fix(pi-claude-cli): bump inactivity timeout from 180s to 300s
Sonnet 4.6 with extended thinking on the triage prompt (~40k chars + AGENTS.md + skills) can take >3 minutes between thinking deltas. The 180s inactivity timeout was killing those subprocesses before they could finish PROMPT.md + fn_review_spec, leaving triage looping into the fallback model. Bump to 5 minutes. Test mock timings updated to match. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1292,7 +1292,7 @@ describe("streamViaCli", () => {
|
||||
});
|
||||
|
||||
describe("inactivity timeout", () => {
|
||||
it("kills subprocess and pushes error after 180s of no output", async () => {
|
||||
it("kills subprocess and pushes error after 300s of no output", async () => {
|
||||
const model = mockModels[0] as any;
|
||||
const context = {
|
||||
messages: [{ role: "user", content: "Hello" }],
|
||||
@@ -1303,8 +1303,8 @@ describe("streamViaCli", () => {
|
||||
|
||||
const proc = (spawn as any).mock.results[0].value;
|
||||
|
||||
// Advance timers by 180 seconds without writing to stdout
|
||||
await vi.advanceTimersByTimeAsync(180_000);
|
||||
// Advance timers by 300 seconds without writing to stdout
|
||||
await vi.advanceTimersByTimeAsync(300_000);
|
||||
|
||||
const mockStream = MockAssistantMessageEventStream.mock.instances[0];
|
||||
const doneEvent = mockStream._events.find(
|
||||
@@ -1330,8 +1330,8 @@ describe("streamViaCli", () => {
|
||||
|
||||
const proc = (spawn as any).mock.results[0].value;
|
||||
|
||||
// Advance to 170s then write a line
|
||||
await vi.advanceTimersByTimeAsync(170_000);
|
||||
// Advance to 290s then write a line (just under the 300s cap)
|
||||
await vi.advanceTimersByTimeAsync(290_000);
|
||||
|
||||
// Write a stream event line
|
||||
proc.stdout.write(
|
||||
@@ -1345,8 +1345,8 @@ describe("streamViaCli", () => {
|
||||
);
|
||||
await vi.advanceTimersByTimeAsync(0);
|
||||
|
||||
// Advance another 170s (340s total, 170s since last line) -- should NOT timeout
|
||||
await vi.advanceTimersByTimeAsync(170_000);
|
||||
// Advance another 290s (580s total, 290s since last line) -- should NOT timeout
|
||||
await vi.advanceTimersByTimeAsync(290_000);
|
||||
|
||||
const mockStream = MockAssistantMessageEventStream.mock.instances[0];
|
||||
const doneEvent = mockStream._events.find(
|
||||
@@ -1354,7 +1354,7 @@ describe("streamViaCli", () => {
|
||||
);
|
||||
expect(doneEvent).toBeUndefined();
|
||||
|
||||
// Advance 10 more seconds (180s since last line) -- NOW should timeout
|
||||
// Advance 10 more seconds (300s since last line) -- NOW should timeout
|
||||
await vi.advanceTimersByTimeAsync(10_000);
|
||||
|
||||
const doneEvent2 = mockStream._events.find(
|
||||
@@ -1401,7 +1401,7 @@ describe("streamViaCli", () => {
|
||||
await vi.advanceTimersByTimeAsync(100);
|
||||
|
||||
// Advance past 180s -- should NOT timeout since result was received
|
||||
await vi.advanceTimersByTimeAsync(180_000);
|
||||
await vi.advanceTimersByTimeAsync(300_000);
|
||||
|
||||
const mockStream = MockAssistantMessageEventStream.mock.instances[0];
|
||||
const errorEvents = mockStream._events.filter(
|
||||
|
||||
@@ -44,8 +44,14 @@ import { createEventBridge } from "./event-bridge.js";
|
||||
import { handleControlRequest } from "./control-handler.js";
|
||||
import { mapThinkingEffort } from "./thinking-config.js";
|
||||
import { isPiKnownClaudeTool } from "./tool-mapping.js";
|
||||
/** Inactivity timeout: kill subprocess if no stdout for 180 seconds (3 minutes). */
|
||||
const INACTIVITY_TIMEOUT_MS = 180_000;
|
||||
/**
|
||||
* Inactivity timeout: kill the Claude CLI subprocess if no stdout arrives
|
||||
* for this long. Sonnet 4.6 with extended thinking on large system prompts
|
||||
* (e.g. the triage prompt + AGENTS.md + skill blocks ~ 40k chars) can take
|
||||
* minutes between thinking deltas; a 3-minute timeout was killing those
|
||||
* sessions before they could call fn_review_spec. Bump to 5 minutes.
|
||||
*/
|
||||
const INACTIVITY_TIMEOUT_MS = 300_000;
|
||||
|
||||
/** Extended stream options: pi's SimpleStreamOptions plus optional cwd and mcpConfigPath */
|
||||
type StreamViaCLiOptions = SimpleStreamOptions & {
|
||||
|
||||
Reference in New Issue
Block a user