@jesdi/skills 0.0.84 → 0.0.85

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.84",
3
+ "version": "0.0.85",
4
4
  "description": "jesdi's agent skills (content package consumed by @jesdi/skills-cli)",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -144,14 +144,21 @@ and do not know about the run, except `driver_run.py`, which the deciding module
144
144
  (`driver._risk`), so a risk that the diff does not handle is an unmet criterion under the usual round and cap rules.
145
145
  - A `--models` file may name only the roles of the skill's `models.json` (`driver_agents.load_models`): a removed
146
146
  role (`correctness`, `explorer`) or an unknown one stops the run before the preflight.
147
+ - The preflight asks every entry of every list on each invocation and returns the lists without the entries that
148
+ failed. A role keeps going on what is left, so a provider out of credits stops no run; a role with no entry left
149
+ exits 3. Round 2 stays on the only implementer entry left (`driver_fixloop.entry`), and the ledger says it
150
+ stays rather than escalates.
147
151
  - The full final review is three lens roles, `final-spec`, `final-correctness` and `final-structure`, with no model
148
152
  list. `driver_agents.LENSES` is the one table of a lens: the `source` of its findings, the method file it follows,
149
153
  whether its lines of the one lens prompt `prompts/final-lens.md` inline that file, and whether it runs on another
150
154
  provider. Its lines are `prompts/lens-<source>.md`, with `prompts/lens-copy.md` as `{copy}`. The entry, the
151
155
  prompt values (`driver_final._lens_values`), the precondition errors and the source tags read it, and `TIMEOUTS` and
152
156
  `READ_ONLY` take its roles. `driver_agents.lens_entries` takes the entries from `final-reviewer`, and
153
- `other_provider_entries` keeps a lens, its rerun too, on another provider than the first implementer entry;
154
- `load_models` refuses a list with none. `driver_final._run_lenses` runs them at the same time in slot 1 inside one
157
+ `correctness_entries` keeps a lens, its rerun too, on another provider than the first implementer entry;
158
+ `load_models` refuses a list with none. When the preflight (`driver_agents.preflight`) leaves none, because each
159
+ such entry failed it, the lens falls back to the `final-reviewer` entries that are left. The ledger says so, and the
160
+ PR body's Review coverage (`driver_final._review_providers`) names the entries each review ran on, read from
161
+ `run.agents`, so a fallback that a later invocation undid is not claimed. `driver_final._run_lenses` runs them at the same time in slot 1 inside one
155
162
  `Run.read_only`, so a lens that changes the slot makes all three run again. A lens that stops or is rejected
156
163
  twice stops the round only after every lens has ended, with one `final-ticket-blocked` question for each such lens
157
164
  (`Run.ask` adds them to one stop); an accepted lens report is kept in `run.final.lenses` with
@@ -21,7 +21,7 @@ Before any agent starts, the driver checks these. Each failed check prints one l
21
21
  - The `final-reviewer` list has an entry on another provider than the first `implementer` entry: the correctness lens of the final review and the scoped review run on it. The error names the list and the implementer entry.
22
22
  - The `review-diff` skill is installed next to this one, with its `spec.md` and `correctness.md`, and the `deep-quality-review` skill is next to this one, in `${CLAUDE_CONFIG_DIR:-~/.claude}/skills` or in `~/.agents/skills`: the lenses of the final review follow them. One error per lens names its skill and its missing file.
23
23
  - With `--push`, `--unattended` or `--base`, the repository has an `origin` remote.
24
- - Each model that the run can use answers one short test prompt (the preflight). A model that fails gives one line with its error. `--dry-run` skips the preflight.
24
+ - Each model entry of every list answers one short test prompt (the preflight), on each invocation. An entry that fails (a model the account cannot use or has no credits for, a CLI that is not signed in) is skipped for that invocation: each role that lists it goes on with its next entry, and one ledger sentence names the entry and the error. Only a role with no entry left stops the run, with one line naming each entry and its error. When no `final-reviewer` entry on another provider is left, the correctness lens and the scoped review run on the `final-reviewer` entries that are left, on the implementer's provider, and one more sentence says so. The driver prints these sentences and writes them to the ledger. The PR body's Review coverage names the entries that the ticket reviews, the correctness lens and the scoped review ran on, from the agents that ran, and flags an entry on a provider that also wrote code. `--dry-run` skips the preflight.
25
25
 
