Runs park on usage limits; failure classes, harness error policy, run budgets
- A stage refused for a Claude usage limit no longer fails its run: the runner tries the chats' Claude account auto-switch (per-home setting) and reruns the visit, else parks the run in the new waiting_quota status (persisted, with reset/resume time in run summaries, details and events) and resumes the same visit at reset + 1 min, also after a restart. resume_run / `pipelines resume` resumes now; cancel works on parked runs. The rerun visit gets a "# Previous attempt" interruption note. Subscription limits no longer say "top up the provider account". - run/retry into an account known to be limited are deferred (quota_policy defer/refuse/now; CLI refuses under --json/--yes unless --defer or --now). - failure_class on runs (quota, loop_exhausted, timeout, permission_denied, harness_error, blocked, environment, canceled, interrupted, budget, check_failed, other) in RunSummary/RunDetail/events, CLI inspect/runs/wait/ stats and the app failure line. - Claude permission denials (permission_denials / refused tool results) fail a blocked visit with permission_denied naming the tool use. - Harness failures are classified transient vs deterministic; deterministic ones (and a repeated empty readback) skip error self-loops; transient self-loops back off 15 s, 1 min, 4 min. - Whole-run USD budget: run --budget, server default (run-budget / get/set_run_settings); 80% warning notification, stop with class budget. - App: waiting_quota status/filter with resume time, Resume now and Cancel, failure class wording. Docs and skill references updated. Merges main (check stage, delivery gate, Claude stage restart survival, schedule changes). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -47,6 +47,15 @@ transient environment or tooling problem, keeping `blocked -> #failure` for a
|
||||
criterion that genuinely cannot be met; that self-loop needs `limits` on the
|
||||
implementer, e.g. `{"max_visits":5,"on":["blocked_retryable"]}`.
|
||||
|
||||
Error edges are runner-policed too. A stage error that would fail the same way
|
||||
again goes to `#failure` instead of following `error -> <same stage>`: a
|
||||
deterministic harness failure (authentication, an invalid argument or model, a
|
||||
configuration the harness refuses), a tool permission denial, a spent run budget,
|
||||
or the same empty-readback failure twice in a row. A transient one (network,
|
||||
5xx/overloaded, timeouts) follows the self-loop after a backoff of 15 s, then 1 min,
|
||||
then 4 min. A provider usage limit never follows the error edge: the run switches
|
||||
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
|
||||
|
||||
@@ -10,6 +10,37 @@
|
||||
4. Verify the repair with a focused regression; run broader checks once relevant
|
||||
inputs settle. Do not raise retry/time budgets to hide a reproducible defect.
|
||||
|
||||
Read the run's `failure_class` first (in `inspect`, `runs`, `wait` and the app's
|
||||
failure line; `stats` counts them):
|
||||
|
||||
| class | meaning and next action |
|
||||
|---|---|
|
||||
| `quota` | provider usage/balance refused; a Claude window parks instead (below), so this means an exhausted paid balance or a failed park |
|
||||
| `loop_exhausted` | a stage's visit limit or the 30-step cap; fix the cause the loop kept hitting |
|
||||
| `timeout` | a stage attempt ran past its `timeout`; check whether work landed before raising it |
|
||||
| `permission_denied` | the stage's tool use was refused (named in the diagnostic) and it gave up; widen `tools`/write paths or change the task |
|
||||
| `harness_error` | the harness failed (transport, readback, cleanup); a deterministic one was not looped |
|
||||
| `blocked` | a stage deliberately routed to `#failure` (its own outcome); read its handoff |
|
||||
| `environment` | harness missing or signed out, workspace/env/delivery access problems |
|
||||
| `budget` | the run's `--budget`/default run budget (or a stage budget) was spent |
|
||||
| `check_failed` | a verification target or delivery gate check failed |
|
||||
| `canceled`, `interrupted`, `other` | operator cancel, server stop, anything else |
|
||||
|
||||
A Claude stage refused for a usage limit is never failed and never retried into
|
||||
the limit. The server first switches the Claude home to another saved account
|
||||
with usage left (when that home's auto-switch is on) and runs the visit again;
|
||||
otherwise the run is parked in `waiting_quota` with `quota_wait.resets_at`/
|
||||
`resume_at` and resumes the same visit a minute after the reset, also after a
|
||||
restart. The visit that runs again is told in `# Previous attempt` that it was
|
||||
interrupted and that partial edits may be in the worktree. Do not retry or cancel a
|
||||
parked run to "unstick" it: `pipelines wait ID` waits through it,
|
||||
`pipelines resume ID --yes` resumes it now (only when the limit is known to be
|
||||
lifted) and `pipelines cancel ID --yes` stops it. While an account is known to be
|
||||
limited, `run`/`retry` under `--json`/`--yes` are refused with the reset time;
|
||||
pass `--defer` to queue the run for the reset or `--now` only when you know the
|
||||
limit is gone. A run's `--budget USD` (or the server's `pipelines run-budget`)
|
||||
warns at 80% and stops at 100% with class `budget`.
|
||||
|
||||
`pipelines retry ID --yes --json` resumes the failed stage; `--stage KEY [--visit N]` picks a
|
||||
recorded stage, `--input-file FILE|-` merges a bounded JSON correction (shown to
|
||||
the stage as `# Operator correction`), `--version N` a published version of the
|
||||
|
||||
@@ -9,9 +9,9 @@ request does not authorize publication, execution or deployment.
|
||||
Inspect actual source and diffs, run relevant tests and record exact results.
|
||||
A model summary, committed branch or successful merge is not proof of runtime
|
||||
behavior. Missing or partial diff capture must be reported as incomplete.
|
||||
With delivery=true, the stage returns a clean candidate and the server checks and
|
||||
lands it, first merging a moved main and re-checking the merged tree; only a real
|
||||
conflict fails. Direct recovery can complete a reviewed merge without another pipeline.
|
||||
With delivery=true (a model land stage on any harness, or a check stage), the
|
||||
server checks and lands the candidate, first merging a moved main and
|
||||
re-checking the merged tree; only a real conflict fails. Direct recovery can complete a reviewed merge without another pipeline.
|
||||
|
||||
Keep artifacts under the supplied run/stage artifact directory. Mark unverified
|
||||
builds as WIP. Verify any download URL serves the real bytes before reporting it.
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
A definition is Markdown made only of `# stage KEY` headings and fenced blocks;
|
||||
no prose outside blocks. Blocks: `prompt`, `configs`, `tools`, `skills`, `edges`,
|
||||
`checks`, `limits` (`references/control.md`), `permissions` and `notify`
|
||||
(`references/notifications.md`). There are no memory, links, input or output
|
||||
`checks`, `limits` (`references/control.md`), `permissions`, `notify`
|
||||
(`references/notifications.md`) and, on check stages, `commands`. There are no memory, links, input or output
|
||||
blocks; stages communicate through `output.md` (`# handoff`) and `public/`.
|
||||
Schedules are saved run configurations, never definition blocks
|
||||
(`references/schedules.md`).
|
||||
@@ -102,8 +102,9 @@ evidence route to `blocked` when declared, else `error`; never fabricate a resul
|
||||
(`pipelines new NAME --template KEY`) fill them in; copy those IDs into a
|
||||
hand-written draft. Availability needs `pipelines provider-check`.
|
||||
- `harness=opencode|pi|claude`; omission means OpenCode (`references/harnesses.md`).
|
||||
`claude` needs `provider=anthropic` and a Claude model ID, and accepts no
|
||||
`permissions` block, `delivery=true` or run write paths.
|
||||
`claude` needs `provider=anthropic` and a Claude model ID; its `permissions`
|
||||
block may hold only a `shell` allow-list (no `edit` patterns or run write
|
||||
paths).
|
||||
- `retries` 0–100, default 2 (three attempts). Retries cover transport failures
|
||||
and timeouts; a stage with `edit`/`shell` (or no tools block) never replays
|
||||
admitted work.
|
||||
@@ -114,7 +115,13 @@ evidence route to `blocked` when declared, else `error`; never fabricate a resul
|
||||
- `budget_usd`, `budget_tokens`: positive caps on reported usage, shared across
|
||||
attempts and visits of this stage; totals include cache reads and writes. Set
|
||||
only when the user asks or a measured visit exists (`references/practices.md`).
|
||||
- `delivery=true`: the landing stage's gate (below). OpenCode harness only.
|
||||
A whole-run cap is not a definition setting: it is the run's `--budget USD` or
|
||||
the server default (`pipelines run-budget`), and every stage's cost counts
|
||||
towards it (80% warning, stop with failure class `budget` at 100%).
|
||||
- `delivery=true`: the landing stage's gate (below), on any harness, or on a
|
||||
check stage.
|
||||
- `allow_workspace_changes=true`: lets a stage with `shell` but no `edit` leave file changes
|
||||
in the run directory (below).
|
||||
- `auto_skip=false`: disable the server skip fallback for a stage that declares a
|
||||
`skipped` edge (`references/operations.md`, Server skip fallback).
|
||||
|
||||
@@ -134,6 +141,20 @@ patterns) and `shell` (exact commands) arrays. It narrows declared tools; it nev
|
||||
enables a missing one. Empty arrays deny; wildcards, chaining, redirects and
|
||||
traversal are rejected. With restricted edits and shell enabled, list shell too:
|
||||
`{"edit":["README.md","plugin/*.qml"],"shell":["bash -n install.sh"]}`.
|
||||
On `harness=claude` only `shell` is accepted; each entry becomes a Claude Code
|
||||
rule (`go test ./...` -> `Bash(go test ./...)`) and an entry ending in ` *` is a
|
||||
prefix (`git diff *` -> `Bash(git diff:*)`, any arguments; claude only). Claude
|
||||
Code checks each part of a chained command, and every other command is
|
||||
refused. A read-only reviewer: `{"shell":["git diff *","git log *","go test ./..."]}`.
|
||||
|
||||
A stage whose `tools` block has `shell` but not `edit` must leave the run directory as it
|
||||
found it: the server compares the workspace before and after the visit and
|
||||
fails the visit (`permission denied: ... changed the workspace (added x, ...)`,
|
||||
following the `error` edge) when any file changed, outside the run's artifact
|
||||
directories and a harness state directory inside the workspace. Committing is
|
||||
not a change; merging or generating files is. Set
|
||||
`allow_workspace_changes=true` on a stage that legitimately writes (for
|
||||
example a land stage that merges main itself).
|
||||
|
||||
Named MCP entries are an explicit allowlist for unattended Claude stages:
|
||||
`mcp:ai-memory` allows that server's tools, while `mcp:linear/list_issues`
|
||||
@@ -190,6 +211,56 @@ A check must fail when it cannot run: validation rejects `|| true`, `|| :`,
|
||||
`|| exit 0`, `|| echo`, negated file tests, `! command -v tool ||`, an `if` with no
|
||||
failing else, and `set +e`. Cover every language the run can change.
|
||||
|
||||
## Check stages
|
||||
|
||||
`type=check` runs shell commands on the server, without a model, and routes on
|
||||
`pass` or `fail`. Use it before review, so a reviewer never sees a red tree, and
|
||||
as the landing gate instead of a model stage that runs the suite itself.
|
||||
|
||||
````markdown
|
||||
# stage verify
|
||||
|
||||
```configs
|
||||
type=check
|
||||
command_timeout=15m
|
||||
```
|
||||
|
||||
```commands
|
||||
uv run ruff check .
|
||||
uv run ty check
|
||||
uv run pytest -q
|
||||
```
|
||||
|
||||
```edges
|
||||
pass -> review
|
||||
fail -> implement
|
||||
```
|
||||
|
||||
```limits
|
||||
{"max_visits":3}
|
||||
```
|
||||
````
|
||||
|
||||
- `commands` (required): 1-20 lines, one `sh -c` command each, run in order
|
||||
from the run directory with its workspace environment; blank and `#` lines are
|
||||
ignored. The first failure stops the rest (`not_run`) unless `keep_going=true`.
|
||||
Lint rejects silent guards (`|| true`) as for `checks`.
|
||||
- Configs: `command_timeout` (per command, default `30m`), `timeout` (the whole
|
||||
stage, default `1h`), `keep_going=true|false`, `delivery=true`. No prompt,
|
||||
tools, model or skills.
|
||||
- Edges: `pass` and `fail` are required and are the only outcomes besides
|
||||
`error` (an infrastructure failure). A `fail` loop back needs `limits`.
|
||||
- Output: the step records each command's status (`passed`, `failed`,
|
||||
`timed_out`, `not_run`), exit code, duration and output (64 KB per failing
|
||||
command, head and tail kept), plus a one-line summary as its verdict. Its
|
||||
`# handoff` names the failing commands with the tail of their output, and the
|
||||
full outputs follow, so the next stage sees exactly what failed.
|
||||
- `delivery=true` makes it the landing gate: the server commits what the run
|
||||
left uncommitted (run worktrees), merges a moved `main`, runs the commands in
|
||||
a fresh worktree of the commit and fast-forwards `main` on `pass`. A failing
|
||||
command is `fail` with `main` untouched; a gate problem (dirty checkout,
|
||||
conflict, refused fast-forward) is `error`.
|
||||
|
||||
## Human stages
|
||||
|
||||
`type=human` pauses the run until a person picks one of its non-`error` edges
|
||||
@@ -201,14 +272,17 @@ wait survives restarts and is never killed by a stage timeout or `max_visits`.
|
||||
|
||||
## Land stage and delivery gate
|
||||
|
||||
A workflow that commits its change ends in `land`: a model stage with
|
||||
`read`/`glob`/`grep`/`shell`, no `edit`, that commits locally. Its prompt states:
|
||||
A workflow that commits its change ends in `land`: either a check stage with
|
||||
`delivery=true` (above; no model, the server commits and lands), or a model
|
||||
stage with `read`/`glob`/`grep`/`shell`, no `edit`, that commits locally. A model
|
||||
land stage's prompt states:
|
||||
|
||||
1. Commit only this run's changes (server list + git status).
|
||||
2. Check the staged diff for unrelated work and secrets.
|
||||
3. No empty commit, push, amend or rebase. Report the hash.
|
||||
|
||||
With `delivery=true` and `checks` commands, after `land` succeeds the server:
|
||||
With `delivery=true` and `checks` commands (any harness), after `land` succeeds
|
||||
the server:
|
||||
commits whatever the run left uncommitted when the item is the run's own
|
||||
worktree (see "Run worktrees" below); requires the item checkout to be clean,
|
||||
untracked files included (the main checkout need not be: the final
|
||||
|
||||
@@ -92,7 +92,7 @@ Use the authoritative `CLI_PREFIX` from the prompt:
|
||||
without changing its input or steps. The stored prompt is unchanged, and
|
||||
listing/renaming never calls a model.
|
||||
- `CLI_PREFIX inspect RUN_ID`: compact summary — a header (status, outcome,
|
||||
duration, diagnostic), one line per step (stage, status, outcome, duration,
|
||||
duration, `failure_class`, diagnostic, run budget), one line per step (stage, status, outcome, duration,
|
||||
first diagnostic line), how to answer a `waiting` run and the final `# handoff`
|
||||
(bounded). `--step N` prints one step in full without its transcript (add
|
||||
`--transcripts` for it), `--transcripts` alone appends every transcript, and
|
||||
@@ -111,13 +111,19 @@ Use the authoritative `CLI_PREFIX` from the prompt:
|
||||
complete tool history.
|
||||
- `CLI_PREFIX decide RUN_ID [STAGE] --option KEY [--feedback TEXT] [--json]`: answer
|
||||
a run `waiting` on a `type=human` stage (`references/format.md`).
|
||||
- A run in `waiting_quota` is parked for a provider usage limit and resumes on its
|
||||
own after `quota_wait.resume_at`; `CLI_PREFIX resume RUN_ID --yes` resumes it now,
|
||||
`cancel` stops it (`references/debugging.md`). `run`/`retry` take `--budget USD`
|
||||
(whole-run cap) and `--now`/`--defer` for a known usage limit;
|
||||
`CLI_PREFIX run-budget [USD|off]` shows or sets the server default run budget.
|
||||
- Without a terminal on stdin/stdout (an agent's shell, a pipe, CI) `run` behaves
|
||||
as `--json` and never opens the full-screen view, `tui` refuses, and every
|
||||
confirmation fails at once naming `--yes` instead of prompting: pass
|
||||
`run NAME "TASK" --json --yes` and `retry RUN_ID --yes --json`.
|
||||
- `CLI_PREFIX wait RUN_ID ...`: one line per run as it finishes (a failed run's
|
||||
stage and first diagnostic line); while a run waits on a human it prints
|
||||
`waiting at STAGE — answer with: pipelines decide ID --option KEY` once (stderr
|
||||
`waiting at STAGE — answer with: pipelines decide ID --option KEY` once and
|
||||
waits through `waiting_quota` (the run resumes on its own) (stderr
|
||||
under `--json`). Exit status: 0 every run succeeded, 2 a run failed, was
|
||||
canceled or interrupted, 1 a client error (unknown id, connection, `--timeout`
|
||||
reached; the run is untouched). `run --wait` and `retry --wait` also exit 2
|
||||
|
||||
Reference in New Issue
Block a user