Conversation
…rtup race - Exclude bookkeeping events (pending_messages.modified, session.start, session.info) from resetting the idle clock so the watchdog can detect hangs during stuck MCP initialization. - Add a hard wall-clock max_session_seconds limit (default 30 min) that terminates sessions even when non-idle events keep flowing. - Protect _ensure_client_started() with an asyncio.Lock to prevent concurrent for-each items from racing to start the subprocess twice. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ace PR - Extract _IDLE_IGNORED_EVENTS to module-level frozenset to avoid per-event set allocation inside on_event() callback - Change is_retryable to False on wall-clock timeout ProviderError to prevent retrying sessions that will hit the same root cause - Remove redundant pre-lock `if not self._started` guard since the internal lock already handles the fast path - Add time-since-last-event to session timeout error for diagnostics - Document wall-clock check granularity (max ≈ max_session + idle_timeout) - Broaden _ensure_client_started docstring to cover parallel groups - Update Raises docstring for wall-clock timeout path - Add 10 new tests: _IDLE_IGNORED_EVENTS membership, session timeout behavior, and concurrent _ensure_client_started race safety Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Change idle_timeout_seconds from 60s to 0.05s in test_session_timeout_fires_even_with_flowing_events so the loop iterates quickly instead of blocking for a full minute (62s → 2s) - Add missing is_retryable assertion to flowing-events timeout test - Fix misleading "fast-path" comment on _ensure_client_started call Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This was referenced Mar 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
pending_messages.modified,session.start,session.info) from resetting the idle clock, so the watchdog can properly detect hangs during stuck MCP initialization.max_session_secondslimit (default 30 min) toIdleRecoveryConfigthat terminates sessions even when non-idle events keep flowing indefinitely._ensure_client_started()with anasyncio.Lockto prevent concurrent for-each items from racing to start the same client subprocess multiple times.Test plan
pending_messages.modifiedevents are flowingmax_session_secondsare terminated with a descriptiveProviderErroruv run pytest tests/test_providers/🤖 Generated with Claude Code