@giamme/forge 0.15.0 → 0.16.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 +29 -0
- package/VERSION +1 -1
- package/docs/artifacts.md +1 -1
- package/docs/commands.md +14 -3
- package/docs/forge-ui.md +14 -0
- package/docs/memory.md +22 -0
- package/docs/reviews.md +7 -0
- package/forge +11 -0
- package/package.json +1 -1
- package/references/dataset.md +5 -2
- package/references/decompose.md +51 -5
- package/references/harnesses.md +4 -1
- package/references/solo.md +5 -1
- package/references/ui.md +10 -1
- package/scripts/forge-artifact.sh +53 -0
- package/scripts/forge-contract.py +55 -8
- package/scripts/forge-control.py +0 -2
- package/scripts/forge-dispatch.sh +28 -12
- package/scripts/forge-fail-first.py +3 -1
- package/scripts/forge-guard.py +247 -8
- package/scripts/forge-issues.py +12 -0
- package/scripts/forge-lib-adopt.sh +260 -0
- package/scripts/forge-lib-attribute.sh +10 -2
- package/scripts/forge-lib-plans.sh +16 -4
- package/scripts/forge-lib-review.sh +8 -2
- package/scripts/forge-lib-task.sh +19 -5
- package/scripts/forge-memory.sh +41 -4
- package/scripts/forge-metrics.sh +7 -0
- package/scripts/forge-parallel.sh +96 -13
- package/scripts/forge-route.py +16 -2
- package/scripts/forge-runs-rm.py +23 -7
- package/scripts/forge-runtime.py +25 -2
- package/scripts/forge-schedule.py +5 -2
- package/scripts/forge-shadow.py +2 -0
- package/scripts/forge-solo.sh +6 -0
- package/scripts/forge_dataset/cli.py +16 -0
- package/scripts/forge_dataset/export.py +1 -0
- package/scripts/forge_dataset/harvest.py +11 -0
- package/scripts/forge_dataset/history.py +126 -0
- package/scripts/forge_dataset/worktrees.py +95 -0
- package/scripts/forge_memory_list.py +153 -0
- package/scripts/forge_worktrees.py +88 -0
- package/ui/README.md +31 -0
- package/ui/docs/api.md +81 -4
- package/ui/forge_ui/__init__.py +14 -1
- package/ui/forge_ui/__main__.py +1 -1
- package/ui/forge_ui/control.py +77 -0
- package/ui/forge_ui/findings.py +7 -0
- package/ui/forge_ui/projects.py +571 -0
- package/ui/forge_ui/reader.py +27 -7
- package/ui/forge_ui/static/app.js +99 -21
- package/ui/forge_ui/static/cloudui.js +6 -2
- package/ui/forge_ui/static/convo.js +1 -1
- package/ui/forge_ui/static/diffview.js +2 -2
- package/ui/forge_ui/static/files.js +1 -1
- package/ui/forge_ui/static/index.html +5 -1
- package/ui/forge_ui/static/panel.js +28 -2
- package/ui/forge_ui/static/projectsview.js +372 -0
- package/ui/forge_ui/static/settings.js +136 -4
- package/ui/forge_ui/static/style.css +93 -3
- package/ui/forge_ui/static/uikit.js +94 -1
- package/ui/forge_ui/static/worktreesview.js +250 -0
- package/ui/forge_ui/worktrees.py +570 -0
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
"""`forge dataset history`: the reviews' findings and the learnings the dataset keeps, for runs whose dir is gone (#126).
|
|
2
|
+
|
|
3
|
+
forge-ui's Projects screen reads run dirs first; this is what it adds for the runs and checkouts that no longer
|
|
4
|
+
exist. Each run is one record with its repository and base commit, so the screen can tell which project it
|
|
5
|
+
belongs to (the same base-commit rule forge-ui's repos.py uses for a run whose checkout is gone):
|
|
6
|
+
|
|
7
|
+
runs {run (dataset uid), run_id, mode, repo_path, base, first, last}
|
|
8
|
+
findings one per review dispatch (qa, qa_shadow) that listed findings: {run, run_id, task, attempt, role,
|
|
9
|
+
scope, reviewer, verdict, ts, findings: [{head, severity (0-3 or null), status, line}]}, as the
|
|
10
|
+
capture parsed them with forge-contract.py (no second parser)
|
|
11
|
+
learnings one per FORGE_LEARNING line a dispatch emitted: {run, run_id, task, role, model, ts, category, text}
|
|
12
|
+
ledger the ledger rows `forge dataset import --ledger` stored: {repo_path, ts, run_id, task, role, model,
|
|
13
|
+
category, key, text, injectable}
|
|
14
|
+
|
|
15
|
+
Read-only: it never creates a store. With the dataset off everything is empty and `enabled` is false.
|
|
16
|
+
"""
|
|
17
|
+
from __future__ import annotations
|
|
18
|
+
|
|
19
|
+
import json
|
|
20
|
+
|
|
21
|
+
from . import connect, dataset_dir, enabled
|
|
22
|
+
|
|
23
|
+
_HEAD_MAX = 400
|
|
24
|
+
_TEXT_MAX = 2000
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def _empty(on):
|
|
28
|
+
return dict(enabled=on, runs=[], findings=[], learnings=[], ledger=[])
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def load() -> dict:
|
|
32
|
+
if not enabled():
|
|
33
|
+
return _empty(False)
|
|
34
|
+
if not (dataset_dir() / 'dataset.sqlite').exists():
|
|
35
|
+
return _empty(True)
|
|
36
|
+
db = connect()
|
|
37
|
+
try:
|
|
38
|
+
paths = dict(db.execute('SELECT repo, path FROM repos'))
|
|
39
|
+
out = _empty(True)
|
|
40
|
+
runs = {}
|
|
41
|
+
|
|
42
|
+
def note(run, run_id, mode, repo, ts):
|
|
43
|
+
if not run:
|
|
44
|
+
return None
|
|
45
|
+
r = runs.setdefault(run, dict(run=run, run_id=run_id, mode=mode, repo_path=paths.get(repo), base=None,
|
|
46
|
+
first=ts, last=ts))
|
|
47
|
+
r['first'], r['last'] = min(r['first'], ts), max(r['last'], ts)
|
|
48
|
+
r['run_id'] = r['run_id'] or run_id
|
|
49
|
+
r['repo_path'] = r['repo_path'] or paths.get(repo)
|
|
50
|
+
return r
|
|
51
|
+
|
|
52
|
+
attempt_task = {}
|
|
53
|
+
for rid, run, run_id, mode, repo, task, attempt, ts, data in db.execute(
|
|
54
|
+
"SELECT rid, run, run_id, mode, repo, task, attempt, ts, data FROM events WHERE kind = 'attempt' ORDER BY ts"):
|
|
55
|
+
r = note(run, run_id, mode, repo, ts)
|
|
56
|
+
attempt_task[rid] = (task, attempt)
|
|
57
|
+
if r is not None and r['base'] is None:
|
|
58
|
+
try:
|
|
59
|
+
base = json.loads(data).get('base_ref')
|
|
60
|
+
except ValueError:
|
|
61
|
+
base = None
|
|
62
|
+
if isinstance(base, str) and len(base) in (40, 64):
|
|
63
|
+
r['base'] = base.lower()
|
|
64
|
+
for run, run_id, mode, repo, task, attempt, parent, ts, data in db.execute(
|
|
65
|
+
"SELECT run, run_id, mode, repo, task, attempt, parent, ts, data FROM events WHERE kind = 'dispatch' ORDER BY ts"):
|
|
66
|
+
try:
|
|
67
|
+
d = json.loads(data)
|
|
68
|
+
except ValueError:
|
|
69
|
+
continue
|
|
70
|
+
note(run, run_id, mode, repo, ts)
|
|
71
|
+
if task is None and parent in attempt_task:
|
|
72
|
+
task, attempt = task or attempt_task[parent][0], attempt or attempt_task[parent][1]
|
|
73
|
+
role = d.get('role')
|
|
74
|
+
spec = d.get('alias') or d.get('model')
|
|
75
|
+
if d.get('effort') and spec and ':' not in str(spec):
|
|
76
|
+
spec = '%s:%s' % (spec, d['effort'])
|
|
77
|
+
found = d.get('findings')
|
|
78
|
+
if role in ('qa', 'qa_shadow') and isinstance(found, list) and found:
|
|
79
|
+
items = []
|
|
80
|
+
for f in found:
|
|
81
|
+
if not isinstance(f, dict) or not isinstance(f.get('head'), str):
|
|
82
|
+
continue
|
|
83
|
+
sev = f.get('severity')
|
|
84
|
+
items.append(dict(head=f['head'][:_HEAD_MAX], severity=sev if type(sev) is int and 0 <= sev <= 3 else None,
|
|
85
|
+
status=f.get('status') if f.get('status') in ('CONFIRMED', 'PLAUSIBLE', 'UNSTATED') else None,
|
|
86
|
+
line=f.get('line') if type(f.get('line')) is int else None))
|
|
87
|
+
if items:
|
|
88
|
+
out['findings'].append(dict(run=run, run_id=run_id, task=task, attempt=attempt, role=role,
|
|
89
|
+
scope=d.get('scope'), reviewer=spec, verdict=d.get('verdict'), ts=ts,
|
|
90
|
+
findings=items))
|
|
91
|
+
for line in d.get('learnings') or []:
|
|
92
|
+
if not isinstance(line, str):
|
|
93
|
+
continue
|
|
94
|
+
category, sep, text = line.partition('|')
|
|
95
|
+
if not sep:
|
|
96
|
+
continue
|
|
97
|
+
out['learnings'].append(dict(run=run, run_id=run_id, task=task, role=role, model=spec, ts=ts,
|
|
98
|
+
category=category.strip().lower(), text=text.strip()[:_TEXT_MAX]))
|
|
99
|
+
for repo, data in db.execute("SELECT repo, data FROM events WHERE kind = 'ledger' ORDER BY ts"):
|
|
100
|
+
try:
|
|
101
|
+
d = json.loads(data)
|
|
102
|
+
except ValueError:
|
|
103
|
+
continue
|
|
104
|
+
if not isinstance(d.get('text'), str) or d.get('category') in (None, '-'):
|
|
105
|
+
continue
|
|
106
|
+
out['ledger'].append(dict(repo_path=paths.get(repo), ts=d.get('ts'), run_id=d.get('run_id'), task=d.get('task'),
|
|
107
|
+
role=d.get('role'), model=d.get('model'), category=d.get('category'),
|
|
108
|
+
key=d.get('key'), text=d['text'][:_TEXT_MAX], injectable=d.get('injectable') != '0'))
|
|
109
|
+
out['runs'] = sorted(runs.values(), key=lambda r: r['first'])
|
|
110
|
+
return out
|
|
111
|
+
finally:
|
|
112
|
+
db.close()
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
def main(args) -> int:
|
|
116
|
+
rep = load()
|
|
117
|
+
if args.json:
|
|
118
|
+
print(json.dumps(rep, sort_keys=True))
|
|
119
|
+
return 0
|
|
120
|
+
if not rep['enabled']:
|
|
121
|
+
print('the dataset is off (FORGE_DATASET=off)')
|
|
122
|
+
return 0
|
|
123
|
+
print('runs: %d, reviews with findings: %d, learnings: %d, ledger rows: %d' % (
|
|
124
|
+
len(rep['runs']), len(rep['findings']), len(rep['learnings']), len(rep['ledger'])))
|
|
125
|
+
print("forge-ui's Projects screen (#/projects) shows them by repository.")
|
|
126
|
+
return 0
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"""`forge dataset worktrees`: what the dataset knows about the worktrees forge created (#125).
|
|
2
|
+
|
|
3
|
+
forge-ui's Worktrees screen reads this through the CLI (forge_ui never opens the store itself) and adds
|
|
4
|
+
what git and the run dirs say now. Three kinds of record:
|
|
5
|
+
|
|
6
|
+
events every `worktree_created` and `worktree_removed` event: when forge added or removed a
|
|
7
|
+
worktree, with its repository, run, task, path, branch and kind
|
|
8
|
+
attempts each (repository, run id, task) a parallel attempt was recorded for: a task worktree
|
|
9
|
+
existed at the derived path, before the events were recorded (no dates)
|
|
10
|
+
integrated each (repository, run id) whose integrate moved the user's branch (`integrate_advanced`)
|
|
11
|
+
|
|
12
|
+
`since` is the time of the first worktree event: the list of removed worktrees is complete only from
|
|
13
|
+
then on. With the dataset off, or no store yet, everything is empty and `enabled` says which.
|
|
14
|
+
Read-only: it never creates a store.
|
|
15
|
+
"""
|
|
16
|
+
from __future__ import annotations
|
|
17
|
+
|
|
18
|
+
import json
|
|
19
|
+
import time
|
|
20
|
+
|
|
21
|
+
from . import connect, dataset_dir, enabled
|
|
22
|
+
|
|
23
|
+
_NAMES = ('worktree_created', 'worktree_removed')
|
|
24
|
+
_FIELDS = ('path', 'branch', 'kind', 'repo_path', 'by')
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def _empty(on):
|
|
28
|
+
return dict(enabled=on, since=None, events=[], attempts=[], integrated=[], repos=[])
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def load() -> dict:
|
|
32
|
+
if not enabled():
|
|
33
|
+
return _empty(False)
|
|
34
|
+
if not (dataset_dir() / 'dataset.sqlite').exists():
|
|
35
|
+
return _empty(True)
|
|
36
|
+
db = connect()
|
|
37
|
+
try:
|
|
38
|
+
paths = dict(db.execute('SELECT repo, path FROM repos'))
|
|
39
|
+
out = _empty(True)
|
|
40
|
+
out['repos'] = [dict(repo=key, path=path) for key, path in sorted(paths.items()) if path]
|
|
41
|
+
rows = db.execute("SELECT ts, repo, run, run_id, task, data FROM events WHERE kind = 'event' "
|
|
42
|
+
"AND (data LIKE '%\"name\": \"worktree_created\"%' OR data LIKE '%\"name\": \"worktree_removed\"%' "
|
|
43
|
+
"OR data LIKE '%\"name\": \"integrate_advanced\"%') ORDER BY ts")
|
|
44
|
+
integrated = set()
|
|
45
|
+
for ts, repo, run, run_id, task, data in rows:
|
|
46
|
+
try:
|
|
47
|
+
d = json.loads(data)
|
|
48
|
+
except ValueError:
|
|
49
|
+
continue
|
|
50
|
+
name = d.get('name')
|
|
51
|
+
if name == 'integrate_advanced':
|
|
52
|
+
if run_id and paths.get(repo):
|
|
53
|
+
integrated.add((paths[repo], run_id))
|
|
54
|
+
continue
|
|
55
|
+
if name not in _NAMES or not isinstance(d.get('path'), str):
|
|
56
|
+
continue
|
|
57
|
+
event = dict(name=name, ts=ts, run=run, run_id=run_id, task=task)
|
|
58
|
+
event.update({k: d.get(k) if isinstance(d.get(k), str) else None for k in _FIELDS})
|
|
59
|
+
if event['branch'] == '-':
|
|
60
|
+
event['branch'] = None
|
|
61
|
+
event['repo_path'] = event['repo_path'] or paths.get(repo)
|
|
62
|
+
out['events'].append(event)
|
|
63
|
+
out['since'] = out['events'][0]['ts'] if out['events'] else None
|
|
64
|
+
out['integrated'] = [dict(repo_path=p, run_id=r) for p, r in sorted(integrated)]
|
|
65
|
+
seen = set()
|
|
66
|
+
for repo, run_id, task in db.execute("SELECT DISTINCT repo, run_id, task FROM events WHERE kind = 'attempt' "
|
|
67
|
+
"AND mode = 'parallel' AND task IS NOT NULL AND run_id IS NOT NULL"):
|
|
68
|
+
if paths.get(repo) and (paths[repo], run_id, task) not in seen:
|
|
69
|
+
seen.add((paths[repo], run_id, task))
|
|
70
|
+
out['attempts'] = [dict(repo_path=p, run_id=r, task=t) for p, r, t in sorted(seen)]
|
|
71
|
+
return out
|
|
72
|
+
finally:
|
|
73
|
+
db.close()
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def main(args) -> int:
|
|
77
|
+
rep = load()
|
|
78
|
+
if args.json:
|
|
79
|
+
print(json.dumps(rep, sort_keys=True))
|
|
80
|
+
return 0
|
|
81
|
+
if not rep['enabled']:
|
|
82
|
+
print('the dataset is off (FORGE_DATASET=off): no worktree history is recorded')
|
|
83
|
+
return 0
|
|
84
|
+
created = sum(1 for e in rep['events'] if e['name'] == 'worktree_created')
|
|
85
|
+
removed = sum(1 for e in rep['events'] if e['name'] == 'worktree_removed')
|
|
86
|
+
print('worktree events: %d created, %d removed%s' % (created, removed, '' if rep['since'] is None else
|
|
87
|
+
' (recorded since %s)' % _when(rep['since'])))
|
|
88
|
+
print('tasks with an attempt (worktrees before the record): %d' % len(rep['attempts']))
|
|
89
|
+
print("forge-ui's Worktrees screen (#/worktrees) adds what git and the run dirs say now.")
|
|
90
|
+
return 0
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
def _when(ts):
|
|
94
|
+
return time.strftime('%Y-%m-%d %H:%M', time.localtime(ts))
|
|
95
|
+
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""`forge-memory.sh learnings <repo> --json`: every learning in a repo's ledger and its state (#126).
|
|
3
|
+
|
|
4
|
+
forge-memory.sh runs its own `rebuild` into a scratch dir first, with MEMORY_DROPS recording what it dropped
|
|
5
|
+
and why; this reads the ledger, that rebuilt memory and the drops, and says per learning what the rebuild did,
|
|
6
|
+
so the state shown is the one forge's bash decided, never a second implementation of it:
|
|
7
|
+
|
|
8
|
+
in_memory the rebuilt memory.md has it
|
|
9
|
+
waiting a finding seen in one run only: it needs a second run to be promoted
|
|
10
|
+
stale its [anchor] path no longer exists in the repo
|
|
11
|
+
capped trimmed by the memory cap (FORGE_MEMORY_MAX_LINES / MAX_BYTES)
|
|
12
|
+
muted every row of it was marked not injectable (Jev's curation)
|
|
13
|
+
|
|
14
|
+
A learning is a (category, key) group, as rebuild groups the ledger: `count` is the number of distinct runs
|
|
15
|
+
it appeared in, `text` the latest wording. `memory` is the repo's current .forge/memory.md by section, with
|
|
16
|
+
the roles each section reaches; `rebuilt_differs` says the current file is not what a rebuild makes now (an
|
|
17
|
+
older forge wrote it, or a `prune` asked Jev to drop facts). Stdlib only.
|
|
18
|
+
"""
|
|
19
|
+
from __future__ import annotations
|
|
20
|
+
|
|
21
|
+
import argparse
|
|
22
|
+
import json
|
|
23
|
+
import re
|
|
24
|
+
import sys
|
|
25
|
+
from pathlib import Path
|
|
26
|
+
|
|
27
|
+
SECTIONS = (('verify', 'Verify', ('planner', 'dwarf')),
|
|
28
|
+
('trap', 'Known traps', ('planner', 'dwarf', 'qa')),
|
|
29
|
+
('finding', 'Recurring QA findings', ('planner', 'dwarf', 'qa')))
|
|
30
|
+
_TITLE = {'## ' + title: (cat, roles) for cat, title, roles in SECTIONS}
|
|
31
|
+
_FACT = re.compile(r'^- (?:([0-9]+)x: )?(.*)$')
|
|
32
|
+
_MAX_READ = 32 << 20
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def _read(path):
|
|
36
|
+
try:
|
|
37
|
+
p = Path(path)
|
|
38
|
+
if not p.is_file() or p.stat().st_size > _MAX_READ:
|
|
39
|
+
return None
|
|
40
|
+
return p.read_text(encoding='utf-8', errors='replace')
|
|
41
|
+
except OSError:
|
|
42
|
+
return None
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def parse_memory(text):
|
|
46
|
+
"""[{category, title, roles, lines: [{text, count}]}] of a memory.md, in file order."""
|
|
47
|
+
out, current = [], None
|
|
48
|
+
for line in (text or '').splitlines():
|
|
49
|
+
if line.startswith('## '):
|
|
50
|
+
found = _TITLE.get(line.strip())
|
|
51
|
+
current = None
|
|
52
|
+
if found:
|
|
53
|
+
current = dict(category=found[0], title=line[3:].strip(), roles=list(found[1]), lines=[])
|
|
54
|
+
out.append(current)
|
|
55
|
+
continue
|
|
56
|
+
fact = _FACT.match(line)
|
|
57
|
+
if fact and current is not None:
|
|
58
|
+
current['lines'].append(dict(text=fact.group(2), count=int(fact.group(1)) if fact.group(1) else None))
|
|
59
|
+
return out
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def ledger_groups(text):
|
|
63
|
+
"""{(category, key): group} as rebuild groups the ledger, plus every learning row."""
|
|
64
|
+
groups = {}
|
|
65
|
+
for line in (text or '').splitlines():
|
|
66
|
+
if not line or line.startswith('#'):
|
|
67
|
+
continue
|
|
68
|
+
cols = line.split('\t')
|
|
69
|
+
if len(cols) < 9:
|
|
70
|
+
continue
|
|
71
|
+
ts, run, task, role, model, verdict, cat, key, txt = cols[:9]
|
|
72
|
+
if cat == '-' or key == '-':
|
|
73
|
+
continue # a dispatch that emitted no learning
|
|
74
|
+
injectable = not (len(cols) >= 11 and cols[10] == '0')
|
|
75
|
+
g = groups.setdefault((cat, key), dict(category=cat, key=key, rows=[], runs=set(), last_ts=None, text=None,
|
|
76
|
+
any_injectable=False))
|
|
77
|
+
g['rows'].append(dict(ts=ts, run_id=run, task=task, role=role, model=model, verdict=verdict, text=txt,
|
|
78
|
+
injectable=injectable))
|
|
79
|
+
if injectable:
|
|
80
|
+
g['any_injectable'] = True
|
|
81
|
+
g['runs'].add(run)
|
|
82
|
+
# awk's `ts >= lastts[k]` on strings: the later row of two with the same time wins
|
|
83
|
+
if g['last_ts'] is None or ts >= g['last_ts']:
|
|
84
|
+
g['last_ts'], g['text'] = ts, txt
|
|
85
|
+
return groups
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
def drops_of(text):
|
|
89
|
+
"""{(reason, category or '-', text)} of rebuild's MEMORY_DROPS rows; cap rows hold the whole '- ...' line."""
|
|
90
|
+
out = set()
|
|
91
|
+
for line in (text or '').splitlines():
|
|
92
|
+
reason, _, rest = line.partition('\t')
|
|
93
|
+
cat, _, fact = rest.partition('\t')
|
|
94
|
+
if reason == 'cap':
|
|
95
|
+
m = _FACT.match(fact)
|
|
96
|
+
fact = m.group(2) if m else fact
|
|
97
|
+
out.add((reason, cat, fact))
|
|
98
|
+
return out
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
def classify(groups, rebuilt, drops):
|
|
102
|
+
kept = {(s['category'], line['text']) for s in rebuilt for line in s['lines']}
|
|
103
|
+
capped = {fact for reason, _cat, fact in drops if reason == 'cap'}
|
|
104
|
+
stale = {(cat, fact) for reason, cat, fact in drops if reason in ('anchor_missing', 'jev_stale')}
|
|
105
|
+
out = []
|
|
106
|
+
for (cat, key), g in groups.items():
|
|
107
|
+
if not g['any_injectable']:
|
|
108
|
+
state, text, count = 'muted', g['rows'][-1]['text'], 0
|
|
109
|
+
else:
|
|
110
|
+
text, count = g['text'], len(g['runs'])
|
|
111
|
+
if (cat, text) in kept:
|
|
112
|
+
state = 'in_memory'
|
|
113
|
+
elif (cat, text) in stale:
|
|
114
|
+
state = 'stale'
|
|
115
|
+
elif text in capped:
|
|
116
|
+
state = 'capped'
|
|
117
|
+
elif cat == 'finding' and count < 2:
|
|
118
|
+
state = 'waiting'
|
|
119
|
+
else:
|
|
120
|
+
state = 'dropped' # not reached by today's rebuild; kept honest if it changes
|
|
121
|
+
rows = g['rows']
|
|
122
|
+
out.append(dict(category=cat, key=key, text=text, count=count, state=state,
|
|
123
|
+
first=min(r['ts'] for r in rows), last=max(r['ts'] for r in rows), rows=rows))
|
|
124
|
+
out.sort(key=lambda r: (r['last'], r['category'], r['key']), reverse=True)
|
|
125
|
+
return out
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
def build(repo, ledger, memory, rebuilt, drops, max_lines, max_bytes, memory_off):
|
|
129
|
+
ledger_text, current, made = _read(ledger), _read(memory), _read(rebuilt)
|
|
130
|
+
groups = ledger_groups(ledger_text)
|
|
131
|
+
rebuilt_sections = parse_memory(made)
|
|
132
|
+
return dict(repo=repo, ledger=ledger_text is not None, memory_off=memory_off, max_lines=max_lines,
|
|
133
|
+
max_bytes=max_bytes, memory=parse_memory(current) if current is not None else None,
|
|
134
|
+
rebuilt_differs=(current or '') != (made or ''),
|
|
135
|
+
learnings=classify(groups, rebuilt_sections, drops_of(_read(drops))))
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
def main(argv=None):
|
|
139
|
+
p = argparse.ArgumentParser(prog='forge-memory.sh learnings')
|
|
140
|
+
for name in ('repo', 'ledger', 'memory', 'rebuilt', 'drops'):
|
|
141
|
+
p.add_argument('--' + name, required=True)
|
|
142
|
+
p.add_argument('--max-lines', type=int, required=True)
|
|
143
|
+
p.add_argument('--max-bytes', type=int, required=True)
|
|
144
|
+
p.add_argument('--memory-off', choices=('0', '1'), default='0')
|
|
145
|
+
a = p.parse_args(argv)
|
|
146
|
+
json.dump(build(a.repo, a.ledger, a.memory, a.rebuilt, a.drops, a.max_lines, a.max_bytes, a.memory_off == '1'),
|
|
147
|
+
sys.stdout, sort_keys=True)
|
|
148
|
+
sys.stdout.write('\n')
|
|
149
|
+
return 0
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
if __name__ == '__main__':
|
|
153
|
+
sys.exit(main())
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"""Which worktrees under `.forge-worktrees` are forge's, and what kind each is.
|
|
2
|
+
|
|
3
|
+
One rule for `forge runs rm` (what it may remove) and forge-ui's Worktrees screen (what it offers to
|
|
4
|
+
remove), so the two cannot disagree (#125).
|
|
5
|
+
|
|
6
|
+
forge-parallel.sh puts a run's worktrees in `<checkout>/../.forge-worktrees/<run id>/`, derived with a
|
|
7
|
+
logical `cd`, never read from the run's `wt_root` file. A worktree there is the run's when:
|
|
8
|
+
|
|
9
|
+
task it has the branch forge/<run id>/<task> checked out, for a task of the run
|
|
10
|
+
integration it has the branch forge/<run id>-integration checked out
|
|
11
|
+
candidate it is detached, directly in the run's folder, and named `_candidate-<n>` (integrate's
|
|
12
|
+
scratch worktree, left behind when integrate stopped)
|
|
13
|
+
attribute it is detached, directly in the run's folder, and named `_attribute` or
|
|
14
|
+
`_attribute-<n>` (the culprit search's scratch worktree), and no task has that name
|
|
15
|
+
|
|
16
|
+
Anything else there, and any worktree of the run's branches outside that folder, is not forge's.
|
|
17
|
+
"""
|
|
18
|
+
from __future__ import annotations
|
|
19
|
+
|
|
20
|
+
import os
|
|
21
|
+
import re
|
|
22
|
+
|
|
23
|
+
RUN_ID = re.compile(r'[A-Za-z0-9][A-Za-z0-9._-]{0,127}')
|
|
24
|
+
_SCRATCH = (('candidate', re.compile(r'_candidate-[0-9]+')), ('attribute', re.compile(r'_attribute(?:-[0-9]+)?')))
|
|
25
|
+
KINDS = ('task', 'integration', 'candidate', 'attribute')
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def contains(parent, child):
|
|
29
|
+
"""True when `child` is `parent` or inside it (both real paths)."""
|
|
30
|
+
parent = parent.rstrip(os.sep) or os.sep
|
|
31
|
+
return child == parent or child.startswith(parent + os.sep)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def wt_root(repo, run_id):
|
|
35
|
+
"""The run's worktree folder, as forge-parallel.sh derives it: `$(cd "$REPO/.." && pwd)/.forge-worktrees/<run id>`."""
|
|
36
|
+
return os.path.realpath(os.path.join(os.path.normpath(os.path.join(repo, '..')), '.forge-worktrees', run_id))
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def owner(path, branch, run_id, tasks, root):
|
|
40
|
+
"""The kind of forge worktree at `path` (one of KINDS), or None when it is not the run's.
|
|
41
|
+
|
|
42
|
+
`branch` is the full ref git lists (refs/heads/...), or None for a detached worktree; `tasks` the run's
|
|
43
|
+
task ids; `root` the run's worktree folder (`wt_root`).
|
|
44
|
+
"""
|
|
45
|
+
real = os.path.realpath(path)
|
|
46
|
+
if real == root or not contains(root, real):
|
|
47
|
+
return None
|
|
48
|
+
if branch == 'refs/heads/forge/%s-integration' % run_id:
|
|
49
|
+
return 'integration'
|
|
50
|
+
prefix = 'refs/heads/forge/%s/' % run_id
|
|
51
|
+
if isinstance(branch, str) and branch.startswith(prefix) and branch[len(prefix):] in set(tasks):
|
|
52
|
+
return 'task'
|
|
53
|
+
name = os.path.basename(real)
|
|
54
|
+
if branch is None and os.path.dirname(real) == root and name not in set(tasks):
|
|
55
|
+
for kind, pattern in _SCRATCH:
|
|
56
|
+
if pattern.fullmatch(name):
|
|
57
|
+
return kind
|
|
58
|
+
return None
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def parse_porcelain(out, z=True):
|
|
62
|
+
"""`git worktree list --porcelain [-z]` output (text) as a list of dicts:
|
|
63
|
+
{path, head, branch (full ref or None), detached, bare, locked (reason or None), prunable (reason or None)}.
|
|
64
|
+
|
|
65
|
+
`locked` and `prunable` are '' when git gave no reason. With `z` a path may hold a newline; without it
|
|
66
|
+
such a path is split and its record is malformed, so that output is only for a git too old for -z.
|
|
67
|
+
"""
|
|
68
|
+
found, current = [], None
|
|
69
|
+
fields = out.split('\0') if z else out.split('\n')
|
|
70
|
+
for field in fields:
|
|
71
|
+
if not field:
|
|
72
|
+
current = None
|
|
73
|
+
continue
|
|
74
|
+
key, _, value = field.partition(' ')
|
|
75
|
+
if key == 'worktree':
|
|
76
|
+
current = dict(path=value, head=None, branch=None, detached=False, bare=False, locked=None, prunable=None)
|
|
77
|
+
found.append(current)
|
|
78
|
+
elif current is None:
|
|
79
|
+
continue
|
|
80
|
+
elif key == 'HEAD':
|
|
81
|
+
current['head'] = value
|
|
82
|
+
elif key == 'branch':
|
|
83
|
+
current['branch'] = value
|
|
84
|
+
elif key in ('detached', 'bare'):
|
|
85
|
+
current[key] = True
|
|
86
|
+
elif key in ('locked', 'prunable'):
|
|
87
|
+
current[key] = value
|
|
88
|
+
return found
|
package/ui/README.md
CHANGED
|
@@ -239,6 +239,37 @@ keep one meaning everywhere (amber running, green merged or passed, red failed,
|
|
|
239
239
|
run cloud filtered to its runs.
|
|
240
240
|
|
|
241
241
|
<img src="docs/media/models.png" width="760" alt="The implementers table: tasks, first-attempt pass rate with its 95% interval, retries, escalations, timeouts, accepts, median model time and tokens per model.">
|
|
242
|
+
- **Projects (`#/projects`, `#/projects/<id>[/runs|/findings|/memories]`):** one row per repository
|
|
243
|
+
(its root, as the run cloud groups runs, with the same id): runs, runs live now, last activity, open
|
|
244
|
+
findings and memory lines, sorted by latest activity; a repository whose folder is gone stays listed,
|
|
245
|
+
and runs tied to it only by their path are marked. A project's page has three tabs. *Runs*: its runs,
|
|
246
|
+
with the checkout and branch as a column to filter on. *Findings*: every finding of every review of
|
|
247
|
+
every run (each attempt and round, final reviews, shadow reviews behind a toggle), with severity,
|
|
248
|
+
confidence, location, run, task, attempt, reviewer, date and status: `open`, `filed`, `fixed`, `swept`,
|
|
249
|
+
`dismissed` (from `forge issues`, offline) or `superseded` (a later review of the same task passed,
|
|
250
|
+
which does not say the finding was fixed). A finding repeated across rounds is one row with a count,
|
|
251
|
+
by `forge issues`' fingerprint. A row opens the diff at that finding; filing and dismissing stay on the
|
|
252
|
+
run's Open findings page. *Memories*: what `memory.md` gives models, by section and role, and every
|
|
253
|
+
learning in the ledger with its state from `forge memory learnings` (in memory, waiting for a second
|
|
254
|
+
run, stale, trimmed by the cap, curated out), from the root and each checkout that still exists, and
|
|
255
|
+
from the dataset for checkouts that are gone; when checkouts' files differ the tab says so and lets you
|
|
256
|
+
pick one. Each tab reads its endpoint when it opens, never on the poll; *Read again* reads everything
|
|
257
|
+
again. A run's header (its repository name) and each map district's heading link to the project.
|
|
258
|
+
- **Worktrees (`#/worktrees`, `#/worktrees/repo/<root>`, `#/worktrees/runs/<key>`):** every worktree forge
|
|
259
|
+
created, in any repository forge-ui knows (the runs it lists and the repositories in the dataset),
|
|
260
|
+
with its run, task, branch, whether that branch is merged, its last commit, when forge created and
|
|
261
|
+
removed it, and its size. Each row has a status: *in use* (its run is active), *uncommitted
|
|
262
|
+
changes*, *locked*, *needed by the run* (the `_integration` of a run not yet integrated), *failed
|
|
263
|
+
task*, *finished*, *missing on disk*, *not forge's* (it fails the ownership rule `forge runs rm`
|
|
264
|
+
uses), *unknown to git* (a folder no repository lists) and *removed*. Rows with a safe next step
|
|
265
|
+
show the command to copy: `git -C <path> status`, `git -C <repo> worktree remove <path>` (plus
|
|
266
|
+
`git branch -d` for a merged branch), or `git worktree prune`; never `--force`, and the page runs
|
|
267
|
+
nothing, so it works with `--read-only`. *Whole runs* gives each finished run's
|
|
268
|
+
`forge runs rm <run-dir> --worktrees --branches --dry-run`, which also deletes the run directory
|
|
269
|
+
after archiving it. Removed worktrees are complete from the release that records them (dataset
|
|
270
|
+
events `worktree_created` and `worktree_removed`); older ones are derived from run dirs and the
|
|
271
|
+
dataset, without dates. The screen reads `/api/worktrees` when it opens and every minute, never on
|
|
272
|
+
the page's poll; sizes fill in as they are measured. A run's header links to its worktrees.
|
|
242
273
|
- **Diffs (`…/tasks/<id>/diff[/<source>][/file/<path> | /finding/<id>]`, `…/final-review/<name>/diff[/finding/<id>]`):** a task's
|
|
243
274
|
`changes.diff`, its previous or committed diff, or exactly the diff one reviewer read (the last
|
|
244
275
|
diff in that review's prompt), picked from a row of sources with each review's verdict; a final
|
package/ui/docs/api.md
CHANGED
|
@@ -259,7 +259,7 @@ its last 20,000 behind a leading `…`. Their `truncated` lists the field names
|
|
|
259
259
|
| `GET /api/runs/<key>/verification/lanes/<lane>/log[/lines/<n>]` | `200 VerificationLog` of `verification.lane.<lane>.log` |
|
|
260
260
|
| `GET /api/runs/<key>/verification/lanes/<lane>/runs/<k>/log[/lines/<n>]` | `200 VerificationLog` of `verification.lane.<lane>.run-<k>.log` |
|
|
261
261
|
| `GET /api/models` | `200 Models` |
|
|
262
|
-
| `GET /api/health` | `200 {"app": "forge-ui", "version", "build", "pid", "controls": true\|false}`; `controls` is `false` in read-only mode |
|
|
262
|
+
| `GET /api/health` | `200 {"app": "forge-ui", "version", "build", "pid", "controls": true\|false}`; `version` is forge's own (the root `VERSION` file, read when this server started), `null` when that file cannot be read; `controls` is `false` in read-only mode |
|
|
263
263
|
| `GET /api/runs/<key>/controls` | `200` the `forge control show --json` object of a plan run (see Controls); `404` for a solo or unknown run |
|
|
264
264
|
| `POST /api/runs/<key>/controls` | change one control or pin; authenticated, see Controls (write endpoints) |
|
|
265
265
|
| `GET /api/runs/<key>/issues?scope=run\|repo&offline=0\|1&plausible=0\|1&dismissed=0\|1&only=fp,fp` | `200` the `forge issues --json` listing, run fresh on every request (no cache); see Controls (write endpoints) |
|
|
@@ -267,6 +267,11 @@ its last 20,000 behind a leading `…`. Their `truncated` lists the field names
|
|
|
267
267
|
| `POST /api/runs/<key>/issues/dismiss` | dismiss or (`undo`) restore findings; authenticated |
|
|
268
268
|
| `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` |
|
|
269
269
|
| `GET /api/models/reviewers` | `200` the `forge dataset reviewers --json` report (how each reviewer's PASSed work held up); no parameters |
|
|
270
|
+
| `GET /api/projects` | `200 {projects: [ProjectRow]}`: one row per repository (see Projects) |
|
|
271
|
+
| `GET /api/projects/<id>` | `200 Project`, `404` for an unknown id |
|
|
272
|
+
| `GET /api/projects/<id>/findings[?refresh=1]` | `200 ProjectFindings`: every review's findings with their status |
|
|
273
|
+
| `GET /api/projects/<id>/memories[?refresh=1]` | `200 ProjectMemories`: what each checkout's memory gives models and every learning's state |
|
|
274
|
+
| `GET /api/worktrees[?refresh=1]` | `200 Worktrees`: every worktree forge created, with its status and the commands to remove it; cached 60 s (see Worktrees) |
|
|
270
275
|
| `GET /api/config?run=<key>` | `200` the `forge config show --json` of that run's repository root (see Config) |
|
|
271
276
|
| `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 |
|
|
272
277
|
| `GET /api/config/profiles?run=<key>` | `200` every profile of that run's repository, each with its level, shadowed levels, default flag and body (see Profiles) |
|
|
@@ -417,6 +422,8 @@ Every RunSummary field, plus:
|
|
|
417
422
|
"ended": 1760622300.0}]},
|
|
418
423
|
"final_review": FinalReviewSummary,
|
|
419
424
|
"final_reviews": [FinalReviewSummary, ...],
|
|
425
|
+
"adoptions": [{"at": 1760621000.0, "base": "...", "tip": "...", "verdict": "PASS", "approved": false,
|
|
426
|
+
"spec": "opus", "review": "adopt-1760621000-7", "reason": "..."}],
|
|
420
427
|
"scheduler": {"live": true, "drained": false, "stopping": null, "max_parallel": 3,
|
|
421
428
|
"pauses": [{"scope": "model:codex/gpt-6", "class": "rate_limit", "harness": "codex", "model": "gpt-6",
|
|
422
429
|
"tasks": ["perf"], "cycle": 1, "until": 1760622130.0, "exhausted": false}]},
|
|
@@ -818,7 +825,8 @@ TaskDetail:
|
|
|
818
825
|
"known_issues": null, "dwarf_input": "...", "qa_input": "..."},
|
|
819
826
|
"gate": {...},
|
|
820
827
|
"reviews": [{"kind": "primary", "execution": "qa-...", "attempt": 1, "spec": "opus",
|
|
821
|
-
"verdict": "FAIL", "state": "done", "findings": [Finding, ...]
|
|
828
|
+
"verdict": "FAIL", "state": "done", "findings": [Finding, ...],
|
|
829
|
+
"tests": {"status": "could_not_run", "reason": "..."}}],
|
|
822
830
|
"truncated": [], "warnings": []}
|
|
823
831
|
```
|
|
824
832
|
|
|
@@ -827,7 +835,9 @@ TaskDetail:
|
|
|
827
835
|
`dwarf.input`, `qa.input`; the others are `null`). `reviews` lists each non-shadow `qa`
|
|
828
836
|
execution with the findings of its own `qa.last` copy (`null` until it is done); then the
|
|
829
837
|
task's current `qa.last` as a `primary` review with `execution` `null`, only when no
|
|
830
|
-
execution's copy is identical to it; then one `shadow` review per shadow dir.
|
|
838
|
+
execution's copy is identical to it; then one `shadow` review per shadow dir. `tests` is the
|
|
839
|
+
reply's `FORGE_TESTS` line: `status` `ran`, `not_needed`, `could_not_run` or `unclear` (it says
|
|
840
|
+
something else), and `reason` or `null`; `null` when the reply has none.
|
|
831
841
|
|
|
832
842
|
ExecutionDetail: the Execution, plus `resolved` (every `key=value` of `<role>.resolved`, or
|
|
833
843
|
`null`), `dataset` (`{trigger, parent, attempt_start, resume}` or `null`), `prompt` (the
|
|
@@ -839,7 +849,8 @@ solo run), `<task>/<attempt>-<k>`, the review name, or `null`), `truncated` and
|
|
|
839
849
|
|
|
840
850
|
FinalReviewDetail: the FinalReviewSummary, plus `meta` (every `review.meta` key),
|
|
841
851
|
`tasks_summary`, `qa_input`, `qa_last`, `known_issues` (texts or `null`), `findings` (a list
|
|
842
|
-
of Findings, in place of the summary), `truncated` and
|
|
852
|
+
of Findings, in place of the summary), `tests` (as on a TaskDetail review), `truncated` and
|
|
853
|
+
`warnings`.
|
|
843
854
|
|
|
844
855
|
## DiffDetail (`forge_ui/diffs.py`)
|
|
845
856
|
|
|
@@ -1473,6 +1484,72 @@ Runs `dataset reviewers --json` and answers with its object: `horizon_days`, `mi
|
|
|
1473
1484
|
request runs the CLI, and the page asks once per change of `/api/models`. Advisory: it feeds the
|
|
1474
1485
|
Reviewers table's Did not hold column and nothing else. Timeout 60 s.
|
|
1475
1486
|
|
|
1487
|
+
### `GET /api/projects` and `/api/projects/<id>[/findings|/memories]`
|
|
1488
|
+
|
|
1489
|
+
The Projects screen (`forge_ui/projects.py`). Read-only, so they answer in `--read-only` mode too, and
|
|
1490
|
+
none of them calls `gh`. A project is one repository root as `repos.py` resolves it; `<id>` is the run
|
|
1491
|
+
cloud's (cloudmodel.js `hashId`: FNV-1a over the root's UTF-16 code units, 8 hex digits).
|
|
1492
|
+
|
|
1493
|
+
```
|
|
1494
|
+
ProjectRow = {id, name, root, exists, runs, live, last, path_only (runs tied by path only), checkouts,
|
|
1495
|
+
memory_lines (lines of <root>/.forge/memory.md, null when absent), open_findings (not superseded)}
|
|
1496
|
+
Project = {id, name, root, exists, live, last, path_only, memory_off_runs,
|
|
1497
|
+
checkouts: [{path, exists, branch, runs, root}], runs: [RunSummary + identity_source, dataset_uid, no_memory]}
|
|
1498
|
+
ProjectFindings = {id, rows: [Finding], notes: [text], runs, dataset_runs, computed, available}
|
|
1499
|
+
Finding = {source: run|dataset, run (key or null), run_id, task, final_review (its dir name, 'final' from the
|
|
1500
|
+
dataset), attempt, kind: primary|shadow|final, reviewer, verdict, at, id, severity, confidence, location,
|
|
1501
|
+
summary, text, fp (forge issues' key, null when it cannot parse the line), count, occurrences: [{run,
|
|
1502
|
+
run_id, task, attempt, kind, reviewer, at, href}], status, fileable, origin, href (the diff at the finding)}
|
|
1503
|
+
ProjectMemories = {id, sources: [{path, root, branch, ok, ledger, memory, rebuilt_differs, max_lines}], differs,
|
|
1504
|
+
learnings: [{category, key, text, count, states: {source path: state}, rows, last, dataset_only}],
|
|
1505
|
+
notes, memory_off_runs, runs, computed}
|
|
1506
|
+
```
|
|
1507
|
+
|
|
1508
|
+
Findings come from every review of every run dir (parsed by forge-contract.py through `findings.py`), and
|
|
1509
|
+
from `dataset history --json` for runs whose dir is gone (their base commit ties a run whose checkout is
|
|
1510
|
+
gone to the project, as `repos.py` does). `status` comes from one `issues <run> --json --offline --all-runs
|
|
1511
|
+
--include-plausible --include-dismissed` listing per project, matched by `forge issues`' own key, else
|
|
1512
|
+
`superseded` when a later review of the same task (or a later final review) passed, else `open`. Repeats
|
|
1513
|
+
within a task collapse by that key; a line it cannot parse is its own row. Memories run `memory learnings
|
|
1514
|
+
<checkout> --json` for the root and each checkout a run started in that still exists. A run's findings
|
|
1515
|
+
are cached by its `updated` time, the CLI's answers for 300 s; `refresh=1` reads everything again; any
|
|
1516
|
+
other parameter is a `400`.
|
|
1517
|
+
|
|
1518
|
+
### `GET /api/worktrees`
|
|
1519
|
+
|
|
1520
|
+
The Worktrees screen (`forge_ui/worktrees.py`). Read-only, so it answers in `--read-only` mode too.
|
|
1521
|
+
It runs `git worktree list --porcelain -z` in every repository forge-ui knows (the roots of the runs
|
|
1522
|
+
it lists, and the repositories `forge dataset worktrees --json` names), `git status` in each forge
|
|
1523
|
+
worktree on disk, one `git show` per repository for the last commits and one `for-each-ref --merged
|
|
1524
|
+
HEAD` for merged branches; it lists the folders under each `.forge-worktrees` that no repository
|
|
1525
|
+
lists, and adds the dataset's history through `dataset worktrees --json`. Who owns a worktree is
|
|
1526
|
+
forge's rule (`scripts/forge_worktrees.py`, the one `forge runs rm` uses). The answer is cached
|
|
1527
|
+
for 60 s per server; `refresh=1` reads everything again, any other parameter is a `400`. Sizes are
|
|
1528
|
+
walked in a background thread and are `null` until measured (`sizes_pending` counts the rest).
|
|
1529
|
+
|
|
1530
|
+
```
|
|
1531
|
+
Worktrees = {
|
|
1532
|
+
rows: [Row], truncated, runs: [{key, run_id, path, repo, active, command}], repos: [root],
|
|
1533
|
+
notes: [text], dataset: {enabled, since} | null (the CLI failed), computed (unix time),
|
|
1534
|
+
totals: {count, on_disk, bytes, by_status: {status: n}}, sizes_pending
|
|
1535
|
+
}
|
|
1536
|
+
Row = {
|
|
1537
|
+
path, repo (the repository's main working tree, or null), git_dir, run (run key or null),
|
|
1538
|
+
run_id, run_path, task, branch (null when detached), kind (task | integration | candidate |
|
|
1539
|
+
attribute | null), status, merged (branch merged into the repository's HEAD; null unknown),
|
|
1540
|
+
head, commit: {sha, time, subject} | null, created, removed (unix times or null), derived
|
|
1541
|
+
(true: from a run dir or the dataset, no dates), locked (git's reason, '' for none, null when
|
|
1542
|
+
not locked), size (bytes or null), note, commands: [{label, command}]
|
|
1543
|
+
}
|
|
1544
|
+
```
|
|
1545
|
+
|
|
1546
|
+
`status` is one of `in_use`, `dirty`, `locked`, `needed`, `failed`, `finished`, `missing`,
|
|
1547
|
+
`foreign`, `unknown`, `removed`. Commands: `dirty` gets `git -C <path> status`; `failed` gets
|
|
1548
|
+
`git -C <repo> worktree remove <path>`; `finished` gets the same plus `git -C <repo> branch -d
|
|
1549
|
+
<branch>` when the branch is merged; `missing` gets `git -C <repo> worktree prune`; every other
|
|
1550
|
+
status gets none. Paths are quoted for the shell and no command has `--force`. `runs[].command` is
|
|
1551
|
+
`forge runs rm <run-dir> --worktrees --branches --dry-run`, null while the run is active.
|
|
1552
|
+
|
|
1476
1553
|
### `GET /api/config?run=<key>` and `POST /api/config`
|
|
1477
1554
|
|
|
1478
1555
|
The repository is the run's `repo_root` (see RunSummary) when that is an existing absolute directory,
|