Expand description
Deterministic, offline “echo” LLM client for #2056’s mandatory offline testability (no live model, no API key).
Why: task execution needs a live LLM in production, but the e2e/CI suite
must exercise the FULL flow (create -> attach -> run -> live tool events
-> done) without one. Setting TCODE_MOCK_LLM=echo (checked by
build_llm_client) swaps this deterministic client in for the real
LlmClient — the daemon still starts and serves ping/health/
session.* fine with neither set; only task.run needs one or the
other.
What: EchoLlmClient replays a FIXED script exercising exactly the
shape #2056 wires: the PM delegates once to python-engineer, which
runs one bash tool call then stops, after which the PM sees the result
and stops too. This is production code (not #[cfg(test)]) because the
REAL tcode binary, spawned as a subprocess in tests/task_e2e.rs, must
be able to construct it with no test harness in scope.
Test: task::mock_llm::tests::*; exercised end-to-end (as a real
subprocess) by tests/task_e2e.rs.
Structs§
- Echo
LlmClient - A deterministic, scripted
LlmClientTraitfor offline task-execution testing (#2056).
Constants§
- MOCK_
LLM_ ECHO - The
TCODE_MOCK_LLMvalue that selectsEchoLlmClient. - MOCK_
LLM_ ENV - Environment variable selecting the mock LLM. Set to
MOCK_LLM_ECHOto enableEchoLlmClientinstead of a real OpenRouter client.
Functions§
- build_
llm_ client - Build the
Arc<dyn LlmClientTrait>task.runexecutions share.