Skip to content

fix(session): use adaptive timeout for LLM stream to prevent spurious…#94

Merged
duguwanglong merged 1 commit intomainfrom
fix/adaptive-stream-timeout
Apr 10, 2026
Merged

fix(session): use adaptive timeout for LLM stream to prevent spurious…#94
duguwanglong merged 1 commit intomainfrom
fix/adaptive-stream-timeout

Conversation

@duguwanglong
Copy link
Copy Markdown
Contributor

Some models (e.g. minimax-m2.7) pause for extended periods between reasoning and content generation phases during streaming. The previous fixed 60s inter-chunk timeout caused repeated TimeoutErrors mid-stream, making the agent unable to complete tasks like writing analysis reports.

Replace the single LLM_STREAM_CHUNK_TIMEOUT_S with two-phase timeouts:

  • first chunk: 60s (unchanged, guards against unresponsive models)
  • ongoing chunks: 300s (relaxed, tolerates long mid-stream pauses)

… failures

Some models (e.g. minimax-m2.7) pause for extended periods between
reasoning and content generation phases during streaming. The previous
fixed 60s inter-chunk timeout caused repeated TimeoutErrors mid-stream,
making the agent unable to complete tasks like writing analysis reports.

Replace the single LLM_STREAM_CHUNK_TIMEOUT_S with two-phase timeouts:
- first chunk: 60s (unchanged, guards against unresponsive models)
- ongoing chunks: 300s (relaxed, tolerates long mid-stream pauses)

The error message now includes the phase (waiting for first response /
mid-stream) for easier debugging.

Made-with: Cursor
@duguwanglong duguwanglong requested a review from Jieatgit April 10, 2026 13:14
@duguwanglong duguwanglong merged commit fc7eecf into main Apr 10, 2026
2 checks passed
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