@giamme/forge 0.12.1 → 0.13.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 (107) hide show
  1. package/CHANGELOG.md +55 -0
  2. package/README.md +1 -1
  3. package/SKILL.md +29 -12
  4. package/VERSION +1 -1
  5. package/docs/add-ons.md +11 -6
  6. package/docs/artifacts.md +12 -6
  7. package/docs/commands.md +179 -17
  8. package/docs/decomposed-runs.md +13 -5
  9. package/docs/forge-ui.md +7 -3
  10. package/docs/memory.md +2 -1
  11. package/docs/models.md +4 -2
  12. package/docs/reviews.md +49 -20
  13. package/docs/troubleshooting.md +3 -1
  14. package/forge +17 -1
  15. package/package.json +1 -1
  16. package/references/dataset.md +39 -13
  17. package/references/decision-models.md +759 -0
  18. package/references/decompose.md +166 -29
  19. package/references/harnesses.md +10 -3
  20. package/references/planning.md +8 -0
  21. package/references/solo.md +13 -3
  22. package/scripts/forge-artifact.sh +30 -4
  23. package/scripts/forge-config.py +238 -29
  24. package/scripts/forge-contract.py +95 -56
  25. package/scripts/forge-control.py +40 -9
  26. package/scripts/forge-decide.py +6 -0
  27. package/scripts/forge-dispatch.sh +38 -16
  28. package/scripts/forge-fail-first.py +2 -2
  29. package/scripts/forge-gate-addressed.sh +40 -0
  30. package/scripts/forge-gate-message.sh +64 -0
  31. package/scripts/forge-issues.py +321 -33
  32. package/scripts/forge-jev-options.sh +269 -42
  33. package/scripts/forge-lib-attribute.sh +447 -0
  34. package/scripts/forge-lib-gates.sh +32 -0
  35. package/scripts/forge-lib-plans.sh +17 -6
  36. package/scripts/forge-lib-review.sh +22 -17
  37. package/scripts/forge-lib-task.sh +217 -38
  38. package/scripts/forge-lib-verify.sh +45 -8
  39. package/scripts/forge-memory.sh +3 -3
  40. package/scripts/forge-parallel-options.sh +18 -5
  41. package/scripts/forge-parallel.sh +455 -303
  42. package/scripts/forge-plan-check.py +35 -1
  43. package/scripts/forge-pre-review.py +437 -0
  44. package/scripts/forge-prompt.py +25 -5
  45. package/scripts/forge-route.py +2 -2
  46. package/scripts/forge-runtime.py +10 -4
  47. package/scripts/forge-schedule.py +21 -5
  48. package/scripts/forge-shadow.py +2 -2
  49. package/scripts/forge-solo.sh +38 -9
  50. package/scripts/forge-submodules.py +389 -0
  51. package/scripts/forge_dataset/cli.py +12 -6
  52. package/scripts/forge_dataset/export.py +55 -45
  53. package/scripts/forge_dataset/harvest.py +33 -5
  54. package/scripts/{forge_jev/outcome.py → forge_dataset/states.py} +21 -7
  55. package/scripts/forge_decide/__init__.py +141 -0
  56. package/scripts/forge_decide/budget.py +149 -0
  57. package/scripts/forge_decide/cache.py +66 -0
  58. package/scripts/forge_decide/cli.py +953 -0
  59. package/scripts/forge_decide/doctor.py +221 -0
  60. package/scripts/forge_decide/label_addressed.py +75 -0
  61. package/scripts/forge_decide/label_attribution.py +62 -0
  62. package/scripts/forge_decide/label_coverage.py +81 -0
  63. package/scripts/forge_decide/label_message.py +38 -0
  64. package/scripts/forge_decide/label_prompt.py +139 -0
  65. package/scripts/forge_decide/labels.py +328 -0
  66. package/scripts/forge_decide/metrics.py +125 -0
  67. package/scripts/forge_decide/migrate.py +226 -0
  68. package/scripts/forge_decide/providers.py +292 -0
  69. package/scripts/forge_decide/replay.py +350 -0
  70. package/scripts/forge_decide/report.py +382 -0
  71. package/scripts/forge_decide/resolve.py +397 -0
  72. package/scripts/forge_decide/sites.py +377 -0
  73. package/scripts/forge_jev/__init__.py +202 -104
  74. package/scripts/forge_jev/addressed.py +171 -0
  75. package/scripts/forge_jev/attribution.py +198 -0
  76. package/scripts/forge_jev/cli.py +460 -382
  77. package/scripts/forge_jev/client.py +155 -77
  78. package/scripts/forge_jev/coupling.py +19 -87
  79. package/scripts/forge_jev/coverage.py +303 -0
  80. package/scripts/forge_jev/findings.py +219 -0
  81. package/scripts/forge_jev/gates.py +225 -27
  82. package/scripts/forge_jev/memory.py +65 -4
  83. package/scripts/forge_jev/message.py +134 -0
  84. package/scripts/forge_jev/plan_gates.py +294 -0
  85. package/scripts/forge_jev/questions.py +173 -313
  86. package/scripts/forge_jev/verify.py +130 -104
  87. package/ui/README.md +2 -2
  88. package/ui/docs/api.md +60 -32
  89. package/ui/forge_ui/control.py +60 -11
  90. package/ui/forge_ui/export.py +2 -1
  91. package/ui/forge_ui/models.py +1 -0
  92. package/ui/forge_ui/reader.py +87 -14
  93. package/ui/forge_ui/static/app.js +2 -2
  94. package/ui/forge_ui/static/controls.js +20 -13
  95. package/ui/forge_ui/static/panel.js +63 -17
  96. package/ui/forge_ui/static/runmodel.js +23 -1
  97. package/ui/forge_ui/static/scene3d.js +2 -15
  98. package/ui/forge_ui/static/settings.js +336 -41
  99. package/ui/forge_ui/static/style.css +19 -7
  100. package/references/jev.md +0 -865
  101. package/scripts/forge_jev/backtest.py +0 -322
  102. package/scripts/forge_jev/corpus.py +0 -156
  103. package/scripts/forge_jev/features.py +0 -24
  104. package/scripts/forge_jev/predict.py +0 -204
  105. package/scripts/forge_jev/review.py +0 -73
  106. package/scripts/forge_jev/routing.py +0 -271
  107. package/scripts/forge_jev/subset.py +0 -123
@@ -1,18 +1,17 @@
1
- """Verify-command discovery and failure triage: select, never generate, and judge flakes."""
1
+ """Verify-command discovery: select, never generate."""
2
2
  from __future__ import annotations
3
3
 
4
4
  import json
5
5
  from pathlib import Path
6
6
  import re
7
+ import subprocess
7
8
 
8
9
  from . import enabled, load_config, threshold
9
10
  from .client import ask, choice, noul, probabilities, score
