@giamme/forge 0.17.0 → 0.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/SKILL.md +16 -3
  3. package/VERSION +1 -1
  4. package/docs/artifacts.md +8 -0
  5. package/docs/commands.md +70 -6
  6. package/docs/dataset.md +5 -0
  7. package/docs/decomposed-runs.md +8 -0
  8. package/docs/forge-ui.md +23 -2
  9. package/docs/memory.md +2 -0
  10. package/docs/safety.md +8 -0
  11. package/forge +24 -1
  12. package/package.json +1 -1
  13. package/references/dataset.md +19 -0
  14. package/references/decompose.md +134 -1
  15. package/references/solo.md +2 -1
  16. package/references/ui.md +5 -2
  17. package/scripts/forge-artifact.sh +14 -0
  18. package/scripts/forge-brief.py +132 -0
  19. package/scripts/forge-compare.py +11 -1
  20. package/scripts/forge-config.py +176 -9
  21. package/scripts/forge-contract.py +46 -3
  22. package/scripts/forge-control.py +86 -13
  23. package/scripts/forge-dispatch.sh +14 -10
  24. package/scripts/forge-du.py +167 -0
  25. package/scripts/forge-lib-adopt.sh +1 -0
  26. package/scripts/forge-lib-plans.sh +5 -2
  27. package/scripts/forge-lib-review.sh +29 -1
  28. package/scripts/forge-metrics.sh +7 -3
  29. package/scripts/forge-parallel-options.sh +4 -0
  30. package/scripts/forge-parallel.sh +503 -9
  31. package/scripts/forge-prompt.py +120 -0
  32. package/scripts/forge-retro.py +115 -0
  33. package/scripts/forge-runs-compact.py +443 -0
  34. package/scripts/forge-runs-rm.py +2 -0
  35. package/scripts/forge-runs.py +18 -3
  36. package/scripts/forge-schedule.py +279 -4
  37. package/scripts/forge-shadow.py +7 -1
  38. package/scripts/forge-solo.sh +2 -0
  39. package/scripts/forge-summarize.py +698 -0
  40. package/scripts/forge-ui-options.sh +10 -0
  41. package/scripts/forge_brief/__init__.py +587 -0
  42. package/scripts/forge_brief/answers.py +459 -0
  43. package/scripts/forge_dataset/__init__.py +10 -0
  44. package/scripts/forge_dataset/export.py +18 -4
  45. package/scripts/forge_dataset/facts.py +6 -4
  46. package/scripts/forge_dataset/harvest.py +40 -6
  47. package/scripts/forge_dataset/history.py +5 -3
  48. package/scripts/forge_decide/__init__.py +11 -1
  49. package/scripts/forge_locations.py +366 -0
  50. package/scripts/forge_registry.py +19 -0
  51. package/scripts/forge_retro/__init__.py +417 -0
  52. package/scripts/forge_retro/issues.py +1193 -0
  53. package/scripts/forge_retro/report.py +671 -0
  54. package/scripts/forge_side/__init__.py +477 -0
  55. package/scripts/forge_storage.py +515 -0
  56. package/ui/README.md +68 -8
  57. package/ui/docs/api.md +205 -17
  58. package/ui/forge_ui/control.py +92 -11
  59. package/ui/forge_ui/export.py +24 -5
  60. package/ui/forge_ui/links.py +337 -0
  61. package/ui/forge_ui/models.py +57 -4
  62. package/ui/forge_ui/projects.py +4 -1
  63. package/ui/forge_ui/reader.py +661 -30
  64. package/ui/forge_ui/static/app.js +86 -4
  65. package/ui/forge_ui/static/briefview.js +302 -0
  66. package/ui/forge_ui/static/checksview.js +6 -2
  67. package/ui/forge_ui/static/controls.js +5 -0
  68. package/ui/forge_ui/static/index.html +3 -0
  69. package/ui/forge_ui/static/panel.js +268 -2
  70. package/ui/forge_ui/static/runmodel.js +13 -1
  71. package/ui/forge_ui/static/storageview.js +271 -0
  72. package/ui/forge_ui/static/style.css +99 -3
  73. package/ui/forge_ui/static/worktreesview.js +3 -3
  74. package/ui/forge_ui/storage.py +136 -0
  75. package/ui/forge_ui/transcripts.py +35 -10
  76. package/ui/forge_ui/worktrees.py +154 -13
