From 9827d90ef92f126a382bcde68c1478bca4e20f0f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 5 Apr 2026 03:04:28 +0000 Subject: [PATCH 1/2] chore: plan OTLP span name improvements Agent-Logs-Url: https://github.com/github/gh-aw/sessions/dbbf08d1-3791-4538-9e1c-c1ef392a1c7e Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- .github/workflows/hourly-ci-cleaner.lock.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/hourly-ci-cleaner.lock.yml b/.github/workflows/hourly-ci-cleaner.lock.yml index fd08d159a83..4896629747e 100644 --- a/.github/workflows/hourly-ci-cleaner.lock.yml +++ b/.github/workflows/hourly-ci-cleaner.lock.yml @@ -728,9 +728,9 @@ jobs: run: | set -o pipefail # Extract markdown body from custom agent file (skip frontmatter) - AGENT_CONTENT="$(awk 'NR==1 && /^---$/ { in_frontmatter=1; next } in_frontmatter && /^---$/ { in_frontmatter=0; next } !in_frontmatter { print }' "${GITHUB_WORKSPACE}/.github/agents/ci-cleaner.agent.md")" - # Combine agent content with prompt - PROMPT_TEXT="$(printf '%s\n\n%s' "$AGENT_CONTENT" "$(cat /tmp/gh-aw/aw-prompts/prompt.txt)")" + AGENT_CONTENT="$(awk 'BEGIN{skip=1} /^---$/{if(skip){skip=0;next}else{skip=1;next}} !skip' "${GITHUB_WORKSPACE}/.github/agents/ci-cleaner.agent.md")" + # Combine agent content with prompt + PROMPT_TEXT="$(printf '%s\n\n%s' "$AGENT_CONTENT" "$(cat /tmp/gh-aw/aw-prompts/prompt.txt)")" touch /tmp/gh-aw/agent-step-summary.md # shellcheck disable=SC1003 sudo -E awf --container-workdir "${GITHUB_WORKSPACE}" --mount "${RUNNER_TEMP}/gh-aw:${RUNNER_TEMP}/gh-aw:ro" --mount "${RUNNER_TEMP}/gh-aw:/host${RUNNER_TEMP}/gh-aw:ro" --tty --env-all --exclude-env ANTHROPIC_API_KEY --exclude-env GITHUB_MCP_SERVER_TOKEN --exclude-env MCP_GATEWAY_API_KEY --mount /opt/hostedtoolcache/go:/opt/hostedtoolcache/go:ro --mount /usr/bin/go:/usr/bin/go:ro --mount /usr/bin/make:/usr/bin/make:ro --mount /usr/local/bin/node:/usr/local/bin/node:ro --mount /usr/local/bin/npm:/usr/local/bin/npm:ro --mount /usr/local/lib/node_modules:/usr/local/lib/node_modules:ro --allow-domains '*.githubusercontent.com,anthropic.com,api.anthropic.com,api.github.com,api.snapcraft.io,archive.ubuntu.com,azure.archive.ubuntu.com,cdn.playwright.dev,codeload.github.com,crl.geotrust.com,crl.globalsign.com,crl.identrust.com,crl.sectigo.com,crl.thawte.com,crl.usertrust.com,crl.verisign.com,crl3.digicert.com,crl4.digicert.com,crls.ssl.com,files.pythonhosted.org,ghcr.io,github-cloud.githubusercontent.com,github-cloud.s3.amazonaws.com,github.com,go.dev,golang.org,goproxy.io,host.docker.internal,json-schema.org,json.schemastore.org,keyserver.ubuntu.com,lfs.github.com,objects.githubusercontent.com,ocsp.digicert.com,ocsp.geotrust.com,ocsp.globalsign.com,ocsp.identrust.com,ocsp.sectigo.com,ocsp.ssl.com,ocsp.thawte.com,ocsp.usertrust.com,ocsp.verisign.com,packagecloud.io,packages.cloud.google.com,packages.microsoft.com,pkg.go.dev,playwright.download.prss.microsoft.com,ppa.launchpad.net,proxy.golang.org,pypi.org,raw.githubusercontent.com,registry.npmjs.org,s.symcb.com,s.symcd.com,security.ubuntu.com,sentry.io,statsig.anthropic.com,storage.googleapis.com,sum.golang.org,ts-crl.ws.symantec.com,ts-ocsp.ws.symantec.com,www.googleapis.com' --log-level info --proxy-logs-dir /tmp/gh-aw/sandbox/firewall/logs --audit-dir /tmp/gh-aw/sandbox/firewall/audit --enable-host-access --image-tag 0.25.13 --skip-pull --enable-api-proxy \ @@ -1197,7 +1197,7 @@ jobs: touch /tmp/gh-aw/agent-step-summary.md # shellcheck disable=SC1003 sudo -E awf --container-workdir "${GITHUB_WORKSPACE}" --mount "${RUNNER_TEMP}/gh-aw:${RUNNER_TEMP}/gh-aw:ro" --mount "${RUNNER_TEMP}/gh-aw:/host${RUNNER_TEMP}/gh-aw:ro" --tty --env-all --exclude-env ANTHROPIC_API_KEY --allow-domains '*.githubusercontent.com,anthropic.com,api.anthropic.com,api.github.com,api.snapcraft.io,archive.ubuntu.com,azure.archive.ubuntu.com,cdn.playwright.dev,codeload.github.com,crl.geotrust.com,crl.globalsign.com,crl.identrust.com,crl.sectigo.com,crl.thawte.com,crl.usertrust.com,crl.verisign.com,crl3.digicert.com,crl4.digicert.com,crls.ssl.com,files.pythonhosted.org,ghcr.io,github-cloud.githubusercontent.com,github-cloud.s3.amazonaws.com,github.com,host.docker.internal,json-schema.org,json.schemastore.org,keyserver.ubuntu.com,lfs.github.com,objects.githubusercontent.com,ocsp.digicert.com,ocsp.geotrust.com,ocsp.globalsign.com,ocsp.identrust.com,ocsp.sectigo.com,ocsp.ssl.com,ocsp.thawte.com,ocsp.usertrust.com,ocsp.verisign.com,packagecloud.io,packages.cloud.google.com,packages.microsoft.com,playwright.download.prss.microsoft.com,ppa.launchpad.net,pypi.org,raw.githubusercontent.com,registry.npmjs.org,s.symcb.com,s.symcd.com,security.ubuntu.com,sentry.io,statsig.anthropic.com,ts-crl.ws.symantec.com,ts-ocsp.ws.symantec.com' --log-level info --proxy-logs-dir /tmp/gh-aw/sandbox/firewall/logs --audit-dir /tmp/gh-aw/sandbox/firewall/audit --enable-host-access --image-tag 0.25.13 --skip-pull --enable-api-proxy \ - -- /bin/bash -c 'export PATH="$(find /opt/hostedtoolcache -maxdepth 4 -type d -name bin 2>/dev/null | tr '\''\n'\'' '\'':'\'')$PATH"; [ -n "$GOROOT" ] && export PATH="$GOROOT/bin:$PATH" || true && claude --print --disable-slash-commands --no-chrome --allowed-tools Bash,BashOutput,ExitPlanMode,Glob,Grep,KillBash,LS,NotebookRead,Read,Task,TodoWrite --debug-file /tmp/gh-aw/threat-detection/detection.debug.log --verbose --permission-mode bypassPermissions --output-format stream-json "$(cat /tmp/gh-aw/aw-prompts/prompt.txt)"${GH_AW_MODEL_DETECTION_CLAUDE:+ --model "$GH_AW_MODEL_DETECTION_CLAUDE"}' 2>&1 | tee -a /tmp/gh-aw/threat-detection/detection.log + -- /bin/bash -c 'export PATH="$(find /opt/hostedtoolcache -maxdepth 4 -type d -name bin 2>/dev/null | tr '\''\n'\'' '\'':'\'')$PATH"; [ -n "$GOROOT" ] && export PATH="$GOROOT/bin:$PATH" || true && claude --print --disable-slash-commands --no-chrome --allowed-tools Bash,BashOutput,ExitPlanMode,Glob,Grep,KillBash,LS,NotebookRead,Read,Task,TodoWrite --debug-file /tmp/gh-aw/threat-detection/detection.log --verbose --permission-mode bypassPermissions --output-format stream-json "$(cat /tmp/gh-aw/aw-prompts/prompt.txt)"${GH_AW_MODEL_DETECTION_CLAUDE:+ --model "$GH_AW_MODEL_DETECTION_CLAUDE"}' 2>&1 | tee -a /tmp/gh-aw/threat-detection/detection.log env: ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} BASH_DEFAULT_TIMEOUT_MS: 60000 From fd8473ed4005935aa46669e6c7d20e51abb41aea Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 5 Apr 2026 03:14:50 +0000 Subject: [PATCH 2/2] fix: use actual job name in OTLP span names (gh-aw..setup/conclusion) Agent-Logs-Url: https://github.com/github/gh-aw/sessions/dbbf08d1-3791-4538-9e1c-c1ef392a1c7e Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- actions/setup/action.yml | 4 ++-- actions/setup/index.js | 2 +- actions/setup/js/action_conclusion_otlp.cjs | 8 ++++---- actions/setup/js/action_otlp.test.cjs | 2 +- actions/setup/js/action_setup_otlp.cjs | 2 +- actions/setup/js/send_otlp_span.cjs | 5 +++-- actions/setup/js/send_otlp_span.test.cjs | 3 +-- actions/setup/post.js | 2 +- 8 files changed, 14 insertions(+), 14 deletions(-) diff --git a/actions/setup/action.yml b/actions/setup/action.yml index 8f32cb2503c..fe7ff75aa04 100644 --- a/actions/setup/action.yml +++ b/actions/setup/action.yml @@ -11,7 +11,7 @@ inputs: required: false default: 'false' job-name: - description: 'Name of the job being set up. When OTEL_EXPORTER_OTLP_ENDPOINT is configured, a gh-aw.job.setup span is pushed to the OTLP endpoint.' + description: 'Name of the job being set up. When OTEL_EXPORTER_OTLP_ENDPOINT is configured, a gh-aw..setup span is pushed to the OTLP endpoint.' required: false default: '' trace-id: @@ -23,7 +23,7 @@ outputs: files_copied: description: 'Number of files copied' trace-id: - description: 'The OTLP trace ID used for the gh-aw.job.setup span. Pass this to subsequent job setup steps via the trace-id input to correlate all job spans under a single trace.' + description: 'The OTLP trace ID used for the gh-aw..setup span. Pass this to subsequent job setup steps via the trace-id input to correlate all job spans under a single trace.' runs: using: 'node24' diff --git a/actions/setup/index.js b/actions/setup/index.js index 34284e093fc..d7e96af5aef 100644 --- a/actions/setup/index.js +++ b/actions/setup/index.js @@ -43,7 +43,7 @@ if (result.status !== 0) { process.exit(result.status ?? 1); } -// Send a gh-aw.job.setup span to the OTLP endpoint when configured. +// Send a gh-aw..setup span to the OTLP endpoint when configured. // Delegates to action_setup_otlp.cjs so that script mode (setup.sh) and // dev/release mode share the same implementation. // Explicitly set INPUT_TRACE_ID (normalized above) so action_setup_otlp.cjs diff --git a/actions/setup/js/action_conclusion_otlp.cjs b/actions/setup/js/action_conclusion_otlp.cjs index 0c473154ecb..c297b349fd4 100644 --- a/actions/setup/js/action_conclusion_otlp.cjs +++ b/actions/setup/js/action_conclusion_otlp.cjs @@ -4,8 +4,8 @@ /** * action_conclusion_otlp.cjs * - * Sends a gh-aw.job.conclusion OTLP span (or a span named after the current - * job). Used by both: + * Sends a `gh-aw..conclusion` OTLP span (or `gh-aw.job.conclusion` + * when no job name is configured). Used by both: * * - actions/setup/post.js (dev/release/action mode) * - actions/setup/clean.sh (script mode) @@ -14,7 +14,7 @@ * * Environment variables read: * INPUT_JOB_NAME – job name from the `job-name` action input; when set the - * span is named "gh-aw.job.", otherwise + * span is named "gh-aw..conclusion", otherwise * "gh-aw.job.conclusion". * GITHUB_AW_OTEL_TRACE_ID – parent trace ID (set by action_setup_otlp.cjs) * GITHUB_AW_OTEL_PARENT_SPAN_ID – parent span ID (set by action_setup_otlp.cjs) @@ -35,7 +35,7 @@ async function run() { return; } - const spanName = process.env.INPUT_JOB_NAME ? `gh-aw.job.${process.env.INPUT_JOB_NAME}` : "gh-aw.job.conclusion"; + const spanName = process.env.INPUT_JOB_NAME ? `gh-aw.${process.env.INPUT_JOB_NAME}.conclusion` : "gh-aw.job.conclusion"; console.log(`[otlp] sending conclusion span "${spanName}" to ${endpoint}`); const { sendJobConclusionSpan } = require(path.join(__dirname, "send_otlp_span.cjs")); diff --git a/actions/setup/js/action_otlp.test.cjs b/actions/setup/js/action_otlp.test.cjs index 03db5280587..45243f6e61e 100644 --- a/actions/setup/js/action_otlp.test.cjs +++ b/actions/setup/js/action_otlp.test.cjs @@ -173,7 +173,7 @@ describe("action_conclusion_otlp run()", () => { const payload = JSON.parse(capturedBody); const spanName = payload?.resourceSpans?.[0]?.scopeSpans?.[0]?.spans?.[0]?.name; - expect(spanName).toBe("gh-aw.job.agent"); + expect(spanName).toBe("gh-aw.agent.conclusion"); fetchSpy.mockRestore(); }); diff --git a/actions/setup/js/action_setup_otlp.cjs b/actions/setup/js/action_setup_otlp.cjs index bd9c1bcc3da..3e9151c2ab0 100644 --- a/actions/setup/js/action_setup_otlp.cjs +++ b/actions/setup/js/action_setup_otlp.cjs @@ -4,7 +4,7 @@ /** * action_setup_otlp.cjs * - * Sends a gh-aw.job.setup OTLP span and writes the trace/span IDs to + * Sends a `gh-aw..setup` OTLP span and writes the trace/span IDs to * GITHUB_OUTPUT and GITHUB_ENV. Used by both: * * - actions/setup/index.js (dev/release/action mode) diff --git a/actions/setup/js/send_otlp_span.cjs b/actions/setup/js/send_otlp_span.cjs index fb071f9d5b4..29701e72cdb 100644 --- a/actions/setup/js/send_otlp_span.cjs +++ b/actions/setup/js/send_otlp_span.cjs @@ -281,7 +281,8 @@ function isValidSpanId(id) { */ /** - * Send a `gh-aw.job.setup` span to the configured OTLP endpoint. + * Send a `gh-aw..setup` span (or `gh-aw.job.setup` when no job name + * is configured) to the configured OTLP endpoint. * * This is designed to be called from `actions/setup/index.js` immediately after * the setup script completes. It always returns `{ traceId, spanId }` so callers @@ -363,7 +364,7 @@ async function sendJobSetupSpan(options = {}) { const payload = buildOTLPPayload({ traceId, spanId, - spanName: "gh-aw.job.setup", + spanName: jobName ? `gh-aw.${jobName}.setup` : "gh-aw.job.setup", startMs, endMs, serviceName, diff --git a/actions/setup/js/send_otlp_span.test.cjs b/actions/setup/js/send_otlp_span.test.cjs index 16ebc122c2f..6638c7579ff 100644 --- a/actions/setup/js/send_otlp_span.test.cjs +++ b/actions/setup/js/send_otlp_span.test.cjs @@ -615,8 +615,7 @@ describe("sendJobSetupSpan", () => { const body = JSON.parse(init.body); const span = body.resourceSpans[0].scopeSpans[0].spans[0]; - expect(span.name).toBe("gh-aw.job.setup"); - // Span traceId and spanId must match the returned values + expect(span.name).toBe("gh-aw.agent.setup"); expect(span.traceId).toBe(traceId); expect(span.spanId).toBe(spanId); diff --git a/actions/setup/post.js b/actions/setup/post.js index d8445ae5881..6fbd548221e 100644 --- a/actions/setup/post.js +++ b/actions/setup/post.js @@ -16,7 +16,7 @@ const fs = require("fs"); // Wrap everything in an async IIFE so that the OTLP span is fully sent before // the cleanup deletes /tmp/gh-aw/ (which contains aw_info.json and otel.jsonl). (async () => { - // Send a gh-aw.job.conclusion span to the configured OTLP endpoint, if any. + // Send a gh-aw..conclusion span to the configured OTLP endpoint, if any. // Delegates to action_conclusion_otlp.cjs so that script mode (clean.sh) and // dev/release mode share the same implementation. Non-fatal: errors are // handled inside sendJobConclusionSpan via console.warn.