stage: retry pre-admission harness reach failures and widen repair deadline

Treat a failure to reach the harness before any prompt or tool call is
admitted (connecting or creating the session) as a distinct retryable
reach failure, so a transport blip at the first stage no longer ends a
mutating run; keep post-admission readback/poll/agent failures retried
only on an explicit read-only stage and never replay admitted tool work.
Preserve the true cause when the context is already done (join ctx.Err
with the typed transport error) and report a sanitized unknown provider
error name/status instead of a blanket summary.

Make the isolated format-repair deadline proportional to the stage
timeout (floored, capped and clamped to remaining minus a margin) so a
slow-but-repairable result is recovered without ever extending the stage
deadline; the bounded ladder, value guard, deny-all formatter session,
cumulative usage accounting and no-tool-replay rule are unchanged.

Update docs/model-results.md, docs/pipeline-performance-review.md and the
packaged skill references; add stage, opencode and server fixtures.
This commit is contained in:
2026-10-17 14:51:09 +01:00
parent 5adc961f88
commit 7b72b8f20f
15 changed files with 563 additions and 63 deletions
+14 -9
View File
@@ -20,14 +20,18 @@ Each playbook is *symptom → how to confirm → what to do*.
the model may have done work but no final result was read.
- **Confirm** `inspect --json` shows the category on the failed stage. A request
failure, an active-session poll failure and a final-readback failure all carry this
one category.
one category. A request that failed while the context was still in flight shows
both the sanitized transport detail and `context deadline exceeded`; an execution
error names the sanitized error name/tag and any HTTP status, not a provider body.
- **Do** Treat it as a transport failure, not a task failure. Distinguish a
pre-admission failure (nothing executed) from a post-admission one (tools may have
run). An explicit read-only stage may retry; a stage whose tools include `edit`/
`shell`, or that has no tools block, **never replays admitted work**. Do not re-run
a full agent stage merely to recover a response's formatting. If it recurs, check
the service and harness health (`references/operations.md`); do not weaken the
stage to get past it.
pre-admission reach failure (connecting or creating the session; nothing executed)
from a post-admission one (tools may have run). A pre-admission reach failure
replays nothing, so it is retried automatically within `retries` for any stage; a
post-admission failure is retried only on an explicit read-only stage. A stage
whose tools include `edit`/`shell`, or that has no tools block, **never replays
admitted work**. Do not re-run a full agent stage merely to recover a response's
formatting. If it recurs, check the service and harness health
(`references/operations.md`); do not weaken the stage to get past it.
## Malformed model results
@@ -39,8 +43,9 @@ Each playbook is *symptom → how to confirm → what to do*.
- **Do** Recovery is bounded and work-preserving. A deterministic local pass first
appends missing closers, drops one trailing comma, or inserts the single
comma/colon the parser expected; only if that is ambiguous does one deny-all
formatter request run, with a deadline derived from the payload size and the
attempt's remaining budget. Each path records a `repaired`, `partial` or
formatter request run, with a deadline derived from the payload size, the stage
timeout and the attempt's remaining budget, clamped so it never extends the
stage's own deadline. Each path records a `repaired`, `partial` or
`unrecoverable` status in `format_repairs`; a partial or unrecoverable payload
is never accepted as complete. On an explicit read-only stage a malformed result
may be re-emitted up to `retries`; a stage with `edit`/`shell` or no tools block