26
26
  A run that stopped is continued with the same command. `state.json` is the only input of a resume.
27
27
 
@@ -229,7 +229,7 @@ Answer with `--answer <question id>=<option id>` on the next run, or through the
229
229
  | Demonstrated red plus green for locked tests | `driver_report.py` `_red_errors`: each red line of a test-writer report (and of a correction) must be in its log. `driver_gate.py` `run`, called from `driver_run.py` `Run.gate` and `driver_fixloop.py` `_gate`: the fast gate gets the ticket's locked files in `IMPLEMENT_SPEC_LOCKED` and must be green on the candidate before its review. |
230
230
  | Locked files changed only by the test-writer | `driver_locked.py` `errors`, one diff check after the implementer, a fixer, the ticket conflict agent, the final fixer and the rebase conflict agent report (the baseline from `for_ticket`, or at the end of run `for_end_of_run`): the ticket's own locked files against its last test-writer commit, every other ticket's against the merge base of the branch and the PR tip, at the end of run every ticket's against the tidied tip (for the rebase conflict agent, the recovery point). A changed file rejects the report. `driver.py` `_refuse_breach` (with `driver_locked.py` `landing_errors`), under the merge lock: the commit that would land against every other ticket's locked files as the PR tip has it; a changed file blocks the ticket with one `ticket-blocked` question. `driver_locked.py` `_unlisted_errors`: a test-writer that changes another ticket's locked file must list it in `locked`, and the reviewer gets its diff (`prompts/elsewhere.md`) to judge against the spec. |
231
231
  | The full gate at landing and at the end of run | `driver.py` `_checked_landing`: the full gate runs on the commit that would land, a fast-forward as well as a merge commit, before the PR branch moves to it. `driver_final.py` `_review_until_reviewed` runs it after the tidy and after each fix batch. |
232
- | The ticket reviewer and the final correctness lens (and the scoped review) on another provider than the implementer | `models.json`: the `reviewer` list starts on another provider than the `implementer` list, which a `--models` file can change. `driver_agents.py` `other_provider_entries`: the correctness lens and the scoped review run and rerun only on `final-reviewer` entries of another provider than the first `implementer` entry; `load_models` refuses a list with no such entry before any agent, and the preflight checks that entry. |
232
+ | The ticket reviewer and the final correctness lens (and the scoped review) on another provider than the implementer | `models.json`: the `reviewer` list starts on another provider than the `implementer` list, which a `--models` file can change. `driver_agents.py` `other_provider_entries`: the correctness lens and the scoped review run and rerun only on `final-reviewer` entries of another provider than the first `implementer` entry; `load_models` refuses a list with no such entry before any agent. When the preflight finds no such entry usable (a provider out of credits), `correctness_entries` falls back to the `final-reviewer` entries that are left, and the ledger says so. When the reviewer's other-provider entry is skipped, its next entry may share the implementer's provider. The PR body's Review coverage names the entries each review ran on and flags one on a provider that also wrote code. |
233
233
 
234
234
  ## Known limits
235
235
 
@@ -496,7 +496,14 @@ def _exit_code(final: dict, args, end_blocked: bool) -> int:
496
496
  return code
497
497
 
498
498
 
499
- def _run(tickets: list[Ticket], models: dict[str, list[str]], args, kept: dict[str, int], pr: str) -> int:
499
+ def _record_skipped(skipped: list[str]) -> None:
500
+ """One ledger sentence per entry the preflight skipped. The PR body names the entries the reviews ran on."""
501
+ for sentence in skipped:
502
+ ledger(sentence)
503
+
504
+
505
+ def _run(tickets: list[Ticket], models: dict[str, list[str]], skipped: list[str], args, kept: dict[str, int],
506
+ pr: str) -> int:
500
507
  state = driver_state.State(STATE)
501
508
  slots = 1 if args.only else min(args.parallel, len(tickets))
502
509
  errors = _resume(tickets, state, pr, slots, args, kept)
