@giamme/forge 0.12.0 → 0.12.1

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 CHANGED
@@ -5,6 +5,28 @@ All notable changes to this project are documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and versions follow the format `{major}.{minor}[.{patch}]` ([...] parts appear only when non-zero).
7
7
 
8
+ ## [0.12.1] - 2026-10-28
9
+
10
+ A run can now fix the review findings it tolerated before it ends (`run --sweep Pn`), and forge-ui shows where each task stands, the checks each attempt ran and the environment problems several tasks hit. A task that deletes large files no longer breaks its review.
11
+
12
+ ### Highlights
13
+
14
+ - forge-ui shows where each task of a decomposed run is: the task table's Now column and a task's Now section name the command a running dwarf or reviewer is running and for how long, flag it once its log has been quiet for five minutes, and say why a task that is not running waits (its dependencies, a task it shares files with, no free slot, a drain or stop, an infrastructure pause with its countdown, or the retry policy's stop with the split it suggests). The run's inspector says what the scheduler is doing.
15
+ - `run --sweep Pn` fixes the review findings a run tolerated while its context is fresh. Once every task has merged, and before the combined verification, the open findings at Pn or worse become a few extra fix tasks, one per file (at most 8 findings each, `--sweep-max N` tasks, default 5; `--sweep-plausible` adds PLAUSIBLE ones). Each fix task runs on the plan's low tier, with a narrow review that says, finding by finding, whether it was fixed. The sweep plan, with every finding it left out and why, is printed and kept in `sweep/plan.md`. `forge issues` no longer offers a finding the sweep fixed, and a fix task that fails does not fail the run.
16
+
17
+ ### Added
18
+
19
+ - Each attempt in forge-ui lists the tests, type checks, lints and builds its dwarf and reviewer ran, read from their logs, with each one's exit code, time and pass/fail counts and a link to that command in the conversation, and says which commands of the brief's acceptance criteria were never run. forge now keeps a clock beside each agent's log (<role>.clock; FORGE_LOG_CLOCK=off turns it off) so codex and grok commands are timed too.
20
+ - A banner in a run's header names an environment problem that more than one task ran into (Docker down or out of address pools, a missing container, a port in use, the sandbox's EPERM, a refused local service, no network, a full disk, a missing command), with the tasks it hit and the commands that failed on it.
21
+ - forge-ui shows a run's finding sweep: a fix task lists the findings it took with what its review said of each, the task a finding came from shows where it stands, the run's Finish says what the sweep fixed and left, and Open findings marks findings the sweep fixed as swept instead of offering to file them.
22
+ - `run --sweep-ahead` tells a task the open review findings in files it owns, to fix only when its change already goes through that code; its reviewer is told the same, and no dispatch is added.
23
+
24
+ ### Fixed
25
+
26
+ - A codex command run through zsh -lc "…" now shows without its shell wrapper in a conversation, and a message containing a Unicode line separator no longer breaks the reading of its log.
27
+ - `FORGE_FORECAST_BUDGET_S=inf` (or any budget too large to wait for, such as `1e10`) now means no time limit for the plan forecast that `run` prints, instead of silently dropping the forecast.
28
+ - A task that deletes large files no longer breaks its review: deleted files now appear in the reviewer's diff by name only, without their contents. Previously, deleting a big data directory could make the prompt too long for the reviewer's CLI, which refused it and left the task in ERROR.
29
+
8
30
  ## [0.12] - 2026-10-27
9
31
 
10
32
  Decomposed runs can now be steered while they run and stop cleanly when interrupted: drain, stop, retry or resize a live run from forge control or forge-ui, an infrastructure stop pauses only the model or CLI it hit, and verification can run as parallel lanes that rerun only what failed and name the failing tests.
package/SKILL.md CHANGED
@@ -45,7 +45,9 @@ For explanation requests, explain the workflow without spending model quota.
45
45
  when requested; preserve failed task branches and worktrees. `run --retry-failed N`,
46
46
  `--infra-retries M`, `--qa-threshold Pn`, `plan --shadow-qa` (a second review of a
47
47
  sampled share of attempts, never read, to measure reviewer agreement) and
