@giamme/forge 0.21.0 → 0.23.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 +81 -0
- package/README.md +25 -15
- package/SKILL.md +137 -216
- package/VERSION +1 -1
- package/bin/forge.js +104 -0
- package/docs/README.md +2 -3
- package/docs/add-ons.md +5 -3
- package/docs/artifacts.md +17 -2
- package/docs/commands.md +85 -63
- package/docs/decomposed-runs.md +195 -21
- package/docs/development.md +12 -10
- package/docs/forge-ui.md +33 -4
- package/docs/install.md +127 -6
- package/docs/memory.md +6 -1
- package/docs/models.md +36 -10
- package/docs/reviews.md +50 -29
- package/docs/safety.md +27 -2
- package/docs/troubleshooting.md +8 -11
- package/forge +29 -4
- package/forge.cmd +56 -0
- package/package.json +6 -3
- package/references/dataset.md +10 -9
- package/references/decompose-integration.md +337 -0
- package/references/decompose-opt-in.md +527 -0
- package/references/decompose-recovery.md +569 -0
- package/references/decompose-review.md +256 -0
- package/references/decompose.md +99 -1606
- package/references/findings.md +68 -0
- package/references/harnesses.md +7 -12
- package/references/memory.md +13 -2
- package/references/planning.md +48 -18
- package/references/ripwire.md +38 -13
- package/references/runtime.md +22 -33
- package/references/setup.md +90 -0
- package/references/solo.md +13 -42
- package/references/ui.md +12 -5
- package/registry.tsv +40 -22
- package/scripts/forge-artifact.sh +148 -13
- package/scripts/forge-compare.py +5 -15
- package/scripts/forge-config.py +14 -1
- package/scripts/forge-contract.py +216 -53
- package/scripts/forge-control.py +781 -51
- package/scripts/forge-dispatch.sh +202 -42
- package/scripts/forge-du.py +13 -3
- package/scripts/forge-guard.py +137 -6
- package/scripts/forge-handoff.py +221 -39
- package/scripts/forge-install-ripwire.sh +100 -24
- package/scripts/forge-install.sh +100 -41
- package/scripts/forge-issues.py +6 -4
- package/scripts/forge-jev-options.sh +3 -5
- package/scripts/forge-lib-adopt.sh +169 -5
- package/scripts/forge-lib-attribute.sh +10 -3
- package/scripts/forge-lib-decompose.sh +454 -0
- package/scripts/forge-lib-env.sh +179 -0
- package/scripts/forge-lib-group.sh +9 -6
- package/scripts/forge-lib-plans.sh +38 -21
- package/scripts/forge-lib-review.sh +28 -8
- package/scripts/forge-lib-task.sh +263 -69
- package/scripts/forge-lib-verify.sh +59 -10
- package/scripts/forge-memory.sh +83 -4
- package/scripts/forge-metrics.sh +10 -3
- package/scripts/forge-parallel-options.sh +23 -4
- package/scripts/forge-parallel.sh +602 -217
- package/scripts/forge-plan-check.py +71 -8
- package/scripts/forge-planner.py +303 -17
- package/scripts/forge-pr.py +9 -1
- package/scripts/forge-prompt.py +2 -2
- package/scripts/forge-review-links.py +248 -0
- package/scripts/forge-ripwire.py +234 -16
- package/scripts/forge-route.py +19 -27
- package/scripts/forge-runs-rm.py +92 -21
- package/scripts/forge-runs.py +46 -5
- package/scripts/forge-runtime.py +39 -14
- package/scripts/forge-schedule.py +141 -33
- package/scripts/forge-setup-stale.py +236 -0
- package/scripts/forge-setup.py +804 -0
- package/scripts/forge-shadow.py +2 -20
- package/scripts/forge-solo-lock.py +46 -0
- package/scripts/forge-solo.sh +39 -58
- package/scripts/forge-sweep.py +3 -2
- package/scripts/forge-ui.py +8 -1
- package/scripts/forge-update.sh +8 -3
- package/scripts/forge-verify.py +17 -1
- package/scripts/forge-version.py +13 -1
- package/scripts/forge-watch.py +7 -2
- package/scripts/forge-win.sh +156 -0
- package/scripts/forge_brief/__init__.py +6 -1
- package/scripts/forge_brief/proposals.py +6 -1
- package/scripts/forge_dataset/__init__.py +1 -1
- package/scripts/forge_dataset/capture.py +0 -34
- package/scripts/forge_dataset/checks.py +0 -1
- package/scripts/forge_dataset/cli.py +5 -1
- package/scripts/forge_dataset/export.py +28 -6
- package/scripts/forge_dataset/facts.py +1 -2
- package/scripts/forge_dataset/forecast.py +1 -1
- package/scripts/forge_dataset/harvest.py +107 -7
- package/scripts/forge_dataset/importer.py +3 -2
- package/scripts/forge_dataset/pairs.py +3 -3
- package/scripts/forge_dataset/reviewers.py +4 -3
- package/scripts/forge_dataset/routing.py +6 -3
- package/scripts/forge_dataset/tiers.py +1 -1
- package/scripts/forge_decide/__init__.py +1 -1
- package/scripts/forge_decide/budget.py +12 -7
- package/scripts/forge_decide/profiles.py +11 -14
- package/scripts/forge_decide/replay.py +9 -4
- package/scripts/forge_decompose.py +987 -0
- package/scripts/forge_flock.py +17 -2
- package/scripts/forge_groups/review.py +6 -1
- package/scripts/forge_jev/__init__.py +1 -1
- package/scripts/forge_jev/cli.py +10 -1
- package/scripts/forge_jev/gates.py +10 -1
- package/scripts/forge_jev/verify.py +10 -2
- package/scripts/forge_legacy.py +86 -0
- package/scripts/forge_memory_home.py +57 -0
- package/scripts/forge_models.py +151 -0
- package/scripts/forge_posix.py +17 -0
- package/scripts/forge_prefs.py +138 -0
- package/scripts/forge_proc.py +108 -0
- package/scripts/forge_registry.py +2 -2
- package/scripts/forge_side/__init__.py +23 -4
- package/scripts/forge_storage.py +28 -15
- package/ui/README.md +22 -10
- package/ui/docs/api.md +121 -99
- package/ui/forge_ui/control.py +53 -16
- package/ui/forge_ui/export.py +0 -10
- package/ui/forge_ui/models.py +15 -2
- package/ui/forge_ui/projects.py +4 -1
- package/ui/forge_ui/reader.py +462 -60
- package/ui/forge_ui/server.py +0 -10
- package/ui/forge_ui/static/app.js +28 -9
- package/ui/forge_ui/static/checksview.js +12 -3
- package/ui/forge_ui/static/controls.js +147 -11
- package/ui/forge_ui/static/convo.js +5 -2
- package/ui/forge_ui/static/diffview.js +4 -5
- package/ui/forge_ui/static/panel.js +180 -77
- package/ui/forge_ui/static/projectsview.js +16 -2
- package/ui/forge_ui/static/runmodel.js +18 -4
- package/ui/forge_ui/static/scene3d.js +52 -31
- package/ui/forge_ui/static/settings.js +1 -1
- package/ui/forge_ui/static/storageview.js +2 -2
- package/ui/forge_ui/static/style.css +23 -6
- package/ui/forge_ui/static/worktreesview.js +8 -4
- package/ui/forge_ui/transcripts.py +6 -0
- package/ui/forge_ui/worktrees.py +13 -1
- package/docs/fractal.md +0 -181
- package/references/fractal-dashboard.md +0 -21
- package/references/fractal.md +0 -307
- package/scripts/forge-fractal-dispatch.sh +0 -4
- package/scripts/forge-fractal-options.sh +0 -54
- package/scripts/forge-fractal.py +0 -6
- package/scripts/forge-install-fractal.sh +0 -4
- package/scripts/forge_fractal/__init__.py +0 -88
- package/scripts/forge_fractal/bridge.py +0 -46
- package/scripts/forge_fractal/cli.py +0 -224
- package/scripts/forge_fractal/dashboard.css +0 -138
- package/scripts/forge_fractal/dashboard.html +0 -41
- package/scripts/forge_fractal/dashboard.js +0 -687
- package/scripts/forge_fractal/decomposition.py +0 -262
- package/scripts/forge_fractal/execution.py +0 -659
- package/scripts/forge_fractal/inspection.py +0 -261
- package/scripts/forge_fractal/install.py +0 -158
- package/scripts/forge_fractal/invocation.py +0 -95
- package/scripts/forge_fractal/pipeline.py +0 -125
- package/scripts/forge_fractal/selection.py +0 -180
- package/ui/forge_ui/fractal.py +0 -582
|
@@ -4,8 +4,10 @@
|
|
|
4
4
|
forge-plan-check.py size --plan P
|
|
5
5
|
Names the tasks that are large by the measure that predicts a failed first attempt, the
|
|
6
6
|
tasks whose prompt.md has no acceptance criteria, and the tasks whose acceptance criteria
|
|
7
|
-
ask for the whole suite (each attempt would run it; the run's verification already does
|
|
8
|
-
|
|
7
|
+
ask for the whole suite (each attempt would run it; the run's verification already does
|
|
8
|
+
once at the end of the run on the combined result — not after each merge, so a failure is
|
|
9
|
+
not attributed to a task unless `forge-parallel.sh attribute` is run). Prints nothing
|
|
10
|
+
when every task is fine. Exit status is always 0.
|
|
9
11
|
|
|
10
12
|
forge-plan-check.py gates PLAN
|
|
11
13
|
Prints the decision-model gate block (what drift, forward, prompt and coverage did to this
|
|
@@ -27,7 +29,10 @@ sendback and gates print nothing and exit 0 if forge_jev.plan_gates cannot be im
|
|
|
27
29
|
|
|
28
30
|
forge-plan-check.py collapse PLAN
|
|
29
31
|
Collapses a chain into one task named combined. The original table is kept as
|
|
30
|
-
tasks.precollapse.tsv and each tasks/<id>/ moves to tasks.precollapse/<id>/. A
|
|
32
|
+
tasks.precollapse.tsv and each tasks/<id>/ moves to tasks.precollapse/<id>/. A
|
|
33
|
+
groups.tsv is kept as groups.precollapse.tsv and rewritten: the parts become combined,
|
|
34
|
+
and a group made only of parts is dropped (the file goes when none is left);
|
|
35
|
+
collapsed.json lists the dropped groups under "groups". A one or
|
|
31
36
|
branches plan is not changed. A plan that already has tasks.precollapse.tsv or
|
|
32
37
|
collapsed.json exits 2.
|
|
33
38
|
|
|
@@ -205,6 +210,8 @@ NO_CRITERIA = '- (no criteria were written for this part)'
|
|
|
205
210
|
PRECOLLAPSE_TSV = 'tasks.precollapse.tsv'
|
|
206
211
|
PRECOLLAPSE_DIR = 'tasks.precollapse'
|
|
207
212
|
COLLAPSED_JSON = 'collapsed.json'
|
|
213
|
+
GROUPS_TSV = 'groups.tsv'
|
|
214
|
+
PRECOLLAPSE_GROUPS = 'groups.precollapse.tsv'
|
|
208
215
|
|
|
209
216
|
|
|
210
217
|
class PlanShapeError(Exception):
|
|
@@ -621,17 +628,60 @@ def render_tasks(original: bytes, row: dict) -> bytes:
|
|
|
621
628
|
return (body + cells + '\n').encode('utf-8', 'surrogateescape')
|
|
622
629
|
|
|
623
630
|
|
|
624
|
-
def _collapsed_text(ids: list, info: dict) -> str:
|
|
631
|
+
def _collapsed_text(ids: list, info: dict, dropped_groups=None) -> str:
|
|
625
632
|
payload = {
|
|
626
633
|
'from': ids,
|
|
627
634
|
'into': 'combined',
|
|
628
635
|
'shape': {key: info[key] for key in SHAPE_KEYS},
|
|
629
636
|
}
|
|
637
|
+
if dropped_groups is not None:
|
|
638
|
+
payload['groups'] = {'kept_as': PRECOLLAPSE_GROUPS, 'dropped': dropped_groups}
|
|
630
639
|
return json.dumps(payload, indent=2) + '\n'
|
|
631
640
|
|
|
632
641
|
|
|
633
|
-
def
|
|
642
|
+
def collapse_groups(text: str, parts) -> tuple:
|
|
643
|
+
"""groups.tsv after a collapse (#257): (new text or None to remove the file, dropped group ids).
|
|
644
|
+
|
|
645
|
+
Every collapsed part becomes `combined`, once per group. A group made only of parts is
|
|
646
|
+
dropped: the plan is one task now, and a group of one task is that task's own review. A
|
|
647
|
+
member that was not a part is kept as written, so `forge_groups.validate` still reports it.
|
|
648
|
+
Comment and blank lines are kept. A row that is not six columns is kept for validate too."""
|
|
649
|
+
parts = set(parts)
|
|
650
|
+
out, dropped, kept = [], [], 0
|
|
651
|
+
for line in text.splitlines():
|
|
652
|
+
if not line.strip() or line.startswith('#'):
|
|
653
|
+
out.append(line)
|
|
654
|
+
continue
|
|
655
|
+
row = line.split('\t')
|
|
656
|
+
if len(row) != 6:
|
|
657
|
+
out.append(line)
|
|
658
|
+
kept += 1
|
|
659
|
+
continue
|
|
660
|
+
members = [m.strip() for m in row[3].split(',')]
|
|
661
|
+
if members and all(m in parts for m in members):
|
|
662
|
+
dropped.append(row[0])
|
|
663
|
+
continue
|
|
664
|
+
merged = []
|
|
665
|
+
for member in members:
|
|
666
|
+
name = 'combined' if member in parts else member
|
|
667
|
+
if name not in merged:
|
|
668
|
+
merged.append(name)
|
|
669
|
+
row[3] = ','.join(merged)
|
|
670
|
+
out.append('\t'.join(row))
|
|
671
|
+
kept += 1
|
|
672
|
+
if not kept:
|
|
673
|
+
return None, dropped
|
|
674
|
+
return '\n'.join(out) + '\n', dropped
|
|
675
|
+
|
|
676
|
+
|
|
677
|
+
def _rollback(plan: Path, original: bytes, moved: list, made_pre: bool, replaced: bool, made_combined: bool,
|
|
678
|
+
groups=None) -> None:
|
|
634
679
|
"""Put back what collapse had changed. Leftover part dirs are not deleted."""
|
|
680
|
+
if groups is not None:
|
|
681
|
+
_atomic_write(plan / GROUPS_TSV, groups)
|
|
682
|
+
kept = plan / PRECOLLAPSE_GROUPS
|
|
683
|
+
if kept.exists():
|
|
684
|
+
kept.unlink()
|
|
635
685
|
if made_combined:
|
|
636
686
|
combined = plan / 'tasks' / 'combined'
|
|
637
687
|
if combined.exists():
|
|
@@ -677,7 +727,7 @@ def combined_risk(risks: list):
|
|
|
677
727
|
def commit_collapse(plan: Path, original: bytes, rows: list, row: dict, prompt: str, approach, info: dict,
|
|
678
728
|
risk=None) -> None:
|
|
679
729
|
"""Move the chain aside and write the combined task. A failure restores the plan."""
|
|
680
|
-
moved, made_pre, replaced, made_combined = [], False, False, False
|
|
730
|
+
moved, made_pre, replaced, made_combined, groups = [], False, False, False, None
|
|
681
731
|
try:
|
|
682
732
|
_atomic_write(plan / PRECOLLAPSE_TSV, original)
|
|
683
733
|
pre = plan / PRECOLLAPSE_DIR
|
|
@@ -699,10 +749,23 @@ def commit_collapse(plan: Path, original: bytes, rows: list, row: dict, prompt:
|
|
|
699
749
|
if risk is not None:
|
|
700
750
|
_atomic_write(combined / 'risk', risk + '\n')
|
|
701
751
|
ids = [task['id'] for task in _parts_in_wave_order(rows)]
|
|
702
|
-
|
|
752
|
+
dropped = None
|
|
753
|
+
groups_path = plan / GROUPS_TSV
|
|
754
|
+
if groups_path.is_file():
|
|
755
|
+
# The planner's review groups name the parts; left as they were, validate refuses
|
|
756
|
+
# the collapsed plan (#257). The original is kept beside tasks.precollapse.tsv.
|
|
757
|
+
data = groups_path.read_bytes()
|
|
758
|
+
text, dropped = collapse_groups(data.decode('utf-8', 'surrogateescape'), ids)
|
|
759
|
+
_atomic_write(plan / PRECOLLAPSE_GROUPS, data)
|
|
760
|
+
groups = data
|
|
761
|
+
if text is None:
|
|
762
|
+
groups_path.unlink()
|
|
763
|
+
else:
|
|
764
|
+
_atomic_write(groups_path, text)
|
|
765
|
+
_atomic_write(plan / COLLAPSED_JSON, _collapsed_text(ids, info, dropped))
|
|
703
766
|
except Exception as err:
|
|
704
767
|
try:
|
|
705
|
-
_rollback(plan, original, moved, made_pre, replaced, made_combined)
|
|
768
|
+
_rollback(plan, original, moved, made_pre, replaced, made_combined, groups)
|
|
706
769
|
except Exception as restore_err:
|
|
707
770
|
raise PlanShapeError('collapse failed (%s) and the plan could not be restored (%s)'
|
|
708
771
|
% (err, restore_err)) from err
|
package/scripts/forge-planner.py
CHANGED
|
@@ -22,8 +22,24 @@ gate and the one-task plan. Standard library only; no shell wiring.
|
|
|
22
22
|
forge-planner.py one-task --plan P --goal-file F [--difficulty low|medium|high]
|
|
23
23
|
Writes a one-row plan without a planner: id `task`, files `.`, the request as its prompt.
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
forge-planner.py node-prompt --plan P --task ID [--start keep|fresh]
|
|
26
|
+
Writes P/tasks/ID/split.prompt, the question a planner gets about ONE task of an existing
|
|
27
|
+
plan (#153): split it into subtasks inside its own files, or keep it whole and say why.
|
|
28
|
+
|
|
29
|
+
forge-planner.py node-parse --plan P --task ID --reply FILE
|
|
30
|
+
The strict parse of that reply, or of subtasks a person wrote (a forge-plan block, or the
|
|
31
|
+
bare JSON object): P/tasks/ID/split.proposal.json, which forge_decompose.py turns into the
|
|
32
|
+
task's sub-plan. A refusal writes P/tasks/ID/split.refused and exits 4.
|
|
33
|
+
|
|
34
|
+
Recursive decomposition (#153) in a whole-plan reply: a task may carry `subtasks` (its own small
|
|
35
|
+
plan, same keys, nested as deep as the reply likes) and a one-line `reason`. `parse` checks them as
|
|
36
|
+
strictly as tasks, and that each subtask's files lie inside its parent's, and keeps them in
|
|
37
|
+
P/tasks/<id>/split.proposal.json for `plan` to apply within the run's limits; a `reason` on a task
|
|
38
|
+
kept whole goes to P/tasks/<id>/split.reason. A reply may also carry `later`, the stages of a goal
|
|
39
|
+
larger than one plan: they go to P/later.json, and forge plans each when the one before has merged.
|
|
40
|
+
|
|
41
|
+
prompt, parse, gate and one-task refuse (exit 2) a plan dir that already has tasks.tsv, so nothing
|
|
42
|
+
is overwritten. Exit codes: 0 done, 2 usage or input problem, 4 reply refused.
|
|
27
43
|
"""
|
|
28
44
|
from __future__ import annotations
|
|
29
45
|
|
|
@@ -36,6 +52,7 @@ import sys
|
|
|
36
52
|
import tempfile
|
|
37
53
|
|
|
38
54
|
sys.path.insert(0, str(Path(__file__).resolve().parent))
|
|
55
|
+
import forge_decompose # noqa: E402
|
|
39
56
|
import forge_groups # noqa: E402
|
|
40
57
|
from forge_jev.coverage import split_requirements # noqa: E402 (read-only use)
|
|
41
58
|
|
|
@@ -49,7 +66,15 @@ MAX_TASKS = 20
|
|
|
49
66
|
TASK_KEYS = ('id', 'deps', 'difficulty', 'files', 'title', 'approach', 'prompt')
|
|
50
67
|
# #122: a task's risk, recorded in shadow beside its difficulty. Optional, and the one key that never refuses a
|
|
51
68
|
# reply: a missing or unknown value records nothing, because a label nothing routes on must not cost a plan.
|
|
52
|
-
|
|
69
|
+
# #153: `subtasks` (the task's own small plan) and `reason` (one line: why it is split, or why it is
|
|
70
|
+
# kept whole). Both optional; a present one is checked strictly.
|
|
71
|
+
OPTIONAL_KEYS = ('risk', 'subtasks', 'reason')
|
|
72
|
+
MAX_SUBTASKS = 20
|
|
73
|
+
MAX_REASON = 500
|
|
74
|
+
# #153: the stages of a goal larger than one plan, in order. Optional on the reply.
|
|
75
|
+
LATER_KEYS = ('title', 'goal')
|
|
76
|
+
MAX_LATER = 10
|
|
77
|
+
MAX_LATER_GOAL = 4000
|
|
53
78
|
# #136: groups are optional on the reply. A missing key writes no groups.tsv. A present one is
|
|
54
79
|
# checked strictly; the planner never sets review=group (that is plan --group-review, or an edit).
|
|
55
80
|
GROUP_KEYS = ('id', 'title', 'goal', 'members')
|
|
@@ -180,7 +205,7 @@ def build_prompt(request: str, level: str | None) -> str:
|
|
|
180
205
|
'sees only that prompt can do it, and ends with a `## Acceptance criteria` section of checks '
|
|
181
206
|
'a reviewer can verify (a behaviour, a command that passes, a file that exists), not restated '
|
|
182
207
|
'goals. Its tests are the ones for the files it touches. Never ask for the whole test suite '
|
|
183
|
-
'(`tests/check.sh`, `npm test`, `make check` and the like): forge runs that
|
|
208
|
+
'(`tests/check.sh`, `npm test`, `make check` and the like): forge runs that once at the end of the run.',
|
|
184
209
|
'Where tasks share a seam (an interface, a file format, a name), fix it in the `approach` of '
|
|
185
210
|
'every task that touches it, so both sides build the same thing.',
|
|
186
211
|
'**Keep each task** under about 7000 characters of prompt and 9 files. A smaller task with '
|
|
@@ -190,6 +215,18 @@ def build_prompt(request: str, level: str | None) -> str:
|
|
|
190
215
|
'step, form one group (usually one per wave of the plan\'s dependency order). Each group '
|
|
191
216
|
'has a short title and a goal sentence that says what is true once its tasks are done. A '
|
|
192
217
|
'group may have one task. A task may be left out of every group.',
|
|
218
|
+
'**Subtasks.** A task that is still large after the rules above, and whose own `files` hold '
|
|
219
|
+
'several pieces that can be built and reviewed apart, may carry `subtasks`: its own small plan. '
|
|
220
|
+
'forge runs them on the task\'s branch and then reviews the task on everything they produced. '
|
|
221
|
+
'Each subtask owns paths inside its parent\'s `files` and depends only on its sibling subtasks. '
|
|
222
|
+
'A split is never required and most tasks have none: when the pieces do not live inside one '
|
|
223
|
+
'task\'s files, make them tasks instead. Say in the task\'s `reason`, in one line, why you split '
|
|
224
|
+
'it, or why you kept whole a task that looked splittable. forge applies the run\'s limits (by '
|
|
225
|
+
'default two levels and six subtasks per task); a split beyond them runs as one task.',
|
|
226
|
+
'**A goal larger than one plan.** When the request is too large for one plan, put only its '
|
|
227
|
+
'first coherent stage in `tasks` and list the stages that follow in `later`, in order. forge '
|
|
228
|
+
'plans each later stage only when the one before has merged, from the code as it then is, so '
|
|
229
|
+
'do not write their tasks now.',
|
|
193
230
|
]
|
|
194
231
|
numbered = '\n'.join(f'{n}. {rule}' for n, rule in enumerate(rules, 1))
|
|
195
232
|
return f"""\
|
|
@@ -211,8 +248,8 @@ The request follows verbatim between the markers. It is the whole requirement.
|
|
|
211
248
|
# Reply format
|
|
212
249
|
|
|
213
250
|
Reply with exactly one fenced block whose opening line is ```forge-plan and whose body is one
|
|
214
|
-
JSON object with the key `tasks` and, optionally, `groups`. `tasks` is a list of 1 to
|
|
215
|
-
objects, each with
|
|
251
|
+
JSON object with the key `tasks` and, optionally, `groups` and `later`. `tasks` is a list of 1 to
|
|
252
|
+
{MAX_TASKS} objects, each with these keys and no others:
|
|
216
253
|
|
|
217
254
|
- `id`: lowercase slug matching `^[a-z0-9][a-z0-9-]{{0,39}}$`, unique in the plan;
|
|
218
255
|
- `deps`: list of ids of tasks that must land first (`[]` for none), no cycles;
|
|
@@ -222,7 +259,16 @@ objects, each with exactly these keys and no others:
|
|
|
222
259
|
`..`, no tab, comma or newline in a path);
|
|
223
260
|
- `title`: one line without a tab;
|
|
224
261
|
- `approach`: a few lines on the intended shape (a string; `""` for none);
|
|
225
|
-
- `prompt`: the task's full instruction, ending with a `## Acceptance criteria` section
|
|
262
|
+
- `prompt`: the task's full instruction, ending with a `## Acceptance criteria` section;
|
|
263
|
+
- `subtasks`: optional. A list of 2 to {MAX_SUBTASKS} objects with these same keys, each `files`
|
|
264
|
+
entry inside this task's `files`, `deps` naming sibling subtasks only. Omit it for a task that
|
|
265
|
+
is one piece;
|
|
266
|
+
- `reason`: optional. One line, at most {MAX_REASON} characters: why the task is split, or why it
|
|
267
|
+
is kept whole.
|
|
268
|
+
|
|
269
|
+
`later`, when present, is a list of at most {MAX_LATER} objects with exactly the keys `title` (one
|
|
270
|
+
short line) and `goal` (what that stage must reach, in full, since it becomes that plan's request).
|
|
271
|
+
Omit the key when the request fits one plan.
|
|
226
272
|
|
|
227
273
|
`groups`, when present, is a list of objects with exactly these keys and no others. Omit the key
|
|
228
274
|
to return no groups:
|
|
@@ -325,13 +371,16 @@ def check_path(path, where: str):
|
|
|
325
371
|
raise Refusal(f'{where}: file {path!r} has a .. component')
|
|
326
372
|
|
|
327
373
|
|
|
328
|
-
|
|
329
|
-
|
|
374
|
+
MAX_SPLIT_DEPTH = 6 # forge_decompose.LIMIT_RANGE's deepest; a reply nested past it is not a plan
|
|
375
|
+
|
|
376
|
+
|
|
377
|
+
def check_task(task, index: int, seen: set, depth: int = 0, prefix: str = '') -> dict:
|
|
378
|
+
where = f'{prefix}task {index + 1}' if not prefix else f'{prefix}{index + 1}'
|
|
330
379
|
check_keys(task, TASK_KEYS, where, OPTIONAL_KEYS)
|
|
331
380
|
tid = task['id']
|
|
332
381
|
if not isinstance(tid, str) or not ID_RE.fullmatch(tid):
|
|
333
382
|
raise Refusal(f'{where}: id {tid!r} does not match ^[a-z0-9][a-z0-9-]{{0,39}}$')
|
|
334
|
-
where = f'task {tid}'
|
|
383
|
+
where = f'{prefix}{tid}' if prefix else f'task {tid}'
|
|
335
384
|
if tid in seen:
|
|
336
385
|
raise Refusal(f'{where}: duplicate id')
|
|
337
386
|
seen.add(tid)
|
|
@@ -361,7 +410,70 @@ def check_task(task, index: int, seen: set) -> dict:
|
|
|
361
410
|
if not has_acceptance_heading(prompt):
|
|
362
411
|
raise Refusal(f'{where}: prompt has no "## Acceptance criteria" heading')
|
|
363
412
|
risk = task.get('risk')
|
|
364
|
-
|
|
413
|
+
checked = dict(task, risk=risk if isinstance(risk, str) and risk in RISKS else None)
|
|
414
|
+
reason = task.get('reason')
|
|
415
|
+
if reason is not None:
|
|
416
|
+
if not isinstance(reason, str) or LINE_BREAKS_RE.search(reason) or len(reason) > MAX_REASON:
|
|
417
|
+
raise Refusal(f'{where}: reason is not one line of at most {MAX_REASON} characters')
|
|
418
|
+
check_text(reason, where)
|
|
419
|
+
checked['reason'] = (reason or '').strip() or None
|
|
420
|
+
if 'subtasks' in task:
|
|
421
|
+
checked['subtasks'] = check_subtasks(task['subtasks'], tid, files, depth + 1)
|
|
422
|
+
return checked
|
|
423
|
+
|
|
424
|
+
|
|
425
|
+
def check_subtasks(raw, parent: str, parent_files: list, depth: int = 1, low: int = 2) -> list:
|
|
426
|
+
"""A task's `subtasks`: `low` to MAX_SUBTASKS tasks under the same rules, ids unique among the
|
|
427
|
+
siblings, deps naming siblings only and forming no cycle, and every file inside the parent's."""
|
|
428
|
+
where = f'task {parent}'
|
|
429
|
+
if depth > MAX_SPLIT_DEPTH:
|
|
430
|
+
raise Refusal(f'{where}: subtasks nest more than {MAX_SPLIT_DEPTH} levels deep')
|
|
431
|
+
if not isinstance(raw, list) or not low <= len(raw) <= MAX_SUBTASKS:
|
|
432
|
+
count = f' ({len(raw)})' if isinstance(raw, list) else ''
|
|
433
|
+
raise Refusal(f'{where}: subtasks must be a list of {low} to {MAX_SUBTASKS} objects{count}; '
|
|
434
|
+
'omit the key for a task that is one piece')
|
|
435
|
+
seen: set = set()
|
|
436
|
+
checked = []
|
|
437
|
+
for index, item in enumerate(raw):
|
|
438
|
+
child = check_task(item, index, seen, depth, f'{where}: subtask ')
|
|
439
|
+
for path in child['files']:
|
|
440
|
+
if not forge_decompose.inside(path, parent_files):
|
|
441
|
+
raise Refusal(f'{where}: subtask {child["id"]}: file {path!r} is outside its parent\'s files '
|
|
442
|
+
f'({", ".join(parent_files)})')
|
|
443
|
+
checked.append(child)
|
|
444
|
+
try:
|
|
445
|
+
check_graph(checked)
|
|
446
|
+
except Refusal as err:
|
|
447
|
+
raise Refusal(f'{where}: among its subtasks: {err}')
|
|
448
|
+
return checked
|
|
449
|
+
|
|
450
|
+
|
|
451
|
+
def proposal_of(task: dict) -> dict:
|
|
452
|
+
"""What forge_decompose.py reads: {reason, tasks}, each task with `split` where it has subtasks."""
|
|
453
|
+
def plain(item):
|
|
454
|
+
out = {key: item[key] for key in TASK_KEYS}
|
|
455
|
+
out['risk'] = item.get('risk')
|
|
456
|
+
if item.get('subtasks'):
|
|
457
|
+
out['split'] = proposal_of(item)
|
|
458
|
+
return out
|
|
459
|
+
return {'reason': task.get('reason') or '', 'tasks': [plain(item) for item in task['subtasks']]}
|
|
460
|
+
|
|
461
|
+
|
|
462
|
+
def check_later(raw) -> list:
|
|
463
|
+
if not isinstance(raw, list) or not 1 <= len(raw) <= MAX_LATER:
|
|
464
|
+
count = f' ({len(raw)})' if isinstance(raw, list) else ''
|
|
465
|
+
raise Refusal(f'later must be a list of 1 to {MAX_LATER} objects{count}; omit the key when the request fits one plan')
|
|
466
|
+
stages = []
|
|
467
|
+
for index, stage in enumerate(raw):
|
|
468
|
+
where = f'later {index + 1}'
|
|
469
|
+
check_keys(stage, LATER_KEYS, where)
|
|
470
|
+
check_group_line(stage['title'], f'{where}: title')
|
|
471
|
+
goal = stage['goal']
|
|
472
|
+
if not isinstance(goal, str) or not goal.strip() or len(goal) > MAX_LATER_GOAL:
|
|
473
|
+
raise Refusal(f'{where}: goal is not a non-empty text of at most {MAX_LATER_GOAL} characters')
|
|
474
|
+
check_text(goal, where)
|
|
475
|
+
stages.append({'title': stage['title'].strip(), 'goal': goal})
|
|
476
|
+
return stages
|
|
365
477
|
|
|
366
478
|
|
|
367
479
|
def check_group_line(value, where: str):
|
|
@@ -478,9 +590,8 @@ def nested_deeper_than(value, limit: int) -> bool:
|
|
|
478
590
|
return False
|
|
479
591
|
|
|
480
592
|
|
|
481
|
-
def
|
|
482
|
-
"""
|
|
483
|
-
body = extract_block(reply)
|
|
593
|
+
def load_block(body: str):
|
|
594
|
+
"""The JSON of a forge-plan block, under the limits every reply is read with."""
|
|
484
595
|
try:
|
|
485
596
|
data = json.loads(body, object_pairs_hook=no_duplicate_keys, parse_int=bounded_int)
|
|
486
597
|
except (ValueError, RecursionError) as err:
|
|
@@ -490,7 +601,14 @@ def parse_reply(reply: str):
|
|
|
490
601
|
raise Refusal(f'the forge-plan body is not valid JSON: {type(err).__name__}: {str(err)[:200]}')
|
|
491
602
|
if nested_deeper_than(data, MAX_JSON_DEPTH):
|
|
492
603
|
raise Refusal(f'the forge-plan body is not valid JSON: nested more than {MAX_JSON_DEPTH} levels deep')
|
|
493
|
-
|
|
604
|
+
return data
|
|
605
|
+
|
|
606
|
+
|
|
607
|
+
def parse_plan(reply: str):
|
|
608
|
+
"""(tasks, groups, later). groups is None when the reply has no groups key, else a list (maybe
|
|
609
|
+
empty); later is None when it has no later key."""
|
|
610
|
+
data = load_block(extract_block(reply))
|
|
611
|
+
check_keys(data, ('tasks',), 'the forge-plan body', ('groups', 'later'))
|
|
494
612
|
tasks = data['tasks']
|
|
495
613
|
if not isinstance(tasks, list) or not 1 <= len(tasks) <= MAX_TASKS:
|
|
496
614
|
count = f' ({len(tasks)})' if isinstance(tasks, list) else ''
|
|
@@ -499,7 +617,14 @@ def parse_reply(reply: str):
|
|
|
499
617
|
checked = [check_task(t, i, seen) for i, t in enumerate(tasks)]
|
|
500
618
|
check_graph(checked)
|
|
501
619
|
groups = check_groups(data['groups'], seen) if 'groups' in data else None
|
|
502
|
-
|
|
620
|
+
later = check_later(data['later']) if 'later' in data else None
|
|
621
|
+
return checked, groups, later
|
|
622
|
+
|
|
623
|
+
|
|
624
|
+
def parse_reply(reply: str):
|
|
625
|
+
"""(tasks, groups), as before `later` existed: what the callers that only need the plan read."""
|
|
626
|
+
tasks, groups, _later = parse_plan(reply)
|
|
627
|
+
return tasks, groups
|
|
503
628
|
|
|
504
629
|
|
|
505
630
|
def cmd_parse(args) -> int:
|
|
@@ -510,7 +635,7 @@ def cmd_parse(args) -> int:
|
|
|
510
635
|
request = read_text(request_path, 'request')
|
|
511
636
|
reply = read_text(args.reply, 'reply')
|
|
512
637
|
try:
|
|
513
|
-
tasks, groups =
|
|
638
|
+
tasks, groups, later = parse_plan(reply)
|
|
514
639
|
except Refusal as err:
|
|
515
640
|
# A key or path may hold a lone surrogate; escape it so the reason can be written and printed.
|
|
516
641
|
reason = str(err).encode('utf-8', 'backslashreplace').decode('utf-8')
|
|
@@ -531,9 +656,18 @@ def cmd_parse(args) -> int:
|
|
|
531
656
|
outputs.append((folder / 'prompt.md', text.encode('utf-8')))
|
|
532
657
|
outputs.append((folder / 'approach.md', t['approach'].encode('utf-8') if t['approach'].strip() else None))
|
|
533
658
|
outputs.append((folder / 'risk', (t['risk'] + '\n').encode('utf-8') if t['risk'] else None))
|
|
659
|
+
# #153: what the planner decided about splitting this task. `plan` applies a proposal within
|
|
660
|
+
# the run's limits (forge_decompose.py settle) and records the reason of a task kept whole.
|
|
661
|
+
split = json.dumps(proposal_of(t)).encode('utf-8') if t.get('subtasks') else None
|
|
662
|
+
outputs.append((folder / forge_decompose.PROPOSAL, split))
|
|
663
|
+
kept = (t['reason'] + '\n').encode('utf-8') if t.get('reason') and not t.get('subtasks') else None
|
|
664
|
+
outputs.append((folder / forge_decompose.REASON, kept))
|
|
534
665
|
outputs.append((plan / 'tasks.tsv', ('\n'.join(rows) + '\n').encode('utf-8')))
|
|
535
666
|
if groups is not None:
|
|
536
667
|
outputs.append((plan / 'groups.tsv', groups_tsv_bytes(groups)))
|
|
668
|
+
# #153: the stages after this plan, for the table, the run summary and `next`.
|
|
669
|
+
chain = json.dumps({'later': later}, indent=1).encode('utf-8') + b'\n' if later else None
|
|
670
|
+
outputs.append((plan / forge_decompose.LATER, chain))
|
|
537
671
|
for path, data in outputs:
|
|
538
672
|
if data is None:
|
|
539
673
|
path.unlink(missing_ok=True) # an empty approach must not keep an older one alive
|
|
@@ -587,6 +721,147 @@ def cmd_one_task(args) -> int:
|
|
|
587
721
|
return 0
|
|
588
722
|
|
|
589
723
|
|
|
724
|
+
# --- one task of an existing plan (#153) -------------------------------------------------------
|
|
725
|
+
|
|
726
|
+
NODE_ROLE = """\
|
|
727
|
+
You are the planner of a software change that is already under way. You are read-only: inspect the
|
|
728
|
+
repository as much as you need, and return a plan. Never edit, create or delete a file, and never
|
|
729
|
+
run anything that changes the repository. One task of the plan is in front of you. Decide whether it
|
|
730
|
+
should be split into subtasks, each built in a worktree of its own and judged by a reviewer against
|
|
731
|
+
its prompt, or kept as one task."""
|
|
732
|
+
|
|
733
|
+
|
|
734
|
+
def node_task(args):
|
|
735
|
+
plan = Path(args.plan)
|
|
736
|
+
row = forge_decompose.row_of(plan, args.task)
|
|
737
|
+
if row is None:
|
|
738
|
+
die(f'no task {args.task!r} in {plan}')
|
|
739
|
+
return plan, row
|
|
740
|
+
|
|
741
|
+
|
|
742
|
+
def tail_text(path: Path, limit: int) -> str:
|
|
743
|
+
try:
|
|
744
|
+
text = path.read_text(encoding='utf-8', errors='replace')
|
|
745
|
+
except OSError:
|
|
746
|
+
return ''
|
|
747
|
+
return text if len(text) <= limit else '[...]\n' + text[-limit:]
|
|
748
|
+
|
|
749
|
+
|
|
750
|
+
def build_node_prompt(plan: Path, row: dict, start: str) -> str:
|
|
751
|
+
tdir = plan / 'tasks' / row['id']
|
|
752
|
+
limits = forge_decompose.limits(plan)
|
|
753
|
+
most = min(limits['children'], MAX_SUBTASKS)
|
|
754
|
+
prompt = read_text(tdir / 'prompt.md', 'task prompt')
|
|
755
|
+
review = tail_text(tdir / 'qa.last', 6000).strip()
|
|
756
|
+
stopped = tail_text(tdir / 'decision.md', 1500).strip()
|
|
757
|
+
so_far = ''
|
|
758
|
+
if stopped:
|
|
759
|
+
so_far += f'\n# Why it stopped\n\n{stopped}\n'
|
|
760
|
+
if review:
|
|
761
|
+
so_far += f'\n# The last review of the work so far\n\n{review}\n'
|
|
762
|
+
if start == 'fresh':
|
|
763
|
+
work = ('The work done on this task so far is set aside: the subtasks start from the code as it was '
|
|
764
|
+
'before the task began.')
|
|
765
|
+
else:
|
|
766
|
+
work = ('The work done on this task so far stays on its branch, and the subtasks build on it: plan '
|
|
767
|
+
'what is still missing or wrong, not what is already there and right.')
|
|
768
|
+
rules = [
|
|
769
|
+
'**Keeping it whole is a valid answer**, and the right one when the task is one coherent piece. '
|
|
770
|
+
'Reply then with exactly one task (the task as it should be done) and say why in `reason`. '
|
|
771
|
+
'A split is never required.',
|
|
772
|
+
'**Each subtask owns paths inside this task\'s files** (' + ', '.join(row['files']) + '). A path '
|
|
773
|
+
'outside them refuses the whole reply.',
|
|
774
|
+
'**Never two subtasks that edit the same file**, unless a dependency orders them. `deps` names '
|
|
775
|
+
'sibling subtasks only.',
|
|
776
|
+
'Never split so fine that a subtask cannot be verified on its own: each must be reviewable and '
|
|
777
|
+
'correct by itself. Prefer subtasks that can run in parallel to a pure chain.',
|
|
778
|
+
'**Each subtask\'s `prompt`** carries the whole requirement it owns, written so that someone who '
|
|
779
|
+
'sees only that prompt can do it, and ends with a `## Acceptance criteria` section of checks a '
|
|
780
|
+
'reviewer can verify. The task\'s own prompt is attached to each subtask for context.',
|
|
781
|
+
'Rate `difficulty` by what the subtask demands of the model: `low` mechanical and local, '
|
|
782
|
+
'`medium` a self-contained implementation against a clear spec, `high` design judgment or '
|
|
783
|
+
'subtle edge cases.',
|
|
784
|
+
work,
|
|
785
|
+
f'At most {most} subtasks.',
|
|
786
|
+
]
|
|
787
|
+
numbered = '\n'.join(f'{n}. {rule}' for n, rule in enumerate(rules, 1))
|
|
788
|
+
return f"""\
|
|
789
|
+
# Role
|
|
790
|
+
|
|
791
|
+
{NODE_ROLE}
|
|
792
|
+
|
|
793
|
+
# The task
|
|
794
|
+
|
|
795
|
+
Its id is `{row['id']}`, its difficulty `{row['difficulty']}`, its title "{row['title']}". Its prompt
|
|
796
|
+
follows verbatim between the markers.
|
|
797
|
+
|
|
798
|
+
<<<TASK
|
|
799
|
+
{prompt}{'' if prompt.endswith(chr(10)) else chr(10)}TASK>>>
|
|
800
|
+
{so_far}
|
|
801
|
+
# Rules
|
|
802
|
+
|
|
803
|
+
{numbered}
|
|
804
|
+
|
|
805
|
+
# Reply format
|
|
806
|
+
|
|
807
|
+
Reply with exactly one fenced block whose opening line is ```forge-plan and whose body is one
|
|
808
|
+
JSON object with the keys `reason` (one line: why you split the task this way, or why you kept it
|
|
809
|
+
whole) and `tasks`, a list of 1 to {most} objects (one means: keep it whole), each with exactly
|
|
810
|
+
these keys and no others:
|
|
811
|
+
|
|
812
|
+
- `id`: lowercase slug matching `^[a-z0-9][a-z0-9-]{{0,39}}$`, unique in the reply;
|
|
813
|
+
- `deps`: list of ids of subtasks of this reply that must land first (`[]` for none), no cycles;
|
|
814
|
+
- `difficulty`: `low`, `medium` or `high`;
|
|
815
|
+
- `files`: non-empty list of repo-relative paths inside the task's files;
|
|
816
|
+
- `title`: one line without a tab;
|
|
817
|
+
- `approach`: a few lines on the intended shape (a string; `""` for none);
|
|
818
|
+
- `prompt`: the subtask's full instruction, ending with a `## Acceptance criteria` section.
|
|
819
|
+
|
|
820
|
+
Put no other `forge-plan` block in the reply. Text outside the block is ignored. Anything that
|
|
821
|
+
breaks these rules makes the whole reply refused; nothing is repaired.
|
|
822
|
+
"""
|
|
823
|
+
|
|
824
|
+
|
|
825
|
+
def cmd_node_prompt(args) -> int:
|
|
826
|
+
plan, row = node_task(args)
|
|
827
|
+
out = plan / 'tasks' / row['id'] / 'split.prompt'
|
|
828
|
+
write_atomic(out, build_node_prompt(plan, row, args.start))
|
|
829
|
+
print(out)
|
|
830
|
+
return 0
|
|
831
|
+
|
|
832
|
+
|
|
833
|
+
def parse_node(text: str, row: dict) -> dict:
|
|
834
|
+
"""{reason, tasks} from a planner's reply about one task, or from subtasks a person wrote: the
|
|
835
|
+
forge-plan block when the text has one, else the text as the bare JSON object."""
|
|
836
|
+
lines = text.split('\n')
|
|
837
|
+
fenced = any(OPEN_RE.match(line.rstrip('\r')) for line in lines)
|
|
838
|
+
data = load_block(extract_block(text) if fenced else text)
|
|
839
|
+
check_keys(data, ('tasks',), 'the forge-plan body', ('reason',))
|
|
840
|
+
reason = data.get('reason')
|
|
841
|
+
if reason is not None and (not isinstance(reason, str) or LINE_BREAKS_RE.search(reason) or len(reason) > MAX_REASON):
|
|
842
|
+
raise Refusal(f'reason is not one line of at most {MAX_REASON} characters')
|
|
843
|
+
tasks = check_subtasks(data['tasks'], row['id'], row['files'], low=1)
|
|
844
|
+
return {'reason': (reason or '').strip(), 'tasks': proposal_of({'subtasks': tasks})['tasks']}
|
|
845
|
+
|
|
846
|
+
|
|
847
|
+
def cmd_node_parse(args) -> int:
|
|
848
|
+
plan, row = node_task(args)
|
|
849
|
+
tdir = plan / 'tasks' / row['id']
|
|
850
|
+
reply = read_text(args.reply, 'reply')
|
|
851
|
+
try:
|
|
852
|
+
proposal = parse_node(reply, row)
|
|
853
|
+
except Refusal as err:
|
|
854
|
+
reason = str(err).encode('utf-8', 'backslashreplace').decode('utf-8')
|
|
855
|
+
write_atomic(tdir / 'split.refused', f'{reason}\nreply: {args.reply}\n')
|
|
856
|
+
print(f'subtasks refused: {reason}')
|
|
857
|
+
return 4
|
|
858
|
+
out = Path(args.out) if args.out else tdir / forge_decompose.PROPOSAL
|
|
859
|
+
write_atomic(out, json.dumps(proposal))
|
|
860
|
+
(tdir / 'split.refused').unlink(missing_ok=True)
|
|
861
|
+
print(out)
|
|
862
|
+
return 0
|
|
863
|
+
|
|
864
|
+
|
|
590
865
|
def main(argv=None) -> int:
|
|
591
866
|
ap = argparse.ArgumentParser(prog='forge-planner.py', description=__doc__.split('\n')[0])
|
|
592
867
|
sub = ap.add_subparsers(dest='cmd', required=True)
|
|
@@ -608,6 +883,17 @@ def main(argv=None) -> int:
|
|
|
608
883
|
p.add_argument('--goal-file', required=True)
|
|
609
884
|
p.add_argument('--difficulty', choices=DIFFICULTIES, default='medium')
|
|
610
885
|
p.set_defaults(fn=cmd_one_task)
|
|
886
|
+
p = sub.add_parser('node-prompt', help='write the prompt that asks a planner about one task of a plan')
|
|
887
|
+
p.add_argument('--plan', required=True)
|
|
888
|
+
p.add_argument('--task', required=True)
|
|
889
|
+
p.add_argument('--start', choices=forge_decompose.STARTS, default='keep')
|
|
890
|
+
p.set_defaults(fn=cmd_node_prompt)
|
|
891
|
+
p = sub.add_parser('node-parse', help='strictly parse the subtasks proposed for one task')
|
|
892
|
+
p.add_argument('--plan', required=True)
|
|
893
|
+
p.add_argument('--task', required=True)
|
|
894
|
+
p.add_argument('--reply', required=True)
|
|
895
|
+
p.add_argument('--out', help='where the checked subtasks go (default: tasks/<task>/split.proposal.json)')
|
|
896
|
+
p.set_defaults(fn=cmd_node_parse)
|
|
611
897
|
args = ap.parse_args(argv)
|
|
612
898
|
return args.fn(args)
|
|
613
899
|
|
package/scripts/forge-pr.py
CHANGED
|
@@ -161,8 +161,16 @@ def build(path: Path, source: str, scrub, texts: bool) -> tuple[str, str]:
|
|
|
161
161
|
out += ['- `%s` %s: %s' % (scrub(t['id']), cell(scrub(t['title'])), t['status']) for t in other]
|
|
162
162
|
out += ['', 'These tasks are not part of the integration branch.', '']
|
|
163
163
|
verification = d.get('verification_status')
|
|
164
|
+
ver_commit = ((d.get('verification') or {}).get('commit') or '').strip()
|
|
165
|
+
if verification == 'STALE':
|
|
166
|
+
if ver_commit:
|
|
167
|
+
ver_text = 'STALE (verified `%s`, before later merges)' % ver_commit[:7]
|
|
168
|
+
else:
|
|
169
|
+
ver_text = 'STALE (verified an earlier commit, before later merges)'
|
|
170
|
+
else:
|
|
171
|
+
ver_text = verification or 'not recorded'
|
|
164
172
|
review = d.get('final_review')
|
|
165
|
-
out += ['## Checks', '', '- Verification: %s' %
|
|
173
|
+
out += ['## Checks', '', '- Verification: %s' % ver_text]
|
|
166
174
|
if review:
|
|
167
175
|
note = ''
|
|
168
176
|
if review.get('outdated'):
|
package/scripts/forge-prompt.py
CHANGED
|
@@ -19,8 +19,8 @@ QA_ROUND_NOTE = """\
|
|
|
19
19
|
Check each finding above first: is it fixed, still present, or validly rejected by the
|
|
20
20
|
implementer (see their reply below)? Report a finding that is still present again, in the
|
|
21
21
|
usual labelled format with its severity. Mention a fixed or rejected finding only in a plain
|
|
22
|
-
sentence, never as a `- [Px][CONFIRMED]` or `- [Px][PLAUSIBLE]` line
|
|
23
|
-
counted as an open finding. This round's threshold, in the contract below, governs; it may
|
|
22
|
+
sentence without its severity, never as a `- [Px][CONFIRMED]` or `- [Px][PLAUSIBLE]` line or
|
|
23
|
+
a bullet that leads with P0-P3: every labelled line is counted as an open finding. This round's threshold, in the contract below, governs; it may
|
|
24
24
|
differ from the last round's. Then review the full task diff below: the changes since that
|
|
25
25
|
round are where new problems are most likely."""
|
|
26
26
|
|