fix(mcp): make OAuth server connections non-blocking at startup#2281
Merged
fix(mcp): make OAuth server connections non-blocking at startup#2281
Conversation
OAuth MCP servers blocked agent startup for up to 300 s because connect_all() awaited the OAuth callback before the TUI was ready, causing the auth URL to never be displayed. - Extract OAuth Phase 2 from connect_all() into connect_oauth_deferred() - connect_all() now only connects non-OAuth servers (fast path) - connect_oauth_deferred() runs as a background task after TUI/channel is initialised, auto-opens the browser via open::that_in_background(), awaits the callback, and publishes tools via tools_watch_tx - Add has_oauth_servers() predicate on McpManager - Add open = "5" workspace dependency for cross-platform browser launch - CLI fallback: eprintln prints the auth URL when no status_tx present Fixes #2276
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
connect_all()intoconnect_oauth_deferred()incrates/zeph-mcp/src/manager.rsconnect_all()now only connects non-OAuth servers (fast, no blocking)connect_oauth_deferred()runs as a background task spawned insrc/runner.rsafter TUI/channel is initialisedopen::that_in_background()before awaiting callbackeprintlnprints auth URL when nostatus_txis presenttools_watch_txon success — picked up automatically by the agent loopopen = "5"workspace dependency for cross-platform browser launchFixes
Fixes #2276
Test plan
cargo clippy --workspace --features full -- -D warnings— cleancargo nextest run --config-file .github/nextest.toml --workspace --features full --lib --bins— 6821 passed