@@ -506,6 +513,7 @@ def _run(tickets: list[Ticket], models: dict[str, list[str]], args, kept: dict[s
506
513
  if errors:
507
514
  return 3
508
515
  run = Run(args, models, state, pr, kept)
516
+ _record_skipped(skipped)
509
517
  if args.unattended and args.stage_json:
510
518
  Path(args.stage_json).unlink(missing_ok=True) # the file tells how this run ends, never an earlier one
511
519
  end_blocked, lines = _work(tickets, slots, run)
@@ -670,12 +678,32 @@ def _hold(common: Path, pr: str) -> tuple[ExitStack | None, str]:
670
678
  return stack.pop_all(), ""
671
679
 
672
680
 
681
+ def _preflight(args, models: dict[str, list[str]]) -> tuple[dict[str, list[str]], list[str]] | None:
682
+ """(the lists the run uses, the sentences of the skipped entries), or None with each error printed. A --runner
683
+ run starts no CLI, so it has no preflight."""
684
+ return (models, []) if args.runner else _checked(models)
685
+
686
+
687
+ def _checked(models: dict[str, list[str]]) -> tuple[dict[str, list[str]], list[str]] | None:
688
+ """The CLIs answer before the first agent. A model that the account cannot use stops no ticket: its roles go on
689
+ with their next entry, and the operator sees one line per skipped entry. Only a role with no entry left stops the
690
+ run."""
691
+ models, errors, skipped = driver_agents.preflight(models)
692
+ print("".join(line + "\n" for line in errors or skipped), end="")
693
+ return None if errors else (models, skipped)
694
+
695
+
696
+ def _dry_run(args) -> int:
697
+ """Validate the call and print the frontier width: 0 when it is valid, else 3."""
698
+ if valid := _validated(args):
699
+ _print_width(valid[0])
700
+ return 0 if valid else 3
701
+
702
+
673
703
  def main(argv: list[str] | None = None) -> int:
674
704
  args = _arguments(argv)
675
705
  if args.dry_run: # it changes nothing, so it needs no lock
676
- if valid := _validated(args):
677
- _print_width(valid[0])
678
- return 0 if valid else 3
706
+ return _dry_run(args)
679
707
  if not (locking := _common_dir_and_branch(args)):
680
708
  return 3
681
709
  common, pr = locking
@@ -692,12 +720,10 @@ def main(argv: list[str] | None = None) -> int:
692
720
  if not (valid := _validated(args)):
693
721
  return 3
694
722
  tickets, models, kept = valid
695
- # The CLIs answer before the first agent, so a model that the account cannot use stops no ticket.
696
- if not args.runner and (errors := driver_agents.preflight(models)):
697
- print("".join(error + "\n" for error in errors), end="")
723
+ if not (checked := _preflight(args, models)):
698
724
  return 3
699
725
  _print_width(tickets)
700
- return _run(tickets, models, args, kept, pr)
726
+ return _run(tickets, *checked, args, kept, pr)
701
727
 
702
728
 
703
729
  if __name__ == "__main__":
@@ -106,9 +106,15 @@ def other_provider_entry(models: dict[str, list[str]]) -> str:
106
106
  return next(iter(other_provider_entries(models)), "")
107
107
 
108
108
 
109
+ def correctness_entries(models: dict[str, list[str]]) -> list[str]:
110
+ """The entries of the correctness lens and the scoped review: the other-provider ones, or, when none passed the
111
+ preflight, the whole `final-reviewer` list, so a provider out of credits stops no run (the PR body says so)."""
112
+ return other_provider_entries(models) or models["final-reviewer"]
113
+
114
+
109
115
  def lens_entries(models: dict[str, list[str]], role: str) -> list[str]:
110
116
  """The entries a lens of the final review runs on, the first one first, its rerun on the next one."""
111
- return other_provider_entries(models) if LENSES[role].other_provider else models["final-reviewer"]
117
+ return correctness_entries(models) if LENSES[role].other_provider else models["final-reviewer"]
112
118
 
113
119
 
114
120
  def _entry_errors(models: dict[str, list[str]]) -> list[str]:
@@ -127,18 +133,30 @@ def _entry_errors(models: dict[str, list[str]]) -> list[str]:
127
133
  return [error for error in found if error]
128
134
 
129
135
 
130
- def used_entries(models: dict[str, list[str]]) -> list[str]:
131
- """Each entry the driver can start an agent on: the first of each role, the other-provider entry and the second
132
- implementer entry (fix round 2)."""
133
- firsts = (entries[0] for entries in models.values())
134
- return sorted({*firsts, other_provider_entry(models), *models["implementer"][1:2]})
136
+ def preflight(models: dict[str, list[str]]) -> tuple[dict[str, list[str]], list[str], list[str]]:
137
+ """Give one short prompt to every entry of every list, all at the same time. Returns (the lists without the
138
+ entries whose CLI failed: a model the account cannot use or is out of credits for, a CLI that is not signed in;
139
+ one error per role with no entry left; one sentence per skipped entry, and one more when no entry on another
140
+ provider than the implementer's first one is left)."""
141
+ failed = _failures(sorted({entry for role in models.values() for entry in role}))
142
+ kept = {role: [entry for entry in entries if entry not in failed] for role, entries in models.items()}
143
+ errors = [_no_entry_left(role, models[role], failed) for role, entries in kept.items() if not entries]
144
+ return kept, errors, [] if errors else _skipped(models, kept, failed)
145
+
135
146
 
147
+ def _no_entry_left(role: str, entries: list[str], failed: dict[str, str]) -> str:
148
+ """The error of a role whose every entry failed the preflight."""
149
+ return f"{role}: every model entry failed the preflight: " + "; ".join(
150
+ f"model entry {entry}: {failed[entry]}" for entry in entries)
136
151
 
137
- def preflight(models: dict[str, list[str]]) -> list[str]:
138
- """Give one short prompt to each used entry, all at the same time. Returns one error per entry whose CLI fails:
139
- a model that the account cannot use, a CLI that is not signed in."""
152
+
153
+ def _failures(entries: list[str]) -> dict[str, str]:
154
+ """{entry: why} for each entry whose CLI fails the preflight prompt."""
140
155
  with tempfile.TemporaryDirectory(prefix="implement-spec-preflight-") as folder:
141
156
  def check(index: int, entry: str) -> str:
157
+ cli = PROVIDERS[split(entry)[0]][0]
158
+ if not shutil.which(cli):
159
+ return f"{cli} is not on PATH"
142
160
  prompt, log = (Path(folder) / f"{index}{suffix}" for suffix in (".prompt.md", ".log"))
143
161
  prompt.write_text(PREFLIGHT)
144
162
  # A read-only command: the agent can change nothing, and codex writes its answer to the -o file.
@@ -147,12 +165,22 @@ def preflight(models: dict[str, list[str]]) -> list[str]:
147
165
  if code == 0:
148
166
  return ""
149
167
  why = f"no answer in {PREFLIGHT_MINUTES} minutes" if code is None else f"exit {code}"
150
- cli = PROVIDERS[split(entry)[0]][0]
151
- return f"model entry {entry}: the {cli} CLI failed the preflight ({why}): {last_words(log)}"
168
+ return f"the {cli} CLI failed the preflight ({why}): {last_words(log)}"
152
169
 
153
- entries = used_entries(models)
154
170
  with ThreadPoolExecutor(len(entries)) as pool:
155
- return [error for error in pool.map(check, range(len(entries)), entries) if error]
171
+ return {entry: why for entry, why in zip(entries, pool.map(check, range(len(entries)), entries)) if why}
172
+
173
+
174
+ def _skipped(models: dict[str, list[str]], kept: dict[str, list[str]], failed: dict[str, str]) -> list[str]:
175
+ """One ledger sentence per skipped entry, and one when the correctness lens lost its other provider."""
176
+ skipped = [f"Model entry {entry} is skipped for this invocation: {why.rstrip('.')}; each role that lists it "
177
+ f"goes on with its next entry ({', '.join(role for role in models if entry in models[role])})."
178
+ for entry, why in failed.items()]
179
+ if other_provider_entry(models) and not other_provider_entry(kept):
180
+ skipped.append(f"No final-reviewer entry on another provider than {kept['implementer'][0]} passed the "
181
+ f"preflight: the correctness lens and the scoped review run on "
182
+ f"{', '.join(kept['final-reviewer'])}, the implementer's provider.")
183
+ return skipped
156
184
 
157
185
 
158
186
  def last_words(log: Path) -> str:
@@ -417,7 +417,7 @@ def _review(run: Run, final: dict, tip: str) -> None:
417
417
  def _scoped(run: Run, values: dict[str, str], tip: str, done: int) -> tuple[list[dict], set[str]]:
418
418
  """The scoped review after the fix batch, one `final-reviewer`. Returns (its findings, each with the source
419
419
  `final-reviewer`; the titles of the must-fix findings it resolved)."""
420
- entries = driver_agents.other_provider_entries(run.models)
420
+ entries = driver_agents.correctness_entries(run.models)
421
421
  report = run.read_only(FINAL, ".", run.pr, tip, lambda: run.agent(Call(
422
422
  "final-reviewer", FINAL, ".", values, entry=entries[0], entries=entries, fix_round=done)))
423
423
  return ([{**finding, "source": "final-reviewer"} for finding in report["findings"]],
@@ -596,7 +596,26 @@ def _facts(run: Run, final: dict, tickets: list[Ticket]) -> str:
596
596
  "map": "\n".join(f"- {number}: {commit[:7]} {titles[number]}" for number, commit in final["commits"].items()),
597
597
  "fixes": fixes or "None.", "rulings": "\n".join(f"- {ruling}" for ruling in rulings) or "None.",
598
598
  "tip": tip, "onto": final["onto"], "tidied": final["tidied"],
599
- "scoped": f"{final['tidied']}..{tip}" if fixes else "not needed"})
599
+ "scoped": f"{final['tidied']}..{tip}" if fixes else "not needed",
600
+ "providers": _review_providers(run.state.read()["run"]["agents"])})
601
+
602
+
603
+ # The roles that review code, with their line in the PR body, and the roles that write it.
604
+ _REVIEWS = {"reviewer": "Ticket reviews", "final-correctness": "Correctness lens", "final-reviewer": "Scoped review"}
605
+ _AUTHORS = ("implementer", "fixer", "conflict")
606
+
607
+
608
+ def _review_providers(agents: list[dict]) -> str:
609
+ """One line per reviewing role that ran: the entries it ran on, and whether one of them shares a provider with an
610
+ entry that wrote code. It reads the agents that ran, so a preflight fallback of an earlier invocation that a later
611
+ one undid is not claimed."""
612
+ wrote = {driver_agents.split(agent["entry"])[0] for agent in agents if agent["role"] in _AUTHORS}
613
+ lines = []
614
+ for role, label in _REVIEWS.items():
615
+ if used := sorted({agent["entry"] for agent in agents if agent["role"] == role}):
616
+ same = any(driver_agents.split(entry)[0] in wrote for entry in used)
617
+ lines.append(f"- {label} ran on: {', '.join(used)}" + (", on a provider that also wrote code" * same))
618
+ return "\n".join(lines)
600
619
 