@@ -25,9 +25,23 @@ import urllib.parse
25
25
  from forge_ui import __version__, reader, server
26
26
 
27
27
  STATIC = server.STATIC_DIR
28
- # what the exported page runs, in index.html's order; the cloud, the leaderboard and notifications need a server
29
- SCRIPTS = ('theme.js', 'icons.js', 'datatable.js', 'shell.js', 'runmodel.js', 'cloudmodel.js', 'graph.js', 'gantt.js', 'verifyview.js', 'checksview.js', 'panel.js', 'diffview.js', 'convo.js', 'files.js', 'map3d.js',
30
- 'search.js', 'app.js')
28
+ # what the exported page runs; every other script index.html loads is in LEFT_OUT, with the reason
29
+ SCRIPTS = ('theme.js', 'icons.js', 'datatable.js', 'shell.js', 'runmodel.js', 'cloudmodel.js', 'graph.js', 'gantt.js', 'verifyview.js', 'checksview.js',
30
+ 'briefview.js', 'panel.js', 'diffview.js', 'convo.js', 'files.js', 'map3d.js', 'search.js', 'app.js')
31
+ LEFT_OUT = {
32
+ 'uikit.js': 'write helpers and the guards that keep a poll from redrawing what a person holds; a snapshot neither writes nor polls',
33
+ 'controls.js': 'changes a live run',
34
+ 'rundelete.js': 'deletes a run',
35
+ 'settings.js': 'the settings screen reads and writes the server',
36
+ 'notify.js': 'notifications come from polling the run list',
37
+ 'modelstats.js': 'the model leaderboard needs /api/models, which a snapshot does not carry',
38
+ 'leaderboard.js': 'the model leaderboard needs /api/models, which a snapshot does not carry',
39
+ 'cloudui.js': 'the run cloud needs every run, and a snapshot carries one',
40
+ 'findingsview.js': 'the open-findings page dismisses findings or files them as issues',
41
+ 'worktreesview.js': 'the Worktrees screen needs /api/worktrees',
42
+ 'storageview.js': 'the Disk screen needs /api/storage',
43
+ 'projectsview.js': 'the Projects screen needs every run of the repository',
44
+ }
31
45
  MODULES = ('iso.js', 'cloud3d.js', 'findings3d.js', 'stagectl.js', 'scene3d.js') # bundled in dependency order
32
46
  DIFF_CAP = 1 << 20 # one diff's JSON
33
47
  TRANSCRIPT_CAP = 2 << 20 # one execution's transcript
@@ -40,9 +54,14 @@ _TEXT_KEYS = frozenset(('prompt', 'last', 'request', 'log_tail', 'dwarf_tail', '
40
54
  'dwarf_input', 'error', 'last_line', 'message', 'excerpt', 'tail', 'lines', 'call', 'split',
41
55
  'needs_input', 'detail'))
42
56
  # keys that are private text only under one parent: a person's --reason on each decision (`reason` elsewhere is
43
- # a short machine word, such as a sweep's dropped-finding reason, and stays); the --reason of each adoption too
57
+ # a short machine word, such as a sweep's dropped-finding reason, and stays); the --reason of each adoption too.
58
+ # A task header's goal and criteria are paragraphs of the prompt; the run's own `goal` (its title) stays.
59
+ # A brief question's why, the choices in options, its default and the answer a person typed are private
60
+ # only under `questions` and `parked` (`text` is already in _TEXT_KEYS). `scope`, `state` and `id` stay.
44
61
  _TEXT_KEYS_UNDER = {'decisions': frozenset(('reason',)), 'adoptions': frozenset(('reason',)),
45
- 'adoption': frozenset(('reason',))}
62
+ 'adoption': frozenset(('reason',)), 'header': frozenset(('goal', 'criteria')),
63
+ 'questions': frozenset(('why', 'options', 'default', 'answer')),
64
+ 'parked': frozenset(('why', 'options', 'default', 'answer'))}
46
65
 
