@giamme/forge 0.18.0 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +33 -0
- package/README.md +1 -0
- package/SKILL.md +16 -2
- package/VERSION +1 -1
- package/docs/artifacts.md +25 -1
- package/docs/commands.md +81 -14
- package/docs/decomposed-runs.md +114 -1
- package/docs/development.md +2 -1
- package/docs/forge-ui.md +84 -15
- package/docs/memory.md +25 -4
- package/docs/models.md +8 -0
- package/docs/reviews.md +122 -0
- package/forge +20 -3
- package/package.json +2 -1
- package/references/dataset.md +20 -1
- package/references/decompose.md +621 -33
- package/references/harnesses.md +18 -3
- package/references/planning.md +43 -14
- package/references/ui.md +53 -6
- package/registry.tsv +8 -3
- package/scripts/forge-brief.py +88 -3
- package/scripts/forge-compare.py +4 -3
- package/scripts/forge-contract.py +202 -27
- package/scripts/forge-control.py +117 -5
- package/scripts/forge-dispatch.sh +34 -5
- package/scripts/forge-group.py +496 -0
- package/scripts/forge-groups.py +89 -0
- package/scripts/forge-handoff.py +1128 -0
- package/scripts/forge-lib-group.sh +641 -0
- package/scripts/forge-lib-plans.sh +339 -3
- package/scripts/forge-lib-task.sh +197 -4
- package/scripts/forge-memory.sh +245 -3
- package/scripts/forge-parallel.sh +715 -34
- package/scripts/forge-planner.py +104 -8
- package/scripts/forge-route.py +190 -12
- package/scripts/forge-runs.py +9 -5
- package/scripts/forge-schedule.py +354 -45
- package/scripts/forge-solo.sh +2 -0
- package/scripts/forge-worktrees.py +243 -0
- package/scripts/forge_brief/__init__.py +294 -50
- package/scripts/forge_brief/answers.py +58 -11
- package/scripts/forge_brief/proposals.py +1630 -0
- package/scripts/forge_dataset/efforts.py +4 -3
- package/scripts/forge_dataset/export.py +24 -12
- package/scripts/forge_dataset/facts.py +5 -3
- package/scripts/forge_dataset/forecast.py +8 -18
- package/scripts/forge_dataset/harvest.py +204 -9
- package/scripts/forge_dataset/history.py +11 -6
- package/scripts/forge_dataset/importer.py +65 -1
- package/scripts/forge_dataset/names.py +66 -0
- package/scripts/forge_dataset/reviewers.py +5 -2
- package/scripts/forge_dataset/risk.py +6 -3
- package/scripts/forge_dataset/routing.py +6 -1
- package/scripts/forge_groups/__init__.py +308 -0
- package/scripts/forge_groups/attribute.py +289 -0
- package/scripts/forge_groups/review.py +286 -0
- package/scripts/forge_owner.py +152 -0
- package/scripts/forge_side/__init__.py +12 -7
- package/ui/docs/api.md +173 -17
- package/ui/forge_ui/control.py +361 -2
- package/ui/forge_ui/executions.py +8 -1
- package/ui/forge_ui/export.py +31 -4
- package/ui/forge_ui/groups.py +264 -0
- package/ui/forge_ui/models.py +70 -8
- package/ui/forge_ui/reader.py +262 -19
- package/ui/forge_ui/server.py +4 -0
- package/ui/forge_ui/static/app.js +93 -13
- package/ui/forge_ui/static/briefview.js +350 -47
- package/ui/forge_ui/static/diffview.js +86 -1
- package/ui/forge_ui/static/groupsview.js +332 -0
- package/ui/forge_ui/static/index.html +1 -0
- package/ui/forge_ui/static/panel.js +127 -7
- package/ui/forge_ui/static/projectsview.js +189 -10
- package/ui/forge_ui/static/runmodel.js +14 -3
- package/ui/forge_ui/static/storageview.js +91 -10
- package/ui/forge_ui/static/style.css +79 -5
- package/ui/forge_ui/static/worktreesview.js +233 -12
- package/ui/forge_ui/storage.py +14 -0
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Which task of a plan declares a path.
|
|
3
|
+
|
|
4
|
+
`<plan>/tasks.tsv` is tab-separated `id deps difficulty files dwarf qa title`.
|
|
5
|
+
`files` is a comma list of repo-relative paths or directories; `-` declares
|
|
6
|
+
nothing. A later decision asks this module which task owns a path, and whether
|
|
7
|
+
that path sits outside one task, using the same coverage rule the scheduler
|
|
8
|
+
uses to serialise tasks.
|
|
9
|
+
|
|
10
|
+
python3 scripts/forge_owner.py <plan> <path>... [--task ID]
|
|
11
|
+
"""
|
|
12
|
+
from __future__ import annotations
|
|
13
|
+
|
|
14
|
+
import argparse
|
|
15
|
+
import json
|
|
16
|
+
import os
|
|
17
|
+
from pathlib import Path
|
|
18
|
+
import posixpath
|
|
19
|
+
import sys
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def _rows(plan: str | os.PathLike) -> list[tuple[str, str]]:
|
|
23
|
+
"""`(id, files)` from tasks.tsv, in file order.
|
|
24
|
+
|
|
25
|
+
Comment lines, blank lines and rows with fewer than four columns are
|
|
26
|
+
skipped. A missing tasks.tsv raises FileNotFoundError.
|
|
27
|
+
"""
|
|
28
|
+
text = (Path(plan) / 'tasks.tsv').read_text(encoding='utf-8').replace('\r', '')
|
|
29
|
+
found = []
|
|
30
|
+
for line in text.splitlines():
|
|
31
|
+
if not line or line.startswith('#'):
|
|
32
|
+
continue
|
|
33
|
+
columns = line.split('\t')
|
|
34
|
+
if len(columns) < 4:
|
|
35
|
+
continue
|
|
36
|
+
found.append((columns[0], columns[3]))
|
|
37
|
+
return found
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def _entries(files: str) -> list[str]:
|
|
41
|
+
"""Normalised paths in one files cell. Empty tokens and `-` declare nothing."""
|
|
42
|
+
return [posixpath.normpath(part) for part in files.split(',') if part and part != '-']
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def declared(plan: str | os.PathLike, task: str) -> list[str]:
|
|
46
|
+
"""That task's normalised `files` entries. `[]` for `-` or an unknown task."""
|
|
47
|
+
for ident, files in _rows(plan):
|
|
48
|
+
if ident == task:
|
|
49
|
+
return _entries(files)
|
|
50
|
+
return []
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def covers(entry: str, path: str) -> bool:
|
|
54
|
+
"""Whether one declared entry covers one path. An entry of `.` covers every path."""
|
|
55
|
+
# forge-schedule.py overlap: posixpath.normpath on each side, then equal or a '/' prefix; '.' covers all.
|
|
56
|
+
def piece(value: str) -> str | None:
|
|
57
|
+
if not value or value == '-':
|
|
58
|
+
return None
|
|
59
|
+
return posixpath.normpath(value)
|
|
60
|
+
|
|
61
|
+
left, right = piece(entry), piece(path)
|
|
62
|
+
if left is None or right is None:
|
|
63
|
+
return False
|
|
64
|
+
return (left == '.' or right == '.' or left == right
|
|
65
|
+
or left.startswith(right + '/') or right.startswith(left + '/'))
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def _query(path: str) -> str | None:
|
|
69
|
+
"""Repo-relative form of a path, or None when no task can own it.
|
|
70
|
+
|
|
71
|
+
Strip one leading `./`, then posixpath.normpath. An absolute result, or one
|
|
72
|
+
that starts with `..`, is outside the repository.
|
|
73
|
+
"""
|
|
74
|
+
text = str(path)
|
|
75
|
+
if text.startswith('./'):
|
|
76
|
+
text = text[2:]
|
|
77
|
+
norm = posixpath.normpath(text)
|
|
78
|
+
if posixpath.isabs(norm) or norm.startswith('..'):
|
|
79
|
+
return None
|
|
80
|
+
return norm
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
def owners(plan: str | os.PathLike, path: str) -> list[str]:
|
|
84
|
+
"""Every task id whose `files` cover `path`, in tasks.tsv order."""
|
|
85
|
+
rows = _rows(plan)
|
|
86
|
+
query = _query(path)
|
|
87
|
+
if query is None:
|
|
88
|
+
return []
|
|
89
|
+
found: list[str] = []
|
|
90
|
+
seen: set[str] = set()
|
|
91
|
+
for ident, files in rows:
|
|
92
|
+
if ident in seen:
|
|
93
|
+
continue
|
|
94
|
+
seen.add(ident) # the first row is the task's declaration, as declared() reads it
|
|
95
|
+
if any(covers(entry, query) for entry in _entries(files)):
|
|
96
|
+
found.append(ident)
|
|
97
|
+
return found
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
def owner(plan: str | os.PathLike, path: str) -> str | None:
|
|
101
|
+
"""The first task in tasks.tsv order whose `files` cover `path`, or None."""
|
|
102
|
+
found = owners(plan, path)
|
|
103
|
+
return found[0] if found else None
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
def outside(plan: str | os.PathLike, task: str, path: str) -> bool:
|
|
107
|
+
"""True when none of `task`'s declared entries covers `path`.
|
|
108
|
+
|
|
109
|
+
A task that declares `.` has nothing outside. A task whose `files` is `-`,
|
|
110
|
+
or an unknown task, has everything outside.
|
|
111
|
+
"""
|
|
112
|
+
return not any(covers(entry, path) for entry in declared(plan, task))
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
def _report(plan: str, paths: list[str], task: str | None) -> dict:
|
|
116
|
+
idents = [ident for ident, _files in _rows(plan)]
|
|
117
|
+
if task is not None and task not in idents:
|
|
118
|
+
raise LookupError(task)
|
|
119
|
+
items = []
|
|
120
|
+
for path in paths:
|
|
121
|
+
found = owners(plan, path)
|
|
122
|
+
items.append({
|
|
123
|
+
'path': path,
|
|
124
|
+
'owner': found[0] if found else None,
|
|
125
|
+
'owners': found,
|
|
126
|
+
'outside': outside(plan, task, path) if task is not None else None,
|
|
127
|
+
})
|
|
128
|
+
return {'paths': items}
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
def main(argv: list[str] | None = None) -> int:
|
|
132
|
+
parser = argparse.ArgumentParser(
|
|
133
|
+
prog='forge_owner.py', description='Which task of a plan declares a path.')
|
|
134
|
+
parser.add_argument('plan', help='plan directory containing tasks.tsv')
|
|
135
|
+
parser.add_argument('paths', nargs='+', help='repo-relative paths to look up')
|
|
136
|
+
parser.add_argument('--task', help='also report whether each path is outside this task')
|
|
137
|
+
args = parser.parse_args(argv)
|
|
138
|
+
try:
|
|
139
|
+
report = _report(args.plan, args.paths, args.task)
|
|
140
|
+
except FileNotFoundError:
|
|
141
|
+
print("forge_owner: no tasks.tsv in '%s'" % args.plan, file=sys.stderr)
|
|
142
|
+
return 2
|
|
143
|
+
except LookupError as error:
|
|
144
|
+
print("forge_owner: unknown task '%s'" % error, file=sys.stderr)
|
|
145
|
+
return 2
|
|
146
|
+
json.dump(report, sys.stdout)
|
|
147
|
+
sys.stdout.write('\n')
|
|
148
|
+
return 0
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
if __name__ == '__main__':
|
|
152
|
+
sys.exit(main())
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"""Whether a side dispatch (a brief or a task summary) may run, and running it.
|
|
1
|
+
"""Whether a side dispatch (a brief, a brief change or a task summary) may run, and running it.
|
|
2
2
|
|
|
3
3
|
Retro, brief mode and generated summaries are opt-in. `settings(plan)` resolves the
|
|
4
4
|
effective choice for one plan dir. `allowed` says whether one dispatch may go out.
|
|
@@ -17,6 +17,9 @@ Precedence for each switch, first match wins:
|
|
|
17
17
|
4. Off. `brief_scope` defaults to `task`. An env var forces the switch off and leaves
|
|
18
18
|
the resolved scope and model in place.
|
|
19
19
|
|
|
20
|
+
A `brief-change` dispatch (a wave-scoped proposal, #136) follows the brief settings: the same
|
|
21
|
+
level, `FORGE_BRIEF=off`, model, `never-send` floor and its own cap.
|
|
22
|
+
|
|
20
23
|
`allowed` refuses with `env`, `off`, `never-send` (the plan repo's privacy floor),
|
|
21
24
|
`no-model` or `cap`, in that order. For a summary, `tasks/<task>/summaries` (`on` or
|
|
22
25
|
`off`) overrides the plan's mode and nothing else. The cap is
|
|
@@ -40,7 +43,9 @@ from forge_decide.providers import privacy_floor
|
|
|
40
43
|
SCRIPTS = Path(__file__).resolve().parent.parent
|
|
41
44
|
DISPATCH = SCRIPTS / 'forge-dispatch.sh'
|
|
42
45
|
|
|
43
|
-
KINDS = ('brief', 'summary')
|
|
46
|
+
KINDS = ('brief', 'brief-change', 'summary')
|
|
47
|
+
# Kinds that follow the brief settings: `FORGE_BRIEF=off`, the plan's brief level and brief model.
|
|
48
|
+
BRIEF_KINDS = ('brief', 'brief-change')
|
|
44
49
|
ON_OFF = ('off', 'on')
|
|
45
50
|
BRIEF_LEVELS = ('off', 'advisory', 'gated', 'strict')
|
|
46
51
|
BRIEF_SCOPES = ('task', 'wave', 'plan')
|
|
@@ -283,19 +288,19 @@ def _allocate(plan: Path, kind: str, task: str) -> Path:
|
|
|
283
288
|
|
|
284
289
|
|
|
285
290
|
def allowed(kind, plan, task=None):
|
|
286
|
-
"""`(ok, reason)` for a `brief` or `summary` dispatch. `reason` is None when it may run.
|
|
291
|
+
"""`(ok, reason)` for a `brief`, `brief-change` or `summary` dispatch. `reason` is None when it may run.
|
|
287
292
|
|
|
288
293
|
Reasons, in the order they are decided: `env`, `off`, `never-send`, `no-model`, `cap`.
|
|
289
294
|
"""
|
|
290
295
|
if kind not in KINDS:
|
|
291
|
-
raise ValueError('kind must be brief or summary, not %r' % (kind,))
|
|
296
|
+
raise ValueError('kind must be brief, brief-change or summary, not %r' % (kind,))
|
|
292
297
|
plan = Path(plan)
|
|
293
|
-
if kind
|
|
298
|
+
if kind in BRIEF_KINDS and _env_off('FORGE_BRIEF'):
|
|
294
299
|
return False, 'env'
|
|
295
300
|
if kind == 'summary' and _env_off('FORGE_SUMMARIES'):
|
|
296
301
|
return False, 'env'
|
|
297
302
|
found = settings(plan)
|
|
298
|
-
if kind
|
|
303
|
+
if kind in BRIEF_KINDS:
|
|
299
304
|
on = found['brief']['level'] in ('advisory', 'gated', 'strict')
|
|
300
305
|
model = found['brief']['model']
|
|
301
306
|
else:
|
|
@@ -405,7 +410,7 @@ def run(kind, plan, task, prompt, spec, timeout=900) -> dict:
|
|
|
405
410
|
stops the dispatch's session, including a preflight that has not exited.
|
|
406
411
|
"""
|
|
407
412
|
if kind not in KINDS:
|
|
408
|
-
raise ValueError('kind must be brief or summary, not %r' % (kind,))
|
|
413
|
+
raise ValueError('kind must be brief, brief-change or summary, not %r' % (kind,))
|
|
409
414
|
plan = Path(plan)
|
|
410
415
|
if not _safe_component(task):
|
|
411
416
|
return _finish(plan, task, kind, spec, False, None, None, 'error')
|
package/ui/docs/api.md
CHANGED
|
@@ -55,6 +55,18 @@ written), and the reader must never raise because of one.
|
|
|
55
55
|
| `summaries`, `summaries_model` | the run's task-summary switch (`on` or `off`; absent is `off`) and its model spec, from `forge control set summaries`; returned as `summaries`, see RunDetail |
|
|
56
56
|
| `profile.json` | the profile the run froze: `name`, `level` (`user`, `repo` or `builtin`), `body` (the profile object), `shadowed` (levels the winning copy hid), `frozen_at` (UTC, `YYYY-MM-DDTHH:MM:SSZ`), `overridden` (the sorted dotted keys a flag of the run replaced, such as `routing.qa.any`; empty when none). RunDetail returns `settings.profile` `{name, level, overridden}`, `null` when the file is absent, unreadable or not that shape |
|
|
57
57
|
| `deferrals.txt` | one line per task the wave planner deferred |
|
|
58
|
+
| `groups.tsv` | tab-separated, 6 columns: `id review qa members title goal`. `#` lines and blank lines are skipped. `id` matches `[a-z0-9][a-z0-9-]{0,39}`. `review` is `task` or `group`. `qa` is a model spec or `-`. `members` is a comma list of task ids or `-`. `-` in any cell reads as `null`. A row with a bad id, or a repeated id, is skipped with a warning; the first copy of an id wins. Returned as RunDetail `groups` only when this file exists |
|
|
59
|
+
| `groups/<gid>/status` | one word, for a `review=group` group: `REVIEWING PASS FAIL NEEDS_DECISION UNKNOWN CONFLICT INFRA TIMEOUT ERROR INVALIDATED WAITING INTERRUPTED`. Any other word is kept as written |
|
|
60
|
+
| `groups/<gid>/round` | the current round, an integer |
|
|
61
|
+
| `groups/<gid>/merged` | exists when the group's review was merged |
|
|
62
|
+
| `groups/<gid>/rounds.tsv` | `round<TAB>epoch<TAB>status<TAB>implicated<TAB>reviewer` per line. `implicated` is a comma list of task ids or `-`. A row whose round or epoch does not parse is warned and skipped |
|
|
63
|
+
| `groups/<gid>/members.tsv` | `round<TAB>task<TAB>commit<TAB>attempt` per line: who was in each round. Returned on the group detail as `members_by_round` |
|
|
64
|
+
| `groups/<gid>/attribution.json` | `{round, findings: [{n, severity, status, file, line, tasks, blocking, ambiguous}], implicated, ambiguous}`, and `blocking` when it is a boolean. Returned as `attribution` |
|
|
65
|
+
| `groups/<gid>/decision.md` | the group's decision; the detail keeps its first line |
|
|
66
|
+
| `groups/<gid>/qa.last`, `qa.gate`, `known_issues.md` | the group's review, as a task's: the reply, the gate line, the tolerated findings. `qa.last` and `known_issues.md` are returned on the group detail |
|
|
67
|
+
| `groups/<gid>/candidate.base`, `candidate.commit` | one commit each: the base the group reviewed and the candidate it reviewed. Returned as `candidate` `{base, commit}` |
|
|
68
|
+
| `groups/<gid>/qa.input`, `qa.out`, `qa.log` (or `.gz`), `qa.clock` | the group's QA dispatch, sitting in the group dir as a task's sit in its task dir |
|
|
69
|
+
| `groups/<gid>/attempts/qa-<uuid>/` | that dispatch's execution, the same dir a task's QA dispatch writes |
|
|
58
70
|
| `retro.md`, `retro/notes.jsonl` | written when retro mode is on: the report (Markdown) and one JSON note per line (`fixable_by` `user`, `forge` or `unsure`, `check` `verified` or `claimed`, `blocking` a boolean). Returned as `retro`, see RunDetail |
|
|
59
71
|
| `integration.base`, `accepted.integration` | one commit each: where the integration branch started, the revision the run accepted |
|
|
60
72
|
| `attempts/<role>-<uuid>/` | one *execution* (below) of the run itself: `parallel` (a `run`) or `verification` |
|
|
@@ -62,7 +74,7 @@ written), and the reader must never raise because of one.
|
|
|
62
74
|
| `final-review` | a symlink to the newest *published* review dir; `final-review.verdict` a copy of its verdict |
|
|
63
75
|
| `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 |
|
|
64
76
|
| `tasks/<id>/merged` | exists when the task was merged; its mtime is when |
|
|
65
|
-
| `tasks/<id>/status` | one word: `RUNNING PASS FAIL ERROR INFRA TIMEOUT UNKNOWN INVALIDATED BLOCKED INTERRUPTED NOCHANGES CONFLICT NEEDS_INPUT NEEDS_DECISION` |
|
|
77
|
+
| `tasks/<id>/status` | one word: `RUNNING PASS FAIL ERROR INFRA TIMEOUT UNKNOWN INVALIDATED BLOCKED INTERRUPTED NOCHANGES CONFLICT NEEDS_INPUT NEEDS_DECISION IMPLEMENTED`. `IMPLEMENTED` means the member's own work is in and it is waiting for its group's review |
|
|
66
78
|
| `tasks/<id>/attempt` | the current attempt number |
|
|
67
79
|
| `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 |
|
|
68
80
|
| `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` |
|
|
@@ -119,7 +131,14 @@ Only the transcript, checks and environment endpoints open an execution's `.log`
|
|
|
119
131
|
running one's log for its `now`; no read opens a `.cmd`.
|
|
120
132
|
|
|
121
133
|
**Task status** is `MERGED` if `tasks/<id>/merged` exists, otherwise the first word of
|
|
122
|
-
`tasks/<id>/status`, otherwise `PENDING`.
|
|
134
|
+
`tasks/<id>/status`, otherwise `PENDING`. `IMPLEMENTED` is a waiting status: the work is in,
|
|
135
|
+
and the task is awaiting its group's review. It is not done, not active and not failed, and a
|
|
136
|
+
task that depends on one waits on it (it is not a stopped dependency). `status_class` in
|
|
137
|
+
`reader.py` returns `waiting` for it, as it does for `NEEDS_INPUT` and `NEEDS_DECISION`.
|
|
138
|
+
`_waiting` uses that class for a dependency: `done` (`MERGED` only) drops it from `on`,
|
|
139
|
+
`failed` (the stopped statuses, `NOCHANGES` included) puts it in `stopped`, and `waiting`
|
|
140
|
+
leaves it in `on` only. `PASS` is neither: it is saved and not merged yet, so a dependent
|
|
141
|
+
still lists it.
|
|
123
142
|
|
|
124
143
|
Only the ids listed in `tasks.tsv` are tasks: `tasks/` may also hold forge's own dirs (e.g.
|
|
125
144
|
`tasks/_integration/`), and a task dir holds many other files (`attempts/` is a directory of
|
|
@@ -186,6 +205,7 @@ def discover(plans=(), roots=(), registry=True, registry_dir=None) -> list[tuple
|
|
|
186
205
|
def summarize(path, source='plan') -> dict # a RunSummary, below
|
|
187
206
|
def detail(path, source='plan') -> dict # a RunDetail, below
|
|
188
207
|
def task_detail(path, task_id, source='plan') -> dict | None # a TaskDetail
|
|
208
|
+
def group_detail(path, gid, source='plan') -> dict | None # a Group, or None
|
|
189
209
|
def execution_detail(path, name, source='plan') -> dict | None # an ExecutionDetail
|
|
190
210
|
def final_review_detail(path, name, source='plan') -> dict | None # a FinalReviewDetail
|
|
191
211
|
def task_diff(path, task_id, which='current', source='plan') -> dict | None # a DiffDetail
|
|
@@ -208,6 +228,7 @@ class Catalog:
|
|
|
208
228
|
def get(self, key) -> dict | None # RunDetail for that run_key, or None
|
|
209
229
|
def identity(self, key) -> dict | None # {root, worktree, branch, source} of that run; None for an unknown key
|
|
210
230
|
def task(self, key, task_id) -> dict | None
|
|
231
|
+
def group(self, key, gid) -> dict | None # a Group, or None for an unknown gid or a gid that cannot name one
|
|
211
232
|
def execution(self, key, name) -> dict | None
|
|
212
233
|
def final_review(self, key, name) -> dict | None
|
|
213
234
|
def diff(self, key, task_id, which='current'), execution_diff(self, key, name),
|
|
@@ -254,6 +275,7 @@ its last 20,000 behind a leading `…`. Their `truncated` lists the field names
|
|
|
254
275
|
| `GET /api/runs` | `200 {"runs": [RunSummary, ...]}` |
|
|
255
276
|
| `GET /api/runs/<key>` | `200 RunDetail`, or `404 {"error": "not found"}` |
|
|
256
277
|
| `GET /api/runs/<key>/tasks/<id>` | `200 TaskDetail`; `<id>` is percent-decoded (strict UTF-8) and must be a `tasks.tsv` id (`solo` for a solo run). An id that decodes to `/`, NUL, U+FFFD, `.` or `..` is a 404 without a read |
|
|
278
|
+
| `GET /api/runs/<key>/groups/<gid>` | `200 Group`; `<gid>` matches `[a-z0-9][a-z0-9-]{0,39}`. An unknown gid, a gid outside that pattern, or an unknown run is `404 {"error": "not found"}` |
|
|
257
279
|
| `GET /api/runs/<key>/executions/<role>-<uuid>` | `200 ExecutionDetail` |
|
|
258
280
|
| `GET /api/runs/<key>/final-reviews/<name>` | `200 FinalReviewDetail`; `<name>` is `final-review-<e>-<p>` or `integrate-<e>-<p>` |
|
|
259
281
|
| `GET /api/runs/<key>/tasks/<id>/diff[/<which>]` | `200 DiffDetail`; `<which>` is `current` (the default: `changes.diff`), `prev`, `committed` (plan tasks), `existing` (solo) |
|
|
@@ -280,6 +302,10 @@ its last 20,000 behind a leading `…`. Their `truncated` lists the field names
|
|
|
280
302
|
| `POST /api/runs/<key>/issues` | file GitHub issues for chosen findings; authenticated, 300 s timeout |
|
|
281
303
|
| `POST /api/runs/<key>/issues/dismiss` | dismiss or (`undo`) restore findings; authenticated |
|
|
282
304
|
| `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` |
|
|
305
|
+
| `POST /api/runs/<key>/tasks/<id>/answer` | answer a task that waits for input (`forge control retry … --answer-file -`); authenticated, see Controls |
|
|
306
|
+
| `POST /api/worktrees/remove` | remove chosen worktrees (`forge worktrees rm`); authenticated, 900 s timeout |
|
|
307
|
+
| `POST /api/projects/<id>/memories/forget` | forget learnings in a project's checkouts (`forge memory forget`); authenticated |
|
|
308
|
+
| `POST /api/storage/compact` | compact one run or all (`forge runs compact --logs`); authenticated, 900 s timeout |
|
|
283
309
|
| `GET /api/models/reviewers` | `200` the `forge dataset reviewers --json` report (how each reviewer's PASSed work held up); no parameters |
|
|
284
310
|
| `GET /api/projects` | `200 {projects: [ProjectRow]}`: one row per repository (see Projects) |
|
|
285
311
|
| `GET /api/projects/<id>` | `200 Project`, `404` for an unknown id |
|
|
@@ -298,15 +324,16 @@ its last 20,000 behind a leading `…`. Their `truncated` lists the field names
|
|
|
298
324
|
| `GET /<name>` | that file from `forge_ui/static/` (`.html .js .css .svg` only, no subdirs) |
|
|
299
325
|
| anything else | `404 {"error": "not found"}` (an unknown path or run); a method a path does not take (PUT, DELETE, OPTIONS, a POST to a read path): `405` with `Allow`, except that a GET to a path that only takes POST (`/api/runs/<key>/delete`, `/api/runs/<key>/issues/dismiss`) answers `404` |
|
|
300
326
|
|
|
301
|
-
The lazy endpoints answer `404 {"error": "not found"}` for an unknown run, task,
|
|
327
|
+
The lazy endpoints answer `404 {"error": "not found"}` for an unknown run, task, group,
|
|
302
328
|
execution or review; the diff endpoints also for a `<which>` the run kind has not (`existing`
|
|
303
329
|
of a plan task, `prev` of a solo run), the diff and transcript endpoints for an execution that is
|
|
304
330
|
not `qa` or `dwarf`; the
|
|
305
331
|
Fractal node endpoints for an unknown node or a task whose Fractal state is not `available`. A
|
|
306
332
|
diff that is not there yet is a `200` with `available: false`. An execution is looked for only where executions are written:
|
|
307
333
|
`attempts/`, `tasks/<id>/attempts/`, `shadow/<id>/<a>-<k>/attempts/`,
|
|
308
|
-
`final-review-*/attempts
|
|
309
|
-
that resolves outside the run dir (a symlinked `attempts/`, say) is ignored.
|
|
334
|
+
`final-review-*/attempts/`, `integrate-*/final-review/attempts/` and `groups/<gid>/attempts/`,
|
|
335
|
+
in that order; a dir that resolves outside the run dir (a symlinked `attempts/`, say) is ignored.
|
|
336
|
+
A group's QA dispatch is the last of those, so a task execution of the same id is still found first. The verification
|
|
310
337
|
log endpoints answer `404` for a solo run, a `<lane>` not matching `[A-Za-z0-9][A-Za-z0-9_-]{0,63}`
|
|
311
338
|
(so no `..`), a `<k>` or `<n>` that is not a positive decimal without a leading zero, and a log
|
|
312
339
|
that is missing, a symlink or not a regular file.
|
|
@@ -577,6 +604,12 @@ Every RunSummary field, plus:
|
|
|
577
604
|
- `waves` comes from `waves.tsv` (index 0 is wave 1); `[]` when it is missing. A solo run's
|
|
578
605
|
`waves` is `[["solo"]]`.
|
|
579
606
|
- `tasks` keeps the order of `tasks.tsv`. A solo run has one task, described below.
|
|
607
|
+
- `groups` is present only when `groups.tsv` exists: one Group summary per row, in file order
|
|
608
|
+
(Group, below). Each task then also has `group`, the id of the group that lists it, or `null`
|
|
609
|
+
when it is in none. A task listed in two groups takes the first group in the file. A plan with
|
|
610
|
+
no `groups.tsv` has neither key, on the run or on a task, so that run JSON is unchanged. An
|
|
611
|
+
empty `groups.tsv` still exists: `groups` is `[]` and every task's `group` is `null`. A solo
|
|
612
|
+
run has neither key.
|
|
580
613
|
- `warnings` names every file or line the reader skipped as malformed. Missing files are
|
|
581
614
|
not warnings.
|
|
582
615
|
|
|
@@ -772,8 +805,9 @@ Every RunSummary field, plus:
|
|
|
772
805
|
not a scheduler runs); else, while `scheduler.live` is true, for a `PENDING` or `INFRA` task:
|
|
773
806
|
`infra` (a pause in `scheduler.pauses` holds it: scope `all`, or its id in `tasks`; the pause's
|
|
774
807
|
keys plus `kind`), then for a `PENDING` task `deps` (`on`: its deps not merged, `stopped`: those
|
|
775
|
-
in a stopped status such as `FAIL`; a dep at `NEEDS_INPUT
|
|
776
|
-
|
|
808
|
+
in a stopped status such as `FAIL` or `NOCHANGES`; a dep at `NEEDS_INPUT`, `NEEDS_DECISION` or
|
|
809
|
+
`IMPLEMENTED` is in `on` only — the first two wait for the user, `IMPLEMENTED` waits for the group's
|
|
810
|
+
review, and none of them is a stopped dependency), `stopping` (`mode`), `drained`, `brief` (`questions`: a gated
|
|
777
811
|
plan holds it for the ids of its `must_answer` questions with no entry in `brief.answers.json`, or `[]`
|
|
778
812
|
while `brief.json` is not written yet and `brief.pid` names a running process; the same two files
|
|
779
813
|
`forge-schedule.py` reads), `overlap` (`on`: running
|
|
@@ -835,6 +869,75 @@ and `retry_sources.tsv` are read from the run directory (next to `attempts.tsv`)
|
|
|
835
869
|
empty, so a later attempt whose dwarf changed is `unknown` unless a retry source or a queued retry
|
|
836
870
|
explains it. `goal` and `criteria` are capped as `tasks/solo/goal` and `tasks/solo/criteria`.
|
|
837
871
|
|
|
872
|
+
## Group
|
|
873
|
+
|
|
874
|
+
`GET /api/runs/<key>/groups/<gid>` returns one group. `<gid>` matches
|
|
875
|
+
`[a-z0-9][a-z0-9-]{0,39}`. An unknown gid, a gid outside that pattern, or an unknown run is
|
|
876
|
+
`404 {"error": "not found"}`. A plan with no such group, including a solo run, is the same 404.
|
|
877
|
+
|
|
878
|
+
RunDetail `groups` (only when `groups.tsv` exists) lists the summary, in file order. A
|
|
879
|
+
`review=task` summary is identity and goal only. A `review=group` summary also carries the
|
|
880
|
+
review state. `-` in a cell is `null`. `members` is a list of task ids, or `null` for `-` or an
|
|
881
|
+
empty cell.
|
|
882
|
+
|
|
883
|
+
```json
|
|
884
|
+
{"id": "ship", "review": "group", "qa": "opus", "members": ["reader", "page"],
|
|
885
|
+
"title": "Ship the reader", "goal": "Land it together",
|
|
886
|
+
"status": "PASS", "round": 2, "merged": true, "implicated": null, "decision": "Accepted",
|
|
887
|
+
"rounds": [{"round": 1, "epoch": 1760601000.0, "status": "FAIL", "implicated": ["reader"], "reviewer": "opus"},
|
|
888
|
+
{"round": 2, "epoch": 1760602000.0, "status": "PASS", "implicated": null, "reviewer": "opus"}]}
|
|
889
|
+
```
|
|
890
|
+
|
|
891
|
+
- `status` is the first word of `groups/<gid>/status`, or `null` when that file is missing. `round`
|
|
892
|
+
is the integer in `round`, or `null`. `merged` is whether `merged` exists.
|
|
893
|
+
- `rounds` comes from `rounds.tsv`. `implicated` on the summary is the last parsed round's
|
|
894
|
+
`implicated` (`null` for `-`, or when there is no round). `decision` is the first line of
|
|
895
|
+
`decision.md`, or `null`. A row with a round or epoch that does not parse is warned and skipped.
|
|
896
|
+
- A `review` other than `task` or `group` is warned and the row is still returned, without the
|
|
897
|
+
review-state fields. `review` of `-` is `null` and warned the same way. A bad id and a repeated id are warned and skipped; the first copy wins.
|
|
898
|
+
Missing files are `null` or `[]` or `false`, not warnings. Nothing in a malformed file raises.
|
|
899
|
+
|
|
900
|
+
The group endpoint returns that summary plus the review itself:
|
|
901
|
+
|
|
902
|
+
```json
|
|
903
|
+
{"attribution": {"round": 2, "findings": [
|
|
904
|
+
{"n": 1, "severity": "P1", "status": "CONFIRMED", "file": "ui/reader.py", "line": 42,
|
|
905
|
+
"tasks": ["reader"], "blocking": true, "ambiguous": false}],
|
|
906
|
+
"implicated": ["reader"], "ambiguous": [1], "blocking": true},
|
|
907
|
+
"members_by_round": [{"round": 1, "members": [
|
|
908
|
+
{"task": "reader", "commit": "abc123", "attempt": 1}]}],
|
|
909
|
+
"qa_last": "FORGE_VERDICT: PASS\n", "known_issues": null,
|
|
910
|
+
"candidate": {"base": "aaaaaaaa", "commit": "bbbbbbbb"},
|
|
911
|
+
"execution": {"id": "qa-…", "role": "qa", "state": "done"},
|
|
912
|
+
"warnings": [], "truncated": []}
|
|
913
|
+
```
|
|
914
|
+
|
|
915
|
+
- `attribution` is `attribution.json`, or `null` when the file is missing or its `findings` is not
|
|
916
|
+
a list (warned: `not an attribution`). Each finding keeps `n`, `severity`, `status`, `file`,
|
|
917
|
+
`line`, `tasks`, `blocking` and `ambiguous`. A finding that is not an object is skipped. A value
|
|
918
|
+
of the wrong type is warned and replaced (`n` falls back to its 1-based index, `line` to `null`,
|
|
919
|
+
`tasks` to `[]`, the flags to `false`). `implicated` is a list of ids and `ambiguous` a list of
|
|
920
|
+
finding numbers, `[]` when absent or the wrong type. Top-level `blocking` is kept only when it
|
|
921
|
+
is a boolean.
|
|
922
|
+
- `members_by_round` groups `members.tsv` by round, in file order. `-` for `commit` or `attempt`
|
|
923
|
+
is `null`. A row with no round or no task is warned and skipped; an attempt that is not an
|
|
924
|
+
integer is warned and kept as `null`.
|
|
925
|
+
- `qa_last` and `known_issues` use the bounded reader TaskDetail's texts and a final review's
|
|
926
|
+
`qa.last` use: the first 20,000 and last 8,000 characters, the cut named in `truncated`
|
|
927
|
+
(`qa_last`, `known_issues`). A missing file is `null`.
|
|
928
|
+
- `candidate` is the first line of `candidate.base` and `candidate.commit`, with `-` as `null`.
|
|
929
|
+
- `execution` is the group's QA dispatch: the newest `qa` execution in
|
|
930
|
+
`groups/<gid>/attempts/`, built by the same reader a task's QA dispatch uses, or `null` when
|
|
931
|
+
there is none. It is `running` only while `groups/<gid>/status` is `REVIEWING`; any other
|
|
932
|
+
unfinished dispatch is `orphaned`. The execution and transcript endpoints open it with
|
|
933
|
+
`owner` `{"kind": "group", "id": "<gid>"}`, and while it runs they read the group dir's
|
|
934
|
+
`qa.delivered`, `qa.prompt` and `qa.input` the way a task's owner dir is read.
|
|
935
|
+
- `warnings` and `truncated` are that read's. A warning is kept when its file is under
|
|
936
|
+
`groups/<gid>/` (this group's rounds, members, attribution and review dispatch). A malformed
|
|
937
|
+
`groups.tsv` row, and another group's files, are warnings of the run read, not of this group.
|
|
938
|
+
`truncated` names the texts this read cut (`qa_last`, `known_issues`). A `review=task` group
|
|
939
|
+
has the same detail fields; with no review dir they are `null` or `[]`, and `warnings` is `[]`.
|
|
940
|
+
|
|
838
941
|
## Execution
|
|
839
942
|
|
|
840
943
|
```json
|
|
@@ -859,8 +962,8 @@ explains it. `goal` and `criteria` are capped as `tasks/solo/goal` and `tasks/so
|
|
|
859
962
|
and it is the newest execution of its role in its dir, else `orphaned`. The owner is live
|
|
860
963
|
when: the task's status is `RUNNING` (task executions and their children); the solo
|
|
861
964
|
status is `RUNNING`; a shadow has no `shadow.status`; a final review's `state` is
|
|
862
|
-
`running`;
|
|
863
|
-
whose parent is not `running` is `orphaned`.
|
|
965
|
+
`running`; a group's `status` is `REVIEWING` (its QA dispatch); always, for the run's own
|
|
966
|
+
`parallel` and `verification`. A `dwarf` or `qa` whose parent is not `running` is `orphaned`.
|
|
864
967
|
- `parent`: for `dwarf` and `qa`, the `task` (or `solo`) execution `dataset.json` names, else
|
|
865
968
|
the latest one whose run (`started` to `ended`, open while unfinished) contains this
|
|
866
969
|
start, else `null`. `task`, `solo`, `parallel` and `verification` have no parent.
|
|
@@ -981,8 +1084,8 @@ ExecutionDetail: the Execution, plus `resolved` (every `key=value` of `<role>.re
|
|
|
981
1084
|
`<role>.prompt` copy; while running without one, the owner dir's `<role>.delivered`, then
|
|
982
1085
|
`.prompt`, then `.input`), `last` (the `<role>.last` copy), `findings` (a list of Findings for
|
|
983
1086
|
a finished `qa`, else `null`, in place of the summary), `owner`
|
|
984
|
-
(`{"kind": "task" | "shadow" | "final_review" | "run", "id": ...}`: the task id (`solo` for a
|
|
985
|
-
solo run), `<task>/<attempt>-<k>`, the review name, or `null`), `truncated` and `warnings`.
|
|
1087
|
+
(`{"kind": "task" | "shadow" | "final_review" | "run" | "group", "id": ...}`: the task id (`solo` for a
|
|
1088
|
+
solo run), `<task>/<attempt>-<k>`, the review name, the group id, or `null`), `truncated` and `warnings`.
|
|
986
1089
|
|
|
987
1090
|
FinalReviewDetail: the FinalReviewSummary, plus `meta` (every `review.meta` key),
|
|
988
1091
|
`tasks_summary`, `qa_input`, `qa_last`, `known_issues` (texts or `null`), `findings` (a list
|
|
@@ -1403,16 +1506,17 @@ difficulty paths deps model` each), `decomposition_history` (its newest 20, each
|
|
|
1403
1506
|
|
|
1404
1507
|
- It holds `style.css` (with the labels' face, `D-DINCondensed-Bold.woff2`, inlined as a `data:`
|
|
1405
1508
|
URL) and the classic scripts the run view uses (`theme.js icons.js datatable.js shell.js
|
|
1406
|
-
runmodel.js cloudmodel.js graph.js gantt.js verifyview.js checksview.js
|
|
1407
|
-
map3d.js search.js app.js`), inline; the import map; a `<script type="application/json" id="forge-snapshot">` with
|
|
1509
|
+
runmodel.js cloudmodel.js graph.js gantt.js verifyview.js checksview.js briefview.js groupsview.js
|
|
1510
|
+
panel.js diffview.js convo.js files.js map3d.js search.js app.js`), inline; the import map; a `<script type="application/json" id="forge-snapshot">` with
|
|
1408
1511
|
`{meta, api}`; and a `<script type="text/plain" id="forge-stage">` holding `iso.js`,
|
|
1409
1512
|
`cloud3d.js`, `findings3d.js`, `stagectl.js` and `scene3d.js` bundled into one module (each
|
|
1410
1513
|
module in its own scope, relative imports bound to the earlier ones' exports, `createStage`
|
|
1411
1514
|
exported), which `map3d.js` imports from a `blob:` URL.
|
|
1412
1515
|
- `api` maps each path the page requests to that endpoint's response as the server would answer
|
|
1413
1516
|
it (server.api_get): `/api/runs` (this run only), the RunDetail, every TaskDetail, every
|
|
1414
|
-
ExecutionDetail the RunDetail names, every FinalReviewDetail, Files, RunFindings, and the
|
|
1415
|
-
Fractal trees and nodes.
|
|
1517
|
+
Group detail, every ExecutionDetail the RunDetail or a Group names, every FinalReviewDetail, Files, RunFindings, and the
|
|
1518
|
+
Fractal trees and nodes. A script named above whose file is not in `forge_ui/static/` yet is left out,
|
|
1519
|
+
so `groupsview.js` can be listed before the group page adds it. With `texts=1` also every diff the page can open (each task's diff and its `sources`,
|
|
1416
1520
|
each final review's, each Fractal node's), every `dwarf` and `qa` ExecutionTranscript (at most 2 MB each)
|
|
1417
1521
|
and ExecutionChecks, every TaskChecks, the RunEnvironment,
|
|
1418
1522
|
and the VerificationLog tail of `verification.log`, of each lane's log and of each lane run's log
|
|
@@ -1422,6 +1526,9 @@ difficulty paths deps model` each), `decomposition_history` (its newest 20, each
|
|
|
1422
1526
|
planning_last approach retry_findings needs_input dwarf_input error last_line message excerpt tail lines call split detail`.
|
|
1423
1527
|
Under each brief `questions` or `parked` entry it also nulls `why`, `options`, `default` and `answer`
|
|
1424
1528
|
(`scope`, `state`, `id`, `must_answer` and `possibly_stale` stay; a late answer's `text` is in the list above).
|
|
1529
|
+
Under each group, on RunDetail `groups` and on `GET …/groups/<gid>`, it nulls `goal` and `decision`
|
|
1530
|
+
(the planner's line and the first line of `decision.md`). The run's own `goal` stays, and so does a
|
|
1531
|
+
group's `title`. A task's `decision` object stays, with its `text` nulled by the list above.
|
|
1425
1532
|
It 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`.
|
|
1426
1533
|
- `paths=0` (the default) makes every string that is a whole absolute path (but `/api/…`, `url`s
|
|
1427
1534
|
and `command`s) its last component, and replaces the run dir, the repo and the home dir inside other
|
|
@@ -1449,7 +1556,7 @@ each authenticated POST to the table, so a new write route is one entry in it.
|
|
|
1449
1556
|
|
|
1450
1557
|
**The call.** `[<forge root>/forge, ...]`, an argv list with no shell, in a process
|
|
1451
1558
|
group of its own. `stdin` is closed, except for a profile create or edit (the profile object) and a
|
|
1452
|
-
brief answer (the answer text), both via `--file
|
|
1559
|
+
brief answer (the answer text), both via `--file -`, and a task answer (its text, via `--answer-file -`). `<forge root>` is two directories above `forge_ui/` and can be replaced as
|
|
1453
1560
|
`forge_ui.server.forge_cli`. A call that outlives its timeout (60 s) gets SIGTERM for its whole
|
|
1454
1561
|
group, SIGKILL 5 s later if anything is left, and is reaped, all before the run's lock is
|
|
1455
1562
|
released; the answer is `504 {"error": "timeout", "detail": "the operation may have partly
|
|
@@ -1641,6 +1748,51 @@ deletion) `500`. Deletion holds the run's write lock and a server-wide lock on t
|
|
|
1641
1748
|
directory (`409 busy` when either is held). The run key is looked up again under the lock, and
|
|
1642
1749
|
once the directory is gone every later request for that key is `404`. Timeout 900 s.
|
|
1643
1750
|
|
|
1751
|
+
### `POST /api/worktrees/remove`
|
|
1752
|
+
|
|
1753
|
+
Body: `{"paths": [string, 1 to 200], "branches": bool (false), "dry_run": bool (false)}`. Every path
|
|
1754
|
+
is absolute, has no control characters and is a row of `GET /api/worktrees`: the cached rows are
|
|
1755
|
+
checked and, when a path is missing, read once again. A path that is not listed is `400`. Runs
|
|
1756
|
+
`worktrees rm <paths…> [--branches] [--dry-run] --json --actor ui` and answers with its object
|
|
1757
|
+
(`ok`, `dry_run`, `rows: [{path, action, status, reason}]`, status `removed`, `skipped`, `failed` or
|
|
1758
|
+
`would-remove`). Exit 4 (a row failed) is a `200` with `ok: false` and the rows, so the page can say
|
|
1759
|
+
which row failed; exit 2 `400`, exit 3 `409`. A server-wide lock (`409 {"error": "busy"}`) covers
|
|
1760
|
+
the call; timeout 900 s. After a real removal (not `dry_run`) the worktrees and storage caches are
|
|
1761
|
+
dropped, so the next `GET` reads again. Refused under `--read-only` (`405`) and without the token.
|
|
1762
|
+
|
|
1763
|
+
### `POST /api/projects/<id>/memories/forget`
|
|
1764
|
+
|
|
1765
|
+
Body: `{"keys": [string "category:key", 1 to 200], "dry_run": bool (false), "path": string}`. The
|
|
1766
|
+
project is `<id>` of `GET /api/projects` (`404` when unknown). Without `path` the call runs in every
|
|
1767
|
+
checkout of the project that exists; `path` must be one of them (`400` otherwise). Runs `memory
|
|
1768
|
+
forget <checkout> <keys…> [--dry-run] --json --actor ui` once per checkout and answers `200
|
|
1769
|
+
{"ok", "dry_run", "checkouts": [{"path", "result"}]}`, `result` being that CLI's object. A checkout
|
|
1770
|
+
whose call failed has `result: null` plus `status` and `error` (the mapped answer), and `ok` is
|
|
1771
|
+
false; when every checkout failed the first failure is the answer. A project with no existing
|
|
1772
|
+
checkout is `409`. A server-wide lock (`409 busy`); timeout 60 s per checkout. A real forget drops
|
|
1773
|
+
the project screen's memory answers. Refused under `--read-only` and without the token.
|
|
1774
|
+
|
|
1775
|
+
### `POST /api/storage/compact`
|
|
1776
|
+
|
|
1777
|
+
Body: `{"run": "<12-hex run key>"}` or `{"all": true}` (exactly one), and `"dry_run": bool (false)`.
|
|
1778
|
+
Runs `runs compact <run dir> --logs --json [--dry-run]`, or `runs compact --all --logs --json
|
|
1779
|
+
[--dry-run]`, and answers with its object (`ok`, `dry_run`, `bytes_freed`, `runs`). An unknown run
|
|
1780
|
+
key is `404`. Exit 2 `400`; exit 3 (the named run is active) `409` with the CLI's message; exit 4
|
|
1781
|
+
`500`. A server-wide lock (`409 {"error": "busy"}`); timeout 900 s. A real compaction marks the
|
|
1782
|
+
`GET /api/storage` answer stale, so the next read measures again. Refused under `--read-only` and
|
|
1783
|
+
without the token.
|
|
1784
|
+
|
|
1785
|
+
### `POST /api/runs/<key>/tasks/<id>/answer`
|
|
1786
|
+
|
|
1787
|
+
Body: `{"text": string}`, 1 to 8000 characters after stripping, no NUL; `<id>` is a task id as for
|
|
1788
|
+
the brief route. The run must be a plan (`404` otherwise). Always runs `control retry <plan> <id>
|
|
1789
|
+
--answer-file - --actor ui --json` with the stripped text on stdin: forge queues the answer for a
|
|
1790
|
+
live scheduler and prepares the retry itself when none runs. The answer is `200 {"live": bool,
|
|
1791
|
+
"result": <the CLI's object>}`, where `live` says whether `scheduler.live` named a live process (as
|
|
1792
|
+
RunDetail's `scheduler.live`) and `result` is `{"queued": true, "request"}` or `{"queued": false,
|
|
1793
|
+
"prepared": true}`. Exit 3 (the task is not `NEEDS_INPUT`) is `409` with the CLI's message. Holds
|
|
1794
|
+
the run's write lock (`409 busy`); timeout 60 s. Refused under `--read-only` and without the token.
|
|
1795
|
+
|
|
1644
1796
|
### `GET /api/models/reviewers`
|
|
1645
1797
|
|
|
1646
1798
|
Runs `dataset reviewers --json` and answers with its object: `horizon_days`, `min_landed`,
|
|
@@ -1734,7 +1886,7 @@ Storage = {state: measuring | ready | error | unavailable, error, started, progr
|
|
|
1734
1886
|
data: Report | null (the last measurement, kept while the next one runs)}
|
|
1735
1887
|
Report = {repo: null, computed, complete, totals: {runs, worktrees, data_home, reclaimable, snapshots, logs, strays},
|
|
1736
1888
|
runs: [{path, run_id, repo, updated, total, snapshots, snapshot_count, logs, gz, compressible, strays,
|
|
1737
|
-
fractal, other, reclaimable, complete, commands: [{label, command}]}],
|
|
1889
|
+
fractal, other, reclaimable, complete, key: forge-ui run key | null (not in the run list), commands: [{label, command}]}],
|
|
1738
1890
|
strays: [{path, bytes, kind: dependencies | git, run}], worktrees: [{repo, run_id, path, bytes, complete}],
|
|
1739
1891
|
data_home: {path, bytes, parts: {dataset, blobs, archive, exports, legacy, storage, other}} | null,
|
|
1740
1892
|
commands: [{label, command, bytes?}]}
|
|
@@ -1847,6 +1999,10 @@ Suggested meaning: merged and pass green, running blue, pending grey, fail, erro
|
|
|
1847
1999
|
red, infra and timeout orange, blocked, interrupted, invalidated, unknown and nochanges muted
|
|
1848
2000
|
purple. `NEEDS_DECISION` takes the same waiting colour as `NEEDS_INPUT` (`--lamp-wait`, the
|
|
1849
2001
|
`st-needs_input` class in `style.css`): a task that waits for the user is neither done nor failed.
|
|
2002
|
+
`IMPLEMENTED` is the same kind of waiting status: the member's work is in and it is awaiting the
|
|
2003
|
+
group's review. `reader.status_class` returns `waiting` for it, and a task that depends on one
|
|
2004
|
+
lists it in `waiting.on` and not in `waiting.stopped`. The page paints it with
|
|
2005
|
+
`st-implemented`, the same waiting colour; until that class exists the stage falls back to `#888`.
|
|
1850
2006
|
|
|
1851
2007
|
## The graph (`forge_ui/static/graph.js`)
|
|
1852
2008
|
|