Pin that one override still asks, and say where the catalog and the entry go

This commit is contained in:
2026-09-26 19:59:43 +02:00
parent d4ae61a685
commit 413aa2f638
3 changed files with 7 additions and 4 deletions
+1 -1
View File
@@ -11,6 +11,6 @@
- `loop-claude` says why when it cannot read `~/.claude.json` before an interrupt, and the interrupt then lands in Claude Code's trust dialog.
- `loop-claude` takes an edit to itself at the next cycle boundary once the edited file answers `--help`, and exits 1 when the edited file cannot read the running loop's state.
- `loop-claude --help` names the Claude Code version its transcript, session and trust handling were observed on; check it first when an upgrade breaks a cycle.
- `loop-claude` runs every claude it starts, the interrupt included, on the project's model, saved in `~/.claude/loop-claude-models.json`. A project without an entry is asked for one on the terminal, from Claude Code's model catalog, and exits 2 without a terminal; delete the entry to pick again. `LOOP_CLAUDE_WORKER_MODEL` and `LOOP_CLAUDE_JUDGE_MODEL` override it.
- `loop-claude` runs every claude it starts, the interrupt included, on the project's model, saved in `~/.claude/loop-claude-models.json`. A project without an entry is asked for one on the terminal, from Claude Code's model catalog, and exits 2 without a terminal; delete the entry to pick again. `LOOP_CLAUDE_WORKER_MODEL` and `LOOP_CLAUDE_JUDGE_MODEL` override it; with both set, nothing is asked.
- `settings.json`, the agents and the status line run on any machine unedited; the status line shows reset times in the machine's own time zone.
- `loop-claude`'s no-premises exit names what is wrong: `README.md` unopenable or not UTF-8, a `## Goals` or `## Audience` heading missing or repeated, or nothing under one.
+2 -2
View File
@@ -276,14 +276,14 @@ def read_models(saved):
def ask_model(name, saved):
if not (sys.stdin.isatty() and sys.stdout.isatty()):
print(f"{name} has no model in {saved}, and stdin or stdout is not a terminal to ask on; run it on a terminal or add \"{name}\": \"<model>\" to {saved}", file=sys.stderr)
print(f"{name} has no model in {saved}, and stdin or stdout is not a terminal to ask on; run it on a terminal or add \"{name}\": \"<model>\" to the JSON object in {saved}", file=sys.stderr)
sys.exit(2)
offered = catalog()
print(f"\nThe model to run {name} on, saved in {saved}:", file=sys.stderr)
for number, (model_id, label) in enumerate(offered, 1):
print(f" {number}. {label} ({model_id})", file=sys.stderr)
if not offered:
print(" no model catalog cached; running claude once fills it", file=sys.stderr)
print(" no model catalog cached in ~/.claude/cache/model-catalog", file=sys.stderr)
while True:
try:
answer = input(f"{'A number, or any' if offered else 'A'} name claude --model takes: ").strip()
+4 -1
View File
@@ -158,10 +158,13 @@ class ProjectModel(unittest.TestCase):
with unittest.mock.patch("sys.stdin.isatty", return_value=False), self.assertRaises(SystemExit) as stopped:
loop.project_model("/srv/a")
self.assertEqual(stopped.exception.code, 2)
self.assertIn(f'add "srv/a": "<model>" to {saved}', sys.stderr.getvalue())
self.assertIn(f'add "srv/a": "<model>" to the JSON object in {saved}', sys.stderr.getvalue())
self.assertFalse(saved.exists())
with unittest.mock.patch.dict(os.environ, {"LOOP_CLAUDE_JUDGE_MODEL": "j", "LOOP_CLAUDE_WORKER_MODEL": "w"}), unittest.mock.patch("sys.stdin.isatty", return_value=False):
self.assertEqual(loop.project_model("/srv/a"), "")
with unittest.mock.patch.dict(os.environ, {"LOOP_CLAUDE_JUDGE_MODEL": "j"}), unittest.mock.patch("sys.stdin.isatty", return_value=False), self.assertRaises(SystemExit) as stopped:
loop.project_model("/srv/a")
self.assertEqual(stopped.exception.code, 2)
with (
unittest.mock.patch("sys.stdin.isatty", return_value=True),
unittest.mock.patch("sys.stdout.isatty", return_value=True),