601
620
 
602
621
  def _run_pr_writer(run: Run, tip: str, risk: Path, values: dict) -> str:
@@ -51,9 +51,9 @@ class Job:
51
51
 
52
52
 
53
53
  def entry(models: dict[str, list[str]], round: int) -> str:
54
- """The implementer entry of a fix round: the second one for round 2."""
54
+ """The implementer entry of a fix round: the second one for round 2, or the only one the preflight left."""
55
55
  entries = models["implementer"]
56
- return entries[1] if round >= 2 else entries[0]
56
+ return entries[1] if round >= 2 and len(entries) > 1 else entries[0]
57
57
 
58
58
 
59
59
  def _log_findings(number: str, findings: list[dict]) -> list[dict]:
@@ -183,7 +183,8 @@ def _fix(job: Job, findings: list[dict], landing: str = "") -> None:
183
183
  on = entry(run.models, job.round)
184
184
  run.state.ticket(number, phase="fix", round=job.round, landing=landing or None)
185
185
  if job.round == 2:
186
- ledger(f"Ticket {number} round 2: escalated to {on}.")
186
+ ledger(f"Ticket {number} round 2: escalated to {on}." if on != run.models["implementer"][0] else
187
+ f"Ticket {number} round 2: stays on {on}: the preflight left no second implementer entry.")
187
188
  values, notes = job.pointers(job.round - 1), []
