Skip to content

Fix worker terminal-state failure misclassification #23977

@alex-solovyev

Description

@alex-solovyev

Goal

Prevent worker redispatch/noise when an interrupted headless worker already reached a terminal external state.

Context

Recent worker failure excerpts showed a worker process could be terminated after the PR had already merged and the linked issue had closed. The local runtime then recorded a failure because it lacked a final completion signal, even though GitHub state was already terminal.

Files

  • .agents/scripts/headless-runtime-worker.sh
  • .agents/scripts/tests/test-headless-runtime-helper.sh

Implementation

  • Before recording worker_failed, check confirmed GitHub terminal state:
    • linked issue is CLOSED
    • PR for current branch is merged
    • merged PR is discoverable by linked issue number
  • If confirmed, release the dispatch claim as worker_complete and skip fast-fail accounting.

Verification

  • bash .agents/scripts/tests/test-headless-runtime-helper.sh
  • shellcheck .agents/scripts/headless-runtime-worker.sh .agents/scripts/tests/test-headless-runtime-helper.sh
  • bash -n .agents/scripts/headless-runtime-worker.sh .agents/scripts/tests/test-headless-runtime-helper.sh
  • git diff --check
  • .agents/scripts/linters-local.sh

aidevops.sh v3.17.28 plugin for OpenCode v1.15.7 with gpt-5.5 spent 3d 18h and 2,985,576 tokens on this with the user in an interactive session.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions