Repository navigation
Description
The send_remote_message tool starts failing with Remote message limit reached (50 requests per window). after a window has sent 50 messages in total. The count never decreases, so the cap works as a lifetime budget, not a rate limit. Every agent session in the window shares that budget. Agents can't reload the window, so long-running multi-host coordination stops until a person notices and runs Developer: Reload Window.
Repro
- In VS Code 1.147.0 (commit
8a14f0cc1b08), open the Agents window with two or more agent hosts (Remote-SSH agent hosts in our case) andchat.remoteSessions.tools.enabledon. - From any agent sessions in that window, call
send_remote_message50 times. The calls can be spread over hours and across sessions, and some of them can fail (for example, an unavailable host). - The 51st call, from any session, fails with
Remote message limit reached (50 requests per window). - Run Developer: Reload Window. Sends work again.
Observed 2026-11-20 on macOS with two Linux agent hosts: two coordination messages failed unsent after a day of normal multi-host traffic, and delivery resumed after a reload. From the source (not tested separately), waiting, closing sessions or toggling chat.remoteSessions.tools.enabled does not reset the count, because the router holding it is created once per window and never cleared.
Cause
remoteSessionMessageRouter.ts (main ef689d24; the cap logic is unchanged since 3bc56b5, #336690):
const maxRemoteMessages = 50;(L32) is a constant with no setting.RemoteSessionMessageRouter.requests(L74) is aMapkeyed by[source chat, tool call id]. It exists to make a retried tool call idempotent: the same call with the same input returns the original promise.send()(L91–108) rejects new calls oncerequests.size >= maxRemoteMessages.- Entries are only added (
set, L106) and never deleted.SendRemoteMessageToolcreates the router once, andworkbench.contrib.remoteSessionToolscreates that tool once per window, so the map only grows. - The entry is added before the send resolves. Sends that fail during routing (unknown target, host offline) count against the cap.
- The idempotency cache and the abuse limit are therefore the same structure. Retries need only recent or in-flight entries, but the limit counts everything ever sent.
Expected
The cap should protect against a runaway loop without ending legitimate long-lived coordination. Any of the following would do:
- Bound the rate, not the lifetime. For example, count sends in a sliding window (N per M minutes) and evict idempotency entries after they settle plus a retry TTL.
- Don't count failed sends, or refund them when routing fails before anything is delivered.
- Scope the budget per source session (perhaps with a larger per-window ceiling), so one chatty session can't block every other session in the window.
- Make it configurable (e.g.
chat.remoteSessions.tools.maxMessages), and put the remaining budget and the reset condition in the error text, e.g. "Reload the window to reset". Today the message doesn't say how to recover. - Optionally, provide a command that resets the budget, since a full reload interrupts everything else running in the window.
Workaround
A person runs Developer: Reload Window in the Agents window. Agents have no tool to do this. Our agent guidance now tells them to budget sends, and when they hit the error, to report BLOCKED and ask the user to reload.
Related
#336682 (feature), #337849 (test plan), #348946 (idle agent host activation), #349566 (replying to the sending chat).
Filed by an AI assistant at the user's explicit request, based on source inspection and one observed occurrence.
Activity