Repository navigation
Agent jobs cancelled by engine.concurrency.cancel-in-progress are reported as missing_terminal_safe_output failures (regression since v0.91.x) #69050
Description
Summary
When an agent job gets cancelled because a newer run took its engine.concurrency group (cancel-in-progress: true), the conclusion job still opens a [aw] <Workflow> finished without a terminal safe output failure issue. This is the normal superseded-run case, and v0.89.21 handled it quietly. After we upgraded to v0.91.12, each superseded run opens a failure issue.
Setup
engine:
id: copilot
concurrency:
group: "my-agent-${{ github.event.workflow_run.pull_requests[0].number || github.event.pull_request.number || github.event.workflow_run.head_branch }}"
cancel-in-progress: trueThe workflow runs on workflow_run (build workflows completing on a PR).
What happened
- Run A starts for PR #N, commit 1. Its agent job starts and Copilot begins working.
- A new commit is pushed to PR #N. Run B's agent job joins the same
engine.concurrencygroup and cancels run A's agent job about 20 seconds after the Copilot CLI starts. At that point the agent has emitted no safe output. - Run A's agent job concludes as
cancelled. - The agent job's "Ingest agent output" step (
collect_ndjson_output.cjs) finds no terminal safe output. It callsbuildEmptyOutputOutcome()and adds a synthetic item:{"type":"report_incomplete","reason":"missing_terminal_safe_output","driverExitCode":0, ...}. - The conclusion job's
handle_agent_failure.cjslogsAgent conclusion: cancelled. It sees the syntheticreport_incomplete, setshasReportIncomplete = true, fails the step, and creates the failure issue.
Relevant conclusion-job log:
GH_AW_AGENT_CONCLUSION: cancelled
Agent conclusion: cancelled
Checking for existing issue with precise failure metadata for title: "[aw] … finished without a terminal safe output"
No existing issue found, creating a new one
The issue body also misleads: Driver exit code: 0, Last tool call status: succeeded. The CLI was still running (assistant.turn_start for turn 1 is the last session event) and was killed by the cancellation. It never exited 0.
Expected
A cancelled agent conclusion should not lead to a missing_terminal_safe_output / report_incomplete failure issue, and certainly not when the cancellation came from cancel-in-progress. A newer run supersedes the cancelled one, so no failure occurred.
Regression
- v0.89.21:
collect_ndjson_output.cjsnever addsreport_incomplete.handle_agent_failure.cjssetshasMissingSafeOutputsonly whenagentConclusion === "success". Acancelledrun with empty output therefore reaches the "did not fail … skipping failure handling" early return. - v0.91.12:
empty_output_outcome.cjsarrived in Add privacy-preserving completion evidence to failure reports #68003 and was extended in Clarify privacy-preserving driver and downstream failure diagnostics #68001, Make missing safe-output failure details actionable #68414 and Distinguish pre-agent startup failures from missing terminal outputs #68467. The collector now adds areport_incompleteitem whatever the job conclusion. That item setshasReportIncomplete, which overrides the early return forcancelled. - Still present on v0.92.0 and
main:collect_ndjson_output.cjsL377–379, no conclusion check.
Suggested fix
Either of these would work:
- In
handle_agent_failure.cjs, ignore areport_incompleteitem whosereason === "missing_terminal_safe_output"(or any collector-synthesized one) whenagentConclusion === "cancelled". - Skip the synthetic outcome in the collector when the job is being cancelled. This is harder, because the ingest step runs inside the cancelled job, so doing it in the conclusion job is more reliable.
A regression test should cover: agent conclusion cancelled, the collector-synthesized missing_terminal_safe_output item, and no failure issue created.
Environment
- gh-aw v0.91.12 (compiler and
gh-aw-actions/setup); previously v0.89.21 without this issue - Engine: copilot (CLI 1.0.96)
- Trigger:
workflow_run
Activity