Skip to content

fix(agents): Propagate streamed initialization errors - #294

Open
Gujiassh wants to merge 1 commit into
TencentCloudADP:mainfrom
Gujiassh:fix/stream-initialization-errors
Open

Gujiassh wants to merge 1 commit into
TencentCloudADP:mainfrom
Gujiassh:fix/stream-initialization-errors

Conversation

@Gujiassh

Copy link
Copy Markdown

Summary

Fixes #293.

Move SimpleAgent initialization into the existing streaming exception/completion handler. When environment or MCP startup fails asynchronously, a consumer waiting for events now receives the original exception instead of waiting indefinitely.

Add regression coverage for delayed initialization failures, a real failing stdio MCP subprocess, initialized and uninitialized successful streams, and runner errors. The public API, emitted events and saved conversation history remain unchanged.

Validation

  • pytest tests/agents/test_simple_agent_streaming.py tests/agents/test_common.py -q — 6 passed.
  • The two startup-failure regressions fail on unmodified main and pass with the fix.
  • A real Python MCP child exiting with code 3 now completes the consumer with the same McpError as the producer, without making a model request.
  • Ruff lint and format checks pass for both changed files.

This branch has not been deployed

No deployments
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.

run_streamed hangs when MCP initialization fails

1 participant