Repository navigation
Conversation
|
The following comment was made by an LLM, it may be inaccurate: |
There was a problem hiding this comment.
The change looks sound to me, and I have no blocking concerns.
How I checked it: the new regression test fails on the base and passes with this PR. test/mcp.test.ts has one failure, the descendant-cleanup timeout, and the base has the same one. Session tests and the packages/core type check pass. I could not run the ACP resume reproduction from #54794, because it needs the free hosted model, which rejects local builds, and a mock provider does not trigger the race. So I have only verified the fix at the registry level, not end to end over ACP.
On cost: flush runs before every step, and it now takes the reconcile lock and calls MCP.tools(). That is an in-memory read, so the extra work per step is small. The unchanged-list check by reference (===) is correct, because entries are only replaced with new objects when the server re-lists its tools.
Public API: unchanged.
Overlap: #52214 (open) adds a separate refresh that the MCP add/remove/connect/disconnect routes await, and it keeps flush limited to waiting for the initial registration. Folding the refresh into flush, as this PR does, also covers those routes for the next session snapshot, so the two PRs should be reconciled before both land.
Related: #39902
Issue for this PR
Closes #54794
Type of change
What does this PR do?
Refresh the connected MCP tool inventory before a session takes its tool snapshot. Previously,
flushonly waited for initial registration; an ACP-resumed turn could miss an already-connected tool while its catalog update waited in the 100ms debounce and produce a false removal notice. The refresh shares the reconciliation lock and skips unchanged inventories.How did you verify your code works?
flushand passes with this change, without advancing the debounce timer.packages/core:bun run test test/mcp.test.ts --timeout 30000— 78 passed, 1 failed. The failure wasterminates MCP descendants after the wrapper exits successfullyhitting its internal 3s timeout.packages/core:bun run typecheckpassed; affected-file formatting andgit diff --checkpassed.aws4fetchdependency in the console app; affected-core typechecking passed.Screenshots / recordings
No UI changes.
Checklist
Added by the opencode bot (AI-generated).
Related: #39902