47
66
 
48
67
  def _enc(value):
@@ -0,0 +1,337 @@
1
+ """GitHub links named in a task's markdown. No network, and no git."""
2
+ from __future__ import annotations
3
+
4
+ import re
5
+
6
+
7
+ # A fenced block (CommonMark: up to three spaces, matching marker, backtick info has no backtick).
8
+ _FENCE = re.compile(r'^( {0,3})(`{3,}|~{3,})(.*)$')
9
+ # An ATX heading. `#8` has no space, so it stays a reference; `# Title` does not.
10
+ _ATX = re.compile(r'^[ ]{0,3}#{1,6}(?:[ \t]|$)')
11
+ # One block-quote marker: up to three spaces, `>`, and one optional space (CommonMark).
12
+ _QUOTE = re.compile(r'^( {0,3}> ?)')
13
+ # A thematic break. It takes precedence over a list marker (`- - -` is not a list).
14
+ _HR = re.compile(r'^ {0,3}([-*_])(?:[ \t]*\1){2,}[ \t]*$')
15
+ _NEXT = re.compile(r'https://github\.com/[^\s<>)\]]+|(?<![\w/])#(\d+)\b', re.IGNORECASE)
16
+ _ISSUE = re.compile(
17
+ r'^https://github\.com/([^/\s?#]+)/([^/\s?#]+)/(issues|pull)/(\d+)(?:[/?#]|$)', re.IGNORECASE)
18
+ _REMOTES = (
19
+ re.compile(r'^git@github\.com:([^/]+)/([^/]+?)(?:\.git)?/?$', re.IGNORECASE),
20
+ re.compile(r'^ssh://(?:git@)?github\.com/([^/]+)/([^/]+?)(?:\.git)?/?$', re.IGNORECASE),
21
+ re.compile(r'^https://github\.com/([^/]+)/([^/]+?)(?:\.git)?/?$', re.IGNORECASE),
22
+ re.compile(r'^git://github\.com/([^/]+)/([^/]+?)(?:\.git)?/?$', re.IGNORECASE),
23
+ )
24
+
25
+
26
+ class _ListItem:
27
+ """One open list item. `indent` is the spaces a later line needs to stay inside it."""
28
+
29
+ def __init__(self, indent, has_content):
30
+ self.indent = indent
31
+ self.has_content = has_content
32
+
33
+
34
+ def _blank(line):
35
+ return line.strip(' \t') == ''
36
+
37
+
38
+ def _expand_leading(line):
39
+ """Leading tabs become spaces at stops of 4, the way CommonMark measures indent.
40
+
41
+ Only the indent is expanded. A tab later in the line is left as it is, and the original
42
+ line is what gets masked, so a reference's text does not move.
43
+ """
44
+ column = 0
45
+ index = 0
46
+ while index < len(line) and line[index] in ' \t':
47
+ if line[index] == ' ':
48
+ column += 1
49
+ else:
50
+ column += 4 - (column % 4)
51
+ index += 1
52
+ return ' ' * column + line[index:]
53
+
54
+
55
+ def _space_indent(line):
56
+ index = 0
57
+ while index < len(line) and line[index] == ' ':
58
+ index += 1
59
+ return index
60
+
61
+
62
+ def _open_fence(line):
63
+ """`(marker, length, indent)` or None. `line` is what remains after its containers."""
64
+ match = _FENCE.match(line)
65
+ if match is None:
66
+ return None
67
+ indent, mark, info = match.group(1), match.group(2), match.group(3)
68
+ if mark[0] == '`' and '`' in info:
69
+ return None
70
+ return mark[0], len(mark), len(indent)
71
+
72
+
73
+ def _close_fence(line, opened):
74
+ match = _FENCE.match(line)
75
+ if match is None:
76
+ return False
77
+ mark, info = match.group(2), match.group(3)
78
+ # CommonMark: a closer may take up to three spaces whatever the opener took; _FENCE caps it.
79
+ return mark[0] == opened[0] and len(mark) >= opened[1] and not info.strip()
80
+
81
+
82
+ def _list_opener(line):
83
+ """`(content indent, has content)` when `line` starts a list item, else None.
84
+
85
+ Four or more spaces before the marker is an indented code block, not a list. More than
86
+ four spaces after the marker are content; the item's own indent stays marker plus one.
87
+ """
88
+ if _HR.match(line):
89
+ return None
90
+ mark_at = 0
91
+ while mark_at < 3 and mark_at < len(line) and line[mark_at] == ' ':
92
+ mark_at += 1
93
+ if mark_at >= len(line) or line[mark_at] == ' ':
94
+ return None
95
+ body = line[mark_at:]
96
+ if body[0] in '-+*':
97
+ width = 1
98
+ else:
99
+ width = 0
100
+ while width < len(body) and width < 9 and body[width].isdigit():
101
+ width += 1
102
+ if width == 0 or width >= len(body) or body[width] not in '.)':
103
+ return None
104
+ width += 1
105
+ after = body[width:]
106
+ spaces = 0
107
+ while spaces < len(after) and after[spaces] == ' ':
108
+ spaces += 1
109
+ if spaces == 0 and after != '':
110
+ return None
111
+ if spaces == len(after):
112
+ padding, has_content = 1, False
113
+ elif spaces > 4:
114
+ padding, has_content = 1, True
115
+ else:
116
+ padding, has_content = spaces, True
117
+ return mark_at + width + padding, has_content
118
+
119
+
120
+ def _list_interrupts(line):
121
+ """A bullet interrupts a paragraph. An ordered marker does only when its number is 1."""
122
+ if _list_opener(line) is None:
123
+ return False
124
+ body = line[_space_indent(line):]
125
+ return body[:1] in '-+*' or body.startswith('1.') or body.startswith('1)')
126
+
127
+
128
+ def _interrupts_paragraph(line):
129
+ return (_ATX.match(line) is not None or _open_fence(line) is not None or _QUOTE.match(line) is not None
130
+ or _HR.match(line) is not None or _list_interrupts(line))
131
+
132
+
133
+ def _open_containers(rest, containers, paragraph):
134
+ """Open block quotes and list items at the start of `rest`. Return the leaf content."""
135
+ while rest:
136
+ match = _QUOTE.match(rest)
137
+ if match:
138
+ containers.append('quote')
139
+ rest = rest[match.end():]
140
+ paragraph = False
141
+ continue
142
+ opened = _list_opener(rest)
143
+ if opened is not None and (not paragraph or _list_interrupts(rest)):
144
+ indent, has_content = opened
145
+ containers.append(_ListItem(indent, has_content))
146
+ rest = rest[indent:]
147
+ paragraph = False
148
+ continue
149
+ break
150
+ return rest
151
+
152
+
153
+ def _continue(line, containers, allow_lazy):
154
+ """Match open quotes and list items outside-in.
155
+
156
+ Return `(kept, rest, lazy)`. A miss closes that container and everything inside it
157
+ (`kept` false) so the line is tried again. A fenced block does not continue lazily:
158
+ `allow_lazy` is only for a paragraph, and a line that starts a block is not one.
159
+ """
160
+ rest = line
161
+ for index, box in enumerate(containers):
162
+ if box == 'quote':
163
+ match = _QUOTE.match(rest)
164
+ if match:
165
+ rest = rest[match.end():]
166
+ continue
167
+ elif _blank(rest):
168
+ # A blank line stays in an item that already has content, and ends an empty one.
169
+ if not box.has_content:
170
+ del containers[index:]
171
+ return False, line, False
172
+ continue
173
+ else:
174
+ spaces = _space_indent(rest)
175
+ if spaces >= box.indent:
176
+ rest = rest[box.indent:]
177
+ box.has_content = True
178
+ continue
179
+ if allow_lazy and not _blank(line) and not _interrupts_paragraph(rest):
180
+ return True, line, True
181
+ del containers[index:]
182
+ return False, line, False
183
+ return True, rest, False
184
+
185
+
186
+ def _mask(text):
187
+ """Blank fenced blocks, inline code spans, and ATX heading lines. Length stays put.
188
+
189
+ A fence inside a block quote ends when the quote ends: a fenced block does not run on
190
+ into the next paragraph. A fence under a list item is indented with the item; that
191
+ indent is removed before the marker is recognized. A marker indented four or more
192
+ spaces outside a list is an indented code block and is left alone. A quoted fence
193
+ marker inside a top-level fence is content, so it does not close the outer fence.
194
+ """
195
+ masked, containers, fence, paragraph = [], [], None, False
196
+ lines = text.splitlines()
197
+ index = 0
198
+ while index < len(lines):
199
+ line = lines[index]
200
+ view = _expand_leading(line)
201
+ if fence is not None:
202
+ kept, rest, _lazy = _continue(view, containers, allow_lazy=False)
203
+ if not kept:
204
+ fence = None
205
+ continue
206
+ if _close_fence(rest, fence):
207
+ fence = None
208
+ masked.append(' ' * len(line))
209
+ index += 1
210
+ continue
211
+ kept, rest, lazy = _continue(view, containers, allow_lazy=paragraph)
212
+ if not kept:
213
+ continue
214
+ if lazy:
215
+ paragraph = True
216
+ masked.append(line)
217
+ index += 1
218
+ continue
219
+ rest = _open_containers(rest, containers, paragraph)
220
+ opened = _open_fence(rest)
221
+ if opened is not None:
222
+ fence = opened
223
+ paragraph = False
224
+ masked.append(' ' * len(line))
225
+ index += 1
226
+ continue
227
+ paragraph = not _blank(rest) and _ATX.match(rest) is None and _HR.match(rest) is None
228
+ masked.append(line)
229
+ index += 1
230
+ body = _mask_spans('\n'.join(masked))
231
+ blanked = []
232
+ for line in body.split('\n'):
233
+ blanked.append(' ' * len(line) if _ATX.match(line) else line)
234
+ return '\n'.join(blanked)
235
+
236
+
237
+ def _mask_spans(text):
238
+ """Blank inline code spans. A span closes on the next run of the same number of backticks."""
239
+ out, index, size = [], 0, len(text)
240
+ while index < size:
241
+ if text[index] != '`':
242
+ out.append(text[index])
243
+ index += 1
244
+ continue
245
+ end = index
246
+ while end < size and text[end] == '`':
247
+ end += 1
248
+ length, cursor, close = end - index, end, None
249
+ while cursor < size:
250
+ if text[cursor] != '`':
251
+ cursor += 1
252
+ continue
253
+ run = cursor
254
+ while run < size and text[run] == '`':
255
+ run += 1
256
+ if run - cursor == length:
257
+ close = run
258
+ break
259
+ cursor = run
260
+ if close is None:
261
+ out.append(text[index:end])
262
+ index = end
263
+ else:
264
+ out.append(' ' * (close - index))
265
+ index = close
266
+ return ''.join(out)
267
+
268
+
269
+ def _slug(origin):
270
+ """`(owner, repo)` of a GitHub remote, or None. SSH and HTTPS both work. No network."""
271
+ if not isinstance(origin, str):
272
+ return None
273
+ text = origin.strip()
274
+ if len(text) >= 2 and text[0] == text[-1] and text[0] in '\'"':
275
+ text = text[1:-1].strip()
276
+ for pattern in _REMOTES:
277
+ match = pattern.match(text)
278
+ if match is None:
279
+ continue
280
+ owner, repo = match.group(1), match.group(2)
281
+ if owner in ('.', '..') or repo in ('.', '..'):
282
+ return None
283
+ return owner, repo
284
+ return None
285
+
286
+
287
+ def _number(text):
288
+ """The integer, or None when the digit string is longer than Python will convert."""
289
+ try:
290
+ return int(text)
291
+ except ValueError:
292
+ return None
293
+
294
+
295
+ def _issue(token, source):
296
+ token = token.rstrip('.,;:!?')
297
+ match = _ISSUE.match(token)
298
+ if match is None:
299
+ return dict(kind='url', number=None, url=token, source=source)
300
+ number = _number(match.group(4))
301
+ # A number past the conversion limit is still a URL; it is not an issue number.
302
+ if number is None:
303
+ return dict(kind='url', number=None, url=token, source=source)
304
+ owner, repo, kind = match.group(1), match.group(2), match.group(3).lower()
305
+ path = 'pull' if kind == 'pull' else 'issues'
306
+ url = f'https://github.com/{owner}/{repo}/{path}/{number}'
307
+ return dict(kind='pr' if kind == 'pull' else 'issue', number=number, url=url, source=source)
308
+
309
+
310
+ def extract(text, source, origin=None):
311
+ """`[{kind, number, url, source}]` in order, deduplicated.
312
+
313
+ `kind` is `issue`, `pr` or `url`. A `#N` reference is an issue; its url is
314
+ `https://github.com/<owner>/<repo>/issues/N` when `origin` is that repo's GitHub
315
+ remote, and null otherwise. Full issue and pull URLs are canonical, so the same
316
+ number written as `#N` and as a URL is one link. A digit string Python will not
317
+ convert is skipped for `#N`, and kept as kind `url` for a full URL. Nothing is fetched.
318
+ """
319
+ if not text:
320
+ return []
321
+ slug = _slug(origin)
322
+ found, seen = [], set()
323
+ for match in _NEXT.finditer(_mask(text)):
324
+ if match.group(1) is None:
325
+ item = _issue(match.group(0), source)
326
+ else:
327
+ number = _number(match.group(1))
328
+ if number is None:
329
+ continue
330
+ url = f'https://github.com/{slug[0]}/{slug[1]}/issues/{number}' if slug else None
331
+ item = dict(kind='issue', number=number, url=url, source=source)
332
+ key = (item['kind'], item['number'], item['url'])
333
+ if key in seen:
334
+ continue
335
+ seen.add(key)
336
+ found.append(item)
337
+ return found
@@ -7,14 +7,16 @@ implementer is censored, never counted as a failure.
7
7
  from __future__ import annotations
