@jesdi/skills 0.0.58 → 0.0.59

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jesdi/skills",
3
- "version": "0.0.58",
3
+ "version": "0.0.59",
4
4
  "description": "jesdi's agent skills (content package consumed by @jesdi/skills-cli)",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -146,6 +146,12 @@ and do not know about the run, except `driver_run.py`, which the three deciding
146
146
  - A reviewer or a correctness pass that reports BLOCKED or NEEDS_CONTEXT raises `driver_run.Stopped`, which
147
147
  carries the report. `driver_fixloop._run_reviewers` turns it into a `review-stopped` question, or, after an
148
148
  `accept` ruling on that role (`driver_decisions.accepted`), uses the report as it is.
149
+ - An implementer or a fixer that reports BLOCKED or NEEDS_CONTEXT asks a question in `Run._ask_stop`: `locked-test`
150
+ for a contradicted locked test, else `implementer-stopped` or `fixer-stopped`. The stop of a fixer sets the round
151
+ back by one, so its `retry` (gate and review the tip, then a fixer) runs the same round again.
152
+ - An implementer or a fixer with nothing to change reports DONE with no commit (`driver_report._unchanged_errors`):
153
+ the branch did not move, the tree is clean, and a concern says why. The driver gates and reviews that tip as it
154
+ would a new one.
149
155
  - The correctness prompt carries the checks of `review-diff` (`driver_review.checks`): the pass reads files only
150
156
  from git at the tip and from `.agent/`, and a project-local install sits in an ignored directory.
151
157
 
@@ -57,7 +57,7 @@ Default timeouts in minutes: explorer 30, test-writer 30, implementer 90, review
57
57
  |---|---|
58
58
  | 0 | Done: every ticket is merged and no question is open. Also the end of a valid `--dry-run`. In local mode without `--push`, nothing is pushed. |
59
59
  | 1 | A ticket is BLOCKED, or the end of run is BLOCKED. The other tickets ran as far as they could. |
60
- | 2 | Parked: a question of kind `locked-test`, `locked-test-again`, `review-stopped` or `final-finding` is open. Exit 2 wins over exit 1. |
60
+ | 2 | Parked: a question of kind `locked-test`, `locked-test-again`, `review-stopped`, `implementer-stopped`, `fixer-stopped` or `final-finding` is open. Exit 2 wins over exit 1. |
61
61
  | 3 | Invalid input or a failed precondition: a usage error, a ticket error, a model error, an uncommitted change, a slot that cannot be made, another driver that runs on the same PR branch. No agent starts. The one exception: a review page that cannot be written gives exit 3 at the end of a run, after agents ran. |
62
62
  | 4 | Stopped: the CLI of an agent failed two times and wrote no report (for example, the account cannot use the model). The driver starts no other agent and lets the running agents end. No ticket is BLOCKED by it: fix the CLI or the model entry, then run the same command again to resume. |
63
63
  | 130 | The operator interrupted the run. The driver stops each agent. The work stays in the slots for the next run. |
@@ -111,7 +111,7 @@ Rules for each agent:
111
111
  - A call blocks until the agent ends. The driver does not poll.
112
112
  - An agent stops only the processes it started and their child processes, by PID, and never kills a process it did not start, nor uses `pkill`, `killall` or a `kill` by name or pattern: other slots and sessions share the machine. A process it did not start that blocks it goes into its concerns.
113
113
  - An agent gets one rerun: after a rejected report, after a timeout, or after it left the ticket branch. The rerun prompt is the first prompt plus the reason.
114
- - A report with status `BLOCKED` or `NEEDS_CONTEXT` blocks the ticket. From the reviewer or the correctness pass, it also asks a `review-stopped` question.
114
+ - A report with status `BLOCKED` or `NEEDS_CONTEXT` blocks the ticket. From the reviewer or the correctness pass, it also asks a `review-stopped` question; from the implementer or a fixer, a `locked-test` question when a concern starts with `locked test contradicts spec:`, else an `implementer-stopped` or `fixer-stopped` question. Nothing left to change is no stop: the implementer and the fixer report it as DONE with no commit.
115
115
  - A BLOCKED ticket stops the tickets that it blocks. All other tickets run on.
116
116
 
117
117
  ### Findings and fix rounds
