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.
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.shImplementation
worker_failed, check confirmed GitHub terminal state:CLOSEDworker_completeand skip fast-fail accounting.Verification
bash .agents/scripts/tests/test-headless-runtime-helper.shshellcheck .agents/scripts/headless-runtime-worker.sh .agents/scripts/tests/test-headless-runtime-helper.shbash -n .agents/scripts/headless-runtime-worker.sh .agents/scripts/tests/test-headless-runtime-helper.shgit diff --check.agents/scripts/linters-local.shaidevops.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.