8
8
 
9
9
  from collections import OrderedDict
10
+ import importlib.util
10
11
  import json
11
12
  import math
12
13
  import os
13
14
  from pathlib import Path
15
+ import sys
14
16
  import threading
15
17
  import time
16
18
 
17
- from forge_ui import executions, reader
19
+ from forge_ui import executions, findings, reader
18
20
 
19
21
 
20
22
  _MAX_ROWS = 50000
@@ -35,6 +37,57 @@ def _alias(spec):
35
37
  return (spec.split(':', 1)[0] or None) if isinstance(spec, str) else None
36
38
 
37
39
 
40
+ _DATASET = Path(__file__).resolve().parents[2] / 'scripts' / 'forge_dataset' / '__init__.py'
41
+ _SIDE_LOCK = threading.Lock()
42
+ _SIDE_FN = {}
43
+
44
+
45
+ def _is_side_role():
46
+ """forge_dataset.is_side_role, loaded read-only the way reader loads forge_infra. None when it cannot be."""
47
+ with _SIDE_LOCK:
48
+ if 'fn' in _SIDE_FN:
49
+ return _SIDE_FN['fn']
50
+ fn = None
51
+ scripts = str(_DATASET.parents[1])
52
+ inserted = scripts not in sys.path
53
+ if inserted:
54
+ sys.path.insert(0, scripts)
55
+ try:
56
+ spec = importlib.util.spec_from_file_location(
57
+ 'forge_dataset_for_ui', _DATASET,
58
+ loader=findings._ReadOnlyLoader('forge_dataset_for_ui', str(_DATASET)))
59
+ module = importlib.util.module_from_spec(spec)
60
+ spec.loader.exec_module(module)
61
+ candidate = getattr(module, 'is_side_role', None)
62
+ fn = candidate if callable(candidate) else None
63
+ except Exception:
64
+ fn = None
65
+ finally:
66
+ if inserted and scripts in sys.path:
67
+ sys.path.remove(scripts)
68
+ _SIDE_FN['fn'] = fn
69
+ return fn
70
+
71
+
72
+ def side_role(role) -> bool:
73
+ """A side dispatch: harvested `side_*`, or the on-disk role `side` (`is_side_role` rejects the bare name).
74
+
75
+ Not an attempt. A shadow review is a separate flag on the execution; this is only the role.
76
+ """
77
+ if role == 'side':
78
+ return True
79
+ fn = _is_side_role()
80
+ if fn is not None:
81
+ return bool(fn(role))
82
+ return isinstance(role, str) and role.startswith('side_')
83
+
84
+
85
+ def _primary_qa(item) -> bool:
86
+ """The review of record for an attempt. A shadow review and a side dispatch are not one."""
87
+ role = item['role']
88
+ return role == 'qa' and not item['shadow'] and role != 'qa_shadow' and not side_role(role)
89
+
90
+
38
91
  def _builtin_profiles_path():
