bug: tools/list_changed after a policy reload sometimes never reaches Claude Code #53
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
After a policy reload, a connected Claude Code session usually picks up the new tool list without a reconnect, but not always. One approval out of four on 2026-10-08 never showed up until
/mcp reconnect wraptool.What happened
One Claude Code session, connected over
sse(/sse?cwd=…). Each capability approval was applied to the config, and the file watcher reloaded it:req_ff9b721bfj_issue_createreq_c6eccd3e,req_904e18eb,req_b221502cfj_issue_search,fj_issue_view,fj_issue_editreq_abe9d8f2fj_issue_commentFor the last one the server side was fine: the tool was registered,
wraptool_discoverlisted it, and a directtools/listover a fresh MCP session returned it. Claude Code's tool list stayed unchanged until/mcp reconnect wraptool, after which the tool appeared at once.Suspects
sendNotificationCore(mcp-go v0.54.0,server/session.go) does a non-blocking send to the session's notification channel (buffer 100 on the SSE transport) and drops the notification when it is full. The only trace is anOnErrorhook, and wraptool registers none, so a drop is invisible.registrar.reloadcallsDeleteToolsonce and thenAddToolonce per tool (registerSource), and each call emits its ownnotifications/tools/list_changed. A reload therefore sends one notification per registered tool, plus one. Several reloads in a row, a large policy, or a stalled SSE writer could fill the buffer.To investigate
OnErrorhook that logsErrNotificationChannelBlockedwith the session ID, so a drop shows up in the server log.AddToolloop with oneAddToolscall (one notification per batch), and check whetherDeleteTools+AddToolscan be made a single notification.list_changedreceived against those sent. Repeat over Streamable HTTP (/mcp).req_abe9d8f2reload for errors or session churn.Workaround
/mcp reconnect wraptoolin Claude Code. Agents can confirm the server's real state withwraptool_discover.Related
#50 (tool search; its hot-reload question).
🤖 Generated with Claude Code