idle-draft: clear attempts on success so forced redos start fresh

Claude-Session: https://claude.ai/code/session_01YQDoWNM7XPPii28khFWoMc
This commit is contained in:
Paul O'Reilly
2026-08-02 21:54:53 +12:00
parent 1f008eebcb
commit ec25f02f01
3 changed files with 67 additions and 6 deletions

View File

@@ -265,7 +265,14 @@ For the selected `(item_or_dossier, work_type, provider)`:
`max_attempts` (2) content failures for that work type, set
`state.items[item].blocked` with a reason (the item is then excluded from all
further dispatch until a human runs `mark unblock`).
- **Exit 0 and validation passes** → success.
- **Exit 0 and validation passes** → success. Clears (deletes, not zeroes)
`state.items[item].attempts[work_type]` if present, and drops `attempts`
entirely if it's now empty — a success following one or more prior content
failures for that work type resets the item's attempt history for that work
type, so a later human-forced redo (deleting the produced file and letting
idle-draft regenerate it) starts fresh rather than already one content
failure from `blocked`. Other work types' counters on the same item are
untouched.
7. Validation (on exit 0, before promotion): the temp output file must be non-empty and
its first non-blank line must be a top-level Markdown heading (`# ...`). For
`research` work type specifically: every absolute path matching `/home/\S+` cited in
@@ -400,6 +407,7 @@ a lighter-touch check); `draft` and `review` carry no `allowed_tools` key.
|---|---|---|---|
| Transient | timeout, HTTP 429/5xx, network reset | not incremented | retried next eligible cycle |
| Content | empty output, missing heading, dead citation path, non-retryable non-zero exit | incremented | `.rejected` kept; `blocked` at `max_attempts` (2) |
| Success | — | cleared (key deleted, `attempts` dropped if now empty) for that work type only | output promoted, committed |
## Exit codes