fix: refresh connector tools between turns in existing sessions - #663
Open
apoorvgarg31 wants to merge 1 commit into
Open
apoorvgarg31 wants to merge 1 commit into
apoorvgarg31 wants to merge 1 commit into
Conversation
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
Fixes #662.
Refresh connector and MCP tool selection before a new turn, retry, or durable resume. This lets an existing chat pick up a newly connected account or MCP server without restarting the application or replacing its worker.
The source diff is limited to four backend files and one regression-test file. No UI, dependency, database, or deployment changes.
Reproduction and tests
Tested against upstream
5bc10d928e0b64aae74313349a3b17bd19643ae2with Python 3.12 and Node 20, matching the repository CI versions.pytest tests/test_connection_refresh.py -q: 15 passed.pytest tests -q: 1,970 passed, 1 skipped.npm test: 181 passed.npm run e2e: 221 passed.npm run buildandgit diff --check: passed.The new tests include a continuously open real-backend WebSocket for both manual connection and the managed OAuth callback, disconnect/re-enable, tool/chat/persona restrictions, pending questions, background turns, retry/resume, unrelated tool preservation, and refresh failure. A real local stdio MCP server is discovered, approved, and executed after the original session has started.
GitHub CI: the upstream workflow is awaiting maintainer approval before it can run.
These are local macOS results, not a claim that GitHub CI or packaged Desktop acceptance has already passed. Upstream's existing Playwright suite uses mocked HTTP/WebSocket endpoints; the real-backend same-socket case is covered separately by the new Python test.
Before / after screenshots
As requested by the README contribution guidance. Settings connection screenshots and reproduction details are in #662.
Before: the account is connected, but the original chat's next turn still lacks Outlook search.
After: the next turn receives Outlook search and the earlier messages remain.
The screenshots use the actual upstream UI/backend and a clearly labelled deterministic diagnostic provider that reports the actual received tool schema. External identity validation is stubbed; identities/tokens are synthetic. They do not claim live Outlook OAuth or model acceptance. Images are hosted at an immutable commit on a separate evidence branch in the contributor fork, keeping binary assets out of this PR's source diff.
Scope / limitations
This is a next-turn refresh, not immediate mid-turn revocation or cancellation redesign. It intentionally does not interrupt an already-running operation. It does not force a remote MCP
tools/liston every turn, or add a new MCP transport/config reload mechanism; existing explicit reconnect/discovery behavior remains authoritative. No live external OAuth account or packaged Desktop build was used for this acceptance.