Skip to content

fix(run-agent-task): emit an error annotation with the failure reason when an agent task fails - #2641

Merged
chubes4 merged 1 commit into
mainfrom
fix/issue-2637-wp-codebox
Dec 5, 2026
Merged

chubes4 merged 1 commit into
mainfrom
fix/issue-2637-wp-codebox

Conversation

@chubes4

@chubes4 chubes4 commented Dec 5, 2026

Copy link
Copy Markdown
Collaborator

Summary

Before this change, an agent task that failed through the normal result path just set exit code 1. The failure reason was only in the result JSON artifact, so the job log showed nothing but Process completed with exit code 1. Now the step prints one GitHub Actions ::error annotation built from the normalized failure (stage, code, message), so the cause shows up in the run log, the run annotations and failure notifications.

What changed

  • A failed run prints one ::error title=Agent task failed (<stage>)::<code>: <message> line on stdout. It is built from failure, or from projection_error if there is no failure, with a generic fallback.
  • The message is redacted, path-sanitized and capped at 1000 characters. %, CR and LF are escaped as workflow-command data, and the title also escapes : and ,.
  • The thrown-exception path also emits the annotation, using the failure that writeNormalizedFailure now returns. Its existing console.error output stays.
  • The lifecycle test now captures stdout. It checks that successful runs print no annotation, that turn-capped runs print exactly one annotation with the expected stage, code and message, and that the apply-rejection annotation stays on a single line.

Verification

All gates passed on 3386346e4622. Base main: gated on f1871b88cbd8, target now f1871b88cbd8, re-verified: no.

  • HOMEBOY_LINT_BASE=f1871b88cbd864fad990b9212a170434433f36fe homeboy --placement local review lint wp-codebox --path . --…: passed, 111096 ms; retained gate metadata.
  • node tests/execute-native-agent-task-lifecycle.test.mjs: passed, 3791 ms; retained gate evidence.
  • repro: none (no repro gate was declared, so these gates do not prove the issue).
  • CI: pending

Gate 2 output
native agent task lifecycle ok

Cook run
  • Cook ID: agent-task-4e1d5f4c-0c75-40d0-805d-615bfe0e0b6c
  • Attempt run ID: agent-task-4e1d5f4c-0c75-40d0-805d-615bfe0e0b6c-attempt-1-d79c4d6b
  • Gate 1: tree b8b652ebe924e822f7732436ea419a678060f1ce
  • Gate 2: tree b8b652ebe924e822f7732436ea419a678060f1ce

Delivery

  • Delivered: One escaped, length-capped ::error annotation on the non-success path, built from the normalized failure
  • Delivered: Regression assertion in tests/execute-native-agent-task-lifecycle.test.mjs

Evidence

  • Local check: node tests/execute-native-agent-task-lifecycle.test.mjs printed 'native agent task lifecycle ok', including the new annotation assertions for the max-turns and apply-reject cases.
  • Local lint could not run: homeboy reported that the nodejs extension manifest could not be read in this environment. The lint gate result is left to Homeboy.

AI disclosure

Tool: Homeboy Cook. Agent: Homeboy (roadie). Model: roadie · route cook-heavy · served claude-opus-5-5. Cook time: 10m02s.

The AI read the issue, added the annotation helper to execute-native-agent-task.mjs, and extended the lifecycle regression test, under the direction of the Cook requester. Homeboy reports controller verification separately from this account of the AI's work. A human reviews before merge.

Refs #2637

@chubes4
chubes4 marked this pull request as ready for review December 5, 2026 15:32
@chubes4
chubes4 merged commit ecb8eb9 into main Dec 5, 2026
4 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant