@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.
Files changed (153) hide show
  1. package/CHANGELOG.md +61 -0
  2. package/README.md +19 -12
  3. package/SKILL.md +137 -216
  4. package/VERSION +1 -1
  5. package/docs/README.md +2 -3
  6. package/docs/add-ons.md +5 -3
  7. package/docs/artifacts.md +17 -2
  8. package/docs/commands.md +85 -63
  9. package/docs/decomposed-runs.md +195 -21
  10. package/docs/development.md +11 -9
  11. package/docs/forge-ui.md +33 -4
  12. package/docs/install.md +37 -5
  13. package/docs/memory.md +6 -1
  14. package/docs/models.md +36 -10
  15. package/docs/reviews.md +44 -25
  16. package/docs/safety.md +27 -2
  17. package/docs/troubleshooting.md +7 -10
  18. package/forge +25 -4
  19. package/package.json +2 -1
  20. package/references/dataset.md +10 -9
  21. package/references/decompose-integration.md +337 -0
  22. package/references/decompose-opt-in.md +527 -0
  23. package/references/decompose-recovery.md +569 -0
  24. package/references/decompose-review.md +256 -0
  25. package/references/decompose.md +99 -1606
  26. package/references/findings.md +68 -0
  27. package/references/harnesses.md +7 -12
  28. package/references/memory.md +13 -2
  29. package/references/planning.md +48 -18
  30. package/references/ripwire.md +38 -13
  31. package/references/runtime.md +22 -33
  32. package/references/setup.md +90 -0
  33. package/references/solo.md +13 -42
  34. package/references/ui.md +12 -5
  35. package/registry.tsv +40 -22
  36. package/scripts/forge-artifact.sh +143 -12
  37. package/scripts/forge-compare.py +5 -15
  38. package/scripts/forge-config.py +14 -1
  39. package/scripts/forge-contract.py +216 -53
  40. package/scripts/forge-control.py +777 -54
  41. package/scripts/forge-dispatch.sh +95 -12
  42. package/scripts/forge-du.py +13 -3
  43. package/scripts/forge-handoff.py +221 -39
  44. package/scripts/forge-install-ripwire.sh +100 -24
  45. package/scripts/forge-install.sh +18 -32
  46. package/scripts/forge-issues.py +6 -4
  47. package/scripts/forge-jev-options.sh +3 -5
  48. package/scripts/forge-lib-adopt.sh +169 -5
  49. package/scripts/forge-lib-attribute.sh +10 -3
  50. package/scripts/forge-lib-decompose.sh +454 -0
  51. package/scripts/forge-lib-env.sh +21 -0
  52. package/scripts/forge-lib-group.sh +4 -1
  53. package/scripts/forge-lib-plans.sh +30 -18
  54. package/scripts/forge-lib-review.sh +28 -8
  55. package/scripts/forge-lib-task.sh +225 -56
  56. package/scripts/forge-lib-verify.sh +59 -10
  57. package/scripts/forge-memory.sh +81 -4
  58. package/scripts/forge-metrics.sh +4 -2
  59. package/scripts/forge-parallel-options.sh +23 -4
  60. package/scripts/forge-parallel.sh +447 -175
  61. package/scripts/forge-plan-check.py +71 -8
  62. package/scripts/forge-planner.py +303 -17
  63. package/scripts/forge-pr.py +9 -1
  64. package/scripts/forge-prompt.py +2 -2
  65. package/scripts/forge-review-links.py +248 -0
  66. package/scripts/forge-ripwire.py +234 -16
  67. package/scripts/forge-route.py +19 -27
  68. package/scripts/forge-runs-rm.py +92 -21
  69. package/scripts/forge-runs.py +46 -5
  70. package/scripts/forge-runtime.py +37 -12
  71. package/scripts/forge-schedule.py +124 -33
  72. package/scripts/forge-setup-stale.py +236 -0
  73. package/scripts/forge-setup.py +804 -0
  74. package/scripts/forge-shadow.py +2 -20
  75. package/scripts/forge-solo-lock.py +46 -0
  76. package/scripts/forge-solo.sh +33 -56
  77. package/scripts/forge-sweep.py +2 -1
  78. package/scripts/forge-ui.py +8 -1
  79. package/scripts/forge-update.sh +2 -2
  80. package/scripts/forge-verify.py +16 -1
  81. package/scripts/forge-version.py +13 -1
  82. package/scripts/forge-watch.py +7 -2
  83. package/scripts/forge_dataset/__init__.py +1 -1
  84. package/scripts/forge_dataset/capture.py +0 -34
  85. package/scripts/forge_dataset/checks.py +0 -1
  86. package/scripts/forge_dataset/cli.py +5 -1
  87. package/scripts/forge_dataset/export.py +28 -6
  88. package/scripts/forge_dataset/facts.py +1 -2
  89. package/scripts/forge_dataset/forecast.py +1 -1
  90. package/scripts/forge_dataset/harvest.py +107 -7
  91. package/scripts/forge_dataset/importer.py +3 -2
  92. package/scripts/forge_dataset/pairs.py +3 -3
  93. package/scripts/forge_dataset/reviewers.py +4 -3
  94. package/scripts/forge_dataset/routing.py +6 -3
  95. package/scripts/forge_dataset/tiers.py +1 -1
  96. package/scripts/forge_decide/__init__.py +1 -1
  97. package/scripts/forge_decide/profiles.py +11 -14
  98. package/scripts/forge_decompose.py +987 -0
  99. package/scripts/forge_groups/review.py +6 -1
  100. package/scripts/forge_jev/__init__.py +1 -1
  101. package/scripts/forge_jev/cli.py +10 -1
  102. package/scripts/forge_jev/gates.py +10 -1
  103. package/scripts/forge_jev/verify.py +10 -2
  104. package/scripts/forge_legacy.py +86 -0
  105. package/scripts/forge_memory_home.py +57 -0
  106. package/scripts/forge_models.py +151 -0
  107. package/scripts/forge_prefs.py +138 -0
  108. package/scripts/forge_side/__init__.py +10 -0
  109. package/scripts/forge_storage.py +28 -15
  110. package/ui/README.md +22 -10
  111. package/ui/docs/api.md +121 -99
  112. package/ui/forge_ui/control.py +46 -14
  113. package/ui/forge_ui/export.py +0 -10
  114. package/ui/forge_ui/models.py +15 -2
  115. package/ui/forge_ui/projects.py +4 -1
  116. package/ui/forge_ui/reader.py +456 -59
  117. package/ui/forge_ui/server.py +0 -10
  118. package/ui/forge_ui/static/app.js +28 -9
  119. package/ui/forge_ui/static/checksview.js +12 -3
  120. package/ui/forge_ui/static/controls.js +147 -11
  121. package/ui/forge_ui/static/convo.js +5 -2
  122. package/ui/forge_ui/static/diffview.js +4 -5
  123. package/ui/forge_ui/static/panel.js +180 -77
  124. package/ui/forge_ui/static/projectsview.js +16 -2
  125. package/ui/forge_ui/static/runmodel.js +18 -4
  126. package/ui/forge_ui/static/scene3d.js +29 -29
  127. package/ui/forge_ui/static/settings.js +1 -1
  128. package/ui/forge_ui/static/storageview.js +2 -2
  129. package/ui/forge_ui/static/style.css +23 -6
  130. package/ui/forge_ui/static/worktreesview.js +8 -4
  131. package/ui/forge_ui/transcripts.py +6 -0
  132. package/ui/forge_ui/worktrees.py +13 -1
  133. package/docs/fractal.md +0 -181
  134. package/references/fractal-dashboard.md +0 -21
  135. package/references/fractal.md +0 -307
  136. package/scripts/forge-fractal-dispatch.sh +0 -4
  137. package/scripts/forge-fractal-options.sh +0 -54
  138. package/scripts/forge-fractal.py +0 -6
  139. package/scripts/forge-install-fractal.sh +0 -4
  140. package/scripts/forge_fractal/__init__.py +0 -88
  141. package/scripts/forge_fractal/bridge.py +0 -46
  142. package/scripts/forge_fractal/cli.py +0 -224
  143. package/scripts/forge_fractal/dashboard.css +0 -138
  144. package/scripts/forge_fractal/dashboard.html +0 -41
  145. package/scripts/forge_fractal/dashboard.js +0 -687
  146. package/scripts/forge_fractal/decomposition.py +0 -262
  147. package/scripts/forge_fractal/execution.py +0 -659
  148. package/scripts/forge_fractal/inspection.py +0 -261
  149. package/scripts/forge_fractal/install.py +0 -158
  150. package/scripts/forge_fractal/invocation.py +0 -95
  151. package/scripts/forge_fractal/pipeline.py +0 -125
  152. package/scripts/forge_fractal/selection.py +0 -180
  153. package/ui/forge_ui/fractal.py +0 -582
