@jesdi/skills 0.0.53 → 0.0.54

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.53",
3
+ "version": "0.0.54",
4
4
  "description": "jesdi's agent skills (content package consumed by @jesdi/skills-cli)",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -138,6 +138,10 @@ and do not know about the run, except `driver_run.py`, which the three deciding
138
138
  - No test-writer correction runs after round 4 (`driver_fixloop._act_on`): its findings become `finding` questions
139
139
  with the others. A correction there would add red locked tests that no fix round makes green, and `accept` could
140
140
  not merge the ticket.
141
+ - A correction that does not close its findings (the next review finds one again, or the driver rejects its
142
+ report) asks a `locked-test-again` question. `correct-again` and `accept` send the ticket back to `review`, and
143
+ `driver_decisions.corrections` reads the answers from `state.json`: the count of `correct-again` stops bounds the
144
+ extra corrections (`AGAIN`), and an `accept` stop closes the ticket's locked-test findings in `_act_on`.
141
145
 
142
146
  ### Questions
143
147
 
@@ -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` or `final-finding` is open. Exit 2 wins over exit 1. |
60
+ | 2 | Parked: a question of kind `locked-test`, `locked-test-again` 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. |
@@ -118,7 +118,7 @@ Rules for each agent:
118
118
 
119
119
  | Finding | What the driver does |
120
120
  |---|---|
121
- | kind `fixture`, any severity, or kind `test`, `critical` or `important`, on a locked file of the ticket | One test-writer correction, outside the fix rounds. The fixer may not edit a locked file, so a fix round cannot close a `test` finding there. The corrected files are the new locked versions, and the next review is a full review. A finding that the correction reports in `not_addressed` (it needs a production change first) becomes a finding of kind `code`, with the reason as its evidence, and goes to a fix round at once; the ledger says it was not corrected. A finding of this kind that is open after the correction blocks the ticket. No correction runs after round 4. |
121
+ | kind `fixture`, any severity, or kind `test`, `critical` or `important`, on a locked file of the ticket | One test-writer correction, outside the fix rounds. The fixer may not edit a locked file, so a fix round cannot close a `test` finding there. The corrected files are the new locked versions, and the next review is a full review. A finding that the correction reports in `not_addressed` (it needs a production change first) becomes a finding of kind `code`, with the reason as its evidence, and goes to a fix round at once; the ledger says it was not corrected. A finding of this kind that is open in the review after the correction, or a correction that the driver rejects, blocks the ticket with a `locked-test-again` question. No correction runs after round 4. |
122
122
  | `critical` or `important` | One fix round. |
123
123
  | `minor` | It stays in the ledger and in the findings file. The final reviewer gets the list. |
124
124
 
@@ -197,6 +197,7 @@ A question is a bounded choice for the operator. `driver_decisions.py` `KINDS` h
197
197
  |---|---|---|---|---|
198
198
  | `locked-test` | `<NN>-locked-test-<n>` | An implementer or a fixer reports BLOCKED with a concern that starts with `locked test contradicts spec:`. | 2 | `overrule-test`: the test-writer corrects the test from that report, then the implementer runs again, and the fix rounds count from 0: the corrected tests are a new contract. `overrule-implementer` (recommended): the implementer runs again. |
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
+ | `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. |
200
201
  | `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. |
201
202
 
202
203
  `n` counts the questions of that ticket and kind in the run, so an id is never used twice.
@@ -57,6 +57,24 @@ KINDS = {
57
57
  "redesign": Option(
58
58
  "Keep the ticket BLOCKED. The design changes before more work on it.",
59
59
  "Ruling: {ticket} stays BLOCKED, the design changes first (redesign): {subject}.", {})}),
60
+ "locked-test-again": Kind(
61
+ True,
62
+ "Ticket {ticket}: a locked-test finding is open after the test-writer correction: {subject}",
63
+ "The test-writer correction did not close this finding on the locked tests: the review after it found it "
64
+ "again, or the driver rejected the correction (the ledger line says which). Ticket {ticket} is BLOCKED and "
65
+ "each ticket that it blocks waits.",
66
+ "correct-again",
67
+ {"correct-again": Option(
68
+ "The test-writer corrects the locked tests once more, from the next review. Then the fix rounds go on.",
69
+ "Ruling: {ticket} locked-test finding goes back to the test-writer for one more correction "
70
+ "(correct-again): {subject}.", {"phase": "review"}),
71
+ "accept": Option(
72
+ "Close the finding as it is: the locked tests stay as they are, and no more correction runs for the "
73
+ "ticket. The ticket goes on to its fix rounds with its other findings.",
74
+ "Ruling: {ticket} locked-test finding closed as it is (accept): {subject}.", {"phase": "review"}),
75
+ "redesign": Option(
76
+ "Keep the ticket BLOCKED. The design changes before more work on it.",
77
+ "Ruling: {ticket} stays BLOCKED, the design changes first (redesign): {subject}.", {})}),
60
78
  # A final-review question belongs to no ticket: its `ticket` is "".
61
79
  "final-finding": Kind(
62
80
  True,
@@ -72,6 +90,19 @@ KINDS = {
72
90
  }
73
91
 
74
92
 
93
+ AGAIN = 2 # the extra corrections a ticket may get: a test-writer and a reviewer that never agree cannot loop
94
+
95
+
96
+ def corrections(questions: list[dict], ticket: str) -> tuple[int, bool]:
97
+ """(the extra corrections that the `locked-test-again` stops of `ticket` gave, whether one stop accepted its
98
+ findings). A stop with one `correct-again` answer gives one correction; a stop with only `accept` accepts."""
99
+ stops: dict[int, set] = {}
100
+ for q in questions:
101
+ if (q["ticket"], q["kind"]) == (ticket, "locked-test-again") and q["answer"]:
102
+ stops.setdefault(q["stop"], set()).add(q["answer"])
103
+ return sum("correct-again" in answers for answers in stops.values()), {"accept"} in stops.values()
104
+
105
+
75
106
  def contradicted(role: str, report: dict) -> str:
76
107
  """The locked tests that a BLOCKED report of an implementer or a fixer says contradict the spec; "" when it is not
77
108
  that stop."""
@@ -85,9 +116,12 @@ def question(kind: str, ticket: str, subject: str, evidence: list[str], asked: l
85
116
  """A new open question, id `<NN>-<kind>-<n>` (`<kind>-<n>` with no ticket); n counts in `asked`, the whole run."""
86
117
  made, values = KINDS[kind], {"ticket": ticket, "subject": subject}
87
118
  number = 1 + sum((q["ticket"], q["kind"]) == (ticket, kind) for q in asked)
119
+ options, recommended = made.options, made.recommended
120
+ if kind == "locked-test-again" and corrections(asked, ticket)[0] >= AGAIN:
121
+ options, recommended = {name: options[name] for name in ("accept", "redesign")}, "accept"
88
122
  return {"id": f"{ticket}-{kind}-{number}".lstrip("-"), "title": made.title.format(**values), "why": made.why.format(**values),
89
- "evidence": evidence, "recommended": made.recommended,
90
- "options": [{"id": name, "description": option.description} for name, option in made.options.items()],
123
+ "evidence": evidence, "recommended": recommended,
124
+ "options": [{"id": name, "description": option.description} for name, option in options.items()],
91
125
  "ticket": ticket, "kind": kind, "subject": subject, "stop": stop, "answer": None}
92
126
 
93
127
 
@@ -11,6 +11,7 @@ from concurrent.futures import ThreadPoolExecutor
11
11
  from dataclasses import dataclass, field
12
12
 
13
13
  import driver_agents
14
+ import driver_decisions
14
15
  import driver_gate
15
16
  import driver_merge
16
17
  import driver_review
@@ -108,9 +109,10 @@ def _correct(job: Job, findings: list[dict]) -> list[dict]:
108
109
  """One test-writer correction for the findings on the locked tests. It is outside the fix rounds. Returns the
109
110
  findings that it did not correct, as findings of kind code for the fixer (issue #111)."""
110
111
  run, number = job.run, job.ticket.number
112
+ titles, evidence = [finding["title"] for finding in findings], str(OUT / number / f"findings-{job.round}.json")
111
113
  if job.corrected:
112
- titles = "; ".join(finding["title"] for finding in findings)
113
- raise Blocked(f"the review: a locked-test finding is open after the test-writer correction: {titles}")
114
+ run.ask(number, "locked-test-again", titles, evidence)
115
+ raise Blocked(f"the review: a locked-test finding is open after the test-writer correction: {'; '.join(titles)}")
114
116
  restored = run.restore_locked_files(number, job.slot)
115
117
  job.tip = driver_slots.head(job.slot) # the restore is a commit of the driver
116
118
  # The gate was green on the tip before the restore, so a red gate here is a restored file that fails with the
@@ -126,9 +128,13 @@ def _correct(job: Job, findings: list[dict]) -> list[dict]:
126
128
  "record": record and os.path.relpath(record, job.slot)}
127
129
  notes = ["correction"] + ["restored"] * bool(restored) + ["restored-red"] * bool(record)
128
130
  with during("the test-writer correction"):
129
- report = run.agent("test-writer", number, job.slot, values, notes=notes, fix_round=job.round + 1,
130
- check={"correction": True, "restored": restored, "restore_red": bool(record),
131
- "findings": [finding["title"] for finding in findings]})
131
+ try:
132
+ report = run.agent("test-writer", number, job.slot, values, notes=notes, fix_round=job.round + 1,
133
+ check={"correction": True, "restored": restored, "restore_red": bool(record),
134
+ "findings": titles})
135
+ except Blocked:
136
+ run.ask(number, "locked-test-again", titles, evidence) # a rejected correction is one that did not close
137
+ raise
132
138
  job.tip, job.previous, job.corrected = driver_slots.head(job.slot), "", True
133
139
  entry = run.state.read()["tickets"][number]
134
140
  run.state.ticket(number, tip=job.tip, **driver_review.written(job.slot, entry, report["locked"], job.tip))
@@ -181,10 +187,24 @@ def _fix(job: Job) -> None:
181
187
  job.corrected, job.proofs, job.again = False, set(followed), due
182
188
 
183
189
 
190
+ def _unaccepted(job: Job, state: dict, to_correct: list[dict]) -> list[dict]:
191
+ """The findings for a correction once an `accept` ruling closed the ticket's locked-test findings: only the
192
+ driver's, since a changed locked file is still restored. With no such ruling, `to_correct`."""
193
+ number = job.ticket.number
194
+ if not driver_decisions.corrections(state["run"]["questions"], number)[1]:
195
+ return to_correct
196
+ for finding in to_correct:
197
+ if finding["source"] != "driver":
198
+ ledger(f"Ticket {number}: {finding['kind']} finding in {finding['file']} closed as it is by the ruling "
199
+ f"(accept), with no correction: {finding['title']}.")
200
+ return [finding for finding in to_correct if finding["source"] == "driver"]
201
+
202
+
184
203
  def _act_on(job: Job, found: list[dict]) -> bool:
185
204
  """Do what the findings of a review ask for: a correction, a fix round, or a stop. True: none is open."""
186
- locked = job.run.state.read()["tickets"][job.ticket.number]["locked"]
187
- to_correct, to_fix = driver_review.route(found, locked)
205
+ state = job.run.state.read()
206
+ to_correct, to_fix = driver_review.route(found, state["tickets"][job.ticket.number]["locked"])
207
+ to_correct = _unaccepted(job, state, to_correct)
188
208
  if job.round == ROUNDS:
189
209
  # No correction after round 4: no fix round could make its new locked tests green, so `accept` could not merge.
190
210
  to_correct, to_fix = [], [finding for finding in found if finding in to_correct + to_fix]
@@ -141,12 +141,67 @@ def test_a_locked_file_check_that_git_cannot_make_is_a_finding(tmp_path):
141
141
  assert found["severity"] == "critical" and found["title"].startswith("locked file check failed: ")
142
142
 
143
143
 
144
- def test_a_fixture_finding_that_comes_back_after_its_correction_blocks_the_ticket(tmp_path):
145
- stale = finding("STALE", kind="fixture", file="tests/test_01.py")
146
- correction = {**tw("01"), "files": {"tests/test_01.py": "# corrected\n"}, "commit": "test: 01 fixture fix"}
147
- rig = Inside(tmp_path).run(plan(**{"01/test-writer": [tw("01"), correction], "01/reviewer": [review("01", [stale])] * 2}))
148
- assert blocked(rig).endswith("BLOCKED at the review: a locked-test finding is open after the test-writer correction: STALE.")
149
- assert len(rig.calls("01", "test-writer")) == 2 and rig.state()["tickets"]["01"]["round"] == 0
144
+ STALE = finding("STALE", kind="fixture", file="tests/test_01.py")
145
+ AGAIN_1 = "01-locked-test-again-1"
146
+
147
+
148
+ def corrections(n):
149
+ """`n` test-writer corrections of tests/test_01.py, each with its own content."""
150
+ return [{**tw("01"), "files": {"tests/test_01.py": f"# corrected {i}\n"}, "commit": f"test: 01 correction {i}"}
151
+ for i in range(1, n + 1)]
152
+
153
+
154
+ def asked(rig):
155
+ """The open questions of the run: id -> option ids."""
156
+ return {q["id"]: [o["id"] for o in q["options"]] for q in rig.state()["run"]["questions"] if q["answer"] is None}
157
+
158
+
159
+ def test_a_locked_test_finding_that_comes_back_after_its_correction_asks_the_operator(tmp_path):
160
+ # Issue #107: the ticket was BLOCKED with no question, so only an edit of state.json could resume it.
161
+ steps = plan(**{"01/test-writer": [tw("01"), *corrections(2)],
162
+ "01/reviewer": [review("01", [STALE])] * 3 + [review("01")]})
163
+ rig = Inside(tmp_path).run(steps)
164
+ assert rig.code == 2 and rig.state()["tickets"]["01"]["phase"] == "blocked", rig.ledger()
165
+ assert rig.led("BLOCKED at the review: a locked-test finding is open after the test-writer correction: STALE.")
166
+ assert asked(rig) == {AGAIN_1: ["correct-again", "accept", "redesign"]}
167
+ (question,) = rig.state()["run"]["questions"]
168
+ assert question["recommended"] == "correct-again" and question["evidence"][0] == ".agent/implement/01/findings-0.json"
169
+ rig.run(steps, "--answer", f"{AGAIN_1}=correct-again")
170
+ assert rig.code == 0, rig.ledger()
171
+ order = [call["role"] for call in rig.calls("01")]
172
+ assert order == ["test-writer", "implementer", "reviewer", "test-writer", "reviewer", "reviewer", "test-writer",
173
+ "reviewer"]
174
+ assert rig.led("Ruling: 01 locked-test finding goes back to the test-writer for one more correction")
175
+ assert rig.state()["tickets"]["01"]["phase"] == "merged"
176
+
177
+
178
+ def test_an_accepted_locked_test_finding_lets_the_ticket_go_on_to_its_fix_rounds(tmp_path):
179
+ steps = plan(**{"01/test-writer": [tw("01"), *corrections(1)], "01/fixer": [fix("01", 1)],
180
+ "01/reviewer": [review("01", [STALE]), review("01", [STALE]), review("01", [STALE, STUCK]),
181
+ review("01", [STALE])]})
182
+ rig = Inside(tmp_path).run(steps)
183
+ assert rig.code == 2 and list(asked(rig)) == [AGAIN_1], rig.ledger()
184
+ rig.run(steps, "--answer", f"{AGAIN_1}=accept")
185
+ assert rig.code == 0, rig.ledger()
186
+ order = [call["role"] for call in rig.calls("01")]
187
+ assert order == ["test-writer", "implementer", "reviewer", "test-writer", "reviewer", "reviewer", "fixer",
188
+ "reviewer"]
189
+ assert rig.state()["tickets"]["01"]["round"] == 1
190
+ assert rig.led("STALE", "closed as it is by the ruling")
191
+
192
+
193
+ def test_the_extra_corrections_are_bounded_and_redesign_keeps_the_ticket_blocked(tmp_path):
194
+ steps = plan(**{"01/test-writer": [tw("01"), *corrections(3)], "01/reviewer": [review("01", [STALE])] * 6})
195
+ rig = Inside(tmp_path).run(steps)
196
+ for n in (1, 2):
197
+ assert asked(rig) == {f"01-locked-test-again-{n}": ["correct-again", "accept", "redesign"]}, rig.ledger()
198
+ rig.run(steps, "--answer", f"01-locked-test-again-{n}=correct-again")
199
+ # Two extra corrections did not close it: a third one is not offered.
200
+ assert asked(rig) == {"01-locked-test-again-3": ["accept", "redesign"]}, rig.ledger()
201
+ assert len(rig.calls("01", "test-writer")) == 4
202
+ rig.run(steps, "--answer", "01-locked-test-again-3=redesign")
203
+ assert rig.code == 1 and rig.state()["tickets"]["01"]["phase"] == "blocked" and asked(rig) == {}
204
+ assert rig.led("Ruling: 01 stays BLOCKED, the design changes first (redesign): STALE.")
150
205
 
151
206
 
152
207
  def test_an_open_finding_survives_the_fixture_correction_of_its_review_and_starts_the_fix_round(tmp_path):
@@ -282,10 +337,15 @@ def test_the_fix_rounds_count_from_0_after_an_overruled_test(tmp_path):
282
337
  assert rig.state()["tickets"]["01"]["round"] == 1 and not rig.led("after round 4")
283
338
 
284
339
 
285
- def test_a_fixture_correction_that_is_rejected_blocks_the_ticket(tmp_path):
286
- stale = finding("STALE", kind="fixture", file="tests/test_01.py")
287
- rig = Inside(tmp_path).run(plan(**{"01/test-writer": [tw("01"), {}, {}], "01/reviewer": [review("01", [stale])]}))
288
- assert "BLOCKED at the test-writer correction: report .agent/implement/01/test-writer-1.json is not" in blocked(rig)
340
+ def test_a_fixture_correction_that_is_rejected_asks_the_operator(tmp_path):
341
+ # Issue #107: a correction the driver rejects (for one, a change to a file it does not list) was a dead end too.
342
+ steps = plan(**{"01/test-writer": [tw("01"), {}, {}, *corrections(1)],
343
+ "01/reviewer": [review("01", [STALE])] * 2 + [review("01")]})
344
+ rig = Inside(tmp_path).run(steps)
345
+ assert rig.code == 2 and list(asked(rig)) == [AGAIN_1], rig.ledger()
346
+ assert rig.led("BLOCKED at the test-writer correction: report .agent/implement/01/test-writer-1.json is not")
347
+ rig.run(steps, "--answer", f"{AGAIN_1}=correct-again")
348
+ assert rig.code == 0 and len(rig.calls("01", "test-writer")) == 4, rig.ledger()
289
349
 
290
350
 
291
351
  # ---------------------------------------------------------------- the locked files of the merged tickets
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "generatedAt": "2026-10-19T23:09:36.924Z",
3
+ "generatedAt": "2026-10-20T08:20:29.273Z",
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.28",
50
- "hash": "sha256-bcdecd8970590a6678eec2601eccabadc23a7f92c9e9aba1887a67518f71dc2c",
49
+ "version": "0.1.29",
50
+ "hash": "sha256-777240d5b64b5fdff5e6fa9633e2ed21d9f5147c3781404c88dc11c0248bfaee",
51
51
  "description": "Implement a specification in code."
52
52
  },
53
53
  {