enrich OTel error conclusion spans with agent_output.json error details#24675
Merged
enrich OTel error conclusion spans with agent_output.json error details#24675
Conversation
11 tasks
When GH_AW_AGENT_CONCLUSION is 'failure' or 'timed_out', sendJobConclusionSpan now lazily reads /tmp/gh-aw/agent_output.json and surfaces structured error details as span attributes: - gh-aw.error.count: total number of errors from agent_output.errors[] - gh-aw.error.messages: up to 5 messages joined with ' | ' - statusMessage enriched with first error (truncated to 256 chars) Closes #<issue>" Agent-Logs-Url: https://github.com/github/gh-aw/sessions/f707bf63-0b17-420f-8466-f74e42d8dfe7 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Enrich error conclusion spans with agent_output.json details
enrich OTel error conclusion spans with agent_output.json error details
Apr 5, 2026
Copilot stopped work on behalf of
pelikhan due to an error
April 5, 2026 05:18
Collaborator
|
/q fix live sentry access |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR enriches OTLP job conclusion spans with actionable error details by reading structured errors[] from agent_output.json when the agent fails or times out, improving root-cause visibility in traces.
Changes:
- Lazy-read
/tmp/gh-aw/agent_output.jsononly forfailure/timed_outconclusions and derive span status message + error attributes fromerrors[]. - Add span attributes
gh-aw.error.countandgh-aw.error.messages(capped to 5 messages), and truncate enrichedstatusMessageto 256 chars. - Extend unit tests to cover enrichment behavior and ensure
GH_AW_AGENT_CONCLUSIONenv handling is isolated per test.
Show a summary per file
| File | Description |
|---|---|
| actions/setup/js/send_otlp_span.cjs | Reads agent_output.json on agent failure/timeouts and emits enriched OTLP status/attributes. |
| actions/setup/js/send_otlp_span.test.cjs | Adds test coverage for the new enrichment logic and stabilizes env save/restore for the new env var. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 2/2 changed files
- Comments generated: 0
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
sendJobConclusionSpanemitted only"agent failure"or"agent timed_out"as span status — no root cause. The structurederrors[]array inagent_output.jsonwas already available on disk at conclusion time but never consulted.Changes
actions/setup/js/send_otlp_span.cjs/tmp/gh-aw/agent_output.jsononly whenisAgentFailure(zero I/O overhead on success/cancel)gh-aw.error.count— total error count fromagent_output.errors[]gh-aw.error.messages— up to 5 messages joined with|statusMessagewith the first error, truncated to 256 charsactions/setup/js/send_otlp_span.test.cjsGH_AW_AGENT_CONCLUSIONto env save/restore inbeforeEach/afterEachtimed_outenrichment, 5-entry cap (with full count), 256-char truncation, missing/empty errors array, and no-op on non-failure conclusions