diff --git a/src/agent/claude-code/live-processes.ts b/src/agent/claude-code/live-processes.ts index f5e24b3..61f036a 100644 --- a/src/agent/claude-code/live-processes.ts +++ b/src/agent/claude-code/live-processes.ts @@ -1,7 +1,8 @@ export type LiveProcess = { toolCallIds: string[]; kill(): void }; -// pi runs a message's tools (each capped at 30s by tool-execute) and calls back well within this; -// it stays under MCP_TOOL_TIMEOUT so an orphaned process is killed before the CLI gives up on its own. +// Tools usually call back within seconds, but a question tool holds its call until the learner +// answers. Past this, the process is killed and the answer starts a fresh one with a full replay. +// It stays under MCP_TOOL_TIMEOUT so the process is killed before the CLI gives up on its own. export const LIVE_PROCESS_IDLE_TIMEOUT_MS = 10 * 60_000; /** Test seam (runner.ts's pdfModelOverride idiom). */ diff --git a/src/agent/claude-code/stream.ts b/src/agent/claude-code/stream.ts index 919561a..0f9dd4d 100644 --- a/src/agent/claude-code/stream.ts +++ b/src/agent/claude-code/stream.ts @@ -36,8 +36,9 @@ type RunClaudeOptions = { cwd: string; env: NodeJS.ProcessEnv }; export type RunClaude = (args: string[], options: RunClaudeOptions) => ChildProcessWithoutNullStreams | null; -// A held MCP call lasts until pi has run every tool of the message (each capped at 30s by -// tool-execute) and called back; this must outlast that so the CLI never times out first. +// A held MCP call lasts until pi calls back with the tool result, which for a question tool is +// whenever the learner answers; this must outlast the live-process idle timeout so the CLI never +// times out first. const MCP_TOOL_TIMEOUT_MS = 30 * 60_000; const PRIVATE_FILE_MODE = 0o600;