48
- `plan --reviewer-session` (continue the reviewer's session across rounds) are opt-in: offer
48
+ `plan --reviewer-session` (continue the reviewer's session across rounds) and `run --sweep Pn`
49
+ (once every task merged, fix the tolerated findings at Pn or worse in a few extra tasks, one per
50
+ file; `--sweep-ahead` instead hands a task the open findings in its files) are opt-in: offer
49
51
  them, never add them unprompted. So is `--fail-first` (solo or `plan`): the change's new
50
52
  tests also run without its non-test changes, and the reviewer is asked to report any that
51
53
  still pass as P2; it needs `.forge/verify-subset` and never changes a result by itself. `plan` explores by default (`--explore 0.2`: now and then
package/VERSION CHANGED
@@ -1 +1 @@
1
- 0.12
1
+ 0.12.1
package/docs/artifacts.md CHANGED
@@ -14,6 +14,7 @@ as if the dwarf had written it.
14
14
  <role>.prompt the exact prompt sent
15
15
  <role>.cmd the exact command line executed
16
16
  <role>.log full transcript
17
+ <role>.clock when the log grew: one `<epoch> <bytes>` line per second it grew (forge-ui times codex and grok events by it; FORGE_LOG_CLOCK=off)
17
18
  <role>.last the final message — read this first
18
19
  <role>.infra only after an infrastructure failure: class, retry_after, detail, harness, model
19
20
  <role>.orphans only when processes were left running after the harness exited
@@ -48,6 +49,11 @@ A decomposed run adds:
48
49
  tasks/<id>/{capsule.md,prompt.md,dwarf.*,qa.*,changes.diff,status}
49
50
  tasks/<id>/attempt, attempts.tsv attempts spent; one audit row per entry (incl. refunded stops)
50
51
  tasks/<id>/known_issues.md, qa.gate findings tolerated by --qa-threshold, and the gate's decision
52
+ sweep/plan.json, plan.md run --sweep: the fix tasks, their findings, and every finding left out with its reason
53
+ tasks/<id>/sweep.json a fix task's findings (S1, S2, ...), each with its source task and key
54
+ tasks/<id>/sweep.outcome.json what the fix task's review said of each, written when it merged; forge issues reads it
55
+ tasks/<id>/sweep.ahead.json run --sweep-ahead: the open findings this task was handed
56
+ sweep_ahead run --sweep-ahead is on for this plan
51
57
  tasks/<id>/guard.txt what forge observed about the implementer (self-commit, orphans, promises)
52
58
  tasks/<id>/infra.txt, resume, noretry infrastructure stop record (<role>.infra plus stage=); QA-only resume marker; no-progress marker
53
59
  tasks/<id>/<role>.harness only while a guarded dispatch runs: its harness's pid and start time, for forge-guard.py stop
package/docs/commands.md CHANGED
@@ -64,7 +64,7 @@ the size of a `--only` selection).
64
64
 
65
65
  | Flag | Does |
66
66
  |---|---|
67
- | `--json` | machine-readable output; `findings` lists each one with its fingerprint, severity, origin (`tolerated`, `accepted`, `review` or `plausible`), task, `review`, `filed` state and `dismissed` mark. A whole-run finding's `review` is `{name, outdated, merged_since}` (`outdated` is null when the review has no verdict or the plan has no accepted integration commit; `merged_since` is empty unless the review is outdated). Every other finding has `review` null |
67
+ | `--json` | machine-readable output; `findings` lists each one with its fingerprint, severity, origin (`tolerated`, `accepted`, `review` or `plausible`), task, `review`, `swept` (`{task, finding}` when the run's finding sweep fixed it; such a finding is never drafted), `filed` state and `dismissed` mark. A whole-run finding's `review` is `{name, outdated, merged_since}` (`outdated` is null when the review has no verdict or the plan has no accepted integration commit; `merged_since` is empty unless the review is outdated). Every other finding has `review` null |
68
68
  | `--offline` | never run `gh`: no filed state, commit publication judged from local refs |
69
69
  | `--only FP` | keep only these 12-hex fingerprints (repeatable or comma-separated) |
70
70
  | `--all-runs` | read `RUN` as a repository (or a plan dir naming one) and collect every run in its registry; the newest plan wins for a finding in several |
@@ -241,6 +241,10 @@ is started in its own session, and after it exits any process still alive in tha
241
241
  listed in `<role>.orphans` and stopped, so a backgrounded measurement cannot outlive the
242
242
  dispatch. The timeout watchdog and the exit trap signal the whole session too.
243
243
 
244
+ **Log clock.** Beside the log, `<role>.clock` records when it grew (one `<epoch> <bytes>` line for
245
+ each second it did), so forge-ui can time the commands of a harness that logs no times (codex,
246
+ grok). It never changes a dispatch's outcome; `FORGE_LOG_CLOCK=off` turns it off.
247
+
244
248
  ```bash
245
249
  # what would this actually run?
246
250
  bash scripts/forge-dispatch.sh dwarf sol:ultra --prompt-file /tmp/p --dry-run
@@ -339,6 +343,8 @@ forge-parallel.sh run <plan-dir> [--max-parallel N] [--yolo-dwarf] [--yolo
339
343
  [--infra-fallback | --no-infra-fallback]
340
344
  [--qa-threshold P0|P1|P2|P3|none] [--verify-retries N]
341
345
  [--escalate-after N] [--escalate-effort | --no-escalate-effort]
346
+ [--sweep P0|P1|P2|P3 [--sweep-plausible] [--sweep-max N]]
347
+ [--sweep-ahead | --no-sweep-ahead]
342
348
  [--fractal | --no-fractal] [--fractal-<limit> <n>]
343
349
  forge-parallel.sh retry <plan-dir> <task-id> [--dwarf <spec>] [--timeout S]
344
350
  [--qa-threshold Pn|none] [--verify-retries N]
@@ -374,6 +380,10 @@ forge-parallel.sh combine <new-plan-dir> <plan-dir> <plan-dir>... [--verify <c
374
380
  | `--verify-lane 'name[opts]=cmd'` | run, retry | `verify.d/<name>` | one verification lane; repeatable. Options as in a lane file, comma-separated (`group=g`, `first`, `retries=n`, `reports=dir`, `baseline=file`). The first one of an invocation replaces the plan's earlier lanes and `--verify`; see [verification lanes](../references/decompose.md#execution-checks-and-integration-verification) |
375
381
  | `--verify-parallel N` | run, retry, integrate | `verify_parallel` | lanes run at once, 1 to 32 (default `3`) |
376
382
  | `--escalate-after N` | run, retry | `escalate_after` | failed attempts on one model before the next goes a tier up (default `3`, `0` = off) |
383
+ | `--sweep Pn` | run | no — this run only | once every task has merged, fix the open findings at `Pn` or worse in a few extra tasks, one per file, each with a narrow review; the plan goes to `sweep/plan.md`. Once per plan; what it does not fix stays for `forge issues`. See [the finding sweep](reviews.md#fixing-them-in-the-run-the-finding-sweep-opt-in) |
384
+ | `--sweep-plausible` | run | no — this run only | the sweep also takes PLAUSIBLE findings of passed tasks |
385
+ | `--sweep-max N` | run | no — this run only | at most `N` fix tasks (default `5`) |
386
+ | `--sweep-ahead` | run | `sweep_ahead` | a task is also told the open findings in files it owns, to fix on its way (off by default; `--no-sweep-ahead` turns it off) |
377
387
  | `--escalate-effort` | run, retry | `escalate_effort` | at the top tier, retry the same model once more at its next accepted effort before stopping (off by default; `--no-escalate-effort` turns it off) |
378
388
 
379
389
  **Exit codes:** `0` ok · `2` usage or validation · `3` precondition (not a git repo, …) ·
package/docs/forge-ui.md CHANGED
@@ -69,6 +69,31 @@ view the verification has rows of its own after the tasks, one per lane with a b
69
69
  reruns marked (a single command's runs sit back to back, dashed, because only their durations
70
70
  are known), and its finish node counts the lanes and reruns.
71
71
 
72
+ The task table's *Now* column, and *Now* at the top of a task's inspector, say where each task
73
+ is. A running task names the dwarf or reviewer at work, the command it is running (and whether
74
+ it is a test, type check, lint or build) and for how long, and flags *quiet N min* once its log
75
+ has said nothing for five minutes. A task that is not running says why: the tasks it waits on, a
76
+ running task it shares files with, no free slot, a drain or stop, an infrastructure pause with
77
+ its countdown, or the retry policy's stop with the split it suggests. The run's inspector says
78
+ what the scheduler is doing and how many tasks wait on what.
79
+
80
+ Under each attempt's dwarf and reviewer are the checks they ran, read from their logs: each
81
+ test, type check, lint or build with its exit, its time and the counts it printed, a failed
82
+ one's last lines, and a link to that command in the conversation. Each attempt then says which
83
+ of the commands its brief's `## Acceptance criteria` names ran, ran another way, or never ran.
84
+ When a failed command met an environment problem (Docker down or out of address pools, a port in
85
+ use, the sandbox's EPERM, a refused local service, no network, a full disk, a missing command)
86
+ the attempt says so, and when more than one task met the same one, a banner in the run's header
87
+ lists them. codex and grok log no times, so forge keeps a small clock beside each agent's log
88
+ (`<role>.clock`, off with `FORGE_LOG_CLOCK=off`); runs from before it show their checks without
89
+ times.
90
+
91
+ A run with a [finding sweep](reviews.md#fixing-them-in-the-run-the-finding-sweep-opt-in) shows its fix
92
+ tasks like any other. A fix task's inspector lists the findings it took, each with a lamp for what
93
+ its review said (fixed, not fixed, not reported), and links each to the task it came from. That task
94
+ shows which of its findings the sweep took and where they stand. The run's *Finish* says how many
95
+ the sweep fixed and lists what it left for `forge issues`, with each reason.
96
+
72
97
  ### Controls
73
98
 
74
99
  forge-ui reads everything, and it changes things only by calling forge's own commands: it
@@ -93,8 +118,9 @@ indistinguishable from the same command typed in a terminal, except that `contro
93
118
  says why.
94
119
  - **Open findings:** the review findings a run left open (tolerated by `--qa-threshold`,
95
120
  PLAUSIBLE, or left by the whole-run review), for this run or every run of its repository.
96
- Findings of an outdated review carry an "outdated review" marker, and findings a person
97
- accepted have origin `accepted`. Select some and file them as GitHub issues, or dismiss the
121
+ Findings of an outdated review carry an "outdated review" marker, findings a person
122
+ accepted have origin `accepted`, and findings the run's finding sweep fixed are *swept*: listed,
123
+ never filed. Select some and file them as GitHub issues, or dismiss the
98
124
  ones that need no work (and take that back). It runs `forge issues`, so a finding is never
99
125
  filed twice.
100
126
  - **Delete a run:** a dialog that first shows a dry run, then deletes the run directory
package/docs/reviews.md CHANGED
@@ -172,6 +172,39 @@ that merged after it. In `--json` each whole-run finding carries `review`: `name
172
172
  plan has no accepted integration commit, and `merged_since` is empty unless the review
173
173
  is outdated. Every other finding has `review` null.
174
174
 
175
+ ## Fixing them in the run: the finding sweep (opt-in)
176
+
177
+ `run --sweep P3` fixes the tolerated findings while the run's context is fresh, instead of leaving
178
+ them for issues. Once every task has merged, and before the combined verification, forge plans one
179
+ sweep:
180
+
181
+ - **Which findings.** The CONFIRMED findings `--qa-threshold` tolerated at `P3` or worse, and
182
+ PLAUSIBLE ones too with `--sweep-plausible`. Left out:
183
+ - findings a person accepted;
184
+ - dismissed ones (`forge issues --dismiss`), and ones with no file or whose file is gone;
185
+ - ones whose code a later task changed after the review.
186
+ - **How many tasks.** One fix task per file, worst first, at most 8 findings each and
187
+ `--sweep-max N` tasks (default 5). They run in parallel up to `--max-parallel`.
188
+ - **Which models.** Each fix task's implementer is your low tier (`--dwarf-low`, else `--dwarf`),
189
+ or the implementer of the task the finding came from. Its reviewer is that task's reviewer.
190
+ - **The plan.** It lists the groups, the findings, the dispatches and everything left out with
191
+ its reason. It is printed and kept in `<plan>/sweep/plan.md`.
192
+
193
+ A fix task's review is narrow. The reviewer says, for each finding, whether the change fixed it
194
+ (`S1: FIXED`, `S2: NOT FIXED — why`), and reports only regressions the change introduced. It passes
195
+ when at least one finding is fixed and nothing blocking broke. A finding the sweep fixed is no
196
+ longer offered as an issue. One it did not fix still is, and so is anything a sweep review found:
197
+ there is only one round. A fix task that fails does not fail the run.
198
+
199
+ The sweep uses the same `--retry-failed` budget and controls as the rest of the run, and a plan is
200
+ swept once. A run without `--sweep` behaves as before. The cost is at least two dispatches per file,
201
+ plus retries, spent on findings the threshold had said could wait, and changes land right before
202
+ the final review. That is why it is off by default.
203
+
204
+ `run --sweep-ahead` is the cheaper first step and needs no extra dispatch. A task dispatched after
205
+ others merged is told the open findings in the files it owns, at most three, to fix only when its
206
+ change already goes through that code. Its reviewer is told the same.
207
+
175
208
  ## Accepting a task despite its reviewer
176
209
 
177
210
  ```bash
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@giamme/forge",
3
- "version": "0.12.0",
3
+ "version": "0.12.1",
4
4
  "description": "Multi-model coding with a reviewer that reads the code: plan, build in parallel worktrees, review every real diff, merge only what passes.",
5
5
  "keywords": ["claude-code", "codex", "opencode", "agent-skill", "code-review", "multi-model"],
6
6
  "license": "MIT",
@@ -353,7 +353,7 @@ run.
353
353
  `forge-parallel.sh run` prints the same block before it dispatches, shortened: the tasks without
354
354
  enough history share one line instead of a row each, and when no task has enough, the whole block
355
355
  is one line pointing at `forge dataset forecast <plan>`. It runs with a time budget
356
- (`FORGE_FORECAST_BUDGET_S`, default 3 seconds), prints one line and moves on if reading the
356
+ (`FORGE_FORECAST_BUDGET_S`, default 3 seconds; `inf` means no limit), prints one line and moves on if reading the
357
357
  history takes longer, never prints errors and never changes the exit code. `--no-forecast` or
358
358
  `FORGE_FORECAST=off` turn it off. The block is written to the plan as `forecast.json` and
359
359
  recorded once as a `forecast` event, so it can later be compared to what the run did.
@@ -404,6 +404,38 @@ any blocking finding, or a `FAIL` with no CONFIRMED finding stays a failure. The
404
404
  then the literal `PASS`; `known_issues.md`, `qa.gate` and the summary say what was tolerated.
405
405
  Without a threshold none of this applies.
406
406
 
407
+ ### The finding sweep (opt-in)
408
+
409
+ Tolerated findings are recorded, not fixed. `run --sweep Pn` fixes them inside the run instead: once
410
+ every task has merged, and before the combined verification, the scheduler runs `forge-sweep.py plan`
411
+ once. It collects the open findings at `Pn` or worse (the ones `--qa-threshold` tolerated, plus
412
+ PLAUSIBLE ones with `--sweep-plausible`), with `forge issues`' own collector, and leaves out:
413
+
414
+ - findings a person accepted with `accept`, and findings of fix tasks (one round: what a sweep review
415
+ finds goes to `forge issues`, never into another sweep);
416
+ - dismissed ones (`forge issues --dismiss`), ones with no file, and ones whose file is gone;
417
+ - ones whose line, as the reviewer saw it, a later merge changed (`changed`, naming those merges).
418
+
419
+ Every finding left out is listed in the plan with its reason. The rest become fix tasks, one per file,
420
+ worst first, at most 8 findings each and `--sweep-max N` (default 5) tasks. Each fix task is a row
421
+ `sweep-<n>` in `tasks.tsv` with `prompt.md` and `sweep.json`. Its implementer is the plan's low tier
422
+ (the first spec of `--dwarf-low`, else of `--dwarf`; checked at `run` start), else the implementer of
423
+ the task the worst finding came from. Its reviewer is that task's reviewer. The plan (groups, findings,
424
+ dispatches) is printed and kept in `<plan>/sweep/plan.md` and `plan.json`. A plan is swept at most once.
425
+
426
+ Fix tasks share the run's scheduling, controls and `--retry-failed` budget. Their review is narrow
427
+ (`forge-contract.py qa --kind sweep`): one `S<n>: FIXED` or `S<n>: NOT FIXED` line per finding, plus
428
+ regressions as findings. It passes when at least one finding is fixed and there is no blocking
429
+ regression. When a fix task merges, its review's lines go to `tasks/<id>/sweep.outcome.json`, and
430
+ `forge issues` leaves out what it fixed (`swept` in `--json`). A fix task that fails leaves its
431
+ findings for `forge issues` and does not fail the run. The run's summary says what the sweep fixed,
432
+ and the whole-run review that follows reads the sweep's changes like any other task's.
433
+
434
+ `run --sweep-ahead` (kept in `<plan>/sweep_ahead`; `--no-sweep-ahead` turns it off) is the cheaper
435
+ first step. A task dispatched after others merged is told the open findings in files it owns (at
436
+ most 3, picked once in `tasks/<id>/sweep.ahead.json`), to fix only on its way, and its reviewer is
437
+ told the same. It adds no dispatch. A later sweep counts the ones whose line changed as `changed`.
438
+
407
439
  ## Retrying, and resuming an interrupted run
408
440
 
409
441
  A failed task keeps its branch and its worktree. `retry` is what acts on them:
package/references/ui.md CHANGED
@@ -55,6 +55,17 @@ run goes on, with the same exit code.
55
55
  output; after a failure, the failing tests first, by lane, new or known (from JUnit/TAP
56
56
  reports), each opening the lane's log at its line, or a reportless lane's log tail; then every
57
57
  lane's state, time, runs and tests; a lane's name opens its output.
58
+ - **Where each task is:** the task table's *Now* column and a task's *Now* section: the command a
59
+ running dwarf or reviewer runs and for how long, flagged *quiet* after five minutes with no
60
+ output, or why a task waits (dependencies, shared files, no free slot, a drain or stop, an
61
+ infrastructure pause with its countdown, the retry policy's stop and its split). The run
62
+ inspector says what the scheduler is doing.
63
+ - **Checks:** each attempt's tests, type checks, lints and builds, read from its dwarf's and
64
+ reviewer's logs, with exits, times and counts, a failed one's last lines, and which of the
65
+ commands its `## Acceptance criteria` name never ran. codex and grok logs carry no times, so
66
+ `forge-dispatch.sh` keeps `<role>.clock` (when the log grew, each second) beside each log for
67
+ them; `FORGE_LOG_CLOCK=off` turns it off. An environment problem (Docker, a sandbox's EPERM, a
68
+ port in use, …) that several tasks' failed commands met gets one banner in the run header.
58
69
  - **Opening a node** shows its attempts, dwarves and reviews, and an inspector with the prompt
59
70
  that launched each one, the model, timings by phase, tokens, verdicts and the P0–P3 findings
60
71
  of every review (the final review's included).
@@ -3,7 +3,7 @@
3
3
 
4
4
  Three subcommands, stdlib only, no network:
5
5
 
6
- qa --part head|tail [--kind task|final|solo] [--threshold P0|P1|P2|P3]
6
+ qa --part head|tail [--kind task|final|solo|sweep] [--threshold P0|P1|P2|P3]
7
7
  Prints one piece of the QA prompt. The caller prints everything between and
8
8
  after the pieces itself (scope notes, the diff fence, the memory note and the
9
9
  "Place any learning notes before the final FORGE_VERDICT ..." sentence).
@@ -73,7 +73,7 @@ import sys
73
73
 
74
74
  SEVERITIES = ('P0', 'P1', 'P2', 'P3')
75
75
  PLACEHOLDER = 'path/file.py:123'
76
- KINDS = ('task', 'final', 'solo')
76
+ KINDS = ('task', 'final', 'solo', 'sweep')
77
77
 
78
78
  Finding = collections.namedtuple('Finding', 'status severity located line text')
79
79
  Finding.__doc__ = (
@@ -114,6 +114,14 @@ _HEAD = {
114
114
  'behaviour versus what was asked. Also say if it solved a different problem than the',
115
115
  "one stated, or changed files outside the goal's scope.",
116
116
  ] + _NO_TRUST,
117
+ 'sweep': [
118
+ 'This is a finding sweep. The implementer was asked to fix only the review findings listed in',
119
+ 'the task above (S1, S2, ...), which reviews of earlier tasks in this run left open. Your review',
120
+ 'is narrow: for each listed finding, decide from the diff below whether it is fixed, or no longer',
121
+ 'applies to the code; and check that the change breaks nothing it touches. Do not review code the',
122
+ 'diff did not change, and do not report other problems you notice there: they are not this',
123
+ "task's work.",
124
+ ] + _NO_TRUST,
117
125
  'final': [
118
126
  'This is the final, whole-run review. The diff below is the COMBINED result of several',
119
127
  'tasks that were implemented independently and each reviewed on its own slice only.',
@@ -148,11 +156,25 @@ _SEVERITY = [
148
156
 
149
157
  _NO_THRESHOLD = ['The severity tag does not change the verdict rule below.']
150
158
 
159
+ _SWEEP_FINDINGS = [
160
+ 'Report findings only — do not edit any file. A finding here is a regression the change',
161
+ 'introduced: give its file and line, what breaks, and a concrete input that triggers it. Mark it',
162
+ 'CONFIRMED if you traced it in the code, or PLAUSIBLE if you could not fully verify it.',
163
+ ]
164
+
165
+ _SWEEP_STATUS = [
166
+ 'Then give one line for every listed finding, in exactly this form (its own S number):',
167
+ ' - S<n>: FIXED',
168
+ ' - S<n>: NOT FIXED — what is still wrong',
169
+ 'FIXED means the diff removes the problem, or the code it pointed at no longer has it. Do not',
170
+ 'repeat a NOT FIXED finding as a finding bullet; its line is enough.',
171
+ ]
172
+
151
173
  _PASS = ' FORGE_VERDICT: PASS — no confirmed correctness bug (style nits are not failures)'
152
174
  _FAIL = ' FORGE_VERDICT: FAIL — at least one CONFIRMED correctness bug'
153
175
 
154
176
 
155
- def _threshold_clause(rank: int) -> list:
177
+ def _threshold_clause(rank: int, kind: str = 'task') -> list:
156
178
  name = SEVERITIES[rank]
157
179
  blocking = ', '.join(SEVERITIES[:rank + 1])
158
180
  if rank == len(SEVERITIES) - 1:
@@ -164,6 +186,8 @@ def _threshold_clause(rank: int) -> list:
164
186
  'CONFIRMED finding at a lower severity (%s) is recorded as a known issue and does' % tolerated,
165
187
  'not by itself justify FAIL. Give FAIL if and only if at least one CONFIRMED',
166
188
  'finding is blocking.']
189
+ if kind == 'sweep': # the verdict lines below say when a sweep fails
190
+ lines[-2:] = ['not by itself justify FAIL.']
167
191
  return lines + ['A CONFIRMED finding without a severity tag counts as blocking.']
168
192
 
169
193
 
@@ -176,10 +200,15 @@ def qa_text(part: str, kind: str = 'task', threshold=None) -> str:
176
200
  return '\n'.join(_HEAD[kind]) + '\n'
177
201
  if part != 'tail':
178
202
  raise ValueError('part must be head or tail')
179
- lines = list(_FINDINGS) + (_SOLO_EXTRA if kind == 'solo' else [])
203
+ lines = list(_SWEEP_FINDINGS if kind == 'sweep' else _FINDINGS) + (_SOLO_EXTRA if kind == 'solo' else [])
180
204
  lines += [''] + _SEVERITY
181
- lines += [''] + (_NO_THRESHOLD if rank is None else _threshold_clause(rank))
182
- if rank is None:
205
+ lines += [''] + (_NO_THRESHOLD if rank is None else _threshold_clause(rank, kind))
206
+ if kind == 'sweep':
207
+ lines += [''] + _SWEEP_STATUS
208
+ where = '' if rank is None else ' at the blocking threshold (%s or worse)' % SEVERITIES[rank]
209
+ verdicts = [' FORGE_VERDICT: PASS — at least one listed finding is FIXED, and no CONFIRMED regression%s' % where,
210
+ ' FORGE_VERDICT: FAIL — no listed finding is FIXED, or a CONFIRMED regression%s' % where]
211
+ elif rank is None:
183
212
  verdicts = [_PASS, _FAIL]
184
213
  else:
185
214
  where = '%s or worse' % SEVERITIES[rank]
@@ -378,7 +407,8 @@ def _parser() -> argparse.ArgumentParser:
378
407
  qa.add_argument('--part', required=True, choices=('head', 'tail'),
379
408
  help='head = review preamble, tail = findings format + verdict contract')
380
409
  qa.add_argument('--kind', choices=KINDS, default='task',
381
- help='task (default), final (whole-run review) or solo (solo wording)')
410
+ help='task (default), final (whole-run review), solo (solo wording) or sweep (a finding '
411
+ 'sweep task: per-finding FIXED lines, regressions only)')
382
412
  qa.add_argument('--threshold', type=_threshold_arg, default=None, metavar='P0..P3',
383
413
  help='least severe level that still blocks (default: none)')
384
414
  sub.add_parser('dwarf', help='print the implementer rules block')
@@ -381,7 +381,7 @@ write_continue() { :; } # redefined below once there is an attempt to archive
381
381
  ATTEMPT=""
382
382
  if [ "$PREFLIGHT" != 1 ] && [ "$DRY" != 1 ]; then
383
383
  ATTEMPT="$(python3 "$RUNTIME" begin "$RUN_DIR" "$ROLE")" || exit 3
384
- rm -f "$RUN_DIR/$ROLE.last" "$RUN_DIR/$ROLE.log" "$RUN_DIR/$ROLE.resolved" "$RUN_DIR/$ROLE.cmd" "$RUN_DIR/$ROLE.timedout" "$RUN_DIR/$ROLE.infra" "$RUN_DIR/$ROLE.orphans" "$RUN_DIR/$ROLE.session" "$RUN_DIR/$ROLE.continue" "$RUN_DIR/$ROLE.harness"
384
+ rm -f "$RUN_DIR/$ROLE.last" "$RUN_DIR/$ROLE.log" "$RUN_DIR/$ROLE.clock" "$RUN_DIR/$ROLE.resolved" "$RUN_DIR/$ROLE.cmd" "$RUN_DIR/$ROLE.timedout" "$RUN_DIR/$ROLE.infra" "$RUN_DIR/$ROLE.orphans" "$RUN_DIR/$ROLE.session" "$RUN_DIR/$ROLE.continue" "$RUN_DIR/$ROLE.harness"
385
385
  trap 'exit 143' TERM
386
386
  trap 'exit 130' INT
387
387
  # GUARD_ON is 1 only when the harness was started in its own process group (see the
@@ -398,6 +398,7 @@ if [ "$PREFLIGHT" != 1 ] && [ "$DRY" != 1 ]; then
398
398
  python3 "$GUARD" reap "$hpid" "$RUN_DIR/$ROLE.orphans" >/dev/null 2>&1
399
399
  fi
400
400
  if [ -n "${wpid:-}" ]; then pkill -P "$wpid" 2>/dev/null; kill "$wpid" 2>/dev/null; fi
401
+ [ -z "${cpid:-}" ] || kill "$cpid" 2>/dev/null
401
402
  rm -f "$RUN_DIR/$ROLE.harness"
402
403
  }
403
404
  # What the EXIT trap's `finish` archives. Pessimistic until an outcome is known, so every
@@ -726,7 +727,7 @@ fi
726
727
  # when a stale $LAST is already there. That is harmless when each run gets a fresh
727
728
  # run-dir, and silently wrong for `forge-parallel.sh retry`, which reuses the task
728
729
  # directory — it would read the first attempt's result and never notice.
729
- rm -f "$LAST" "$LOG" "$RUN_DIR/$ROLE.timedout" "$RUN_DIR/$ROLE.infra" "$RUN_DIR/$ROLE.orphans" "$RUN_DIR/$ROLE.harness"
730
+ rm -f "$LAST" "$LOG" "$RUN_DIR/$ROLE.clock" "$RUN_DIR/$ROLE.timedout" "$RUN_DIR/$ROLE.infra" "$RUN_DIR/$ROLE.orphans" "$RUN_DIR/$ROLE.harness"
730
731
  python3 "$RUNTIME" phase "$ATTEMPT" model
731
732
  t0="$(date +%s)"
732
733
  # Process-group guard. A dwarf that starts `npm test &` and ends its turn leaves that
@@ -748,6 +749,13 @@ else
748
749
  ( cd "$REPO" && exec "${RUNCMD[@]}" </dev/null ) > "$LOG" 2>&1 &
749
750
  fi
750
751
  hpid=$!
752
+ # Log clock: when the log grew, so forge-ui can time the commands of a harness whose events
753
+ # carry no time (codex, grok). Advisory and off with FORGE_LOG_CLOCK=off; it ends on its own
754
+ # if this dispatch dies first.
755
+ cpid=""
756
+ case "${FORGE_LOG_CLOCK:-on}" in off|OFF|Off|0|no|false) ;; *)
757
+ [ -z "$ATTEMPT" ] || { python3 "$RUNTIME" clock "$LOG" "$RUN_DIR/$ROLE.clock" </dev/null >/dev/null 2>&1 & cpid=$!; } ;;
758
+ esac
751
759
  # The harness leads its own session, so a scheduler's signal to this dispatch's group never
752
760
  # reaches it; only the EXIT trap below does. Record it for the scheduler's backstop
753
761
  # (forge-guard.py stop) in case this dispatch dies before the trap finishes. The start time
@@ -786,6 +794,8 @@ if [ "${LIMIT:-0}" != "0" ]; then
786
794
  fi
787
795
 
788
796
  wait "$hpid"; rc=$?
797
+ # Its last sample is in before `finish` copies the clock into the attempt.
798
+ if [ -n "$cpid" ]; then kill "$cpid" 2>/dev/null; wait "$cpid" 2>/dev/null; cpid=""; fi
789
799
  if [ -n "$wpid" ]; then
790
800
  # The watchdog is asleep in a child of its own; kill that too or it outlives the
791
801
  # run as an orphan holding the timer.
@@ -21,7 +21,11 @@ gh-proman computes, and both tools skip a finding either of them already filed,
21
21
  When the gh-proman skill is configured for the repository, prefer `gh-proman findings`: it also
22
22
  adds the issues to the team's project board with a priority. This command is the fallback.
23
23
 
24
- --json lists every finding in `findings` (fp, severity, origin, plan, task, text, `filed`, `review`, ...). --offline never
24
+ A finding a run's finding sweep (`run --sweep`) fixed stays listed, with `swept` = {task, finding} (null
25
+ otherwise), and is never drafted: the sweep task that merged and whose reviewer marked it FIXED is its record.
26
+ One the sweep did not fix is drafted as before.
27
+
28
+ --json lists every finding in `findings` (fp, severity, origin, plan, task, text, `filed`, `review`, `swept`, ...). --offline never
25
29
  runs `gh` (no filed state, publication of commits judged from local refs only). --only FP[,FP] keeps those
26
30
  fingerprints. --all-runs reads <run> as a repository (or a plan dir naming one) and collects every run in its
27
31
  registry, the newest plan winning for a finding present in several. A caller filing an explicit selection
@@ -611,6 +615,41 @@ def fingerprint(slug, f):
611
615
  return hashlib.sha1(f"{slug.lower()}|{f['file']}|{norm}".encode("utf-8")).hexdigest()[:12]
612
616
 
613
617
 
618
+ def finding_key(f):
619
+ """A finding's fingerprint without the repository, for what is recorded before any slug is known: the
620
+ finding sweep (forge-sweep.py) keys its findings by it."""
621
+ return fingerprint("", f)
622
+
623
+
624
+ def swept(plan_dir):
625
+ """{finding_key: {task, finding}} for the findings a merged sweep task's reviewer marked FIXED."""
626
+ fixed = {}
627
+ tasks = Path(plan_dir) / "tasks"
628
+ if not tasks.is_dir():
629
+ return fixed
630
+ for task_dir in sorted(tasks.iterdir()):
631
+ if not (task_dir / "merged").exists() or not (task_dir / "sweep.outcome.json").is_file():
632
+ continue
633
+ try:
634
+ items = json.loads(read(task_dir / "sweep.outcome.json"))["findings"]
635
+ except (ValueError, KeyError, TypeError):
636
+ continue
637
+ for item in items if isinstance(items, list) else []:
638
+ if isinstance(item, dict) and item.get("status") == "fixed" and isinstance(item.get("key"), str):
639
+ fixed.setdefault(item["key"], {"task": task_dir.name, "finding": item.get("id")})
640
+ return fixed
641
+
642
+
643
+ def mark_swept(found):
644
+ """Set `swept` on each finding a sweep of its own plan fixed (None otherwise)."""
645
+ plans = {}
646
+ for f in found:
647
+ plan_dir = f.get("plan_dir")
648
+ if plan_dir not in plans:
649
+ plans[plan_dir] = swept(plan_dir) if plan_dir else {}
650
+ f["swept"] = plans[plan_dir].get(finding_key(f)) if f.get("task") else None
651
+
652
+
614
653
  def github_slug(repo_path):
615
654
  res = run(["git", "-C", repo_path, "remote", "get-url", "origin"], check=False)
616
655
  m = re.search(r"github\.com[:/]([^/\s]+)/([^/\s]+?)(?:\.git)?/?$", res.stdout.strip())
@@ -989,13 +1028,14 @@ def finding_entry(f, filed=None, dismissed=None):
989
1028
  "plan": f["plan"], "plan_dir": f["plan_dir"], "task": f["task"], "file": f["file"],
990
1029
  "summary": (f["text"].splitlines() or [""])[0][:160], "text": f["text"],
991
1030
  "reviewer": f["reviewer"], "commit": f.get("commit") or "",
992
- "review": f.get("review"),
1031
+ "review": f.get("review"), "swept": f.get("swept"),
993
1032
  "filed": {"url": filed["url"], "state": filed["state"]} if filed else None,
994
1033
  "dismissed": dismissed}
995
1034
 
996
1035
 
997
1036
  def file_findings(args):
998
1037
  meta, found, notes = collect(Path(args.run), args.include_plausible, args.all_runs)
1038
+ mark_swept(found)
999
1039
  repo_path, warnings = run_repository(meta)
1000
1040
  slug = args.repo or github_slug(repo_path)
1001
1041
  if not slug:
@@ -1028,6 +1068,8 @@ def list_and_file(args, meta, found, notes, repo_path, slug, warnings):
1028
1068
  entries.append(finding_entry(f, issue, mark))
1029
1069
  if issue:
1030
1070
  already.append({"finding": f["raw"], "issue": issue["url"], "state": issue["state"]})
1071
+ elif f.get("swept"):
1072
+ continue # fixed in the run by its finding sweep
1031
1073
  elif not mark or args.include_dismissed:
1032
1074
  todo.append(f)
1033
1075
  notes = notes + [f"--only {fp}: no such open finding" for fp in args.only if fp not in known]
@@ -1058,7 +1100,8 @@ def list_and_file(args, meta, found, notes, repo_path, slug, warnings):
1058
1100
  drafts.sort(key=lambda d: SEVERITIES.index(d["severity"]))
1059
1101
  out = {"repo": slug, "plan": meta["plan"], "notes": notes, "warnings": warnings,
1060
1102
  "summary": {"findings": len(seen), "already_filed": len(already),
1061
- "dismissed": sum(1 for e in entries if e["dismissed"]), "drafts": len(drafts),
1103
+ "dismissed": sum(1 for e in entries if e["dismissed"]),
1104
+ "swept": sum(1 for e in entries if e["swept"]), "drafts": len(drafts),
1062
1105
  **{o: sum(1 for f in todo if f["origin"] == o)
1063
1106
  for o in ("tolerated", "accepted", "review", "plausible")}},
1064
1107
  "findings": entries, "already_filed": already, "drafts": drafts}
@@ -1103,6 +1146,7 @@ def create(slug, drafts, args):
1103
1146
  def print_human(out, applied):
1104
1147
  s = out["summary"]
1105
1148
  dismissed = f", {s['dismissed']} dismissed" if s["dismissed"] else ""
1149
+ dismissed += f", {s['swept']} fixed by the run's finding sweep" if s.get("swept") else ""
1106
1150
  print(f"{out['repo']} · run {out['plan']}: {s['findings']} finding(s), {s['already_filed']} already filed{dismissed}, "
1107
1151
  f"{s['drafts']} draft(s) ({s['tolerated']} tolerated, {s['accepted']} accepted, "
1108
1152
  f"{s['review']} review, {s['plausible']} plausible)")
@@ -424,7 +424,7 @@ final_review() {
424
424
  { note "final review: cannot assemble the review context"; return 3; }
425
425
 
426
426
  # At most the limit plus one byte is ever read, so an enormous change cannot fill the disk.
427
- git -C "$src" diff --binary "$base" "$tip" -- . ':(exclude).forge' 2>/dev/null |
427
+ git -C "$src" diff --binary --irreversible-delete "$base" "$tip" -- . ':(exclude).forge' 2>/dev/null |
428
428
  head -c $((REVIEW_DIFF_LIMIT + 1)) > "$out/combined.diff"
429
429
  diff_n="$(wc -c < "$out/combined.diff" | tr -d ' ')"
430
430
  if [ "$diff_n" -gt "$REVIEW_DIFF_LIMIT" ]; then inline=0; rm -f "$out/combined.diff"; fi
@@ -443,7 +443,7 @@ final_review() {
443
443
  echo "There are no changes since that review: it judged this same commit."
444
444
  else
445
445
  echo "### Changes since that review ($(printf '%.7s' "$since")..$(printf '%.7s' "$tip"))"
446
- git -C "$src" diff --binary "$since" "$tip" -- . ':(exclude).forge' 2>/dev/null |
446
+ git -C "$src" diff --binary --irreversible-delete "$since" "$tip" -- . ':(exclude).forge' 2>/dev/null |
447
447
  head -c $((REVIEW_SINCE_LIMIT + 1)) > "$out/since.diff"
448
448
  if [ "$inline" = 1 ] && [ "$(wc -c < "$out/since.diff" | tr -d ' ')" -le "$REVIEW_SINCE_LIMIT" ] &&
449
449
  ! grep -q '```diff' "$out/since.diff"; then
@@ -237,7 +237,7 @@ attempt_delta() { # attempt_delta <tdir> <worktree> <reviewed-commit>
237
237
  && from="$(git -C "$wt" rev-parse --verify -q "$(cat "$tdir/retry_findings.commit")^{commit}")" \
238
238
  && to="$(git -C "$wt" rev-parse --verify -q "$reviewed^{commit}")" \
239
239
  && git -C "$wt" merge-base --is-ancestor "$from" "$to" \
240
- && git -C "$wt" diff --binary "$from" "$to" -- . ':(exclude).forge' > "$tdir/.changes.since.diff" 2>/dev/null \
240
+ && git -C "$wt" diff --binary --irreversible-delete "$from" "$to" -- . ':(exclude).forge' > "$tdir/.changes.since.diff" 2>/dev/null \
241
241
  && [ -s "$tdir/.changes.since.diff" ] \
242
242
  && git -C "$wt" diff --stat "$from" "$to" -- . ':(exclude).forge' > "$tdir/.changes.since.stat" 2>/dev/null; then
243
243
  printf '%s %s\n' "$from" "$to" > "$tdir/changes.since.range"
@@ -649,6 +649,7 @@ run_report_extras() { # run_report_extras <plan> [<verification dir>]
649
649
  report_infra "$1"
650
650
  report_escalations "$1"
651
651
  report_known_issues "$1"
652
+ python3 "$SKILL_DIR/scripts/forge-sweep.py" report "$1" 2>/dev/null || true
652
653
  report_guard_notes "$1"
653
654
  report_verify_notes "${2:-$1}"
654
655
  }
@@ -34,6 +34,12 @@
34
34
  # tasks already stopped are decided again
35
35
  # --no-escalate-effort run retry (removes the file) turn that step off (the default)
36
36
  # --final-review SPEC integrate $PLAN/final_qa QA spec for the whole-run review
37
+ # --sweep Pn run (this run only) once every task merged, fix the open findings
38
+ # at Pn or worse in a few tasks, one per file
39
+ # --sweep-plausible run (this run only) the sweep takes PLAUSIBLE findings too
40
+ # --sweep-max N run (this run only) at most N sweep tasks (default 5)
41
+ # --sweep-ahead run $PLAN/sweep_ahead a task is told the open findings in files it
42
+ # --no-sweep-ahead owns, to fix on its way (off by default)
37
43
  # --verify-lane L=CMD run retry $PLAN/verify.d/<L> a verification lane: name[options]=command,
38
44
  # options as in a lane file (group=g,first,...);
39
45
  # repeatable; replaces --verify and the lanes
@@ -43,6 +49,10 @@ PP_SHIFT=2
43
49
  PP_RETRY_FAILED=0
44
50
  PP_INFRA_RETRIES=0
45
51
  PP_FINAL_REVIEW=""
52
+ PP_SWEEP=""
53
+ PP_SWEEP_MAX=5
54
+ PP_SWEEP_MAX_SET=0
55
+ PP_SWEEP_PLAUSIBLE=0
46
56
  PP_LANES_FRESH=0 # the first --verify-lane of an invocation, or the first after a --verify, starts a fresh verify.d/
47
57
 
48
58
  # --verify-lane 'name[opt,opt]=command' -> $PLAN/verify.d/name: the options become the lane
@@ -127,6 +137,22 @@ forge_pp_flag() {
127
137
  case "${2:-}" in ''|*[!0-9]*) die "--verify-parallel needs an integer from 1 to 32" ;; esac
128
138
  [ "$2" -ge 1 ] && [ "$2" -le 32 ] || die "--verify-parallel needs an integer from 1 to 32"
129
139
  printf '%s' "$2" > "$plan/verify_parallel" ;;
140
+ --sweep)
141
+ [ "$cmd" = run ] || return 1
142
+ case "${2:-}" in P0|P1|P2|P3) PP_SWEEP="$2" ;; *) die "--sweep needs P0, P1, P2 or P3: the least severe finding it fixes" ;; esac ;;
143
+ --sweep-max)
144
+ [ "$cmd" = run ] || return 1
145
+ case "${2:-}" in ''|*[!0-9]*|0) die "--sweep-max needs a positive integer" ;; esac
146
+ PP_SWEEP_MAX="$2"; PP_SWEEP_MAX_SET=1 ;;
147
+ --sweep-plausible)
148
+ [ "$cmd" = run ] || return 1
149
+ PP_SHIFT=1; PP_SWEEP_PLAUSIBLE=1 ;;
150
+ --sweep-ahead)
151
+ [ "$cmd" = run ] || return 1
152
+ PP_SHIFT=1; printf 'on\n' > "$plan/sweep_ahead" ;;
153
+ --no-sweep-ahead)
154
+ [ "$cmd" = run ] || return 1
155
+ PP_SHIFT=1; rm -f "$plan/sweep_ahead" ;;
130
156
  --final-review)
131
157
  [ "$cmd" = integrate ] || return 1
132
158
  PP_FINAL_REVIEW="${2:?--final-review needs a QA spec}"