188
189
  if landing:
189
190
  record = driver_gate.record_path(OUT / number, driver_gate.FULL, landing)
@@ -17,3 +17,4 @@ One commit per ticket, in merge order:
17
17
  - Branch tip and reviewed tip: {tip}
18
18
  - Full review: {onto}..{tidied}
19
19
  - Scoped review after the fix batch: {scoped}
20
+ {providers}
@@ -311,16 +311,33 @@ def test_no_report_is_a_violation_with_one_rerun_then_blocked(env):
311
311
  assert any("01" in l and "BLOCKED" in l for l in w.ledger().splitlines()), w.ledger()
312
312
 
313
313
 
314
- def test_a_model_the_account_cannot_use_fails_the_preflight_with_exit_3_before_any_agent(env):
314
+ def test_a_role_whose_every_entry_fails_the_preflight_exits_3_before_any_agent(env):
315
315
  w = World(env, reviewer=["openai/gpt-astra@medium"])
316
316
  proc = w.run({"test-writer": [tw()]}, runner=False)
317
317
  assert proc.returncode == 3, proc.stdout + proc.stderr
318
- assert f"model entry openai/gpt-astra@medium: the codex CLI failed the preflight (exit 1): {REFUSED}" \
319
- in proc.stdout.splitlines(), proc.stdout
318
+ assert (f"reviewer: every model entry failed the preflight: model entry openai/gpt-astra@medium: the codex CLI "
319
+ f"failed the preflight (exit 1): {REFUSED}") in proc.stdout.splitlines(), proc.stdout
320
320
  assert not launches(w.tmp, "claude") and not launches(w.tmp, "codex")
