Keep configs in ~/.config/build-release/ and tool state in ~/.local/state/build-release/, under XDG_* where set
CI / tests (pull_request) Successful in 6m34s
CI / tests (pull_request) Successful in 6m34s
This commit is contained in:
@@ -11,12 +11,13 @@ plan. For a model off the routing ladder, the tool doesn't print anything on std
|
||||
naming the ladder's file, and exits 0; launch the subagent with no model or effort.
|
||||
|
||||
It reads the routing ladder of the project whose checkout it runs in: routing-ladder.json in the
|
||||
folder of the project's config, ~/.claude-projects/<key>/, or else the one this setup ships, as in
|
||||
folder of the project's config, ~/.config/build-release/<key>/, or else the one this setup ships, as in
|
||||
a checkout no config names. build-release --help shows the file's shape.
|
||||
|
||||
Exit 1, saying why, on bad arguments, or where the project's config or its routing ladder is faulty
|
||||
or cannot be read.
|
||||
"""
|
||||
from collections.abc import Mapping
|
||||
import pathlib
|
||||
import re
|
||||
import sys
|
||||
@@ -37,7 +38,7 @@ def agent_args(ladder: Ladder, model: str, likelihood: int, planning: bool = Fal
|
||||
return (project.planning_rung if planning else project.worker_rung)(likelihood).agent_args()
|
||||
|
||||
|
||||
def main(argv: list[str], home: pathlib.Path) -> int:
|
||||
def main(argv: list[str], home: pathlib.Path, env: Mapping[str, str]) -> int:
|
||||
if argv[:1] in (["-h"], ["--help"]):
|
||||
print(__doc__.strip())
|
||||
return 0
|
||||
@@ -47,7 +48,7 @@ def main(argv: list[str], home: pathlib.Path) -> int:
|
||||
print(f"subagent-rung: cannot read the arguments{' ' + ' '.join(argv) if argv else ''}; {USAGE}", file=sys.stderr)
|
||||
return 1
|
||||
model, likelihood = operands
|
||||
file = project_ladder_file(None, home)
|
||||
file = project_ladder_file(None, home, env)
|
||||
ladder = file if isinstance(file, Failure) else read_ladder(file)
|
||||
if isinstance(ladder, Failure):
|
||||
print(f"subagent-rung: {ladder.reason}", file=sys.stderr)
|
||||
|
||||
@@ -39,14 +39,14 @@ class SubagentRung(unittest.TestCase):
|
||||
# On the shipped ladder an L of 1 steps Fable 5.2 down to Opus 5.5, and an L of 4 up to Opus 5.5 at xhigh.
|
||||
self.assertEqual([self.run_tool("claude-fable-5-2", level, cwd=checkout / "nested").stdout for level in ("1", "4")], ["model fable, effort low\n", "model fable, effort max\n"])
|
||||
off = self.run_tool("claude-opus-5-5", "3", cwd=checkout)
|
||||
own = self.home / ".claude-projects" / "acme" / "routing-ladder.json"
|
||||
own = self.home / ".config/build-release" / "acme" / "routing-ladder.json"
|
||||
self.assertEqual((off.returncode, off.stdout, off.stderr), (0, "", f"subagent-rung: claude-opus-5-5 is not on the routing ladder {own}; pass the Agent tool no model or effort\n"))
|
||||
|
||||
def test_exits_1_naming_the_file_where_the_projects_ladder_holds_a_fault(self):
|
||||
checkout = self.project('[{"model": "claude-fable-5-2", "effort": "low"},]')
|
||||
refused = self.run_tool("claude-fable-5-2", "3", cwd=checkout)
|
||||
self.assertEqual((refused.returncode, refused.stdout), (1, ""))
|
||||
self.assertTrue(refused.stderr.startswith(f"subagent-rung: cannot read the routing ladder {self.home / '.claude-projects' / 'acme' / 'routing-ladder.json'}: "), refused.stderr)
|
||||
self.assertTrue(refused.stderr.startswith(f"subagent-rung: cannot read the routing ladder {self.home / '.config/build-release' / 'acme' / 'routing-ladder.json'}: "), refused.stderr)
|
||||
|
||||
def test_prints_the_agent_tools_model_and_effort_for_the_rung_an_l_picks(self):
|
||||
self.assertEqual(main.agent_args(LADDER, "claude-opus-5-5", 3), "model fable, effort low")
|
||||
|
||||
Reference in New Issue
Block a user