You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(mcp): restart a running chat when the host MCP servers it got change - #48785
When you change an MCP server in Orca, for example by turning it off for Claude or signing in to it, chats already running pick up the change on their next message. Before, only new chats did. A chat restarts only when the change touches a server it actually uses.
Files
Added
Deleted
Net
Test
2
$\color{#1a7f37}{\Huge{\mathbf{+}}}$36
$\color{#cf222e}{\Huge{\mathbf{−}}}$2
$\color{#1a7f37}{\Huge{\mathbf{+}}}$34
Prod
10
$\color{#1a7f37}{\Huge{\mathbf{+}}}$253
$\color{#cf222e}{\Huge{\mathbf{−}}}$47
$\color{#1a7f37}{\Huge{\mathbf{+}}}$206
What Changed
Before: with ORCA_MCP_SERVERS=1, a chat's host-list servers were fixed for the life of its agent process. Bot chats were the exception, and only for the bot's own tools.
After: each chat that resolved host servers at launch records, beside the bot's own tools when there are any:
each server's digest: its config plus its saved values or sign-in grant, so a token refresh doesn't count;
the host list's epoch.
launchTools.outdated (no I/O) now checks both epochs.
launchTools.changed rereads the host list only after the epoch moved, meaning Orca wrote the list or signed in to one of its servers. It restarts the chat only if a server the chat got, or would get now, changed. Otherwise it moves the recorded epoch on, so an edit to another workspace's server, or to one the chat left out, never restarts it. Servers can be left out because the agent's own config has that name, the bot's own tool won, or the agent takes no session servers (ACP agents with botToolsOff, or Claude when managed settings refuse --mcp-config).
Handover: the mid-handover refresh (launchToolsRefreshDue) now also asks changed before stopping the child. An unrelated write can't restart a chat in that window.
Sign-in epoch: an Orca sign-in to a host-list server advances the host list's epoch. Bot folders are unchanged.
Credential reads:botToolCredentialsFingerprint is split into per-credential parts, so one store read serves every server.
Why
The agreed contract is that chats relaunch with the new list on their next turn. On main, non-bot sessions recorded nothing and bot sessions recorded only their own folder, so editing a host server never reached a running chat. Comparing the servers each chat got, rather than the whole file's revision, keeps unrelated edits from restarting chats.
Linked Issue
N/A, part of the MCP servers fleet (follow-up to #48707).
Visual Proof
N/A: no UI change. A running chat relaunches on its next turn, the same visible restart bot chats already do when their tools change.
Testing
session-mcp-launch.test.ts, a new state check:
a chat records nothing while the switch is off;
an edit to a server on only in another workspace, or to one the chat left out, marks the chat outdated, changed stays false, and the epoch moves on;
an agent that ignores session servers never changes;
turning off a server the chat got makes changed true.
The bot-tools-file.test.ts revision tests still pass against the new record shape.
check:changed passes. Not run live; the existing retireOutgrownChild path already does the relaunch.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Every added test fails without this change and avoids the test anti-patterns
Performance
With the switch off, nothing new runs. With it on:
a chat's turn checks an in-memory epoch;
the host list and its credential store are reread once per chat, only after Orca writes the list or a sign-in changes;
per-session records are bounded at 2,000 entries.
Risk
Level: Medium
Worst case: a chat restarts once when it didn't need to. That happens when a newly added server's name clashes with the agent's own config; reading every agent's config each turn to avoid it would cost more. Restarts resume the conversation, as bot tool changes already do.
Not seen: edits made to the host-list file outside Orca aren't noticed until Orca next writes the list. The file is Orca's own.
Switch off: with ORCA_MCP_SERVERS unset, nothing is recorded and every path runs as on main.
Bot chats: unchanged, apart from changed also being consulted at handover, where it agrees with outdated for a bot's own tools.
Back out: a plain revert.
AI Disclosure
Review
Agent skill upstream boundary
Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.
Notes
All host-side and in memory. No wire, persistence, platform or mobile change. Remote hosts decide this for their own chats.
Checklist
This PR is small and focused
I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
I stated the risk: what could break, for whom, and how to back it out
Before/after screenshots or videos attached for UI changes, or N/A with reason
Self-reviewed for correctness, security, and performance
Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)
The changes add per-server host MCP digests that include saved credential fingerprints when applicable. Session launch records now track bot and host tools, and change checks compare those records with tools delivered to each session. The delivery loop uses a shared predicate to decide whether a chat's tools are due for refresh. Tests cover host-server changes and ignored delivery, and the blocking-helper baseline is updated.
Merge Risk: Low · up to 6291a
Running chats now refresh their host MCP servers when Orca changes them. Two edge cases can leave a chat on its launch-time servers until it restarts: a host list that was unreadable at launch, and a child that outlives the 2,000-session record limit. Neither is likely to cause serious harm, and both are worth fixing but are low-impact.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the main change: running chats restart when the host MCP servers they received change. The changeset adds launch-time recording of host-list digests and epochs, a changed-check that re…
Description check
The description follows the repository template closely. It has ELI5, What Changed, Why, Linked Issue, Visual Proof, Testing, Performance, Risk, AI Disclosure, Review, Agent skill boundary, Notes, and…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title names the main change: running chats restart when the host MCP servers they received change. The changeset adds launch-time recording of host-list digests and epochs, a changed-check that restarts a chat only when a delivered server changes, and related refresh logic. The title is specific and matches the primary objective. It uses the conventional fix(mcp) prefix and is 72 characters long, which is within a normal title length.
Full details: Description check
Explanation
The description follows the repository template closely. It has ELI5, What Changed, Why, Linked Issue, Visual Proof, Testing, Performance, Risk, AI Disclosure, Review, Agent skill boundary, Notes, and Checklist sections. The What Changed, Why, Performance, and Risk sections are detailed and explain the mechanism and the back-out path. The Linked Issue section says N/A and cites a follow-up to #48707 rather than an actual issue, which the template says outside contributors must link. The AI Disclosure section is empty. The Testing section admits the live run was not done, and the pnpm lint, typecheck, test, and build checklist item is unchecked. The Review section is empty.
Resolution
Optional improvements: state the linked issue explicitly or confirm that the author is a maintainer, fill in the empty AI Disclosure and Review sections, and confirm the pnpm lint, typecheck, test, and build results or note that CI will cover them.
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
Minor · Functional Correctness · Quick win
Keep launch records for children that are still loaded.
launchedTools evicts its oldest entry once 2,000 distinct sessions have a record. The eviction hook is not set. Eviction ignores whether the session's child is still running. A child that a viewer keeps alive can lose its record while still loaded. Its changed and outdated checks then return false, so the child keeps its launch-time tools after a relevant host-server change. The child keeps stale tools until it restarts.
Choose a policy that keeps the record while the child is loaded. Either remove records only when their child closes, or skip evicting loaded children. Keep the bound for records whose child is gone. Add a test that a loaded child still sees a change after 2,001 other launches.
A chat records the host list's servers it resolved at launch, beside a
bot's own tools. After Orca writes the list or signs in to one of its
servers, the chat's next turn relaunches only when one of the servers it
got, or would get now, changed. Edits to servers it left out, or for agents
that take none, move the recorded epoch on without a restart.
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 5b980024-4b87-4767-8dd5-f99c97396ae7
Commits
Reviewing files that changed from the base of the PR and between 0669a12 and 6291a02.
Files selected for processing: 3
config/main-blocking-helper-baseline.txt
src/main/mcp-servers/mcp-host-list-launch.ts
src/main/mcp-servers/session-mcp-launch.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
Minor · Functional Correctness · Heavy lift
A failed host-list read at launch leaves the chat without refresh tracking.
When the host list cannot be read while a chat launches, hostServersFor returns undefined. The non-bot path then returns launched: null, and resolveSessionToolServers deletes the session's record. After the list recovers, sessionLaunchToolsOutdated and sessionLaunchToolsChanged have no epoch to compare, so the chat never refreshes its host servers until it restarts.
A bot chat with host servers enabled has the same gap for its host list. Its host record is null, so host-list changes never make the chat outdated. Its own bot tools still refresh.
The read-failure case needs its own state. It should keep the epoch captured before the read, and it should record that the host baseline is unknown. The next turn should then reread the list and compare. The switch-off case should keep null. The implementation choice for the unknown baseline is open, but it must not be confused with "no servers from Orca."
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
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.
ELI5
When you change an MCP server in Orca, for example by turning it off for Claude or signing in to it, chats already running pick up the change on their next message. Before, only new chats did. A chat restarts only when the change touches a server it actually uses.
What Changed
ORCA_MCP_SERVERS=1, a chat's host-list servers were fixed for the life of its agent process. Bot chats were the exception, and only for the bot's own tools.launchTools.outdated(no I/O) now checks both epochs.launchTools.changedrereads the host list only after the epoch moved, meaning Orca wrote the list or signed in to one of its servers. It restarts the chat only if a server the chat got, or would get now, changed. Otherwise it moves the recorded epoch on, so an edit to another workspace's server, or to one the chat left out, never restarts it. Servers can be left out because the agent's own config has that name, the bot's own tool won, or the agent takes no session servers (ACP agents withbotToolsOff, or Claude when managed settings refuse--mcp-config).launchToolsRefreshDue) now also askschangedbefore stopping the child. An unrelated write can't restart a chat in that window.botToolCredentialsFingerprintis split into per-credential parts, so one store read serves every server.Why
The agreed contract is that chats relaunch with the new list on their next turn. On main, non-bot sessions recorded nothing and bot sessions recorded only their own folder, so editing a host server never reached a running chat. Comparing the servers each chat got, rather than the whole file's revision, keeps unrelated edits from restarting chats.
Linked Issue
N/A, part of the MCP servers fleet (follow-up to #48707).
Visual Proof
N/A: no UI change. A running chat relaunches on its next turn, the same visible restart bot chats already do when their tools change.
Testing
session-mcp-launch.test.ts, a new state check:changedstays false, and the epoch moves on;changedtrue.The
bot-tools-file.test.tsrevision tests still pass against the new record shape.check:changedpasses. Not run live; the existingretireOutgrownChildpath already does the relaunch.I manually tested these changes locally
Automated tests added/updated, or explained why not below
Every added test fails without this change and avoids the test anti-patterns
Performance
With the switch off, nothing new runs. With it on:
Risk
Level: Medium
ORCA_MCP_SERVERSunset, nothing is recorded and every path runs as on main.changedalso being consulted at handover, where it agrees withoutdatedfor a bot's own tools.AI Disclosure
Review
Agent skill upstream boundary
Notes
All host-side and in memory. No wire, persistence, platform or mobile change. Remote hosts decide this for their own chats.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)