321
321
  assert "ticket/feat%2Fcsv/01" not in git(w.repo, "branch", "--list") and not w.ledger()
322
322
 
323
323
 
324
+ def test_a_model_the_account_cannot_use_is_skipped_and_its_roles_go_on_with_their_next_entry(env):
325
+ """The other provider is out of credits: the reviewer and the correctness lens go on with Anthropic."""
326
+ opus = "anthropic/claude-opus-5@medium"
327
+ w = World(env, reviewer=["openai/gpt-astra@medium", opus], **{"final-reviewer": [opus, "openai/gpt-astra@medium"]})
328
+ proc = w.run({}, runner=False)
329
+ assert proc.returncode != 3, proc.stdout + proc.stderr
330
+ skipped = [f"Model entry openai/gpt-astra@medium is skipped for this invocation: the codex CLI failed the "
331
+ f"preflight (exit 1): {REFUSED.rstrip('.')}; each role that lists it goes on with its next entry (reviewer, "
332
+ f"final-reviewer).",
333
+ f"No final-reviewer entry on another provider than {opus} passed the preflight: the correctness lens "
334
+ f"and the scoped review run on {opus}, the implementer's provider."]
335
+ assert w.ledger().splitlines()[:2] == skipped, w.ledger()
336
+ assert proc.stdout.splitlines()[:2] == skipped, "the operator sees each skipped entry"
337
+ assert not launches(w.tmp, "codex"), "no agent starts on the skipped entry"
338
+ assert launches(w.tmp, "claude"), "the first agent starts on Anthropic"
339
+
340
+
324
341
  def test_a_cli_that_fails_with_no_report_stops_the_run_with_exit_4_and_the_same_command_resumes(env):
325
342
  w = World(env, refactor=True)
326
343
  plan = {"implementer": [{"stderr": REFUSED + "\n", "exit": 1}] * 2 + [impl()]}
@@ -13,6 +13,7 @@ import pytest
13
13
 
14
14
  import driver
15
15
  import driver_agents
16
+ import driver_fixloop
16
17
  import driver_report
17
18
  import driver_state
18
19
 
@@ -964,7 +965,7 @@ def test_a_rerun_after_an_interrupt_keeps_the_work_in_each_slot_and_reruns_the_r
964
965
  assert [line for line in ledger if "renamed the branch" in line] == (renamed if older_driver else [])
965
966
 
966
967
 
967
- def test_the_preflight_asks_each_used_entry_once_and_names_each_cli_that_fails(tmp_path, monkeypatch):
968
+ def test_the_preflight_asks_each_entry_once_and_drops_each_entry_whose_cli_fails(tmp_path, monkeypatch):
968
969
  """claude answers; codex refuses gpt-astra, and the gpt-6.1-sol call never ends."""
969
970
  bin_dir = tmp_path / "bin"
970
971
  bin_dir.mkdir()
@@ -978,15 +979,21 @@ def test_the_preflight_asks_each_used_entry_once_and_names_each_cli_that_fails(t
978
979
  monkeypatch.setattr(driver_agents, "PREFLIGHT_MINUTES", 0.02)
979
980
  models, _ = driver_agents.load_models(None)
980
981
  models["implementer"][1] = "openai/gpt-6.1-sol@medium"
981
- models["reviewer"] = ["openai/gpt-astra@medium"]
982
- assert driver_agents.used_entries(models) == ["claude-opus-5-5@medium", "claude-sonnet-5-5@medium",
983
- "openai/gpt-6-astra@medium", "openai/gpt-6.1-sol@medium",
984
- "openai/gpt-astra@medium"]
985
- assert driver_agents.preflight(models) == [
986
- "model entry openai/gpt-6.1-sol@medium: the codex CLI failed the preflight (no answer in 0.02 minutes): "
987
- "no output",
988
- "model entry openai/gpt-astra@medium: the codex CLI failed the preflight (exit 1): ERROR: not supported"]
989
- assert len((bin_dir / "asked").read_text().splitlines()) == 5
982
+ models["final-reviewer"] = ["openai/gpt-astra@medium", "claude-opus-5-5@medium"]
983
+ kept, errors, skipped = driver_agents.preflight(models)
984
+ assert errors == [] and len((bin_dir / "asked").read_text().splitlines()) == 5
985
+ assert kept["implementer"] == ["claude-sonnet-5-5@medium"] and kept["final-reviewer"] == ["claude-opus-5-5@medium"]
986
+ assert kept["test-writer"] == ["claude-sonnet-5-5@medium"] and kept["reviewer"] == models["reviewer"]
987
+ assert skipped == [
988
+ "Model entry openai/gpt-6.1-sol@medium is skipped for this invocation: the codex CLI failed the preflight (no "
989
+ "answer in 0.02 minutes): no output; each role that lists it goes on with its next entry (test-writer, "
990
+ "implementer).",
991
+ "Model entry openai/gpt-astra@medium is skipped for this invocation: the codex CLI failed the preflight (exit "
992
+ "1): ERROR: not supported; each role that lists it goes on with its next entry (final-reviewer).",
993
+ "No final-reviewer entry on another provider than claude-sonnet-5-5@medium passed the preflight: the "
994
+ "correctness lens and the scoped review run on claude-opus-5-5@medium, the implementer's provider."]
995
+ assert driver_agents.lens_entries(kept, "final-correctness") == ["claude-opus-5-5@medium"]
996
+ assert driver_fixloop.entry(kept, 2) == "claude-sonnet-5-5@medium", "round 2 stays on the only entry left"
990
997
 
991
998
 
992
999
  def test_last_words_takes_the_result_of_a_stream_json_line(tmp_path):
@@ -6,6 +6,8 @@ import json
6
6
 
7
7
  import pytest
8
8
 
9
+ import driver
10
+ import driver_agents
9
11
  import driver_final
10
12
  from test_final import Final, final, fixer, fn
11
13
  from test_fixloop import inside # noqa: F401 (the autouse fixture puts the rig's CLIs on PATH)
@@ -76,6 +78,35 @@ def test_the_summary_counts_each_lens_under_its_role_and_has_no_correctness_row(
76
78
  assert "agents, correctness" not in summary
77
79
 
78
80
 
81
+ def test_with_the_other_provider_out_of_credits_every_review_runs_on_the_entry_left_and_the_pr_says_so(
82
+ tmp_path, monkeypatch):
83
+ """The preflight of a real run skips ASTRA: the ticket reviews and the correctness lens run on OPUS."""
84
+ out = "the codex CLI failed the preflight (exit 1): ERROR: You've hit your usage limit."
85
+ monkeypatch.setattr(driver, "_preflight", lambda args, models: driver._checked(models))
86
+ monkeypatch.setattr(driver_agents, "_failures", lambda entries: {ASTRA: out} if ASTRA in entries else {})
87
+ rig = rig_of(tmp_path, models={**MODELS, "reviewer": [ASTRA, OPUS]}).run(plan())
88
+ assert rig.code == 0, rig.out
89
+ skipped = [f"Model entry {ASTRA} is skipped for this invocation: {out.rstrip('.')}; each role that lists it goes on "
90
+ f"with its next entry (reviewer, final-reviewer).",
91
+ f"No final-reviewer entry on another provider than {SONNET} passed the preflight: the correctness lens "
92
+ f"and the scoped review run on {OPUS}, the implementer's provider."]
93
+ assert rig.out.splitlines()[:2] == skipped and rig.ledger()[:2] == skipped
94
+ ran = {(agent["role"], agent["entry"]) for agent in rig.state()["run"]["agents"]}
95
+ assert {entry for role, entry in ran if role in ("reviewer", "final-correctness")} == {OPUS}, ran
96
+ assert driver_final._review_providers(rig.state()["run"]["agents"]).splitlines() == [
97
+ f"- Ticket reviews ran on: {OPUS}, on a provider that also wrote code",
98
+ f"- Correctness lens ran on: {OPUS}, on a provider that also wrote code"]
99
+
100
+
101
+ def test_the_review_coverage_names_only_what_ran_so_an_undone_fallback_is_not_claimed():
102
+ agents = [{"role": "implementer", "entry": SONNET}, {"role": "reviewer", "entry": OPUS},
103
+ {"role": "reviewer", "entry": ASTRA}, {"role": "final-correctness", "entry": ASTRA},
104
+ {"role": "final-reviewer", "entry": ASTRA}]
105
+ assert driver_final._review_providers(agents).splitlines() == [
106
+ f"- Ticket reviews ran on: {OPUS}, {ASTRA}, on a provider that also wrote code",
107
+ f"- Correctness lens ran on: {ASTRA}", f"- Scoped review ran on: {ASTRA}"]
108
+
109
+
79
110
  # ---------------------------------------------------------------- input validation
80
111
 
81
112
  def test_a_final_reviewer_list_with_no_entry_on_another_provider_exits_3_before_any_agent(tmp_path):
@@ -103,6 +103,8 @@ def test_a_local_run_stops_before_the_push_and_a_push_rerun_pushes_and_opens_the
103
103
  assert f"PR method: {pr_skill}\n" in writer["prompt"]
104
104
  assert "Facts of the run, which the driver puts after your body:\n## Tickets" in writer["prompt"]
105
105
  assert "## Rulings\n\nNone.\n" in pr["body"] and "Scoped review after the fix batch: not needed" in pr["body"]
106
+ coverage = pr["body"].split("## Review coverage\n")[1]
107
+ assert "- Ticket reviews ran on: " in coverage and "- Correctness lens ran on: " in coverage, coverage
106
108
  assert f"Pushed feat/csv at {tip} to origin." in rig.out and "PR: https://github.example/pull/1" in rig.out
107
109
  assert f"feat/csv is pushed at {tip[:7]}; its PR is https://github.example/pull/1." in rig.out
108
110
  assert rig.led("The PR of feat/csv into main is open: https://github.example/pull/1.")
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "generatedAt": "2026-11-03T12:00:34.732Z",
3
+ "generatedAt": "2026-11-04T11:29:47.358Z",
4
4
  "skills": [
5
5
  {
6
6
  "name": "agents-wayfinder",
@@ -58,8 +58,8 @@
58
58
  },
59
59
  {
60
60
  "name": "implement-spec",
61
- "version": "0.1.48",
62
- "hash": "sha256-c1c51c34db8cb4c87c3437b3b0c1569dbabb60e327b3afdeaa5e0b9306efa0ba",
61
+ "version": "0.1.49",
62
+ "hash": "sha256-ff750cddd350cf54c5b3de41243b9bff3295c1b257df5dd2b30fb58a341a98a7",
63
63
  "description": "Implement a specification in code."
64
64
  },
65
65
  {