Merge main (findings ledger, loop continuation) into usage-limit branch

Keeps the findings ledger, extra visits and on_exhausted=decide alongside the
run budget, failure classes, quota parking and error-loop backoff.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-03 14:35:54 +00:00
66 changed files with 3565 additions and 148 deletions
+4 -2
View File
@@ -45,8 +45,10 @@ preserved branch. `failed` and `interrupted` (server stopped mid-run) runs can b
retried: resume reruns the failed or interrupted stage, or starts the next stage
after the last completed one. `canceled` runs need a new run or direct work on
their branch. A retried stage's `input.md` carries a `# Previous attempt` section
(why the last attempt failed) and, with `--input-file`, a `# Operator correction`
section holding only the overridden keys.
(why it failed; partial work under `previous-attempt/`) and, with
`--input-file`, a `# Operator correction`. An exhausted loop continues with
`--extra-visits N [--stage KEY]` (`references/control.md`); `inspect` shows the
findings ledger (`references/format.md`).
## Use an existing pipeline
+17 -1
View File
@@ -33,6 +33,18 @@ Semantics (`internal/server/runner.go`):
route normally. Here, `approved` on visit three succeeds; `rejected` fails.
- A target with a lower cap than the reviewer stops the loop first, so the
reviewer's `on` never fires.
- `on` lists only loop outcomes: validation rejects an outcome whose edge goes
forward (e.g. `success -> write`), since `on` would turn a good result on the
last visit into a failure. Lint also warns when a target's lower cap stops
the loop first and when `limits` sit on a stage no loop re-enters.
- `"on_exhausted":"decide"` (optional `"accept_to":"<stage>|#success|#failure"`,
default `#success`): instead of failing, an exhausted loop (the `on` case or
entering beyond the cap) parks the run on an operator decision and notifies:
`accept` (take the work as is, route to `accept_to`), `continue` (one more
round: one more visit for the stage and the loop target) or `abort`. Answer
with `pipelines decide RUN_ID --option accept|continue|abort` or the apps.
- A failed exhausted run continues with `pipelines retry ID --extra-visits N
[--stage KEY]`.
- `max_visits` accepts 1–5. Every `on` outcome must have a nonterminal edge.
Human stages are exempt from visit caps. The global 30-step and
five-visits-per-stage limits always apply.
@@ -58,6 +70,10 @@ Claude accounts or parks in `waiting_quota` (`references/debugging.md`).
Visit count, limit decision and original target are retained in `inspect --json`.
Turn memory is run-local: there is no cross-run memory or hidden replay, and
retries start fresh except for the completed prefix a resume carries. Accumulated
retries start fresh except for the completed prefix, the findings ledger and the
failed visit's partial work (`previous-attempt/`) a resume carries. Reviewers
should reference ledger IDs (`references/format.md`, Findings ledger) rather
than restate earlier findings, and a findings gate (`type=findings`) can
replace a model triage stage. Accumulated
turn content is untrusted data; a fresh session does not prove semantic
independence.
+65 -3
View File
@@ -54,9 +54,13 @@ Each visit gets `input.md`, `memory.md`, `history.md`, `output.md` and `private/
in `<run>/stages/<seq>-<stage>/`, plus the run-level shared `public/` addressed by
its absolute path.
- `memory.md` (capped at 4 KB, always inlined in the prompt): the run task, the
previous stage's `# handoff` with its outcome and `public/` additions, a
one-line-per-stage outcome ledger and the server-captured changed files.
- `memory.md` (about 20 KB, always inlined in the prompt), in priority order:
the run task (never truncated), the previous stage's `# handoff` with its
outcome and `public/` additions, the open findings ledger, this stage's own
previous handoff, a one-line-per-stage outcome ledger and the server-captured
changed files. Lower-priority sections shrink first.
- `findings.md`: the run's whole findings ledger with every status change
(written when the run has one).
- `input.md`: the run task, plus on later turns the previous turn's full output
(`internal/turn/render.go`). A stage with `read` reads it on demand; a stage
without `read` gets it inlined (up to 32 KB) on every call, so give `read` to
@@ -96,6 +100,60 @@ The `{ "outcome": ..., "output": ... }` JSON envelope and its format-repair ladd
are retired: never ask for JSON fields or invent server sections. Missing tools or
evidence route to `blocked` when declared, else `error`; never fabricate a result.
## Findings ledger
The runner keeps one findings ledger per run and shows it to every later visit
(open items in `memory.md`, everything in `findings.md`), in `inspect` and in
the app's Findings tab. Any model stage may add an optional `# findings`
section to `output.md`, one item per line:
````markdown
# findings
- important introduced internal/cache.go:42: eviction never runs
- nit pre-existing -: helper names are inconsistent
- F3 fixed: evict on write; test added
- F4 dismissed: intended behaviour, documented in README
- F5 settled: operator accepted the trade-off
- F2 open: the fix misses the error path
````
A new finding is `<severity> <origin> <file:line or ->: <summary>` with
severity `critical`, `important`, `minor` or `nit` and origin `introduced` or
`pre-existing`. The runner assigns stable IDs (`F1`, `F2`, ...). A status line
is `<id> fixed|dismissed|settled|open: <reason>`. Dismissed and settled items
are closed for good: re-raising one (same location and summary) or reopening it
is ignored; re-raising a fixed one reopens it. Prompts need not restate this
syntax (the runner explains it); tell reviewers to reference IDs and to raise
only new problems.
Route on the ledger mechanically with a findings gate instead of a model
triage stage:
````markdown
# stage triage
```configs
type=findings
severity=important
origin=introduced
```
```limits
{"max_visits":3}
```
```edges
open -> implement
clear -> land
```
````
The outcome is `open` when any open finding has at least `severity` (default
`important`) and the given `origin` (default `introduced`; `pre-existing` or
`any`), otherwise `clear`. No model runs. Only `open`, `clear` and `error`
edges are allowed.
## Configs
- `provider`/`model`: exact IDs validated during server setup. Templates
@@ -122,6 +180,10 @@ evidence route to `blocked` when declared, else `error`; never fabricate a resul
check stage.
- `allow_workspace_changes=true`: lets a stage with `shell` but no `edit` leave file changes
in the run directory (below).
- `resume_session=true`: on a loop visit, resume this stage's previous harness
session instead of starting a cold one (Claude harness only; others start
fresh; a session Claude Code no longer has starts fresh). Use it for
implementers that re-enter after review; keep reviewers fresh.
- `auto_skip=false`: disable the server skip fallback for a stage that declares a
`skipped` edge (`references/operations.md`, Server skip fallback).