@giamme/forge 0.22.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 +61 -0
- package/README.md +19 -12
- package/SKILL.md +137 -216
- package/VERSION +1 -1
- 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 +11 -9
- package/docs/forge-ui.md +33 -4
- package/docs/install.md +37 -5
- package/docs/memory.md +6 -1
- package/docs/models.md +36 -10
- package/docs/reviews.md +44 -25
- package/docs/safety.md +27 -2
- package/docs/troubleshooting.md +7 -10
- package/forge +25 -4
- package/package.json +2 -1
- 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 +143 -12
- 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 +777 -54
- package/scripts/forge-dispatch.sh +95 -12
- package/scripts/forge-du.py +13 -3
- package/scripts/forge-handoff.py +221 -39
- package/scripts/forge-install-ripwire.sh +100 -24
- package/scripts/forge-install.sh +18 -32
- 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 +21 -0
- package/scripts/forge-lib-group.sh +4 -1
- package/scripts/forge-lib-plans.sh +30 -18
- package/scripts/forge-lib-review.sh +28 -8
- package/scripts/forge-lib-task.sh +225 -56
- package/scripts/forge-lib-verify.sh +59 -10
- package/scripts/forge-memory.sh +81 -4
- package/scripts/forge-metrics.sh +4 -2
- package/scripts/forge-parallel-options.sh +23 -4
- package/scripts/forge-parallel.sh +447 -175
- 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 +37 -12
- package/scripts/forge-schedule.py +124 -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 +33 -56
- package/scripts/forge-sweep.py +2 -1
- package/scripts/forge-ui.py +8 -1
- package/scripts/forge-update.sh +2 -2
- package/scripts/forge-verify.py +16 -1
- package/scripts/forge-version.py +13 -1
- package/scripts/forge-watch.py +7 -2
- 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/profiles.py +11 -14
- package/scripts/forge_decompose.py +987 -0
- 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_prefs.py +138 -0
- package/scripts/forge_side/__init__.py +10 -0
- 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 +46 -14
- 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 +456 -59
- 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 +29 -29
- 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
package/references/decompose.md
CHANGED
|
@@ -1,38 +1,33 @@
|
|
|
1
|
-
# Decomposed runs
|
|
1
|
+
# Decomposed runs: planning
|
|
2
2
|
|
|
3
3
|
Mechanics behind `--decompose-level`: how a goal becomes tasks, how tasks are routed to
|
|
4
|
-
dwarves by difficulty, how waves are computed, and
|
|
4
|
+
dwarves by difficulty, how waves are computed, the size and gates a plan must pass, and its shape.
|
|
5
|
+
Read this file to plan a decomposed run; it is the only one planning needs.
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
The rest of the decomposition reference is split by phase, so a run reads only what applies:
|
|
8
|
+
|
|
9
|
+
- [Reviews and verdicts](decompose-review.md): QA verdicts, fail-first evidence, pre-review tests,
|
|
10
|
+
implementer sessions, shadow reviews, severity, thresholds, known issues and the finding sweep.
|
|
11
|
+
- [Retries, stops and recovery](decompose-recovery.md): retrying and resuming, `NEEDS_DECISION`
|
|
12
|
+
and reviews that don't converge, `INFRA` stops, implementer guards, accept, split and combine.
|
|
13
|
+
- [Integration and verification](decompose-integration.md): chained plans, branches and worktrees,
|
|
14
|
+
worktree setup, failure modes, execution checks and the integration verification.
|
|
15
|
+
- [Opt-in modes](decompose-opt-in.md): groups and group review, retro notes, brief mode and task
|
|
16
|
+
summaries.
|
|
8
17
|
|
|
9
18
|
## Contents
|
|
10
19
|
|
|
11
20
|
- [The two axes: decompose-level and difficulty](#the-two-axes-decompose-level-and-difficulty)
|
|
12
21
|
- [tasks.tsv](#taskstsv)
|
|
13
22
|
- [Routing](#routing)
|
|
14
|
-
- [
|
|
15
|
-
- [
|
|
16
|
-
- [Fractal within decomposed tasks](#fractal-within-decomposed-tasks)
|
|
23
|
+
- [Subtasks: a task split at any level](#subtasks-a-task-split-at-any-level)
|
|
24
|
+
- [A goal larger than one plan](#a-goal-larger-than-one-plan)
|
|
17
25
|
- [Waves and disjointness](#waves-and-disjointness)
|
|
18
|
-
- [Groups and group review (opt-in)](#groups-and-group-review-opt-in)
|
|
19
26
|
- [Task size and acceptance criteria](#task-size-and-acceptance-criteria)
|
|
20
27
|
- [Plan gates: sent back, and the block under the table](#plan-gates-sent-back-and-the-block-under-the-table)
|
|
21
28
|
- [The capsule](#the-capsule)
|
|
22
29
|
- [Planning](#planning)
|
|
23
30
|
- [Plan shape](#plan-shape)
|
|
24
|
-
- [QA verdicts](#qa-verdicts)
|
|
25
|
-
- [Retro notes (opt-in)](#retro-notes-opt-in)
|
|
26
|
-
- [Brief mode (opt-in)](#brief-mode-opt-in)
|
|
27
|
-
- [Task summaries (opt-in)](#task-summaries-opt-in)
|
|
28
|
-
- [Severity, thresholds and known issues](#severity-thresholds-and-known-issues)
|
|
29
|
-
- [Retrying, and resuming an interrupted run](#retrying-and-resuming-an-interrupted-run)
|
|
30
|
-
- [Infrastructure failures](#infrastructure-failures)
|
|
31
|
-
- [Implementer guards](#implementer-guards)
|
|
32
|
-
- [Accepting, splitting, combining and the whole-run review](#accepting-splitting-combining-and-the-whole-run-review)
|
|
33
|
-
- [Chained plans](#chained-plans)
|
|
34
|
-
- [Branches, worktrees, cleanup](#branches-worktrees-cleanup)
|
|
35
|
-
- [Failure modes](#failure-modes)
|
|
36
31
|
|
|
37
32
|
## The two axes: decompose-level and difficulty
|
|
38
33
|
|
|
@@ -276,51 +271,87 @@ changes. An unchanged command repeats the previous diff, and that retry stops: `
|
|
|
276
271
|
`noretry`, and `The retry changed nothing: the diff is byte-identical to the previous
|
|
277
272
|
attempt.` It is not reviewed again.
|
|
278
273
|
|
|
279
|
-
##
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
274
|
+
## Subtasks: a task split at any level
|
|
275
|
+
|
|
276
|
+
Goal, plans, tasks and subtasks follow one rule: a node is either done as one piece or split
|
|
277
|
+
into children that own parts of it. forge does this itself; there is no other runtime.
|
|
278
|
+
|
|
279
|
+
A split task's subtasks are a plan of their own in `<plan>/tasks/<id>/sub` (its `run_id` is
|
|
280
|
+
`<run>--<id>`, its `parent.json` names the task). They are routed with the plan's difficulty
|
|
281
|
+
pools and reviewer pools, each owns paths **inside the task's `files`**, and `deps` name sibling
|
|
282
|
+
subtasks only. They run on the same scheduler, under the run's one `--max-parallel` for the whole
|
|
283
|
+
tree. Each subtask is reviewed against its own prompt (which carries the task's prompt, so the
|
|
284
|
+
requirement is not lost). When every subtask has merged, their work is merged onto the task's
|
|
285
|
+
branch and the task is reviewed once on the cumulative diff, against the task's prompt. A subtask
|
|
286
|
+
can be split again, the same way.
|
|
287
|
+
|
|
288
|
+
**Who splits.** Never force a split: one task is always a valid answer.
|
|
289
|
+
|
|
290
|
+
- **The planner, at plan time.** A task of its reply may carry `subtasks` and a one-line
|
|
291
|
+
`reason` ([planner contract](planning.md#the-planner-contract-forge-plannerpy)). `plan` makes
|
|
292
|
+
the sub-plan, and the table shows the tree under `subtasks`. A task the planner kept whole with
|
|
293
|
+
a `reason` has that reason recorded.
|
|
294
|
+
- **The user, for a task that stopped.** A `NEEDS_DECISION` whose reasons include `split` offers
|
|
295
|
+
it in `decision.md`. Relay the choice; on the user's word run
|
|
296
|
+
`retry <plan> <id> --decide split --subtasks FILE --reason "<their reason>" --approved`
|
|
297
|
+
(`--planner SPEC` instead of `--subtasks` dispatches one read-only planner about that task).
|
|
298
|
+
You may write the subtasks file yourself when the user asked you to split the task:
|
|
299
|
+
`forge-planner.py node-prompt --plan <plan> --task <id>` writes the rules and the format to
|
|
300
|
+
`tasks/<id>/split.prompt`. On a live run, `forge control retry <plan> <id> --decide split
|
|
301
|
+
--subtasks FILE --reason "…" --approved` queues the same decision.
|
|
302
|
+
- **The run, when the user opted in.** `run --auto-split [--split-planner SPEC]`: a task that
|
|
303
|
+
stops on `split` is split by the planner once, without waiting. Off unless asked for. Offer it
|
|
304
|
+
with the table when the plan has `high` tasks; do not turn it on yourself.
|
|
305
|
+
|
|
306
|
+
`--decide split` keeps the task's work: the subtasks start from its branch and get the last
|
|
307
|
+
review. `--decide split=fresh` starts from the task's base, and the earlier work stays on
|
|
308
|
+
`refs/forge/kept/<run>/<id>`. Ask which, when the user did not say; default to keeping it.
|
|
309
|
+
|
|
310
|
+
**Limits.** `plan --split-depth N` (default 2; `0` = no splitting), `--split-children N` (6) and
|
|
311
|
+
`--split-nodes N` (24, the whole run). They are printed under the task table as
|
|
312
|
+
`decomposition limits: …` and are part of what the user approves. The first `run` freezes them
|
|
313
|
+
(`decomposition.json`: `limits`, `frozen`); a `plan` that would change one afterwards exits 2. A
|
|
314
|
+
split past a limit is not made: the node is recorded `bounded` with the limit it met, and the
|
|
315
|
+
task runs as one task. Say so; do not retry the split.
|
|
316
|
+
|
|
317
|
+
**Outcomes of a split request.** `retry --decide split` exits 0 after running the task with its
|
|
318
|
+
subtasks, or with `--no-dispatch` after making them. It exits 2 and changes nothing when the
|
|
319
|
+
answer was one task (recorded as kept whole, with the reason), when a limit bounded it, or when
|
|
320
|
+
the subtasks were refused (a file outside the task's, a dep that is not a sibling, a cycle, a
|
|
321
|
+
duplicate id, a prompt without `## Acceptance criteria`). A task already split is never split
|
|
322
|
+
again; its subtasks are kept and `run` continues them.
|
|
323
|
+
|
|
324
|
+
**While it runs.** The task is `RUNNING` while its subtasks run. If one fails, stops or waits
|
|
325
|
+
for a person, the task becomes `BLOCKED` with `tasks/<id>/sub.waiting` listing them, no attempt
|
|
326
|
+
of the task is spent, and the summary prints `waiting for their subtasks:` with the sub-plan's
|
|
327
|
+
path. Work on the subtask in its own plan (`retry <plan>/tasks/<id>/sub <subtask>`, and every
|
|
328
|
+
`--answer`, `--decide`, `accept` and `forge control` form), then `run <plan>` again. `run
|
|
329
|
+
--retry-failed N` and `--infra-retries M` reach the subtasks. Resume and retry keep accepted
|
|
330
|
+
decisions and never make a subtask twice.
|
|
331
|
+
|
|
332
|
+
**Records.** `decomposition.json` in each plan of the tree: per task `decision` (`atomic`,
|
|
333
|
+
`split`, `bounded`), `reason`, `by` (`planner`, `user`, `auto`, `default`), `at` and the limits
|
|
334
|
+
in force. `tasks/<id>/decisions.tsv` gets `retry=1 split` or `retry=1 split=fresh`: the split
|
|
335
|
+
grants the one attempt that reviews the whole task. `forge runs tree <plan>` prints the tree;
|
|
336
|
+
`forge control show`, `forge handoff` and `forge watch` name subtasks by path (`<id>/<sub>`);
|
|
337
|
+
forge-ui shows each node's decision, reason, model, tokens and diff.
|
|
338
|
+
|
|
339
|
+
## A goal larger than one plan
|
|
340
|
+
|
|
341
|
+
A planner that judges the goal too large for one plan returns the first coherent stage as
|
|
342
|
+
`tasks` and the stages after it as `later` (title and goal each). `plan` prints them under the
|
|
343
|
+
table (`later stages`), and the run summary names them once every task has merged. Then:
|
|
292
344
|
|
|
293
345
|
```bash
|
|
294
|
-
|
|
295
|
-
bash <skill_dir>/scripts/forge-parallel.sh plan "$PLAN" --repo "$REPO" --decompose-level medium \
|
|
296
|
-
--dwarf sol:high --dwarf-low luna:medium --dwarf-high sol:xhigh,terra:xhigh --qa opus
|
|
297
|
-
|
|
298
|
-
# Preview the selected backend, pools, bounds and workspace without provider calls.
|
|
299
|
-
bash <skill_dir>/scripts/forge-parallel.sh run "$PLAN" --fractal --dry-run
|
|
300
|
-
|
|
301
|
-
# After approval of the task/model table:
|
|
302
|
-
bash <skill_dir>/scripts/forge-parallel.sh run "$PLAN" --fractal \
|
|
303
|
-
--max-parallel 3 --fractal-concurrency 3 --fractal-depth 2
|
|
346
|
+
bash <skill_dir>/scripts/forge-parallel.sh next "$PLAN" [<new-plan-dir>] [--planner <spec>] [plan flags...]
|
|
304
347
|
```
|
|
305
348
|
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
eligible model/harness. Children route by difficulty, then the configured general dwarf,
|
|
313
|
-
then their parent's dwarf. A retry cannot introduce a model outside that frozen pool.
|
|
314
|
-
|
|
315
|
-
`--max-parallel` bounds top-level task pipelines. `--fractal-concurrency` separately bounds
|
|
316
|
-
all active model invocations across their trees, including QA. Parents release their model
|
|
317
|
-
slot while waiting; nesting cannot multiply that limit. Child dependencies must be satisfied,
|
|
318
|
-
ownership must remain inside the parent, and overlapping children are serialized.
|
|
319
|
-
|
|
320
|
-
The choice is persisted in `fractal-selection.json`. Explicit `--fractal` or `--no-fractal`
|
|
321
|
-
skips the once-per-interactive-run question; unattended execution without either is off.
|
|
322
|
-
Installation never activates the backend. The [Fractal reference](fractal.md) documents
|
|
323
|
-
all limits, prerequisites and the child-request protocol.
|
|
349
|
+
`next` needs every task of `$PLAN` `MERGED` (exit 3 otherwise) and a planner (the plan's, or
|
|
350
|
+
`--planner`; exit 2 with neither). It makes the next plan dir (`<first plan dir>-<stage>` unless
|
|
351
|
+
named), starts it from `$PLAN`'s integration branch (`--after`), copies the options, pools and
|
|
352
|
+
limits, dispatches the planner on the code as it now is, and stops at the table. Show that table
|
|
353
|
+
and wait for approval, as for any plan; `--approved` is refused on `next`. `integrate --approved`
|
|
354
|
+
on the last plan brings the whole chain ([chained plans](decompose-integration.md#chained-plans)).
|
|
324
355
|
|
|
325
356
|
## Waves and disjointness
|
|
326
357
|
|
|
@@ -347,296 +378,6 @@ fingerprint checks. A slow unrelated task no longer holds up eligible dependents
|
|
|
347
378
|
|
|
348
379
|
Each task's baseline is pinned immediately before dispatch and stays fixed across retries.
|
|
349
380
|
|
|
350
|
-
## Groups and group review (opt-in)
|
|
351
|
-
|
|
352
|
-
Two opt-ins share `groups.tsv`. A planner may name groups, and those are identity only
|
|
353
|
-
(`review=task`): they do not change dispatch or the estimate, and they are fine under Fractal.
|
|
354
|
-
`plan --groups` with `--group-review` is the other opt-in: one QA review covers several tasks.
|
|
355
|
-
Offer either; never add them unprompted. The user-facing tradeoff is in
|
|
356
|
-
[group review](../docs/reviews.md#group-review-opt-in). The data layer is `scripts/forge_groups`
|
|
357
|
-
and `scripts/forge-groups.py` (`validate`, `derive`, `resolve`, `freeze`, `check`, `of`, `show`).
|
|
358
|
-
|
|
359
|
-
### `groups.tsv`
|
|
360
|
-
|
|
361
|
-
Six tab-separated columns. `#` lines and blank lines are ignored.
|
|
362
|
-
|
|
363
|
-
```
|
|
364
|
-
# id review qa members title goal
|
|
365
|
-
```
|
|
366
|
-
|
|
367
|
-
- `id` matches `[a-z0-9][a-z0-9-]{0,39}`, is unique, and is not also a task id.
|
|
368
|
-
- `review` is `task` or `group`.
|
|
369
|
-
- `qa` is a spec, or `-`.
|
|
370
|
-
- `members` is a comma list of task ids, in order. A task is in at most one group.
|
|
371
|
-
- `title` and `goal` are one line each, or `-` when absent. A planner's title and goal are
|
|
372
|
-
at most 200 characters.
|
|
373
|
-
|
|
374
|
-
Where a row comes from:
|
|
375
|
-
|
|
376
|
-
- A planner reply that includes `groups` writes `groups.tsv` with `review` always `task` and
|
|
377
|
-
`qa` always `-`. A planner group may have one member. The planner never sets `review=group`.
|
|
378
|
-
- `plan --groups waves` makes one group per computed wave that has at least two tasks, named
|
|
379
|
-
`w1`, `w2`, and so on. A wave larger than the max splits in `tasks.tsv` order into `w3a`,
|
|
380
|
-
`w3b`, and so on. A leftover single task is dropped. Each gets the title `Wave 3` (`Wave 3a`)
|
|
381
|
-
and no goal: nothing in a computed wave says what it is for.
|
|
382
|
-
- `--group-review` is only valid with `--groups waves`. Without it, `plan` exits 2:
|
|
383
|
-
`--group-review goes with --groups waves (it sets the review of the groups waves derives)`.
|
|
384
|
-
The derived groups then have `review=group`. High-difficulty tasks stay out and keep their
|
|
385
|
-
own review. A leftover single is dropped.
|
|
386
|
-
- `plan --groups FILE` copies that file. An existing `groups.tsv` and no `--groups` is used
|
|
387
|
-
as it is.
|
|
388
|
-
|
|
389
|
-
`plan` computes waves, then validates, resolves each review group's `qa`, and freezes.
|
|
390
|
-
The approval table shows each group's title and goal, `(no goal)` when it has none, and one line
|
|
391
|
-
naming the groups without a goal. `forge group set PLAN GID --goal "…"` (or `--title`) writes it
|
|
392
|
-
and freezes the groups again, under the control lock and logged in `control.log` (actor `cli`).
|
|
393
|
-
It refuses (exit 3) when `groups.tsv` or a member's deps or files already differ from what `plan`
|
|
394
|
-
froze, since freezing again would accept those edits too. It works on a live run: a title or a
|
|
395
|
-
goal changes no membership, and the next group review or brief prompt uses the new text.
|
|
396
|
-
|
|
397
|
-
### Rules for `review=group`
|
|
398
|
-
|
|
399
|
-
These apply only when `review` is `group`. A `review=task` group is not checked this way.
|
|
400
|
-
|
|
401
|
-
- At least two members, and at most `--group-max-tasks` (default 6, plan file
|
|
402
|
-
`group_max_tasks`). The flag accepts a positive integer. Deriving waves requires at
|
|
403
|
-
least 2 (`max tasks must be at least 2`). Validating an existing file uses the same max,
|
|
404
|
-
so 1 rejects every review group.
|
|
405
|
-
- No member depends on another member, directly or through a task outside the group.
|
|
406
|
-
- Declared `files` do not overlap. A directory covers the paths under it, `.` covers
|
|
407
|
-
everything, and `-` declares nothing. Same rule as the scheduler.
|
|
408
|
-
- No sweep member (an id `sweep-N`, or `tasks/<id>/sweep.json`).
|
|
409
|
-
- `qa` of `-` becomes the QA spec of the highest-difficulty member (`high` over `medium`
|
|
410
|
-
over `low`; a tie takes the first listed), as `tasks.tsv` has it after `plan`.
|
|
411
|
-
|
|
412
|
-
### The freeze, and what makes `run` refuse
|
|
413
|
-
|
|
414
|
-
`groups.frozen` is the sha256 of the freeze text: one line per group, all six columns, then
|
|
415
|
-
one line per member, `member<TAB>deps<TAB>files`. The dwarf column is not in it. No groups
|
|
416
|
-
removes `groups.frozen`. A `groups.frozen` with no `groups.tsv` fails the check.
|
|
417
|
-
|
|
418
|
-
`run` calls `forge-groups.py check` when `groups.tsv` or `groups.frozen` exists, a dry run
|
|
419
|
-
included, before any dispatch. A mismatch, a missing file, or groups that cannot be read
|
|
420
|
-
refuses with `groups.tsv or a member's deps/files changed since plan; run plan again`.
|
|
421
|
-
|
|
422
|
-
Group review and Fractal do not combine. `--fractal`, or a plan that is already fractal,
|
|
423
|
-
makes `plan` and `run` exit 2: `group review does not support Fractal yet`.
|
|
424
|
-
|
|
425
|
-
### The member lifecycle and `IMPLEMENTED`
|
|
426
|
-
|
|
427
|
-
A `review=group` member implements, writes `reviewed.commit` and `source.fingerprint`, and
|
|
428
|
-
stops at `IMPLEMENTED`. There is no per-task QA snapshot, no shadow review, no fail-first
|
|
429
|
-
check, and no QA-only resume (the `resume` marker is removed). `--pre-review-tests` still
|
|
430
|
-
runs, on a snapshot that exists only for that check. Red is `FAIL`, unreviewed, not
|
|
431
|
-
`IMPLEMENTED`.
|
|
432
|
-
|
|
433
|
-
`record_attempt` writes no `attempts.tsv` row while the status is `IMPLEMENTED`, and
|
|
434
|
-
`post_attempt` does nothing. The attempt cap counts `attempts.tsv` rows (an `INFRA` row
|
|
435
|
-
does not count), so that stop spends nothing. The `attempt` counter may already have moved.
|
|
436
|
-
|
|
437
|
-
`retry` and `accept` of an `IMPLEMENTED` task exit 3: `<id> is implemented and waits for
|
|
438
|
-
group <gid>'s review`. The scheduler does not dispatch that member again. A dependent waits
|
|
439
|
-
for `MERGED`, so it does not start.
|
|
440
|
-
|
|
441
|
-
### When a group is reviewed
|
|
442
|
-
|
|
443
|
-
The scheduler treats each `review=group` group as one unit, keyed `group:<gid>` in `active`.
|
|
444
|
-
It is ready when every member is `IMPLEMENTED`, nothing is running it, it has not merged, and
|
|
445
|
-
its status is empty or `WAITING`, or `FAIL` with `settled.round` equal to the current
|
|
446
|
-
`round`, or this run has marked it to review again. It starts as soon as the last member is
|
|
447
|
-
`IMPLEMENTED`. There is no wave barrier. It takes one slot, and it does not start while the
|
|
448
|
-
run is stopping, draining, or paused for infrastructure. The command is
|
|
449
|
-
`forge-parallel.sh _group`.
|
|
450
|
-
|
|
451
|
-
### The candidate, and the size bound
|
|
452
|
-
|
|
453
|
-
The candidate worktree is `<wt_root>/_group-<gid>`. It starts at the integration HEAD, then
|
|
454
|
-
merges each member's `reviewed.commit` with `--no-ff`, in member order.
|
|
455
|
-
|
|
456
|
-
- A member that is not `IMPLEMENTED`: the group is `WAITING`. Members stay as they are.
|
|
457
|
-
- A member whose branch tip is not `reviewed.commit`, or whose worktree fingerprint is not
|
|
458
|
-
`source.fingerprint`: that member becomes `INVALIDATED` with `invalidated.reason`
|
|
459
|
-
`group-candidate`, and the group is `WAITING`.
|
|
460
|
-
- A conflict between members: the group is `CONFLICT`, `conflict.files` lists the files, the
|
|
461
|
-
merge is aborted, the members stay `IMPLEMENTED`, and nothing is dispatched.
|
|
462
|
-
- Any other merge failure, or no integration HEAD: `ERROR`.
|
|
463
|
-
|
|
464
|
-
The fingerprint is the sha256 of the sorted `task=commit` lines plus a final
|
|
465
|
-
`tree=<candidate tree>` line.
|
|
466
|
-
|
|
467
|
-
`combined.diff` is `git diff --binary --irreversible-delete` of the candidate against that
|
|
468
|
-
base, excluding `.forge`. Over `group_max_diff_kb` times 1024 bytes (default 256 when the
|
|
469
|
-
plan file is absent), the group is `NEEDS_DECISION` with reason `oversized`. Nothing is
|
|
470
|
-
dispatched, truncated, or sent to another reviewer. `decision.md` starts `reasons: oversized`
|
|
471
|
-
and offers two edits, then `plan` again: smaller groups in `groups.tsv`, or this group's
|
|
472
|
-
`review` set to `task`. `forge group retry` refuses an oversized group.
|
|
473
|
-
`--group-max-diff-kb N` is a positive integer, written only when given, so a re-plan keeps it.
|
|
474
|
-
The same is true of `--group-max-tasks`.
|
|
475
|
-
|
|
476
|
-
This is not a [whole-run review](../docs/reviews.md#whole-run-review-opt-in). That one reads
|
|
477
|
-
the combined result after the run and truncates. A group review that is over the bound never
|
|
478
|
-
builds a prompt.
|
|
479
|
-
|
|
480
|
-
### The prompt and `{tasks=…}`
|
|
481
|
-
|
|
482
|
-
One fresh QA dispatch. The prompt is the contract head for kind `group` (the task preamble,
|
|
483
|
-
plus that this review covers several tasks and must judge each against its own criteria and
|
|
484
|
-
judge the combined change), the group's title and goal, `Members, in merge order`, then any
|
|
485
|
-
findings from the previous round that named no task. Each member follows: title, `prompt.md`,
|
|
486
|
-
the declared files and the reviewed commit. When the task has them, it also has the intended
|
|
487
|
-
approach, that member's diff `--stat` against its base, pre-review text, guard notes and
|
|
488
|
-
drift. Findings the previous round attributed to the task are quoted, and the implementer's
|
|
489
|
-
reply is included when this attempt is not the one those findings judged. The tail is the task contract plus
|
|
490
|
-
the `{tasks=…}` instructions below, then the whole combined diff in a fence. The diff is not
|
|
491
|
-
truncated. An oversized group never gets here. The threshold is the plan's QA threshold.
|
|
492
|
-
|
|
493
|
-
`{tasks=…}` is its own brace. It is not the facts brace
|
|
494
|
-
`{reach=… origin=… evidence=…}`. The prompt says to write it immediately before the facts
|
|
495
|
-
brace, so the facts brace still ends the line. The last `{tasks=…}` on a finding wins. Ids
|
|
496
|
-
are separated by commas or spaces.
|
|
497
|
-
|
|
498
|
-
Attribution (`scripts/forge_groups/attribute.py`, written to `attribution.json` with the
|
|
499
|
-
round):
|
|
500
|
-
|
|
501
|
-
- A tag names those ids. An empty tag (`{tasks=}` or `{tasks= , }`) names nobody and does
|
|
502
|
-
not fall back to the file.
|
|
503
|
-
- With no tag, the tasks are the members whose changed paths contain the finding's file, in
|
|
504
|
-
member order. A leading `./` is stripped and nothing else is normalised: `src/./a.py` does
|
|
505
|
-
not match `src/a.py`.
|
|
506
|
-
- Ambiguous when the tag names an id that is not a member, when the tag names nobody, when
|
|
507
|
-
there is no tag and no file, or when no member changed that file.
|
|
508
|
-
- `blocking` is the gate's per-finding decision at the threshold (`none` is P3; unset is
|
|
509
|
-
P2). `PLAUSIBLE` never blocks.
|
|
510
|
-
- `implicated` is the union, in member order, of the tasks on blocking findings that are not
|
|
511
|
-
ambiguous. The top-level `ambiguous` list is the `n` of findings that are both blocking
|
|
512
|
-
and ambiguous.
|
|
513
|
-
|
|
514
|
-
The facts line is `implicated<TAB>ambiguous<TAB>findings<TAB>blocking`. The two lists are
|
|
515
|
-
comma separated, or `-`. `findings` is the count. `blocking` is `1` or `0`.
|
|
516
|
-
|
|
517
|
-
### Each outcome, and what happens next
|
|
518
|
-
|
|
519
|
-
The round ends in `groups/<gid>/status`, and one `rounds.tsv` row: round, epoch, status,
|
|
520
|
-
implicated tasks or `-`, QA spec. Status writes are atomic.
|
|
521
|
-
|
|
522
|
-
- **`PASS`.** The scheduler runs `_merge_group`: one `--no-ff` merge of `candidate.commit`
|
|
523
|
-
onto integration (`forge: merge group <gid> (ids)`). Every member is judged `PASS` (one
|
|
524
|
-
`attempts.tsv` row), its status becomes `PASS`, `merged` is touched, and the group's
|
|
525
|
-
`merged` is touched. A conflict sets the group and every member to `CONFLICT`, keeps
|
|
526
|
-
`conflict.files`, and merges nothing. Integration moved (`accepted.integration` does not
|
|
527
|
-
match) or dirty: the group is `INVALIDATED` with `integration-moved` or
|
|
528
|
-
`integration-dirty`, and nothing merges. A member whose branch tip is not its reviewed
|
|
529
|
-
commit, or whose worktree fingerprint is not `source.fingerprint`: those members are
|
|
530
|
-
`INVALIDATED` with `group-candidate`, and the group is `INVALIDATED` with
|
|
531
|
-
`candidate-moved`. A member that is no longer `IMPLEMENTED`, or a recomputed fingerprint
|
|
532
|
-
that does not match, invalidates the group with `candidate-moved` and merges nothing;
|
|
533
|
-
members are not marked `INVALIDATED` unless they moved. A member dependency that is not
|
|
534
|
-
`MERGED` blocks the merge and leaves the status unchanged. `forge group retry` on `PASS`
|
|
535
|
-
refuses; the next `run` merges it.
|
|
536
|
-
- **`FAIL`.** `_group_settle` writes each implicated member's `qa.last` (a header, the
|
|
537
|
-
blocks attributed to it, `Also involves:` when a finding names other members too, then
|
|
538
|
-
`FORGE_VERDICT: FAIL`), runs the QA gate, sets the status to `FAIL`, writes one judged
|
|
539
|
-
attempt row, runs `post_attempt`, and writes `settled.group` (`gid round`). A member that
|
|
540
|
-
is not implicated stays `IMPLEMENTED`: no `qa.last`, no attempt row, no gate. The group
|
|
541
|
-
writes `settled.round`. The scheduler requeues the `FAIL` members when `--retry-failed`
|
|
542
|
-
budget remains. Without it they stay `FAIL` and the others stay `IMPLEMENTED`. The next
|
|
543
|
-
round starts when the implicated members are `IMPLEMENTED` again. Settling the same round
|
|
544
|
-
twice does nothing. A `FAIL` that implicates no member settles nothing.
|
|
545
|
-
- **`NEEDS_DECISION`, ambiguous.** A blocking finding names no member. Members stay
|
|
546
|
-
`IMPLEMENTED`. `decision.md` starts `reasons: ambiguous`. The user names the members with
|
|
547
|
-
`forge group retry PLAN GID --tasks a,b`. That runs `_group_settle --tasks`, which fails
|
|
548
|
-
those members, each with the ambiguous findings (marked as assigned by a decision), and
|
|
549
|
-
also any member the review implicated by its own blocking finding, with only that. It moves
|
|
550
|
-
`decision.md` to `decision.<round>.md`, and sets the group to `FAIL`. The next `run
|
|
551
|
-
--retry-failed` retries those tasks. A live scheduler picks them up on its sweep when
|
|
552
|
-
they have budget left. Do this only when the user says so.
|
|
553
|
-
- **`NEEDS_DECISION`, oversized.** Refused by `forge group retry`. Split `groups.tsv` and
|
|
554
|
-
run `plan` again, or set that group's `review` to `task` and run `plan` again. The reason
|
|
555
|
-
word is the first token after `reasons:`. Only `oversized` and `ambiguous` are handled.
|
|
556
|
-
Any other reason is refused; read `decision.md`.
|
|
557
|
-
- **`UNKNOWN`.** No verdict. Members stay `IMPLEMENTED`. The scheduler reviews the group
|
|
558
|
-
again within `--retry-failed`, counted in `groups/<gid>/retries.used`. No member attempt
|
|
559
|
-
is spent. With the budget spent, the group stays `UNKNOWN`.
|
|
560
|
-
- **`INFRA`, `TIMEOUT`, `ERROR`, `INTERRUPTED`.** `INFRA` is dispatch exit 8: `infra.txt`
|
|
561
|
-
has `stage=qa` and the class, and no attempt is spent. `TIMEOUT` is exit 7. Any other
|
|
562
|
-
dispatch failure is `ERROR`. `forge group retry` on `UNKNOWN`, `INFRA`, `TIMEOUT`,
|
|
563
|
-
`INTERRUPTED` or `ERROR` sets the group status to `INTERRUPTED` and touches no member
|
|
564
|
-
file, so the next `run` reviews it again. `--tasks` is refused in those states. A review
|
|
565
|
-
that dies while `REVIEWING` is marked `ERROR`. A scheduler killed mid-review leaves
|
|
566
|
-
`REVIEWING`; the next `run` turns that into `INTERRUPTED` and reviews again, without
|
|
567
|
-
re-implementing the members.
|
|
568
|
-
- **`INVALIDATED`.** A tracked change to the candidate or to the review snapshot during the
|
|
569
|
-
review. An untracked file in the snapshot is not a change. Also the merge-time reasons
|
|
570
|
-
above. The next `run` reviews it again, unless `invalidated.reason` is
|
|
571
|
-
`integration-moved` or `integration-dirty`. `forge group retry` says the same and does
|
|
572
|
-
not rearm it.
|
|
573
|
-
- **`CONFLICT`.** `forge group retry` refuses. Two paths differ. A conflict while building
|
|
574
|
-
the candidate leaves the members `IMPLEMENTED`, and `retry` of an `IMPLEMENTED` task
|
|
575
|
-
exits 3, so the printed `forge-parallel.sh retry` line does not apply until a member is
|
|
576
|
-
no longer `IMPLEMENTED`. A conflict merging onto integration sets every member to
|
|
577
|
-
`CONFLICT`, and a `CONFLICT` task can be retried.
|
|
578
|
-
- **`WAITING`.** A member is not `IMPLEMENTED`. **`REVIEWING`.** A review is running.
|
|
579
|
-
Neither is retried with `forge group retry`.
|
|
580
|
-
|
|
581
|
-
### Attempt accounting
|
|
582
|
-
|
|
583
|
-
Only a judged attempt writes an `attempts.tsv` row, and the cap counts those rows. An
|
|
584
|
-
`IMPLEMENTED` member spends nothing. A member a `FAIL` does not implicate spends nothing.
|
|
585
|
-
A re-review after `UNKNOWN`, `INFRA`, `TIMEOUT`, `INTERRUPTED` or `ERROR` spends no member
|
|
586
|
-
attempt. On `PASS`, every member gets one judged `PASS` row, including members the findings
|
|
587
|
-
did not name. A later `FAIL` of only some members records one `FAIL` row for each of those,
|
|
588
|
-
at the attempt number they are on. Separately, a task attempt left `STALE` (`prompt.md` or
|
|
589
|
-
`approach.md` changed while it ran) is not judged. `attempts.tsv` records `STALE`, and the cap
|
|
590
|
-
skips that row, as it skips `INFRA`.
|
|
591
|
-
|
|
592
|
-
### Resume
|
|
593
|
-
|
|
594
|
-
`run` again does not re-implement a member left `IMPLEMENTED`. A `PASS` group is merged,
|
|
595
|
-
with no new QA dispatch; a stale member branch is not merged. An unsettled `FAIL` is
|
|
596
|
-
settled, then those members are requeued. `INTERRUPTED`, `INFRA` and `TIMEOUT` are reviewed
|
|
597
|
-
again. `INVALIDATED` is reviewed again unless the reason is `integration-moved` or
|
|
598
|
-
`integration-dirty`. `UNKNOWN` is reviewed again while the group's `--retry-failed` budget
|
|
599
|
-
remains; otherwise the status line is printed. `NEEDS_DECISION`, `CONFLICT` and `ERROR` wait
|
|
600
|
-
for a person. The summary says `forge: <id> is implemented, waiting for group <gid>
|
|
601
|
-
(<status>)` for a member still `IMPLEMENTED`. An empty group status is printed as
|
|
602
|
-
`not reviewed`. A dependent of an unmerged group stays `BLOCKED`.
|
|
603
|
-
|
|
604
|
-
### Files in `groups/<gid>/`
|
|
605
|
-
|
|
606
|
-
`status` (then `PASS`, `FAIL`, `NEEDS_DECISION`, `UNKNOWN`, `CONFLICT`, `INFRA`, `TIMEOUT`,
|
|
607
|
-
`ERROR`, `INVALIDATED`, `WAITING`, or `REVIEWING`; `INTERRUPTED` is written by the scheduler
|
|
608
|
-
or by `forge group retry`), `round`, `rounds.tsv`, `candidate.base`, `candidate.commit`,
|
|
609
|
-
`members.tsv` (round, task, reviewed commit, attempt; one row per member of a round that
|
|
610
|
-
built a candidate), `fingerprint`, `combined.diff`, `members.paths` (`task<TAB>path`),
|
|
611
|
-
`attribution.json`, `qa.input`, `qa.last`, `qa.out`, `qa.gate`, `qa.round-<n>.last`,
|
|
612
|
-
`known_issues.md`, `infra.txt`, `decision.md`, `conflict.files`, `review.base`, `merge.out`,
|
|
613
|
-
`group.out` (the scheduler's log). Settle writes `settled.round`, `settle.tasks` (until the
|
|
614
|
-
round is settled) and `decision.<round>.md`. Merge writes `merged` and, when it refuses,
|
|
615
|
-
`invalidated.reason` (`integration-moved`, `integration-dirty`, `candidate-moved`).
|
|
616
|
-
`retries.used` counts `UNKNOWN` re-reviews. The candidate worktree stays at
|
|
617
|
-
`<wt_root>/_group-<gid>`.
|
|
618
|
-
|
|
619
|
-
On the member: `reviewed.commit`, `source.fingerprint`, `settled.group`, and
|
|
620
|
-
`invalidated.reason` of `group-candidate` when the member moved. Plan files: `groups.tsv`,
|
|
621
|
-
`groups.frozen`, `group_max_tasks`, `group_max_diff_kb`.
|
|
622
|
-
|
|
623
|
-
The dataset records `group_review` and `group_merge`. The QA dispatch has `scope` `group`
|
|
624
|
-
and an empty task, and it is left out of the per-task reviewer statistics. A judged member
|
|
625
|
-
attempt is linked with `review_scope=group`, `group` and `round`, and does not keep a copy
|
|
626
|
-
of that review's `qa.last` or `qa.gate`. See
|
|
627
|
-
[the dataset](dataset.md#raw-events-not-training-examples).
|
|
628
|
-
|
|
629
|
-
`forge group show PLAN [--group GID] [--json]` reads this. `forge group retry` is the
|
|
630
|
-
decision and the rearm above. Exit codes and flags are in
|
|
631
|
-
[commands](../docs/commands.md#the-forge-command).
|
|
632
|
-
|
|
633
|
-
### Out of scope
|
|
634
|
-
|
|
635
|
-
- Shadow reviews of groups. A member skips shadow, and the group dispatch is one fresh QA.
|
|
636
|
-
- Fractal. `group review does not support Fractal yet`.
|
|
637
|
-
- A reviewer session across rounds. The group dispatch does not continue a session.
|
|
638
|
-
- Fail-first on a member. Pre-review tests still run, as above.
|
|
639
|
-
|
|
640
381
|
## Task size and acceptance criteria
|
|
641
382
|
|
|
642
383
|
Size predicts a failed first attempt better than anything forge asks a model. In the run
|
|
@@ -659,7 +400,9 @@ So:
|
|
|
659
400
|
- End every `prompt.md` with an `## Acceptance criteria` section: observable checks the
|
|
660
401
|
reviewer can verify (a behaviour, a command that passes, a file that exists), not
|
|
661
402
|
restated goals. A command names the task's own tests, never the whole suite: the run's
|
|
662
|
-
verification runs the suite
|
|
403
|
+
verification runs the suite once at the end of the run after the tasks merge (a failure is not
|
|
404
|
+
attributed to a task; run `forge-parallel.sh attribute <plan-dir>` or pass `--attribute` on
|
|
405
|
+
`run` to search the merge order), and naming it here makes every attempt run it.
|
|
663
406
|
- `plan` prints an advisory block under the table naming tasks at 7,000 characters or 9
|
|
664
407
|
declared files and over, with the history for their size, tasks with no acceptance
|
|
665
408
|
criteria, and tasks whose acceptance criteria ask for the whole suite (forge's
|
|
@@ -803,7 +546,10 @@ becomes one task, id `combined`:
|
|
|
803
546
|
|
|
804
547
|
The original `tasks.tsv` bytes are kept as `tasks.precollapse.tsv`. Each `tasks/<id>/`
|
|
805
548
|
moves to `tasks.precollapse/<id>/`. `collapsed.json` is `from` (the ids in wave order),
|
|
806
|
-
`into` `combined`, and `shape`. A
|
|
549
|
+
`into` `combined`, and `shape`. A `groups.tsv` is kept as `groups.precollapse.tsv` and
|
|
550
|
+
rewritten: the parts become `combined`, and a group made only of parts is dropped (the file
|
|
551
|
+
goes when no group is left); `collapsed.json` then also has `groups`, with `kept_as` and the
|
|
552
|
+
`dropped` group ids (#257). A one-task or branching plan is left as it is. A plan that
|
|
807
553
|
already has `tasks.precollapse.tsv` or `collapsed.json` is not an error. The table
|
|
808
554
|
announces a collapse only when this call did it:
|
|
809
555
|
|
|
@@ -813,1256 +559,3 @@ collapsed a sequential plan of N tasks into one (tasks.precollapse.tsv keeps the
|
|
|
813
559
|
|
|
814
560
|
`auto` adds `--collapse-chains` unless `--no-collapse`, so the sequential line shows when
|
|
815
561
|
you planned by hand, or when `auto` was told not to collapse.
|
|
816
|
-
|
|
817
|
-
## QA verdicts
|
|
818
|
-
|
|
819
|
-
Decompose-mode QA prompts require a final line:
|
|
820
|
-
|
|
821
|
-
```
|
|
822
|
-
FORGE_VERDICT: PASS — no CONFIRMED finding at the blocking threshold (P2 or worse)
|
|
823
|
-
FORGE_VERDICT: FAIL — at least one CONFIRMED finding at the blocking threshold (P2 or worse)
|
|
824
|
-
```
|
|
825
|
-
|
|
826
|
-
forge decides the verdict from the findings, at a blocking threshold: `P2` unless
|
|
827
|
-
`--qa-threshold` sets another. A CONFIRMED finding at the threshold or worse, or one with no
|
|
828
|
-
severity, blocks: a PASS that lists one becomes FAIL. A CONFIRMED finding below the threshold
|
|
829
|
-
never blocks: a FAIL made only of those is accepted, and either way they are recorded in
|
|
830
|
-
`known_issues.md`, which `forge issues` and the sweep pick up. PLAUSIBLE findings never block.
|
|
831
|
-
`--qa-threshold P3` (or `none`) makes every CONFIRMED finding block.
|
|
832
|
-
|
|
833
|
-
The runner accepts only a standalone verdict on the final nonempty line (the shared parser
|
|
834
|
-
also tolerates the dash gloss the prompt prints after each verdict, trailing whitespace and
|
|
835
|
-
CRLF). A missing verdict is `UNKNOWN` and is treated exactly
|
|
836
|
-
like a failure — excluded from integration and flagged. Merging a diff whose reviewer never
|
|
837
|
-
reached a conclusion would defeat the point of reviewing it, so the ambiguous case fails
|
|
838
|
-
safe rather than optimistically.
|
|
839
|
-
|
|
840
|
-
A failing task is excluded and its branch preserved; the rest of the run proceeds. There is
|
|
841
|
-
no automatic repair pass unless the run was started with `--retry-failed N`, consistent with
|
|
842
|
-
forge's rule that a dwarf → QA cycle does not loop on its own initiative.
|
|
843
|
-
|
|
844
|
-
The prompt contract (preamble, findings format, severity definitions and the verdict lines)
|
|
845
|
-
comes from one place, `scripts/forge-contract.py`, shared by solo, decomposed and the final
|
|
846
|
-
review; the implementer rules appended to every dwarf prompt come from the same module.
|
|
847
|
-
When the run verifies the repository (`--verify`, verification lanes or `.forge/verify`), those
|
|
848
|
-
rules tell the implementer never to run the whole suite, even when the task's acceptance
|
|
849
|
-
criteria name it, and to report it as left to forge: the suite runs once, after the merge.
|
|
850
|
-
Without verification, the implementer runs the whole suite only when the task asks for it.
|
|
851
|
-
|
|
852
|
-
### Fail-first evidence (opt-in)
|
|
853
|
-
|
|
854
|
-
`plan --fail-first` (and `forge-solo.sh --fail-first`) checks that the tests a change adds
|
|
855
|
-
or edits can fail. Before each review, forge exports the reviewed commit and, separately,
|
|
856
|
-
the task's base plus only the change's test-path files (tests, their fixtures and helpers),
|
|
857
|
-
then runs `.forge/verify-subset` (a per-file test command that contains `{files}`, such as
|
|
858
|
-
`pytest -q {files}` or `npm test -- {files}`; it is a separate file from `.forge/verify` because
|
|
859
|
-
there is no general way to restrict an arbitrary command to a file list) once per new or
|
|
860
|
-
edited test file in each. Every file gets one result in
|
|
861
|
-
`tasks/<id>/failfirst.json` (solo: `<run>/failfirst.json`):
|
|
862
|
-
|
|
863
|
-
- `proven`: passes with the change, fails without it;
|
|
864
|
-
- `passes_without_change`: passes both ways, so it does not prove the change;
|
|
865
|
-
- `inconclusive`: fails even with the change (a broken test or a missing dependency);
|
|
866
|
-
- `error`: could not run (export failure, or `FORGE_FAIL_FIRST_TIMEOUT`, default 600 s, per run).
|
|
867
|
-
|
|
868
|
-
The reviewer's prompt lists the results and asks for a `[P2][CONFIRMED]` finding for each
|
|
869
|
-
test that passes without the change, unless the reviewer explains why it need not fail
|
|
870
|
-
(a refactor kept green). It is advice: forge never changes a status or verdict from it, and
|
|
871
|
-
a P2 only blocks through the reviewer and the usual threshold gate (`P2` by default, see [QA verdicts](#qa-verdicts)). The exports are
|
|
872
|
-
throwaway directories outside the review snapshot, so no fingerprint changes. forge-ui
|
|
873
|
-
shows the evidence under the task's review findings, and each check is recorded in the
|
|
874
|
-
run dataset as a `fail_first` event with the JSON attached. Without
|
|
875
|
-
`.forge/verify-subset` the check records `skipped` and the prompt says nothing.
|
|
876
|
-
`plan --no-fail-first` turns it off again.
|
|
877
|
-
|
|
878
|
-
### Pre-review tests (opt-in)
|
|
879
|
-
|
|
880
|
-
`plan --pre-review-tests` runs **only the tests an attempt affects** before paying for its
|
|
881
|
-
review, never the whole suite (that stays the run's end-of-run verification). After an attempt is
|
|
882
|
-
committed, forge exports the reviewed commit and runs `.forge/verify-subset` on a selection:
|
|
883
|
-
|
|
884
|
-
1. the test files the change adds or edits;
|
|
885
|
-
2. for each changed source file, the tests from the first source that answers: `.forge/test-map`,
|
|
886
|
-
then the naming convention (`foo.py` → `test_foo.py`, `foo_test.py`, `foo.test.js`, ...), then
|
|
887
|
-
a reverse lookup (test files that name the changed module);
|
|
888
|
-
3. with `{changed}` in the command instead of `{files}`, the changed paths themselves, for a runner
|
|
889
|
-
that finds the related tests on its own (`npx jest --findRelatedTests {changed}`).
|
|
890
|
-
|
|
891
|
-
`.forge/test-map` is the reliable source; one rule per line, `#` comments, globs where `*` also
|
|
892
|
-
matches `/`, and `-` for "no tests":
|
|
893
|
-
|
|
894
|
-
```
|
|
895
|
-
scripts/forge-issues.py tests/test_issues.py tests/test_sweep.py
|
|
896
|
-
ui/forge_ui/*.py ui/tests/test_*.py
|
|
897
|
-
docs/* -
|
|
898
|
-
```
|
|
899
|
-
|
|
900
|
-
A change to shared test infrastructure (a conftest, a test helper, a lockfile, a build file),
|
|
901
|
-
more than 20 selected files (`FORGE_PRE_REVIEW_MAX_FILES`) or a run past 120 s
|
|
902
|
-
(`FORGE_PRE_REVIEW_TIMEOUT`) makes the check `skipped` as too broad. A failing run is rerun file
|
|
903
|
-
by file (a file that passes alone is `flaky`), and each file that still fails is run on the task
|
|
904
|
-
base: one that fails there too is `pre-existing` and does not count against the attempt.
|
|
905
|
-
|
|
906
|
-
- **Red** (`failed`): the attempt is `FAIL` without a review. Its retry findings are the failing
|
|
907
|
-
tests and the end of their output, labelled as forge's (`tasks/<id>/prereview.md`). It counts
|
|
908
|
-
toward `--retry-failed` and `--escalate-after` like a rejected attempt.
|
|
909
|
-
- **Green**, `flaky` or `pre-existing`: the review runs, and the reviewer's prompt says what forge
|
|
910
|
-
ran and found.
|
|
911
|
-
- **Skipped or broken** (no `.forge/verify-subset`, nothing selected, too broad, a command error):
|
|
912
|
-
the review runs exactly as without the option. The check never blocks on its own failure.
|
|
913
|
-
|
|
914
|
-
The implementer is told forge will run them, so it need not repeat them exhaustively. Checks run
|
|
915
|
-
in throwaway exports, so neither the task worktree nor any fingerprint changes; at most 2 run at
|
|
916
|
-
once across the plan's tasks (`plan --pre-review-parallel N`, 1-64). A QA-only resume reuses the
|
|
917
|
-
check of the commit it re-reviews. `tasks/<id>/prereview.json` records the selection, every run
|
|
918
|
-
and the outcome; forge-ui shows it under the task's review findings, and the dataset records a
|
|
919
|
-
`pre_review` event. `forge control set <plan> pre-review-tests on|off` and `pre-review-parallel N`
|
|
920
|
-
change both while a run works; `plan --no-pre-review-tests` turns it off.
|
|
921
|
-
|
|
922
|
-
### Implementer session (opt-in)
|
|
923
|
-
|
|
924
|
-
`plan --implementer-session` makes a retry **continue the implementer's own session** instead of
|
|
925
|
-
starting one that re-reads the same files: the dwarf keeps what it learned, and the retry's prompt
|
|
926
|
-
(the task, the findings, the rules) arrives as the next turn, after a short note that its work is
|
|
927
|
-
as it left it. It applies to claude and openclaude. codex's `exec resume` takes no sandbox flag, so
|
|
928
|
-
a codex implementer could be resumed only by a config override nobody verifies, and it stays fresh.
|
|
929
|
-
|
|
930
|
-
A retry continues only when all of these hold; anything else is a fresh session, as without the
|
|
931
|
-
option:
|
|
932
|
-
|
|
933
|
-
- it carries findings from a review, or from pre-review tests, of a commit this session made;
|
|
934
|
-
- the worktree is still exactly that commit: no edits since (a timed-out or interrupted attempt
|
|
935
|
-
leaves some), nothing committed on top;
|
|
936
|
-
- the dwarf resolves to the same harness, model and effort, so an escalation (`--escalate-after`,
|
|
937
|
-
a pin, `retry --dwarf`) starts fresh;
|
|
938
|
-
- the plan is not Fractal.
|
|
939
|
-
|
|
940
|
-
A continue the harness refuses or that fails at once (dispatch exit **9**, nothing changed in the
|
|
941
|
-
worktree) is followed by a fresh dispatch of the same prompt, which decides the attempt. One that
|
|
942
|
-
fails after it already changed files is a failed implementer (`ERROR`), as a fresh one would be:
|
|
943
|
-
running another on top would pay for the attempt twice. One row per attempt goes to
|
|
944
|
-
`tasks/<id>/implementer_sessions.tsv`: row, attempt, `continued`, `fresh` or `failed`, the reason
|
|
945
|
-
(`same-spec`, `first-attempt`, `no-findings`, `work-changed`, `no-session`, `invalid-session`,
|
|
946
|
-
`spec-changed`, `harness-unsupported`, `fractal`, `continue-unsupported`, `continue-failed`) and
|
|
947
|
-
the session id it considered. The dataset tags a continued dwarf dispatch `session_continue`, and
|
|
948
|
-
`forge dataset status` counts implementer continues apart from reviewer ones.
|
|
949
|
-
`plan --no-implementer-session` turns it off; `split` and `combine` carry it (combine only when
|
|
950
|
-
every source has it).
|
|
951
|
-
|
|
952
|
-
### Shadow reviews (opt-in)
|
|
953
|
-
|
|
954
|
-
`plan --shadow-qa <spec>[,<spec>...] [--shadow-rate R]` sends a sampled share of
|
|
955
|
-
reviewed attempts (R, default 0.1) to a second, independent reviewer. Its verdict is
|
|
956
|
-
recorded in the run dataset and never read by the run. It exists to measure how often two
|
|
957
|
-
reviewers agree on one diff, which is the noise in every review-based label. The approval
|
|
958
|
-
table shows the reviewers, the rate and the expected extra reviews, and `--shadow-qa none`
|
|
959
|
-
turns shadow reviews off again.
|
|
960
|
-
|
|
961
|
-
- **Which reviewer:** the first listed spec whose model family (Claude, GPT, Gemini, ...)
|
|
962
|
-
differs from the task's reviewer, so the two do not share one blind spot. If none
|
|
963
|
-
differs, the first listed spec that does not resolve to the reviewer's own harness, model
|
|
964
|
-
and effort: the same model at another effort (`same_model`) or another model of the
|
|
965
|
-
family. Only when every listed spec is identical to the reviewer does it run as a
|
|
966
|
-
`control`, two reviews with one setting, which measures noise and never counts as an
|
|
967
|
-
effort comparison (a reviewer pool can hand a task the shadow's own spec). Forge only
|
|
968
|
-
ever uses the specs you list. A spec that cannot run here (`doctor` fails) is dropped
|
|
969
|
-
with a note and never fails the run.
|
|
970
|
-
- **Measuring an effort:** list only specs of the reviewers' own model at another effort,
|
|
971
|
-
for example `--shadow-qa sol:medium` beside `sol:high` reviewers, with a rate high enough
|
|
972
|
-
for at least 30 pairs per comparison. Each pair is one more review, so agree on its cost first.
|
|
973
|
-
- **Which attempts:** a deterministic sample per (run, task, attempt), so a QA-only
|
|
974
|
-
resume decides the same way.
|
|
975
|
-
- **Same evidence, separate everything else.** The shadow reviews a byte-identical copy of
|
|
976
|
-
the primary's prompt, in its own snapshot, from its own dir
|
|
977
|
-
(`<plan>/shadow/<task>/<attempt>-<k>/`). Nothing reads that dir. It writes no status,
|
|
978
|
-
memory, ledger, gate or retry findings, and a reviewer that edits its snapshot is
|
|
979
|
-
recorded as `invalid`.
|
|
980
|
-
- **Bounded:** it runs beside the primary, and the task waits for it before writing any
|
|
981
|
-
status. Once the primary is done, the shadow gets as long again as the primary took
|
|
982
|
-
(at least 5 minutes), then it is stopped. It dies with its task, including on Ctrl-C of
|
|
983
|
-
a manual `retry`.
|
|
984
|
-
- **Scope:** parallel mode only, and never under Fractal.
|
|
985
|
-
|
|
986
|
-
`./forge dataset status` reports the agreement rate, overall and per model pair, and
|
|
987
|
-
`./forge dataset pairs` splits it by what differs between the two reviewers: effort within one
|
|
988
|
-
model, another model of the family, another family, and controls. For each pair of settings it
|
|
989
|
-
gives verdict agreement with a 95% interval, the blocking findings only one side found, and the
|
|
990
|
-
token and time ratio (see [the dataset reference](dataset.md#paired-reviews)). The export
|
|
991
|
-
adds `shadow` and `consensus` to the matching review cases' metadata.
|
|
992
|
-
|
|
993
|
-
## Retro notes (opt-in)
|
|
994
|
-
|
|
995
|
-
`plan --retro` makes each agent record what got in its way: a sandbox that blocked a command, a
|
|
996
|
-
tool that is not installed, an instruction it could not follow, a forge fault. A note says what
|
|
997
|
-
happened and who can fix it. Without a flag a plan keeps its earlier choice, and a first plan
|
|
998
|
-
takes the user setting (`forge config set retro on`). `plan --no-retro` turns it off.
|
|
999
|
-
|
|
1000
|
-
- **What an agent writes.** Most tasks have nothing to report, and a hard task is not a note.
|
|
1001
|
-
A note is one `FORGE_RETRO: {json}` line in the final message. The planner, QA and the
|
|
1002
|
-
whole-run review write it the same way. A dwarf blocked before it finishes also appends the
|
|
1003
|
-
same JSON to `.forge/retro-inbox.jsonl` in its worktree, which forge reads when the dispatch
|
|
1004
|
-
ends. The fields are `type` (`environment`, `sandbox`, `tooling`, `prompt`, `forge-bug` or
|
|
1005
|
-
`other`), `fixable_by` (`user`, `forge` or `unsure`), `summary`, `evidence` (the command, its
|
|
1006
|
-
exit code and the error, up to 2 KB), `blocking` and `tried`.
|
|
1007
|
-
- **Checked against the log.** forge looks for the note's command and the first line of its
|
|
1008
|
-
error in that dispatch's log. When both are there the note is `verified`; otherwise `claimed`.
|
|
1009
|
-
- **Orchestrator notes.** `forge retro note PLAN --type T --fixable-by F --summary S` records
|
|
1010
|
-
one note of the run's own, with `--command`, `--exit`, `--error`, `--blocking` and `--tried`
|
|
1011
|
-
as needed. It is always `claimed`, and it does not check the retro setting.
|
|
1012
|
-
- **Where it goes.** `<plan>/retro/notes.jsonl`, `tasks/<id>/retro.json` for a task, and one
|
|
1013
|
-
`retro_note` dataset event per note. `forge retro report PLAN` writes `<plan>/retro.md`.
|
|
1014
|
-
Notes with the same type and the same normalised command form one pattern; a note with no
|
|
1015
|
-
command is matched on its normalised summary instead. Each pattern
|
|
1016
|
-
goes to the group its majority `fixable_by` names: **You can fix this on this machine**
|
|
1017
|
-
(`user`), **forge should fix this** (`forge`), or **Not sure who should fix this** (`unsure`,
|
|
1018
|
-
also on a tie). A run prints one line with the pattern count and the path when there are any
|
|
1019
|
-
patterns. The first plan with retro on says what is recorded, once per user.
|
|
1020
|
-
- **Filing.** `forge retro issues PLAN` drafts one redacted issue per `forge` pattern, for
|
|
1021
|
-
forge's own repository, and posts nothing. The dry run prints the texts and their hash.
|
|
1022
|
-
`forge retro issues PLAN --apply --approve HASH` posts only when the hash matches those texts
|
|
1023
|
-
and the `--choice rN=new|comment:N|skip` choices. It needs an authenticated `gh`, and it
|
|
1024
|
-
refuses a never-send repository. Both refusals exit `3`.
|
|
1025
|
-
- **Never memory.** Notes never go into `.forge/memory.md` or the ledger, and no prompt reads
|
|
1026
|
-
them back. A retro plan does add a short instruction block to each prompt, at its end.
|
|
1027
|
-
- **Off.** With retro off (`--no-retro`, no setting, or `FORGE_RETRO=off`) no instruction is
|
|
1028
|
-
added to any prompt, the inbox is not read, and forge stores no note from a dispatch. Its
|
|
1029
|
-
prompts stay as they were without the feature. `forge retro note` still records a note when
|
|
1030
|
-
it is called, because it does not check the setting.
|
|
1031
|
-
|
|
1032
|
-
Files it adds: `retro_mode` (plan file), `retro/notes.jsonl`, `retro/.lock`, `retro.md`,
|
|
1033
|
-
`tasks/<id>/retro.json`, and `.forge/retro-inbox.jsonl` in a worktree (removed once its notes
|
|
1034
|
-
are stored). It costs no model call of its own.
|
|
1035
|
-
|
|
1036
|
-
## Brief mode (opt-in)
|
|
1037
|
-
|
|
1038
|
-
With `plan --brief advisory|gated|strict --brief-model SPEC`, a read-only side dispatch writes
|
|
1039
|
-
the questions each task needs answered before it starts. Each question has a default. A task
|
|
1040
|
-
with no answer follows the default. The user answers with `forge brief answer`.
|
|
1041
|
-
A task-scoped answer goes into that task's prompt. A `wave` or `plan` answer stays parked
|
|
1042
|
-
until an approved proposal applies its diff. forge never answers for the user.
|
|
1043
|
-
|
|
1044
|
-
- **Cost.** One dispatch per task that has no `brief.json`, at effort `low`, four at a time.
|
|
1045
|
-
A reply that is not valid JSON, or has the wrong shape, is retried once; a second failure
|
|
1046
|
-
stores no questions and the reason in `brief.json`'s `error`. Answers, stale flags and
|
|
1047
|
-
`reject` call no model. A proposal is one more side dispatch, kind `brief-change`. Each
|
|
1048
|
-
unstarted task whose questions are regenerated is one more, kind `brief`. Both are read-only,
|
|
1049
|
-
at effort `low`, on the brief model.
|
|
1050
|
-
- **When.** `run` writes the missing briefs when it starts. `strict` waits for them; `advisory`
|
|
1051
|
-
and `gated` write them alongside the scheduler. `forge brief write PLAN [--task ID] [--jobs N]
|
|
1052
|
-
[--force]` does the same by hand, and `--force` redoes a task that already has a brief.
|
|
1053
|
-
- **Levels.**
|
|
1054
|
-
- `advisory`: the run does not wait. Open questions reach the prompt under "Open questions:
|
|
1055
|
-
follow the stated default", with each default.
|
|
1056
|
-
- `gated`: a task with an unanswered must-answer question is held. The run prints
|
|
1057
|
-
`forge: <task> waits for your answer to <qid>` with the `forge brief answer` line. A task
|
|
1058
|
-
whose brief is still being written waits too.
|
|
1059
|
-
- `strict`: `run` exits `3` before any task starts while a question of an unstarted task is
|
|
1060
|
-
open. It prints each question, its default and the answer command. Answer them and run again.
|
|
1061
|
-
- **Answers.** `forge brief answer PLAN TASK QID TEXT` (or `--file F`; `-` reads stdin). For a
|
|
1062
|
-
task-scoped question, an answer given before the task starts goes to `brief.answers.json` and
|
|
1063
|
-
into the prompt under "Decisions the user made", which overrides what the requirements say.
|
|
1064
|
-
After the task starts, that answer goes to `brief.late.json` and changes nothing in the run.
|
|
1065
|
-
The command then prints the `tasks.tsv` row, the `prompt.md` a follow-up needs, and the
|
|
1066
|
-
`forge control add` line that queues it.
|
|
1067
|
-
- **Scope.** `--brief-scope` is `task` (the default), `wave` or `plan`. The question's own
|
|
1068
|
-
scope decides what an answer may change. `task` writes the answer into that task. `wave` and
|
|
1069
|
-
`plan` questions are parked in `brief.parked.json` whatever `--brief-scope` says, and they
|
|
1070
|
-
change the plan only through a proposal you approve. Both scopes use the plan's
|
|
1071
|
-
[groups](#groups-and-group-review-opt-in). A wave proposal needs the question's group in
|
|
1072
|
-
`groups.tsv`. When the task belongs to a group, the question
|
|
1073
|
-
writer is told that group's title, goal and the other tasks in it. It asks `wave` when the
|
|
1074
|
-
answer would change how several tasks of the group are done, and `plan` when the answer
|
|
1075
|
-
would add, remove or split tasks, or change their order. A wave question from a grouped
|
|
1076
|
-
task records `"group": "<gid>"`. A plan question from a grouped task records `"group": null`.
|
|
1077
|
-
A task in no group keeps the prompt it had before groups, and its parked questions have no
|
|
1078
|
-
`group` key. With `--brief-scope wave` or `plan` and no `groups.tsv`, forge prints one note
|
|
1079
|
-
and goes on. `brief.groups.noted` keeps that note to once per plan. The note says to run
|
|
1080
|
-
`plan --groups waves`, or to let the planner write groups, because a wave question with no
|
|
1081
|
-
group stays parked. `gated` and `strict` still read only the task questions in `brief.json`.
|
|
1082
|
-
A parked question does not hold a task.
|
|
1083
|
-
- **Parked answers.** A parked question can be answered when the brief scope is at least as
|
|
1084
|
-
wide as the question. `wave` answers wave questions. `plan` answers wave and plan questions.
|
|
1085
|
-
`task` answers neither: the question id is unknown, and `answer` exits `2`. The answer goes
|
|
1086
|
-
to `tasks/<id>/brief.parked.answers.json` as `{qid: {text, actor, t}}`, including after the
|
|
1087
|
-
task has started. It is never a late answer, and it does not change a prompt. The command
|
|
1088
|
-
prints `forge brief propose PLAN TASK QID`. Nothing in the plan changes until that proposal
|
|
1089
|
-
is approved. `forge brief show` lists parked questions by group: `Group <gid> (<title>):`
|
|
1090
|
-
and the question, or `Group <gid>:` when the title is `-` or the group is gone, then
|
|
1091
|
-
`Plan:` for a plan question. A question with no `group` key stays under
|
|
1092
|
-
`Parked (wider scope):`.
|
|
1093
|
-
- **Proposals.** `forge brief propose PLAN TASK QID` asks the brief model what that parked
|
|
1094
|
-
answer changes, in one read-only side dispatch of kind `brief-change`, and stores the result
|
|
1095
|
-
under `proposals/<pid>/` (`p1`, `p2`, and so on). Each directory holds `proposal.json`,
|
|
1096
|
-
`diff.patch` (a unified diff of the plan files it would change) and `hash`. `state` is
|
|
1097
|
-
`proposed`, `refused`, `approved` or `rejected`. A reply that breaks the rules below, or
|
|
1098
|
-
that changes nothing, is stored as `refused` with its reason and its diff, and `propose`
|
|
1099
|
-
exits `3`. `apply` leaves a refused proposal where it is. A failed dispatch stores nothing.
|
|
1100
|
-
The question's scope is the proposal's scope: under `--brief-scope plan`, a wave question
|
|
1101
|
-
is still a wave proposal. A plan question needs `--brief-scope plan`, or `propose` refuses
|
|
1102
|
-
it. `forge brief proposals PLAN` lists every proposal, oldest first, with its state, scope,
|
|
1103
|
-
group, summary and diff. `--json` prints the same records. A `proposed` one also prints the
|
|
1104
|
-
exact `forge brief apply` line. `forge brief reject PLAN PID [--reason TEXT]` sets
|
|
1105
|
-
`rejected`. It touches no plan file. Only a `proposed` or `refused` proposal can be rejected.
|
|
1106
|
-
- **What each scope may change.**
|
|
1107
|
-
- `task`: the answer, as under Answers. There is no proposal.
|
|
1108
|
-
- `wave`: `prompt.md`, `approach.md` and the `files` column, and only for unstarted members
|
|
1109
|
-
of the question's group. The question must name a group that is in `groups.tsv`. A change
|
|
1110
|
-
that names another task, a started member, or any other field refuses the whole proposal.
|
|
1111
|
-
A wave question with no group cannot be proposed.
|
|
1112
|
-
- `plan`: the same three fields on any unstarted task, new tasks, removal of unstarted
|
|
1113
|
-
tasks, and new dependency lists for unstarted tasks. A split is a removal plus the added
|
|
1114
|
-
tasks, and every task that still depended on a removed one needs its deps rewritten in
|
|
1115
|
-
the same reply. An added task's group is null or an existing group id. Anything that
|
|
1116
|
-
would not be a plan `plan` could have written refuses the whole proposal. Between runs,
|
|
1117
|
-
an added row gets dwarf and qa `-`.
|
|
1118
|
-
- **Approve by hash.** `hash` is the sha256 of `diff.patch` and the current contents of every
|
|
1119
|
-
target. For a wave `files` change the target is that task's `tasks.tsv` row. For a plan
|
|
1120
|
-
change the hash also covers `tasks.tsv`, `groups.tsv` and every edited prompt or approach.
|
|
1121
|
-
`forge brief apply PLAN PID --approve HASH` must quote the hash `proposals` shows. A
|
|
1122
|
-
different hash, a state other than `proposed`, a target that has started, or a target that
|
|
1123
|
-
changed since the proposal, refuses the apply and writes nothing. After a target changes,
|
|
1124
|
-
propose again.
|
|
1125
|
-
- **Live and between runs.** While a scheduler is live, a wave proposal that changes only
|
|
1126
|
-
prompt and approach is written. The next attempt of an unstarted task reads those files.
|
|
1127
|
-
A wave proposal that changes `files` is refused while the run is live, and nothing is
|
|
1128
|
-
written: the scheduler keeps the files column it read at start. With no live run, a wave
|
|
1129
|
-
`files` change is written, `groups.frozen` is re-frozen (a stale marker left by a plan
|
|
1130
|
-
proposal stays stale), and `waves.tsv` is recomputed when that file already exists. A
|
|
1131
|
-
plan apply with no live run writes `tasks.tsv` and the task directories, and `groups.tsv`
|
|
1132
|
-
when membership changed. A removed task's directory moves to `tasks/.removed/<id>-<pid>/`.
|
|
1133
|
-
`groups.frozen` becomes the marker `stale: plan changed by proposal <pid>`, so `run`
|
|
1134
|
-
refuses until `forge-parallel.sh plan` validates, routes and freezes again. With a live
|
|
1135
|
-
run, a plan proposal that includes an edit, a removal or a dep change is refused, and
|
|
1136
|
-
nothing is written. A proposal that only adds tasks queues each one with
|
|
1137
|
-
`forge control add`, in dependency order. A task added that way joins no group. It needs
|
|
1138
|
-
dwarf and qa specs copied from a task that already has them. If a later add is refused,
|
|
1139
|
-
the tasks already queued stay, and the proposal is `approved` so it is not applied again.
|
|
1140
|
-
- **Affected tasks.** After a successful apply, every task the proposal changed or added, and
|
|
1141
|
-
every task that depends on a changed, added or removed task, directly or further down, gets
|
|
1142
|
-
`tasks/<id>/brief.affected`. The marker is `{pid, reason, t}`. `reason` is `changed`,
|
|
1143
|
-
`added` or `dependent`. An unstarted task's questions are regenerated, one brief dispatch
|
|
1144
|
-
each (`write --force`). An answer whose question text is still in the new brief is kept.
|
|
1145
|
-
Any other answer moves to `brief.answers.prev.json`. A task that has already started gets
|
|
1146
|
-
the same marker with `flag_only`, and its questions stay. `forge brief show` lists a marked
|
|
1147
|
-
task as `affected by <pid>`, and adds `flagged (already started)` when `flag_only` is set.
|
|
1148
|
-
`apply --no-regenerate` writes the same markers and does not dispatch. Regenerating one
|
|
1149
|
-
task later is `forge brief write PLAN --task ID --force`. The next approved proposal that
|
|
1150
|
-
touches a task replaces that task's marker. Earlier proposals stay in `proposals/`.
|
|
1151
|
-
- **Stale.** After a task merges, a merge that changed files outside that task's declared files
|
|
1152
|
-
flags the open questions of its dependents that have not started (`possibly_stale`). `forge
|
|
1153
|
-
brief stale PLAN TASK` does this by hand.
|
|
1154
|
-
- **Model.** `--brief-model SPEC` is required with brief on, and it must resolve; otherwise
|
|
1155
|
-
`plan` exits `2`. forge never picks the model.
|
|
1156
|
-
- **Privacy.** A never-send repository gets no brief dispatch (`never-send`), so its tasks have
|
|
1157
|
-
no questions and nothing holds them.
|
|
1158
|
-
- **Off.** With `--brief off`, no setting, or `FORGE_BRIEF=off`, there is no writer, no hold and
|
|
1159
|
-
no prompt addition. `forge-prompt.py` adds nothing without a `brief` file. `forge brief write`,
|
|
1160
|
-
`forge brief show` and `forge brief propose` exit `3` for such a plan.
|
|
1161
|
-
|
|
1162
|
-
Files it adds: the plan files `brief`, `brief_scope` and `brief_model`; `brief.out` (the
|
|
1163
|
-
writer's output), `brief.pid` (while the writer runs) and `brief.groups.noted` (once, when
|
|
1164
|
-
wave or plan scope has no groups); `proposals/<pid>/proposal.json`, `diff.patch` and `hash`;
|
|
1165
|
-
and per task `tasks/<id>/brief.json`, `brief.parked.json`, `brief.answers.json`,
|
|
1166
|
-
`brief.late.json`, `brief.parked.answers.json`, `brief.affected` and `brief.answers.prev.json`.
|
|
1167
|
-
A removed task's directory is moved to `tasks/.removed/<id>-<pid>/`. Its events are
|
|
1168
|
-
`brief_question`, `brief_answer`, `brief_diff` and `side_dispatch` (kind `brief` or
|
|
1169
|
-
`brief-change`). A `brief_diff` event is `{pid, scope, group, state, tasks}` and is written
|
|
1170
|
-
when a proposal is proposed, refused, approved or rejected. The approved event from a
|
|
1171
|
-
successful apply also carries `affected` and `flagged`, the task ids it marked.
|
|
1172
|
-
|
|
1173
|
-
## Task summaries (opt-in)
|
|
1174
|
-
|
|
1175
|
-
`plan --summaries on --summaries-model SPEC` writes a short summary of each task to
|
|
1176
|
-
`tasks/<id>/summary.json`. The model sees only the task's facts: its status, its attempt trail
|
|
1177
|
-
(attempt, dwarf spec, verdict, findings count, worst severity, retry reason), the latest review's
|
|
1178
|
-
finding titles and severities, its known issues, and its dependencies and dependents. The facts
|
|
1179
|
-
are capped at 8 KB. The model never sees the repository, the diff or the task prompt.
|
|
1180
|
-
|
|
1181
|
-
- **Cost.** One read-only dispatch per task, at effort `low`, when its facts change. Unchanged
|
|
1182
|
-
facts are not dispatched again, because `inputs_hash` matches the stored summary. Each kind
|
|
1183
|
-
of side dispatch is capped per run at `max(10, 3 × tasks)`.
|
|
1184
|
-
- **When.** During `run`, the scheduler starts a detached `forge summarize PLAN --task ID` for
|
|
1185
|
-
each task whose status, dwarf reply, attempt trail, verdict or retry count changed since its
|
|
1186
|
-
last look. The first look at a task only remembers it. The scheduler never waits for a
|
|
1187
|
-
summary, and a failed one changes nothing in the run. On a finished run, `forge control set
|
|
1188
|
-
PLAN summaries on` starts `forge summarize` itself, with its output in `summaries.out`.
|
|
1189
|
-
- **Output.** `summary.json` holds `text`, `sentence`, `model`, `generated_at`, `inputs_hash`
|
|
1190
|
-
and `sources` (the attempts and findings the facts came from). The prompt asks for 3 to 5
|
|
1191
|
-
short lines. A reply that is not a JSON object with `text` and `sentence`, or whose text runs
|
|
1192
|
-
past 8 lines, is rejected: the previous `summary.json` stays and `summary.error` says why.
|
|
1193
|
-
- **Commands.** `forge summarize PLAN [--task ID] [--force] [--json]`. `--force` dispatches even
|
|
1194
|
-
when the facts did not change. `--json` prints one object per task: `task`, `status`, `reason`.
|
|
1195
|
-
`forge control set PLAN summaries on|off` sets the plan. `--task ID on|off|inherit` sets one
|
|
1196
|
-
task; its own `on` or `off` overrides the plan, and `inherit` drops that override.
|
|
1197
|
-
- **Model.** `--summaries-model SPEC` is required with summaries on, and it must resolve;
|
|
1198
|
-
otherwise `plan` exits `2`. Set a user default with `forge config set summaries.model SPEC`.
|
|
1199
|
-
- **Off.** With `--summaries off`, no setting, or `FORGE_SUMMARIES=off`, there is no dispatch and
|
|
1200
|
-
no `summary.json`.
|
|
1201
|
-
|
|
1202
|
-
Files it adds: the plan files `summaries` and `summaries_model`; `summaries.out`; and per task
|
|
1203
|
-
`tasks/<id>/summary.json`, `summary.error` (after a failed reply) and `tasks/<id>/summaries`
|
|
1204
|
-
(`on` or `off`, the task's override). Its events are `side_dispatch` (kind `summary`) and the
|
|
1205
|
-
`side_summary` role in the dataset.
|
|
1206
|
-
|
|
1207
|
-
## Severity, thresholds and known issues
|
|
1208
|
-
|
|
1209
|
-
QA labels each finding `- [P0..P3][CONFIRMED|PLAUSIBLE] file:line — what breaks (input)`:
|
|
1210
|
-
P0 data loss, security hole, crash or wrong result on the main path; P1 wrong behaviour on
|
|
1211
|
-
realistic input or a broken existing contract; P2 edge-case bug, unusual-timing race, missing
|
|
1212
|
-
hardening; P3 minor. Severity is impact; CONFIRMED/PLAUSIBLE is confidence.
|
|
1213
|
-
|
|
1214
|
-
`--qa-threshold Pn` on `plan`, `run`, `retry` or `review` (remembered in `<plan>/qa_threshold`; `none`
|
|
1215
|
-
means P3, `default` removes the setting) changes the default `P2`, the **least severe level that
|
|
1216
|
-
still blocks** (see [QA verdicts](#qa-verdicts)). `tasks/<id>/qa_threshold` overrides it per task (a
|
|
1217
|
-
per-task `none` means P3, so it exempts the task from a looser plan threshold; `forge control set ... qa-threshold`
|
|
1218
|
-
writes both and takes effect at the next attempt) —
|
|
1219
|
-
the way to give a dev-tooling or investigation task a looser bar than production code,
|
|
1220
|
-
which otherwise gets a new finding in a new corner of a non-default option every round and
|
|
1221
|
-
only a human decision ends it. The orchestrator decides *deterministically* (`forge-contract.py gate`),
|
|
1222
|
-
and does not take the reviewer's word in either direction: a `FAIL` becomes `PASS` with known
|
|
1223
|
-
issues only when there is at least one CONFIRMED finding, every CONFIRMED finding carries a
|
|
1224
|
-
`P0..P3` label, and all of them are strictly milder than the threshold; a `PASS` that lists a
|
|
1225
|
-
blocking finding becomes `FAIL`. Anything unlabelled, any blocking finding, or a `FAIL` with no
|
|
1226
|
-
CONFIRMED finding stays a failure. The task's status is then the literal `PASS`; `known_issues.md`,
|
|
1227
|
-
`qa.gate` and the summary say what was tolerated.
|
|
1228
|
-
|
|
1229
|
-
### The finding sweep (opt-in)
|
|
1230
|
-
|
|
1231
|
-
Tolerated findings are recorded, not fixed. `run --sweep Pn` fixes them inside the run instead: once
|
|
1232
|
-
every task has merged, and before the combined verification, the scheduler runs `forge-sweep.py plan`.
|
|
1233
|
-
The sweep is once per finding, not once per plan. Round 1 is `<plan>/sweep/plan.json`; round N (N ≥ 2)
|
|
1234
|
-
is `<plan>/sweep/rounds/<N>/plan.json`. A finding an earlier round attempted is not swept again, whatever
|
|
1235
|
-
that attempt's outcome. The first round is planned once every task that is not a fix task has merged.
|
|
1236
|
-
A later round starts when those tasks have merged, every fix task of the previous round is `MERGED`,
|
|
1237
|
-
`FAIL`, `NEEDS_DECISION` or `INFRA`, and new eligible findings exist. At most one round starts per
|
|
1238
|
-
scheduler pass. A later `plan` with nothing new writes and prints nothing. The scheduler records that
|
|
1239
|
-
check in `<plan>/sweep/nothing.json`, and the run's summary prints
|
|
1240
|
-
`sweep: nothing new to sweep (N finding(s) already swept or attempted, M left for forge issues)`.
|
|
1241
|
-
It collects the open findings at `Pn` or worse (the ones the threshold tolerated, plus
|
|
1242
|
-
PLAUSIBLE ones with `--sweep-plausible`), with `forge issues`' own collector, and leaves out:
|
|
1243
|
-
|
|
1244
|
-
- findings a person accepted with `accept` or kept with `adopt --approved` (listed as `accepted`), and
|
|
1245
|
-
findings of fix tasks (what a sweep review finds goes to `forge issues`, never into another sweep);
|
|
1246
|
-
- dismissed ones (`forge issues --dismiss`), ones the finding record marks `fixed`, `filed` or
|
|
1247
|
-
`duplicate`, and ones an earlier round already attempted;
|
|
1248
|
-
- ones with no file, and ones whose file is gone;
|
|
1249
|
-
- ones whose line, as the reviewer saw it, a later merge changed (`changed`, naming those merges).
|
|
1250
|
-
|
|
1251
|
-
Every finding left out is listed in the plan with its reason. The rest become fix tasks, one per file,
|
|
1252
|
-
worst first, at most 8 findings each and `--sweep-max N` (default 5) tasks. Each fix task is a row
|
|
1253
|
-
`sweep-<n>` in `tasks.tsv` with `prompt.md` and `sweep.json`. Its implementer is the plan's low tier
|
|
1254
|
-
(the first spec of `--dwarf-low`, else of `--dwarf`; checked at `run` start), else the implementer of
|
|
1255
|
-
the task the worst finding came from. Its reviewer is that task's reviewer. What an adopted range's review
|
|
1256
|
-
tolerated is swept too: its fix task's reviewer is the adoption's, and below the low tier its implementer
|
|
1257
|
-
is the run's first task's. The plan (groups, findings,
|
|
1258
|
-
dispatches) is printed and kept next to that round's `plan.json`, as `plan.md`. Round 1 lives in
|
|
1259
|
-
`<plan>/sweep/`; each later round lives in `<plan>/sweep/rounds/<N>/`.
|
|
1260
|
-
|
|
1261
|
-
Fix tasks share the run's scheduling, controls and `--retry-failed` budget. Their review is narrow
|
|
1262
|
-
(`forge-contract.py qa --kind sweep`): one `S<n>: FIXED` or `S<n>: NOT FIXED` line per finding, plus
|
|
1263
|
-
regressions as findings. It passes when at least one finding is fixed and there is no blocking
|
|
1264
|
-
regression. When a fix task merges, its review's lines go to `tasks/<id>/sweep.outcome.json`, and
|
|
1265
|
-
`forge issues` leaves out what it fixed (`swept` in `--json`). Each finding that review marked fixed
|
|
1266
|
-
also gets a `fixed` record, actor `sweep`, reason `sweep <task>`, and the merge commit when
|
|
1267
|
-
`<plan>/accepted.integration` is 7 to 40 lowercase hex characters. A fix task that fails leaves its
|
|
1268
|
-
findings for `forge issues` and does not fail the run. The run's summary says what each round fixed,
|
|
1269
|
-
and the whole-run review that follows reads the sweep's changes like any other task's.
|
|
1270
|
-
|
|
1271
|
-
`run --sweep-ahead` (kept in `<plan>/sweep_ahead`; `--no-sweep-ahead` turns it off) is the cheaper
|
|
1272
|
-
first step. A task dispatched after others merged is told the open findings in files it owns (at
|
|
1273
|
-
most 3, picked once in `tasks/<id>/sweep.ahead.json`), to fix only on its way, and its reviewer is
|
|
1274
|
-
told the same. It adds no dispatch. A later sweep counts the ones whose line changed as `changed`.
|
|
1275
|
-
|
|
1276
|
-
## Retrying, and resuming an interrupted run
|
|
1277
|
-
|
|
1278
|
-
A failed task keeps its branch and its worktree. `retry` is what acts on them:
|
|
1279
|
-
|
|
1280
|
-
```bash
|
|
1281
|
-
forge-parallel.sh retry <plan-dir> <task-id> [--dwarf <spec>]
|
|
1282
|
-
```
|
|
1283
|
-
|
|
1284
|
-
It re-dispatches that one task **in the worktree it already has**, with the previous
|
|
1285
|
-
reviewer's findings prepended to the prompt — that carry-forward is the whole difference
|
|
1286
|
-
between a retry and simply running the task again. It then re-reviews, and merges if the
|
|
1287
|
-
verdict is now `PASS`. `--dwarf` escalates to a stronger model and is written back into
|
|
1288
|
-
`tasks.tsv`, so the table shows the model that will actually be spent and the escalation
|
|
1289
|
-
survives a re-plan.
|
|
1290
|
-
|
|
1291
|
-
Two details that are load-bearing rather than incidental:
|
|
1292
|
-
|
|
1293
|
-
- **The base is pinned per task, not per run.** A retry diffs against the commit the task
|
|
1294
|
-
was originally branched from, so its reviewer sees the task's *cumulative* work. Reviewing
|
|
1295
|
-
only the fix would let the first attempt's code through unread, and re-basing onto the
|
|
1296
|
-
integration branch as it now stands would put other tasks' merged code into this task's
|
|
1297
|
-
diff.
|
|
1298
|
-
- **An identical retry is not re-reviewed.** If the diff comes back byte-identical to the
|
|
1299
|
-
previous attempt, the task fails again without a QA dispatch. Paying a reviewer to read
|
|
1300
|
-
the same code twice buys nothing. A retry that only rejects the findings, and leaves
|
|
1301
|
-
that diff unchanged, is still this identical retry.
|
|
1302
|
-
|
|
1303
|
-
`retry` is a command a human types. Forge does not loop a dwarf against its own reviewer on
|
|
1304
|
-
its own initiative; the one exception is the opt-in `run --retry-failed N` below.
|
|
1305
|
-
|
|
1306
|
-
**`UNKNOWN` and `INFRA` resume at the review stage.** If the reviewer never gave a verdict (or
|
|
1307
|
-
its dispatch stopped on an infrastructure failure after the dwarf finished), the work was not
|
|
1308
|
-
rejected, so `retry` / `--retry-failed` re-runs **QA only** on the unchanged, already-committed
|
|
1309
|
-
work: no dwarf, no new commit, no attempt spent. A `tasks/<id>/resume` marker records this and is
|
|
1310
|
-
revalidated against the branch tip and the saved source fingerprint before it is trusted; if the
|
|
1311
|
-
worktree changed, the full task runs. Findings are carried only from a real review.
|
|
1312
|
-
|
|
1313
|
-
On a retry whose diff changed, QA receives the previous round under **Findings from the
|
|
1314
|
-
previous review round**, the diff since that round (`tasks/<id>/changes.since.diff`,
|
|
1315
|
-
`changes.since.range` and `changes.since.stat`; omitted when the earlier commit is
|
|
1316
|
-
missing or not an ancestor, or when nothing changed) and the implementer's reply. It is
|
|
1317
|
-
told to restate only findings that are still open, as `- [Px][CONFIRMED|PLAUSIBLE]`
|
|
1318
|
-
lines, because every labelled line is counted. That is the retry's review, not the
|
|
1319
|
-
QA-only re-run above.
|
|
1320
|
-
|
|
1321
|
-
**In-run retries.** `run <plan> --retry-failed N` re-queues a task whose reviewer said
|
|
1322
|
-
`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
|
|
1323
|
-
as `retry` does (same findings carry-forward, same pinned base, same cumulative review). Other
|
|
1324
|
-
tasks keep running; dependents wait for the task to merge. It applies per invocation (not
|
|
1325
|
-
remembered), never to `TIMEOUT`/`ERROR`/`CONFLICT` or an `INVALIDATED` merge, and never after a retry that
|
|
1326
|
-
changed nothing (`tasks/<id>/noretry`). Every entry is logged in `tasks/<id>/attempts.tsv`.
|
|
1327
|
-
An attempt that carries retry findings also gets one row in `tasks/<id>/retry_sources.tsv`:
|
|
1328
|
-
the attempt number, the source of those findings (`review`, `prereview`, `bounce`, `message`,
|
|
1329
|
-
`answer` or `prompt`) and the epoch time. A row for the same attempt replaces the earlier one, because an
|
|
1330
|
-
infrastructure stop refunds the attempt and its restart runs the same number again. forge-ui's
|
|
1331
|
-
attempt trail reads this file.
|
|
1332
|
-
|
|
1333
|
-
**A prompt edited during the attempt.** When `dwarf.input` is built, `prompt.md` and
|
|
1334
|
-
`approach.md` are copied to `prompt.dispatched` and `approach.dispatched`. A missing
|
|
1335
|
-
`approach.md` is an empty copy, and `prompt.dispatched` is written last: its presence is what
|
|
1336
|
-
says the pair is complete. If the copy fails, `prompt.dispatched` is removed and a later edit
|
|
1337
|
-
is not detected. An attempt from before those copies is not checked. Before review,
|
|
1338
|
-
if either file differs, the attempt is `STALE` and no review runs. `stale.diff` is the unified
|
|
1339
|
-
diff, `control.log` gets action `prompt-changed` with actor `scheduler`, and the console names
|
|
1340
|
-
the file and says no attempt was spent. The attempt counter is given back, as a dwarf-stage
|
|
1341
|
-
infrastructure stop is. The cap skips the `STALE` row, the escalation streak treats `STALE` as
|
|
1342
|
-
neutral, and no decision is written. Unless the run is stopping, the scheduler re-dispatches at
|
|
1343
|
-
once with `retry_findings.source` `prompt`. `retry_findings.md` is the new requirements plus
|
|
1344
|
-
that diff, and the next entry reuses the attempt number. `changes.diff` and
|
|
1345
|
-
`changes.prev.diff` are removed, so a re-dispatch that keeps the committed work is reviewed
|
|
1346
|
-
rather than refused as identical (`stale.diff` and `committed.diff` stay). A `STALE` task still
|
|
1347
|
-
waiting at the next `run` is prepared the same way, with no `--retry-failed` required and no
|
|
1348
|
-
retry counted. `forge control retry` accepts `STALE`; `--dwarf` is refused, because the same
|
|
1349
|
-
implementer gets the new text. A plain `forge-parallel.sh retry` does not take this path. The
|
|
1350
|
-
dataset attempt event has `prompt_changed` (true when the status is `STALE`). `forge dataset
|
|
1351
|
-
routing`, tiers and the forecast leave those attempts out,
|
|
1352
|
-
the same way they leave out a refunded or infrastructure stop. The `prompt` blob is
|
|
1353
|
-
`prompt.dispatched`, the text the implementer was given; an attempt from before the copy falls
|
|
1354
|
-
back to `prompt.md`. An empty `approach.dispatched` stores no approach blob.
|
|
1355
|
-
|
|
1356
|
-
**Escalation after repeated failures.** In forge's history the first three attempts at a task
|
|
1357
|
-
pass review at about the same rate (43%, 42%, 47%), and the fourth and later at 29%, whether
|
|
1358
|
-
or not the model changed. So a retry does not repeat a dispatch that has already failed three
|
|
1359
|
-
times on one model (`--escalate-after N` on `run` or `retry`, kept in the plan, default 3, `0`
|
|
1360
|
-
turns it off):
|
|
1361
|
-
|
|
1362
|
-
- **Counting:** the count is the task's failed attempts (FAIL, or an implementer TIMEOUT) on its current model,
|
|
1363
|
-
from the fifth column of `attempts.tsv`, after the latest row of `tasks/<id>/decisions.tsv`.
|
|
1364
|
-
Infrastructure stops, missing verdicts, `STALE` attempts and forge's own errors judge nothing and are skipped; a pass
|
|
1365
|
-
or a change of model resets it. A lateral move does not: the streak carries across `tasks/<id>/lateral.tsv`.
|
|
1366
|
-
- **Escalation:** at the threshold, the next attempt goes to a different model in the next tier
|
|
1367
|
-
up of the pools given to `plan` (same position in the pool, as with exploration),
|
|
1368
|
-
recorded in `escalations.tsv` and `tasks.tsv` like a `retry --dwarf`.
|
|
1369
|
-
- **Stop:** when nothing is above (the model is in the top tier, or in no tier pool at
|
|
1370
|
-
all), the task stops as `NEEDS_DECISION` with reason `split` (see [When reviews don't converge](#when-reviews-dont-converge)).
|
|
1371
|
-
`tasks/<id>/split.suggested` still says to split it or name a model. `run --retry-failed` does not retry it,
|
|
1372
|
-
and a plain `retry` refuses (exit 2).
|
|
1373
|
-
- **Effort step** (`--escalate-effort` on `run` or `retry`, kept in the plan as `escalate_effort`;
|
|
1374
|
-
`--no-escalate-effort` removes it; off by default): when no higher tier has another model, the
|
|
1375
|
-
same alias and harness is tried once more at the next effort its pairing accepts
|
|
1376
|
-
(`forge-dispatch.sh efforts --spec <spec>` lists them, weakest first), counted from the effort
|
|
1377
|
-
the last dispatch really ran after any clamp; a spec that names no effort counts as `medium`.
|
|
1378
|
-
The streak then counts per effort, so the new effort starts from zero. At the pairing's highest
|
|
1379
|
-
effort the task still stops, and `split.suggested` says that effort was tried too. Turning the
|
|
1380
|
-
step on (flag or `forge control set escalate-effort on`) clears the stop markers, so tasks the
|
|
1381
|
-
policy already stopped are decided again at their next retry.
|
|
1382
|
-
- **Overrides:** an explicit `retry --dwarf <spec>` is the human's choice and skips the policy, even
|
|
1383
|
-
with the same model. The dwarf column itself cannot tell a pin from a pool pick, so it does
|
|
1384
|
-
not; `--escalate-after 0` does.
|
|
1385
|
-
- **Fractal plans** keep their frozen eligible set and are not escalated; neither is a
|
|
1386
|
-
QA-only resume, which spends no implementer attempt.
|
|
1387
|
-
- **Reporting:** the policy's state is decided after every attempt, so a run whose retry budget ran out
|
|
1388
|
-
still reports `its next retry goes to <spec>` or the split suggestion under the results.
|
|
1389
|
-
A pending pin is reported ahead of both, as `its next retry goes to <spec> (pinned)`, or
|
|
1390
|
-
`(pinned; after the QA-only re-run)` only when the next entry really re-runs QA (the
|
|
1391
|
-
`resume` marker, or an unreviewed verdict, still matches the worktree). A marker the
|
|
1392
|
-
next retry will discard is not that wait.
|
|
1393
|
-
|
|
1394
|
-
**A budget per model.** `plan --retry-per-model N` writes `retry_per_model` (`N` from 1 to 99).
|
|
1395
|
-
`--no-retry-per-model` removes it; a re-plan with neither keeps the file. A task may fail N
|
|
1396
|
-
times on the model it is on, then the next attempt moves one rung up the pools and the count
|
|
1397
|
-
starts again. With `escalate_effort` on, the same N applies to each effort of that model before
|
|
1398
|
-
the next effort. `forge-route.py escalation` uses `retry_per_model` as the trigger when the
|
|
1399
|
-
file is a number from 1 to 99, instead of `escalate_after`. When both files exist, `run` notes
|
|
1400
|
-
that retry-per-model replaces `--escalate-after` for this plan; the `escalate_after` file stays.
|
|
1401
|
-
Automatic retries still need `--retry-failed` above 0 (or a live `retry_budget` above 0): any
|
|
1402
|
-
positive budget turns the ladder on, and that number is not the limit. A person's
|
|
1403
|
-
`decided.left` replaces the ladder: a positive count retries even when `forge-route.py per-model`
|
|
1404
|
-
says no, and 0 does not. `retry=N` with `--dwarf` keeps the task on that model until the larger of N
|
|
1405
|
-
and the per-model count. `max_attempts`, the converging stop, `noretry`
|
|
1406
|
-
and `escalation.stop` still apply. `forge-route.py per-model` prints whether one task may be
|
|
1407
|
-
attempted again (`retry`, `rung`, `failed_on_rung`, `rungs_left`, `per_model`; exit 2 when the
|
|
1408
|
-
plan has no valid file). `worst-case` is the unmerged tasks' dispatches (implementer, reviewer,
|
|
1409
|
-
and shadow reviews when those are on) and the tasks whose `N` times rungs exceed
|
|
1410
|
-
`max_attempts`. The plan table prints `retry per model: N`, `worst case with retry-per-model N:
|
|
1411
|
-
X dispatches`, and `max-attempts … stops these tasks before the top of their ladder` for that
|
|
1412
|
-
last list. Pools `low`, `medium` and `high` with N=3 give a task that starts on `low` up to 9
|
|
1413
|
-
implementer attempts, bounded by `--max-attempts` (default 8). A `script` implementer has no
|
|
1414
|
-
rungs above it; its worst-case implementer count is 0.
|
|
1415
|
-
|
|
1416
|
-
History cannot yet say whether escalating rescues a task (31% of the 29 later attempts on a
|
|
1417
|
-
changed spec passed, mostly effort bumps); the attempts this policy makes are what will.
|
|
1418
|
-
|
|
1419
|
-
## When reviews don't converge
|
|
1420
|
-
|
|
1421
|
-
A task can fail review after review, each round with new findings. forge keeps a findings ledger
|
|
1422
|
-
at `tasks/<id>/ledger.tsv`, one row per review: epoch, attempt, review, verdict, gate, worst,
|
|
1423
|
-
confirmed, new, carried, diff_bytes, delta_bytes. A CONFIRMED finding is carried when the previous
|
|
1424
|
-
review named the same problem; the rest are new. The diff sizes are `changes.diff` and
|
|
1425
|
-
`changes.since.diff` as they stand when the row is written.
|
|
1426
|
-
|
|
1427
|
-
The signal looks at the last reviews. The count is the plan file `converge_window` when that file
|
|
1428
|
-
holds a number (`plan --converge-window N`, or `forge control set converge-window N` later), and
|
|
1429
|
-
**4** otherwise. It fires when every review in that window failed (verdict
|
|
1430
|
-
FAIL, or the gate turned a PASS into a fail) with at least one CONFIRMED finding, at least half of
|
|
1431
|
-
the findings in the later reviews are new, and the worst severity is no better in the last review
|
|
1432
|
-
than in the first. A window below 2 never fires. On past runs, a window of 4 stopped no task that
|
|
1433
|
-
merged by attempt 4. Rows from before the latest `tasks/<id>/decisions.tsv` entry do not count: a
|
|
1434
|
-
decision restarts the window, and the escalation streak with it.
|
|
1435
|
-
|
|
1436
|
-
Task and solo reviews are asked to list every CONFIRMED finding, and to say so plainly when the
|
|
1437
|
-
diff is correct, so a round is the whole list and not only the worst few.
|
|
1438
|
-
|
|
1439
|
-
The task then stops with status **`NEEDS_DECISION`**. So does a task the retry policy cannot
|
|
1440
|
-
escalate further (reason `split`; `split.suggested` still names the suggestion), a task at its
|
|
1441
|
-
attempt cap (reason `cap`), and a `FAIL` whose every blocking finding needs a file the task does
|
|
1442
|
-
not declare (reason `plan`). The cap is `plan --max-attempts N`, default **8** when `max_attempts`
|
|
1443
|
-
is absent, counted across runs: an infrastructure stop spends nothing, a `STALE` attempt spends
|
|
1444
|
-
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`
|
|
1445
|
-
changes it; `--confirm` applies only to that key. A `NEEDS_INPUT` task at the cap keeps its question:
|
|
1446
|
-
raise the plan's cap before the answer can start an attempt.
|
|
1447
|
-
|
|
1448
|
-
**Reason `plan`.** After a judged `FAIL`, and before the escalation check, the task stops when
|
|
1449
|
-
`qa.last` holds a real `PASS` or `FAIL` verdict, at least one finding blocks at the task's
|
|
1450
|
-
threshold, every blocking finding carries `{outside=…}`, and `forge_owner.py` says none of
|
|
1451
|
-
those paths is covered by this task's declared files (a declaration of `.` covers every path;
|
|
1452
|
-
`files` of `-`, or an unknown task, leaves every path outside). A `PLAUSIBLE` finding never
|
|
1453
|
-
blocks, and a finding milder than the threshold does not. The check writes
|
|
1454
|
-
`tasks/<id>/outside.json`: a JSON list of `{path, owner, owners, owner_status}`. `owner` is the
|
|
1455
|
-
task that declares the path, or null when none does; `owners` is every such task; `owner_status`
|
|
1456
|
-
is `MERGED` when that task has `merged`, otherwise the text of its `status`, or `PENDING` when
|
|
1457
|
-
it has none, and null when there is no owner. If that does not hold, `outside.json` is removed
|
|
1458
|
-
and escalation runs as usual. `decision.md` lists each path as `path — declared by <id> (<status>)`
|
|
1459
|
-
or `path — declared by no task`, then the plan choices, which edit `tasks.tsv`: add the path to
|
|
1460
|
-
this task's `files`, make this task depend on the owner (edit its `deps`), or merge the two
|
|
1461
|
-
rows into one task. Then `forge-parallel.sh plan <plan>` again when no run is live, and
|
|
1462
|
-
`forge-parallel.sh retry <plan> <id> --decide retry=1 --reason "…" --approved`. The usual
|
|
1463
|
-
choices (more attempts, a threshold, a named model, accept, split) stay listed. This `FAIL`
|
|
1464
|
-
counts toward the cap. It does not escalate, and `--retry-failed` does not re-queue
|
|
1465
|
-
`NEEDS_DECISION`, so it spends no further attempt on the model. The reviewer's `{outside=…}`
|
|
1466
|
-
is what stops the task. The implementer is told not to edit a file outside its `files`, and to
|
|
1467
|
-
end with `FORGE_BLOCKED: <path>: <why>`, one line per path. Those lines are copied into
|
|
1468
|
-
`qa.input` as a claim ("The implementer says these fixes need files outside the task"), for the
|
|
1469
|
-
reviewer to confirm with `{outside=<path>}` or refute. Task, solo and group reviews are taught
|
|
1470
|
-
the brace; sweep, adopt and final reviews are not. The brace is its own, immediately before the
|
|
1471
|
-
facts brace: `- [P1][CONFIRMED] path/file.py:123 — {outside=a.py,b.py} {reach=main origin=new evidence=ran}`.
|
|
1472
|
-
|
|
1473
|
-
`tasks/<id>/decision.md` gives the reasons and the choices. Nothing else resumes the task: not a
|
|
1474
|
-
re-run, not `--retry-failed`, not a retry budget and not a pin. A plain `retry` exits 2.
|
|
1475
|
-
|
|
1476
|
-
`retry` holds the plan lock until its attempts end, so to resume several tasks side by side add
|
|
1477
|
-
`--no-dispatch` to each. It records the decision, carries the findings forward and starts nothing;
|
|
1478
|
-
the task is then `PENDING`, and one `forge-parallel.sh run <plan>` dispatches them all under
|
|
1479
|
-
`--max-parallel`, with dependents starting as their dependencies merge. It works on any `retry`,
|
|
1480
|
-
not only a decision, but takes no `--retry-failed` or `--infra-retries`: give those to the `run`. A
|
|
1481
|
-
second `--decide` on a prepared task is refused; a `--dwarf` changes its model and keeps its count.
|
|
1482
|
-
|
|
1483
|
-
The choices:
|
|
1484
|
-
|
|
1485
|
-
- `forge-parallel.sh retry <plan> <id> --decide retry=N --reason "…" --approved` gives N more
|
|
1486
|
-
attempts, N from 1 to 20. At the cap this raises the cap by N, and it is the only choice that
|
|
1487
|
-
runs the task again while the attempts already spent sit on the cap.
|
|
1488
|
-
- `forge-parallel.sh retry <plan> <id> --decide threshold=Pn --reason "…" --approved` sets this
|
|
1489
|
-
task's blocking threshold (`P0`, `P1`, `P2` or `P3`) and then retries once.
|
|
1490
|
-
- `forge-parallel.sh retry <plan> <id> --dwarf <spec> --reason "…" --approved` names a model for
|
|
1491
|
-
one attempt. Add `--decide retry=N` for up to N attempts: the retry policy keeps the task on that
|
|
1492
|
-
model until they are used, and they end early the way any retry does, on a pass or when the reviews
|
|
1493
|
-
stop converging. Or add `--decide threshold=Pn` to set the threshold too. `decisions.tsv` records it
|
|
1494
|
-
as one row, such as `retry=2 dwarf=sol:high`.
|
|
1495
|
-
- `forge-parallel.sh accept <plan> <id> --reason "…" --approved` merges it; the findings become
|
|
1496
|
-
known issues.
|
|
1497
|
-
- Split it by hand: `tasks/<id>/decision.md` and the run summary say to replace its row in
|
|
1498
|
-
`tasks.tsv` with smaller tasks, then `forge-parallel.sh run <plan>`, which reads that file
|
|
1499
|
-
again and recomputes `waves.tsv`. `forge control drain` and `add` do not do it: they need a
|
|
1500
|
-
scheduler that is still live (exit 3 once `scheduler.live` is gone, which it is by the time
|
|
1501
|
-
the summary is printed), and `add` queues a new row without replacing the stopped one, which
|
|
1502
|
-
stays `NEEDS_DECISION` for that invocation (its dependents keep the `deps` loaded at the
|
|
1503
|
-
start, and the run exits 5 while the row is unmerged).
|
|
1504
|
-
|
|
1505
|
-
Take the stopped task's row out of `tasks.tsv`. Leave `tasks/<id>/` where it is; its diff
|
|
1506
|
-
is not on the integration branch. A row left in place is not dispatched. Append one row
|
|
1507
|
-
per smaller task, seven tab-separated columns: `id`, `deps`, `difficulty` (`low`, `medium`
|
|
1508
|
-
or `high`), `files` (non-empty), `dwarf`, `qa`, `title`. Copy the stopped task's `dwarf`
|
|
1509
|
-
and `qa` (explicit specs; `forge control add` refuses `-` and `UNASSIGNED`, and `run`
|
|
1510
|
-
preflights every spec). `deps` is `-`, a task that is already `MERGED`, or another new
|
|
1511
|
-
task. On every remaining row whose `deps` named the stopped task, put those new ids in
|
|
1512
|
-
its place: a dependency that is no longer a row makes `run` die with `dependency cycle or
|
|
1513
|
-
unsatisfiable deps`, and one that never merges leaves the dependent `BLOCKED`. Write a
|
|
1514
|
-
non-empty `tasks/<id>/prompt.md` for each new id. The next `run` skips `MERGED` work and
|
|
1515
|
-
dispatches the new rows from the integration branch as it stands, not from the stopped
|
|
1516
|
-
task's worktree. While a scheduler is still live, `forge control add` can queue a row
|
|
1517
|
-
written this way whose dependencies that run already knows; the row that replaces the
|
|
1518
|
-
stopped task takes effect on the `run` after the scheduler has exited.
|
|
1519
|
-
`forge-parallel.sh split` moves whole tasks into a new plan
|
|
1520
|
-
([below](#accepting-splitting-combining-and-the-whole-run-review)).
|
|
1521
|
-
|
|
1522
|
-
A live scheduler takes the same decision as `forge control retry <plan> <id> --decide …` (or
|
|
1523
|
-
`--dwarf`), and an accept as `forge control accept <plan> <id>`, each with `--reason` and
|
|
1524
|
-
`--approved`; that only queues the request. An accepted task merges and its dependents start in
|
|
1525
|
-
the same run (#138). The answer is appended
|
|
1526
|
-
to `tasks/<id>/decisions.tsv` (epoch, attempt, choice, reason). The run summary lists these tasks
|
|
1527
|
-
under `waiting for your decision:`. A run that ends with such a task unmerged exits 5.
|
|
1528
|
-
|
|
1529
|
-
**Live controls.** `forge control show|set|pin|unpin <plan>` changes a run while it works:
|
|
1530
|
-
`qa-threshold` (read once per attempt, so an attempt keeps the bar it started with; per task, `none`
|
|
1531
|
-
(P3) exempts it from a looser plan threshold and `inherit` drops the override; at plan level, `default` restores P2), `timeout`, `escalate-after`, `escalate-effort`
|
|
1532
|
-
(`on|off`), `verify-retries`, `infra-backoff` (a shape as for `--infra-backoff`; `none` drops it,
|
|
1533
|
-
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
|
|
1534
|
-
or `--task`), `infra-retries` and `max-parallel` (1 to 64, at the next dispatch decision; a lower
|
|
1535
|
-
limit lets running tasks finish and never stops one). The budgets
|
|
1536
|
-
keep the **per invocation** rule: the flags of `run` are not remembered, and a live scheduler only
|
|
1537
|
-
mirrors them into `retry_budget`, `infra_budget` and `tasks/<id>/retry_budget` (re-read at every
|
|
1538
|
-
decision, removed when it stops; `tasks/<id>/retries.used` stays), so a change dies with the
|
|
1539
|
-
run. `pin <task> <spec>` sets the model the task's next full retry uses, once (checked with
|
|
1540
|
-
`forge-dispatch.sh doctor`, no quota): `prepare_retry` claims `escalation.pin` as
|
|
1541
|
-
`escalation.pin.applying`, rewrites `tasks.tsv`, appends the `escalations.tsv` row with
|
|
1542
|
-
`source=pin`, clears `escalation.stop`/`split.suggested`, then consumes the pin. A symlinked
|
|
1543
|
-
`escalations.tsv`, or a symlink in any directory from the plan down to it, is not written:
|
|
1544
|
-
the pin stays and nothing is retried. A QA-only resume leaves it for the next full retry;
|
|
1545
|
-
Fractal plans never apply pins; a MERGED task refuses one.
|
|
1546
|
-
The last column of `escalations.tsv` says who decided: `policy`, `retry` (an explicit
|
|
1547
|
-
`--dwarf`) or `pin`; four-column rows read as `policy`. Older rows may say `fallback`.
|
|
1548
|
-
A sideways move is recorded in `lateral.tsv`, not here (see [Infrastructure failures](#infrastructure-failures)).
|
|
1549
|
-
Every change goes to `control.log` (JSON lines: `at`, `actor` `cli|ui`, `action`, `task`, `key`,
|
|
1550
|
-
`value`, `previous`) and to the dataset as a `control` event. Exit 2 invalid input, 3 refused (not
|
|
1551
|
-
live, MERGED, Fractal, failing doctor, lock busy over 5 s). Report them; never set one yourself
|
|
1552
|
-
unless asked.
|
|
1553
|
-
|
|
1554
|
-
Five more commands steer a live scheduler (exit 3 when none is live):
|
|
1555
|
-
|
|
1556
|
-
- `drain <plan>` starts nothing new: running tasks finish, the scheduler waits (it prints
|
|
1557
|
-
`drained — N task(s) waiting` once) and infrastructure waits keep counting down. `resume <plan>`
|
|
1558
|
-
ends the drain. This is the supported way to pause a run; nothing has to be signalled. A drain
|
|
1559
|
-
holds only tasks still to start: when none is left (or waiting on infrastructure), the run
|
|
1560
|
-
ends as it would without the drain, verification included.
|
|
1561
|
-
- `stop <plan>` starts nothing new and ends the run once the running tasks are done: a waiting
|
|
1562
|
-
infrastructure pause ends too, unstarted tasks stay `PENDING`, verification is skipped and `run`
|
|
1563
|
-
exits 130. When every task has merged by then, nothing was cut short: the run ends as usual,
|
|
1564
|
-
verifies and exits 0. `stop --now` interrupts the running tasks
|
|
1565
|
-
as SIGTERM would.
|
|
1566
|
-
- `retry <plan> <task> [--dwarf <spec>]` and `add <plan> <task>` only queue a request, one JSON
|
|
1567
|
-
file in `control.requests/`. At its next pass the scheduler applies or refuses it and appends
|
|
1568
|
-
an outcome line to `control.log` with the same `request` id (`actor` `scheduler`, `outcome`
|
|
1569
|
-
`applied|refused`, `reason`). `retry` takes a `FAIL`, `UNKNOWN`, `TIMEOUT`, `ERROR`,
|
|
1570
|
-
`BLOCKED`, `INTERRUPTED` or `STALE` task that is neither running nor waiting. A `STALE`
|
|
1571
|
-
task is re-dispatched with the changed prompt on the same implementer, and `--dwarf` is
|
|
1572
|
-
refused. The others are prepared exactly as `forge-parallel.sh retry` does. A
|
|
1573
|
-
`NEEDS_DECISION` task is resumed only by `--decide` or `--dwarf`, each with `--reason` and
|
|
1574
|
-
`--approved`. It spends no automatic retry budget; an `INFRA` task is the scheduler's own
|
|
1575
|
-
to resume. `add` takes a row the human appended to `tasks.tsv` (with its
|
|
1576
|
-
`tasks/<id>/prompt.md`) whose dependencies this run already knows, and refreshes `waves.tsv`.
|
|
1577
|
-
A request never outlives the scheduler that was live when it was queued; one left behind is
|
|
1578
|
-
refused, and every request is refused once the run is stopping.
|
|
1579
|
-
|
|
1580
|
-
**Ordinary execution resume:** run `run` again. Tasks already `MERGED` are skipped. A saved PASS is fingerprint-checked and merged without
|
|
1581
|
-
redispatch. PENDING, `INFRA` (paused by an infrastructure failure) and newly unblocked tasks run
|
|
1582
|
-
when eligible. A `STALE` task still waiting is prepared with the new prompt and spends nothing.
|
|
1583
|
-
A `NEEDS_DECISION` task is not among them: only a decision resumes it. Failed or interrupted tasks
|
|
1584
|
-
require an explicit `retry` (or `--retry-failed N`); `run` never silently pays for them again. Worktrees and pinned
|
|
1585
|
-
baselines are retained. A per-plan advisory lock excludes concurrent run/retry/integrate
|
|
1586
|
-
operations. A `review=group` member left `IMPLEMENTED` is not implemented again; its group's
|
|
1587
|
-
review resumes as in [Groups and group review](#groups-and-group-review-opt-in).
|
|
1588
|
-
|
|
1589
|
-
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.
|
|
1590
|
-
|
|
1591
|
-
**Interrupts.** A SIGINT or SIGTERM to `run` (or to its scheduler), and `forge control stop
|
|
1592
|
-
--now`, first reap the tasks that already ended (a PASS still merges), then send TERM to each
|
|
1593
|
-
running task's process group, wait up to `FORGE_INTERRUPT_GRACE` seconds (default 10) for the
|
|
1594
|
-
group to empty and KILL what is left. Only those live tasks become `INTERRUPTED`; their worktree
|
|
1595
|
-
keeps the partial work. Each guarded dispatch records its harness in `tasks/<id>/<role>.harness`
|
|
1596
|
-
(pid and start time), and `forge-guard.py stop` ends a harness that outlived its dispatch, at
|
|
1597
|
-
the interrupt and again at the next scheduler start (a scheduler killed outright leaves tasks
|
|
1598
|
-
`RUNNING`; the next run stops their harnesses and marks them `INTERRUPTED`). An interrupted
|
|
1599
|
-
`run` skips verification and its rerun, prints `forge-parallel.sh retry <plan> <id>` for each
|
|
1600
|
-
interrupted task, releases the plan lock and exits **130**. A signal that arrives during
|
|
1601
|
-
verification stops the verify command's whole process tree (TERM, then KILL after a few
|
|
1602
|
-
seconds) and records `verification.status` `INTERRUPTED`; that verification is not rerun.
|
|
1603
|
-
|
|
1604
|
-
**Fractal resume:** discover the managed ID with `<skill_dir>/forge fractal runs --repo
|
|
1605
|
-
"$REPO" --json`, then use `<skill_dir>/forge fractal resume RUN_ID`. Run-level resume
|
|
1606
|
-
recovers execution and the recorded Forge pipeline, retaining accepted stages and pinned
|
|
1607
|
-
baselines. A control scoped with `--task` or `--task ... --node ...` only resumes that
|
|
1608
|
-
execution scope; it does not relaunch the full pipeline. Use `retry "$PLAN" TASK_ID` for
|
|
1609
|
-
an explicitly requested new attempt, with the existing backend, bounds and eligible pool.
|
|
1610
|
-
Pause, stop and inspection preserve both the work and diagnostics.
|
|
1611
|
-
|
|
1612
|
-
## Infrastructure failures
|
|
1613
|
-
|
|
1614
|
-
A usage window, a spent budget, an auth problem, a rate limit, a provider outage, a network error,
|
|
1615
|
-
an empty answer or a cancelled dispatch says nothing about the work. The status stays **`INFRA`**.
|
|
1616
|
-
`forge-dispatch.sh` classifies the stop from the dispatch log (strong phrases and structured
|
|
1617
|
-
`is_error`/`turn.failed` results only; a reply that otherwise succeeded is never reclassified) and
|
|
1618
|
-
exits **8**, writing `<role>.infra` (`class=`, `retry_after=`, `reset_at=` when the wait is known,
|
|
1619
|
-
`detail=`, `rc=`, `role=`, `harness=`, `model=`). `do_task` copies that file to
|
|
1620
|
-
`tasks/<id>/infra.txt` and adds `stage=dwarf|qa`. The class is a symptom. What happens next is the
|
|
1621
|
-
cause, from `CAUSES` in `scripts/forge_infra.py`. A run recorded before the split may say `quota`;
|
|
1622
|
-
that name is recovered as `usage_limit`, and the summary still prints the stored word.
|
|
1623
|
-
|
|
1624
|
-
- a **dwarf-stage** stop refunds the attempt counter;
|
|
1625
|
-
- a **QA-stage** stop keeps the attempt (the dwarf's work is committed) and writes the `resume=qa`
|
|
1626
|
-
marker, so the next entry re-reviews without running the dwarf.
|
|
1627
|
-
|
|
1628
|
-
| Cause | Scope | Move | Without a peer | Hint |
|
|
1629
|
-
|---|---|---|---|---|
|
|
1630
|
-
| `capacity` | model | lateral | wait | — |
|
|
1631
|
-
| `rate_limit` | model | wait | wait | — |
|
|
1632
|
-
| `usage_limit` | harness | lateral | wait_if_reset | wait for the reset, or add another harness to this tier's pool |
|
|
1633
|
-
| `budget` | harness | lateral | ask | add credits, or check the billing of {harness} |
|
|
1634
|
-
| `auth` | harness | lateral | ask | log in to {harness} again |
|
|
1635
|
-
| `network` | all | wait | wait | — |
|
|
1636
|
-
| `provider_down` | harness | lateral | wait | — |
|
|
1637
|
-
| `empty` | model | retry | wait | — |
|
|
1638
|
-
| `cancelled` | model | retry | ask | check {harness}'s approval and permission settings |
|
|
1639
|
-
|
|
1640
|
-
**Scope** is what the pause holds back. `model` pauses that model on that harness
|
|
1641
|
-
(`model:<harness>/<model>`); `harness` pauses that harness's account (`harness:<harness>`);
|
|
1642
|
-
`all` pauses everything, so running tasks drain and nothing new starts. A model or harness cause
|
|
1643
|
-
with no harness, or a model cause with no model, pauses everything. Other tasks keep running. A
|
|
1644
|
-
pending task whose next dispatch needs a paused pair waits; unstarted tasks stay `PENDING`, never
|
|
1645
|
-
`BLOCKED`.
|
|
1646
|
-
|
|
1647
|
-
**Move** is what happens first. **lateral** sends the work to another model of the same tier —
|
|
1648
|
-
another harness or account when the scope is a harness, another model when the scope is one model —
|
|
1649
|
-
and never a stronger tier. **wait** pauses the scope until the cause clears and spends one of that
|
|
1650
|
-
scope's waits. **retry** dispatches the same model again at once and spends no wait; the next stop
|
|
1651
|
-
of that same cause is treated as lateral.
|
|
1652
|
-
|
|
1653
|
-
**Without a peer** is the recovery when no model can take the work. **wait** is the pause above.
|
|
1654
|
-
**wait_if_reset** waits when the reset is known and inside six hours, and asks otherwise; if this
|
|
1655
|
-
task did move sideways, the scope waits rather than asking. **ask** pauses the scope, marks it
|
|
1656
|
-
**needs you** with the hint (`{harness}` filled in), and spends no wait. Nothing on that scope is
|
|
1657
|
-
retried until a person acts. Raising the infra-retry budget above the value it had when it asked
|
|
1658
|
-
starts a wait after all. "Needs you" is that end of the recovery: no peer, and the cause will not
|
|
1659
|
-
clear by itself.
|
|
1660
|
-
|
|
1661
|
-
**Lateral recovery** is on for a new plan. `plan` writes `infra_fallback` as `on`;
|
|
1662
|
-
`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
|
|
1663
|
-
`run --no-infra-fallback` write the file, and `forge control set infra-fallback on|off` applies at
|
|
1664
|
-
the next infrastructure stop. It runs at the dwarf stage and at the QA stage, and not on a Fractal
|
|
1665
|
-
plan:
|
|
1666
|
-
|
|
1667
|
-
- a **dwarf-stage** stop takes the next healthy model of the tier the task is running in: the tier
|
|
1668
|
-
recorded at its newest assignment (the plan's pick, explored or not, an escalation, a pin, a
|
|
1669
|
-
`retry --dwarf`, an earlier move), as long as it still runs that model; otherwise its difficulty.
|
|
1670
|
-
A re-plan that keeps a row's model keeps its tier. A pinned implementer is not moved. No attempt
|
|
1671
|
-
is spent.
|
|
1672
|
-
- a **QA-stage** stop takes a reviewer of the same strength from `qa-routing.json`: the next member
|
|
1673
|
-
of the task's difficulty pool, then of `any`, on a pair nobody paused. Never the stopped
|
|
1674
|
-
reviewer's model, and never the implementer's. The attempt and the `resume` marker stay, so the
|
|
1675
|
-
next entry is QA only. A reviewer no such pool lists, or a plan with no `qa-routing.json`, has
|
|
1676
|
-
no peer. A pin waits for the next full retry.
|
|
1677
|
-
|
|
1678
|
-
Each move is a row of `tasks/<id>/lateral.tsv` (epoch, attempt, role `dwarf` or `qa`, from, to,
|
|
1679
|
-
cause) and a `lateral` dataset event. It is not an escalation: it is not written to
|
|
1680
|
-
`escalations.tsv`, and the escalation streak carries across the dwarf moves. A pool with no healthy
|
|
1681
|
-
member keeps the ordinary pause.
|
|
1682
|
-
|
|
1683
|
-
Without `--infra-retries`, `run` ends once nothing else can run, prints what to fix and exits `8`;
|
|
1684
|
-
verification is skipped, and running the same command again resumes. `run --infra-retries M` waits
|
|
1685
|
-
out each scope instead, up to `M` waits **per scope** (a stop in a scope already paused joins its
|
|
1686
|
-
wait and is not counted again). A scope whose waits are used up stays paused. An asking scope
|
|
1687
|
-
spends none of those waits.
|
|
1688
|
-
|
|
1689
|
-
Each wait is the provider's retry-after when the log carried one (capped at 6 h), otherwise the
|
|
1690
|
-
backoff shape for that wait number. `--infra-backoff <shape>` on `run` (kept as `infra_backoff`,
|
|
1691
|
-
read at every wait, so `forge control set infra-backoff` applies to the next one) takes
|
|
1692
|
-
`exp:<base>[,<cap>]` (base doubling, capped at `<cap>`, default the larger of the base and 30 min),
|
|
1693
|
-
`linear:<start>,<step>[,<cap>]`, or `list:<a>,<b>,...` (a bare `<a>,<b>,...` is a list; the last
|
|
1694
|
-
value repeats), all in positive seconds. The default is `exp:60`; `FORGE_INFRA_BACKOFF` changes
|
|
1695
|
-
that base. The wait message names the source, for example `waiting 120s before resuming (backoff
|
|
1696
|
-
exp:60, wait 2 of 3)`. While anything is paused, `infra.paused` (JSON `{"scopes": [...]}` with
|
|
1697
|
-
`scope`, `class`, `harness`, `model`, `tasks`, `cycle`, `until`, `exhausted`, `needs_you`, `hint`,
|
|
1698
|
-
`reset_at`) says what waits and until when. It is removed when nothing is paused, and again when
|
|
1699
|
-
the scheduler exits, so a summary printed after the run reads `infra.txt` alone.
|
|
1700
|
-
|
|
1701
|
-
The run summary and `forge control show` name the cause, the reset when it is known
|
|
1702
|
-
(`resets HH:MM`, with the date when it is not today), and **needs you** with the hint. The
|
|
1703
|
-
summary's line is ` <task> <cause> on <harness>/<model> (<stage> stage)`, then the reset and
|
|
1704
|
-
`— needs you: <hint>`, and a move is `moved sideways: <task> <role> <from> → <to> (<cause>)`.
|
|
1705
|
-
`forge control show` prints the cause on the task's status (`INFRA (cause)`) and, while the
|
|
1706
|
-
scheduler is live, on each pause line. forge-ui shows the same facts; the words it uses are in
|
|
1707
|
-
[forge-ui](ui.md).
|
|
1708
|
-
|
|
1709
|
-
A dwarf that exits 0 with an empty final message *and* an empty diff is `class=empty`: it never
|
|
1710
|
-
really ran. Under Fractal a dwarf-side stop still ends as Fractal's own `failed`; QA-side stops
|
|
1711
|
-
behave as above, and `scripts/forge_fractal/pipeline.py` resets `INFRA` to `PENDING` on resume.
|
|
1712
|
-
|
|
1713
|
-
A planned pause (a provider maintenance window, a quota reset) is `forge control drain`, not a
|
|
1714
|
-
signal: running tasks finish, nothing new starts, and `forge control resume` continues the same
|
|
1715
|
-
run.
|
|
1716
|
-
|
|
1717
|
-
## Implementer guards
|
|
1718
|
-
|
|
1719
|
-
forge records what it observed about how each dwarf behaved, never what the dwarf claimed:
|
|
1720
|
-
HEAD or the checked-out ref moved (**self-commit / branch switch**), processes left alive in the
|
|
1721
|
-
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
|
|
1722
|
-
`FORGE_ORPHAN_GUARD=off` or under Fractal), and a final message that **promises later work**.
|
|
1723
|
-
They are written to `tasks/<id>/guard.txt`, added to the QA prompt as "Implementer guard notes" and
|
|
1724
|
-
shown in the run summary. They never change a status. The dwarf prompt itself tells the
|
|
1725
|
-
implementer not to commit, not to start background processes, to finish every measurement before
|
|
1726
|
-
its last message, and to say plainly what it could not run.
|
|
1727
|
-
|
|
1728
|
-
## Accepting, splitting, combining and the whole-run review
|
|
1729
|
-
|
|
1730
|
-
Four subcommands act on plans after tasks have run. Full usage and refusal conditions are in the
|
|
1731
|
-
[README](../docs/reviews.md#accepting-a-task-despite-its-reviewer); the mechanics:
|
|
1732
|
-
|
|
1733
|
-
- **`adopt <plan> <commit|a..b> --reason …`**, or **`adopt <plan> --head --reason …`** (each with
|
|
1734
|
-
`--qa <spec>`, `--yolo-qa`, `--approved`), brings a commit
|
|
1735
|
-
made outside forge into the run instead of leaving `review` refusing. The first cherry-picks onto the
|
|
1736
|
-
integration branch. `--head` takes what is already on it past `accepted.integration`, and it is what
|
|
1737
|
-
`review`'s refusal names. The run's QA (`--qa`, then `final_qa`, then the first task's) reviews that
|
|
1738
|
-
range alone against the reason, and no implementer runs. PASS, or a verdict the threshold accepts, moves
|
|
1739
|
-
`accepted.integration`, adds a row to `adoptions.tsv` (epoch, base, tip, verdict, approved, spec, review,
|
|
1740
|
-
reason) and to `control.log`, writes an `adopt` dataset event, and verifies as a retry does. A FAIL or
|
|
1741
|
-
UNKNOWN puts the branch back and exits 5, unless `--approved` keeps it, which writes the findings to the
|
|
1742
|
-
adoption's `known_issues.md` as `accept` does; `forge issues` and the run's report read that file (as
|
|
1743
|
-
accepted findings, the reason with them), and the sweep lists them as `accepted` without fixing them;
|
|
1744
|
-
what the review tolerated under the threshold the sweep fixes like a task's. The reviewer is told the
|
|
1745
|
-
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
|
|
1746
|
-
infrastructure stop exits 8, a signal exits 130 or 143. If the worktree changed during the review it is
|
|
1747
|
-
left as it is, with the commands to go on. A range that lived only on the branch stays at
|
|
1748
|
-
`refs/forge/adopt-refused/<dir>`. A merge commit is refused, and a range that does not apply exits 6. A
|
|
1749
|
-
diff over 400 KB is read in the snapshot rather than inlined, as in a final review.
|
|
1750
|
-
There is no task row, because no model implemented it; the final review reads the whole range and is told
|
|
1751
|
-
about it, `attribute` treats it as a step of its own, and forge-ui lists it above the final review, each
|
|
1752
|
-
row opening its review, its findings and the range's diff with the findings pinned.
|
|
1753
|
-
`adopt-<epoch>-<pid>/` keeps the review.
|
|
1754
|
-
- **`accept <plan> <task> --reason … --approved`** overrides a `FAIL`/`UNKNOWN` reviewer only
|
|
1755
|
-
when the reviewed commit is still the branch tip and the worktree still matches
|
|
1756
|
-
`source.fingerprint`. It records `known_issues.md` and `accepted.by`, merges through `merge_task`,
|
|
1757
|
-
and restores the prior state if the merge fails. The orchestrator never runs it unprompted.
|
|
1758
|
-
- **`review <plan> [--qa <spec>]`** and **`integrate --final-review <spec>`** run one QA dispatch
|
|
1759
|
-
over the combined result (`integration.base..tip`, or `parent..candidate`) in a disposable
|
|
1760
|
-
checkout with the goal, every task's requirements, known issues, drift, guard notes and the
|
|
1761
|
-
verification result in front of the reviewer. Same verdict/severity contract and
|
|
1762
|
-
threshold gate as per-task QA; a mutation during the review is `INVALIDATED`; a `FAIL`
|
|
1763
|
-
or missing verdict blocks `integrate` with exit `5`, an infrastructure stop with `8`, and the
|
|
1764
|
-
user's branch is never touched. Nothing runs unless one of them is invoked.
|
|
1765
|
-
- **`split <plan> <new-plan> --tasks a,b`** copies the selected tasks' saved state to a new plan,
|
|
1766
|
-
renames their branches and worktrees to the new run id, starts a new integration branch at the
|
|
1767
|
-
source's accepted tip and removes them from the source (refuses Fractal-backed plans, `MERGED`
|
|
1768
|
-
or `RUNNING` tasks, and selections that strand a dependent).
|
|
1769
|
-
- **`combine <new-plan> <plan>…`** merges the integration branches of fully merged plans into one
|
|
1770
|
-
new plan whose `run` only verifies. Task branches keep their original names.
|
|
1771
|
-
|
|
1772
|
-
`split`/`combine` hold the plans' advisory locks for their whole duration, and every failure path
|
|
1773
|
-
removes what it created.
|
|
1774
|
-
|
|
1775
|
-
## Chained plans
|
|
1776
|
-
|
|
1777
|
-
`plan <dir> --after <prev>` starts `<dir>` from an earlier plan's integration branch. `<prev>`
|
|
1778
|
-
is that plan's directory. See the [plan flags](../docs/commands.md#scriptsforge-parallelsh).
|
|
1779
|
-
|
|
1780
|
-
`plan` writes `<prev>`'s absolute path to `after` and the starting commit to
|
|
1781
|
-
`integration.base`, and creates `forge/<run>-integration` at `<prev>`'s
|
|
1782
|
-
`accepted.integration`. A branch that already points at that commit is kept. The approval
|
|
1783
|
-
table prints `after: <run> (<base>)`, with the first 12 characters of that commit. A later `plan` of the same directory without `--after` keeps the
|
|
1784
|
-
files and the branch. A chained plan skips the warning about uncommitted changes in the
|
|
1785
|
-
repository: its worktrees start from the previous plan's accepted tip.
|
|
1786
|
-
|
|
1787
|
-
`<prev>` has to be a plan of the same repository. Every refusal below is exit 2, and it leaves
|
|
1788
|
-
the plan directory and the branches as they were:
|
|
1789
|
-
|
|
1790
|
-
- `<prev>` is not a directory, `--after` was given no directory, or the directory has no
|
|
1791
|
-
`tasks.tsv`, `run_id` and `repo`
|
|
1792
|
-
- the plan would come after itself
|
|
1793
|
-
- the two plans belong to different repositories
|
|
1794
|
-
- a task of `<prev>` is not `MERGED`
|
|
1795
|
-
- `forge/<prev-run>-integration` is missing, `<prev>` has no `accepted.integration`, or the
|
|
1796
|
-
branch tip is not that accepted commit. Extra commits on the branch are adopted into
|
|
1797
|
-
`<prev>` first (`forge-parallel.sh adopt <prev> --head --reason "…"`)
|
|
1798
|
-
- `<prev>`'s scheduler is live (`scheduler.live` names a pid that is still running)
|
|
1799
|
-
- this plan's own `forge/<run>-integration` is at another commit: it is checked out, it is
|
|
1800
|
-
not still at the recorded `integration.base`, or this plan already has merged work
|
|
1801
|
-
|
|
1802
|
-
Before any merge, a different `--after` moves the branch when it is still at its old
|
|
1803
|
-
`integration.base` and is not checked out. After a task has merged, a different `--after`
|
|
1804
|
-
is the same exit 2, and the recorded base stays.
|
|
1805
|
-
|
|
1806
|
-
`run` checks again while no task of this plan has merged. If `<prev>` has no
|
|
1807
|
-
`accepted.integration`, `run` notes that and goes on. Otherwise that commit must be an
|
|
1808
|
-
ancestor of this plan's `integration.base`. If `<prev>` moved, `run` exits 3, dispatches
|
|
1809
|
-
nothing, and tells you to run `plan <dir> --after <prev>` again. Planning again with the
|
|
1810
|
-
same `--after` records the new tip. A plan split from a chained plan starts later than
|
|
1811
|
-
`<prev>` ended; the old tip is still an ancestor, so the check passes. Once a task of this
|
|
1812
|
-
plan has merged, `run` does not check again.
|
|
1813
|
-
|
|
1814
|
-
`integrate` merges this plan's integration branch, which already holds every plan it follows,
|
|
1815
|
-
and prints `this brings plans A → B → C` with the run ids, oldest first. A predecessor
|
|
1816
|
-
that cannot be read, or a chain longer than 64, makes that line start with `…`. A plan
|
|
1817
|
-
with no `after` file prints no such line.
|
|
1818
|
-
|
|
1819
|
-
`forge runs` puts `after <run>` on the plan's summary line. `<run>` is the predecessor's run
|
|
1820
|
-
id, or its key when that directory is gone. forge-ui shows After, a link to the plan this run
|
|
1821
|
-
follows, and Followed by, the plans whose `after` names this run.
|
|
1822
|
-
|
|
1823
|
-
## Branches, worktrees, cleanup
|
|
1824
|
-
|
|
1825
|
-
```
|
|
1826
|
-
<plan-dir>/tasks/<id>/approach.md intended approach, if planned
|
|
1827
|
-
<plan-dir>/retry_per_model failures on each model before the next rung (1-99); absent leaves escalate_after
|
|
1828
|
-
<plan-dir>/tasks/<id>/prompt.dispatched prompt.md as given to the implementer; written last at dispatch
|
|
1829
|
-
<plan-dir>/tasks/<id>/approach.dispatched approach.md as given; empty when there was none
|
|
1830
|
-
<plan-dir>/tasks/<id>/stale.diff unified diff when prompt.md or approach.md changed during the attempt
|
|
1831
|
-
<plan-dir>/tasks/<id>/outside.json paths a plan stop named, with owner, owners and owner_status
|
|
1832
|
-
<plan-dir>/tasks/<id>/risk low|medium|high, recorded only (#122), if rated
|
|
1833
|
-
<plan-dir>/groups.tsv id, review, qa, members, title, goal; absent unless groups are on
|
|
1834
|
-
<plan-dir>/groups.frozen sha256 of the six columns, then each member's deps and files
|
|
1835
|
-
<plan-dir>/group_max_tasks, group_max_diff_kb review-group bounds; defaults 6 and 256 when the file is absent
|
|
1836
|
-
<plan-dir>/groups/<gid>/ one review=group group's review; see Groups and group review
|
|
1837
|
-
<plan-dir>/tasks/<id>/reviewed.commit commit a review=group member stopped at (also a task review's)
|
|
1838
|
-
<plan-dir>/tasks/<id>/source.fingerprint worktree fingerprint beside that commit
|
|
1839
|
-
<plan-dir>/tasks/<id>/settled.group gid and round, once a group FAIL judged this member
|
|
1840
|
-
<plan-dir>/tasks/<id>/retry_sources.tsv attempt, source, epoch: why each retried attempt ran (#133)
|
|
1841
|
-
<plan-dir>/run.flags.json flags of this run of the plan, rewritten at each real start; not copied by split or rerun
|
|
1842
|
-
<plan-dir>/handoff.notes.jsonl session notes of what is not on disk: at, actor, text; newest first in forge handoff
|
|
1843
|
-
<plan-dir>/handoff.driver.json harness, session, since, last_seen of the session driving the run
|
|
1844
|
-
<plan-dir>/tasks/<id>/interrupted-<epoch>.diff uncommitted work saved before forge handoff resume resets a stale RUNNING worktree
|
|
1845
|
-
<plan-dir>/resume-<epoch>.{log,done} log of the run forge handoff resume started, and its exit code once that run ends
|
|
1846
|
-
<repo>/.forge/ project memory (survives the run)
|
|
1847
|
-
<repo>/../.forge-worktrees/<run-id>/<task-id> task worktree
|
|
1848
|
-
<repo>/../.forge-worktrees/<run-id>/_integration integration worktree
|
|
1849
|
-
<repo>/../.forge-worktrees/<run-id>/_group-<gid> group-review candidate; kept for the merge
|
|
1850
|
-
forge/<run-id>/<task-id> task branch
|
|
1851
|
-
forge/<run-id>-integration integration branch
|
|
1852
|
-
```
|
|
1853
|
-
|
|
1854
|
-
Fractal also keeps control repositories, isolated product candidates and per-step logs
|
|
1855
|
-
under `${XDG_STATE_HOME:-$HOME/.local/state}/forge/fractal/runs/<managed-run-id>/tasks/`.
|
|
1856
|
-
These are separate from the Forge task worktrees listed above. Candidates begin at each
|
|
1857
|
-
task's pinned baseline and return to its ordinary review/integration pipeline; Fractal
|
|
1858
|
-
initialization metadata stays outside the product diff. Managed run/task IDs are shown by
|
|
1859
|
-
`fractal runs` and `fractal tree`, and differ from the human-readable `tasks.tsv` IDs.
|
|
1860
|
-
|
|
1861
|
-
### Worktree setup
|
|
1862
|
-
|
|
1863
|
-
A fresh worktree is a bare checkout — no `node_modules`, no venv, no build output. Without help,
|
|
1864
|
-
every dwarf in the run rediscovers that the same way (run the tests, watch them fail, work out the
|
|
1865
|
-
install) and pays it again, which is both slow and a source of near-identical "this worktree has no
|
|
1866
|
-
dependencies" entries in project memory.
|
|
1867
|
-
|
|
1868
|
-
Tell forge what a worktree needs and it runs it verbatim, once per worktree, from the worktree
|
|
1869
|
-
root, at creation time only:
|
|
1870
|
-
|
|
1871
|
-
- `.forge/setup` in the repo — executable, or any file whose contents are a shell command;
|
|
1872
|
-
- `--setup <command>` on `run` or `retry`, which overrides it.
|
|
1873
|
-
|
|
1874
|
-
A resumed run or a `retry` reuses the existing worktree and does not pay it again. The integration
|
|
1875
|
-
worktree gets the same treatment, since that is where a merged result is validated — without it the
|
|
1876
|
-
one checkout holding every task's merged work is the one checkout that cannot build it.
|
|
1877
|
-
|
|
1878
|
-
Failure is reported and non-fatal: the dwarf gets a worktree it can still install into itself,
|
|
1879
|
-
which is the status quo this replaces. Output lands in `tasks/<id>/setup.out`.
|
|
1880
|
-
|
|
1881
|
-
**Submodules.** `git worktree add` leaves every submodule directory empty. Before the setup step,
|
|
1882
|
-
forge fills them offline from the source checkout (no fetch, no `git submodule`), so `.forge/setup`
|
|
1883
|
-
sees a complete tree. Each submodule gets one state in `tasks/<id>/submodules.txt`:
|
|
1884
|
-
|
|
1885
|
-
- `exported` — the recorded commit was extracted from the source's submodule repository;
|
|
1886
|
-
- `copied` — that commit was not available, so the source checkout's files were copied;
|
|
1887
|
-
- `kept` — the directory already held files (a resume), left as they are;
|
|
1888
|
-
- `missing` — nothing was available; the directory stays empty and the runner prints a note.
|
|
1889
|
-
|
|
1890
|
-
The files carry no `.git`, so git ignores them: they never appear in `changes.diff`, a commit, a
|
|
1891
|
-
review snapshot or a fingerprint, and the worktree still moves and is removed normally. The capsule
|
|
1892
|
-
tells the dwarf which submodules are present. Integration worktrees (`run`, `integrate`, `combine`,
|
|
1893
|
-
`split`) get the same treatment. Out of scope: a task that moves a gitlink's recorded commit (its
|
|
1894
|
-
worktree keeps the old content) and nested submodules (left empty).
|
|
1895
|
-
|
|
1896
|
-
**Reviewers get the same dependencies.** A review snapshot holds committed files only, so forge
|
|
1897
|
-
links the directories package managers install into (`node_modules`, `bower_components`, `.venv`,
|
|
1898
|
-
`venv`, `vendor`, `.bundle`, `Pods`, Mix's `deps` and `_build`, `.dart_tool`, `elm-stuff` and
|
|
1899
|
-
SwiftPM's `.build`) from the checkout under review (the task's
|
|
1900
|
-
worktree, or the integration worktree for a final review) into the snapshot, at the root and in
|
|
1901
|
-
workspace packages down to five levels, unless the snapshot already holds that path or lacks its
|
|
1902
|
-
parent. These are the directories this step filled, so they match the attempt. The links count for
|
|
1903
|
-
no fingerprint and stay out of the reviewer's `git status`. The prompt names what was linked and what
|
|
1904
|
-
is committed, or says there is none, says when forge ran no tests of its own, and tells the reviewer
|
|
1905
|
-
to report rather than search or install. A directory that is only partly committed (`vendor/.gitkeep`)
|
|
1906
|
-
keeps its committed files and gets no link. Nothing guards a write
|
|
1907
|
-
through a link: forge commits whatever git does not ignore, so a linked directory is an ignored one
|
|
1908
|
-
(a directory the attempt committed is already in the snapshot and gets no link), and a write there
|
|
1909
|
-
changes nothing that merges. A link dangles once its worktree is removed, which harms nothing. Each
|
|
1910
|
-
reviewer ends with `FORGE_TESTS: RAN`, `NOT NEEDED — why` or `COULD NOT RUN — why`; the last prints a note, and
|
|
1911
|
-
forge-ui and the dataset show it.
|
|
1912
|
-
|
|
1913
|
-
Forge does not guess this step, and the obvious guess is worth naming because it looks right and
|
|
1914
|
-
is not: symlinking the source repo's `node_modules` into the worktree. In a workspace monorepo the
|
|
1915
|
-
workspace links inside it point back at the source checkout, so the worktree builds against the
|
|
1916
|
-
source repo's packages rather than its own — producing type errors naming files the task never
|
|
1917
|
-
touched. Copying is correct but can be gigabytes per task. The repo knows which of those it wants;
|
|
1918
|
-
forge does not.
|
|
1919
|
-
|
|
1920
|
-
The worktree root is a sibling of the repo and **never** `TMPDIR`. Isolated worktrees are
|
|
1921
|
-
never pushed, so a temp root that gets cleaned takes the only copy of that work with it —
|
|
1922
|
-
this has already destroyed real work in this user's `linear-spanks` runs.
|
|
1923
|
-
|
|
1924
|
-
Cleanup rules:
|
|
1925
|
-
|
|
1926
|
-
- A successful task's worktree is removed only after `results.tsv` is written and read back.
|
|
1927
|
-
- A failed, conflicted or unknown task keeps **both** its branch and its worktree, so there
|
|
1928
|
-
is something to inspect and retry from.
|
|
1929
|
-
- The integration branch is left in place. Merging it into the user's branch is a separate
|
|
1930
|
-
`integrate --approved` step and never happens automatically.
|
|
1931
|
-
|
|
1932
|
-
The user's own branch and working tree are untouched for the whole run.
|
|
1933
|
-
|
|
1934
|
-
## Failure modes
|
|
1935
|
-
|
|
1936
|
-
| Symptom | Cause |
|
|
1937
|
-
|---------|-------|
|
|
1938
|
-
| task status `ERROR` | worktree creation or a dispatch failed; see `tasks/<id>/dwarf.out` / `qa.out` |
|
|
1939
|
-
| task status `TIMEOUT` | that role exceeded the dispatch timeout and was killed. It has usually left a partial edit in the worktree; `retry` continues from it |
|
|
1940
|
-
| task status `FAIL` with "produced no changes" | the dwarf ended without editing anything — usually an ambiguous prompt it could not resolve headlessly |
|
|
1941
|
-
| task status `UNKNOWN` | QA never emitted a verdict line; read `tasks/<id>/qa.last`. `retry` re-runs QA only, on the unchanged work |
|
|
1942
|
-
| task status `INFRA`, `run` exits `8` | an infrastructure stop; the cause is in the summary and `tasks/<id>/infra.txt`. No attempt spent. Fix a "needs you" line before re-running; otherwise re-run, or wait with `--infra-retries M`. See [Infrastructure failures](#infrastructure-failures) |
|
|
1943
|
-
| task status `NEEDS_DECISION` | reviews are not converging, the retry policy has no stronger model, every blocking finding needs a file the task does not declare (reason `plan`), or the attempt cap is spent. Read `tasks/<id>/decision.md`. Only a decision resumes it |
|
|
1944
|
-
| task status `STALE` | `prompt.md` or `approach.md` changed during the attempt. Not reviewed, and no attempt spent. The scheduler re-dispatches it with the new text; so does `forge control retry`. See [Retrying, and resuming an interrupted run](#retrying-and-resuming-an-interrupted-run) |
|
|
1945
|
-
| task status `IMPLEMENTED` | a `review=group` member finished implementing and waits for its group's review. `retry` and `accept` exit 3. See [Groups and group review](#groups-and-group-review-opt-in) |
|
|
1946
|
-
| group status `NEEDS_DECISION` | the combined diff is over `group_max_diff_kb`, or a blocking finding names no member. Read `groups/<gid>/decision.md`. `forge group show` prints it; `forge group retry --tasks` only on the user's word, and only for an ambiguous decision |
|
|
1947
|
-
| a group left `INFRA`, `TIMEOUT` or `INTERRUPTED` | the review did not finish. The next `run` reviews it again. `forge group retry` rearms it to `INTERRUPTED`. No member attempt was spent |
|
|
1948
|
-
| a group left `UNKNOWN` | no verdict. The next `run` reviews it again while `--retry-failed` budget remains; otherwise it stays. `forge group retry` rearms it. No member attempt was spent |
|
|
1949
|
-
| a group left `ERROR` | the dispatch failed, or the review ended while still `REVIEWING`. The next `run` leaves it. `forge group retry` rearms it to `INTERRUPTED`. No member attempt was spent |
|
|
1950
|
-
| task status `INTERRUPTED`, `run` exits `130` | the run was signalled or stopped with `forge control stop --now`; verification was skipped. The summary prints `forge-parallel.sh retry <plan> <id>` for each one; a plain `run` does not dispatch them |
|
|
1951
|
-
| a run that sits idle with tasks `PENDING` | `forge control drain` is in effect (`forge control show` says `drained`; `forge control resume` continues), every scope a task needs is paused on infrastructure (`infra.paused`), or `max-parallel` is lower than you think |
|
|
1952
|
-
| a `FAIL` task merged anyway | the threshold (`P2` by default) tolerated its findings, or a person ran `accept`; see `known_issues.md` and `qa.gate` |
|
|
1953
|
-
| a task `FAIL`ed although its reviewer said `PASS` | forge's gate: a CONFIRMED finding at or above the threshold was listed (`qa.gate` decision `fail`); the retry starts with a note saying so |
|
|
1954
|
-
| task status `CONFLICT` | QA passed but the merge onto the integration branch conflicted — `files` was understated somewhere |
|
|
1955
|
-
| every wave has one task | `files` sets overlap across most tasks; the decomposition is not actually parallel |
|
|
1956
|
-
| dwarves ignore existing work | `goal.txt` or `files` missing, so the capsule carries no useful status |
|
|
1957
|
-
| `.forge/` appears in a task's diff | the capture is missing `':(exclude).forge'` — see `memory.md` |
|
|
1958
|
-
| dwarves build incompatible interfaces | no `approach.md`; the seam was never agreed. Plan it, or use `--planner` |
|
|
1959
|
-
| "scope drift" in the summary | the task touched files it did not declare. Not a failure — but if a later task conflicts on one of those files, this is why |
|
|
1960
|
-
| `retry` says "produced no new changes" | the dwarf returned a byte-identical diff. It has nothing to add; escalate with `--dwarf` or fix the prompt |
|
|
1961
|
-
| a task will not re-run: "already exists" | a worktree directory was deleted by hand. `run`/`retry` prune stale registrations first, so re-run rather than deleting the branch |
|
|
1962
|
-
|
|
1963
|
-
A run where several tasks report "produced no changes" usually means the decomposition
|
|
1964
|
-
produced tasks that were not independently actionable — the fix is a coarser
|
|
1965
|
-
`--decompose-level`, not more retries.
|
|
1966
|
-
|
|
1967
|
-
## Execution checks and integration verification
|
|
1968
|
-
|
|
1969
|
-
Before dispatch, `run` preflights every task's dwarf and QA plus a configured planner.
|
|
1970
|
-
`retry` repeats preflight and dependency checks. A dependency must be MERGED, not merely
|
|
1971
|
-
planned or QA-passing; otherwise its consumer is BLOCKED without spending a dispatch.
|
|
1972
|
-
Directory/child ownership paths overlap and cannot run concurrently. A blocked task can be
|
|
1973
|
-
retried after its prerequisites merge. A fresh task then branches from current integration.
|
|
1974
|
-
|
|
1975
|
-
QA receives complete implementation input, approach, capsule and cumulative binary diff.
|
|
1976
|
-
It runs in a disposable repository. Both source and review fingerprints must remain unchanged,
|
|
1977
|
-
and the task branch must still point at the reviewed commit when merged; the review copy is a
|
|
1978
|
-
commit, so only its tracked content counts (a test run's untracked `__pycache__/` there changes
|
|
1979
|
-
nothing). INVALIDATED results never merge; `retry` re-runs only QA while the work is unchanged. Disposable snapshots detect mutation; they do not confine unrestricted shell access.
|
|
1980
|
-
|
|
1981
|
-
Configure combined executable checks with `run <plan> --verify '<command>'` (also accepted by
|
|
1982
|
-
`retry`), or a shell command file at `<repo>/.forge/verify`. Commands execute under Bash from
|
|
1983
|
-
the integration checkout. Forge records `verification.command`, `.log`, `.exit`, `.fingerprint`
|
|
1984
|
-
and `.status` in the plan directory. Failed checks or source changes fail the run. With no
|
|
1985
|
-
command, the result is explicitly UNVERIFIED. A `retry` that leaves tasks still to run
|
|
1986
|
-
(PENDING or BLOCKED) skips its verification and says so: the `run` that dispatches them verifies
|
|
1987
|
-
the integration branch at its end, and `integrate` verifies its candidate.
|
|
1988
|
-
|
|
1989
|
-
A failed command whose source fingerprint is unchanged is rerun (`--verify-retries N`, default
|
|
1990
|
-
`1`, `0` = strict single run). When the repository has `.forge/verify-subset` (a test command
|
|
1991
|
-
with `{files}` or `{changed}`) and the log names failing tracked test files (unittest
|
|
1992
|
-
`FAIL:`/`ERROR:` lines, pytest `FAILED path::`, node's test runner `test at file:L:C` or TAP
|
|
1993
|
-
`location:`), those files run alone first (`verification.failing.log`, run kind `failing`): if
|
|
1994
|
-
they fail again the regression is confirmed and the whole command is not rerun. If they pass,
|
|
1995
|
-
or nothing can be named, the whole command reruns as before, so a pass always comes from the
|
|
1996
|
-
whole command. A rerun that passes leaves status `PASS` but writes
|
|
1997
|
-
`verification.flaky` (both exit codes), keeps the first run in `verification.log` and the second
|
|
1998
|
-
in `verification.retry.log`, and prints a loud `FLAKY` line in `run`/`retry`/`integrate` output;
|
|
1999
|
-
a command that changes the tree is never retried.
|
|
2000
|
-
|
|
2001
|
-
**Verification lanes.** Instead of one command, verification can be several named **lanes**
|
|
2002
|
-
that run side by side, each rerun on its own. A lane is a file whose name is the lane's name
|
|
2003
|
-
(letters, digits, `_` and `-`, at most 64) and whose text is a Bash command, run from the
|
|
2004
|
-
integration checkout like the single command; leading `#forge:` lines give it options. Declare
|
|
2005
|
-
them in the repository as `.forge/verify.d/<name>` files, or for one plan with
|
|
2006
|
-
`run --verify-lane 'name[opt,opt]=command'` (also `retry`; repeatable, written to
|
|
2007
|
-
`<plan>/verify.d/`; the first one of an invocation replaces the plan's earlier lanes and its
|
|
2008
|
-
`--verify`, as `--verify` replaces the plan's lanes). The first source that exists wins: the
|
|
2009
|
-
plan's lanes, the plan's `--verify`, the repository's `.forge/verify.d/`, then
|
|
2010
|
-
`.forge/verify` (ignored, with a note, when the repository also has lanes). `run` checks the
|
|
2011
|
-
lanes before any model is paid for and exits 2 on an invalid one (an unknown or repeated
|
|
2012
|
-
option, an empty command, a path outside the checkout, a missing baseline).
|
|
2013
|
-
|
|
2014
|
-
| Option | Means |
|
|
2015
|
-
|---|---|
|
|
2016
|
-
| `group=<name>` | lanes of one group never run at the same time (a shared database, a port) |
|
|
2017
|
-
| `first` | runs before every other lane; if a `first` lane fails (after its reruns) or changes the tree, the rest are `skipped` |
|
|
2018
|
-
| `retries=<0-9>` | reruns of this lane when it fails; otherwise `--verify-retries` (default `1`) |
|
|
2019
|
-
| `reports=<dir>` | JUnit `*.xml` and TAP `*.tap` reports the lane writes under `<dir>` (inside the checkout). Only reports written during that run count; they give the lane's test counts and failing tests, and are re-read every 10 s while it runs |
|
|
2020
|
-
| `baseline=<file>` | known failing test names, one per line (`#` comments), inside the checkout. A lane whose every failing test is in it ends `known`, which passes. A report that could not be read, or a failure no report names, is judged by the exit code |
|
|
2021
|
-
|
|
2022
|
-
Up to `--verify-parallel N` lanes run at once (`run`, `retry` and `integrate`, kept as
|
|
2023
|
-
`verify_parallel`, 1 to 32, default 3), started in name order. A lane that fails is rerun alone,
|
|
2024
|
-
after the round, up to its budget; a pass on a rerun makes it `flaky`, which passes but is named
|
|
2025
|
-
in the run output (`FLAKY: lane <name> failed once and passed on rerun`), in
|
|
2026
|
-
`verification.flaky` and in the whole-run review. Nothing reruns once the tree changed: the
|
|
2027
|
-
checkout's fingerprint is compared after every round, and a change fails the verification
|
|
2028
|
-
(`mutated`; with lanes in parallel it cannot be pinned to one of them). A lane's states are
|
|
2029
|
-
`waiting`, `running`, `pass`, `fail`, `flaky`, `known`, `skipped` and `interrupted`. Lanes mode
|
|
2030
|
-
replaces the whole-command rerun above; the single-command mode is unchanged.
|
|
2031
|
-
|
|
2032
|
-
A lane may print `::forge step name=<step> state=start` and `::forge step name=<step>
|
|
2033
|
-
state=end [exit=<n>]`, each on a line of its own, to say which step it is in; forge-ui shows the
|
|
2034
|
-
open step live. A signal stops the running lanes' process groups (TERM, then KILL after 5 s),
|
|
2035
|
-
marks them and the verification `INTERRUPTED`, and exits 130 like a single command.
|
|
2036
|
-
|
|
2037
|
-
The runner is `scripts/forge-verify.py` (`lanes` lists and checks a directory's lanes; `run`
|
|
2038
|
-
runs them). In lanes mode `verification.command` holds one `<lane>: <first line>` per lane,
|
|
2039
|
-
`verification.log` the runner's summary plus the last 200 lines of each lane that failed, and
|
|
2040
|
-
`verification.lanes.json` the live state of every lane; each lane writes
|
|
2041
|
-
`verification.lane.<name>.log` and keeps each finished run as `verification.lane.<name>.run-<k>.log`.
|
|
2042
|
-
|
|
2043
|
-
```
|
|
2044
|
-
.forge/verify.d/lint #forge: first
|
|
2045
|
-
npm run lint && npm run typecheck
|
|
2046
|
-
.forge/verify.d/unit #forge: reports=reports/unit
|
|
2047
|
-
npm test -- --reporter=junit --outputFile=reports/unit/junit.xml
|
|
2048
|
-
.forge/verify.d/db #forge: group=postgres retries=2 reports=reports/db baseline=.forge/known-db-failures.txt
|
|
2049
|
-
docker compose up -d postgres && npm run test:db
|
|
2050
|
-
```
|
|
2051
|
-
|
|
2052
|
-
Here `lint` runs alone first; `unit` and `db` then run together, another lane in the
|
|
2053
|
-
`postgres` group would wait for `db`, and a `db` run whose only failures are listed in the
|
|
2054
|
-
baseline ends `known`.
|
|
2055
|
-
|
|
2056
|
-
`scripts/forge-verify-coverage.py` reads the project's own test configuration and **warns**
|
|
2057
|
-
(never fails) about suites the command does not run — at `run` start before any model is paid
|
|
2058
|
-
for, again in `verify_result`, and at `integrate` — recording the lines in
|
|
2059
|
-
`verification.coverage.txt`. Without a verify command it lists what the project defines.
|
|
2060
|
-
|
|
2061
|
-
`integrate <plan> --approved` prepares a separate candidate combining the current user branch
|
|
2062
|
-
and integration revision, runs worktree setup and the configured check there, then updates the
|
|
2063
|
-
user branch only if the candidate passed and the source branch stayed unchanged. Logs live in
|
|
2064
|
-
`<plan>/integrate-*/`. A failed candidate remains available for inspection. With no verification
|
|
2065
|
-
command, integration retains the existing approval boundary and reports UNVERIFIED.
|
|
2066
|
-
|
|
2067
|
-
Optional [Ripwire context](ripwire.md) is enabled by default. Use `--no-ripwire`
|
|
2068
|
-
or `FORGE_RIPWIRE=off` to disable preparation and installation offers.
|