Expand description
tcode run-task end-to-end execution layer (#1034, #1035).
Why: This is the orchestration closer that makes the tcode binary run a task
for real — load project context, assemble the PM prompt, run the PM loop, let
it delegate to the engineer in-process, capture the diff + transcript + usage,
and render a human or JSON report with meaningful exit codes. The LLM client is
injected so the whole path is testable offline with a scripted mock.
What: RunTaskParams, execute_run_task, RunReport, ExitCode, and the
transcript types (TurnRecord, SharedTranscript, RecordingLlmClient).
Test: run_task::tests::* (all offline, mocked LLM).
tcode run-task end-to-end execution (#1034, #1035).
Why: This is the closer that makes the tcode binary actually run a task. It
wires every M1 piece together: load the project CLAUDE.md context (#1033),
assemble the PM system prompt, run the PM through an AgentLoop against the
real (or mocked) LlmClient, let the PM delegate to the python-engineer via
the DelegateToAgentTool + InProcessAgentRunner, and have the engineer run
its own loop with fs/bash tools scoped to the project. The run captures a diff
of the working tree, the PM+engineer transcript, and aggregated token/cost
usage, then renders both a human and a JSON report with meaningful exit codes.
What: RunTaskParams carries the CLI inputs; execute_run_task is the async
orchestrator returning a RunReport. The LLM client is injected so production
passes a real LlmClient and tests pass a scripted mock — no live key needed.
Test: run_task::tests drive the whole PM→engineer path offline.
Structs§
- Recording
LlmClient - A transparent
LlmClientTraitthat records each turn into a shared transcript. - Redelegation
CapSignal - Shared signal tracking total re-delegation attempts across one run (#2265).
- RunReport
- The full result of a
run-taskinvocation, ready to render. - RunTask
Params - Inputs to a single
run-taskinvocation, parsed from the CLI. - Turn
Record - One recorded assistant turn for the run transcript.
Enums§
- Exit
Code - Distinct process exit codes for a
run-taskinvocation.
Constants§
- MAX_
REDELEGATIONS - Maximum total engineer delegation attempts for a single
execute_run_taskrun, shared across everydelegate_to_agentcall the PM makes (#2265).
Functions§
- aggregate_
usage_ per_ role - Sum every transcript turn’s usage, pricing EACH turn against its OWN role’s resolved model rather than blending the whole transcript under one model (#1475 bug 1 fix).
- execute_
run_ task - Execute a
run-taskend-to-end and return the rendered report. - resolve_
agent_ model_ slug - Resolve an agent’s model slug, honouring an optional per-run override (#1035, #1475 bug 1 fix’s prerequisite).
Type Aliases§
- Shared
Transcript - Shared, thread-safe transcript accumulator.