10
- from .questions import failure_triage, runs_tests, verify_runtime, verify_selection
11
+ from .questions import runs_tests, verify_runtime, verify_selection
11
12
 
12
13
  CANDIDATE_CAP = 25 # keeps one discover() request small; deterministic order means the
13
14
  # cap always drops the same (least-likely) tail, never a random one.
14
- LOG_TAIL_CHARS = 4000 # the failure signature (assertion, traceback) is at the end of a
15
- # log; the setup/build noise at the start is not needed to triage it.
16
15
 
17
16
  _PKG_SCRIPT_RE = re.compile(r'^(test|check|ci|verify)(?:[:\-]|$)', re.I)
18
17
  _MAKE_TARGETS = ('test', 'tests', 'check', 'verify', 'ci')
@@ -22,25 +21,80 @@ _WORKFLOW_TEST_HINT_RE = re.compile(
22
21
  r'\b(pytest|npm (?:test|run\s+test\S*)|yarn (?:test|run\s+test\S*)|go test|cargo test|'
23
22
  r'make test|tox\b|jest|vitest|mvn test|gradle test|rspec|phpunit|ctest|go\s+vet\s+&&\s+go\s+test)\b',
24
23
  re.I)
25
- _MEMORY_CMD_RES = (
26
- re.compile(r'\bpytest(?:\s+-{1,2}\S+)*'),
27
- re.compile(r'\bmake\s+\w[\w-]*'),
28
- re.compile(r'\bnpm run\s+[\w:_-]+'),
29
- re.compile(r'\bnpm test\b'),
30
- re.compile(r'\byarn(?:\s+run)?\s+[\w:_-]+'),
31
- re.compile(r'\bgo test(?:\s+\S+)*'),
32
- re.compile(r'\bcargo test(?:\s+\S+)*'),
33
- re.compile(r'\btox\b'),
34
- re.compile(r'\bnox\b'),
24
+ # A remembered command is read off a rendered fact two ways (#42). A code span is the command as
25
+ # its author wrote it, so its content is taken whole, quotes and option values included. Prose is
26
+ # scanned for a runner and the arguments after it, and an argument is a flag, a path or a quoted
27
+ # string: a plain word ends the command, so "cargo test --workspace runs all tests" names
28
+ # `cargo test --workspace`. A bare flag followed by a plain word may take that word as its value
29
+ # ("--features integration"), and half an option is a command cargo rejects, so the command ends
30
+ # before such a flag unless the word is plain prose ("runs", "also"). A number after a flag is
31
+ # always its value ("--jobs 2"), so it stays with the flag. The rendered source tag
32
+ # ("[tests/]") matches none of these forms.
33
+ _CODE_SPAN_RE = re.compile(r'`([^`\n]+)`')
34
+ _PROSE_WORD = r'[A-Za-z][\w-]*(?![\w/-]|\.\w)'
35
+ _PROSE_STOP = (r'(?:runs?|running|also|and|or|then|which|that|for|to|in|on|with|before|after|if|'
36
+ r'when|but|is|are|will|should|must|can|takes?|checks?|covers?|lints?|builds?|'
37
+ r'executes?|needs?|requires?)(?![\w/-]|\.\w)')
38
+ _PROSE_FLAG = (r'-{1,2}[^\s`\'"\[\]=]+(?![^\s`\'"\[\]=])(?:=[^\s`\'"\[\]]*|\s+\d[\w.]*(?![\w/-])|'
39
+ r'(?!\s+(?!' + _PROSE_STOP + r')' + _PROSE_WORD + r'))')
40
+ _PROSE_ARG = r'''(?:''' + _PROSE_FLAG + r'''|[\w.-]*/[\w./-]*|"[^"\n]*"|'[^'\n]*')'''
41
+ # A runner is a whole word: "pytest.ini" and "tests/pytest/" are files, not the pytest command.
42
+ _HEAD_START = r'(?<![\w./-])'
43
+ _HEAD_END = r'(?![\w/-]|\.\w)'
44
+ _MEMORY_HEADS = (
45
+ r'pytest',
46
+ r'make\s+\w[\w-]*',
47
+ r'npm run\s+[\w:_-]+',
48
+ r'npm test',
49
+ r'yarn(?:\s+run)?\s+[\w:_-]+',
50
+ r'go test',
51
+ r'cargo test',
52
+ r'tox',
53
+ r'nox',
54
+ r'bash\s+[\w./-]+\.sh',
55
+ r'python3?\s+[\w./-]+\.py',
56
+ )
57
+ _MEMORY_HEAD_RES = tuple(re.compile(_HEAD_START + head + _HEAD_END) for head in _MEMORY_HEADS)
58
+ _MEMORY_PROSE_RES = tuple(re.compile(_HEAD_START + head + _HEAD_END + r'(?:\s+' + _PROSE_ARG + r')*')
59
+ for head in _MEMORY_HEADS)
60
+ # Punctuation that ends the sentence a command sits in: "pytest -q." names `pytest -q`, but
61
+ # "go test ./..." keeps its dots.
62
+ _SENTENCE_END_RE = re.compile(r'(?:[,;:!?)]|(?<=[^.])\.)+$')
63
+
64
+ # Extension -> language, for languages_present (#42). Anything else is not code here.
65
+ _LANGUAGE_BY_EXTENSION = {
66
+ 'py': 'python', 'rs': 'rust', 'go': 'go', 'rb': 'ruby', 'swift': 'swift',
67
+ 'js': 'javascript', 'jsx': 'javascript', 'ts': 'javascript', 'tsx': 'javascript',
68
+ 'mjs': 'javascript', 'cjs': 'javascript',
69
+ 'java': 'jvm', 'kt': 'jvm',
70
+ 'c': 'c', 'cc': 'c', 'cpp': 'c', 'h': 'c', 'hpp': 'c',
71
+ }
72
+ # A language is present when it has this many code files and this share of them.
73
+ LANGUAGE_MIN_FILES = 5
74
+ LANGUAGE_MIN_SHARE = 0.10
75
+ # Words that name the language a command runs the tests of (#42). Whole words only.
76
+ _COVERAGE_RES = (
77
+ (re.compile(r'\bcargo\b', re.I), 'rust'),
78
+ (re.compile(r'\b(?:pytest|python3?|tox|nox)\b', re.I), 'python'),
79
+ (re.compile(r'\b(?:npm|pnpm|yarn|npx|node|jest|vitest)\b', re.I), 'javascript'),
80
+ (re.compile(r'\bgo[ \t]+(?:test|vet)\b', re.I), 'go'),
81
+ (re.compile(r'\b(?:bundle|rake|rspec)\b', re.I), 'ruby'),
82
+ (re.compile(r'\b(?:gradle|mvn)\b', re.I), 'jvm'),
83
+ (re.compile(r'\bswift\b', re.I), 'swift'),
84
+ (re.compile(r'\b(?:ctest|cmake)\b', re.I), 'c'),
35
85
  )
36
86
 
37
87
 
38
- def _add(found: list[dict], seen: set[str], command: str, source: str, evidence: str) -> None:
88
+ def _add(found: list[dict], seen: set[str], command: str, source: str, evidence: str,
89
+ excerpt: str = '') -> None:
39
90
  command = command.strip()
40
91
  if not command or command in seen or len(found) >= CANDIDATE_CAP:
41
92
  return
42
93
  seen.add(command)
43
- found.append(dict(command=command, source=source, evidence=evidence))
94
+ entry = dict(command=command, source=source, evidence=evidence)
95
+ if excerpt:
96
+ entry['excerpt'] = excerpt
97
+ found.append(entry)
44
98
 
45
99
 
46
100
  def _forge_verify(repo: Path, found, seen) -> None:
@@ -173,24 +227,33 @@ def _workflows(repo: Path, found, seen) -> None:
173
227
  _add(found, seen, command, 'workflow', str(path))
174
228
 
175
229
 
230
+ def _remembered_commands(fact: str) -> list[str]:
231
+ """The runner invocations one memory fact names (#42): code spans first, then the prose."""
232
+ commands = []
233
+ for span in _CODE_SPAN_RE.findall(fact):
234
+ if any(pattern.search(span) for pattern in _MEMORY_HEAD_RES):
235
+ commands.append(span.strip())
236
+ # The prose with each span blanked out, so a span's text is not read a second time.
237
+ prose = _CODE_SPAN_RE.sub(lambda match: ' ' * len(match.group(0)), fact)
238
+ for pattern in _MEMORY_PROSE_RES:
239
+ for match in pattern.finditer(prose):
240
+ commands.append(_SENTENCE_END_RE.sub('', match.group(0)))
241
+ return commands
242
+
243
+
176
244
  def _memory_verify(repo: Path, found, seen) -> None:
177
245
  path = repo / '.forge' / 'memory.md'
178
- if not path.is_file():
179
- return
180
- for line in path.read_text(errors='replace').splitlines():
181
- if 'verify |' not in line:
182
- continue
183
- text = line.split('verify |', 1)[1]
184
- # A memory entry is prose ("pytest -q runs the suite; make test also lints and
246
+ for fact in _memory_facts(repo, 'verify'):
247
+ # A memory fact is prose ("pytest -q runs the suite; make test also lints and
185
248
  # is 4x slower"), not a bare command -- pull out anything that looks like a
186
249
  # known runner invocation rather than treating the whole sentence as a command.
187
- for pattern in _MEMORY_CMD_RES:
188
- for match in pattern.finditer(text):
189
- _add(found, seen, match.group(0), 'memory:verify', str(path))
250
+ for command in _remembered_commands(fact):
251
+ _add(found, seen, command, 'memory', str(path), excerpt=fact)
190
252
 
191
253
 
192
254
  def candidates(repo) -> list[dict]:
193
- """Real, existing verify commands. Each: {'command': str, 'source': str, 'evidence': str}.
255
+ """Real, existing verify commands. Each: {'command': str, 'source': str, 'evidence': str},
256
+ and 'excerpt' for a memory candidate (the memory fact that named it).
194
257
 
195
258
  Deterministic order, deduplicated, capped at CANDIDATE_CAP. Never executes anything --
196
259
  this only enumerates what plausibly exists so Jev can select among real options.
@@ -214,13 +277,11 @@ def _repo_files(repo: Path, limit: int = 200) -> list[str]:
214
277
  return entries[:limit]
215
278
 
216
279
 
217
- # The headings forge-memory.sh:93 renders. Both readers below looked for the LEDGER row
280
+ # The headings forge-memory.sh:93 renders. The reader below looked for the LEDGER row
218
281
  # format instead -- `verify |` and `trap |` -- which is what ledger.tsv holds, not what
219
282
  # `rebuild` writes into memory.md. No line in a rendered memory.md has ever contained
220
- # either, so both lists were empty for every repo, always, while jev.md documented them
221
- # as working. Verification discovery never saw a recorded verify command, and
222
- # known_traps never corroborated anything -- which made the flake re-run unreachable,
223
- # since its third condition is a trap sharing a distinctive token with the failure.
283
+ # either, so the list was empty for every repo, always, while jev.md documented it as
284
+ # working. Verification discovery never saw a recorded verify command.
224
285
  _MEMORY_SECTIONS = {'verify': '## Verify', 'trap': '## Known traps',
225
286
  'finding': '## Recurring QA findings'}
226
287
 
@@ -256,19 +317,6 @@ def _memory_verify_lines(repo: Path) -> list[str]:
256
317
  return _memory_facts(repo, 'verify')
257
318
 
258
319
 
259
- def known_traps(repo) -> list[str]:
260
- """Recorded 'trap' facts from .forge/memory.md (flaky tests, generated files, sharp
261
- edges), for the CLI to hand to triage() -- see references/memory.md."""
262
- path = Path(repo) / '.forge' / 'memory.md'
263
- if not path.is_file():
264
- return []
265
- try:
266
- lines = path.read_text(errors='replace').splitlines()
267
- except OSError:
268
- return []
269
- return _memory_facts(path.parent.parent, 'trap')
270
-
271
-
272
320
  # Enough of an evidence file to tell a test command from a build one, and no more: the
273
321
  # request already carries one Choice and two Nouls per candidate.
274
322
  EVIDENCE_CHARS = 400
@@ -283,6 +331,10 @@ def _evidence_excerpt(candidate: dict) -> str:
283
331
  `make test` at 0.58 while leaving 0.40 on `none`, for a Choice confidence of 0.37
284
332
  against a 0.70 gate -- so it declined, and a verifiable repo reported UNVERIFIED.
285
333
  """
334
+ # A memory candidate's evidence is memory.md, whose head describes every fact, not
335
+ # just the one that named the command. The fact itself is what it runs.
336
+ if candidate.get('excerpt'):
337
+ return candidate['excerpt'][:EVIDENCE_CHARS]
286
338
  path = candidate.get('evidence') or ''
287
339
  try:
288
340
  text = Path(path).read_text(errors='replace')
@@ -308,11 +360,37 @@ def _evidence_excerpt(candidate: dict) -> str:
308
360
  return text[:EVIDENCE_CHARS]
309
361
 
310
362
 
363
+ def languages_present(repo) -> list[str]:
364
+ """The languages a repo has, from its tracked files (#42), sorted. A language counts at
365
+ LANGUAGE_MIN_FILES files and LANGUAGE_MIN_SHARE of the code files. Empty when the repo
366
+ is not a git repository."""
367
+ try:
368
+ listed = subprocess.run(['git', '-C', str(repo), 'ls-files', '-z'],
369
+ capture_output=True, check=True).stdout
370
+ except (OSError, subprocess.CalledProcessError):
371
+ return []
372
+ counts: dict[str, int] = {}
373
+ for name in listed.decode(errors='replace').split('\0'):
374
+ language = _LANGUAGE_BY_EXTENSION.get(Path(name).suffix[1:].lower())
375
+ if language:
376
+ counts[language] = counts.get(language, 0) + 1
377
+ total = sum(counts.values())
378
+ return sorted(language for language, n in counts.items()
379
+ if n >= LANGUAGE_MIN_FILES and n / total >= LANGUAGE_MIN_SHARE)
380
+
381
+
382
+ def languages_covered(command, evidence) -> list[str]:
383
+ """The languages whose tests a command runs, judged from the command and the excerpt of
384
+ what it runs (#42), sorted. Empty when nothing is recognised."""
385
+ text = f'{command}\n{evidence}'
386
+ return sorted({language for pattern, language in _COVERAGE_RES if pattern.search(text)})
387
+
388
+
311
389
  def discover(repo, *, config=None, run_dir=None) -> dict | None:
312
390
  """Ask Jev which candidate actually verifies this repo. None when Jev is
313
391
  unavailable, no candidates exist, or it picks `none`.
314
392
  -> {'command', 'confidence', 'verifiable', 'runs_tests', 'runtime_level', 'source',
315
- 'evidence'}
393
+ 'evidence', 'coverage': {'present', 'covered'}}
316
394
  """
317
395
  config = config or load_config()
318
396
  if not enabled('tests', config=config):
@@ -359,7 +437,7 @@ def discover(repo, *, config=None, run_dir=None) -> dict | None:
359
437
  # correct commands leaves it high; genuine doubt piles onto `none` and drops it.
360
438
  # Ties are then broken by the winner, which is what Choice is for.
361
439
  distribution = probabilities(result, 'choice')
362
- act_at = threshold('tests_act', config=config)
440
+ act_at = threshold('tests_act', config=config, site='jev-verify-discover')
363
441
  if distribution:
364
442
  if (1.0 - distribution.get('none', 0.0)) < act_at:
365
443
  return None
@@ -390,64 +468,12 @@ def discover(repo, *, config=None, run_dir=None) -> dict | None:
390
468
  # `verifiable` is the quantity the gate actually used; `confidence` is kept beside it
391
469
  # because they answer different questions and a future re-measurement needs both.
392
470
  verifiable = (1.0 - distribution.get('none', 0.0)) if distribution else None
471
+ # Coverage (#42) only informs the announcement: the pick stands, and the command's own
472
+ # run still decides verification. `described` already holds the pick's excerpt.
473
+ coverage = dict(present=languages_present(repo_path),
474
+ covered=languages_covered(picked, described[idx]['runs']))
393
475
  return dict(command=picked, confidence=confidence, verifiable=verifiable,
394
476
  runs_tests=runs_probability,
395
477
  runtime_level=runtime_level, source=picked_candidate['source'],
396
- evidence=picked_candidate['evidence'])
397
-
398
-
399
- # A token is distinctive enough to corroborate only if it looks like an identifier or a
400
- # path -- `test_timeout`, `tests/test_api.py`, `CamelCase` -- rather than an English word
401
- # that any failure log would contain.
402
- _TOKEN_RE = re.compile(r'[A-Za-z_][A-Za-z0-9_./:-]{3,}')
403
-
404
-
405
- def _distinctive(text: str) -> set[str]:
406
- tokens = set()
407
- for match in _TOKEN_RE.findall(text or ''):
408
- # Split on path and node-id separators: a trap says `test_api.py::test_timeout`
409
- # while the log says `tests/test_api.py::test_timeout`, which never compare equal
410
- # as whole tokens. Atoms do.
411
- for token in re.split(r'[/:]+', match):
412
- token = token.strip('.-_')
413
- if len(token) < 4:
414
- continue
415
- # A bare short word like `tests` matches every repo; require either an
416
- # identifier/path shape or enough length to be specific.
417
- if '_' in token or '.' in token or len(token) >= 8:
418
- tokens.add(token)
419
- return tokens
420
-
421
-
422
- def corroborating_traps(log_tail: str, traps) -> list[str]:
423
- """Traps that share a distinctive token with the failure output.
478
+ evidence=picked_candidate['evidence'], coverage=coverage)
424
479
 
425
- The re-run gate needs evidence that THIS failure matches a recorded trap, not merely
426
- that the repo has recorded some trap at some point. Without that, one flaky test
427
- noted months ago would excuse every future failure in the repo -- which is precisely
428
- how a real regression gets waved through.
429
- """
430
- haystack = _distinctive(log_tail)
431
- return [trap for trap in (traps or []) if _distinctive(trap) & haystack]
432
-
433
-
434
- def triage(repo, *, command, log_tail, traps, config=None, run_dir=None) -> dict | None:
435
- """Classify a verification failure. -> {'verdict', 'confidence'} or None."""
436
- config = config or load_config()
437
- if not enabled('tests', config=config):
438
- return None
439
- tail = (log_tail or '')[-LOG_TAIL_CHARS:]
440
- # The diff is never sent: recognising a flake needs the failure signature (timeout,
441
- # ordering, port-in-use, a named trap), not the change itself, and the diff is a
442
- # larger payload for no benefit here.
443
- state = dict(command=command, log_tail=tail, known_traps=list(traps or []))
444
- result = ask(state, {'triage': failure_triage(list(traps or []))}, site='jev-verify-triage',
445
- run_dir=run_dir, config=config)
446
- if result is None:
447
- return None
448
- verdict, confidence = choice(result, 'triage')
449
- if verdict is None:
450
- return None
451
- matched = corroborating_traps(tail, traps)
452
- return dict(verdict=verdict, confidence=confidence,
453
- corroborated=bool(matched), corroborating_traps=matched)
package/ui/README.md CHANGED
@@ -34,7 +34,7 @@ blocks on a plate, with cables between them and lamps that light up as things ha
34
34
  otherwise); running nodes pulse and show their current phase.
35
35
  - **Extras:** replay a run from its recorded times, light its critical path, set block height
36
36
  and colour by duration, tokens, attempts or model, and mark shadow reviews that disagreed
37
- with the primary and how sure Clef was that each task would pass.
37
+ with the primary.
38
38
  - **Beyond one run:** a full-screen **run cloud** of every run, grouped by project, in five
39
39
  layouts with filters and runs you can drag anywhere; **diffs** with each finding under the
40
40
  line it names; each dwarf's and reviewer's **conversation**, read from its CLI's log; a
@@ -189,7 +189,7 @@ keep one meaning everywhere (amber running, green merged or passed, red failed,
189
189
  timings (busy, model time, overhead, queue wait after its dependencies merged), attempts and
190
190
  their executions with the checks each ran, review findings with the gate decision, what the
191
191
  finding sweep did with its findings (or, for a fix task, each finding it took and whether its
192
- review found it fixed), Clef predictions against outcomes, and its prompts; for one execution, its model, phases, tokens,
192
+ review found it fixed), and its prompts; for one execution, its model, phases, tokens,
193
193
  checks, exact prompt and final message; for the final review, its verdict, findings, report,
194
194
  prompt and history.
195
195
  - **Now and checks:** a running task's *Now* names the agent at work and its attempt, the phase
package/ui/docs/api.md CHANGED
@@ -48,6 +48,7 @@ written), and the reader must never raise because of one.
48
48
  | `verification.retry.log` | the output of a deterministic or Jev rerun of a single command |
49
49
  | `verification.lanes.json` | a lanes verification's live and final state, written by `scripts/forge-verify.py` (read up to 4 MB); `verification.lane.<name>.log` and `verification.lane.<name>.run-<k>.log` each lane's output |
50
50
  | `verification.commit` | one line, the commit verified |
51
+ | `attribution.json` | the result of `forge-parallel.sh attribute`: `culprit` (a task id or `null`), `base_fails`, `inconclusive` (a reason or `null`), `merges`, `steps`, `verification_runs`, `gate` (`null` without the gate, else `{mode, ranking, tried, outcome}`); returned as `attribution`, see RunDetail |
51
52
  | `max_parallel`, `escalate_after`, `verify_retries` | one integer each |
52
53
  | `qa_threshold` | `P0`..`P3`, the least severe finding that still blocks; `final_qa` the final review's QA spec |
53
54
  | `deferrals.txt` | one line per task the wave planner deferred |
@@ -57,15 +58,17 @@ written), and the reader must never raise because of one.
57
58
  | `final-review` | a symlink to the newest *published* review dir; `final-review.verdict` a copy of its verdict |
