Fixes timeout again.#10
Conversation
There was a problem hiding this comment.
CI Agent Review
Reducing idleTimeoutMilliseconds from 300,000 to 240,000 breaks a cross-file invariant with MAX_SINGLE_WAIT_MILLISECONDS in source/ai.mts (also 240,000). The comment in ai.mts states this constant must "stay under" the agent-loop idle timeout, and previously 240,000 < 300,000 satisfied that. Now the values are equal, eliminating the safety margin. A retry delay capped at 240,000ms with high jitter can exceed the remaining idle timer (which has already been ticking since the start of the turn), causing an abort during the retry sleep. The stale comment in ai.mts still references "300s" and no longer reflects reality.
|
|
||
| export async function* agentLoop(dependencies: { fetch: Fetch }, model: string, messages: readonly CompletionsMessage[], tools: readonly Tool[], profile: ProviderProfile, signal?: AbortSignal, outputValidator?: OutputValidator, idleTimeoutMilliseconds: number = 300_000): AsyncGenerator<AgentLoopEvent, AgentLoopResult> { | ||
| // Must stay below BUN_CONFIG_HTTP_IDLE_TIMEOUT in Dockerfile so this non-throwing retry fires before Bun's socket timer throws a DOMException. | ||
| export async function* agentLoop(dependencies: { fetch: Fetch }, model: string, messages: readonly CompletionsMessage[], tools: readonly Tool[], profile: ProviderProfile, signal?: AbortSignal, outputValidator?: OutputValidator, idleTimeoutMilliseconds: number = 240_000): AsyncGenerator<AgentLoopEvent, AgentLoopResult> { |
There was a problem hiding this comment.
Cross-file invariant violation: the new default of 240,000ms is equal to MAX_SINGLE_WAIT_MILLISECONDS in source/ai.mts (line 48), breaking the documented constraint that it must "stay under" the idle timeout. Previously 240,000 < 300,000 gave a 60s safety margin; now there is 0s margin. A retry sleep at the max cap with high jitter can exceed the remaining idle timer, causing an abort during the retry sleep. Either idleTimeoutMilliseconds should remain above 240,000 (e.g., 300,000), or MAX_SINGLE_WAIT_MILLISECONDS should be reduced below 240,000 to restore the strict-less-than invariant. The comment in ai.mts also still references "300s" and is now stale.
Agent was using features that aren't even released yet.
|
/review |
Agent was using features that aren't even released yet.