@@ -0,0 +1,337 @@
1
+ # Decomposed runs: integration and verification
2
+
3
+ How a decomposed run's work comes together: chained plans, branches, worktrees, verification.
4
+ Part of the decomposition reference; planning is in [decompose.md](decompose.md).
5
+
6
+ ## Contents
7
+
8
+ - [Chained plans](#chained-plans)
9
+ - [Branches, worktrees, cleanup](#branches-worktrees-cleanup)
10
+ - [Failure modes](#failure-modes)
11
+ - [Execution checks and integration verification](#execution-checks-and-integration-verification)
12
+
13
+ ## Chained plans
14
+
15
+ `plan <dir> --after <prev>` starts `<dir>` from an earlier plan's integration branch. `<prev>`
16
+ is that plan's directory. See the [plan flags](../docs/commands.md#scriptsforge-parallelsh).
17
+
18
+ `plan` writes `<prev>`'s absolute path to `after` and the starting commit to
19
+ `integration.base`, and creates `forge/<run>-integration` at `<prev>`'s
20
+ `accepted.integration`. A branch that already points at that commit is kept. The approval
21
+ table prints `after: <run> (<base>)`, with the first 12 characters of that commit. A later `plan` of the same directory without `--after` keeps the
22
+ files and the branch. A chained plan skips the warning about uncommitted changes in the
23
+ repository: its worktrees start from the previous plan's accepted tip.
24
+
25
+ `<prev>` has to be a plan of the same repository. Every refusal below is exit 2, and it leaves
26
+ the plan directory and the branches as they were:
27
+
28
+ - `<prev>` is not a directory, `--after` was given no directory, or the directory has no
29
+ `tasks.tsv`, `run_id` and `repo`
30
+ - the plan would come after itself
31
+ - the two plans belong to different repositories
32
+ - a task of `<prev>` is not `MERGED`
33
+ - `forge/<prev-run>-integration` is missing, `<prev>` has no `accepted.integration`, or the
34
+ branch tip is not that accepted commit. Extra commits on the branch are adopted into
35
+ `<prev>` first (`forge-parallel.sh adopt <prev> --head --reason "…"`)
36
+ - `<prev>`'s scheduler is live (`scheduler.live` names a pid that is still running)
37
+ - this plan's own `forge/<run>-integration` is at another commit: it is checked out, it is
38
+ not still at the recorded `integration.base`, or this plan already has merged work
39
+
40
+ Before any merge, a different `--after` moves the branch when it is still at its old
41
+ `integration.base` and is not checked out. After a task has merged, a different `--after`
42
+ is the same exit 2, and the recorded base stays.
43
+
44
+ `run` checks again while no task of this plan has merged. If `<prev>` has no
45
+ `accepted.integration`, `run` notes that and goes on. Otherwise that commit must be an
46
+ ancestor of this plan's `integration.base`. If `<prev>` moved, `run` exits 3, dispatches
47
+ nothing, and tells you to run `plan <dir> --after <prev>` again. Planning again with the
48
+ same `--after` records the new tip. A plan split from a chained plan starts later than
49
+ `<prev>` ended; the old tip is still an ancestor, so the check passes. Once a task of this
50
+ plan has merged, `run` does not check again.
51
+
52
+ `integrate` merges this plan's integration branch, which already holds every plan it follows,
53
+ and prints `this brings plans A → B → C` with the run ids, oldest first. A predecessor
54
+ that cannot be read, or a chain longer than 64, makes that line start with `…`. A plan
55
+ with no `after` file prints no such line.
56
+
57
+ `forge runs` puts `after <run>` on the plan's summary line. `<run>` is the predecessor's run
58
+ id, or its key when that directory is gone. forge-ui shows After, a link to the plan this run
59
+ follows, and Followed by, the plans whose `after` names this run.
60
+
61
+ ## Branches, worktrees, cleanup
62
+
63
+ ```
64
+ <plan-dir>/tasks/<id>/approach.md intended approach, if planned
65
+ <plan-dir>/retry_per_model failures on each model before the next rung (1-99); absent leaves escalate_after
66
+ <plan-dir>/tasks/<id>/prompt.dispatched prompt.md as given to the implementer; written last at dispatch
67
+ <plan-dir>/tasks/<id>/approach.dispatched approach.md as given; empty when there was none
68
+ <plan-dir>/tasks/<id>/stale.diff unified diff when prompt.md or approach.md changed during the attempt
69
+ <plan-dir>/tasks/<id>/outside.json paths a plan stop named, with owner, owners and owner_status
70
+ <plan-dir>/tasks/<id>/risk low|medium|high, recorded only (#122), if rated
71
+ <plan-dir>/groups.tsv id, review, qa, members, title, goal; absent unless groups are on
72
+ <plan-dir>/groups.frozen sha256 of the six columns, then each member's deps and files
73
+ <plan-dir>/group_max_tasks, group_max_diff_kb review-group bounds; defaults 6 and 256 when the file is absent
74
+ <plan-dir>/groups/<gid>/ one review=group group's review; see Groups and group review
75
+ <plan-dir>/tasks/<id>/reviewed.commit commit a review=group member stopped at (also a task review's)
76
+ <plan-dir>/tasks/<id>/source.fingerprint worktree fingerprint beside that commit
77
+ <plan-dir>/tasks/<id>/settled.group gid and round, once a group FAIL judged this member
78
+ <plan-dir>/tasks/<id>/retry_sources.tsv attempt, source, epoch: why each retried attempt ran (#133)
79
+ <plan-dir>/run.flags.json flags of this run of the plan, rewritten at each real start; not copied by split or rerun
80
+ <plan-dir>/handoff.notes.jsonl session notes of what is not on disk: at, actor, text; newest first in forge handoff
81
+ <plan-dir>/handoff.driver.json harness, session, since, last_seen of the session driving the run
82
+ <plan-dir>/tasks/<id>/interrupted-<epoch>.diff uncommitted work saved before forge handoff resume resets a stale RUNNING worktree
83
+ <plan-dir>/resume-<epoch>.{log,done} log of the run forge handoff resume started, and its exit code once that run ends
84
+ <repo>/.forge/ project memory (survives the run)
85
+ <repo>/../.forge-worktrees/<run-id>/<task-id> task worktree
86
+ <repo>/../.forge-worktrees/<run-id>/_integration integration worktree
87
+ <repo>/../.forge-worktrees/<run-id>/_group-<gid> group-review candidate; kept for the merge
88
+ forge/<run-id>/<task-id> task branch
89
+ forge/<run-id>-integration integration branch
90
+ ```
91
+
92
+ A split task's subtasks are a run of their own, named after the task
93
+ ([Subtasks](decompose.md#subtasks-a-task-split-at-any-level)):
94
+
95
+ ```
96
+ <repo>/../.forge-worktrees/<run-id>--<task-id>/<subtask-id> subtask worktree
97
+ forge/<run-id>--<task-id>/<subtask-id> subtask branch
98
+ forge/<run-id>--<task-id>-integration the subtasks' integration branch, merged into forge/<run-id>/<task-id>
99
+ refs/forge/kept/<run-id>/<task-id> the task's earlier work, after --decide split=fresh
100
+ ```
101
+
102
+ A deeper level repeats the pattern (`<run-id>--<task-id>--<subtask-id>`). `forge runs rm
103
+ --worktrees --branches` on the root run removes all of them; a sub-plan is not deleted by itself.
104
+
105
+ ### Worktree setup
106
+
107
+ A fresh worktree is a bare checkout — no `node_modules`, no venv, no build output. Without help,
108
+ every dwarf in the run rediscovers that the same way (run the tests, watch them fail, work out the
109
+ install) and pays it again, which is both slow and a source of near-identical "this worktree has no
110
+ dependencies" entries in project memory.
111
+
112
+ Tell forge what a worktree needs and it runs it verbatim, once per worktree, from the worktree
113
+ root, at creation time only:
114
+
115
+ - `.forge/setup` in the repo — executable, or any file whose contents are a shell command;
116
+ - `--setup <command>` on `run` or `retry`, which overrides it.
117
+
118
+ A resumed run or a `retry` reuses the existing worktree and does not pay it again. The integration
119
+ worktree gets the same treatment, since that is where a merged result is validated — without it the
120
+ one checkout holding every task's merged work is the one checkout that cannot build it.
121
+
122
+ When tasks add dependencies or change code-generation schemas after the integration worktree was
123
+ created, setup files generated earlier (for example `node_modules` or generated sources) predate
124
+ those merges:
125
+
126
+ - pass `--setup-before-verify` (on `plan`, `run`, `retry`, `verify`, or `integrate`) to re-run
127
+ worktree setup on the integration checkout right before verification whenever commits merged
128
+ after setup; `--no-setup-before-verify` turns it off again;
129
+ - add `.forge/setup-inputs` in the repo (one path, directory prefix, or glob pattern per line, `#`
130
+ for comments) to name the files that drive setup; with it, `--setup-before-verify` only
131
+ re-runs when one of those paths changed since setup instead of on every run;
132
+ - even without `--setup-before-verify`, when verification fails after a lockfile or a path listed
133
+ in `.forge/setup-inputs` merged since setup ran, forge records `verification.stale_setup` and
134
+ prints a warning; as a workaround without the flag, put the dependency/generation step at the
135
+ start of the verify command so every verification builds from current sources.
136
+
137
+ Failure is reported and non-fatal: the dwarf gets a worktree it can still install into itself,
138
+ which is the status quo this replaces. Output lands in `tasks/<id>/setup.out`.
139
+
140
+ **Submodules.** `git worktree add` leaves every submodule directory empty. Before the setup step,
141
+ forge fills them offline from the source checkout (no fetch, no `git submodule`), so `.forge/setup`
142
+ sees a complete tree. Each submodule gets one state in `tasks/<id>/submodules.txt`:
143
+
144
+ - `exported` — the recorded commit was extracted from the source's submodule repository;
145
+ - `copied` — that commit was not available, so the source checkout's files were copied;
146
+ - `kept` — the directory already held files (a resume), left as they are;
147
+ - `missing` — nothing was available; the directory stays empty and the runner prints a note.
148
+
149
+ The files carry no `.git`, so git ignores them: they never appear in `changes.diff`, a commit, a
150
+ review snapshot or a fingerprint, and the worktree still moves and is removed normally. The capsule
151
+ tells the dwarf which submodules are present. Integration worktrees (`run`, `integrate`, `combine`,
152
+ `split`) get the same treatment. Out of scope: a task that moves a gitlink's recorded commit (its
153
+ worktree keeps the old content) and nested submodules (left empty).
154
+
155
+ **Reviewers get the same dependencies.** A review snapshot holds committed files only, so forge
156
+ links the directories package managers install into (`node_modules`, `bower_components`, `.venv`,
157
+ `venv`, `vendor`, `.bundle`, `Pods`, Mix's `deps` and `_build`, `.dart_tool`, `elm-stuff` and
158
+ SwiftPM's `.build`) and any non-secret ignored paths created during `.forge/setup` or `--setup`
159
+ (the difference in `git status --ignored` before and after setup, recorded automatically for the
160
+ worktree, plus any non-secret paths listed one per line in `.forge/review-links`) from the checkout
161
+ under review (the task's worktree, a group candidate worktree, or the integration worktree for a
162
+ final review or `adopt`) into the snapshot, at the root and in workspace packages down to five
163
+ levels, unless the snapshot already holds that path or lacks its parent. These are the paths this
164
+ step filled, so they match the attempt; ignored files already present before setup, including
165
+ secrets such as `.env` or credential files, are never linked. The links count for no fingerprint
166
+ and stay out of the reviewer's `git status`. The prompt names what was linked, what is committed,
167
+ and any setup-generated paths forge could not provide (or says there is none), says when forge ran
168
+ no tests of its own, and tells the reviewer to report rather than search or install. A directory
169
+ that is only partly committed (`vendor/.gitkeep`) keeps its committed files and gets no link. Nothing
170
+ guards a write through a link: forge commits whatever git does not ignore, so a linked path is an
171
+ ignored one (anything the attempt committed is already in the snapshot and gets no link), and a
172
+ write there changes nothing that merges. A link dangles once its worktree is removed, which harms
173
+ nothing. Each reviewer ends with `FORGE_TESTS: RAN`, `RAN — FAILED: <names>`,
174
+ `PARTIAL — <what stopped or was skipped>`, `NOT NEEDED — why` or `COULD NOT RUN — why`;
175
+ checks in a brief's acceptance criteria take priority over the 5-minute guideline (set
176
+ `--qa-test-minutes N` or `0` to adjust), `FAILED` keeps the gate from accepting a FAIL, `PARTIAL`
177
+ and `COULD NOT RUN` print a note, and forge-ui and the dataset show it.
178
+
179
+ Forge does not guess this step, and the obvious guess is worth naming because it looks right and
180
+ is not: symlinking the source repo's `node_modules` into the worktree. In a workspace monorepo the
181
+ workspace links inside it point back at the source checkout, so the worktree builds against the
182
+ source repo's packages rather than its own — producing type errors naming files the task never
183
+ touched. Copying is correct but can be gigabytes per task. The repo knows which of those it wants;
184
+ forge does not.
185
+
186
+ The worktree root is a sibling of the repo and **never** `TMPDIR`. Isolated worktrees are
187
+ never pushed, so a temp root that gets cleaned takes the only copy of that work with it —
188
+ this has already destroyed real work in this user's `linear-spanks` runs.
189
+
190
+ Cleanup rules:
191
+
192
+ - A successful task's worktree is removed only after `results.tsv` is written and read back.
193
+ - A failed, conflicted or unknown task keeps **both** its branch and its worktree, so there
194
+ is something to inspect and retry from.
195
+ - The integration branch is left in place. Merging it into the user's branch is a separate
196
+ `integrate --approved` step and never happens automatically.
197
+
198
+ The user's own branch and working tree are untouched for the whole run.
199
+
200
+ ## Failure modes
201
+
202
+ | Symptom | Cause |
203
+ |---------|-------|
204
+ | task status `ERROR` | worktree creation or a dispatch failed; see `tasks/<id>/dwarf.out` / `qa.out` |
205
+ | 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 |
206
+ | task status `FAIL` with "produced no changes" | the dwarf ended without editing anything — usually an ambiguous prompt it could not resolve headlessly |
207
+ | task status `UNKNOWN` | QA never emitted a verdict line; read `tasks/<id>/qa.last`. `retry` re-runs QA only, on the unchanged work |
208
+ | 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](decompose-recovery.md#infrastructure-failures) |
209
+ | 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 |
210
+ | 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](decompose-recovery.md#retrying-and-resuming-an-interrupted-run) |
211
+ | 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](decompose-opt-in.md#groups-and-group-review-opt-in) |
212
+ | 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 |
213
+ | 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 |
214
+ | 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 |
215
+ | 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 |
216
+ | 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 |
217
+ | 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 |
218
+ | 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` |
219
+ | 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 |
220
+ | task status `CONFLICT` | QA passed but the merge onto the integration branch conflicted — `files` was understated somewhere |
221
+ | every wave has one task | `files` sets overlap across most tasks; the decomposition is not actually parallel |
222
+ | dwarves ignore existing work | `goal.txt` or `files` missing, so the capsule carries no useful status |
223
+ | `.forge/` appears in a task's diff | the capture is missing `':(exclude).forge'` — see `memory.md` |
224
+ | dwarves build incompatible interfaces | no `approach.md`; the seam was never agreed. Plan it, or use `--planner` |
225
+ | "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 |
226
+ | `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 |
227
+ | 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 |
228
+
229
+ A run where several tasks report "produced no changes" usually means the decomposition
230
+ produced tasks that were not independently actionable — the fix is a coarser
231
+ `--decompose-level`, not more retries.
232
+
233
+ ## Execution checks and integration verification
234
+
235
+ Before dispatch, `run` preflights every task's dwarf and QA plus a configured planner.
236
+ `retry` repeats preflight and dependency checks. A dependency must be MERGED, not merely
237
+ planned or QA-passing; otherwise its consumer is BLOCKED without spending a dispatch.
238
+ Directory/child ownership paths overlap and cannot run concurrently. A blocked task can be
239
+ retried after its prerequisites merge. A fresh task then branches from current integration.
240
+
241
+ QA receives complete implementation input, approach, capsule and cumulative binary diff.
242
+ It runs in a disposable repository. Both source and review fingerprints must remain unchanged,
243
+ and the task branch must still point at the reviewed commit when merged; the review copy is a
244
+ commit, so only its tracked content counts (a test run's untracked `__pycache__/` there changes
245
+ 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.
246
+
247
+ Configure combined executable checks with `run <plan> --verify '<command>'` (also accepted by
248
+ `retry`), or a shell command file at `<repo>/.forge/verify`. Commands execute under Bash from
249
+ the integration checkout. Forge records `verification.command`, `.log`, `.exit`, `.fingerprint`
250
+ and `.status` in the plan directory. Failed checks or source changes fail the run. With no
251
+ command, the result is explicitly UNVERIFIED. A `retry` that leaves tasks still to run
252
+ (PENDING or BLOCKED) skips its verification and says so: the `run` that dispatches them verifies
253
+ the integration branch at its end, and `integrate` verifies its candidate.
254
+
255
+ A failed command whose source fingerprint is unchanged is rerun (`--verify-retries N`, default
256
+ `1`, `0` = strict single run). When the repository has `.forge/verify-subset` (a test command
257
+ with `{files}` or `{changed}`) and the log names failing tracked test files (unittest
258
+ `FAIL:`/`ERROR:` lines, pytest `FAILED path::`, node's test runner `test at file:L:C` or TAP
259
+ `location:`), those files run alone first (`verification.failing.log`, run kind `failing`): if
260
+ they fail again the regression is confirmed and the whole command is not rerun. If they pass,
261
+ or nothing can be named, the whole command reruns as before, so a pass always comes from the
262
+ whole command. A rerun that passes leaves status `PASS` but writes
263
+ `verification.flaky` (both exit codes), keeps the first run in `verification.log` and the second
264
+ in `verification.retry.log`, and prints a loud `FLAKY` line in `run`/`retry`/`integrate` output;
265
+ a command that changes the tree is never retried.
266
+
267
+ **Verification lanes.** Instead of one command, verification can be several named **lanes**
268
+ that run side by side, each rerun on its own. A lane is a file whose name is the lane's name
269
+ (letters, digits, `_` and `-`, at most 64) and whose text is a Bash command, run from the
270
+ integration checkout like the single command; leading `#forge:` lines give it options. Declare
271
+ them in the repository as `.forge/verify.d/<name>` files, or for one plan with
272
+ `run --verify-lane 'name[opt,opt]=command'` (also `retry`; repeatable, written to
273
+ `<plan>/verify.d/`; the first one of an invocation replaces the plan's earlier lanes and its
274
+ `--verify`, as `--verify` replaces the plan's lanes). The first source that exists wins: the
275
+ plan's lanes, the plan's `--verify`, the repository's `.forge/verify.d/`, then
276
+ `.forge/verify` (ignored, with a note, when the repository also has lanes). The repository's lanes
277
+ and `.forge/verify` are read as committed on the branch being verified, not from the root checkout,
278
+ and forge says before a run which lanes differ from the root's (#151); `forge-parallel.sh verify <plan>`
279
+ runs that verification again on its own, with no model. `run` checks the
280
+ lanes before any model is paid for and exits 2 on an invalid one (an unknown or repeated
281
+ option, an empty command, a path outside the checkout, a missing baseline).
282
+
283
+ | Option | Means |
284
+ |---|---|
285
+ | `group=<name>` | lanes of one group never run at the same time (a shared database, a port) |
286
+ | `first` | runs before every other lane; if a `first` lane fails (after its reruns) or changes the tree, the rest are `skipped` |
287
+ | `retries=<0-9>` | reruns of this lane when it fails; otherwise `--verify-retries` (default `1`) |
288
+ | `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 |
289
+ | `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 |
290
+
291
+ Up to `--verify-parallel N` lanes run at once (`run`, `retry` and `integrate`, kept as
292
+ `verify_parallel`, 1 to 32, default 3), started in name order. A lane that fails is rerun alone,
293
+ after the round, up to its budget; a pass on a rerun makes it `flaky`, which passes but is named
294
+ in the run output (`FLAKY: lane <name> failed once and passed on rerun`), in
295
+ `verification.flaky` and in the whole-run review. Nothing reruns once the tree changed: the
296
+ checkout's fingerprint is compared after every round, and a change fails the verification
297
+ (`mutated`; with lanes in parallel it cannot be pinned to one of them). A lane's states are
298
+ `waiting`, `running`, `pass`, `fail`, `flaky`, `known`, `skipped` and `interrupted`. Lanes mode
299
+ replaces the whole-command rerun above; the single-command mode is unchanged.
300
+
301
+ A lane may print `::forge step name=<step> state=start` and `::forge step name=<step>
302
+ state=end [exit=<n>]`, each on a line of its own, to say which step it is in; forge-ui shows the
303
+ open step live. A signal stops the running lanes' process groups (TERM, then KILL after 5 s),
304
+ marks them and the verification `INTERRUPTED`, and exits 130 like a single command.
305
+
306
+ The runner is `scripts/forge-verify.py` (`lanes` lists and checks a directory's lanes; `run`
307
+ runs them). In lanes mode `verification.command` holds one `<lane>: <first line>` per lane,
308
+ `verification.log` the runner's summary plus the last 200 lines of each lane that failed, and
309
+ `verification.lanes.json` the live state of every lane; each lane writes
310
+ `verification.lane.<name>.log` and keeps each finished run as `verification.lane.<name>.run-<k>.log`.
311
+
312
+ ```
313
+ .forge/verify.d/lint #forge: first
314
+ npm run lint && npm run typecheck
315
+ .forge/verify.d/unit #forge: reports=reports/unit
316
+ npm test -- --reporter=junit --outputFile=reports/unit/junit.xml
317
+ .forge/verify.d/db #forge: group=postgres retries=2 reports=reports/db baseline=.forge/known-db-failures.txt
318
+ docker compose up -d postgres && npm run test:db
319
+ ```
320
+
321
+ Here `lint` runs alone first; `unit` and `db` then run together, another lane in the
322
+ `postgres` group would wait for `db`, and a `db` run whose only failures are listed in the
323
+ baseline ends `known`.
324
+
325
+ `scripts/forge-verify-coverage.py` reads the project's own test configuration and **warns**
326
+ (never fails) about suites the command does not run — at `run` start before any model is paid
327
+ for, again in `verify_result`, and at `integrate` — recording the lines in
328
+ `verification.coverage.txt`. Without a verify command it lists what the project defines.
329
+
330
+ `integrate <plan> --approved` prepares a separate candidate combining the current user branch
331
+ and integration revision, runs worktree setup and the configured check there, then updates the
332
+ user branch only if the candidate passed and the source branch stayed unchanged. Logs live in
333
+ `<plan>/integrate-*/`. A failed candidate remains available for inspection. With no verification
334
+ command, integration retains the existing approval boundary and reports UNVERIFIED.
335
+
336
+ Optional [Ripwire context](ripwire.md) is enabled by default. Use `--no-ripwire`
337
+ or `FORGE_RIPWIRE=off` to disable preparation and installation offers.