@giamme/forge 0.12.1 → 0.13.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 +66 -0
- package/README.md +1 -1
- package/SKILL.md +29 -12
- package/VERSION +1 -1
- package/docs/add-ons.md +11 -6
- package/docs/artifacts.md +12 -6
- package/docs/commands.md +179 -17
- package/docs/decomposed-runs.md +13 -5
- package/docs/forge-ui.md +14 -4
- package/docs/memory.md +2 -1
- package/docs/models.md +4 -2
- package/docs/reviews.md +49 -20
- package/docs/troubleshooting.md +3 -1
- package/forge +17 -1
- package/package.json +1 -1
- package/references/dataset.md +39 -13
- package/references/decision-models.md +763 -0
- package/references/decompose.md +166 -29
- package/references/harnesses.md +10 -3
- package/references/planning.md +8 -0
- package/references/solo.md +13 -3
- package/scripts/forge-artifact.sh +30 -4
- package/scripts/forge-config.py +238 -29
- package/scripts/forge-contract.py +95 -56
- package/scripts/forge-control.py +40 -9
- package/scripts/forge-decide.py +6 -0
- package/scripts/forge-dispatch.sh +38 -16
- package/scripts/forge-fail-first.py +2 -2
- package/scripts/forge-gate-addressed.sh +40 -0
- package/scripts/forge-gate-message.sh +64 -0
- package/scripts/forge-issues.py +321 -33
- package/scripts/forge-jev-options.sh +269 -42
- package/scripts/forge-lib-attribute.sh +447 -0
- package/scripts/forge-lib-gates.sh +32 -0
- package/scripts/forge-lib-plans.sh +22 -6
- package/scripts/forge-lib-review.sh +22 -17
- package/scripts/forge-lib-task.sh +217 -38
- package/scripts/forge-lib-verify.sh +45 -8
- package/scripts/forge-memory.sh +3 -3
- package/scripts/forge-parallel-options.sh +18 -5
- package/scripts/forge-parallel.sh +457 -303
- package/scripts/forge-plan-check.py +35 -1
- package/scripts/forge-pre-review.py +437 -0
- package/scripts/forge-prompt.py +25 -5
- package/scripts/forge-route.py +2 -2
- package/scripts/forge-runtime.py +10 -4
- package/scripts/forge-schedule.py +21 -5
- package/scripts/forge-shadow.py +2 -2
- package/scripts/forge-solo.sh +39 -9
- package/scripts/forge-submodules.py +389 -0
- package/scripts/forge-ui-options.sh +25 -0
- package/scripts/forge_dataset/cli.py +12 -6
- package/scripts/forge_dataset/export.py +140 -84
- package/scripts/forge_dataset/harvest.py +33 -5
- package/scripts/{forge_jev/outcome.py → forge_dataset/states.py} +21 -7
- package/scripts/forge_decide/__init__.py +141 -0
- package/scripts/forge_decide/budget.py +180 -0
- package/scripts/forge_decide/cache.py +66 -0
- package/scripts/forge_decide/cli.py +953 -0
- package/scripts/forge_decide/doctor.py +270 -0
- package/scripts/forge_decide/label_addressed.py +75 -0
- package/scripts/forge_decide/label_attribution.py +62 -0
- package/scripts/forge_decide/label_coverage.py +81 -0
- package/scripts/forge_decide/label_message.py +38 -0
- package/scripts/forge_decide/label_prompt.py +139 -0
- package/scripts/forge_decide/labels.py +328 -0
- package/scripts/forge_decide/metrics.py +125 -0
- package/scripts/forge_decide/migrate.py +226 -0
- package/scripts/forge_decide/providers.py +292 -0
- package/scripts/forge_decide/replay.py +350 -0
- package/scripts/forge_decide/report.py +382 -0
- package/scripts/forge_decide/resolve.py +397 -0
- package/scripts/forge_decide/sites.py +377 -0
- package/scripts/forge_jev/__init__.py +202 -104
- package/scripts/forge_jev/addressed.py +171 -0
- package/scripts/forge_jev/attribution.py +198 -0
- package/scripts/forge_jev/cli.py +460 -382
- package/scripts/forge_jev/client.py +155 -77
- package/scripts/forge_jev/coupling.py +19 -87
- package/scripts/forge_jev/coverage.py +303 -0
- package/scripts/forge_jev/findings.py +219 -0
- package/scripts/forge_jev/gates.py +225 -27
- package/scripts/forge_jev/memory.py +65 -4
- package/scripts/forge_jev/message.py +134 -0
- package/scripts/forge_jev/plan_gates.py +294 -0
- package/scripts/forge_jev/questions.py +173 -313
- package/scripts/forge_jev/verify.py +130 -104
- package/ui/README.md +2 -2
- package/ui/docs/api.md +92 -39
- package/ui/forge_ui/control.py +71 -14
- package/ui/forge_ui/export.py +2 -1
- package/ui/forge_ui/models.py +17 -16
- package/ui/forge_ui/reader.py +132 -21
- package/ui/forge_ui/repos.py +428 -0
- package/ui/forge_ui/static/app.js +24 -5
- package/ui/forge_ui/static/cloudmodel.js +8 -5
- package/ui/forge_ui/static/controls.js +20 -13
- package/ui/forge_ui/static/modelstats.js +12 -8
- package/ui/forge_ui/static/panel.js +63 -17
- package/ui/forge_ui/static/runmodel.js +48 -7
- package/ui/forge_ui/static/scene3d.js +2 -15
- package/ui/forge_ui/static/settings.js +481 -68
- package/ui/forge_ui/static/style.css +56 -9
- package/references/jev.md +0 -865
- package/scripts/forge_jev/backtest.py +0 -322
- package/scripts/forge_jev/corpus.py +0 -156
- package/scripts/forge_jev/features.py +0 -24
- package/scripts/forge_jev/predict.py +0 -204
- package/scripts/forge_jev/review.py +0 -73
- package/scripts/forge_jev/routing.py +0 -271
- package/scripts/forge_jev/subset.py +0 -123
package/ui/docs/api.md
CHANGED
|
@@ -38,6 +38,7 @@ written), and the reader must never raise because of one.
|
|
|
38
38
|
| `results.tsv` | `id<TAB>status<TAB>branch` per line, e.g. `reader MERGED forge/20261016-1530/reader` |
|
|
39
39
|
| `run_id` | one line, e.g. `20261016-153012-ab12` |
|
|
40
40
|
| `repo` | one line, absolute path of the target repo |
|
|
41
|
+
| `repo.identity` | optional, written by forge 0.13.1 and later, once at creation: `{"root", "worktree", "branch"}`, the repository `repo` belongs to. `root` is its main working tree (the same for every linked worktree), `worktree` the checkout's physical path when it differs from `root` (else `null`), `branch` its branch (`null` when HEAD is detached) |
|
|
41
42
|
| `goal.txt`, `request.md` | free text |
|
|
42
43
|
| `decompose_level` | `low`, `medium` or `high` |
|
|
43
44
|
| `explore`, `shadow_rate` | one number each (e.g. `0.5`) |
|
|
@@ -48,6 +49,7 @@ written), and the reader must never raise because of one.
|
|
|
48
49
|
| `verification.retry.log` | the output of a deterministic or Jev rerun of a single command |
|
|
49
50
|
| `verification.lanes.json` | a lanes verification's live and final state, written by `scripts/forge-verify.py` (read up to 4 MB); `verification.lane.<name>.log` and `verification.lane.<name>.run-<k>.log` each lane's output |
|
|
50
51
|
| `verification.commit` | one line, the commit verified |
|
|
52
|
+
| `attribution.json` | the result of `forge-parallel.sh attribute`: `culprit` (a task id or `null`), `base_fails`, `inconclusive` (a reason or `null`), `merges`, `steps`, `verification_runs`, `gate` (`null` without the gate, else `{mode, ranking, tried, outcome}`); returned as `attribution`, see RunDetail |
|
|
51
53
|
| `max_parallel`, `escalate_after`, `verify_retries` | one integer each |
|
|
52
54
|
| `qa_threshold` | `P0`..`P3`, the least severe finding that still blocks; `final_qa` the final review's QA spec |
|
|
53
55
|
| `deferrals.txt` | one line per task the wave planner deferred |
|
|
@@ -57,15 +59,17 @@ written), and the reader must never raise because of one.
|
|
|
57
59
|
| `final-review` | a symlink to the newest *published* review dir; `final-review.verdict` a copy of its verdict |
|
|
58
60
|
| `integrate-<epoch>-<pid>/` | one `integrate`: `setup.log`, `merge.log`, `verification.*`, `attempts/verification-<uuid>/`, and `final-review/` (a review dir as above) when it ran one |
|
|
59
61
|
| `tasks/<id>/merged` | exists when the task was merged; its mtime is when |
|
|
60
|
-
| `tasks/<id>/status` | one word: `RUNNING PASS FAIL ERROR INFRA TIMEOUT UNKNOWN INVALIDATED BLOCKED INTERRUPTED NOCHANGES CONFLICT` |
|
|
62
|
+
| `tasks/<id>/status` | one word: `RUNNING PASS FAIL ERROR INFRA TIMEOUT UNKNOWN INVALIDATED BLOCKED INTERRUPTED NOCHANGES CONFLICT NEEDS_INPUT` |
|
|
61
63
|
| `tasks/<id>/attempt` | the current attempt number |
|
|
62
|
-
| `tasks/<id>/attempts.tsv` | `epoch<TAB>attempt<TAB>status<TAB>infra_class` per line, one per attempt entry; status may also be `MERGED`, `infra_class` may be empty, `-` or missing |
|
|
64
|
+
| `tasks/<id>/attempts.tsv` | `epoch<TAB>attempt<TAB>status<TAB>infra_class` per line, one per attempt entry; status may also be `MERGED`, `BOUNCED` or `INCOMPLETE` (a send-back that no reviewer judged: the task status stays `FAIL`), `infra_class` may be empty, `-` or missing |
|
|
63
65
|
| `tasks/<id>/escalations.tsv` | `epoch<TAB>attempt<TAB>from_spec<TAB>to_spec[<TAB>source]` per line; `source` (who decided: `policy`, a human's `retry --dwarf` as `retry`, or a `pin`) is missing on older rows, which read as `policy` |
|
|
64
66
|
| `tasks/<id>/qa.last` | the reviewer's final message; its last line matching `FORGE_VERDICT: PASS` or `FORGE_VERDICT: FAIL` is the verdict |
|
|
65
67
|
| `tasks/<id>/prompt.md`, `approach.md`, `retry_findings.md` | free text |
|
|
68
|
+
| `tasks/<id>/needs_input.md` | the question for the user, written when the task stopped `NEEDS_INPUT`: `The implementer asked:`, then the end of the dwarf's last message; free text, returned as `needs_input` |
|
|
66
69
|
| `tasks/<id>/accepted.by` | who accepted a task over a reviewer's FAIL, and why (`key=value`: `task`, `status`, `reason`, `by`, `at`, `epoch`, `attempt`, `reviewed_commit`; older runs are free text; returned as text) |
|
|
67
|
-
| `tasks/<id>/qa.gate` | `threshold<TAB>decision<TAB>worst<TAB>n_confirmed<TAB>n_unlabelled<TAB>n_below` (`decision` is `accept` or `keep`, `-` for none) |
|
|
70
|
+
| `tasks/<id>/qa.gate` | `threshold<TAB>decision<TAB>worst<TAB>n_confirmed<TAB>n_unlabelled<TAB>n_below` (`decision` is `accept` (the reviewer said FAIL, every CONFIRMED finding was below the threshold), `fail` (the reviewer said PASS, but listed a blocking CONFIRMED finding) or `keep`, `-` for none) |
|
|
68
71
|
| `tasks/<id>/known_issues.md` | the confirmed findings a threshold tolerated |
|
|
72
|
+
| `tasks/<id>/prereview.json`, `prereview.md` | the pre-review tests of the latest attempt (opt-in `plan --pre-review-tests`): `status` (`passed`, `flaky`, `pre-existing`, `failed`, `skipped`, `error`), `reason`, `command`, `selected`, `failing`, `preexisting`, `flaky`, `runs`, `seconds`; returned on a task as `pre_review` `{status, reason, command, selected, failing, preexisting, flaky, seconds, tail}` (`tail`: the end of the last failing run's output), `null` without the file. `prereview.md` is the implementer's findings of a `failed` check |
|
|
69
73
|
| `tasks/<id>/dwarf.input`, `qa.input` | the prompts forge assembled; `<role>.delivered`, `<role>.resolved` the live dispatch files |
|
|
70
74
|
| `tasks/<id>/<role>.log`, `<role>.clock` | the running dispatch's harness log and its clock: one `<epoch> <bytes>` line each time the log grew (forge-dispatch.sh samples it every second; `FORGE_LOG_CLOCK=off` writes none) |
|
|
71
75
|
| `tasks/<id>/escalation.stop`, `split.suggested` | the retry policy stopped the task: `<attempts><TAB><model>`, and the split it suggests (free text) |
|
|
@@ -79,8 +83,6 @@ written), and the reader must never raise because of one.
|
|
|
79
83
|
| `fractal-selection.json` | `{"enabled": true, "run": "run-<20 hex>"}` (or `enabled: false`): the run's Fractal choice, see Fractal below |
|
|
80
84
|
| `tasks/<id>/route.jsonl` | one JSON object per line, one per routing decision: `at` (epoch), `task`, `tier`, `epsilon`, `candidates` (list of specs), `default` (spec), `chosen` (spec), `explored` (bool), `propensity` (probability the chosen spec had), `inputs` (object), `decision` (a short hash identifying the decision). Keep unknown fields |
|
|
81
85
|
| `tasks/<id>/route.explored` | exists when the task's route was an exploratory pick |
|
|
82
|
-
| `tasks/<id>/clef.first_pass` | JSON: `p` (predicted probability the first attempt passes), `model`, `at`, `plan_table`, `assignment` (`{dwarf, qa}`) |
|
|
83
|
-
| `tasks/<id>/clef.retry_pass.<n>` | JSON, same shape plus `attempt` = n |
|
|
84
86
|
| `shadow/<id>/<attempt>-<k>/shadow.json` | JSON: `task`, `attempt`, `reviewed`, `primary`, `spec`, `pick`, `started`. A second, never-read review of attempt `<attempt>` |
|
|
85
87
|
| `shadow/<id>/<attempt>-<k>/shadow.status` | one word |
|
|
86
88
|
| `shadow/<id>/<attempt>-<k>/qa.last` | the shadow reviewer's final message, verdict as above |
|
|
@@ -116,6 +118,7 @@ raise because of one. Older solo dirs have `verdict` and not `status`.
|
|
|
116
118
|
|---|---|
|
|
117
119
|
| `prompt.md` | the implementation prompt |
|
|
118
120
|
| `repo` | one line, absolute path of the target repo |
|
|
121
|
+
| `repo.identity` | optional, written by forge 0.13.1 and later, once at creation: `{"root", "worktree", "branch"}`, the repository `repo` belongs to. `root` is its main working tree (the same for every linked worktree), `worktree` the checkout's physical path when it differs from `root` (else `null`), `branch` its branch (`null` when HEAD is detached) |
|
|
119
122
|
| `goal.txt`, `request.md` | free text; the summary goal is the first line of `goal.txt` |
|
|
120
123
|
| `status` | one word: `RUNNING`, then `PASS`, `FAIL`, `UNKNOWN`, `NOCHANGES`, `INVALIDATED`, `TIMEOUT`, `INFRA`, `INTERRUPTED` or `ERROR` |
|
|
121
124
|
| `verdict` | one word, the legacy status (`PASS`, `FAIL`, `UNKNOWN`, `NOCHANGES`, `INVALIDATED`, …) |
|
|
@@ -184,6 +187,7 @@ class Catalog:
|
|
|
184
187
|
def __init__(self, plans=(), roots=(), registry=True, registry_dir=None): ...
|
|
185
188
|
def runs(self) -> list[dict] # RunSummary list, newest `updated` first
|
|
186
189
|
def get(self, key) -> dict | None # RunDetail for that run_key, or None
|
|
190
|
+
def identity(self, key) -> dict | None # {root, worktree, branch, source} of that run; None for an unknown key
|
|
187
191
|
def task(self, key, task_id) -> dict | None
|
|
188
192
|
def execution(self, key, name) -> dict | None
|
|
189
193
|
def final_review(self, key, name) -> dict | None
|
|
@@ -213,7 +217,7 @@ loaded. When it cannot be loaded, `findings_available` is `false` and every find
|
|
|
213
217
|
is `null`; verdicts and `gate` do not need it.
|
|
214
218
|
|
|
215
219
|
Text fields are capped so one huge file cannot blow up a response: `request`, `prompt`,
|
|
216
|
-
`approach`, `retry_findings` keep their first 20,000 characters; `qa_tail`, `dwarf_tail`
|
|
220
|
+
`approach`, `retry_findings`, `needs_input` keep their first 20,000 characters; `qa_tail`, `dwarf_tail`
|
|
217
221
|
and `verification.log_tail` keep their last 4,000. A capped field ends (or, for tails,
|
|
218
222
|
starts) with `…` and the value of `truncated` lists the field names that were cut.
|
|
219
223
|
|
|
@@ -255,8 +259,8 @@ its last 20,000 behind a leading `…`. Their `truncated` lists the field names
|
|
|
255
259
|
| `POST /api/runs/<key>/issues/dismiss` | dismiss or (`undo`) restore findings; authenticated |
|
|
256
260
|
| `POST /api/runs/<key>/delete` | dry-run or delete a run with `forge runs rm`; authenticated, 900 s timeout; later requests for the key answer `404` |
|
|
257
261
|
| `GET /api/models/reviewers` | `200` the `forge dataset reviewers --json` report (how each reviewer's PASSed work held up); no parameters |
|
|
258
|
-
| `GET /api/config?run=<key>` | `200` the `forge config show --json` of that run's
|
|
259
|
-
| `POST /api/config` | set or unset one allowed key (`repo.verify`, `repo.setup`, `repo.verify-subset`, `jev.enabled`
|
|
262
|
+
| `GET /api/config?run=<key>` | `200` the `forge config show --json` of that run's repository root (see Config) |
|
|
263
|
+
| `POST /api/config` | set or unset one allowed key (`repo.verify`, `repo.setup`, `repo.verify-subset`, `decide.gate.<gate>`, `decide.gate.<gate>.provider`, `decide.gate.<gate>.model`); `jev.enabled` is gone; authenticated |
|
|
260
264
|
| `GET /api/runs/<key>/export?texts=0\|1&paths=0\|1` | `200` the run as one HTML file (see Export), `Content-Disposition: attachment`, `Content-Security-Policy: default-src 'none'; sandbox`; `404` for an unknown run |
|
|
261
265
|
| `GET /api/runs/<key>/tasks/<id>/fractal` | `200 TaskFractal` |
|
|
262
266
|
| `GET /api/runs/<key>/tasks/<id>/fractal/nodes/<node>[/diff]` | `200 FractalNodeDetail`, or with `/diff` a `DiffDetail` of its `candidate.diff`; `<node>` matches `[A-Za-z0-9][A-Za-z0-9_-]{0,100}` |
|
|
@@ -304,6 +308,9 @@ nothing when there is none. Every other response keeps
|
|
|
304
308
|
"kind": "plan",
|
|
305
309
|
"run_id": "20261016-153012-ab12",
|
|
306
310
|
"repo": "/Users/me/dev/forge-ui",
|
|
311
|
+
"repo_root": "/Users/me/dev/forge-ui",
|
|
312
|
+
"repo_worktree": null,
|
|
313
|
+
"repo_branch": "main",
|
|
307
314
|
"goal": "first line of goal.txt",
|
|
308
315
|
"decompose_level": "medium",
|
|
309
316
|
"updated": 1760621412.5,
|
|
@@ -328,6 +335,18 @@ nothing when there is none. Every other response keeps
|
|
|
328
335
|
- `created`: when the run began: the earliest birth time (else mtime) of the files a run writes
|
|
329
336
|
once at its start (plan: `run_id`, `repo`, `request.md`, `goal.txt`, `tasks.tsv`; solo: `prompt.md`,
|
|
330
337
|
`repo`, `request.md`, `goal.txt`), else `null`. These are stat'ed only, and never move `updated`.
|
|
338
|
+
- `repo_root`: the repository the run belongs to, and the key to group runs by. It is the identity's
|
|
339
|
+
root, or `repo` when nothing better is known (`null` only when the run has no `repo`). It is found in
|
|
340
|
+
four steps, the first that answers: (1) `repo.identity` in the run dir, written once at creation by
|
|
341
|
+
forge 0.13.1 and later, its `root`; (2) the `repo` path is a live git checkout: the main working tree
|
|
342
|
+
of its `git worktree list`; (3) the `repo` path is gone: the run's base commit (`integration.base`,
|
|
343
|
+
else a plan's first readable `tasks/*/base_ref`, else a solo run's `dwarf.head.before`) is in exactly
|
|
344
|
+
one root that steps 1 and 2 found in the same listing; (4) otherwise `repo` itself. Clients should
|
|
345
|
+
group by `repo_root` and fall back to `repo` when it is absent (an older server).
|
|
346
|
+
- `repo_worktree`: the checkout the run started in, when that is not `repo_root` (a linked worktree; for
|
|
347
|
+
a worktree that was removed, its `repo` text), else `null`.
|
|
348
|
+
- `repo_branch`: the branch the run started on, from `repo.identity` only; `null` when unknown (a
|
|
349
|
+
detached HEAD, or a run whose root came from step 2 or 3).
|
|
331
350
|
- `dwarf_models`, `qa_models`: `models` split by role.
|
|
332
351
|
- `models`: the sorted distinct specs of the `dwarf` and `qa` columns (a solo run: its `dwarf`
|
|
333
352
|
and `qa` specs as its task has them), nulls left out.
|
|
@@ -364,6 +383,8 @@ Every RunSummary field, plus:
|
|
|
364
383
|
"settings": {"explore": 0.5, "shadow_rate": 0.5, "shadow_qa": ["opus", "sol:xhigh"], "timeout": 3600,
|
|
365
384
|
"max_parallel": 2, "qa_threshold": "P2", "escalate_after": 3, "verify_retries": 1,
|
|
366
385
|
"final_qa": "opus"},
|
|
386
|
+
"attribution": {"culprit": "page", "base_fails": false, "inconclusive": null, "verification_runs": 4,
|
|
387
|
+
"gate_outcome": "confirmed"},
|
|
367
388
|
"verification": {"status": "PASS", "command": "python3 -m unittest", "log_tail": "...",
|
|
368
389
|
"runs": [{"n": 1, "kind": "initial", "exit": 0, "tree_changed": false,
|
|
369
390
|
"duration_s": 12.3, "log": "verification.lane.unit.run-1.log",
|
|
@@ -400,8 +421,18 @@ Every RunSummary field, plus:
|
|
|
400
421
|
|
|
401
422
|
- `settings` values are `null` when the file is missing or unparsable; `shadow_qa` is a
|
|
402
423
|
list (empty when missing). `max_parallel`, `escalate_after`, `verify_retries` are integers,
|
|
403
|
-
`
|
|
404
|
-
|
|
424
|
+
`final_qa` the first line of their file. `qa_threshold` is the effective level (`P0`..`P3`):
|
|
425
|
+
a missing file reads `P2` (forge's default) with `qa_threshold_source` `default`; a file reads
|
|
426
|
+
with source `set`, and `none` in it reads `P3`. A solo run has no plan settings: every value
|
|
427
|
+
is `null`, including `shadow_qa`, except `qa_threshold` and its source, which read the same way.
|
|
428
|
+
- `attribution` is the result of `forge-parallel.sh attribute` from `attribution.json`, or `null` when
|
|
429
|
+
the file is missing. `culprit` is the merged task's id or `null`; `base_fails` is `true` only when the
|
|
430
|
+
base verified FAIL; `inconclusive` is the reason the search stopped without a culprit, or `null`;
|
|
431
|
+
`verification_runs` is how many verifications the search ran; `gate_outcome` is `gate.outcome`
|
|
432
|
+
(`confirmed` or `refuted`), `null` without the gate. A file that is not a JSON object, or lacks any of
|
|
433
|
+
`culprit`, `base_fails`, `inconclusive`, `verification_runs` or `gate`, or has a value of the wrong type
|
|
434
|
+
(`culprit` and `inconclusive` a string or `null`, `base_fails` a boolean, `verification_runs` an integer,
|
|
435
|
+
`gate` `null` or an object whose `outcome` is a string or `null`), is `null` and warned.
|
|
405
436
|
- `verification` is `null` when none of `verification.status`, `.command`, `.log` exists. A
|
|
406
437
|
solo run's `verification` is always `null`. `runs` comes from `verification.runs.tsv`
|
|
407
438
|
(malformed rows are warned and skipped; an empty `exit` is `null`), `commit` is the first
|
|
@@ -517,15 +548,12 @@ Every RunSummary field, plus:
|
|
|
517
548
|
"route": [{"at": 1760619000.0, "task": "reader", "tier": "high", "epsilon": 0.5,
|
|
518
549
|
"candidates": ["astra", "opus"], "default": "opus", "chosen": "astra",
|
|
519
550
|
"explored": true, "propensity": 0.25, "inputs": {}, "decision": "9c1e4b7a0d2f3e58"}],
|
|
520
|
-
"clef": {"first_pass": {"p": 0.71, "model": "clef", "at": 1760619100.0,
|
|
521
|
-
"assignment": {"dwarf": "astra", "qa": "opus"}},
|
|
522
|
-
"retry_pass": {"2": {"p": 0.64, "model": "clef", "at": 1760620600.0, "attempt": 2,
|
|
523
|
-
"assignment": {"dwarf": "sol", "qa": "opus"}}}},
|
|
524
551
|
"shadow": [{"attempt": 1, "k": 0, "spec": "sol:xhigh", "primary": "opus",
|
|
525
552
|
"status": "PASS", "verdict": "FAIL", "started": 1760620100.0}],
|
|
526
553
|
"prompt": "full prompt.md text",
|
|
527
554
|
"approach": null,
|
|
528
555
|
"retry_findings": "...",
|
|
556
|
+
"needs_input": "the question in tasks/<id>/needs_input.md, or null",
|
|
529
557
|
"qa_tail": "last 4000 chars of qa.last",
|
|
530
558
|
"dwarf_tail": "last 4000 chars of dwarf.last",
|
|
531
559
|
"executions": [Execution, ...],
|
|
@@ -566,8 +594,6 @@ Every RunSummary field, plus:
|
|
|
566
594
|
plan task, the run dir's `dwarf.last` for a solo run), or `null` when the file is missing.
|
|
567
595
|
Capped like `qa_tail`.
|
|
568
596
|
- `explored`: `true` if `route.explored` exists or any `route` entry has `explored: true`.
|
|
569
|
-
- `clef.first_pass` is `null` when absent; `clef.retry_pass` is `{}` when there are none;
|
|
570
|
-
its keys are the attempt numbers as strings.
|
|
571
597
|
- `shadow`: one entry per `shadow/<id>/<attempt>-<k>/` dir, sorted by attempt then k.
|
|
572
598
|
`status` is `shadow.status`, `verdict` is parsed from that dir's `qa.last`; fields from
|
|
573
599
|
`shadow.json` (`spec`, `primary`, `started`, `reviewed`, `pick`, as they are) that are
|
|
@@ -581,8 +607,10 @@ Every RunSummary field, plus:
|
|
|
581
607
|
run, the run dir's `attempts/` (`solo`, `dwarf`, `qa`). Shadow executions are not in it.
|
|
582
608
|
- `merged_at`: the mtime of `tasks/<id>/merged`, or `null`.
|
|
583
609
|
- `findings`: FindingsSummary of the current `qa.last`, or `null`.
|
|
584
|
-
- `gate`: the parsed `qa.gate` (`n_*` integers, `-` is `null`), or `null` when missing or
|
|
610
|
+
- `gate`: the parsed `qa.gate` (`decision` `accept`, `fail` or `keep`; `n_*` integers, `-` is `null`), or `null` when missing or
|
|
585
611
|
malformed (malformed is warned).
|
|
612
|
+
- `needs_input`: the text of `tasks/<id>/needs_input.md`, capped like `prompt`, or `null` when the file is
|
|
613
|
+
missing. The question a task stopped `NEEDS_INPUT` for; the export leaves it out unless texts are chosen.
|
|
586
614
|
- `known_issues`: whether `known_issues.md` is a non-empty file.
|
|
587
615
|
- `now`: `null` unless the task is `RUNNING`. Then where it is: the newest running non-shadow `dwarf`
|
|
588
616
|
or `qa` execution (`role`, `execution`, `attempt`, `phase`, `phase_started`, `started`), else the
|
|
@@ -615,9 +643,8 @@ it is missing or `<harness default>`). `wave` is 1, `branch` is `null`, and `att
|
|
|
615
643
|
from the run dir's `attempts.tsv`. `status` is the solo status; `attempt` is the highest `n`
|
|
616
644
|
in `attempts.tsv`, or `null`. `escalations`, `route` and `shadow` are empty. `verdict` and
|
|
617
645
|
`qa_tail` come from `qa.last`, and `prompt` comes from `prompt.md`. `deps` and `files` are
|
|
618
|
-
`[]`; `difficulty`, `accepted_by`, `approach` and `
|
|
619
|
-
false; `accepted_attempt` and `accepted_over` are `null`; `explored` is false; `
|
|
620
|
-
`{first_pass: null, retry_pass: {}}`; `waiting` and `sweep` are `null`, `swept` is `[]`. `request` on
|
|
646
|
+
`[]`; `difficulty`, `accepted_by`, `approach`, `retry_findings` and `needs_input` are `null`; `accepted` is
|
|
647
|
+
false; `accepted_attempt` and `accepted_over` are `null`; `explored` is false; `waiting` and `sweep` are `null`, `swept` is `[]`. `request` on
|
|
621
648
|
the detail is `request.md`.
|
|
622
649
|
|
|
623
650
|
## Execution
|
|
@@ -1036,20 +1063,23 @@ lines follow, a line was cut, or reaching them took more than 64 MB of reading.
|
|
|
1036
1063
|
|
|
1037
1064
|
```json
|
|
1038
1065
|
{"generated": 1760621412.5, "runs": 12, "truncated": false,
|
|
1039
|
-
"tasks": [{"run": "3f9a0c1d2e4b", "task": "reader", "kind": "plan", "repo": "/x/y", "
|
|
1066
|
+
"tasks": [{"run": "3f9a0c1d2e4b", "task": "reader", "kind": "plan", "repo": "/x/y", "repo_root": "/x/y",
|
|
1067
|
+
"difficulty": "high",
|
|
1040
1068
|
"created": 1760619000.0, "explored": true, "propensity": 0.125, "final_status": "MERGED",
|
|
1041
1069
|
"accepted": true,
|
|
1042
1070
|
"attempts": [{"n": 1, "alias": "luna", "spec": "luna", "source": "execution", "outcome": "fail",
|
|
1043
|
-
"reason": null, "gate": false, "model_s": 297.0, "duration_s": 300.0,
|
|
1071
|
+
"reason": null, "gate": false, "gate_fail": false, "model_s": 297.0, "duration_s": 300.0,
|
|
1044
1072
|
"tokens": {"input": 120000, "cached": 90000, "output": 8000}, "timed_out": false}],
|
|
1045
1073
|
"escalations": [{"n": 1, "from": "luna", "to": "sol:xhigh"}]}],
|
|
1046
1074
|
"reviews": [{"run": "3f9a0c1d2e4b", "task": "reader", "n": 1, "kind": "primary", "alias": "opus", "spec": "opus",
|
|
1075
|
+
"repo_root": "/x/y",
|
|
1047
1076
|
"verdict": "FAIL", "findings": FindingsSummary, "duration_s": 270.0, "tokens": {...},
|
|
1048
1077
|
"agreement": null, "primary_alias": null}],
|
|
1049
1078
|
"warnings": ["3f9a0c1d2e4b: tasks/x/attempts.tsv line 2: invalid attempt"]}
|
|
1050
1079
|
```
|
|
1051
1080
|
|
|
1052
|
-
- `tasks[]`: one per task (`solo` for a solo run). `
|
|
1081
|
+
- `tasks[]`: one per task (`solo` for a solo run). `repo` is the run's `repo` text and `repo_root` its
|
|
1082
|
+
grouping key, both as in RunSummary (the same for every row of a run). `explored` as Task's; `propensity` that of
|
|
1053
1083
|
the newest `route.jsonl` decision, else `null`; `final_status` the task (or solo) status;
|
|
1054
1084
|
`accepted` whether `accepted.by` is non-empty (`false` for a solo run). `escalations` is
|
|
1055
1085
|
`escalations.tsv` as it is (`n` its attempt column, `from`/`to` specs).
|
|
@@ -1064,16 +1094,17 @@ lines follow, a line was cut, or reaching them took more than 64 MB of reading.
|
|
|
1064
1094
|
- `alias`/`spec`/`source`: the last dwarf execution's model (`execution`), else the fifth
|
|
1065
1095
|
`attempts.tsv` column (`attempts.tsv`), else for attempt 1 only the `tasks.tsv` dwarf (a solo
|
|
1066
1096
|
run's `dwarf.spec`/`dwarf.resolved`) (`plan`), else all `null`.
|
|
1067
|
-
- `gate`: the attempt passed although its (last) primary review said FAIL. `model_s`,
|
|
1097
|
+
- `gate`: the attempt passed although its (last) primary review said FAIL. `gate_fail`: the attempt failed although that review said PASS (forge turned it into FAIL). `model_s`,
|
|
1068
1098
|
`duration_s`, `tokens`, `timed_out`: that dwarf execution's `phases.model`, `duration_s`,
|
|
1069
1099
|
`tokens`, `timed_out`, else `null`/`false`.
|
|
1070
1100
|
- `reviews[]`: every finished primary qa execution (`n` its attempt); every shadow whose
|
|
1071
1101
|
`shadow.status` is `done` (`alias`/`spec` its execution's model, else `shadow.json`'s spec;
|
|
1072
1102
|
`agreement` and `primary_alias` against the primary review of its attempt); every finished
|
|
1073
1103
|
final review (`kind` `final`, `task` and `n` `null`, `verdict` `PASS`/`FAIL` else `null`,
|
|
1074
|
-
timing from its newest execution).
|
|
1104
|
+
timing from its newest execution). Every review row also has `repo_root`, the run's (reviews have no
|
|
1105
|
+
`repo` of their own).
|
|
1075
1106
|
- Per run the facts are kept, keyed by its realpath, until its RunSummary's `updated`,
|
|
1076
|
-
`task_count`, `counts` or `final_review` changes (4,096 runs); a run with a `RUNNING` task is
|
|
1107
|
+
`task_count`, `counts` or `final_review`, or its `repo_root`, changes (4,096 runs); a run with a `RUNNING` task is
|
|
1077
1108
|
read again after 120 s. One computation runs at a time. Past 50,000 task rows the next run
|
|
1078
1109
|
is left out and `truncated` is true. `warnings` (first 500) are prefixed by the run key.
|
|
1079
1110
|
|
|
@@ -1173,7 +1204,7 @@ difficulty paths deps model` each), `decomposition_history` (its newest 20, each
|
|
|
1173
1204
|
(under their tail paths; line ranges are not stored, so the page shows the tail).
|
|
1174
1205
|
- `texts=0` (the default) nulls these keys wherever they hold a string, list or object: `prompt
|
|
1175
1206
|
last request log_tail dwarf_tail qa_tail qa_last qa_input tasks_summary known_issues texts text
|
|
1176
|
-
planning_last approach retry_findings dwarf_input error last_line message excerpt tail lines call split`,
|
|
1207
|
+
planning_last approach retry_findings needs_input dwarf_input error last_line message excerpt tail lines call split`,
|
|
1177
1208
|
and stores no diff, no transcript, no checks and no environment problems (a command is a text). A finding keeps its `summary`, a failing test its `name`.
|
|
1178
1209
|
- `paths=0` (the default) makes every string that is a whole absolute path (but `/api/…`, `url`s
|
|
1179
1210
|
and `command`s) its last component, and replaces the run dir, the repo and the home dir inside other
|
|
@@ -1266,8 +1297,10 @@ routes, so their configuration matters too.
|
|
|
1266
1297
|
running is `409 {"error": "busy"}`, without reaching the CLI; other runs are not held up.
|
|
1267
1298
|
|
|
1268
1299
|
**Errors.** For a CLI that exits non-zero the answer is `{"error", "detail", "result"?}`: `detail`
|
|
1269
|
-
is the last line of its stderr (at most 300 characters; the rest of stderr is not echoed)
|
|
1270
|
-
|
|
1300
|
+
is the last line of its stderr (at most 300 characters; the rest of stderr is not echoed), except for
|
|
1301
|
+
a refusal (exit 3): forge's own message, kept whole (its non-blank lines, joined by `\n`, at most 2000
|
|
1302
|
+
characters), since it names what was refused and why, then what to run instead. `result` is the
|
|
1303
|
+
object its stdout holds, when that parses as one.
|
|
1271
1304
|
|
|
1272
1305
|
| CLI exit | Status | `error` |
|
|
1273
1306
|
|---|---|---|
|
|
@@ -1287,7 +1320,7 @@ for them only unknown keys and runs the catalog does not hold are `404`. Every w
|
|
|
1287
1320
|
### `GET /api/runs/<key>/controls`
|
|
1288
1321
|
|
|
1289
1322
|
`forge control show <plan dir> --json`: `200` with its object (`plan`, `run_id`, `live`, `fractal`,
|
|
1290
|
-
`run` (the plan-wide controls), `tasks` (per task: `status`, `dwarf`, `qa`, `qa_threshold`,
|
|
1323
|
+
`run` (the plan-wide controls; `qa_threshold` is the effective level and `qa_threshold_source` is `set` or `default`), `tasks` (per task: `status`, `dwarf`, `qa`, `qa_threshold`,
|
|
1291
1324
|
`retry_budget`, `retries_used`, `pin`, `escalation_stop`, `escalation_next`) and `log`). No token
|
|
1292
1325
|
is needed to read it. Of `run` the page also reads `max_parallel` (1–64 or `null`), `infra_backoff`
|
|
1293
1326
|
(the shape, `exp:60` when unset), `escalate_effort` (`on`/`off`), `drained` and `stopping`
|
|
@@ -1307,7 +1340,7 @@ known or a spec runs is for the CLI to say (its `400` or `409` comes back as abo
|
|
|
1307
1340
|
|
|
1308
1341
|
| Body | CLI call (after `forge`) |
|
|
1309
1342
|
|---|---|
|
|
1310
|
-
| `{"action": "set", "key": "qa-threshold", "value": "P2"}` | `control set <dir> qa-threshold P2 --actor ui --json` |
|
|
1343
|
+
| `{"action": "set", "key": "qa-threshold", "value": "P2"}` (`default` at run level removes the setting, `none` is P3; for a task `inherit` drops the override) | `control set <dir> qa-threshold P2 --actor ui --json` |
|
|
1311
1344
|
| `{"action": "set", "key": "retry-budget", "value": "inherit", "task": "reader"}` | `control set <dir> retry-budget inherit --task reader --actor ui --json` |
|
|
1312
1345
|
| `{"action": "pin", "task": "graph", "spec": "sol:high:codex"}` | `control pin <dir> graph sol:high:codex --actor ui --json` |
|
|
1313
1346
|
| `{"action": "unpin", "task": "graph"}` | `control unpin <dir> graph --actor ui --json` |
|
|
@@ -1375,14 +1408,34 @@ Reviewers table's Did not hold column and nothing else. Timeout 60 s.
|
|
|
1375
1408
|
|
|
1376
1409
|
### `GET /api/config?run=<key>` and `POST /api/config`
|
|
1377
1410
|
|
|
1378
|
-
The repository is the run's
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1411
|
+
The repository is the run's `repo_root` (see RunSummary) when that is an existing absolute directory,
|
|
1412
|
+
else the run's own `repo` file (first line, an existing absolute directory; else `409`), never a client
|
|
1413
|
+
field. The settings resolve against the root: every worktree of a repository shares its committed
|
|
1414
|
+
`.forge/` config, so the run of a removed worktree reads and writes the main checkout. A run whose root
|
|
1415
|
+
is unknown and whose `repo` is gone is still `409`. `GET` runs `config show --repo <repo> --json` and answers with its
|
|
1416
|
+
object. The `decide` block is the `forge decide status --json` object for that repo, plus `ready`
|
|
1417
|
+
on each gate (`true` when the gate is `shadow` or `on`, nothing skips it, and its provider is
|
|
1418
|
+
local or has a key on file), plus two fields from `forge decide status --json`: `forced` (bool: the
|
|
1419
|
+
gate is `on` and has no passing replay for its provider and model) and `replay` (`{"provider",
|
|
1420
|
+
"model", "passes", "at"}`, `at` in epoch seconds, or `null` when `forge decide replay` has recorded
|
|
1421
|
+
none). An older forge sends neither; the page reads that as `forced: false` and `replay: null`. The
|
|
1422
|
+
Settings page shows `forced` and `replayed <date>` or `replay failed` as tags on the gate. Provider objects keep the status fields except `key`, `key_source`,
|
|
1423
|
+
`key_file` and `key_env`: a key never reaches this response. `jev.enabled` is gone.
|
|
1424
|
+
|
|
1425
|
+
`POST` takes `{"run": <key>, "key": one of repo.verify, repo.setup, repo.verify-subset,
|
|
1426
|
+
decide.gate.<gate>, decide.gate.<gate>.provider, decide.gate.<gate>.model, "value": text | "unset": true}`
|
|
1427
|
+
(exactly one of the two; any other field, `repo` included, is a `400`) and runs
|
|
1428
|
+
`config set <key> <value> --repo <repo> --json` or `config unset <key> --repo <repo> --json`.
|
|
1429
|
+
The gates are `drift`, `forward`, `prompt`, `memory-curate`, `memory-slice`, `memory-stale` and
|
|
1430
|
+
`verify-discover`. `decide.gate.<gate>` takes `off`, `shadow` or `on`. Turning a gate `on` with no passing replay for
|
|
1431
|
+
its provider and model makes the CLI exit 3, which answers `409 {"error": "refused", "detail": <the
|
|
1432
|
+
CLI's message>}`; the message names `forge decide replay` and `--force` and the page shows it whole.
|
|
1433
|
+
A provider or model is a
|
|
1434
|
+
non-empty single line of at most 256 characters, with no control characters and no leading or
|
|
1435
|
+
trailing whitespace, and not starting with `-`. Those three keys write the user level through
|
|
1436
|
+
`forge decide gate` and cannot be unset (the answer says to set the mode to off). A repo file
|
|
1437
|
+
value is a non-empty text of at most 4096 characters without control characters (newline and tab
|
|
1438
|
+
are allowed), not starting with `-`; `repo.verify-subset` must contain `{files}`. `200` with the
|
|
1386
1439
|
CLI's object (`ok`, `key`, `previous`, `value`). Writes serialize on one server-wide config lock
|
|
1387
1440
|
(`409 busy`). Unknown run `404`. Timeout 60 s.
|
|
1388
1441
|
|
package/ui/forge_ui/control.py
CHANGED
|
@@ -29,9 +29,21 @@ MAX_LABELS = 5
|
|
|
29
29
|
MAX_LABEL = 50
|
|
30
30
|
MAX_REASON = 500
|
|
31
31
|
MAX_CONFIG_VALUE = 4096
|
|
32
|
+
MAX_DECIDE_VALUE = 256
|
|
32
33
|
FP_RE = re.compile(r'[0-9a-f]{12}')
|
|
33
|
-
|
|
34
|
+
# Mirrored from forge_decide.GATES and MODES. The ui tests do not put scripts/ on the path, so this
|
|
35
|
+
# module does not import forge_decide; ConfigTests.test_decide_names_match_forge_decide keeps them equal.
|
|
36
|
+
DECIDE_GATES = ('drift', 'forward', 'prompt', 'memory-curate', 'memory-slice', 'memory-stale',
|
|
37
|
+
'verify-discover', 'coverage', 'retry-addressed', 'dwarf-message', 'attribution',
|
|
38
|
+
'findings')
|
|
39
|
+
DECIDE_MODES = ('off', 'shadow', 'on')
|
|
40
|
+
REPO_CONFIG_KEYS = ('repo.verify', 'repo.setup', 'repo.verify-subset')
|
|
41
|
+
CONFIG_KEYS = REPO_CONFIG_KEYS
|
|
42
|
+
_DECIDE_KEY = re.compile(r'^decide\.gate\.([A-Za-z0-9_-]+?)(?:\.(provider|model))?$')
|
|
34
43
|
DETAIL_MAX = 300
|
|
44
|
+
# A refusal (exit 3) is forge's own message, kept whole: what was refused and why, then what to run
|
|
45
|
+
# instead (`forge decide replay ...`, `--force`), with a provider and model of up to 256 characters each.
|
|
46
|
+
REFUSAL_MAX = 2000
|
|
35
47
|
TIMEOUT_DETAIL = 'the operation may have partly completed; reload to see the current state'
|
|
36
48
|
|
|
37
49
|
# forge control's exit codes (scripts/forge-control.py) and the HTTP status each one gets.
|
|
@@ -151,11 +163,19 @@ def _stdout_object(text):
|
|
|
151
163
|
return value if isinstance(value, dict) else None
|
|
152
164
|
|
|
153
165
|
|
|
166
|
+
def _lines(text):
|
|
167
|
+
return [line.strip() for line in text.splitlines() if line.strip()]
|
|
168
|
+
|
|
169
|
+
|
|
154
170
|
def _last_line(text):
|
|
155
|
-
lines =
|
|
171
|
+
lines = _lines(text)
|
|
156
172
|
return lines[-1][:DETAIL_MAX] if lines else ''
|
|
157
173
|
|
|
158
174
|
|
|
175
|
+
def _message(text):
|
|
176
|
+
return '\n'.join(_lines(text))[:REFUSAL_MAX]
|
|
177
|
+
|
|
178
|
+
|
|
159
179
|
def map_exit(result):
|
|
160
180
|
"""(status, body) for a finished CliResult."""
|
|
161
181
|
if result.timed_out:
|
|
@@ -168,7 +188,8 @@ def map_exit(result):
|
|
|
168
188
|
return 502, {'error': 'bad gateway', 'detail': 'the forge CLI printed no JSON object'}
|
|
169
189
|
return 200, obj
|
|
170
190
|
status, error = _EXITS.get(result.code, (502, 'bad gateway'))
|
|
171
|
-
|
|
191
|
+
detail = _message(result.stderr) if result.code == 3 else _last_line(result.stderr)
|
|
192
|
+
body = {'error': error, 'detail': detail or f'the forge CLI exited {result.code}'}
|
|
172
193
|
if obj is not None:
|
|
173
194
|
body['result'] = obj
|
|
174
195
|
return status, body
|
|
@@ -469,6 +490,12 @@ def _delete(ctx):
|
|
|
469
490
|
return ctx.locked(work)
|
|
470
491
|
|
|
471
492
|
|
|
493
|
+
def _directory(value):
|
|
494
|
+
"""`value` when it is an absolute existing directory with no control characters, else None."""
|
|
495
|
+
ok = isinstance(value, str) and os.path.isabs(value) and _no_control_chars(value) and os.path.isdir(value)
|
|
496
|
+
return value if ok else None
|
|
497
|
+
|
|
498
|
+
|
|
472
499
|
def _repo_of(path):
|
|
473
500
|
"""The repository the run's own `repo` file names, or None."""
|
|
474
501
|
try:
|
|
@@ -476,17 +503,19 @@ def _repo_of(path):
|
|
|
476
503
|
line = handle.readline().strip()
|
|
477
504
|
except (OSError, UnicodeDecodeError):
|
|
478
505
|
return None
|
|
479
|
-
return
|
|
506
|
+
return _directory(line)
|
|
480
507
|
|
|
481
508
|
|
|
482
509
|
def _config_run(ctx, key):
|
|
483
|
-
"""(repo, error answer) for the run key a config request names.
|
|
510
|
+
"""(repo, error answer) for the run key a config request names. The repository is the run's root
|
|
511
|
+
(every worktree of one repository shares its .forge/ config), else the directory its `repo` names."""
|
|
484
512
|
if not isinstance(key, str) or not re.fullmatch(r'[0-9a-f]{12}', key):
|
|
485
513
|
return None, _invalid('run must be a 12-hex run key')
|
|
486
514
|
found = ctx.server.catalog.locate(key)
|
|
487
515
|
if not found:
|
|
488
516
|
return None, (404, {'error': 'not found'})
|
|
489
|
-
|
|
517
|
+
identity = ctx.server.catalog.identity(key)
|
|
518
|
+
repo = _directory(identity and identity['root']) or _repo_of(found[0])
|
|
490
519
|
if repo is None:
|
|
491
520
|
return None, (409, {'error': 'refused', 'detail': 'the run names no repository directory'})
|
|
492
521
|
return repo, None
|
|
@@ -511,20 +540,49 @@ def _config_get(ctx):
|
|
|
511
540
|
return ctx.call('config', 'show', '--repo', repo, '--json')
|
|
512
541
|
|
|
513
542
|
|
|
514
|
-
def
|
|
543
|
+
def _classify_config_key(key):
|
|
544
|
+
"""('repo'|'mode'|'provider'|'model', gate or None). BadBody when the key is not one of those shapes."""
|
|
545
|
+
if key == 'jev.enabled':
|
|
546
|
+
raise BadBody('jev.enabled is gone; set a gate with decide.gate.<gate>')
|
|
547
|
+
if key in REPO_CONFIG_KEYS:
|
|
548
|
+
return 'repo', None
|
|
549
|
+
if isinstance(key, str) and key.startswith('decide.'):
|
|
550
|
+
match = _DECIDE_KEY.fullmatch(key)
|
|
551
|
+
if match and match.group(1) in DECIDE_GATES:
|
|
552
|
+
return match.group(2) or 'mode', match.group(1)
|
|
553
|
+
if match:
|
|
554
|
+
raise BadBody('unknown gate %r; gates: %s' % (match.group(1), ', '.join(DECIDE_GATES)))
|
|
555
|
+
raise BadBody('key must be decide.gate.<gate>, decide.gate.<gate>.provider or decide.gate.<gate>.model')
|
|
556
|
+
raise BadBody('key must be one of ' + ', '.join(REPO_CONFIG_KEYS)
|
|
557
|
+
+ ', decide.gate.<gate>, decide.gate.<gate>.provider, decide.gate.<gate>.model')
|
|
558
|
+
|
|
559
|
+
|
|
560
|
+
def _decide_text(value):
|
|
561
|
+
"""A provider or model: one short line, so it cannot become an option on the decide CLI's argv."""
|
|
562
|
+
if (not isinstance(value, str) or not value or value != value.strip()
|
|
563
|
+
or len(value) > MAX_DECIDE_VALUE or value.startswith('-') or not _no_control_chars(value)):
|
|
564
|
+
raise BadBody('value must be short single-line text, not starting with "-"')
|
|
565
|
+
return value
|
|
566
|
+
|
|
567
|
+
|
|
568
|
+
def _config_value(key, body, kind):
|
|
515
569
|
if 'unset' in body:
|
|
516
570
|
if body['unset'] is not True or 'value' in body:
|
|
517
571
|
raise BadBody('give value, or unset: true, not both')
|
|
518
|
-
if
|
|
519
|
-
raise BadBody('
|
|
572
|
+
if kind != 'repo':
|
|
573
|
+
raise BadBody('set the mode to off')
|
|
520
574
|
return 'unset', None
|
|
521
575
|
value = body.get('value')
|
|
576
|
+
if kind == 'mode':
|
|
577
|
+
if value not in DECIDE_MODES:
|
|
578
|
+
raise BadBody('mode must be off, shadow or on')
|
|
579
|
+
return 'set', value
|
|
580
|
+
if kind in ('provider', 'model'):
|
|
581
|
+
return 'set', _decide_text(value)
|
|
522
582
|
if not isinstance(value, str) or not value.strip():
|
|
523
583
|
raise BadBody('value must be a non-empty string')
|
|
524
584
|
if len(value) > MAX_CONFIG_VALUE or value.startswith('-') or not _no_control_chars(value.replace('\n', ' ').replace('\t', ' ')):
|
|
525
585
|
raise BadBody('value is not an acceptable text')
|
|
526
|
-
if key == 'jev.enabled' and value not in ('true', 'false'):
|
|
527
|
-
raise BadBody('jev.enabled takes true or false')
|
|
528
586
|
if key == 'repo.verify-subset' and '{files}' not in value:
|
|
529
587
|
raise BadBody('repo.verify-subset must contain {files}')
|
|
530
588
|
return 'set', value
|
|
@@ -537,9 +595,8 @@ def _config_set(ctx):
|
|
|
537
595
|
try:
|
|
538
596
|
_check_fields(body, ('run', 'key', 'value', 'unset'))
|
|
539
597
|
key = body.get('key')
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
verb, value = _config_value(key, body)
|
|
598
|
+
kind, _gate = _classify_config_key(key)
|
|
599
|
+
verb, value = _config_value(key, body, kind)
|
|
543
600
|
except BadBody as exc:
|
|
544
601
|
return _invalid(str(exc))
|
|
545
602
|
repo, error = _config_run(ctx, body.get('run'))
|
package/ui/forge_ui/export.py
CHANGED
|
@@ -37,7 +37,8 @@ _EXEC = re.compile(r'(?:task|dwarf|qa|solo|verification|parallel)-[0-9a-f]{32}')
|
|
|
37
37
|
# texts that can hold code, prompts or private notes: nulled unless texts=True
|
|
38
38
|
_TEXT_KEYS = frozenset(('prompt', 'last', 'request', 'log_tail', 'dwarf_tail', 'qa_tail', 'qa_last', 'qa_input',
|
|
39
39
|
'tasks_summary', 'known_issues', 'texts', 'text', 'planning_last', 'approach', 'retry_findings',
|
|
40
|
-
'dwarf_input', 'error', 'last_line', 'message', 'excerpt', 'tail', 'lines', 'call', 'split'
|
|
40
|
+
'dwarf_input', 'error', 'last_line', 'message', 'excerpt', 'tail', 'lines', 'call', 'split',
|
|
41
|
+
'needs_input'))
|
|
41
42
|
|
|
42
43
|
|
|
43
44
|
def _enc(value):
|
package/ui/forge_ui/models.py
CHANGED
|
@@ -83,6 +83,7 @@ def _attempts(rows, execs, plan_spec):
|
|
|
83
83
|
verdict = reviews[-1]['verdict'] if reviews else None
|
|
84
84
|
result.append(dict(n=n, alias=model['alias'] if model else _alias(spec), spec=spec, source=source,
|
|
85
85
|
outcome=outcome, reason=reason, gate=outcome == 'pass' and verdict == 'FAIL',
|
|
86
|
+
gate_fail=outcome == 'fail' and verdict == 'PASS',
|
|
86
87
|
model_s=last['phases'].get('model') if last is not None else None,
|
|
87
88
|
duration_s=last['duration_s'] if last is not None else None,
|
|
88
89
|
tokens=dict(last['tokens']) if last is not None and last['tokens'] else None,
|
|
@@ -126,10 +127,10 @@ def _reviews(key, ident, execs, shadows):
|
|
|
126
127
|
return rows
|
|
127
128
|
|
|
128
129
|
|
|
129
|
-
def _facts(path, summary):
|
|
130
|
+
def _facts(path, summary, root):
|
|
130
131
|
rd = reader._Read(path)
|
|
131
132
|
key = summary['key']
|
|
132
|
-
base_row = dict(run=key, repo=summary['repo'], created=summary['created'])
|
|
133
|
+
base_row = dict(run=key, repo=summary['repo'], repo_root=root, created=summary['created'])
|
|
133
134
|
tasks, reviews = [], []
|
|
134
135
|
if summary['kind'] == 'solo':
|
|
135
136
|
execs = reader._solo_execs(rd, reader._solo_status(rd), reader._history(rd, 'attempts.tsv'))
|
|
@@ -165,25 +166,28 @@ def _facts(path, summary):
|
|
|
165
166
|
spec=spec, verdict=review['verdict'] if review['verdict'] in ('PASS', 'FAIL') else None,
|
|
166
167
|
findings=review['findings'], duration_s=review['duration_s'],
|
|
167
168
|
tokens=run['tokens'] if run else None, agreement=None, primary_alias=None))
|
|
168
|
-
order = ('run', 'task', 'kind', 'repo', 'difficulty', 'created', 'explored', 'propensity',
|
|
169
|
-
'accepted', 'attempts', 'escalations')
|
|
169
|
+
order = ('run', 'task', 'kind', 'repo', 'repo_root', 'difficulty', 'created', 'explored', 'propensity',
|
|
170
|
+
'final_status', 'accepted', 'attempts', 'escalations')
|
|
171
|
+
# Reviews have no repo of their own; every row carries the run's grouping key.
|
|
172
|
+
reviews = [dict(row, repo_root=root) for row in reviews]
|
|
170
173
|
return dict(tasks=[{name: row[name] for name in order} for row in tasks], reviews=reviews,
|
|
171
174
|
warnings=[f'{key}: {item}' for item in rd.warnings])
|
|
172
175
|
|
|
173
176
|
|
|
174
|
-
def _signature(summary):
|
|
177
|
+
def _signature(summary, root):
|
|
178
|
+
# The grouping key is part of the signature: a root that appears later must reach the cached rows.
|
|
175
179
|
return (summary['updated'], summary['task_count'], json.dumps(summary['counts'], sort_keys=True),
|
|
176
|
-
summary['final_review'])
|
|
180
|
+
summary['final_review'], root)
|
|
177
181
|
|
|
178
182
|
|
|
179
|
-
def _cached(path, summary, now):
|
|
183
|
+
def _cached(path, summary, now, root):
|
|
180
184
|
real = os.path.realpath(path)
|
|
181
|
-
sig = _signature(summary)
|
|
185
|
+
sig = _signature(summary, root)
|
|
182
186
|
hit = _RUNS.get(real)
|
|
183
187
|
if hit is not None and hit[0] == sig and not ('RUNNING' in summary['counts'] and now - hit[1] > _RUNNING_S):
|
|
184
188
|
_RUNS.move_to_end(real)
|
|
185
189
|
return hit[2]
|
|
186
|
-
facts = _facts(path, summary)
|
|
190
|
+
facts = _facts(path, summary, root)
|
|
187
191
|
_RUNS[real] = (sig, now, facts)
|
|
188
192
|
_RUNS.move_to_end(real)
|
|
189
193
|
while len(_RUNS) > _SIZE:
|
|
@@ -196,18 +200,15 @@ def collect(found):
|
|
|
196
200
|
# One computation at a time: a cold cache reads every run once, not once per request.
|
|
197
201
|
with _LOCK:
|
|
198
202
|
now = time.time()
|
|
199
|
-
|
|
200
|
-
for path, source in
|
|
201
|
-
summary = reader.summarize(path, source)
|
|
202
|
-
if reader._kind(path):
|
|
203
|
-
runs.append((path, summary))
|
|
203
|
+
listed, identities = reader.batch(found)
|
|
204
|
+
runs = [(path, reader.summarize(path, source), identities[entry[0]]) for path, source, entry in listed]
|
|
204
205
|
runs.sort(key=lambda item: item[1]['updated'] if item[1]['updated'] is not None else float('-inf'), reverse=True)
|
|
205
206
|
tasks, reviews, warnings, count, truncated = [], [], [], 0, False
|
|
206
|
-
for path, summary in runs:
|
|
207
|
+
for path, summary, identity in runs:
|
|
207
208
|
if len(tasks) + summary['task_count'] > _MAX_ROWS:
|
|
208
209
|
truncated = True
|
|
209
210
|
break
|
|
210
|
-
facts = _cached(path, summary, now)
|
|
211
|
+
facts = _cached(path, summary, now, reader.repo_root(identity, summary['repo']))
|
|
211
212
|
tasks += facts['tasks']
|
|
212
213
|
reviews += facts['reviews']
|
|
213
214
|
warnings += facts['warnings']
|