Add executor tool loop (A12/A15) — step 5b
- tools.py: four flat tools (read_file, write_file, list_dir, run_command) per A15's reduced manifest. Deliberately unsandboxed: the VM is the trust boundary (B3) and tool use is auto-approved inside an approved unit of work (A4), so path confinement would add failure modes without adding safety. What is enforced is operational — timeout with process-group kill so a backgrounded server cannot outlive its command, output truncation so a build log cannot eat the context window, closed stdin so prompts fail fast, and a scrubbed environment so project code never sees the agent's credentials - executor.py: renders the log, calls the executor role with the reduced manifest, dispatches tool calls, and checkpoints every result (A13). Escalation is observable, never self-assessed (A12): consecutive command failures and a hard turn cap. Failed reads do not count — looking around is not failing - Until delegation exists (step 7), escalation gates to the human with the failures attached - control.py: start milestone now runs the executor; a stopped milestone gates to AWAIT_INPUT Two bugs found by running it live against real models: - A turn-ending gate tool (submit_plan) left a tool_call with no tool_result, which providers reject outright, so every planning turn after the first failed with a 400. The planner now records the gate as the call's outcome, which is also the truthful transcript - The renderer now emits a placeholder for any tool_call lacking a result, so a crash between call and result (A3) cannot poison the transcript permanently Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
47b2bdfdbd
commit
0fd0b2e4a5
10 files changed
+784
-5
No files matched your search
@@ -108,7 +108,18 @@ def test_model_output_is_appended_to_the_log(store: StateStore) -> None:
|
||||
)
|
||||
LLMPlanningAgent(client, store, ROLES).plan("arch", "demo")
|
||||
kinds = [type(e.event).__name__ for e in store.read_events()]
|
||||
assert kinds == ["AssistantText", "ToolCall"]
|
||||
assert kinds == ["AssistantText", "ToolCall", "ToolResult"]
|
||||
|
||||
|
||||
def test_gate_tool_call_is_answered_in_the_log(store: StateStore) -> None:
|
||||
# submit_plan ends the turn and has no natural result, but a tool call
|
||||
# left dangling makes the next render invalid for the provider.
|
||||
client = ScriptedClient([[plan_call("the plan")]])
|
||||
LLMPlanningAgent(client, store, ROLES).plan("arch", "demo")
|
||||
events = [e.event for e in store.read_events()]
|
||||
assert [type(e).__name__ for e in events] == ["ToolCall", "ToolResult"]
|
||||
assert events[1].call_id == events[0].call_id
|
||||
assert "posted for approval" in events[1].result
|
||||
|
||||
|
||||
def test_prose_only_turn_retries_once_then_raises(store: StateStore) -> None:
|
||||
@@ -170,7 +181,13 @@ def test_use_project_produces_llm_plan_and_transcript(tmp_path: Path) -> None:
|
||||
|
||||
events = [e.event for e in store.read_events()]
|
||||
kinds = [type(e).__name__ for e in events]
|
||||
assert kinds == ["UserMessage", "ToolCall", "PlanSubmitted", "GateOpened"]
|
||||
assert kinds == [
|
||||
"UserMessage",
|
||||
"ToolCall",
|
||||
"ToolResult",
|
||||
"PlanSubmitted",
|
||||
"GateOpened",
|
||||
]
|
||||
submitted = next(e for e in events if isinstance(e, PlanSubmitted))
|
||||
assert submitted.model == "anthropic/claude-opus-5" # pinned planner
|
||||
|
||||
|
||||
Reference in new issue
Block a user