Skip to content

Agents window: send_remote_message stops for good after 50 sends per window lifetime; only a window reload resets it #349953

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

  1. 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) and chat.remoteSessions.tools.enabled on.
  2. From any agent sessions in that window, call send_remote_message 50 times. The calls can be spread over hours and across sessions, and some of them can fail (for example, an unavailable host).
  3. The 51st call, from any session, fails with Remote message limit reached (50 requests per window).
  4. 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 a Map keyed 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 once requests.size >= maxRemoteMessages.
  • Entries are only added (set, L106) and never deleted. SendRemoteMessageTool creates the router once, and workbench.contrib.remoteSessionTools creates 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:

  1. 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.
  2. Don't count failed sends, or refund them when routing fails before anything is delivered.
  3. 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.
  4. 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.
  5. 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

  1. added
    bug
    agent-host
    on Nov 24, 2026
  2. added
    remote-session-tools
    on Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

agent-hostagents-windowbugon-testplanremote-session-tools

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions