feat(ack): support project agent routing overrides
This commit is contained in:
@@ -432,6 +432,80 @@ class EnvironmentAndExecutableTests(unittest.TestCase):
|
||||
|
||||
|
||||
class PlanTests(unittest.TestCase):
|
||||
def test_agents_yaml_overrides_board_routing_and_binds_hash(self) -> None:
|
||||
with tempfile.TemporaryDirectory() as temporary:
|
||||
project = Path(temporary).resolve()
|
||||
ack_dir = project / ".pouch" / "ack"
|
||||
ack_dir.mkdir(parents=True)
|
||||
task_board = board(project)
|
||||
agent_routing = {
|
||||
"profileVersion": 1,
|
||||
"mode": "orca",
|
||||
"modelAllowlist": {
|
||||
"pi": {"developer": {"standard": [None]}},
|
||||
"cursor-agent": {"test": {"standard": ["auto"]}},
|
||||
},
|
||||
"profiles": {
|
||||
"pi-dev": {
|
||||
"role": "developer",
|
||||
"cli": "pi",
|
||||
"tier": "standard",
|
||||
"model": None,
|
||||
"reasoningEffort": "medium",
|
||||
"permissionMode": "workspace-write",
|
||||
},
|
||||
"cursor-test": {
|
||||
"role": "test",
|
||||
"cli": "cursor-agent",
|
||||
"tier": "standard",
|
||||
"model": "auto",
|
||||
"reasoningEffort": None,
|
||||
"permissionMode": "workspace-write",
|
||||
},
|
||||
},
|
||||
"defaults": {"developer": "pi-dev", "test": "cursor-test"},
|
||||
}
|
||||
agents_path = ack_dir / "agents.yaml"
|
||||
agents_path.write_text(json.dumps(agent_routing), encoding="utf-8")
|
||||
(ack_dir / "tasks.yaml").write_text(
|
||||
json.dumps(task_board), encoding="utf-8"
|
||||
)
|
||||
executable = project / "pi"
|
||||
executable.write_text("#!/bin/sh\n", encoding="utf-8")
|
||||
executable.chmod(0o700)
|
||||
|
||||
with (
|
||||
mock.patch.object(
|
||||
launch_worker,
|
||||
"capture_worktree_identity",
|
||||
return_value=worktree_identity(project),
|
||||
),
|
||||
mock.patch.object(
|
||||
launch_worker,
|
||||
"resolve_executable",
|
||||
return_value=executable,
|
||||
),
|
||||
mock.patch.object(
|
||||
launch_worker,
|
||||
"run_text",
|
||||
return_value="pi 0.85.1",
|
||||
),
|
||||
):
|
||||
plan = launch_worker.build_plan(
|
||||
project_root_value=str(project),
|
||||
task_id="TASK-001",
|
||||
attempt_id="TASK-001-A1",
|
||||
role="developer",
|
||||
profile_id="pi-dev",
|
||||
worktree_value=str(project),
|
||||
slot=1,
|
||||
)
|
||||
|
||||
self.assertEqual(plan["routingSource"], str(agents_path))
|
||||
self.assertEqual(plan["routingHash"], worker_profiles.canonical_sha256(agent_routing))
|
||||
self.assertEqual(plan["requested"]["model"], None)
|
||||
self.assertEqual(plan["requested"]["argv"], [str(executable), "--thinking", "medium"])
|
||||
|
||||
def test_authoritative_board_is_derived_from_project_root_without_repo_path(self) -> None:
|
||||
with tempfile.TemporaryDirectory() as temporary:
|
||||
project = Path(temporary).resolve()
|
||||
|
||||
Reference in New Issue
Block a user