diff --git a/bin/agent_cycle/judge.py b/bin/agent_cycle/judge.py index 79cd9b8c..f8c40cca 100644 --- a/bin/agent_cycle/judge.py +++ b/bin/agent_cycle/judge.py @@ -208,7 +208,7 @@ def judge_args(rung: Rung, driver: str) -> list[str]: return [ "--json-schema", json.dumps(judge_schema(driver)), *rung.flags(), - "--tools", "", + "--tools", "", "--strict-mcp-config", ] diff --git a/bin/agent_cycle/stuck_workers.py b/bin/agent_cycle/stuck_workers.py index e3f623d8..52eeaa89 100644 --- a/bin/agent_cycle/stuck_workers.py +++ b/bin/agent_cycle/stuck_workers.py @@ -104,7 +104,7 @@ def command_of(pid: int, shells: list[Shell]) -> str: def investigated(shells: list[Shell], rung: Rung, root: str, effects: Effects) -> dict[str, typing.Any] | Failure: """A headless claude's verdict on the worker holding shells, as SCHEMA has it, or why there is none. It runs without tools, so it judges only the evidence it is handed.""" evidence = "\n\n".join(f"Shell {shell.pid}: {shell.command}\nIts processes, as pid, state, CPU and command line:\n{chr(10).join(shell.processes) or 'none'}\nThe end of its output:\n{shell.output or 'none'}" for shell in shells) - reply = claude_reply(effects.claude, ["--json-schema", json.dumps(SCHEMA), *rung.flags(), "--tools", ""], root, PROMPT + "\n" + evidence, "the stuck check") + reply = claude_reply(effects.claude, ["--json-schema", json.dumps(SCHEMA), *rung.flags(), "--tools", "", "--strict-mcp-config"], root, PROMPT + "\n" + evidence, "the stuck check") if isinstance(reply, Limited): return Failure(f"claude hit a limit: {reply.said}") if isinstance(reply, Failure): diff --git a/bin/agent_cycle/test_judge.py b/bin/agent_cycle/test_judge.py index fdf8ffb3..e49d8e24 100644 --- a/bin/agent_cycle/test_judge.py +++ b/bin/agent_cycle/test_judge.py @@ -139,6 +139,11 @@ class JudgePrompt(unittest.TestCase): """What the judge of a-driver reads of a transcript holding entries.""" return judge.Brief("Do it.", "## Goals", records, "the project's decisions", answer_destinations, kinds(*entries), escalated_at, "a-driver") + def test_runs_with_no_tools_and_loads_no_mcp_server(self): + args = judge.judge_args(Rung("claude-opus-5-5", "medium"), "a-driver") + self.assertEqual(args[args.index("--tools") + 1 :], ["", "--strict-mcp-config"]) + self.assertNotIn("--mcp-config", args) + def test_shows_the_transcripts_tail_and_returns_what_it_showed(self): entries = [assistant({"type": "text", "text": "old " + "x" * judge.JUDGE_PROMPT_CHARS}), assistant({"type": "text", "text": "new"})] prompt, grounds = judge.judge_prompt(self.brief(entries, 0)) diff --git a/bin/agent_cycle/test_stuck_workers.py b/bin/agent_cycle/test_stuck_workers.py index ac943804..4d47325f 100644 --- a/bin/agent_cycle/test_stuck_workers.py +++ b/bin/agent_cycle/test_stuck_workers.py @@ -47,7 +47,7 @@ class StuckWorkers(unittest.TestCase): streamed, fake, said, _, record = self.worker_with(ASSISTANT, None, None, None, held=[shell()], replies=[verdict()]) [(args, prompt)] = fake.made("claude") self.assertEqual(args[args.index("--model") + 1 :][:3], ["claude-opus-5-5", "--effort", "medium"]) - self.assertEqual(args[args.index("--tools") + 1], "") + self.assertEqual(args[args.index("--tools") + 1 :][:2], ["", "--strict-mcp-config"]) self.assertEqual(json.loads(args[args.index("--json-schema") + 1])["properties"]["verdict"]["enum"], ["working", "waiting on a person", "stuck"]) self.assertTrue(prompt.endswith("\n\nShell 7: bin/run-tests\nIts processes, as pid, state, CPU and command line:\n8 S 2.0 s python3 -m pytest\n9 S 0.0 s sh -c trap '' INT; sleep 999\nThe end of its output:\ncollected 40 items")) line = "stuck check: a headless claude judged the worker stuck, naming process 8 (python3 -m pytest): pytest waits on a shell that ignores SIGINT" + sign(1600, 1600) diff --git a/bin/do_epic/issue_scores.py b/bin/do_epic/issue_scores.py index ba904a9f..96e63331 100644 --- a/bin/do_epic/issue_scores.py +++ b/bin/do_epic/issue_scores.py @@ -33,7 +33,7 @@ class Scores: def asked(issue: EpicIssue, rule: str, goals: str, language: str, rung: Rung, claude: Claude, cwd: str) -> Scores | Failure | Limited: """The scores claude gives the issue. rule is the text every plan item is scored by, and goals says which goals the issue may move and how to name each. Nothing is written: the caller checks the answer against the plan's format and sets it.""" - reply = claude_reply(claude, ["--json-schema", json.dumps(SCHEMA), *rung.flags(), "--tools", ""], cwd, prompt(issue, rule, goals, language), "the scoring") + reply = claude_reply(claude, ["--json-schema", json.dumps(SCHEMA), *rung.flags(), "--tools", "", "--strict-mcp-config"], cwd, prompt(issue, rule, goals, language), "the scoring") return reply if isinstance(reply, Failure | Limited) else answer_of(structured_output(reply)) diff --git a/bin/do_epic/repo_pick.py b/bin/do_epic/repo_pick.py index ad2c1ae9..35711923 100644 --- a/bin/do_epic/repo_pick.py +++ b/bin/do_epic/repo_pick.py @@ -102,7 +102,7 @@ def picked(store: EpicStore, issue: EpicIssue, team: LabelRepos, rule: str, rung known = recorded(issue, team) if known is not None: return known - reply = claude_reply(claude, ["--json-schema", json.dumps(PICK_SCHEMA), *rung.flags(), "--tools", ""], cwd, prompt(rule, issue), "the repo pick") + reply = claude_reply(claude, ["--json-schema", json.dumps(PICK_SCHEMA), *rung.flags(), "--tools", "", "--strict-mcp-config"], cwd, prompt(rule, issue), "the repo pick") if isinstance(reply, Failure | Limited): return reply answer = answer_of(structured_output(reply)) diff --git a/bin/do_epic/split.py b/bin/do_epic/split.py index 0b969be3..2e587f91 100644 --- a/bin/do_epic/split.py +++ b/bin/do_epic/split.py @@ -123,7 +123,7 @@ def finished(issues: list[EpicIssue], key: str) -> bool: def prediction(issue: EpicIssue, by_person: bool, rule: str, language: str, checkouts: tuple[str, ...], rung: Rung, claude: Claude, cwd: str) -> Prediction | Failure | Limited: """The repos claude predicts the item changes, from the code in checkouts.""" - flags = ["--json-schema", json.dumps(SPLIT_SCHEMA), *rung.flags(), "--tools", "Read,Grep,Glob", *(arg for each in checkouts for arg in ("--add-dir", each))] + flags = ["--json-schema", json.dumps(SPLIT_SCHEMA), *rung.flags(), "--tools", "Read,Grep,Glob", "--strict-mcp-config", *(arg for each in checkouts for arg in ("--add-dir", each))] reply = claude_reply(claude, flags, cwd, prompt(issue, by_person, rule, language, checkouts), "the repo split") return reply if isinstance(reply, Failure | Limited) else answer_of(structured_output(reply)) diff --git a/bin/do_epic/test_issue_scores.py b/bin/do_epic/test_issue_scores.py index e6af3ba9..51e289ac 100644 --- a/bin/do_epic/test_issue_scores.py +++ b/bin/do_epic/test_issue_scores.py @@ -53,7 +53,7 @@ class TheCall(unittest.TestCase): self.assertEqual(self.ask(claude), answer_of(ANSWER)) args, cwd, _ = claude.calls[0] self.assertEqual(cwd, "/state/scoring") - self.assertEqual(args[:9], ["-p", "--json-schema", json.dumps(SCHEMA), "--model", "claude-sonnet-5-5", "--effort", "medium", "--tools", ""]) + self.assertEqual(args[:10], ["-p", "--json-schema", json.dumps(SCHEMA), "--model", "claude-sonnet-5-5", "--effort", "medium", "--tools", "", "--strict-mcp-config"]) def test_names_the_scoring_where_claude_fails(self) -> None: failed = self.ask(Claude("", 1)) diff --git a/bin/do_epic/test_repo_pick.py b/bin/do_epic/test_repo_pick.py index a34beadd..d43119ee 100644 --- a/bin/do_epic/test_repo_pick.py +++ b/bin/do_epic/test_repo_pick.py @@ -57,7 +57,7 @@ class RepoPick(unittest.TestCase): self.pick(claude) args, cwd, _ = claude.calls[0] self.assertEqual(cwd, "/rules") - self.assertEqual(args[:9], ["-p", "--json-schema", json.dumps(PICK_SCHEMA), "--model", "claude-sonnet-5-5", "--effort", "medium", "--tools", ""]) + self.assertEqual(args[:10], ["-p", "--json-schema", json.dumps(PICK_SCHEMA), "--model", "claude-sonnet-5-5", "--effort", "medium", "--tools", "", "--strict-mcp-config"]) def test_puts_the_rule_and_the_item_in_the_prompt(self) -> None: claude = says({"pick": "claude"}) diff --git a/bin/do_epic/test_split.py b/bin/do_epic/test_split.py index f1c24599..fd4b9250 100644 --- a/bin/do_epic/test_split.py +++ b/bin/do_epic/test_split.py @@ -156,8 +156,8 @@ class Split_(unittest.TestCase): self.run_split(claude) args, cwd, prompt = claude.calls[0] self.assertEqual(cwd, "/rules") - self.assertEqual(args[:12], ["-p", "--json-schema", json.dumps(SPLIT_SCHEMA), "--model", "claude-sonnet-5-5", "--effort", "medium", "--tools", "Read,Grep,Glob", "--add-dir", "/repos/api", "--add-dir"]) - self.assertEqual(args[12], "/repos/web") + self.assertEqual(args[:13], ["-p", "--json-schema", json.dumps(SPLIT_SCHEMA), "--model", "claude-sonnet-5-5", "--effort", "medium", "--tools", "Read,Grep,Glob", "--strict-mcp-config", "--add-dir", "/repos/api", "--add-dir"]) + self.assertEqual(args[13], "/repos/web") self.assertIn(RULE, prompt) self.assertIn("## Item ABC-100: Count the runs.", prompt) self.assertIn("write each part's change in Swedish.", prompt) diff --git a/bin/review_replay/replay.py b/bin/review_replay/replay.py index 8e3606f7..5fb1a544 100644 --- a/bin/review_replay/replay.py +++ b/bin/review_replay/replay.py @@ -191,7 +191,7 @@ def match(findings: tuple[str, ...], replay_report: str, root: str, rung: Rung, "A finding it raises only as 🟢 or ❓, or not at all, is not listed.\n\n" f"The findings:\n{numbered}\n\nThe other report:\n{replay_report}" ) - args = ["--json-schema", json.dumps(MATCH_SCHEMA), *rung.flags(), "--tools", ""] + args = ["--json-schema", json.dumps(MATCH_SCHEMA), *rung.flags(), "--tools", "", "--strict-mcp-config"] reply = claude_reply(effects.claude, args, root, prompt, "claude") if isinstance(reply, Failure | Limited): return reply diff --git a/bin/review_replay/test_review_replay.py b/bin/review_replay/test_review_replay.py index 97c9ce1f..9b586428 100644 --- a/bin/review_replay/test_review_replay.py +++ b/bin/review_replay/test_review_replay.py @@ -179,7 +179,7 @@ class Match(unittest.TestCase): self.assertEqual(cwd, "/code/p") self.assertIn("1. 🔴 a\n\n2. 🟡 b\n\nThe other report:\nthe other report", prompt) self.assertEqual(json.loads(args[args.index("--json-schema") + 1]), replay.MATCH_SCHEMA) - self.assertEqual(args[args.index("--tools") + 1], "") + self.assertEqual(args[args.index("--tools") + 1 :][:2], ["", "--strict-mcp-config"]) self.assertEqual(args[args.index("--model"):args.index("--model") + 4], REFERENCE.flags()) def test_takes_the_numbers_in_range_and_fails_on_a_reply_of_another_shape(self):