39
92
  """scripts/forge_decide/builtin_profiles.json, located from this package the way reader._forge_infra finds
40
93
  scripts/forge_infra.py. Read as data: forge-ui never imports forge_decide."""
@@ -127,7 +180,7 @@ def _attempts(rows, execs, plan_spec):
127
180
  result = []
128
181
  for n, (status, logged) in rows.items():
129
182
  dwarfs = [item for item in execs if item['role'] == 'dwarf' and item['attempt'] == n]
130
- reviews = [item for item in execs if item['role'] == 'qa' and not item['shadow'] and item['attempt'] == n]
183
+ reviews = [item for item in execs if _primary_qa(item) and item['attempt'] == n]
131
184
  outcome, reason = _outcome(status, dwarfs, reviews)
132
185
  last = dwarfs[-1] if dwarfs else None
133
186
  model = last['model'] if last is not None else None
@@ -166,7 +219,7 @@ def _route(rd, base):
166
219
  def _reviews(key, ident, execs, shadows):
167
220
  rows = []
168
221
  for item in execs:
169
- if item['role'] == 'qa' and not item['shadow'] and item['state'] == 'done':
222
+ if _primary_qa(item) and item['state'] == 'done':
170
223
  model = item['model'] or {}
171
224
  rows.append(dict(run=key, task=ident, n=item['attempt'], kind='primary', alias=model.get('alias'),
172
225
  spec=model.get('spec'), verdict=item['verdict'], findings=item['findings'],
@@ -176,7 +229,7 @@ def _reviews(key, ident, execs, shadows):
176
229
  continue
177
230
  model = (items[-1]['model'] if items else None) or {}
178
231
  spec = entry['spec'] if isinstance(entry['spec'], str) else model.get('spec')
179
- primaries = [item for item in execs if item['role'] == 'qa' and not item['shadow']
232
+ primaries = [item for item in execs if _primary_qa(item)
180
233
  and item['attempt'] == entry['attempt'] and item['model']]
181
234
  rows.append(dict(run=key, task=ident, n=entry['attempt'], kind='shadow', alias=model.get('alias') or _alias(spec),
182
235
  spec=spec, verdict=entry['verdict'], findings=entry['findings'],
@@ -30,7 +30,7 @@ from pathlib import Path
30
30
  import threading
31
31
  import time
32
32
 
33
- from forge_ui import executions, findings as F, reader, repos
33
+ from forge_ui import executions, findings as F, models, reader, repos
34
34
 
35
35
  ISSUES = Path(__file__).resolve().parents[2] / 'scripts' / 'forge-issues.py'
36
36
  CACHE_S = 300
@@ -246,6 +246,9 @@ def _dataset_occurrences(hist, runs_here):
246
246
  for (run, task), reviews in by_run.items():
247
247
  reviews.sort(key=lambda r: r.get('ts') or 0)
248
248
  for index, review in enumerate(reviews):
249
+ # A side dispatch is not a review of the task. qa_shadow stays a shadow row.
250
+ if models.side_role(review.get('role')):
251
+ continue
249
252
  superseded = any(r.get('verdict') == 'PASS' and r.get('role') == 'qa' for r in reviews[index + 1:])
250
253
  for item in review.get('findings') or []:
251
254
  head = item['head']