@giamme/forge 0.21.0 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +81 -0
- package/README.md +25 -15
- package/SKILL.md +137 -216
- package/VERSION +1 -1
- package/bin/forge.js +104 -0
- package/docs/README.md +2 -3
- package/docs/add-ons.md +5 -3
- package/docs/artifacts.md +17 -2
- package/docs/commands.md +85 -63
- package/docs/decomposed-runs.md +195 -21
- package/docs/development.md +12 -10
- package/docs/forge-ui.md +33 -4
- package/docs/install.md +127 -6
- package/docs/memory.md +6 -1
- package/docs/models.md +36 -10
- package/docs/reviews.md +50 -29
- package/docs/safety.md +27 -2
- package/docs/troubleshooting.md +8 -11
- package/forge +29 -4
- package/forge.cmd +56 -0
- package/package.json +6 -3
- package/references/dataset.md +10 -9
- package/references/decompose-integration.md +337 -0
- package/references/decompose-opt-in.md +527 -0
- package/references/decompose-recovery.md +569 -0
- package/references/decompose-review.md +256 -0
- package/references/decompose.md +99 -1606
- package/references/findings.md +68 -0
- package/references/harnesses.md +7 -12
- package/references/memory.md +13 -2
- package/references/planning.md +48 -18
- package/references/ripwire.md +38 -13
- package/references/runtime.md +22 -33
- package/references/setup.md +90 -0
- package/references/solo.md +13 -42
- package/references/ui.md +12 -5
- package/registry.tsv +40 -22
- package/scripts/forge-artifact.sh +148 -13
- package/scripts/forge-compare.py +5 -15
- package/scripts/forge-config.py +14 -1
- package/scripts/forge-contract.py +216 -53
- package/scripts/forge-control.py +781 -51
- package/scripts/forge-dispatch.sh +202 -42
- package/scripts/forge-du.py +13 -3
- package/scripts/forge-guard.py +137 -6
- package/scripts/forge-handoff.py +221 -39
- package/scripts/forge-install-ripwire.sh +100 -24
- package/scripts/forge-install.sh +100 -41
- package/scripts/forge-issues.py +6 -4
- package/scripts/forge-jev-options.sh +3 -5
- package/scripts/forge-lib-adopt.sh +169 -5
- package/scripts/forge-lib-attribute.sh +10 -3
- package/scripts/forge-lib-decompose.sh +454 -0
- package/scripts/forge-lib-env.sh +179 -0
- package/scripts/forge-lib-group.sh +9 -6
- package/scripts/forge-lib-plans.sh +38 -21
- package/scripts/forge-lib-review.sh +28 -8
- package/scripts/forge-lib-task.sh +263 -69
- package/scripts/forge-lib-verify.sh +59 -10
- package/scripts/forge-memory.sh +83 -4
- package/scripts/forge-metrics.sh +10 -3
- package/scripts/forge-parallel-options.sh +23 -4
- package/scripts/forge-parallel.sh +602 -217
- package/scripts/forge-plan-check.py +71 -8
- package/scripts/forge-planner.py +303 -17
- package/scripts/forge-pr.py +9 -1
- package/scripts/forge-prompt.py +2 -2
- package/scripts/forge-review-links.py +248 -0
- package/scripts/forge-ripwire.py +234 -16
- package/scripts/forge-route.py +19 -27
- package/scripts/forge-runs-rm.py +92 -21
- package/scripts/forge-runs.py +46 -5
- package/scripts/forge-runtime.py +39 -14
- package/scripts/forge-schedule.py +141 -33
- package/scripts/forge-setup-stale.py +236 -0
- package/scripts/forge-setup.py +804 -0
- package/scripts/forge-shadow.py +2 -20
- package/scripts/forge-solo-lock.py +46 -0
- package/scripts/forge-solo.sh +39 -58
- package/scripts/forge-sweep.py +3 -2
- package/scripts/forge-ui.py +8 -1
- package/scripts/forge-update.sh +8 -3
- package/scripts/forge-verify.py +17 -1
- package/scripts/forge-version.py +13 -1
- package/scripts/forge-watch.py +7 -2
- package/scripts/forge-win.sh +156 -0
- package/scripts/forge_brief/__init__.py +6 -1
- package/scripts/forge_brief/proposals.py +6 -1
- package/scripts/forge_dataset/__init__.py +1 -1
- package/scripts/forge_dataset/capture.py +0 -34
- package/scripts/forge_dataset/checks.py +0 -1
- package/scripts/forge_dataset/cli.py +5 -1
- package/scripts/forge_dataset/export.py +28 -6
- package/scripts/forge_dataset/facts.py +1 -2
- package/scripts/forge_dataset/forecast.py +1 -1
- package/scripts/forge_dataset/harvest.py +107 -7
- package/scripts/forge_dataset/importer.py +3 -2
- package/scripts/forge_dataset/pairs.py +3 -3
- package/scripts/forge_dataset/reviewers.py +4 -3
- package/scripts/forge_dataset/routing.py +6 -3
- package/scripts/forge_dataset/tiers.py +1 -1
- package/scripts/forge_decide/__init__.py +1 -1
- package/scripts/forge_decide/budget.py +12 -7
- package/scripts/forge_decide/profiles.py +11 -14
- package/scripts/forge_decide/replay.py +9 -4
- package/scripts/forge_decompose.py +987 -0
- package/scripts/forge_flock.py +17 -2
- package/scripts/forge_groups/review.py +6 -1
- package/scripts/forge_jev/__init__.py +1 -1
- package/scripts/forge_jev/cli.py +10 -1
- package/scripts/forge_jev/gates.py +10 -1
- package/scripts/forge_jev/verify.py +10 -2
- package/scripts/forge_legacy.py +86 -0
- package/scripts/forge_memory_home.py +57 -0
- package/scripts/forge_models.py +151 -0
- package/scripts/forge_posix.py +17 -0
- package/scripts/forge_prefs.py +138 -0
- package/scripts/forge_proc.py +108 -0
- package/scripts/forge_registry.py +2 -2
- package/scripts/forge_side/__init__.py +23 -4
- package/scripts/forge_storage.py +28 -15
- package/ui/README.md +22 -10
- package/ui/docs/api.md +121 -99
- package/ui/forge_ui/control.py +53 -16
- package/ui/forge_ui/export.py +0 -10
- package/ui/forge_ui/models.py +15 -2
- package/ui/forge_ui/projects.py +4 -1
- package/ui/forge_ui/reader.py +462 -60
- package/ui/forge_ui/server.py +0 -10
- package/ui/forge_ui/static/app.js +28 -9
- package/ui/forge_ui/static/checksview.js +12 -3
- package/ui/forge_ui/static/controls.js +147 -11
- package/ui/forge_ui/static/convo.js +5 -2
- package/ui/forge_ui/static/diffview.js +4 -5
- package/ui/forge_ui/static/panel.js +180 -77
- package/ui/forge_ui/static/projectsview.js +16 -2
- package/ui/forge_ui/static/runmodel.js +18 -4
- package/ui/forge_ui/static/scene3d.js +52 -31
- package/ui/forge_ui/static/settings.js +1 -1
- package/ui/forge_ui/static/storageview.js +2 -2
- package/ui/forge_ui/static/style.css +23 -6
- package/ui/forge_ui/static/worktreesview.js +8 -4
- package/ui/forge_ui/transcripts.py +6 -0
- package/ui/forge_ui/worktrees.py +13 -1
- package/docs/fractal.md +0 -181
- package/references/fractal-dashboard.md +0 -21
- package/references/fractal.md +0 -307
- package/scripts/forge-fractal-dispatch.sh +0 -4
- package/scripts/forge-fractal-options.sh +0 -54
- package/scripts/forge-fractal.py +0 -6
- package/scripts/forge-install-fractal.sh +0 -4
- package/scripts/forge_fractal/__init__.py +0 -88
- package/scripts/forge_fractal/bridge.py +0 -46
- package/scripts/forge_fractal/cli.py +0 -224
- package/scripts/forge_fractal/dashboard.css +0 -138
- package/scripts/forge_fractal/dashboard.html +0 -41
- package/scripts/forge_fractal/dashboard.js +0 -687
- package/scripts/forge_fractal/decomposition.py +0 -262
- package/scripts/forge_fractal/execution.py +0 -659
- package/scripts/forge_fractal/inspection.py +0 -261
- package/scripts/forge_fractal/install.py +0 -158
- package/scripts/forge_fractal/invocation.py +0 -95
- package/scripts/forge_fractal/pipeline.py +0 -125
- package/scripts/forge_fractal/selection.py +0 -180
- package/ui/forge_ui/fractal.py +0 -582
|
@@ -0,0 +1,569 @@
|
|
|
1
|
+
# Decomposed runs: retries, stops and recovery
|
|
2
|
+
|
|
3
|
+
What happens when a task fails, stops or needs the user, and the commands that carry a run on.
|
|
4
|
+
Part of the decomposition reference; planning is in [decompose.md](decompose.md).
|
|
5
|
+
|
|
6
|
+
## Contents
|
|
7
|
+
|
|
8
|
+
- [Retrying, and resuming an interrupted run](#retrying-and-resuming-an-interrupted-run)
|
|
9
|
+
- [When reviews don't converge](#when-reviews-dont-converge)
|
|
10
|
+
- [Infrastructure failures](#infrastructure-failures)
|
|
11
|
+
- [Implementer guards](#implementer-guards)
|
|
12
|
+
- [Accepting, splitting, combining and the whole-run review](#accepting-splitting-combining-and-the-whole-run-review)
|
|
13
|
+
|
|
14
|
+
## Retrying, and resuming an interrupted run
|
|
15
|
+
|
|
16
|
+
When the user wants to tell an implementer something (a hint, a correction, a constraint), queue it:
|
|
17
|
+
`forge control steer <plan> <task> "text"` (live run or not). It starts nothing; the task's next implementer
|
|
18
|
+
attempt gets it beside the findings, and that attempt is marked steered and left out of routing statistics.
|
|
19
|
+
A running attempt is not interrupted (#134). For a claude or openclaude implementer that is running now,
|
|
20
|
+
`--now` gives it the message at its next tool call (#252); it is refused when the task has no live
|
|
21
|
+
implementer, and then the plain form queues it.
|
|
22
|
+
|
|
23
|
+
A live `run` says at once when a task stops for the user while the rest goes on (#193):
|
|
24
|
+
`forge: needs you: <task> NEEDS_DECISION (<reasons>) -> <plan>/tasks/<task>/decision.md`, the same with
|
|
25
|
+
`NEEDS_INPUT (a question to answer)` and `needs_input.md`, and `forge: stopped: <task> INFRA (<cause>, no
|
|
26
|
+
attempt spent) -> …/infra.txt` for an infrastructure stop the run is waiting out. Put a `needs you` task to
|
|
27
|
+
the user then. A driver that cannot read the run's output as it comes runs `forge watch <plan>` (one line
|
|
28
|
+
per status change, exits with the run); neither is polling, which is re-reading logs or statuses in a loop.
|
|
29
|
+
|
|
30
|
+
A failed task keeps its branch and its worktree. `retry` is what acts on them:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
forge-parallel.sh retry <plan-dir> <task-id> [--dwarf <spec>]
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
It re-dispatches that one task **in the worktree it already has**, with the previous
|
|
37
|
+
reviewer's findings prepended to the prompt — that carry-forward is the whole difference
|
|
38
|
+
between a retry and simply running the task again. It then re-reviews, and merges if the
|
|
39
|
+
verdict is now `PASS`. `--dwarf` escalates to a stronger model and is written back into
|
|
40
|
+
`tasks.tsv`, so the table shows the model that will actually be spent and the escalation
|
|
41
|
+
survives a re-plan.
|
|
42
|
+
|
|
43
|
+
Two details that are load-bearing rather than incidental:
|
|
44
|
+
|
|
45
|
+
- **The base is pinned per task, not per run.** A retry diffs against the commit the task
|
|
46
|
+
was originally branched from, so its reviewer sees the task's *cumulative* work. Reviewing
|
|
47
|
+
only the fix would let the first attempt's code through unread, and re-basing onto the
|
|
48
|
+
integration branch as it now stands would put other tasks' merged code into this task's
|
|
49
|
+
diff.
|
|
50
|
+
- **An identical retry is not re-reviewed.** If the diff comes back byte-identical to the
|
|
51
|
+
previous attempt, the task fails again without a QA dispatch. Paying a reviewer to read
|
|
52
|
+
the same code twice buys nothing. A retry that only rejects the findings, and leaves
|
|
53
|
+
that diff unchanged, is still this identical retry.
|
|
54
|
+
|
|
55
|
+
`retry` is a command a human types. Forge does not loop a dwarf against its own reviewer on
|
|
56
|
+
its own initiative; the one exception is the opt-in `run --retry-failed N` below.
|
|
57
|
+
|
|
58
|
+
**`UNKNOWN` and `INFRA` resume at the review stage.** If the reviewer never gave a verdict (or
|
|
59
|
+
its dispatch stopped on an infrastructure failure after the dwarf finished), the work was not
|
|
60
|
+
rejected, so `retry` / `--retry-failed` re-runs **QA only** on the unchanged, already-committed
|
|
61
|
+
work: no dwarf, no new commit, no attempt spent. A `tasks/<id>/resume` marker records this and is
|
|
62
|
+
revalidated against the branch tip and the saved source fingerprint before it is trusted; if the
|
|
63
|
+
worktree changed, the full task runs. Findings are carried only from a real review.
|
|
64
|
+
|
|
65
|
+
On a retry whose diff changed, QA receives the previous round under **Findings from the
|
|
66
|
+
previous review round**, the diff since that round (`tasks/<id>/changes.since.diff`,
|
|
67
|
+
`changes.since.range` and `changes.since.stat`; omitted when the earlier commit is
|
|
68
|
+
missing or not an ancestor, or when nothing changed) and the implementer's reply. It is
|
|
69
|
+
told to restate only findings that are still open, as `- [Px][CONFIRMED|PLAUSIBLE]`
|
|
70
|
+
lines, because every labelled line is counted. That is the retry's review, not the
|
|
71
|
+
QA-only re-run above.
|
|
72
|
+
|
|
73
|
+
**In-run retries.** `run <plan> --retry-failed N` re-queues a task whose reviewer said
|
|
74
|
+
`FAIL`/`UNKNOWN`, or whose review was `INVALIDATED` by a change to the review copy, as soon as it ends, up to `N` more times in that run, preparing the retry exactly
|
|
75
|
+
as `retry` does (same findings carry-forward, same pinned base, same cumulative review). Other
|
|
76
|
+
tasks keep running; dependents wait for the task to merge. It applies per invocation (not
|
|
77
|
+
remembered), never to `TIMEOUT`/`ERROR`/`CONFLICT` or an `INVALIDATED` merge, and never after a retry that
|
|
78
|
+
changed nothing (`tasks/<id>/noretry`). Every entry is logged in `tasks/<id>/attempts.tsv`.
|
|
79
|
+
An attempt that carries retry findings also gets one row in `tasks/<id>/retry_sources.tsv`:
|
|
80
|
+
the attempt number, the source of those findings (`review`, `prereview`, `bounce`, `message`,
|
|
81
|
+
`answer` or `prompt`) and the epoch time. A row for the same attempt replaces the earlier one, because an
|
|
82
|
+
infrastructure stop refunds the attempt and its restart runs the same number again. forge-ui's
|
|
83
|
+
attempt trail reads this file.
|
|
84
|
+
|
|
85
|
+
**A prompt edited during the attempt.** When `dwarf.input` is built, `prompt.md` and
|
|
86
|
+
`approach.md` are copied to `prompt.dispatched` and `approach.dispatched`. A missing
|
|
87
|
+
`approach.md` is an empty copy, and `prompt.dispatched` is written last: its presence is what
|
|
88
|
+
says the pair is complete. If the copy fails, `prompt.dispatched` is removed and a later edit
|
|
89
|
+
is not detected. An attempt from before those copies is not checked. Before review,
|
|
90
|
+
if either file differs, the attempt is `STALE` and no review runs. `stale.diff` is the unified
|
|
91
|
+
diff, `control.log` gets action `prompt-changed` with actor `scheduler`, and the console names
|
|
92
|
+
the file and says no attempt was spent. The attempt counter is given back, as a dwarf-stage
|
|
93
|
+
infrastructure stop is. The cap skips the `STALE` row, the escalation streak treats `STALE` as
|
|
94
|
+
neutral, and no decision is written. Unless the run is stopping, the scheduler re-dispatches at
|
|
95
|
+
once with `retry_findings.source` `prompt`. `retry_findings.md` is the new requirements plus
|
|
96
|
+
that diff, and the next entry reuses the attempt number. `changes.diff` and
|
|
97
|
+
`changes.prev.diff` are removed, so a re-dispatch that keeps the committed work is reviewed
|
|
98
|
+
rather than refused as identical (`stale.diff` and `committed.diff` stay). A `STALE` task still
|
|
99
|
+
waiting at the next `run` is prepared the same way, with no `--retry-failed` required and no
|
|
100
|
+
retry counted. `forge control retry` accepts `STALE`; `--dwarf` is refused, because the same
|
|
101
|
+
implementer gets the new text. A plain `forge-parallel.sh retry` does not take this path. The
|
|
102
|
+
dataset attempt event has `prompt_changed` (true when the status is `STALE`). `forge dataset
|
|
103
|
+
routing`, tiers and the forecast leave those attempts out,
|
|
104
|
+
the same way they leave out a refunded or infrastructure stop. The `prompt` blob is
|
|
105
|
+
`prompt.dispatched`, the text the implementer was given; an attempt from before the copy falls
|
|
106
|
+
back to `prompt.md`. An empty `approach.dispatched` stores no approach blob.
|
|
107
|
+
|
|
108
|
+
**A brief edited during the review (#212).** The same comparison runs again once the review has
|
|
109
|
+
finished, before its verdict is recorded. If `prompt.md` or `approach.md` changed while the reviewer
|
|
110
|
+
worked, the verdict judged text that is gone: the attempt is `STALE` exactly as above (refunded, neutral
|
|
111
|
+
in the streak, re-dispatched at once), `control.log`'s `prompt-changed` entry has `during: review`, and
|
|
112
|
+
the finished review is kept as `qa.stale.last` until the next preparation adds it to
|
|
113
|
+
`retry_findings.md`, under the diff, as findings to check against the new text.
|
|
114
|
+
|
|
115
|
+
**Every brief change is on record (#220).** `plan` copies each task's brief to `prompt.seen` and
|
|
116
|
+
`approach.seen`. When an implementer attempt is dispatched, a brief that differs from them (an edit
|
|
117
|
+
between attempts, while the task waited for a decision or its dependencies, or before its first
|
|
118
|
+
dispatch) gets one `prompt-changed` entry with `during: dispatch` and the attempt about to run, and
|
|
119
|
+
its diff in `brief.diff`; the copies are then refreshed. A `STALE` check refreshes them too, so an edit
|
|
120
|
+
during an attempt or its review is logged once, with `during: attempt` or `review`. A plan from before
|
|
121
|
+
these copies compares with the last `prompt.dispatched`. `retry --decide` adds `brief_changed` to its
|
|
122
|
+
dataset decision event, and `forge control retry --decide` to its `control.log` entry: `true` when the
|
|
123
|
+
brief differs from what the last attempt was given, `null` when no attempt recorded that. The run
|
|
124
|
+
summary's scope drift marks a path the task's current brief names with `(named in the brief)`.
|
|
125
|
+
|
|
126
|
+
**Escalation after repeated failures.** In forge's history the first three attempts at a task
|
|
127
|
+
pass review at about the same rate (43%, 42%, 47%), and the fourth and later at 29%, whether
|
|
128
|
+
or not the model changed. So a retry does not repeat a dispatch that has already failed three
|
|
129
|
+
times on one model (`--escalate-after N` on `run` or `retry`, kept in the plan, default 3, `0`
|
|
130
|
+
turns it off):
|
|
131
|
+
|
|
132
|
+
- **Counting:** the count is the task's failed attempts (FAIL, or an implementer TIMEOUT) on its current model,
|
|
133
|
+
from the fifth column of `attempts.tsv`, after the latest row of `tasks/<id>/decisions.tsv`.
|
|
134
|
+
Infrastructure stops, missing verdicts, `STALE` attempts and forge's own errors judge nothing and are skipped; a pass
|
|
135
|
+
or a change of model resets it. A lateral move does not: the streak carries across `tasks/<id>/lateral.tsv`.
|
|
136
|
+
- **Escalation:** at the threshold, the next attempt goes to a different model in the next tier
|
|
137
|
+
up of the pools given to `plan` (same position in the pool, as with exploration),
|
|
138
|
+
recorded in `escalations.tsv` and `tasks.tsv` like a `retry --dwarf`.
|
|
139
|
+
- **Stop:** when nothing is above (the model is in the top tier, or in no tier pool at
|
|
140
|
+
all), the task stops as `NEEDS_DECISION` with reason `split` (see [When reviews don't converge](#when-reviews-dont-converge)).
|
|
141
|
+
`tasks/<id>/split.suggested` still says to split it or name a model; the split is one choice
|
|
142
|
+
([Subtasks](decompose.md#subtasks-a-task-split-at-any-level)), made by the user or, with `run --auto-split`, by the planner. `run --retry-failed` does not retry it,
|
|
143
|
+
and a plain `retry` refuses (exit 2).
|
|
144
|
+
- **Effort step** (`--escalate-effort` on `run` or `retry`, kept in the plan as `escalate_effort`;
|
|
145
|
+
`--no-escalate-effort` removes it; off by default): when no higher tier has another model, the
|
|
146
|
+
same alias and harness is tried once more at the next effort its pairing accepts
|
|
147
|
+
(`forge-dispatch.sh efforts --spec <spec>` lists them, weakest first), counted from the effort
|
|
148
|
+
the last dispatch really ran after any clamp; a spec that names no effort counts as `medium`.
|
|
149
|
+
The streak then counts per effort, so the new effort starts from zero. At the pairing's highest
|
|
150
|
+
effort the task still stops, and `split.suggested` says that effort was tried too. Turning the
|
|
151
|
+
step on (flag or `forge control set escalate-effort on`) clears the stop markers, so tasks the
|
|
152
|
+
policy already stopped are decided again at their next retry.
|
|
153
|
+
- **Overrides:** an explicit `retry --dwarf <spec>` is the human's choice and skips the policy, even
|
|
154
|
+
with the same model. The dwarf column itself cannot tell a pin from a pool pick, so it does
|
|
155
|
+
not; `--escalate-after 0` does.
|
|
156
|
+
- A QA-only resume is not escalated: it spends no implementer attempt.
|
|
157
|
+
- **Reporting:** the policy's state is decided after every attempt, so a run whose retry budget ran out
|
|
158
|
+
still reports `its next retry goes to <spec>` or the split suggestion under the results.
|
|
159
|
+
A pending pin is reported ahead of both, as `its next retry goes to <spec> (pinned)`, or
|
|
160
|
+
`(pinned; after the QA-only re-run)` only when the next entry really re-runs QA (the
|
|
161
|
+
`resume` marker, or an unreviewed verdict, still matches the worktree). A marker the
|
|
162
|
+
next retry will discard is not that wait.
|
|
163
|
+
|
|
164
|
+
**A budget per model.** `plan --retry-per-model N` writes `retry_per_model` (`N` from 1 to 99).
|
|
165
|
+
`--no-retry-per-model` removes it; a re-plan with neither keeps the file. A task may fail N
|
|
166
|
+
times on the model it is on, then the next attempt moves one rung up the pools and the count
|
|
167
|
+
starts again. With `escalate_effort` on, the same N applies to each effort of that model before
|
|
168
|
+
the next effort. `forge-route.py escalation` uses `retry_per_model` as the trigger when the
|
|
169
|
+
file is a number from 1 to 99, instead of `escalate_after`. When both files exist, `run` notes
|
|
170
|
+
that retry-per-model replaces `--escalate-after` for this plan; the `escalate_after` file stays.
|
|
171
|
+
Automatic retries still need `--retry-failed` above 0 (or a live `retry_budget` above 0): any
|
|
172
|
+
positive budget turns the ladder on, and that number is not the limit. A person's
|
|
173
|
+
`decided.left` replaces the ladder: a positive count retries even when `forge-route.py per-model`
|
|
174
|
+
says no, and 0 does not. `retry=N` with `--dwarf` keeps the task on that model until the larger of N
|
|
175
|
+
and the per-model count. `max_attempts`, the converging stop, `noretry`
|
|
176
|
+
and `escalation.stop` still apply. `forge-route.py per-model` prints whether one task may be
|
|
177
|
+
attempted again (`retry`, `rung`, `failed_on_rung`, `rungs_left`, `per_model`; exit 2 when the
|
|
178
|
+
plan has no valid file). `worst-case` is the unmerged tasks' dispatches (implementer, reviewer,
|
|
179
|
+
and shadow reviews when those are on) and the tasks whose `N` times rungs exceed
|
|
180
|
+
`max_attempts`. The plan table prints `retry per model: N`, `worst case with retry-per-model N:
|
|
181
|
+
X dispatches`, and `max-attempts … stops these tasks before the top of their ladder` for that
|
|
182
|
+
last list. Pools `low`, `medium` and `high` with N=3 give a task that starts on `low` up to 9
|
|
183
|
+
implementer attempts, bounded by `--max-attempts` (default 8). A `script` implementer has no
|
|
184
|
+
rungs above it; its worst-case implementer count is 0.
|
|
185
|
+
|
|
186
|
+
History cannot yet say whether escalating rescues a task (31% of the 29 later attempts on a
|
|
187
|
+
changed spec passed, mostly effort bumps); the attempts this policy makes are what will.
|
|
188
|
+
|
|
189
|
+
## When reviews don't converge
|
|
190
|
+
|
|
191
|
+
A task can fail review after review, each round with new findings. forge keeps a findings ledger
|
|
192
|
+
at `tasks/<id>/ledger.tsv`, one row per review: epoch, attempt, review, verdict, gate, worst,
|
|
193
|
+
confirmed, new, carried, diff_bytes, delta_bytes. A CONFIRMED finding is carried when the previous
|
|
194
|
+
review named the same problem; the rest are new. The diff sizes are `changes.diff` and
|
|
195
|
+
`changes.since.diff` as they stand when the row is written.
|
|
196
|
+
|
|
197
|
+
The signal looks at the last reviews. The count is the plan file `converge_window` when that file
|
|
198
|
+
holds a number (`plan --converge-window N`, or `forge control set converge-window N` later), and
|
|
199
|
+
**4** otherwise. It fires when every review in that window failed (verdict
|
|
200
|
+
FAIL, or the gate turned a PASS into a fail) with at least one CONFIRMED finding, at least half of
|
|
201
|
+
the findings in the later reviews are new, and the worst severity is no better in the last review
|
|
202
|
+
than in the first. A window below 2 never fires. On past runs, a window of 4 stopped no task that
|
|
203
|
+
merged by attempt 4. Rows from before the latest `tasks/<id>/decisions.tsv` entry do not count: a
|
|
204
|
+
decision restarts the window, and the escalation streak with it.
|
|
205
|
+
|
|
206
|
+
Task and solo reviews are asked to list every CONFIRMED finding, and to say so plainly when the
|
|
207
|
+
diff is correct, so a round is the whole list and not only the worst few.
|
|
208
|
+
|
|
209
|
+
The task then stops with status **`NEEDS_DECISION`**. So does a task the retry policy cannot
|
|
210
|
+
escalate further (reason `split`; `split.suggested` still names the suggestion), a task at its
|
|
211
|
+
attempt cap (reason `cap`), and a `FAIL` whose every blocking finding needs a file the task does
|
|
212
|
+
not declare (reason `plan`). The cap is `plan --max-attempts N`, default **8** when `max_attempts`
|
|
213
|
+
is absent, counted across runs: an infrastructure stop spends nothing, a `STALE` attempt spends
|
|
214
|
+
nothing, and each `retry=N` a person grants adds N to the cap. `0` is no cap, and a grant does not create one. `forge control set max-attempts N --confirm`
|
|
215
|
+
changes it; `--confirm` applies only to that key. A `NEEDS_INPUT` task at the cap keeps its question:
|
|
216
|
+
raise the plan's cap before the answer can start an attempt.
|
|
217
|
+
|
|
218
|
+
**Reason `plan`.** After a judged `FAIL`, and before the escalation check, the task stops when
|
|
219
|
+
`qa.last` holds a real `PASS` or `FAIL` verdict, at least one finding blocks at the task's
|
|
220
|
+
threshold, every blocking finding carries `{outside=…}`, and `forge_owner.py` says none of
|
|
221
|
+
those paths is covered by this task's declared files (a declaration of `.` covers every path;
|
|
222
|
+
`files` of `-`, or an unknown task, leaves every path outside). A `PLAUSIBLE` finding never
|
|
223
|
+
blocks, and a finding milder than the threshold does not. The check writes
|
|
224
|
+
`tasks/<id>/outside.json`: a JSON list of `{path, owner, owners, owner_status}`. `owner` is the
|
|
225
|
+
task that declares the path, or null when none does; `owners` is every such task; `owner_status`
|
|
226
|
+
is `MERGED` when that task has `merged`, otherwise the text of its `status`, or `PENDING` when
|
|
227
|
+
it has none, and null when there is no owner. If that does not hold, `outside.json` is removed
|
|
228
|
+
and escalation runs as usual. `decision.md` lists each path as `path — declared by <id> (<status>)`
|
|
229
|
+
or `path — declared by no task`, then the plan choices, which edit `tasks.tsv`: add the path to
|
|
230
|
+
this task's `files`, make this task depend on the owner (edit its `deps`), or merge the two
|
|
231
|
+
rows into one task. Then `forge-parallel.sh plan <plan>` again when no run is live, and
|
|
232
|
+
`forge-parallel.sh retry <plan> <id> --decide retry=1 --reason "…" --approved`. The usual
|
|
233
|
+
choices (more attempts, a threshold, a named model, accept, split) stay listed, under a line saying
|
|
234
|
+
that on a live run each is given as `forge control retry` with the same arguments.
|
|
235
|
+
|
|
236
|
+
When no task declares any of the paths, the first plan choice is one command, on a live run or
|
|
237
|
+
not (#199): `forge control retry <plan> <id> --decide files+=<path>[,<path>] --reason "…" --approved`
|
|
238
|
+
(with no run live, `forge-parallel.sh retry` with the same arguments), and `decision.md` prints it
|
|
239
|
+
with the paths filled in, plus a reminder that a finding that is not a change you want is answered
|
|
240
|
+
by clarifying the brief and `--decide retry=1`. The decision adds the paths to the task's `files`
|
|
241
|
+
in `tasks.tsv`, logs `files-added` in `control.log` (the paths as `value`, the files before as
|
|
242
|
+
`previous`, the reason) and the choice in `decisions.tsv`, and resumes the task for one attempt,
|
|
243
|
+
whose input lists the paths under "Files this task owns". It is refused with nothing written (exit 3)
|
|
244
|
+
when another task declares a path, overlapping it as `plan` tells overlap, when the task already owns
|
|
245
|
+
them all, or for a path that is absolute, leaves the repository or is under `.forge`. A path no task
|
|
246
|
+
declares adds no overlap, so the waves stay as `plan` made them, and a dependent starts in the same
|
|
247
|
+
run once the task merges. `forge control` checks the request before queuing it, and the scheduler
|
|
248
|
+
checks again when it applies it. This `FAIL`
|
|
249
|
+
counts toward the cap. It does not escalate, and `--retry-failed` does not re-queue
|
|
250
|
+
`NEEDS_DECISION`, so it spends no further attempt on the model. The reviewer's `{outside=…}`
|
|
251
|
+
is what stops the task. The implementer is told not to edit a file outside its `files`, and to
|
|
252
|
+
end with `FORGE_BLOCKED: <path>: <why>`, one line per path. Those lines are copied into
|
|
253
|
+
`qa.input` as a claim ("The implementer says these fixes need files outside the task"), for the
|
|
254
|
+
reviewer to confirm with `{outside=<path>}` or refute. Task, solo and group reviews are taught
|
|
255
|
+
the brace; sweep, adopt and final reviews are not. The brace is its own, immediately before the
|
|
256
|
+
facts brace: `- [P1][CONFIRMED] path/file.py:123 — {outside=a.py,b.py} {reach=main origin=new evidence=ran}`.
|
|
257
|
+
|
|
258
|
+
`tasks/<id>/decision.md` gives the reasons and the choices. Nothing else resumes the task: not a
|
|
259
|
+
re-run, not `--retry-failed`, not a retry budget and not a pin. A plain `retry` exits 2.
|
|
260
|
+
|
|
261
|
+
`retry` holds the plan lock until its attempts end, so to resume several tasks side by side add
|
|
262
|
+
`--no-dispatch` to each. It records the decision, carries the findings forward and starts nothing;
|
|
263
|
+
the task is then `PENDING`, and one `forge-parallel.sh run <plan>` dispatches them all under
|
|
264
|
+
`--max-parallel`, with dependents starting as their dependencies merge. It works on any `retry`,
|
|
265
|
+
not only a decision, but takes no `--retry-failed` or `--infra-retries`: give those to the `run`. A
|
|
266
|
+
second `--decide` on a prepared task is refused; a `--dwarf` changes its model and keeps its count.
|
|
267
|
+
|
|
268
|
+
The choices:
|
|
269
|
+
|
|
270
|
+
- `forge-parallel.sh retry <plan> <id> --decide retry=N --reason "…" --approved` gives N more
|
|
271
|
+
attempts, N from 1 to 20. At the cap this raises the cap by N, and it is the only choice that
|
|
272
|
+
runs the task again while the attempts already spent sit on the cap.
|
|
273
|
+
- `forge-parallel.sh retry <plan> <id> --decide threshold=Pn --reason "…" --approved` sets this
|
|
274
|
+
task's blocking threshold (`P0`, `P1`, `P2` or `P3`) and then retries once.
|
|
275
|
+
- `forge-parallel.sh retry <plan> <id> --dwarf <spec> --reason "…" --approved` names a model for
|
|
276
|
+
one attempt. Add `--decide retry=N` for up to N attempts: the retry policy keeps the task on that
|
|
277
|
+
model until they are used, and they end early the way any retry does, on a pass or when the reviews
|
|
278
|
+
stop converging. Or add `--decide threshold=Pn` to set the threshold too. `decisions.tsv` records it
|
|
279
|
+
as one row, such as `retry=2 dwarf=sol:high`.
|
|
280
|
+
- `forge-parallel.sh accept <plan> <id> --reason "…" --approved` merges it; the findings become
|
|
281
|
+
known issues.
|
|
282
|
+
- `forge-parallel.sh retry <plan> <id> --decide split --subtasks <file> --reason "…" --approved`
|
|
283
|
+
splits it into subtasks (`--planner <spec>` instead of the file asks a planner; `split=fresh`
|
|
284
|
+
starts over from the task's base). `tasks.tsv` is not edited: the subtasks run as the task's own
|
|
285
|
+
plan and the task is then reviewed on all of their work. One task in the answer keeps it whole,
|
|
286
|
+
and a limit of the run can refuse the split; both leave the task `NEEDS_DECISION` and exit 2.
|
|
287
|
+
See [Subtasks](decompose.md#subtasks-a-task-split-at-any-level).
|
|
288
|
+
- Or replace it by hand, when the pieces should be tasks of the plan itself (other tasks will
|
|
289
|
+
depend on one of them, or they need files the task does not own): replace its row in
|
|
290
|
+
`tasks.tsv` with smaller tasks, then `forge-parallel.sh run <plan>`, which reads that file
|
|
291
|
+
again and recomputes `waves.tsv`. `forge control drain` and `add` do not do it: they need a
|
|
292
|
+
scheduler that is still live (exit 3 once `scheduler.live` is gone, which it is by the time
|
|
293
|
+
the summary is printed), and `add` queues a new row without replacing the stopped one, which
|
|
294
|
+
stays `NEEDS_DECISION` for that invocation (its dependents keep the `deps` loaded at the
|
|
295
|
+
start, and the run exits 5 while the row is unmerged).
|
|
296
|
+
|
|
297
|
+
Take the stopped task's row out of `tasks.tsv`. Leave `tasks/<id>/` where it is; its diff
|
|
298
|
+
is not on the integration branch. A row left in place is not dispatched. Append one row
|
|
299
|
+
per smaller task, seven tab-separated columns: `id`, `deps`, `difficulty` (`low`, `medium`
|
|
300
|
+
or `high`), `files` (non-empty), `dwarf`, `qa`, `title`. Copy the stopped task's `dwarf`
|
|
301
|
+
and `qa` (explicit specs; `forge control add` refuses `-` and `UNASSIGNED`, and `run`
|
|
302
|
+
preflights every spec). `deps` is `-`, a task that is already `MERGED`, or another new
|
|
303
|
+
task. On every remaining row whose `deps` named the stopped task, put those new ids in
|
|
304
|
+
its place: a dependency that is no longer a row makes `run` die with `dependency cycle or
|
|
305
|
+
unsatisfiable deps`, and one that never merges leaves the dependent `BLOCKED`. Write a
|
|
306
|
+
non-empty `tasks/<id>/prompt.md` for each new id. The next `run` skips `MERGED` work and
|
|
307
|
+
dispatches the new rows from the integration branch as it stands, not from the stopped
|
|
308
|
+
task's worktree. While a scheduler is still live, `forge control add` can queue a row
|
|
309
|
+
written this way whose dependencies that run already knows; the row that replaces the
|
|
310
|
+
stopped task takes effect on the `run` after the scheduler has exited.
|
|
311
|
+
`forge-parallel.sh split` moves whole tasks into a new plan
|
|
312
|
+
([below](#accepting-splitting-combining-and-the-whole-run-review)).
|
|
313
|
+
|
|
314
|
+
A live scheduler takes the same decision as `forge control retry <plan> <id> --decide …` (or
|
|
315
|
+
`--dwarf`), and an accept as `forge control accept <plan> <id>`, each with `--reason` and
|
|
316
|
+
`--approved`; that only queues the request. An accepted task merges and its dependents start in
|
|
317
|
+
the same run (#138). The answer is appended
|
|
318
|
+
to `tasks/<id>/decisions.tsv` (epoch, attempt, choice, reason). The run summary lists these tasks
|
|
319
|
+
under `waiting for your decision:`. A run that ends with such a task unmerged exits 5.
|
|
320
|
+
|
|
321
|
+
**Live controls.** `forge control show|set|pin|unpin <plan>` changes a run while it works:
|
|
322
|
+
`qa-threshold` (read once per attempt, so an attempt keeps the bar it started with; per task, `none`
|
|
323
|
+
(P3) exempts it from a looser plan threshold and `inherit` drops the override; at plan level, `default` restores P2), `timeout`, `escalate-after`, `escalate-effort`
|
|
324
|
+
(`on|off`), `verify-retries`, `infra-backoff` (a shape as for `--infra-backoff`; `none` drops it,
|
|
325
|
+
read at the next infrastructure wait), `infra-fallback` (`on|off`, at the next infrastructure stop), `max-attempts` (a non-negative integer, `0` = no cap, and only with `--confirm`), `converge-window` (a non-negative integer), and, only while a scheduler is live, `retry-budget` (plan
|
|
326
|
+
or `--task`), `infra-retries` and `max-parallel` (1 to 64, at the next dispatch decision; a lower
|
|
327
|
+
limit lets running tasks finish and never stops one). The budgets
|
|
328
|
+
keep the **per invocation** rule: the flags of `run` are not remembered, and a live scheduler only
|
|
329
|
+
mirrors them into `retry_budget`, `infra_budget` and `tasks/<id>/retry_budget` (re-read at every
|
|
330
|
+
decision, removed when it stops; `tasks/<id>/retries.used` stays), so a change dies with the
|
|
331
|
+
run. `pin <task> <spec>` sets the model the task's next full retry uses, once (checked with
|
|
332
|
+
`forge-dispatch.sh doctor`, no quota): `prepare_retry` claims `escalation.pin` as
|
|
333
|
+
`escalation.pin.applying`, rewrites `tasks.tsv`, appends the `escalations.tsv` row with
|
|
334
|
+
`source=pin`, clears `escalation.stop`/`split.suggested`, then consumes the pin. A symlinked
|
|
335
|
+
`escalations.tsv`, or a symlink in any directory from the plan down to it, is not written:
|
|
336
|
+
the pin stays and nothing is retried. A QA-only resume leaves it for the next full retry;
|
|
337
|
+
A MERGED task refuses one.
|
|
338
|
+
The last column of `escalations.tsv` says who decided: `policy`, `retry` (an explicit
|
|
339
|
+
`--dwarf`) or `pin`; four-column rows read as `policy`. Older rows may say `fallback`.
|
|
340
|
+
A sideways move is recorded in `lateral.tsv`, not here (see [Infrastructure failures](#infrastructure-failures)).
|
|
341
|
+
Every change goes to `control.log` (JSON lines: `at`, `actor` `cli|ui`, `action`, `task`, `key`,
|
|
342
|
+
`value`, `previous`) and to the dataset as a `control` event. Exit 2 invalid input, 3 refused (not
|
|
343
|
+
live, MERGED, failing doctor, lock busy over 5 s). Report them; never set one yourself
|
|
344
|
+
unless asked.
|
|
345
|
+
|
|
346
|
+
Five more commands steer a live scheduler (exit 3 when none is live):
|
|
347
|
+
|
|
348
|
+
- `drain <plan>` starts nothing new: running tasks finish, the scheduler waits (it prints
|
|
349
|
+
`drained — N task(s) waiting` once) and infrastructure waits keep counting down. `resume <plan>`
|
|
350
|
+
ends the drain. This is the supported way to pause a run; nothing has to be signalled. A drain
|
|
351
|
+
holds only tasks still to start: when none is left (or waiting on infrastructure), the run
|
|
352
|
+
ends as it would without the drain, verification included.
|
|
353
|
+
- `stop <plan>` starts nothing new and ends the run once the running tasks are done: a waiting
|
|
354
|
+
infrastructure pause ends too, unstarted tasks stay `PENDING`, verification is skipped and `run`
|
|
355
|
+
exits 130. When every task has merged by then, nothing was cut short: the run ends as usual,
|
|
356
|
+
verifies and exits 0. `stop --now` interrupts the running tasks
|
|
357
|
+
as SIGTERM would.
|
|
358
|
+
- `retry <plan> <task> [--dwarf <spec>]` and `add <plan> <task>` only queue a request, one JSON
|
|
359
|
+
file in `control.requests/`. At its next pass the scheduler applies or refuses it and appends
|
|
360
|
+
an outcome line to `control.log` with the same `request` id (`actor` `scheduler`, `outcome`
|
|
361
|
+
`applied|refused`, `reason`). `retry` takes a `FAIL`, `UNKNOWN`, `TIMEOUT`, `ERROR`,
|
|
362
|
+
`BLOCKED`, `INTERRUPTED` or `STALE` task that is neither running nor waiting. A `STALE`
|
|
363
|
+
task is re-dispatched with the changed prompt on the same implementer, and `--dwarf` is
|
|
364
|
+
refused. The others are prepared exactly as `forge-parallel.sh retry` does. A
|
|
365
|
+
`NEEDS_DECISION` task is resumed only by `--decide` or `--dwarf`, each with `--reason` and
|
|
366
|
+
`--approved`. `--decide split[=fresh]` takes `--subtasks FILE` here (never `--planner`): control
|
|
367
|
+
checks the subtasks, stores them, and the scheduler makes the split and runs it. It spends no automatic retry budget; an `INFRA` task is the scheduler's own
|
|
368
|
+
to resume. `add` takes a row the human appended to `tasks.tsv` (with its
|
|
369
|
+
`tasks/<id>/prompt.md`) whose dependencies this run already knows, and refreshes `waves.tsv`.
|
|
370
|
+
A request never outlives the scheduler that was live when it was queued; one left behind is
|
|
371
|
+
refused, and every request is refused once the run is stopping.
|
|
372
|
+
|
|
373
|
+
**Ordinary execution resume:** run `run` again. Tasks already `MERGED` are skipped. A saved PASS is fingerprint-checked and merged without
|
|
374
|
+
redispatch. PENDING, `INFRA` (paused by an infrastructure failure) and newly unblocked tasks run
|
|
375
|
+
when eligible. A `STALE` task still waiting is prepared with the new prompt and spends nothing.
|
|
376
|
+
A `NEEDS_DECISION` task is not among them: only a decision resumes it. Failed or interrupted tasks
|
|
377
|
+
require an explicit `retry` (or `--retry-failed N`); `run` never silently pays for them again. Worktrees and pinned
|
|
378
|
+
baselines are retained. A per-plan advisory lock excludes concurrent run/retry/integrate
|
|
379
|
+
operations. A `review=group` member left `IMPLEMENTED` is not implemented again; its group's
|
|
380
|
+
review resumes as in [Groups and group review](decompose-opt-in.md#groups-and-group-review-opt-in).
|
|
381
|
+
|
|
382
|
+
From another session or harness, `forge handoff resume <plan>` follows a live scheduler and restarts a stopped run with its recorded flags; see [From another session or harness](../docs/decomposed-runs.md#from-another-session-or-harness). The `run` and per-task `retry` above remain the way to finish by hand.
|
|
383
|
+
|
|
384
|
+
**Interrupts.** A SIGINT or SIGTERM to `run` (or to its scheduler), and `forge control stop
|
|
385
|
+
--now`, first reap the tasks that already ended (a PASS still merges), then send TERM to each
|
|
386
|
+
running task's process group, wait up to `FORGE_INTERRUPT_GRACE` seconds (default 10) for the
|
|
387
|
+
group to empty and KILL what is left. Only those live tasks become `INTERRUPTED`; their worktree
|
|
388
|
+
keeps the partial work. Each guarded dispatch records its harness in `tasks/<id>/<role>.harness`
|
|
389
|
+
(pid and start time), and `forge-guard.py stop` ends a harness that outlived its dispatch, at
|
|
390
|
+
the interrupt and again at the next scheduler start (a scheduler killed outright leaves tasks
|
|
391
|
+
`RUNNING`; the next run stops their harnesses and marks them `INTERRUPTED`). An interrupted
|
|
392
|
+
`run` skips verification and its rerun, prints `forge-parallel.sh retry <plan> <id>` for each
|
|
393
|
+
interrupted task, releases the plan lock and exits **130**. A signal that arrives during
|
|
394
|
+
verification stops the verify command's whole process tree (TERM, then KILL after a few
|
|
395
|
+
seconds) and records `verification.status` `INTERRUPTED`; that verification is not rerun.
|
|
396
|
+
|
|
397
|
+
**A split task resumes with its subtasks.** `run <plan>` enters a split task again and runs its
|
|
398
|
+
sub-plan (`<plan>/tasks/<id>/sub`) where it stands: merged subtasks are skipped, and no subtask
|
|
399
|
+
is made twice. A task `BLOCKED` with `sub.waiting` is waiting for subtasks that failed or need a
|
|
400
|
+
person; deal with each in the sub-plan (`retry <plan>/tasks/<id>/sub <subtask> …`), then `run
|
|
401
|
+
<plan>`. `forge handoff resume` recovers stale `RUNNING` subtasks in each sub-plan the same way
|
|
402
|
+
it recovers tasks. A plan made with Fractal (removed in 0.23) is never resumed: `run`, `retry`
|
|
403
|
+
and `forge handoff resume` refuse it, exit 3.
|
|
404
|
+
|
|
405
|
+
## Infrastructure failures
|
|
406
|
+
|
|
407
|
+
A usage window, a spent budget, an auth problem, a rate limit, a provider outage, a network error,
|
|
408
|
+
an empty answer or a cancelled dispatch says nothing about the work. The status stays **`INFRA`**.
|
|
409
|
+
`forge-dispatch.sh` classifies the stop from the dispatch log (strong phrases and structured
|
|
410
|
+
`is_error`/`turn.failed` results only; a reply that otherwise succeeded is never reclassified) and
|
|
411
|
+
exits **8**, writing `<role>.infra` (`class=`, `retry_after=`, `reset_at=` when the wait is known,
|
|
412
|
+
`detail=`, `rc=`, `role=`, `harness=`, `model=`). `do_task` copies that file to
|
|
413
|
+
`tasks/<id>/infra.txt` and adds `stage=dwarf|qa`. The class is a symptom. What happens next is the
|
|
414
|
+
cause, from `CAUSES` in `scripts/forge_infra.py`. A run recorded before the split may say `quota`;
|
|
415
|
+
that name is recovered as `usage_limit`, and the summary still prints the stored word.
|
|
416
|
+
|
|
417
|
+
- a **dwarf-stage** stop refunds the attempt counter;
|
|
418
|
+
- a **QA-stage** stop keeps the attempt (the dwarf's work is committed) and writes the `resume=qa`
|
|
419
|
+
marker, so the next entry re-reviews without running the dwarf.
|
|
420
|
+
|
|
421
|
+
| Cause | Scope | Move | Without a peer | Hint |
|
|
422
|
+
|---|---|---|---|---|
|
|
423
|
+
| `capacity` | model | lateral | wait | — |
|
|
424
|
+
| `rate_limit` | model | wait | wait | — |
|
|
425
|
+
| `usage_limit` | harness | lateral | wait_if_reset | wait for the reset, or add another harness to this tier's pool |
|
|
426
|
+
| `budget` | harness | lateral | ask | add credits, or check the billing of {harness} |
|
|
427
|
+
| `auth` | harness | lateral | ask | log in to {harness} again |
|
|
428
|
+
| `network` | all | wait | wait | — |
|
|
429
|
+
| `provider_down` | harness | lateral | wait | — |
|
|
430
|
+
| `empty` | model | retry | wait | — |
|
|
431
|
+
| `cancelled` | model | retry | ask | check {harness}'s approval and permission settings |
|
|
432
|
+
|
|
433
|
+
**Scope** is what the pause holds back. `model` pauses that model on that harness
|
|
434
|
+
(`model:<harness>/<model>`); `harness` pauses that harness's account (`harness:<harness>`);
|
|
435
|
+
`all` pauses everything, so running tasks drain and nothing new starts. A model or harness cause
|
|
436
|
+
with no harness, or a model cause with no model, pauses everything. Other tasks keep running. A
|
|
437
|
+
pending task whose next dispatch needs a paused pair waits; unstarted tasks stay `PENDING`, never
|
|
438
|
+
`BLOCKED`.
|
|
439
|
+
|
|
440
|
+
**Move** is what happens first. **lateral** sends the work to another model of the same tier —
|
|
441
|
+
another harness or account when the scope is a harness, another model when the scope is one model —
|
|
442
|
+
and never a stronger tier. **wait** pauses the scope until the cause clears and spends one of that
|
|
443
|
+
scope's waits. **retry** dispatches the same model again at once and spends no wait; the next stop
|
|
444
|
+
of that same cause is treated as lateral.
|
|
445
|
+
|
|
446
|
+
**Without a peer** is the recovery when no model can take the work. **wait** is the pause above.
|
|
447
|
+
**wait_if_reset** waits when the reset is known and inside six hours, and asks otherwise; if this
|
|
448
|
+
task did move sideways, the scope waits rather than asking. **ask** pauses the scope, marks it
|
|
449
|
+
**needs you** with the hint (`{harness}` filled in), and spends no wait. Nothing on that scope is
|
|
450
|
+
retried until a person acts. Raising the infra-retry budget above the value it had when it asked
|
|
451
|
+
starts a wait after all. "Needs you" is that end of the recovery: no peer, and the cause will not
|
|
452
|
+
clear by itself.
|
|
453
|
+
|
|
454
|
+
**Lateral recovery** is on for a new plan. `plan` writes `infra_fallback` as `on`;
|
|
455
|
+
`plan --no-infra-fallback` writes `off`, and a re-plan keeps the file as it is. A plan with no file stays off. `run --infra-fallback` and
|
|
456
|
+
`run --no-infra-fallback` write the file, and `forge control set infra-fallback on|off` applies at
|
|
457
|
+
the next infrastructure stop. It runs at the dwarf stage and at the QA stage:
|
|
458
|
+
|
|
459
|
+
- a **dwarf-stage** stop takes the next healthy model of the tier the task is running in: the tier
|
|
460
|
+
recorded at its newest assignment (the plan's pick, explored or not, an escalation, a pin, a
|
|
461
|
+
`retry --dwarf`, an earlier move), as long as it still runs that model; otherwise its difficulty.
|
|
462
|
+
A re-plan that keeps a row's model keeps its tier. A pinned implementer is not moved. No attempt
|
|
463
|
+
is spent.
|
|
464
|
+
- a **QA-stage** stop takes a reviewer of the same strength from `qa-routing.json`: the next member
|
|
465
|
+
of the task's difficulty pool, then of `any`, on a pair nobody paused. Never the stopped
|
|
466
|
+
reviewer's model, and never the implementer's. The attempt and the `resume` marker stay, so the
|
|
467
|
+
next entry is QA only. A reviewer no such pool lists, or a plan with no `qa-routing.json`, has
|
|
468
|
+
no peer. A pin waits for the next full retry.
|
|
469
|
+
|
|
470
|
+
Each move is a row of `tasks/<id>/lateral.tsv` (epoch, attempt, role `dwarf` or `qa`, from, to,
|
|
471
|
+
cause) and a `lateral` dataset event. It is not an escalation: it is not written to
|
|
472
|
+
`escalations.tsv`, and the escalation streak carries across the dwarf moves. A pool with no healthy
|
|
473
|
+
member keeps the ordinary pause.
|
|
474
|
+
|
|
475
|
+
Without `--infra-retries`, `run` ends once nothing else can run, prints what to fix and exits `8`;
|
|
476
|
+
verification is skipped, and running the same command again resumes. `run --infra-retries M` waits
|
|
477
|
+
out each scope instead, up to `M` waits **per scope** (a stop in a scope already paused joins its
|
|
478
|
+
wait and is not counted again). A scope whose waits are used up stays paused. An asking scope
|
|
479
|
+
spends none of those waits.
|
|
480
|
+
|
|
481
|
+
Each wait is the provider's retry-after when the log carried one (capped at 6 h), otherwise the
|
|
482
|
+
backoff shape for that wait number. `--infra-backoff <shape>` on `run` (kept as `infra_backoff`,
|
|
483
|
+
read at every wait, so `forge control set infra-backoff` applies to the next one) takes
|
|
484
|
+
`exp:<base>[,<cap>]` (base doubling, capped at `<cap>`, default the larger of the base and 30 min),
|
|
485
|
+
`linear:<start>,<step>[,<cap>]`, or `list:<a>,<b>,...` (a bare `<a>,<b>,...` is a list; the last
|
|
486
|
+
value repeats), all in positive seconds. The default is `exp:60`; `FORGE_INFRA_BACKOFF` changes
|
|
487
|
+
that base. The wait message names the source, for example `waiting 120s before resuming (backoff
|
|
488
|
+
exp:60, wait 2 of 3)`. While anything is paused, `infra.paused` (JSON `{"scopes": [...]}` with
|
|
489
|
+
`scope`, `class`, `harness`, `model`, `tasks`, `cycle`, `until`, `exhausted`, `needs_you`, `hint`,
|
|
490
|
+
`reset_at`) says what waits and until when. It is removed when nothing is paused, and again when
|
|
491
|
+
the scheduler exits, so a summary printed after the run reads `infra.txt` alone.
|
|
492
|
+
|
|
493
|
+
The run summary and `forge control show` name the cause, the reset when it is known
|
|
494
|
+
(`resets HH:MM`, with the date when it is not today), and **needs you** with the hint. The
|
|
495
|
+
summary's line is ` <task> <cause> on <harness>/<model> (<stage> stage)`, then the reset and
|
|
496
|
+
`— needs you: <hint>`, and a move is `moved sideways: <task> <role> <from> → <to> (<cause>)`.
|
|
497
|
+
`forge control show` prints the cause on the task's status (`INFRA (cause)`) and, while the
|
|
498
|
+
scheduler is live, on each pause line. forge-ui shows the same facts; the words it uses are in
|
|
499
|
+
[forge-ui](ui.md).
|
|
500
|
+
|
|
501
|
+
A dwarf that exits 0 with an empty final message *and* an empty diff is `class=empty`: it never
|
|
502
|
+
really ran.
|
|
503
|
+
|
|
504
|
+
A planned pause (a provider maintenance window, a quota reset) is `forge control drain`, not a
|
|
505
|
+
signal: running tasks finish, nothing new starts, and `forge control resume` continues the same
|
|
506
|
+
run.
|
|
507
|
+
|
|
508
|
+
## Implementer guards
|
|
509
|
+
|
|
510
|
+
forge records what it observed about how each dwarf behaved, never what the dwarf claimed:
|
|
511
|
+
HEAD or the checked-out ref moved (**self-commit / branch switch**), processes left alive in the
|
|
512
|
+
harness's session after it exited, or started by it in a session of their own (**orphans**, listed in `dwarf.orphans` and stopped; disabled by
|
|
513
|
+
`FORGE_ORPHAN_GUARD=off`), and a final message that **promises later work**.
|
|
514
|
+
They are written to `tasks/<id>/guard.txt`, added to the QA prompt as "Implementer guard notes" and
|
|
515
|
+
shown in the run summary. They never change a status. The dwarf prompt itself tells the
|
|
516
|
+
implementer not to commit, not to start background processes, to finish every measurement before
|
|
517
|
+
its last message, and to say plainly what it could not run.
|
|
518
|
+
|
|
519
|
+
## Accepting, splitting, combining and the whole-run review
|
|
520
|
+
|
|
521
|
+
Four subcommands act on plans after tasks have run. Full usage and refusal conditions are in the
|
|
522
|
+
[README](../docs/reviews.md#accepting-a-task-despite-its-reviewer); the mechanics:
|
|
523
|
+
|
|
524
|
+
- **`adopt <plan> <commit|a..b> --reason …`**, or **`adopt <plan> --head --reason …`** (each with
|
|
525
|
+
`--qa <spec>`, `--yolo-qa`, `--approved`), brings a commit
|
|
526
|
+
made outside forge into the run instead of leaving `review` refusing. The first cherry-picks onto the
|
|
527
|
+
integration branch. `--head` takes what is already on it past `accepted.integration`, and it is what
|
|
528
|
+
`review`'s refusal names. The run's QA (`--qa`, then `final_qa`, then the first task's) reviews that
|
|
529
|
+
range alone against the reason, and no implementer runs. PASS, or a verdict the threshold accepts, moves
|
|
530
|
+
`accepted.integration`, adds a row to `adoptions.tsv` (epoch, base, tip, verdict, approved, spec, review,
|
|
531
|
+
reason) and to `control.log`, writes an `adopt` dataset event, and verifies as a retry does. A FAIL or
|
|
532
|
+
UNKNOWN puts the branch back and exits 5, unless `--approved` keeps it, which writes the findings to the
|
|
533
|
+
adoption's `known_issues.md` as `accept` does; `forge issues` and the run's report read that file (as
|
|
534
|
+
accepted findings, the reason with them), and the sweep lists them as `accepted` without fixing them;
|
|
535
|
+
what the review tolerated under the threshold the sweep fixes like a task's. The reviewer is told the
|
|
536
|
+
run's verification command (or its lanes' commands), which runs only after the review. A review that concluded nothing always puts it back: a crash or timeout exits 5, an
|
|
537
|
+
infrastructure stop exits 8, a signal exits 130 or 143. If the worktree changed during the review it is
|
|
538
|
+
left as it is, with the commands to go on. A range that lived only on the branch stays at
|
|
539
|
+
`refs/forge/adopt-refused/<dir>`. A merge commit is refused, and a range that does not apply exits 6. A
|
|
540
|
+
diff over 400 KB is read in the snapshot rather than inlined, as in a final review.
|
|
541
|
+
There is no task row, because no model implemented it; the final review reads the whole range and is told
|
|
542
|
+
about it, `attribute` treats it as a step of its own, and forge-ui lists it above the final review, each
|
|
543
|
+
row opening its review, its findings and the range's diff with the findings pinned.
|
|
544
|
+
`adopt-<epoch>-<pid>/` keeps the review.
|
|
545
|
+
A range that extends one a review refused, or one named with `--resubmit <adopt-dir>`, is a resubmission
|
|
546
|
+
(#155): its reviewer gets the previous findings and the commits and diff since, and settles each earlier
|
|
547
|
+
finding and its siblings first; after `--escalate-after` refusals of the same work (3 by default) the next
|
|
548
|
+
one waits for the user (`--decide resubmit`, `--approved`, or adopting it in parts), and each review
|
|
549
|
+
records its number in `adopt-*/submission`.
|
|
550
|
+
- **`accept <plan> <task> --reason … --approved`** overrides a `FAIL`/`UNKNOWN` reviewer only
|
|
551
|
+
when the reviewed commit is still the branch tip and the worktree still matches
|
|
552
|
+
`source.fingerprint`. It records `known_issues.md` and `accepted.by`, merges through `merge_task`,
|
|
553
|
+
and restores the prior state if the merge fails. The orchestrator never runs it unprompted.
|
|
554
|
+
- **`review <plan> [--qa <spec>]`** and **`integrate --final-review <spec>`** run one QA dispatch
|
|
555
|
+
over the combined result (`integration.base..tip`, or `parent..candidate`) in a disposable
|
|
556
|
+
checkout with the goal, every task's requirements, known issues, drift, guard notes and the
|
|
557
|
+
verification result in front of the reviewer. Same verdict/severity contract and
|
|
558
|
+
threshold gate as per-task QA; a mutation during the review is `INVALIDATED`; a `FAIL`
|
|
559
|
+
or missing verdict blocks `integrate` with exit `5`, an infrastructure stop with `8`, and the
|
|
560
|
+
user's branch is never touched. Nothing runs unless one of them is invoked.
|
|
561
|
+
- **`split <plan> <new-plan> --tasks a,b`** copies the selected tasks' saved state to a new plan,
|
|
562
|
+
renames their branches and worktrees to the new run id, starts a new integration branch at the
|
|
563
|
+
source's accepted tip and removes them from the source (refuses plans made with Fractal, a sub-plan, a task that has
|
|
564
|
+
subtasks, `MERGED` or `RUNNING` tasks, and selections that strand a dependent).
|
|
565
|
+
- **`combine <new-plan> <plan>…`** merges the integration branches of fully merged plans into one
|
|
566
|
+
new plan whose `run` only verifies. Task branches keep their original names.
|
|
567
|
+
|
|
568
|
+
`split`/`combine` hold the plans' advisory locks for their whole duration, and every failure path
|
|
569
|
+
removes what it created.
|