gh-aw icon indicating copy to clipboard operation
gh-aw copied to clipboard

Status comment stays on "started" when the agent calls report_incomplete, because the conclusion step that updates it is skipped

Open johnwilliams-12 opened this issue 2 weeks ago • 0 comments

Summary

With status-comment: true, the activation job posts a status comment such as "has started processing this issue comment". When the run ends, the conclusion job's step "Update reaction comment with completion status" should replace that text with the outcome. If the agent calls report_incomplete, that step never runs, so the comment keeps its "started" text for good, even though the run failed.

The step has no if:, so it has the implicit success(). The step before it, "Handle agent failure", calls core.setFailed for report_incomplete, so Actions skips the update step. The other conclusion steps all use if: always(), and the update script already has wording for failed, timed-out and cancelled runs, so it is meant to run after failures.

I saw this in a private repository: a slash-command workflow whose agent hit its AI credit cap and emitted report_incomplete. The conclusion job showed "Handle agent failure" as failed and "Update reaction comment with completion status" as skipped. The comment was never edited (updated_at equal to created_at).

Verified on release v1.3.0 and on main at cbf8ba5 (2026-11-17).

Reproduction

Scratch repository with one workflow, .github/workflows/repro.md:

---
on:
  slash_command:
    name: repro
    events: [pull_request_comment]
  status-comment: true
permissions:
  contents: read
  pull-requests: read
engine: copilot
---

# Repro

Say hello.
git init && git remote add origin https://github.com/example/repro.git
gh aw compile repro          # v1.3.0, and a build of main at cbf8ba5
awk '/^      - name: (Handle agent failure|Report failed jobs|Update reaction comment with completion status)/{print NR": "$0; getline; print NR": "$0; getline; print NR": "$0}' .github/workflows/repro.lock.yml

Output on v1.3.0:

1451:       - name: Handle agent failure
1452:         id: handle_agent_failure
1453:         if: always()
1512:       - name: Report failed jobs
1513:         id: report_failed_jobs
1514:         if: always()
1531:       - name: Update reaction comment with completion status
1532:         id: conclusion
1533:         uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0

A build of main at cbf8ba5 gives the same shape (lines 1476, 1537 and 1556). The update step has no if: and no continue-on-error, while the two steps before it have if: always().

At run time, an agent that calls report_incomplete makes handle_agent_failure.cjs call core.setFailed. A later step without if: is then skipped by Actions. With if: always() on the update step, it would run and notify_comment_error.cjs would write the failure text. I did not run that fix live in a public repository: doing so needs a Copilot run in which the agent emits report_incomplete. The evidence is the compiled step condition plus Actions step semantics.

Analysis

  • pkg/workflow/notify_comment.go builds the step and only sets a condition when an add_comment safe-output job exists: notify_comment.go#L100-L120. In every other case stepCondition stays empty, and the step builder then emits no if: (safe_outputs_steps.go#L179-L182). The add_comment case uses always() && !(needs.add_comment.outputs.comment_id), so always() was intended there.
  • handle_agent_failure.cjs marks its own step failed on purpose when report_incomplete was emitted, so that optional issue reporting can still run: handle_agent_failure.cjs#L4678-L4682. Any error thrown from that script also fails the step.
  • The two neighbouring conclusion steps already use StepCondition: "always()": notify_comment_conclusion_helpers.go#L566 and #L847.
  • notify_comment_error.cjs maps agent conclusions cancelled, skipped and timed_out to status text, so it is designed to run for failed runs: notify_comment_error.cjs#L98-L113.
  • Plain agent failures are not affected, because handle_agent_failure.cjs does not call core.setFailed for them. That is why the bug only shows with report_incomplete, or when the failure handler itself throws.
  • No test checks the condition of the update step. pkg/workflow/status_comment_decoupling_test.go and pkg/workflow/notify_comment_test.go only check whether the step is present, and notify_comment_test.go pins if: always() only for report_failed_jobs (notify_comment_test.go#L385).
  • No open or closed issue or PR matched searches for "report_incomplete status comment", "status-comment not updated agent failure" or "Update reaction comment with completion status skipped" on 2026-11-17.

Implementation plan

  1. Run the step after failures (pkg/workflow/notify_comment.go): set stepCondition = "always()" by default, and keep always() && !(needs.add_comment.outputs.comment_id) when the add_comment job exists.
  2. Test the condition (pkg/workflow/notify_comment_test.go, next to the report_failed_jobs assertion): for a workflow with status-comment: true, assert the compiled "Update reaction comment with completion status" step has if: always() and comes after "Handle agent failure". Add a case with an add-comment safe output that expects the combined condition. The existing cases in pkg/workflow/status_comment_decoupling_test.go already cover the negative case: with status-comment unset, the step is absent.
  3. Recompile the repository's locks: run make recompile so the committed .lock.yml files pick up the new condition.
  4. Add a changeset (.changeset/): a patch entry such as "Update the status comment when the agent calls report_incomplete or the failure handler fails."
  5. Run make agent-report-progress.

Acceptance criteria

  • A workflow with status-comment: true compiles with if: always() on "Update reaction comment with completion status".
  • A workflow with both status-comment: true and an add-comment safe output compiles with always() && !(needs.add_comment.outputs.comment_id) on that step.
  • After a run in which the agent calls report_incomplete, the status comment no longer reads "started processing" and instead shows the failure text from notify_comment_error.cjs.
  • A workflow with status-comment unset or false still compiles without the step.
  • make agent-report-progress passes.

Suggested labels: bug, workflow

johnwilliams-12 avatar Nov 17 '26 10:11 johnwilliams-12