58
59
  | `integrate-<epoch>-<pid>/` | one `integrate`: `setup.log`, `merge.log`, `verification.*`, `attempts/verification-<uuid>/`, and `final-review/` (a review dir as above) when it ran one |
59
60
  | `tasks/<id>/merged` | exists when the task was merged; its mtime is when |
60
- | `tasks/<id>/status` | one word: `RUNNING PASS FAIL ERROR INFRA TIMEOUT UNKNOWN INVALIDATED BLOCKED INTERRUPTED NOCHANGES CONFLICT` |
61
+ | `tasks/<id>/status` | one word: `RUNNING PASS FAIL ERROR INFRA TIMEOUT UNKNOWN INVALIDATED BLOCKED INTERRUPTED NOCHANGES CONFLICT NEEDS_INPUT` |
61
62
  | `tasks/<id>/attempt` | the current attempt number |
62
- | `tasks/<id>/attempts.tsv` | `epoch<TAB>attempt<TAB>status<TAB>infra_class` per line, one per attempt entry; status may also be `MERGED`, `infra_class` may be empty, `-` or missing |
63
+ | `tasks/<id>/attempts.tsv` | `epoch<TAB>attempt<TAB>status<TAB>infra_class` per line, one per attempt entry; status may also be `MERGED`, `BOUNCED` or `INCOMPLETE` (a send-back that no reviewer judged: the task status stays `FAIL`), `infra_class` may be empty, `-` or missing |
63
64
  | `tasks/<id>/escalations.tsv` | `epoch<TAB>attempt<TAB>from_spec<TAB>to_spec[<TAB>source]` per line; `source` (who decided: `policy`, a human's `retry --dwarf` as `retry`, or a `pin`) is missing on older rows, which read as `policy` |
64
65
  | `tasks/<id>/qa.last` | the reviewer's final message; its last line matching `FORGE_VERDICT: PASS` or `FORGE_VERDICT: FAIL` is the verdict |
65
66
  | `tasks/<id>/prompt.md`, `approach.md`, `retry_findings.md` | free text |
67
+ | `tasks/<id>/needs_input.md` | the question for the user, written when the task stopped `NEEDS_INPUT`: `The implementer asked:`, then the end of the dwarf's last message; free text, returned as `needs_input` |
66
68
  | `tasks/<id>/accepted.by` | who accepted a task over a reviewer's FAIL, and why (`key=value`: `task`, `status`, `reason`, `by`, `at`, `epoch`, `attempt`, `reviewed_commit`; older runs are free text; returned as text) |
67
- | `tasks/<id>/qa.gate` | `threshold<TAB>decision<TAB>worst<TAB>n_confirmed<TAB>n_unlabelled<TAB>n_below` (`decision` is `accept` or `keep`, `-` for none) |
69
+ | `tasks/<id>/qa.gate` | `threshold<TAB>decision<TAB>worst<TAB>n_confirmed<TAB>n_unlabelled<TAB>n_below` (`decision` is `accept` (the reviewer said FAIL, every CONFIRMED finding was below the threshold), `fail` (the reviewer said PASS, but listed a blocking CONFIRMED finding) or `keep`, `-` for none) |
68
70
  | `tasks/<id>/known_issues.md` | the confirmed findings a threshold tolerated |
71
+ | `tasks/<id>/prereview.json`, `prereview.md` | the pre-review tests of the latest attempt (opt-in `plan --pre-review-tests`): `status` (`passed`, `flaky`, `pre-existing`, `failed`, `skipped`, `error`), `reason`, `command`, `selected`, `failing`, `preexisting`, `flaky`, `runs`, `seconds`; returned on a task as `pre_review` `{status, reason, command, selected, failing, preexisting, flaky, seconds, tail}` (`tail`: the end of the last failing run's output), `null` without the file. `prereview.md` is the implementer's findings of a `failed` check |
69
72
  | `tasks/<id>/dwarf.input`, `qa.input` | the prompts forge assembled; `<role>.delivered`, `<role>.resolved` the live dispatch files |
70
73
  | `tasks/<id>/<role>.log`, `<role>.clock` | the running dispatch's harness log and its clock: one `<epoch> <bytes>` line each time the log grew (forge-dispatch.sh samples it every second; `FORGE_LOG_CLOCK=off` writes none) |
71
74
  | `tasks/<id>/escalation.stop`, `split.suggested` | the retry policy stopped the task: `<attempts><TAB><model>`, and the split it suggests (free text) |
@@ -79,8 +82,6 @@ written), and the reader must never raise because of one.
79
82
  | `fractal-selection.json` | `{"enabled": true, "run": "run-<20 hex>"}` (or `enabled: false`): the run's Fractal choice, see Fractal below |
80
83
  | `tasks/<id>/route.jsonl` | one JSON object per line, one per routing decision: `at` (epoch), `task`, `tier`, `epsilon`, `candidates` (list of specs), `default` (spec), `chosen` (spec), `explored` (bool), `propensity` (probability the chosen spec had), `inputs` (object), `decision` (a short hash identifying the decision). Keep unknown fields |
81
84
  | `tasks/<id>/route.explored` | exists when the task's route was an exploratory pick |
82
- | `tasks/<id>/clef.first_pass` | JSON: `p` (predicted probability the first attempt passes), `model`, `at`, `plan_table`, `assignment` (`{dwarf, qa}`) |
83
- | `tasks/<id>/clef.retry_pass.<n>` | JSON, same shape plus `attempt` = n |
84
85
  | `shadow/<id>/<attempt>-<k>/shadow.json` | JSON: `task`, `attempt`, `reviewed`, `primary`, `spec`, `pick`, `started`. A second, never-read review of attempt `<attempt>` |
85
86
  | `shadow/<id>/<attempt>-<k>/shadow.status` | one word |
86
87
  | `shadow/<id>/<attempt>-<k>/qa.last` | the shadow reviewer's final message, verdict as above |
@@ -213,7 +214,7 @@ loaded. When it cannot be loaded, `findings_available` is `false` and every find
213
214
  is `null`; verdicts and `gate` do not need it.
214
215
 
215
216
  Text fields are capped so one huge file cannot blow up a response: `request`, `prompt`,
216
- `approach`, `retry_findings` keep their first 20,000 characters; `qa_tail`, `dwarf_tail`
217
+ `approach`, `retry_findings`, `needs_input` keep their first 20,000 characters; `qa_tail`, `dwarf_tail`
217
218
  and `verification.log_tail` keep their last 4,000. A capped field ends (or, for tails,
218
219
  starts) with `…` and the value of `truncated` lists the field names that were cut.
219
220
 
@@ -256,7 +257,7 @@ its last 20,000 behind a leading `…`. Their `truncated` lists the field names
256
257
  | `POST /api/runs/<key>/delete` | dry-run or delete a run with `forge runs rm`; authenticated, 900 s timeout; later requests for the key answer `404` |
257
258
  | `GET /api/models/reviewers` | `200` the `forge dataset reviewers --json` report (how each reviewer's PASSed work held up); no parameters |
258
259
  | `GET /api/config?run=<key>` | `200` the `forge config show --json` of that run's repo |
259
- | `POST /api/config` | set or unset one allowed key (`repo.verify`, `repo.setup`, `repo.verify-subset`, `jev.enabled`); authenticated |
260
+ | `POST /api/config` | set or unset one allowed key (`repo.verify`, `repo.setup`, `repo.verify-subset`, `decide.gate.<gate>`, `decide.gate.<gate>.provider`, `decide.gate.<gate>.model`); `jev.enabled` is gone; authenticated |
260
261
  | `GET /api/runs/<key>/export?texts=0\|1&paths=0\|1` | `200` the run as one HTML file (see Export), `Content-Disposition: attachment`, `Content-Security-Policy: default-src 'none'; sandbox`; `404` for an unknown run |
261
262
  | `GET /api/runs/<key>/tasks/<id>/fractal` | `200 TaskFractal` |
262
263
  | `GET /api/runs/<key>/tasks/<id>/fractal/nodes/<node>[/diff]` | `200 FractalNodeDetail`, or with `/diff` a `DiffDetail` of its `candidate.diff`; `<node>` matches `[A-Za-z0-9][A-Za-z0-9_-]{0,100}` |
@@ -364,6 +365,8 @@ Every RunSummary field, plus:
364
365
  "settings": {"explore": 0.5, "shadow_rate": 0.5, "shadow_qa": ["opus", "sol:xhigh"], "timeout": 3600,
365
366
  "max_parallel": 2, "qa_threshold": "P2", "escalate_after": 3, "verify_retries": 1,
366
367
  "final_qa": "opus"},
368
+ "attribution": {"culprit": "page", "base_fails": false, "inconclusive": null, "verification_runs": 4,
369
+ "gate_outcome": "confirmed"},
367
370
  "verification": {"status": "PASS", "command": "python3 -m unittest", "log_tail": "...",
368
371
  "runs": [{"n": 1, "kind": "initial", "exit": 0, "tree_changed": false,
369
372
  "duration_s": 12.3, "log": "verification.lane.unit.run-1.log",
@@ -400,8 +403,18 @@ Every RunSummary field, plus:
400
403
 
401
404
  - `settings` values are `null` when the file is missing or unparsable; `shadow_qa` is a
402
405
  list (empty when missing). `max_parallel`, `escalate_after`, `verify_retries` are integers,
403
- `qa_threshold` and `final_qa` the first line of their file. A solo run has no plan
404
- settings: every value is `null`, including `shadow_qa`.
406
+ `final_qa` the first line of their file. `qa_threshold` is the effective level (`P0`..`P3`):
407
+ a missing file reads `P2` (forge's default) with `qa_threshold_source` `default`; a file reads
408
+ with source `set`, and `none` in it reads `P3`. A solo run has no plan settings: every value
409
+ is `null`, including `shadow_qa`, except `qa_threshold` and its source, which read the same way.
410
+ - `attribution` is the result of `forge-parallel.sh attribute` from `attribution.json`, or `null` when
411
+ the file is missing. `culprit` is the merged task's id or `null`; `base_fails` is `true` only when the
412
+ base verified FAIL; `inconclusive` is the reason the search stopped without a culprit, or `null`;
413
+ `verification_runs` is how many verifications the search ran; `gate_outcome` is `gate.outcome`
414
+ (`confirmed` or `refuted`), `null` without the gate. A file that is not a JSON object, or lacks any of
415
+ `culprit`, `base_fails`, `inconclusive`, `verification_runs` or `gate`, or has a value of the wrong type
416
+ (`culprit` and `inconclusive` a string or `null`, `base_fails` a boolean, `verification_runs` an integer,
417
+ `gate` `null` or an object whose `outcome` is a string or `null`), is `null` and warned.
405
418
  - `verification` is `null` when none of `verification.status`, `.command`, `.log` exists. A
406
419
  solo run's `verification` is always `null`. `runs` comes from `verification.runs.tsv`
407
420
  (malformed rows are warned and skipped; an empty `exit` is `null`), `commit` is the first
@@ -517,15 +530,12 @@ Every RunSummary field, plus:
517
530
  "route": [{"at": 1760619000.0, "task": "reader", "tier": "high", "epsilon": 0.5,
518
531
  "candidates": ["astra", "opus"], "default": "opus", "chosen": "astra",
519
532
  "explored": true, "propensity": 0.25, "inputs": {}, "decision": "9c1e4b7a0d2f3e58"}],
520
- "clef": {"first_pass": {"p": 0.71, "model": "clef", "at": 1760619100.0,
521
- "assignment": {"dwarf": "astra", "qa": "opus"}},
522
- "retry_pass": {"2": {"p": 0.64, "model": "clef", "at": 1760620600.0, "attempt": 2,
523
- "assignment": {"dwarf": "sol", "qa": "opus"}}}},
524
533
  "shadow": [{"attempt": 1, "k": 0, "spec": "sol:xhigh", "primary": "opus",
525
534
  "status": "PASS", "verdict": "FAIL", "started": 1760620100.0}],
526
535
  "prompt": "full prompt.md text",
527
536
  "approach": null,
528
537
  "retry_findings": "...",
538
+ "needs_input": "the question in tasks/<id>/needs_input.md, or null",
529
539
  "qa_tail": "last 4000 chars of qa.last",
530
540
  "dwarf_tail": "last 4000 chars of dwarf.last",
531
541
  "executions": [Execution, ...],
@@ -566,8 +576,6 @@ Every RunSummary field, plus:
566
576
  plan task, the run dir's `dwarf.last` for a solo run), or `null` when the file is missing.
567
577
  Capped like `qa_tail`.
568
578
  - `explored`: `true` if `route.explored` exists or any `route` entry has `explored: true`.
569
- - `clef.first_pass` is `null` when absent; `clef.retry_pass` is `{}` when there are none;
570
- its keys are the attempt numbers as strings.
571
579
  - `shadow`: one entry per `shadow/<id>/<attempt>-<k>/` dir, sorted by attempt then k.
572
580
  `status` is `shadow.status`, `verdict` is parsed from that dir's `qa.last`; fields from
573
581
  `shadow.json` (`spec`, `primary`, `started`, `reviewed`, `pick`, as they are) that are
@@ -581,8 +589,10 @@ Every RunSummary field, plus:
581
589
  run, the run dir's `attempts/` (`solo`, `dwarf`, `qa`). Shadow executions are not in it.
582
590
  - `merged_at`: the mtime of `tasks/<id>/merged`, or `null`.
583
591
  - `findings`: FindingsSummary of the current `qa.last`, or `null`.
584
- - `gate`: the parsed `qa.gate` (`n_*` integers, `-` is `null`), or `null` when missing or
592
+ - `gate`: the parsed `qa.gate` (`decision` `accept`, `fail` or `keep`; `n_*` integers, `-` is `null`), or `null` when missing or
585
593
  malformed (malformed is warned).
594
+ - `needs_input`: the text of `tasks/<id>/needs_input.md`, capped like `prompt`, or `null` when the file is
595
+ missing. The question a task stopped `NEEDS_INPUT` for; the export leaves it out unless texts are chosen.
586
596
  - `known_issues`: whether `known_issues.md` is a non-empty file.
587
597
  - `now`: `null` unless the task is `RUNNING`. Then where it is: the newest running non-shadow `dwarf`
588
598
  or `qa` execution (`role`, `execution`, `attempt`, `phase`, `phase_started`, `started`), else the
@@ -615,9 +625,8 @@ it is missing or `<harness default>`). `wave` is 1, `branch` is `null`, and `att
615
625
  from the run dir's `attempts.tsv`. `status` is the solo status; `attempt` is the highest `n`
616
626
  in `attempts.tsv`, or `null`. `escalations`, `route` and `shadow` are empty. `verdict` and
617
627
  `qa_tail` come from `qa.last`, and `prompt` comes from `prompt.md`. `deps` and `files` are
618
- `[]`; `difficulty`, `accepted_by`, `approach` and `retry_findings` are `null`; `accepted` is
619
- false; `accepted_attempt` and `accepted_over` are `null`; `explored` is false; `clef` is
620
- `{first_pass: null, retry_pass: {}}`; `waiting` and `sweep` are `null`, `swept` is `[]`. `request` on
628
+ `[]`; `difficulty`, `accepted_by`, `approach`, `retry_findings` and `needs_input` are `null`; `accepted` is
629
+ false; `accepted_attempt` and `accepted_over` are `null`; `explored` is false; `waiting` and `sweep` are `null`, `swept` is `[]`. `request` on
621
630
  the detail is `request.md`.
622
631
 
623
632
  ## Execution
@@ -1040,7 +1049,7 @@ lines follow, a line was cut, or reaching them took more than 64 MB of reading.
1040
1049
  "created": 1760619000.0, "explored": true, "propensity": 0.125, "final_status": "MERGED",
1041
1050
  "accepted": true,
1042
1051
  "attempts": [{"n": 1, "alias": "luna", "spec": "luna", "source": "execution", "outcome": "fail",
1043
- "reason": null, "gate": false, "model_s": 297.0, "duration_s": 300.0,
1052
+ "reason": null, "gate": false, "gate_fail": false, "model_s": 297.0, "duration_s": 300.0,
1044
1053
  "tokens": {"input": 120000, "cached": 90000, "output": 8000}, "timed_out": false}],
1045
1054
  "escalations": [{"n": 1, "from": "luna", "to": "sol:xhigh"}]}],
1046
1055
  "reviews": [{"run": "3f9a0c1d2e4b", "task": "reader", "n": 1, "kind": "primary", "alias": "opus", "spec": "opus",
@@ -1064,7 +1073,7 @@ lines follow, a line was cut, or reaching them took more than 64 MB of reading.
1064
1073
  - `alias`/`spec`/`source`: the last dwarf execution's model (`execution`), else the fifth
1065
1074
  `attempts.tsv` column (`attempts.tsv`), else for attempt 1 only the `tasks.tsv` dwarf (a solo
1066
1075
  run's `dwarf.spec`/`dwarf.resolved`) (`plan`), else all `null`.
1067
- - `gate`: the attempt passed although its (last) primary review said FAIL. `model_s`,
1076
+ - `gate`: the attempt passed although its (last) primary review said FAIL. `gate_fail`: the attempt failed although that review said PASS (forge turned it into FAIL). `model_s`,
1068
1077
  `duration_s`, `tokens`, `timed_out`: that dwarf execution's `phases.model`, `duration_s`,
1069
1078
  `tokens`, `timed_out`, else `null`/`false`.
1070
1079
  - `reviews[]`: every finished primary qa execution (`n` its attempt); every shadow whose
@@ -1173,7 +1182,7 @@ difficulty paths deps model` each), `decomposition_history` (its newest 20, each
1173
1182
  (under their tail paths; line ranges are not stored, so the page shows the tail).
1174
1183
  - `texts=0` (the default) nulls these keys wherever they hold a string, list or object: `prompt
1175
1184
  last request log_tail dwarf_tail qa_tail qa_last qa_input tasks_summary known_issues texts text
1176
- planning_last approach retry_findings dwarf_input error last_line message excerpt tail lines call split`,
1185
+ planning_last approach retry_findings needs_input dwarf_input error last_line message excerpt tail lines call split`,
1177
1186
  and stores no diff, no transcript, no checks and no environment problems (a command is a text). A finding keeps its `summary`, a failing test its `name`.
1178
1187
  - `paths=0` (the default) makes every string that is a whole absolute path (but `/api/…`, `url`s
1179
1188
  and `command`s) its last component, and replaces the run dir, the repo and the home dir inside other
@@ -1266,8 +1275,10 @@ routes, so their configuration matters too.
1266
1275
  running is `409 {"error": "busy"}`, without reaching the CLI; other runs are not held up.
1267
1276
 
1268
1277
  **Errors.** For a CLI that exits non-zero the answer is `{"error", "detail", "result"?}`: `detail`
1269
- is the last line of its stderr (at most 300 characters; the rest of stderr is not echoed) and
1270
- `result` the object its stdout holds, when that parses as one.
1278
+ is the last line of its stderr (at most 300 characters; the rest of stderr is not echoed), except for
1279
+ a refusal (exit 3): forge's own message, kept whole (its non-blank lines, joined by `\n`, at most 2000
1280
+ characters), since it names what was refused and why, then what to run instead. `result` is the
1281
+ object its stdout holds, when that parses as one.
1271
1282
 
1272
1283
  | CLI exit | Status | `error` |
1273
1284
  |---|---|---|
@@ -1287,7 +1298,7 @@ for them only unknown keys and runs the catalog does not hold are `404`. Every w
1287
1298
  ### `GET /api/runs/<key>/controls`
1288
1299
 
1289
1300
  `forge control show <plan dir> --json`: `200` with its object (`plan`, `run_id`, `live`, `fractal`,
1290
- `run` (the plan-wide controls), `tasks` (per task: `status`, `dwarf`, `qa`, `qa_threshold`,
1301
+ `run` (the plan-wide controls; `qa_threshold` is the effective level and `qa_threshold_source` is `set` or `default`), `tasks` (per task: `status`, `dwarf`, `qa`, `qa_threshold`,
1291
1302
  `retry_budget`, `retries_used`, `pin`, `escalation_stop`, `escalation_next`) and `log`). No token
1292
1303
  is needed to read it. Of `run` the page also reads `max_parallel` (1–64 or `null`), `infra_backoff`
1293
1304
  (the shape, `exp:60` when unset), `escalate_effort` (`on`/`off`), `drained` and `stopping`
@@ -1307,7 +1318,7 @@ known or a spec runs is for the CLI to say (its `400` or `409` comes back as abo
1307
1318
 
1308
1319
  | Body | CLI call (after `forge`) |
1309
1320
  |---|---|
1310
- | `{"action": "set", "key": "qa-threshold", "value": "P2"}` | `control set <dir> qa-threshold P2 --actor ui --json` |
1321
+ | `{"action": "set", "key": "qa-threshold", "value": "P2"}` (`default` at run level removes the setting, `none` is P3; for a task `inherit` drops the override) | `control set <dir> qa-threshold P2 --actor ui --json` |
1311
1322
  | `{"action": "set", "key": "retry-budget", "value": "inherit", "task": "reader"}` | `control set <dir> retry-budget inherit --task reader --actor ui --json` |
1312
1323
  | `{"action": "pin", "task": "graph", "spec": "sol:high:codex"}` | `control pin <dir> graph sol:high:codex --actor ui --json` |
1313
1324
  | `{"action": "unpin", "task": "graph"}` | `control unpin <dir> graph --actor ui --json` |
@@ -1377,12 +1388,29 @@ Reviewers table's Did not hold column and nothing else. Timeout 60 s.
1377
1388
 
1378
1389
  The repository is the run's own `repo` file (first line, an existing absolute directory; else
1379
1390
  `409`), never a client field. `GET` runs `config show --repo <repo> --json` and answers with its
1380
- object. `POST` takes `{"run": <key>, "key": one of repo.verify, repo.setup, repo.verify-subset,
1381
- jev.enabled, "value": text | "unset": true}` (exactly one of the two; any other field, `repo`
1382
- included, is a `400`) and runs `config set <key> <value> --repo <repo> --json` or `config unset
1383
- <key> --repo <repo> --json`. A value is a non-empty text of at most 4096 characters without
1384
- control characters (newline and tab are allowed), not starting with `-`; `jev.enabled` takes
1385
- `true` or `false` and cannot be unset; `repo.verify-subset` must contain `{files}`. `200` with the
1391
+ object. The `decide` block is the `forge decide status --json` object for that repo, plus `ready`
1392
+ on each gate (`true` when the gate is `shadow` or `on`, nothing skips it, and its provider is
1393
+ local or has a key on file), plus two fields from `forge decide status --json`: `forced` (bool: the
1394
+ gate is `on` and has no passing replay for its provider and model) and `replay` (`{"provider",
1395
+ "model", "passes", "at"}`, `at` in epoch seconds, or `null` when `forge decide replay` has recorded
1396
+ none). An older forge sends neither; the page reads that as `forced: false` and `replay: null`. The
1397
+ Settings page shows `forced` and `replayed <date>` or `replay failed` as tags on the gate. Provider objects keep the status fields except `key`, `key_source`,
1398
+ `key_file` and `key_env`: a key never reaches this response. `jev.enabled` is gone.
1399
+
1400
+ `POST` takes `{"run": <key>, "key": one of repo.verify, repo.setup, repo.verify-subset,
1401
+ decide.gate.<gate>, decide.gate.<gate>.provider, decide.gate.<gate>.model, "value": text | "unset": true}`
1402
+ (exactly one of the two; any other field, `repo` included, is a `400`) and runs
1403
+ `config set <key> <value> --repo <repo> --json` or `config unset <key> --repo <repo> --json`.
1404
+ The gates are `drift`, `forward`, `prompt`, `memory-curate`, `memory-slice`, `memory-stale` and
1405
+ `verify-discover`. `decide.gate.<gate>` takes `off`, `shadow` or `on`. Turning a gate `on` with no passing replay for
1406
+ its provider and model makes the CLI exit 3, which answers `409 {"error": "refused", "detail": <the
1407
+ CLI's message>}`; the message names `forge decide replay` and `--force` and the page shows it whole.
1408
+ A provider or model is a
1409
+ non-empty single line of at most 256 characters, with no control characters and no leading or
1410
+ trailing whitespace, and not starting with `-`. Those three keys write the user level through
1411
+ `forge decide gate` and cannot be unset (the answer says to set the mode to off). A repo file
1412
+ value is a non-empty text of at most 4096 characters without control characters (newline and tab
1413
+ are allowed), not starting with `-`; `repo.verify-subset` must contain `{files}`. `200` with the
1386
1414
  CLI's object (`ok`, `key`, `previous`, `value`). Writes serialize on one server-wide config lock
1387
1415
  (`409 busy`). Unknown run `404`. Timeout 60 s.
1388
1416