run-spec-error-handling
What /run-spec does when a task goes wrong — classify real versus bookkeeping-only failures, the three-attempt retry ladder with failure digests, lost and stalled workers, blocked and maintainer tasks, deadlock and cycles, and when the run stops
- License 许可
- Apache-2.0
- 最近更新
- 2026-11-10
- Stars
- ★ 0
- Forks
- 1
01 前言 Front Matter
- name
- run-spec-error-handling
- description
- What /run-spec does when a task goes wrong — classify real versus bookkeeping-only failures, the three-attempt retry ladder with failure digests, lost and stalled workers, blocked and maintainer tasks, deadlock and cycles, and when the run stops
- argument-hint
- <spec-name> --task N
03 SKILL.md 正文
Run Spec — Error Handling
A failed task is classified before anything is re-dispatched, because the cheapest correct response differs by class, and a wrong class wastes an attempt or merges broken work.
Input
$ARGUMENTS: the spec and the task. /run-spec reads this page inline.
Invocation contexts
- Slash command: classifies the named task's last result and prints the next action.
- Model-invoked: the same.
- Non-interactive: the same. Every escalation stops the run with the stop report (
/run-spec-completion); nothing waits for an answer.
Classes
| Class | Signal | Response | Costs an attempt |
|---|---|---|---|
| Real failure | acceptance re-run fails, gates red, code absent, or the worker reported blocked on its own defect |
retry ladder | yes |
| Bookkeeping-only | code, tests and acceptance verified; only the entry, hand-off, report or markers are wrong | fix it through the worker (below) | no |
| Lost | the Agent call returned nothing, or no report and no branch | look before retrying (below) | yes, once confirmed |
| Stalled | the worker says it is waiting on something | resume it with the evidence (below) | no |
| Blocked on a decision | blocked with a question the spec does not answer |
stop: escalation | no |
| Not-ready after review | three review rounds (/run-spec-worktree-merge) |
stop: escalation | no |
Record each classification: python3 scripts/harness/runspec.py event --spec <spec> --kind fail --task <N> --attempt <K> --detail "<class>: <one line>".
Retry ladder
At most three attempts per task, each a fresh agent of the same Domain/agent:
- Attempt 1: the first-attempt template.
- Attempt 2: the retry template with the attempt-1 digest.
- Attempt 3: the retry template with both digests.
The digest is at most ten lines: the error class, the failing check with its exact failing lines (at most three), what was tried, the pull request and branch if any, and a one-line hypothesis. It comes from the verification output and the fail event, never from pasted logs. A pull request an earlier attempt opened is continued, not duplicated. After the third failure the run stops: escalation. Budgets never grow on retry; a task that keeps overrunning is re-tiered in tasks.md by a spec change.
Bookkeeping-only
The work is right; only its record is not. First, SendMessage the same worker with the bookkeeping-fix template (/run-spec-dispatch): it has the context to write the entry and hand-off correctly. When the worker cannot be resumed:
- Dispatch
completion-clerk(noeffort) with the worktree path, the task number and the facts it may not recompute: the pull request number, the commit SHAs, the files the pull request changes (gh pr view <pr> --json files), the deviations and the gate lines you observed. It edits only the task's entry. - Fill the hand-off section yourself from the verified diff, or mark it
- No hand-off recorded; see the pull request.when there is nothing a dependent needs. - In the worktree, refresh and commit:
(cd <worktree> && scripts/harness/gate.sh all), thengit -C <worktree> commit -s -m "docs(spec): <alias> task <N> completion entry" -- specs/in-progress/<spec>/tasks.md specs/in-progress/<spec>/handoff.mdandgit -C <worktree> push origin <branch>.
At most one bookkeeping fix per task; a second means a real failure.
Lost and stalled workers
- Lost. A dispatch that came back empty is unknown, not failed. Before retrying, look:
gh pr list --state all --search '"<alias> task <N>" in:title' --json number,title,headRefName --jq '.[] | select(.title | endswith("(<alias> task <N>)"))'andgit ls-remote origin '<type>/<alias>-t<N>'. A pull request or branch means the work happened: verify it as a return (/run-specPhase 2 step 3) and recordreturn. Nothing at all: recordlost, then retry. - Stalled. A worker that ends its turn "waiting for" a command, CI or a notification is not failed. A subagent is never notified when its own background command ends. Check the evidence (the branch, the pull request's checks, the gate markers in its worktree), then
SendMessagethe same worker with what you found and the remaining steps, restating that every command runs in the foreground. Never dispatch a duplicate while the first worker can still be resumed. - Long-running. The Agent tool cannot abort a worker. One that has not returned an hour after dispatch is checked the same way; if it is still working, let it finish and report the overrun.
Blocked and maintainer tasks
- A task with a
Blockedfield is skipped and listed in the report; its dependants cannot start. - A
maintainertask is the operator's. Hand it over with its acceptance criteria when it becomes ready, and continue with every task that does not depend on it.
Deadlock and cycles
runspec.py status reports deadlock: true when tasks remain, none is ready and none is in flight, and cycle: true for a dependency cycle. Either stops the run. The report names each stuck task with the dependencies it waits on and why each is not complete (blocked, maintainer, failed, not merged). Pass every task with an open pull request as --in-flight: a pull request waiting on review or bookkeeping is progress, and must never read as a deadlock.
Output
The class, the event recorded and the next action: retry attempt K, resume worker <id>, bookkeeping fix, or STOP: <escalation> — <reason>.
04 同仓库更多 Skills
mythhelm-deliver-backlog
Coordinate a MYTHHELM backlog run with the shared stage checks and maintainer checkpoints.
mythhelm-bootstrap
Orient a Grok Build session in the MYTHHELM repository before task or spec work.
vendor-consult
Run one advisory stage consult (premise-ground, spec-validate, task-review, change-review, stuck-oracle, dossier) with an optional external vendor, then adjudicate the answer at its anchors
update-docs
Bring README, docs/, knowledge/, WORKFLOW.md and CLAUDE.md in line with what a shipped spec or a merged change actually did — find every statement the change made stale, fix it where readers look, and add only the new facts they need
triage
Score an idea or a GitHub issue against the master spec's stages, gates and commitments, check it for duplicates, and recommend whether it becomes a backlog card; read-only
test-driven-development
Red-green-refactor for Go — use when implementing any feature, bug fix or behaviour change, before writing implementation code