fix(otlp): derive gh-aw.run.status and status.code from output errors when conclusion env var is absent#33037
Merged
pelikhan merged 2 commits intoMay 18, 2026
Conversation
7 tasks
…nv var is absent When GH_AW_AGENT_CONCLUSION and workflowRunConclusion are both empty (e.g. in the agent job's own post-step where needs.<job>.result is not visible), fall back to outputErrors from agent_output.json to set gh-aw.run.status, status.code and statusMessage accurately. - Change `const statusCode` to `let statusCode` to allow later update - After the rawRunStatus block, add fallback: if rawRunStatus is empty and outputErrors.length > 0, set runStatus="failure", statusCode=2, and statusMessage from the first error message - Add four new tests covering: fallback fires, statusMessage content, explicit "success" conclusion not overridden, and no-error path stays OK Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Improve OTel status reporting from observable failure signals
fix(otlp): derive gh-aw.run.status and status.code from output errors when conclusion env var is absent
May 18, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a bug where conclusion spans always reported gh-aw.run.status=success and STATUS_CODE_OK even on failed runs, because GH_AW_AGENT_CONCLUSION is empty in the agent job's own post-step (a job can't read its own needs.<job>.result). When no explicit conclusion signal is available, the code now falls back to observable evidence in agent_output.json errors.
Changes:
- In
sendJobConclusionSpan, when bothGH_AW_AGENT_CONCLUSIONandworkflowRunConclusionare absent butoutputErrors.length > 0, setrunStatus="failure",statusCode=2, and a truncatedstatusMessagederived from the first error. - Promote
statusCodefromconsttoletso the fallback branch can update it. - Add four unit tests covering: fallback firing, first-error selection for
statusMessage, no override whenGH_AW_AGENT_CONCLUSION=success, and no-error path stayingsuccess/OK.
Show a summary per file
| File | Description |
|---|---|
| actions/setup/js/send_otlp_span.cjs | Adds error-based fallback for runStatus/statusCode/statusMessage when no conclusion env var is present. |
| actions/setup/js/send_otlp_span.test.cjs | New test block covering the fallback behavior and its boundaries. |
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
pelikhan
approved these changes
May 18, 2026
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.
gh-aw.run.statusandstatus.codewere hardcoded to"success"/STATUS_CODE_OKon every conclusion span becauseGH_AW_AGENT_CONCLUSIONis empty in the agent job's own post-step — a job cannot observe its ownneeds.<job>.result. The result: every span in Tempo reported success even on genuinely failed runs, making failure-based alerting and dashboards useless.Changes
send_otlp_span.cjs— after readingagent_output.json, ifrawRunStatusis empty (bothGH_AW_AGENT_CONCLUSIONandworkflowRunConclusionabsent) andoutputErrors.length > 0, fall back to observable evidence:statusCodechanged fromconsttoletto allow the late update.send_otlp_span.test.cjs— four new tests in a"run.status fallback from observable error signals"block: fallback fires correctly;statusMessageuses first error; explicitGH_AW_AGENT_CONCLUSION=successis not overridden; no-error path remainssuccess/OK.