@@ -178,7 +178,7 @@ Every report has `status` (`DONE`, `DONE_WITH_CONCERNS`, `NEEDS_CONTEXT`, `BLOCK
178
178
  | Role | Template | More fields | Checks after the schema |
179
179
  |---|---|---|---|
180
180
  | test-writer | `prompts/test-writer.md` | `locked` (test file paths), `red` (`test`, `line`), optional `fixtures` (each locked file that holds no test, as a fake `gh`) | The driver reads a test node id `<file>::<test>` in `locked` as its file. Each fixture is in `locked`; the ticket record keeps it a fixture until a later correction lists the file again. With DONE: one commit, one locked file and one red line or more. Each locked path is in a commit that the role made. Each `line` is in the log. A locked file of a merged ticket that the role changed is in `locked`. A correction (after `overrule-test`, or for a review finding) changes only the files that it lists in `locked` and the files that the driver restored before it. When the gate is red on the restore commit, a DONE correction lists a restored file in `locked`. Each `not_addressed[].finding` is the title of a finding of the correction; a DONE correction with each of its findings there needs no commit. |
181
- | implementer | `prompts/implementer.md` | `green` | With DONE: one commit or more. |
181
+ | implementer | `prompts/implementer.md` | `green` | With DONE and no commit: no new commit on the branch, no uncommitted change, and a concern that says why the start needs no change. The driver then gates and reviews the start commit. |
182
182
  | reviewer | `prompts/reviewer.md` | `findings` (`severity`, `file`, `line`, `title`, `evidence`, `kind`), `mutations` (`test`, `file`, `line`, `red`); `commits` is empty | In a full review (one with no fix range: round 1, and the review after a test-writer correction): `mutations` is required, with a proof for each locked test file (`test` is `<locked file>::<test name>`). A locked fixture needs no proof: it holds no test that a proof could name, and the locked-file check protects it. Each `red` is in the log. |
183
183
  | correctness | `prompts/correctness.md` | the same as the reviewer; `commits` is empty | `mutations` is optional. |
184
184
  | fixer | `prompts/fixer.md` | `green`, `ticket` | With DONE and no commit: no new commit on the branch, no uncommitted change, a gate that is green on the start, and a concern that names each finding of the round. |
@@ -199,6 +199,8 @@ A question is a bounded choice for the operator. `driver_decisions.py` `KINDS` h
199
199
  | `finding` | `<NN>-finding-<n>` | A finding is open after fix round 4. One question for each finding. | 1 | `accept`: close the finding; the ticket merges when each of its findings is accepted. `split` (recommended) and `redesign`: the ticket stays BLOCKED, with the ruling in the ledger. |
200
200
  | `locked-test-again` | `<NN>-locked-test-again-<n>` | A finding for a test-writer correction is open in the review right after a correction, or the driver rejects the correction's report (for example, it changes a file that it does not list in `locked`). One question for each finding. | 2 | `correct-again` (recommended): the ticket resumes from the review, and that review's findings get one more correction. `accept`: no more correction runs for the ticket, its locked tests stay as they are, and the ticket goes on to its fix rounds with its other findings; a changed locked file is still restored. `redesign`: the ticket stays BLOCKED, with the ruling in the ledger. After two `correct-again` stops on a ticket, its next question offers only `accept` (recommended) and `redesign`, so a test-writer and a reviewer that never agree cannot loop. |
201
201
  | `review-stopped` | `<NN>-review-stopped-<n>` | The reviewer or the correctness pass reports `BLOCKED` or `NEEDS_CONTEXT`. One question for each agent that stopped. | 2 | `retry` (recommended): the ticket resumes from the review, and each agent of the review runs again. `accept`: the same, and for the rest of the ticket a `BLOCKED` or `NEEDS_CONTEXT` report of that agent does not stop it: the review goes on with that report's findings and those of the other reports. `redesign`: the ticket stays BLOCKED, with the ruling in the ledger. |
202
+ | `implementer-stopped` | `<NN>-implementer-stopped-<n>` | The implementer reports `BLOCKED` or `NEEDS_CONTEXT`, and no concern starts with `locked test contradicts spec:`. | 2 | `retry` (recommended): the implementer runs again from the tip it left. `accept-tip`: the driver gates and reviews that tip, and the fix rounds close what the review finds. `redesign`: the ticket stays BLOCKED, with the ruling in the ledger. |
203
+ | `fixer-stopped` | `<NN>-fixer-stopped-<n>` | A fixer reports `BLOCKED` or `NEEDS_CONTEXT`, and no concern starts with `locked test contradicts spec:`. | 2 | `retry` (recommended): the round that stopped does not count; the driver gates and reviews the tip the fixer left, and a fixer runs that round again on the review's findings. `redesign`: the ticket stays BLOCKED, with the ruling in the ledger. |
202
204
  | `final-finding` | `final-finding-<n>` | A finding is open after the second round of the final review. | 2 | `fix` (recommended): the finding stays open and nothing is pushed. `accept`: close the finding. |
203
205
 
204
206
  `n` counts the questions of that ticket and kind in the run, so an id is never used twice.
@@ -91,6 +91,36 @@ KINDS = {
91
91
  "redesign": Option(
92
92
  "Keep the ticket BLOCKED. The design changes before more work on it.",
93
93
  "Ruling: {ticket} stays BLOCKED, the design changes first (redesign): {subject}.", {})}),
94
+ "implementer-stopped": Kind(
95
+ True,
96
+ "Ticket {ticket}: the implementer stopped: {subject}",
97
+ "The implementer of ticket {ticket} reported BLOCKED or NEEDS_CONTEXT, and no concern says that a locked test "
98
+ "contradicts the spec. Ticket {ticket} is BLOCKED and each ticket that it blocks waits.",
99
+ "retry",
100
+ {"retry": Option(
101
+ "The implementer runs again from the tip it left.",
102
+ "Ruling: {ticket} implementer runs again (retry): {subject}.", {"phase": "implement"}),
103
+ "accept-tip": Option(
104
+ "The implementer does not run again: the driver gates and reviews the tip it left, and the fix rounds "
105
+ "close what the review finds.",
106
+ "Ruling: {ticket} tip goes to the gate and the review as it is (accept-tip): {subject}.",
107
+ {"phase": "gate"}),
108
+ "redesign": Option(
109
+ "Keep the ticket BLOCKED. The design changes before more work on it.",
110
+ "Ruling: {ticket} stays BLOCKED, the design changes first (redesign): {subject}.", {})}),
111
+ "fixer-stopped": Kind(
112
+ True,
113
+ "Ticket {ticket}: the fixer stopped: {subject}",
114
+ "The fixer of ticket {ticket} reported BLOCKED or NEEDS_CONTEXT, and no concern says that a locked test "
115
+ "contradicts the spec. Ticket {ticket} is BLOCKED and each ticket that it blocks waits.",
116
+ "retry",
117
+ {"retry": Option(
118
+ "The round that stopped does not count: the driver gates and reviews the tip the fixer left, and a fixer "
119
+ "runs that round again on what the review finds.",
120
+ "Ruling: {ticket} fix round runs again (retry): {subject}.", {"phase": "review"}),
121
+ "redesign": Option(
122
+ "Keep the ticket BLOCKED. The design changes before more work on it.",
123
+ "Ruling: {ticket} stays BLOCKED, the design changes first (redesign): {subject}.", {})}),
94
124
  # A final-review question belongs to no ticket: its `ticket` is "".
95
125
  "final-finding": Kind(
96
126
  True,
@@ -69,14 +69,20 @@ def _commit_errors(report: dict, context: dict) -> list[str]:
69
69
  return errors
70
70
 
71
71
 
72
- def _unchanged_errors(report: dict, context: dict) -> list[str]:
73
- """A DONE fixer with no commit (issue #123): the branch did not move, no change is left uncommitted, the gate of
74
- the start is green, and a concern names each finding, with why it needs no change."""
75
- if "fix" not in context or report["commits"] or report["status"] not in ("DONE", "DONE_WITH_CONCERNS"):
72
+ def _unchanged_errors(role: str, report: dict, context: dict) -> list[str]:
73
+ """A DONE implementer or fixer with no commit (issue #123): the branch did not move, no change is left
74
+ uncommitted, the gate of the start is green, and a concern says why no change is needed: for a fixer, one
75
+ concern names each finding."""
76
+ done = report["status"] in ("DONE", "DONE_WITH_CONCERNS")
77
+ if role not in ("implementer", "fixer") or report["commits"] or not done:
76
78
  return []
77
- return _moved_errors(context) + [
79
+ titles = context.get("fix", [])
80
+ errors = _moved_errors(context) + [
78
81
  f"no commit, and no concern names the finding {title}: give each finding a concern that says why it needs no "
79
- "change" for title in context["fix"] if not any(title in concern for concern in report["concerns"])]
82
+ "change" for title in titles if not any(title in concern for concern in report["concerns"])]
83
+ if not (titles or report["concerns"]):
84
+ errors.append("no commit, and no concern: say in `concerns` why the start needs no change")
85
+ return errors
80
86
 
81
87
 
82
88
  def _moved_errors(context: dict) -> list[str]:
@@ -164,6 +170,7 @@ def validate(role: str, path: str, context: dict) -> list[str]:
164
170
  report = {name: value for name, value in report.items() if name in rules["properties"]}
165
171
  if "locked" in report:
166
172
  report["locked"] = locked_files(report["locked"])
167
- return (_commit_errors(report, context) + _owner_errors(report, context) + _unchanged_errors(report, context)
168
- + _correction_errors(report, context) + _merged_errors(report, context) + _proof_errors(report, context)
169
- + _locked_errors(report, context) + _fixture_errors(report))
173
+ return (_commit_errors(report, context) + _owner_errors(report, context)
174
+ + _unchanged_errors(role, report, context) + _correction_errors(report, context)
175
+ + _merged_errors(report, context) + _proof_errors(report, context) + _locked_errors(report, context)
176
+ + _fixture_errors(report))
@@ -119,15 +119,28 @@ class Run:
119
119
  report = _attempts(self, role, number, slot, values, **options)
120
120
  if role == "test-writer":
121
121
  report["locked"] = driver_report.locked_files(report["locked"]) # as validate read it
122
- if subject := driver_decisions.contradicted(role, report):
123
- # The implementer's commits stay: after the ruling the ticket goes on from them.
124
- evidence = OUT / number / f"{role}-{options.get('fix_round', 0)}.json"
125
- self.ask(number, "locked-test", [subject], str(evidence), tip=driver_slots.head(slot))
126
122
  if report.get("status") in ("BLOCKED", "NEEDS_CONTEXT"):
127
123
  concerns = "; ".join(report["concerns"]) or "no concern given"
128
- raise Stopped(f"the {role} reported {report['status']}: {concerns}", report)
124
+ why = f"the {role} reported {report['status']}: {concerns}"
125
+ if number != FINAL:
126
+ self._ask_stop(role, number, slot, report, why, options.get("fix_round", 0))
127
+ raise Stopped(why, report)
129
128
  return report
130
129
 
130
+ def _ask_stop(self, role: str, number: str, slot: str, report: dict, why: str, fix_round: int) -> None:
131
+ """The question of a stopped implementer or fixer: `locked-test` when it says a locked test contradicts the
132
+ spec, else `<role>-stopped` (issue #123). Its commits stay: after the ruling the ticket goes on from them."""
133
+ if role not in ("implementer", "fixer"):
134
+ return
135
+ evidence, tip = str(OUT / number / f"{role}-{fix_round}.json"), driver_slots.head(slot)
136
+ if subject := driver_decisions.contradicted(role, report):
137
+ self.ask(number, "locked-test", [subject], evidence, tip=tip)
138
+ elif role == "implementer":
139
+ self.ask(number, "implementer-stopped", [why], evidence, tip=tip)
140
+ else:
141
+ # The round that stopped does not count: `retry` reviews the tip and runs that round again.
142
+ self.ask(number, "fixer-stopped", [why], evidence, tip=tip, round=fix_round - 1)
143
+
131
144
  def read_only(self, number: str, slot: str, branch: str, tip: str, review: Callable[[], T]) -> T:
132
145
  """Run `review` (read-only agents) and return its result. A review that changes the slot runs once more."""
133
146
  for last in (False, True):
@@ -14,7 +14,7 @@ Use targeted tests while you work.
14
14
  Before you report DONE or DONE_WITH_CONCERNS, make the gate green on your final commit: run `{gate}` with IMPLEMENT_SPEC_BASE={pr_branch} in the environment, then fix, commit, and run it again until it passes. The driver runs the 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.
16
16
  Commit your work on the checked-out ticket branch. Do not dispatch subagents.
17
- When a finding needs no change, for example because a correction before you already resolved it, change nothing for it. When no finding needs a change, make no commit: report DONE_WITH_CONCERNS, list no commit in `commits`, and give one concern per finding to fix that starts with its title and says why it needs no change. A re-review checks each reason. This is not for a red gate: a fix of a red gate is a commit.
17
+ When a finding needs no change, for example because a correction before you already resolved it, change nothing for it. When no finding needs a change, make no commit: report DONE_WITH_CONCERNS, list no commit in `commits`, and give one concern per finding to fix that starts with its title and says why it needs no change. A re-review checks each reason. This is not for a red gate: a fix of a red gate is a commit. Report NEEDS_CONTEXT or BLOCKED only for a question that stops your work: the operator answers it.
18
18
  In `ticket`, give the number of the ticket that owns your commits. In `green`, give the summary lines of the passing test output.
19
19
 
20
20
  Write one JSON report at {report} that matches this schema:
@@ -11,6 +11,7 @@ Never edit a locked file. If a locked test contradicts the spec or the ticket, s
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 gate green on your final commit: run `{gate}` with IMPLEMENT_SPEC_BASE={pr_branch} in the environment, then fix, commit, and run it again until it passes. The driver runs the gate again on that commit.
14
+ When the start commit already meets the ticket, for example because a test-writer correction made the locked tests green, make no commit: report DONE_WITH_CONCERNS, list no commit in `commits`, and give a concern that says why the start needs no change. The driver gates and reviews the start commit. Report NEEDS_CONTEXT or BLOCKED only for a question that stops your work: the operator answers it.
14
15
  In `green`, give the summary lines of the passing test output.
15
16
 
16
17
  Write one JSON report at {report} that matches this schema:
@@ -21,13 +22,11 @@ Write one JSON report at {report} that matches this schema:
21
22
  "required": ["status", "commits", "files", "concerns", "green"],
22
23
  "properties": {
23
24
  "status": {"enum": ["DONE", "DONE_WITH_CONCERNS", "NEEDS_CONTEXT", "BLOCKED"]},
24
- "commits": {"type": "array", "items": {"type": "string", "pattern": "^[0-9a-f]{7,40}$"}},
25
+ "commits": {"description": "Only the commits you made, so empty when you changed nothing: never list a commit that was on the branch at your start.", "type": "array", "items": {"type": "string", "pattern": "^[0-9a-f]{7,40}$"}},
25
26
  "files": {"type": "array", "items": {"type": "string"}},
26
27
  "concerns": {"type": "array", "items": {"type": "string"}},
27
28
  "green": {"type": "array", "items": {"type": "string"}}
28
- },
29
- "if": {"properties": {"status": {"enum": ["DONE", "DONE_WITH_CONCERNS"]}}},
30
- "then": {"properties": {"commits": {"minItems": 1}}}
29
+ }
31
30
  }
32
31
  ```
33
32
 
@@ -13,7 +13,7 @@ import driver_review_page
13
13
  from test_cli import git
14
14
  from test_fixloop import Inside, inside # noqa: F401 (the autouse fixture puts the rig's CLIs on PATH)
15
15
  from test_tidy import Inside as Pushing, tools # noqa: F401 (an unattended run pushes: the rig with an origin and a fake gh)
16
- from test_review import ONE, finding, fix, review
16
+ from test_review import ONE, STUCK, finding, fix, review
17
17
  from test_stops import CONTRA, NEW_TEST, Q1, UNATTENDED, blocked, correction, decisions, stage, steps, write_answers
18
18
  from test_walk import impl, plan, tw
19
19
 
@@ -489,3 +489,83 @@ def test_no_open_question_or_no_file_reads_nothing_and_given_writes_only_valid_a
489
489
  assert driver_answers.given([(Q1, "overrule-test")], one) == []
490
490
  assert driver_answers.read(one) == ({Q1: "overrule-test"}, [])
491
491
  assert driver_answers.read(doc()) == ({}, []), "with no open question the file is history"
492
+
493
+
494
+ # ---------------------------------------------------------------- an implementer or a fixer with nothing to change, or that stops
495
+
496
+ IMPLEMENTER_STOPPED, FIXER_STOPPED = "01-implementer-stopped-1", "01-fixer-stopped-1"
497
+ NO_CHANGE = "the correction made the locked tests green: the start needs no change"
498
+
499
+
500
+ def unchanged():
501
+ """An implementer step with no commit: the start commit already meets the ticket."""
502
+ return {"report": {"status": "DONE_WITH_CONCERNS", "commits": [], "files": [], "concerns": [NO_CHANGE],
503
+ "green": ["1 passed"]}}
504
+
505
+
506
+ def stops(role="implementer", status="NEEDS_CONTEXT"):
507
+ report = {"status": status, "commits": [], "files": [], "concerns": ["the ticket names no column order"],
508
+ "green": [], **({"ticket": "01"} if role == "fixer" else {})}
509
+ return {"report": report}
510
+
511
+
512
+ def test_an_implementer_with_nothing_to_change_after_a_correction_is_accepted_and_its_start_is_gated(tmp_path):
513
+ """Issue 123: after `overrule-test` the correction made the locked tests green, so the implementer had nothing to
514
+ change, and no report of it was valid: NEEDS_CONTEXT blocked the ticket with no question."""
515
+ rig = stopped(tmp_path)
516
+ rig.run(steps(blocked(), unchanged()), "--answer", f"{Q1}=overrule-test")
517
+ assert rig.code == 0 and rig.state()["tickets"]["01"]["phase"] == "merged", rig.ledger()
518
+ assert len(rig.calls("01", "implementer")) == 2 and rig.led("implementer ran on", "report accepted")
519
+ corrected = rig.calls("01", "test-writer")[1]["sha"]
520
+ assert corrected in [gate["commit"] for gate in rig.gates()]
521
+ assert rig.calls("01", "reviewer")[0]["head"] == corrected
522
+ assert "list no commit" in rig.prompt("implementer-0")
523
+
524
+
525
+ @pytest.mark.parametrize("status", ["NEEDS_CONTEXT", "BLOCKED"])
526
+ def test_an_implementer_that_stops_asks_the_operator_and_retry_runs_it_again(tmp_path, status):
527
+ """Issue 123: a stop of the implementer that is not `locked test contradicts spec:` had no question."""
528
+ rig = Inside(tmp_path, ONE).run(steps(stops(status=status)))
529
+ assert rig.code == 2 and rig.state()["tickets"]["01"]["phase"] == "blocked", rig.ledger()
530
+ (question,) = rig.state()["run"]["questions"]
531
+ assert (question["id"], question["recommended"]) == (IMPLEMENTER_STOPPED, "retry")
532
+ assert [o["id"] for o in question["options"]] == ["retry", "accept-tip", "redesign"]
533
+ assert question["evidence"][0] == ".agent/implement/01/implementer-0.json"
534
+ assert question["subject"] == f"the implementer reported {status}: the ticket names no column order"
535
+ rig.run(steps(stops(status=status), impl("01")), "--answer", f"{IMPLEMENTER_STOPPED}=retry")
536
+ assert rig.code == 0 and rig.state()["tickets"]["01"]["phase"] == "merged", rig.ledger()
537
+ assert len(rig.calls("01", "implementer")) == 2 and len(rig.calls("01", "test-writer")) == 1
538
+ assert rig.led(f"Ruling: 01 implementer runs again (retry): the implementer reported {status}")
539
+
540
+
541
+ def test_accept_tip_gates_and_reviews_the_tip_the_stopped_implementer_left(tmp_path):
542
+ rig = Inside(tmp_path, ONE).run(steps(stops()))
543
+ assert rig.code == 2, rig.ledger()
544
+ rig.run(steps(stops()), "--answer", f"{IMPLEMENTER_STOPPED}=accept-tip")
545
+ assert rig.code == 0 and rig.state()["tickets"]["01"]["phase"] == "merged", rig.ledger()
546
+ tip = rig.sha("01", "test-writer")
547
+ assert len(rig.calls("01", "implementer")) == 1 and tip in [gate["commit"] for gate in rig.gates()]
548
+ assert rig.calls("01", "reviewer")[0]["head"] == tip
549
+
550
+
551
+ def test_an_implementer_stop_answered_redesign_keeps_the_ticket_blocked(tmp_path):
552
+ rig = Inside(tmp_path, ONE).run(steps(stops()))
553
+ rig.run(steps(stops()), "--answer", f"{IMPLEMENTER_STOPPED}=redesign")
554
+ assert rig.code == 1 and rig.state()["tickets"]["01"]["phase"] == "blocked", rig.ledger()
555
+ assert len(rig.calls("01", "implementer")) == 1
556
+
557
+
558
+ def test_a_fixer_that_stops_asks_the_operator_and_retry_runs_its_round_again(tmp_path):
559
+ """Issue 123: the round that stopped does not count, so the retry is that round again, after a review."""
560
+ steps = plan(**{"01/reviewer": [review("01", [STUCK]), review("01", [STUCK]), review("01")],
561
+ "01/fixer": [stops("fixer"), fix("01", 1)]})
562
+ rig = Inside(tmp_path, ONE).run(steps)
563
+ assert rig.code == 2 and rig.state()["tickets"]["01"]["round"] == 0, rig.ledger()
564
+ (question,) = rig.state()["run"]["questions"]
565
+ assert (question["id"], question["recommended"]) == (FIXER_STOPPED, "retry")
566
+ assert [o["id"] for o in question["options"]] == ["retry", "redesign"]
567
+ assert question["evidence"][0] == ".agent/implement/01/fixer-1.json"
568
+ rig.run(steps, "--answer", f"{FIXER_STOPPED}=retry")
569
+ assert rig.code == 0 and rig.state()["tickets"]["01"]["phase"] == "merged", rig.ledger()
570
+ assert rig.state()["tickets"]["01"]["round"] == 1 and len(rig.calls("01", "fixer")) == 2
571
+ assert rig.led("Ruling: 01 fix round runs again (retry): the fixer reported NEEDS_CONTEXT")
@@ -221,7 +221,7 @@ def test_a_report_that_says_blocked_blocks_the_ticket_without_a_rerun(repo, tmp_
221
221
  repo()
222
222
  body = f"""printf '{{"status": "{status}", "commits": [], "files": [], "concerns": ["test_x contradicts the spec"], "green": []}}' > "$report"\n"""
223
223
  code, ledger = agents(tmp_path, capsys, body)
224
- assert code == 1 and len(ledger) == 2
224
+ assert code == 2 and len(ledger) == 3 and "question of kind implementer-stopped" in ledger[2]
225
225
  assert ledger[1] == f"Ticket 01: BLOCKED at the implementer: the implementer reported {status}: test_x contradicts the spec."
226
226
 
227
227
 
@@ -364,6 +364,7 @@ REFACTOR = {"seam": "none — refactor"}
364
364
  # A fixer that cannot make the red gate green: the ticket blocks at fix round 1.
365
365
  GIVE_UP = """[ $role != fixer ] || { printf '{"status": "BLOCKED", "commits": [], "files": [], "concerns": ["the gate stays red"], "green": [], "ticket": "01"}' > "$report"; exit 0; }\n"""
366
366
  GAVE_UP = "Ticket 01: BLOCKED at fix round 1: the fixer reported BLOCKED: the gate stays red."
367
+ ASKED = "Ticket 01: the operator decides on 1 question of kind fixer-stopped in .agent/implement/decisions.json."
367
368
 
368
369
 
369
370
  def walk(tmp_path, capsys, body, *args, gate="true"):
@@ -462,14 +463,14 @@ def test_a_red_gate_is_a_finding_and_the_ticket_it_blocks_never_starts(repo, tmp
462
463
  two(repo, second="01")
463
464
  code, ledger, out = walk(tmp_path, capsys, GIVE_UP + WORK + REPORT, gate="echo CHECK-OUTPUT; exit 1")
464
465
  tip = out_of("git", "rev-parse", "--short=7", "ticket/feat%2Fx/01")
465
- assert code == 1 and ledger[-1] == GAVE_UP, out
466
+ assert code == 2 and ledger[-2:] == [GAVE_UP, ASKED], out
466
467
  assert ledger[1] == (f"Ticket 01: critical finding of kind code from the gate at "
467
468
  f".agent/implement/01/gate-{tip}.log:0: the gate is red on {tip}.")
468
469
  record = (tmp_path / f".agent/implement/01/gate-{tip}.log").read_text()
469
470
  assert "status: clean\n" in record and "CHECK-OUTPUT\n\nexit: 1\nafter: clean\nend: " in record
470
471
  assert "Ticket 02 is not merged: its phase is pending." in out and "| gates run | 1 |" in out
471
472
  assert out_of("git", "symbolic-ref", "--short", "HEAD") == "feat/x"
472
- assert walk(tmp_path, capsys, "exit 9\n")[0] == 1 # a BLOCKED ticket stays BLOCKED on a rerun
473
+ assert walk(tmp_path, capsys, "exit 9\n")[0] == 2 # a BLOCKED ticket stays BLOCKED on a rerun
473
474
 
474
475
 
475
476
  def test_a_red_merge_gate_blocks_the_ticket_and_the_pr_branch_does_not_move(repo, tmp_path, capsys):
@@ -486,12 +487,12 @@ def test_a_red_merge_gate_blocks_the_ticket_and_the_pr_branch_does_not_move(repo
486
487
  def test_a_tree_that_is_not_clean_is_a_red_gate_and_the_slot_keeps_the_work(repo, tmp_path, capsys):
487
488
  repo(t01=ticket("01", **REFACTOR))
488
489
  code, ledger, out = walk(tmp_path, capsys, GIVE_UP + WORK + REPORT + "echo left > junk.txt\n", gate="echo NEVER")
489
- assert code == 1 and "from the gate at .agent/implement/01/gate-" in ledger[-3] and ledger[-1] == GAVE_UP, out
490
+ assert code == 2 and "from the gate at .agent/implement/01/gate-" in ledger[-4] and ledger[-2:] == [GAVE_UP, ASKED], out
490
491
  record = next((tmp_path / ".agent/implement/01").glob("gate-*.log")).read_text()
491
492
  assert "status: not clean\n ?? junk.txt\n" in record and "exit: not run" in record and "\nNEVER\n" not in record
492
493
  assert out_of("git", "symbolic-ref", "--short", "HEAD") == "ticket/feat%2Fx/01" and (tmp_path / "junk.txt").exists()
493
494
  code, _, out = walk(tmp_path, capsys, "exit 9\n")
494
- assert code == 3 and "uncommitted change: junk.txt" in out
495
+ assert code == 2 and (tmp_path / "junk.txt").exists(), "the stop repeats: the work in the slot is no error"
495
496
 
496
497
 
497
498
  def test_a_failing_prepare_stops_the_run_and_removes_the_slot(repo, tmp_path, capsys):
@@ -886,7 +887,7 @@ def test_a_merge_commit_the_slot_cannot_check_out_is_not_gated_and_does_not_land
886
887
  def test_a_gate_that_changes_the_tree_or_moves_head_is_red(repo, tmp_path, capsys, gate, after):
887
888
  repo(t01=ticket("01", **REFACTOR))
888
889
  code, ledger, out = walk(tmp_path, capsys, GIVE_UP + WORK + REPORT, gate=gate)
889
- assert code == 1 and "from the gate at .agent/implement/01/gate-" in ledger[-3] and ledger[-1] == GAVE_UP, out
890
+ assert code == 2 and "from the gate at .agent/implement/01/gate-" in ledger[-4] and ledger[-2:] == [GAVE_UP, ASKED], out
890
891
  record = next((tmp_path / ".agent/implement/01").glob("gate-*.log")).read_text()
891
892
  assert "\nexit: 0\n" in record and after in record
892
893
  assert state_of(tmp_path)["tickets"]["01"]["green_gates"] == []
@@ -727,13 +727,11 @@ def test_the_escalation_takes_the_next_entry_of_the_list():
727
727
  assert driver_fixloop.entry({"implementer": ["a@low"]}, 3) == "a@low"
728
728
 
729
729
 
730
- @pytest.mark.parametrize("step, error", [
731
- ({}, "BLOCKED at fix round 1: report .agent/implement/01/fixer-1.json is not"),
732
- ({"report": {"status": "BLOCKED", "commits": [], "files": [], "concerns": ["cannot"], "green": [], "ticket": "01"}},
733
- "BLOCKED at fix round 1: the fixer reported BLOCKED: cannot.")])
734
- def test_a_fixer_that_does_not_finish_blocks_the_ticket_in_its_round(tmp_path, step, error):
735
- rig = Inside(tmp_path).run(plan(**{"01/reviewer": [review("01", [STUCK])], "01/fixer": [step, step]}))
730
+ def test_a_fixer_that_does_not_finish_blocks_the_ticket_in_its_round(tmp_path):
731
+ """A fixer that reports BLOCKED asks a `fixer-stopped` question: test_decisions covers it."""
732
+ rig = Inside(tmp_path).run(plan(**{"01/reviewer": [review("01", [STUCK])], "01/fixer": [{}, {}]}))
736
733
  entry = rig.state()["tickets"]["01"]
734
+ error = "BLOCKED at fix round 1: report .agent/implement/01/fixer-1.json is not"
737
735
  assert error in blocked(rig) and entry["round"] == 1 and entry["tip"] == rig.sha("01", "implementer")
738
736
 
739
737
 
@@ -134,6 +134,17 @@ def test_implementer_without_a_new_commit_is_a_violation(world):
134
134
  assert check("implementer", implementer(shas), start=shas["impl"]) # its only commit is not new
135
135
 
136
136
 
137
+ def test_an_implementer_with_nothing_to_change_reports_no_commit_and_why(world):
138
+ """Issue 123: an implementer whose start already meets the ticket has a report the driver accepts."""
139
+ shas, check, _ = world
140
+ why = ["the correction made the locked tests green: the start needs no change"]
141
+ assert check("implementer", implementer(shas, commits=[], concerns=why), start=shas["impl"]) == []
142
+ assert check("implementer", implementer(shas, commits=[]), start=shas["impl"]) == [
143
+ "no commit, and no concern: say in `concerns` why the start needs no change"]
144
+ assert check("implementer", implementer(shas, commits=[], concerns=why), start=shas["tests"]) == [
145
+ f"commit {shas['impl'][:7]} is on ticket/01 and not in `commits`: list each commit you made"]
146
+
147
+
137
148
  def test_a_fixer_with_nothing_to_change_reports_no_commit_and_a_reason_per_finding(world):
138
149
  """Issue 123: a fixer whose findings need no change has a report the driver accepts: no commit, a concern each."""
139
150
  shas, check, tmp = world
@@ -13,8 +13,8 @@ Interface choices (ticket 05):
13
13
  - question ids are `<NN>-locked-test-<n>` with n counting per run (the first is 1, a second stop on the ticket is 2),
14
14
  and `<NN>-finding-<n>` for an open finding after round 4. Options: `overrule-test` / `overrule-implementer`
15
15
  (recommended: overrule-implementer), and `accept` / `split` / `redesign`.
16
- - an implementer is BLOCKED with a stop only when a `concerns` entry starts with "locked test contradicts spec:";
17
- any other BLOCKED report is an ordinary BLOCKED ticket (exit 1, no decisions file).
16
+ - an implementer is BLOCKED with a `locked-test` stop only when a `concerns` entry starts with "locked test
17
+ contradicts spec:"; any other BLOCKED report is an `implementer-stopped` stop (issue #123).
18
18
  - the answers file is `.agent/implement-answers.json` in the schema.md shape: `v`, `stage: "implement"`, `submitted`
19
19
  (`"changes"`), `revision`, `answers`. A rerun applies it only with `submitted` set and `revision` equal to the current
20
20
  decisions revision; otherwise a ledger line says "ignored" (and "revision" for a stale file, the option id for an
@@ -193,11 +193,11 @@ def test_answer_for_an_unknown_question_id_exits_3_naming_it_before_any_agent(tm
193
193
  assert "no-such-question" in rig.out + rig.err and len(rig.calls()) == seen
194
194
 
195
195
 
196
- def test_a_blocked_report_that_is_not_a_contradicted_locked_test_is_not_a_stop(tmp_path):
196
+ def test_a_blocked_report_that_is_not_a_contradicted_locked_test_is_an_implementer_stop(tmp_path):
197
197
  rig = Review(tmp_path)
198
198
  rig.run(steps(blocked("cannot reach the database")))
199
- assert rig.code == 1, rig.output()
200
- assert not (rig.repo / ".agent/implement/decisions.json").exists()
199
+ assert rig.code == 2, rig.output()
200
+ assert [q["id"] for q in decisions(rig)["questions"]] == ["01-implementer-stopped-1"]
201
201
  assert rig.state()["tickets"]["01"]["phase"] == "blocked"
202
202
 
203
203
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "generatedAt": "2026-10-20T15:57:25.481Z",
3
+ "generatedAt": "2026-10-20T16:37:17.283Z",
4
4
  "skills": [
5
5
  {
6
6
  "name": "backlog",
@@ -46,8 +46,8 @@
46
46
  },
47
47
  {
48
48
  "name": "implement-spec",
49
- "version": "0.1.33",
50
- "hash": "sha256-f5d4bb64baedc840c40253138ece3c8781424ebf7619447b2e10858888a93c7c",
49
+ "version": "0.1.34",
50
+ "hash": "sha256-ca0c5e9ee91c37da47c844b5617ac8e57dfe7a79c402a4c286e887471f54e9fb",
51
51
  "description": "Implement a specification in code."
52
52
  },
53
53
  {