Skip to content

Fixes timeout again.#10

Merged
MicahZoltu merged 1 commit into
mainfrom
micah
Jun 23, 2026
Merged

Fixes timeout again.#10
MicahZoltu merged 1 commit into
mainfrom
micah

Conversation

@MicahZoltu

Copy link
Copy Markdown
Member

Agent was using features that aren't even released yet.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread source/agent-loop.mts

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> {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
@MicahZoltu

Copy link
Copy Markdown
Member Author

/review

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI Agent Review

No issues found across all agent reviews.

@MicahZoltu MicahZoltu merged commit 5c128db into main Jun 23, 2026
2 checks passed
@MicahZoltu MicahZoltu deleted the micah branch June 23, 2026 12:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant