Skip to content

Restore fleet MCP tools after Host reconnect - #17

Merged
sihanwang94 merged 2 commits into
mainfrom
dev/sihanwang/fleet-mcp-reconnect-recovery
Sep 4, 2026
Merged

Restore fleet MCP tools after Host reconnect#17
sihanwang94 merged 2 commits into
mainfrom
dev/sihanwang/fleet-mcp-reconnect-recovery

Conversation

@sihanwang94

@sihanwang94 sihanwang94 commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

Problem

Retained Copilot ACP processes can lose their HTTP MCP tool registry while the Host is unreachable or lose an individual deferred Fleet tool binding during an active session. The transcript previously rendered every attempt as only failed, discarding ACP's actual error (MCP server 'fleet': Tool does not exist.), so operators could not distinguish a missing binding from a normal tool-level refusal.

Root cause

MCP servers are supplied only during ACP session/new or session/load. A retained process is not normally reloaded after Host connectivity returns, and Copilot can also invalidate a deferred MCP tool binding after the session is already running. The Host endpoint and signed lead token remain healthy; the failure occurs inside the retained ACP process before the request reaches /mcp.

Fix

  • Trigger MCP recovery after reconnect reconciliation and durable outbox replay complete, including legacy non-acknowledging Hosts.
  • Preserve ACP rawOutput.message on failed tool events and show the reason beneath failed transcript rows.
  • Detect the exact lost-binding Tool does not exist failure for Fleet tools and schedule one silent ACP reload when the turn reaches idle.
  • Defer busy sessions until their current turn completes.
  • Load the same Copilot session in a fresh process with MCP URLs resolved against the current Host endpoint.
  • Preserve event sequence continuity, additional workspace roots, yolo mode, custom-agent selection, and current model/mode configuration.
  • Deduplicate concurrent refresh requests and generation-gate event sinks so late events from retired processes cannot collide with replacement sequences.
  • Emit a clear terminal failure and Node warning if Copilot cannot be restarted.

Investigation evidence

  • The live Host /mcp endpoint authenticated successfully and returned the complete Fleet tool list.
  • Fresh ACP session/new and session/load probes both called fleet_list_work successfully.
  • Repeated calls in one fresh ACP process succeeded, ruling out the stateless HTTP transport.
  • The affected retained session had one successful fleet_list_work, followed by immediate binding failures, isolating the fault to that session's deferred Copilot tool binding.
  • ACP exposes the actionable reason in tool_call_update.rawOutput.message; Fleet previously dropped it.

Validation

  • Targeted Node and UI coverage passes for error extraction, transcript rendering, reconnect recovery, lost-binding recovery, busy deferral, refresh deduplication, and retired-process event gating.
  • Repository suite: 104/105 files passed on the first run; one unrelated filesystem test exceeded its 5-second timeout under load, then passed alone in 90 ms.
  • Full production build completed successfully.

Silently reload retained ACP sessions after durable outbox replay so orchestrators recover their fleet tool registry without losing configuration or sequence continuity.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Sep 3, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: ab83f7c1-c24e-45ba-a396-52a550b5d709


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Preserve ACP tool failure reasons, show them in the transcript, and silently reload the session when Copilot reports that a Fleet tool no longer exists.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@sihanwang94
sihanwang94 merged commit e9b2358 into main Sep 4, 2026
2 checks passed
@sihanwang94
sihanwang94 deleted the dev/sihanwang/fleet-mcp-reconnect-recovery branch September 4, 2026 20:50
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.

2 participants