@jesdi/skills 0.0.76 → 0.0.78
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/README.md +5 -0
- package/package.json +2 -1
- package/skills/implement-spec/ARCHITECTURE.md +102 -54
- package/skills/implement-spec/README.md +53 -51
- package/skills/implement-spec/SKILL.md +5 -6
- package/skills/implement-spec/driver.py +67 -153
- package/skills/implement-spec/driver_agents.py +75 -25
- package/skills/implement-spec/driver_decisions.py +92 -199
- package/skills/implement-spec/driver_dispute.py +189 -0
- package/skills/implement-spec/driver_final.py +196 -97
- package/skills/implement-spec/driver_fixloop.py +102 -192
- package/skills/implement-spec/driver_legacy.py +73 -5
- package/skills/implement-spec/driver_locked.py +186 -0
- package/skills/implement-spec/driver_merge.py +3 -48
- package/skills/implement-spec/driver_report.py +84 -64
- package/skills/implement-spec/driver_review.py +12 -119
- package/skills/implement-spec/driver_run.py +167 -130
- package/skills/implement-spec/driver_state.py +11 -9
- package/skills/implement-spec/models.json +0 -2
- package/skills/implement-spec/prompts/arbitration.md +34 -0
- package/skills/implement-spec/prompts/conflict.md +1 -0
- package/skills/implement-spec/prompts/correction.md +7 -4
- package/skills/implement-spec/prompts/elsewhere.md +6 -0
- package/skills/implement-spec/prompts/final-fixer.md +1 -1
- package/skills/implement-spec/prompts/final-lens.md +40 -0
- package/skills/implement-spec/prompts/final-reviewer.md +7 -7
- package/skills/implement-spec/prompts/fixer.md +2 -2
- package/skills/implement-spec/prompts/implementer.md +1 -1
- package/skills/implement-spec/prompts/lens-copy.md +1 -0
- package/skills/implement-spec/prompts/lens-correctness.md +8 -0
- package/skills/implement-spec/prompts/lens-spec.md +2 -0
- package/skills/implement-spec/prompts/lens-structure.md +2 -0
- package/skills/implement-spec/prompts/rebase-conflict.md +1 -0
- package/skills/implement-spec/prompts/rereview.md +0 -1
- package/skills/implement-spec/prompts/rerun.md +1 -1
- package/skills/implement-spec/prompts/reviewer.md +3 -6
- package/skills/implement-spec/prompts/ruled.md +3 -0
- package/skills/implement-spec/prompts/test-writer.md +4 -5
- package/skills/implement-spec/tests/test_agents.py +23 -22
- package/skills/implement-spec/tests/test_amendments.py +6 -48
- package/skills/implement-spec/tests/test_arbitration.py +314 -0
- package/skills/implement-spec/tests/test_cli.py +3 -3
- package/skills/implement-spec/tests/test_decisions.py +251 -374
- package/skills/implement-spec/tests/test_driver.py +22 -50
- package/skills/implement-spec/tests/test_final.py +45 -77
- package/skills/implement-spec/tests/test_fixloop.py +400 -633
- package/skills/implement-spec/tests/test_landing.py +23 -126
- package/skills/implement-spec/tests/test_lenses.py +217 -0
- package/skills/implement-spec/tests/test_merge.py +0 -43
- package/skills/implement-spec/tests/test_models.py +50 -1
- package/skills/implement-spec/tests/test_report.py +9 -23
- package/skills/implement-spec/tests/test_review.py +15 -153
- package/skills/implement-spec/tests/test_review_page.py +7 -3
- package/skills/implement-spec/tests/test_scoped.py +125 -0
- package/skills/implement-spec/tests/test_state.py +8 -3
- package/skills/implement-spec/tests/test_stops.py +43 -61
- package/skills/implement-spec/tests/test_tidy.py +77 -98
- package/skills/implement-spec/tests/test_walk.py +7 -6
- package/skills/review-page/SKILL.md +1 -1
- package/skills/test-prune/SKILL.md +10 -4
- package/skills/test-prune/prune.py +5 -4
- package/skills/test-prune/prune_repo.py +5 -0
- package/skills/test-prune/prune_strengthen.py +36 -5
- package/skills/test-prune/tests/test_prune_strengthen.py +144 -0
- package/skills/to-tickets/SKILL.md +1 -1
- package/skills-manifest.json +9 -9
- package/skills/implement-spec/prompts/corrected.md +0 -3
- package/skills/implement-spec/prompts/correctness.md +0 -42
- package/skills/implement-spec/prompts/final-scoped.md +0 -1
- package/skills/implement-spec/prompts/full-review.md +0 -2
- package/skills/implement-spec/prompts/overruled.md +0 -7
- package/skills/implement-spec/prompts/rejected.md +0 -1
- package/skills/implement-spec/prompts/restored-red.md +0 -3
- package/skills/implement-spec/prompts/restored.md +0 -3
- package/skills/implement-spec/prompts/stands.md +0 -2
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
# Final reviewer
|
|
1
|
+
# Final reviewer: the scoped review
|
|
2
2
|
|
|
3
3
|
Spec: {spec}
|
|
4
4
|
Tickets: {tickets}
|
|
5
5
|
PR branch: {pr_branch}, at commit {start_sha}
|
|
6
6
|
Range: {range}
|
|
7
7
|
Gate record of the driver for {start_sha}: {gate}
|
|
8
|
-
|
|
8
|
+
Findings of the full review: {findings}
|
|
9
9
|
Ledger of the run, one sentence per event: {ledger}
|
|
10
|
-
Deferred observations and minor findings from ticket reviews, each with its evidence file:
|
|
11
|
-
{carried}
|
|
12
10
|
Must-fix findings carried from tickets that merged at the cap:
|
|
13
11
|
{must_fix_list}
|
|
14
12
|
Rulings of the operator:
|
|
15
13
|
{rulings}
|
|
16
14
|
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
This is the scoped review after the fix batch: the range holds only the `fix(NN)` commits, and the commits up to {reviewed} have their review. Check that each critical or important finding in {findings} is fixed, and that the fix commits break nothing else.
|
|
16
|
+
The gate is done: the driver ran the full gate on {start_sha}, and its record is the gate evidence of your review. Do not run a gate yourself.
|
|
17
|
+
Verify each must-fix finding: list each one you verified closed in `resolved_must_fix` exactly as the must-fix list shows it, including its file and line, and report each unresolved one in `findings`. A ruling does not settle a must-fix finding.
|
|
18
|
+
Report each critical or important finding that is not fixed, and each defect a fix commit makes, in `findings`.
|
|
19
19
|
Give each finding a severity (critical, important or minor), the file and line, a title, the evidence, and a kind: `code`, `test`, or `fixture`.
|
|
20
20
|
Do not commit. Leave the branch and the tree as you found them.
|
|
21
21
|
|
|
22
|
-
Write one JSON report at {report}
|
|
22
|
+
Write one JSON report at {report}. When your sandbox is read-only, give the JSON as your whole final message and the driver saves it there. The report matches this schema:
|
|
23
23
|
|
|
24
24
|
```json
|
|
25
25
|
{
|
|
@@ -8,8 +8,8 @@ Locked files: {locked}
|
|
|
8
8
|
Findings of the review: {findings}
|
|
9
9
|
|
|
10
10
|
Fix each finding of severity critical or important in the findings file. Leave the minor findings: the final review gets them. Leave each finding of kind `fixture` and each finding of kind `test` on a locked file: the test-writer corrects those.
|
|
11
|
-
Never edit a locked file
|
|
12
|
-
If a locked test contradicts the spec or the ticket, so that no fix can make it green,
|
|
11
|
+
Never edit a locked file, of this ticket or of another: the driver rejects a report whose commits change one.
|
|
12
|
+
If a locked test contradicts the spec or the ticket, so that no fix can make it green, commit your work, then report BLOCKED with one concern per such test: `locked test contradicts spec: <locked file>::<test>: <evidence>`. The reviewer rules on it, and you run again: on the corrected test, or with the ruling, to make the test green.
|
|
13
13
|
Use targeted tests while you work.
|
|
14
14
|
Before you report DONE or DONE_WITH_CONCERNS, make the fast gate green on your final commit: run `{gate}` with IMPLEMENT_SPEC_BASE={pr_branch} and IMPLEMENT_SPEC_LOCKED='{locked}' (the locked files above) in the environment, then fix, commit, and run it again until it passes. The driver runs the fast gate again on that commit, and a re-review reads the lines you changed.
|
|
15
15
|
A finding from the `gate` is a red gate: its file is the gate record. Read the output there and make the gate green.
|
|
@@ -7,7 +7,7 @@ Start commit, which holds the locked tests when the ticket has them: {start_sha}
|
|
|
7
7
|
Locked files: {locked}
|
|
8
8
|
|
|
9
9
|
Make the locked tests green and meet each criterion of the ticket. For internal code, work in vertical test-first slices: one failing test, the smallest code that passes it, then the next slice.
|
|
10
|
-
Never edit a locked file. If a locked test contradicts the spec or the ticket,
|
|
10
|
+
Never edit a locked file, of this ticket or of another: the driver rejects a report whose commits change one. If a locked test contradicts the spec or the ticket, commit your work, then report BLOCKED with one concern per such test: `locked test contradicts spec: <locked file>::<test>: <evidence>`. The reviewer rules on it, and you run again: on the corrected test, or with the ruling, to make the test green.
|
|
11
11
|
Commit your work on the checked-out ticket branch. Do not dispatch subagents. In `commits`, list only the commits you made: the start commit and each commit before it are not yours.
|
|
12
12
|
Use targeted tests while you work.
|
|
13
13
|
Before you report DONE or DONE_WITH_CONCERNS, make the fast gate green on your final commit: run `{gate}` with IMPLEMENT_SPEC_BASE={pr_branch} and IMPLEMENT_SPEC_LOCKED='{locked}' (the locked files above) in the environment, then fix, commit, and run it again until it passes. The driver runs the fast gate again on that commit.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
To run a targeted check off this worktree, make a copy with `git worktree add --detach <temp dir> {start_sha}`, run the check there, and remove the copy with `git worktree remove --force <temp dir>` before you report.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
Review the range with the checks below: can it lose money, corrupt data, or let the wrong person act? The output section of the checks does not apply here: your findings go into the report.
|
|
2
|
+
|
|
3
|
+
<checks>
|
|
4
|
+
{text}
|
|
5
|
+
</checks>
|
|
6
|
+
|
|
7
|
+
Read file content from git at {start_sha} (`git diff {range}`, `git show {start_sha}:<path>`), never from the working tree, and run no tests: other agents work in this worktree while you do. The one exception is the input of the driver, which git can lack because `.agent/` is ignored: read the spec, the tickets, the ledger and the evidence files from the working tree.
|
|
8
|
+
Report only a defect that you can show with a concrete sequence of events.
|
|
@@ -11,6 +11,7 @@ Resolve each conflict so that the behavior of both sides holds: the spec and the
|
|
|
11
11
|
Run the targeted tests of the files you resolved. The driver runs the gate on the rebased tip.
|
|
12
12
|
Stage the files you resolved, then go on with `git rebase --continue`. Do not abort the rebase and do not dispatch subagents.
|
|
13
13
|
You resolve one stop only. When the rebase stops again at a later commit, leave that stop as it is and write your report.
|
|
14
|
+
When the driver rejected an earlier attempt after the rebase went on, the rebase is done: fix what it names in the commit at HEAD with `git commit --amend`, and do not start the rebase again.
|
|
14
15
|
In `commits`, give `git rev-parse HEAD` as it is when you are done. In `files`, give each file you resolved.
|
|
15
16
|
|
|
16
17
|
Write one JSON report at {report} that matches this schema:
|
|
@@ -1,3 +1,2 @@
|
|
|
1
1
|
|
|
2
2
|
This is the re-review after fix round {round}. The fix is {from_sha}..{start_sha}: check only whether your own critical or important findings in {findings} are closed. Repeat an open finding in `findings`. Put a new regression introduced by this fix in `regressions`, with evidence tying it to the fix. Set its `basis` to `criterion` when a ticket criterion fails or `regression` when merged-ticket behavior fails. Put every other newly noticed issue in `observations`.
|
|
3
|
-
Repeat the mutation proof for these production lines only, numbered as they are at {start_sha} (an empty list means that no proof is due): {proofs}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
The
|
|
2
|
+
The earlier attempt did not finish the role: {error}
|
|
@@ -8,10 +8,8 @@ Locked files: {locked}
|
|
|
8
8
|
Test-writer report, when the ticket has a test-writer: {writer_report}
|
|
9
9
|
|
|
10
10
|
Check the diff against the ticket and the spec. Put only an unmet ticket criterion or a regression of a merged ticket's behavior in `findings`; set `basis` to `criterion` or `regression` accordingly; put every other observation in `observations` for final review. A red gate is a finding made by the driver. Check that each criterion has a locked test. Test each suspicion that the ticket names in its Suspicions line.
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
In `mutations`, give for each proof the test as `<locked file>::<test name>`, the production file and line, and one failure line copied exactly from the output you printed.
|
|
14
|
-
Give each finding and observation a severity (critical, important or minor), the file and line, a title, the evidence, and a kind: `fixture` when a locked test encodes a stale path, format or setup detail; `test` when a test is weak or missing, as a locked test that stays green when you break the line it protects; `code` for anything else. The test-writer corrects each `fixture` finding and each critical or important `test` finding on a locked file, and the fixer gets the rest.
|
|
11
|
+
{risk}
|
|
12
|
+
Give each finding and observation a severity (critical, important or minor), the file and line, a title, the evidence, and a kind: `fixture` when a locked test encodes a stale path, format or setup detail; `test` when a test is weak or missing; `code` for anything else. The test-writer corrects each `fixture` finding and each critical or important `test` finding on a locked file, and the fixer gets the rest.
|
|
15
13
|
Do not commit and do not dispatch subagents. Leave the tree as you found it.
|
|
16
14
|
|
|
17
15
|
Write one JSON report at {report}. When your sandbox is read-only, give the JSON as your whole final message and the driver saves it there. The report matches this schema:
|
|
@@ -26,8 +24,7 @@ Write one JSON report at {report}. When your sandbox is read-only, give the JSON
|
|
|
26
24
|
"concerns": {"type": "array", "items": {"type": "string"}},
|
|
27
25
|
"findings": {"type": "array", "items": {"type": "object", "required": ["severity", "file", "line", "title", "evidence", "kind"], "properties": {"severity": {"enum": ["critical", "important", "minor"]}, "file": {"type": "string"}, "line": {"type": "integer"}, "title": {"type": "string", "minLength": 1}, "evidence": {"type": "string", "minLength": 1}, "kind": {"enum": ["code", "fixture", "test"]}, "basis": {"enum": ["criterion", "regression"]}}}},
|
|
28
26
|
"observations": {"type": "array", "items": {"type": "object", "required": ["severity", "file", "line", "title", "evidence", "kind"], "properties": {"severity": {"enum": ["critical", "important", "minor"]}, "file": {"type": "string"}, "line": {"type": "integer"}, "title": {"type": "string", "minLength": 1}, "evidence": {"type": "string", "minLength": 1}, "kind": {"enum": ["code", "fixture", "test"]}}}},
|
|
29
|
-
"regressions": {"description": "After a fix: new regressions introduced by that fix. Set basis to criterion when a ticket criterion fails, or regression when merged-ticket behavior fails.", "type": "array", "items": {"type": "object", "required": ["severity", "file", "line", "title", "evidence", "kind"], "properties": {"severity": {"enum": ["critical", "important", "minor"]}, "file": {"type": "string"}, "line": {"type": "integer"}, "title": {"type": "string", "minLength": 1}, "evidence": {"type": "string", "minLength": 1}, "kind": {"enum": ["code", "fixture", "test"]}, "basis": {"enum": ["criterion", "regression"]}}}}
|
|
30
|
-
"mutations": {"description": "Required in a full review: one proof or more for each locked test file that the end of this prompt names (a locked fixture holds no test and needs none), with `test` as `<locked file>::<test name>`. A review scoped to a fix gives the proofs that it names.", "type": "array", "items": {"type": "object", "required": ["test", "file", "line", "red"], "properties": {"test": {"type": "string", "minLength": 1}, "file": {"type": "string", "minLength": 1}, "line": {"type": "integer"}, "red": {"type": "string", "minLength": 1}}}}
|
|
27
|
+
"regressions": {"description": "After a fix: new regressions introduced by that fix. Set basis to criterion when a ticket criterion fails, or regression when merged-ticket behavior fails.", "type": "array", "items": {"type": "object", "required": ["severity", "file", "line", "title", "evidence", "kind"], "properties": {"severity": {"enum": ["critical", "important", "minor"]}, "file": {"type": "string"}, "line": {"type": "integer"}, "title": {"type": "string", "minLength": 1}, "evidence": {"type": "string", "minLength": 1}, "kind": {"enum": ["code", "fixture", "test"]}, "basis": {"enum": ["criterion", "regression"]}}}}
|
|
31
28
|
}
|
|
32
29
|
}
|
|
33
30
|
```
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
|
|
2
|
+
The reviewer ruled on locked tests of this ticket that an earlier attempt disputed:
|
|
3
|
+
{rulings}A test ruled `test-wrong` was corrected by the test-writer, and a test ruled `code-wrong` stands. Each locked test stands as the branch has it now: make it green. A second dispute on one of these test files goes to the operator as a question of the spec.
|
|
@@ -7,12 +7,12 @@ Branch: {branch}, at commit {start_sha}
|
|
|
7
7
|
|
|
8
8
|
Read the spec, the ticket, CONTEXT.md and the ADRs when they exist, and the public interface of the Seam. Do not read an implementation plan or implementation code.
|
|
9
9
|
Write one black-box acceptance test for each criterion of the ticket, through the Seam only. Define the interface when it does not exist.
|
|
10
|
-
Each fixture sets up exactly the precondition of its scenario. Check it against the rules of the spec and against the locked tests of
|
|
10
|
+
Each fixture sets up exactly the precondition of its scenario. Check it against the rules of the spec and against the locked tests of other tickets: {protected}.
|
|
11
11
|
Run each test and confirm that it fails because the behavior is missing, not because of an import error or a syntax error. Print that failing output.
|
|
12
|
-
A test that is green before any implementation is not a proof. Rewrite it until it fails
|
|
12
|
+
A test that is green before any implementation is not a proof. Rewrite it until it fails.
|
|
13
13
|
Commit the tests red on the checked-out branch. Do not write implementation code and do not dispatch subagents.
|
|
14
|
-
When the ticket must change a locked file of
|
|
15
|
-
In `locked`, list each test file of your commit and each locked file of
|
|
14
|
+
When the ticket must change a locked file of another ticket, merged or not, as one that its Touches line names, change it in your commit: a later agent may not.
|
|
15
|
+
In `locked`, list each test file of your commit and each locked file of another ticket that it changes: file paths only, not test node ids (`tests/x.py`, not `tests/x.py::test_a`). In `red`, give for each test one failure line, copied exactly from the output you printed.
|
|
16
16
|
|
|
17
17
|
Write one JSON report at {report} that matches this schema:
|
|
18
18
|
|
|
@@ -26,7 +26,6 @@ Write one JSON report at {report} that matches this schema:
|
|
|
26
26
|
"files": {"type": "array", "items": {"type": "string"}},
|
|
27
27
|
"concerns": {"type": "array", "items": {"type": "string"}},
|
|
28
28
|
"locked": {"type": "array", "items": {"type": "string"}},
|
|
29
|
-
"fixtures": {"description": "Each file of `locked` that holds no test, as a fake, a fixture or a helper: a review needs no mutation proof for it.", "type": "array", "items": {"type": "string"}},
|
|
30
29
|
"red": {"type": "array", "items": {"type": "object", "required": ["test", "line"], "properties": {"test": {"type": "string", "minLength": 1}, "line": {"type": "string", "minLength": 1}}}},
|
|
31
30
|
"not_addressed": {"type": "array", "items": {"type": "object", "required": ["finding", "reason"], "properties": {"finding": {"type": "string", "minLength": 1}, "reason": {"type": "string", "minLength": 1}}}}
|
|
32
31
|
},
|
|
@@ -41,11 +41,9 @@ with calls.open("a") as f:
|
|
|
41
41
|
f.write(json.dumps(rec) + "\\n")
|
|
42
42
|
plan = json.loads((here / "plan.json").read_text()).get(role, [])
|
|
43
43
|
step = plan[n] if n < len(plan) else {{}}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
step = dict(step, stdout="".join(r + "\\n" for r in reds), report=dict(
|
|
48
|
-
status="DONE", commits=[], files=[], concerns=[], findings=[], mutations=proofs))
|
|
44
|
+
# A role the test does not script reports no findings.
|
|
45
|
+
if role in ("reviewer", "final-reviewer", "final-spec", "final-correctness", "final-structure") and "report" not in step:
|
|
46
|
+
step = dict(step, report=dict(status="DONE", commits=[], files=[], concerns=[], findings=[]))
|
|
49
47
|
for cmd in step.get("git", []):
|
|
50
48
|
git(*cmd)
|
|
51
49
|
for path, text in step.get("files", {{}}).items():
|
|
@@ -147,6 +145,11 @@ def blocked(proc):
|
|
|
147
145
|
assert proc.returncode == 1, proc.stdout + proc.stderr
|
|
148
146
|
|
|
149
147
|
|
|
148
|
+
def asks(proc):
|
|
149
|
+
"""A rejected report and a rejected rerun: the ticket blocks with a `ticket-blocked` question."""
|
|
150
|
+
assert proc.returncode == 2 and "01-ticket-blocked-1" in proc.stdout, proc.stdout + proc.stderr
|
|
151
|
+
|
|
152
|
+
|
|
150
153
|
def tw(n=0, stdout=RED + "\n", **changes):
|
|
151
154
|
step = {"files": {"tests/test_export.py": f"def test_rows():\n assert {n} == 'rows'\n"},
|
|
152
155
|
"stdout": stdout, "commit": "test: red",
|
|
@@ -190,8 +193,7 @@ def test_help_lists_the_timeout_flag_and_default_minutes():
|
|
|
190
193
|
|
|
191
194
|
@pytest.mark.parametrize("entry", ["openai/gpt-sol@medium"])
|
|
192
195
|
def test_openai_implementer_launches_codex_exec_in_workspace_write(env, entry):
|
|
193
|
-
|
|
194
|
-
w = World(env, refactor=True, implementer=[entry], correctness=["claude-opus-5@medium"])
|
|
196
|
+
w = World(env, refactor=True, implementer=[entry, entry]) # the rerun after no report is on the next entry
|
|
195
197
|
w.run(runner=False)
|
|
196
198
|
argv = launches(w.tmp, "codex")[0]
|
|
197
199
|
assert argv[0] == "exec" and "--ephemeral" not in argv
|
|
@@ -201,10 +203,9 @@ def test_openai_implementer_launches_codex_exec_in_workspace_write(env, entry):
|
|
|
201
203
|
assert not launches(w.tmp, "claude")
|
|
202
204
|
|
|
203
205
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
w
|
|
207
|
-
w.run(None, "--only", role, runner=False)
|
|
206
|
+
def test_the_reviewer_launches_codex_exec_read_only(env):
|
|
207
|
+
w = World(env, refactor=True, reviewer=["openai/gpt-sol@medium"])
|
|
208
|
+
w.run(None, "--only", "reviewer", runner=False)
|
|
208
209
|
argv = launches(w.tmp, "codex")[0]
|
|
209
210
|
assert argv[0] == "exec" and "--ephemeral" not in argv
|
|
210
211
|
assert value_after(argv, "--sandbox", "-s") == "read-only"
|
|
@@ -214,7 +215,7 @@ def test_reviewing_roles_launch_codex_exec_read_only(env, role):
|
|
|
214
215
|
@pytest.mark.parametrize("writes", ["file", "message"])
|
|
215
216
|
def test_a_read_only_codex_report_is_the_file_it_wrote_else_its_last_message(env, writes):
|
|
216
217
|
# A read-only sandbox can still let the agent write its report; codex then writes the last message to the -o file.
|
|
217
|
-
w = World(env, refactor=True,
|
|
218
|
+
w = World(env, refactor=True, reviewer=["openai/gpt-sol@medium"])
|
|
218
219
|
report = {"status": "DONE", "commits": [], "files": [], "concerns": [], "findings": []}
|
|
219
220
|
(w.tmp / "bin/codex").write_text(f"""#!{sys.executable}
|
|
220
221
|
import re, sys
|
|
@@ -229,14 +230,14 @@ elif {writes!r} == "file":
|
|
|
229
230
|
else:
|
|
230
231
|
last.write_text({json.dumps(report)!r})
|
|
231
232
|
""")
|
|
232
|
-
ok(w.run(None, "--only", "
|
|
233
|
-
assert json.loads((w.repo / ".agent/implement/01/
|
|
234
|
-
assert "
|
|
233
|
+
ok(w.run(None, "--only", "reviewer", runner=False))
|
|
234
|
+
assert json.loads((w.repo / ".agent/implement/01/reviewer-0.json").read_text()) == report
|
|
235
|
+
assert "reviewer ran on openai/gpt-sol@medium" in w.ledger() and "report accepted" in w.ledger()
|
|
235
236
|
|
|
236
237
|
|
|
237
238
|
@pytest.mark.parametrize("entry", ["claude-opus-5@medium", "anthropic/claude-opus-5@medium"])
|
|
238
239
|
def test_claude_entry_launches_claude_p_and_bare_means_anthropic(env, entry):
|
|
239
|
-
w = World(env, refactor=True, implementer=[entry])
|
|
240
|
+
w = World(env, refactor=True, implementer=[entry, entry]) # the rerun after no report is on the next entry
|
|
240
241
|
w.run(runner=False)
|
|
241
242
|
argv = launches(w.tmp, "claude")[0]
|
|
242
243
|
assert ("-p" in argv or "--print" in argv)
|
|
@@ -278,7 +279,7 @@ def test_implementer_prompt_carries_pointers_and_only_template_sentences(env):
|
|
|
278
279
|
|
|
279
280
|
@pytest.mark.parametrize("role, extra, refactor", [
|
|
280
281
|
("test-writer", (), False), ("implementer", (), True),
|
|
281
|
-
("reviewer", ("--only", "reviewer"), True)
|
|
282
|
+
("reviewer", ("--only", "reviewer"), True)])
|
|
282
283
|
def test_every_prompt_ends_with_report_path_schema_and_the_never_rule(env, role, extra, refactor):
|
|
283
284
|
w = World(env, refactor=refactor)
|
|
284
285
|
w.run(None, *extra)
|
|
@@ -302,7 +303,7 @@ def test_each_role_that_runs_commands_stops_only_its_own_processes(role):
|
|
|
302
303
|
|
|
303
304
|
def test_no_report_is_a_violation_with_one_rerun_then_blocked(env):
|
|
304
305
|
w = World(env, refactor=True)
|
|
305
|
-
|
|
306
|
+
asks(w.run({"implementer": [{}, {}, impl()]}))
|
|
306
307
|
first, second = w.calls("implementer")
|
|
307
308
|
assert first["prompt"].strip() in second["prompt"] and len(second["prompt"]) > len(first["prompt"])
|
|
308
309
|
assert "report" in second["prompt"][len(first["prompt"].rstrip()):].lower()
|
|
@@ -325,7 +326,7 @@ def test_a_cli_that_fails_with_no_report_stops_the_run_with_exit_4_and_the_same_
|
|
|
325
326
|
plan = {"implementer": [{"stderr": REFUSED + "\n", "exit": 1}] * 2 + [impl()]}
|
|
326
327
|
proc = w.run(plan)
|
|
327
328
|
assert proc.returncode == 4, proc.stdout + proc.stderr
|
|
328
|
-
assert f"implement-spec: the run stopped: the implementer on
|
|
329
|
+
assert f"implement-spec: the run stopped: the implementer on openai/gpt-sol@medium exited 1 with no " \
|
|
329
330
|
f"report: {REFUSED}" in proc.stdout.splitlines(), proc.stdout
|
|
330
331
|
assert "BLOCKED" not in w.ledger() and "Ticket 01: the run stops and the phase stays for the next run: the implementer" in w.ledger()
|
|
331
332
|
assert json.loads((w.repo / ".agent/implement/state.json").read_text())["tickets"]["01"]["phase"] == "implement"
|
|
@@ -344,7 +345,7 @@ def test_finished_status_reruns_the_implementer_once_with_the_error_appended(env
|
|
|
344
345
|
def test_second_schema_violation_blocks_the_ticket_with_the_error_in_the_ledger(env):
|
|
345
346
|
w = World(env)
|
|
346
347
|
bad = lambda n: with_report(impl(n), status="FINISHED")
|
|
347
|
-
|
|
348
|
+
asks(w.run({"test-writer": [tw()], "implementer": [bad(0), bad(1), impl(2)]}))
|
|
348
349
|
assert len(w.calls("implementer")) == 2
|
|
349
350
|
assert any("01" in l and "BLOCKED" in l and "FINISHED" in l for l in w.ledger().splitlines()), w.ledger()
|
|
350
351
|
|
|
@@ -362,7 +363,7 @@ def test_red_line_missing_from_the_log_reruns_once_then_blocks(env, second_match
|
|
|
362
363
|
ok(proc)
|
|
363
364
|
assert len(w.calls("implementer")) == 1
|
|
364
365
|
else:
|
|
365
|
-
|
|
366
|
+
asks(proc)
|
|
366
367
|
assert len(w.calls("test-writer")) == 2 and not w.calls("implementer")
|
|
367
368
|
assert any("01" in l and "BLOCKED" in l for l in w.ledger().splitlines()), w.ledger()
|
|
368
369
|
|
|
@@ -382,7 +383,7 @@ def test_implementer_report_with_no_new_commit_is_a_violation(env):
|
|
|
382
383
|
w = World(env)
|
|
383
384
|
nothing = with_report(impl(), commits=[])
|
|
384
385
|
nothing.pop("commit"), nothing.pop("files")
|
|
385
|
-
|
|
386
|
+
asks(w.run({"test-writer": [tw()], "implementer": [nothing, nothing]}))
|
|
386
387
|
assert len(w.calls("implementer")) == 2
|
|
387
388
|
assert any("01" in l and "BLOCKED" in l and "commit" in l for l in w.ledger().splitlines()), w.ledger()
|
|
388
389
|
|
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
"""Ticket 08 acceptance tests: a run with no `origin` gets its final review
|
|
1
|
+
"""Ticket 08 acceptance tests: a run with no `origin` gets its final review.
|
|
2
2
|
|
|
3
3
|
All through `sh run.sh --runner <script> [--push] [--unattended]` on the fixture repository: the rig of test_final
|
|
4
|
-
with and without its bare `origin
|
|
4
|
+
with and without its bare `origin`.
|
|
5
5
|
|
|
6
6
|
Interface choices (ticket 08):
|
|
7
7
|
- with no `origin`, the tidied commits sit on the commit the PR branch had when the run started (nothing to rebase
|
|
8
8
|
onto), and `refs/implement-spec/feat%2Fcsv/recovery` holds the PR tip from before the tidy, as with an `origin`.
|
|
9
9
|
- the one ledger sentence about the missing remote names `origin` and says that the rebase and the push were skipped.
|
|
10
|
-
- a refused start (exit 3) prints its reason on stdout or stderr: `origin` for a push that has no remote
|
|
11
|
-
correctness role one line that names `correctness` and `codex`, or `correctness` and each entry of its list.
|
|
10
|
+
- a refused start (exit 3) prints its reason on stdout or stderr: `origin` for a push that has no remote.
|
|
12
11
|
"""
|
|
13
12
|
import pytest
|
|
14
13
|
|
|
15
14
|
from test_cli import git, ticket
|
|
16
15
|
from test_final import Final, ref, stop_lines
|
|
17
|
-
from test_review import
|
|
16
|
+
from test_review import ONE
|
|
18
17
|
from test_stops import UNATTENDED
|
|
19
18
|
from test_walk import plan
|
|
20
19
|
|
|
@@ -43,7 +42,7 @@ def test_with_no_origin_the_branch_is_tidied_gated_and_reviewed_with_no_rebase_a
|
|
|
43
42
|
records = sorted(p.name for p in (rig.repo / ".agent/implement/final").glob("gate-*.log"))
|
|
44
43
|
assert records == [f"gate-full-{tip[:7]}.log"], records
|
|
45
44
|
(gate,) = [g for g in rig.gates() if g["commit"] == tip]
|
|
46
|
-
(call,) = rig.final_calls("final-
|
|
45
|
+
(call,) = rig.final_calls("final-spec")
|
|
47
46
|
assert call["head"] == tip and gate["t0"] < call["t0"], "the final review reads the gated, tidied tip"
|
|
48
47
|
assert not rig.final_calls("conflict") and not rig.prs() and git(rig.repo, "remote") == "", "nothing is pushed"
|
|
49
48
|
branch_tip, reviewed, _ = stop_lines(rig.out)
|
|
@@ -73,45 +72,4 @@ def test_with_an_origin_the_end_of_run_still_rebases_onto_the_fetched_base_and_p
|
|
|
73
72
|
assert rig.code == 0, rig.output()
|
|
74
73
|
git(rig.repo, "merge-base", "--is-ancestor", ref(rig.origin, "refs/heads/main"), "feat/csv")
|
|
75
74
|
assert rig.pushes() == [f"refs/heads/feat/csv {rig.branch()}"] and len(rig.prs()) == 1
|
|
76
|
-
assert len(rig.final_calls("final-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
# ---------------------------------------------------------------- the correctness CLI
|
|
80
|
-
|
|
81
|
-
@pytest.mark.parametrize("files", [RISKY, ONE], ids=["risk-line", "no-risk-line"])
|
|
82
|
-
def test_a_correctness_entry_whose_cli_is_not_on_path_stops_the_run_before_any_agent(tmp_path, files):
|
|
83
|
-
rig = Review(tmp_path, files, {"correctness": [SOL, OPUS], "implementer": [OPUS]})
|
|
84
|
-
(tmp_path / "bin/codex").unlink()
|
|
85
|
-
rig.run(plan())
|
|
86
|
-
assert rig.code == 3, rig.output()
|
|
87
|
-
assert [l for l in (rig.out + rig.err).splitlines() if "correctness" in l and "codex" in l], rig.output()
|
|
88
|
-
assert not rig.calls() and not rig.gates()
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
def test_a_correctness_list_all_on_the_implementers_provider_stops_the_run_before_any_agent(tmp_path):
|
|
92
|
-
rig = Review(tmp_path, RISKY, {"correctness": [OPUS, FABLE], "implementer": [OPUS]})
|
|
93
|
-
rig.run(plan())
|
|
94
|
-
assert rig.code == 3, rig.output()
|
|
95
|
-
assert [l for l in (rig.out + rig.err).splitlines() if "correctness" in l and OPUS in l and FABLE in l], rig.output()
|
|
96
|
-
assert not rig.calls() and not rig.gates()
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
@pytest.mark.parametrize("entries, codex", [([SOL, OPUS], False), ([OPUS], True)], ids=["no-codex", "one-provider"])
|
|
100
|
-
def test_no_run_folds_the_correctness_pass_into_the_reviewer(tmp_path, entries, codex):
|
|
101
|
-
rig = Review(tmp_path, RISKY, {"correctness": entries, "implementer": [OPUS]})
|
|
102
|
-
if not codex:
|
|
103
|
-
(tmp_path / "bin/codex").unlink()
|
|
104
|
-
rig.run(plan())
|
|
105
|
-
assert not [c for c in rig.calls(role="reviewer") if "correctness.md" in c["prompt"]], "a reviewer got the pass"
|
|
106
|
-
assert not rig.led("folded"), rig.ledger()
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
def test_a_risky_ticket_still_gets_reviewer_and_correctness_together_on_the_entry_of_another_provider(tmp_path):
|
|
110
|
-
rig = Review(tmp_path, RISKY, {"correctness": [OPUS, SOL], "implementer": [OPUS]})
|
|
111
|
-
rig.run(plan(**{"02/reviewer": [review("02", touch=["r"], wait=["c"])],
|
|
112
|
-
"02/correctness": [correct(touch=["c"], wait=["r"])]}))
|
|
113
|
-
assert rig.code == 0, rig.output()
|
|
114
|
-
(r,), (c,) = rig.calls("02", "reviewer"), rig.calls("02", "correctness")
|
|
115
|
-
assert r["t0"] < c["t1"] and c["t0"] < r["t1"], "each started before the other ended"
|
|
116
|
-
assert rig.led("correctness", "gpt-sol@medium") and not rig.led("correctness", OPUS)
|
|
117
|
-
assert "correctness.md" not in r["prompt"] and not rig.led("folded")
|
|
75
|
+
assert len(rig.final_calls("final-spec")) == 1 and not [l for l in rig.ledger() if "skipped" in l.lower()]
|