alonso.torres b132939b71 ✨ Route MCP wake requests across instances through Redis
The instance that holds a frozen plugin's connection may not hold the
browser extension that can wake its tab. The session waker now asks wake
agents through a WakeAgents interface. With Redis, an agent of this
instance is asked first; otherwise the request goes out on a wake channel
per user, to which an instance subscribes while it holds an agent of that
user. Each instance answers on a response channel per request: with its
agent's outcome, or with unknown-session at once when none of its agents
holds the session. The first activation wins. A request that reaches no
instance fails at once, so a frozen session without an agent still fails
as before.

When a forwarded task finds its plugin frozen, the instance holding the
plugin connection reports the wake on the task's response channel. A
waking notice lets the requester extend its timeout by the wake budget,
and a sent notice restarts the plain task timeout, so the wake does not
count against the task. Tasks that need no wake send no notices.

A woken page reconnects through the load balancer, perhaps to another
instance. With Redis the waker does not wait for a local reconnect:
when the woken page has closed its socket, the owner sends a resend
notice and the requester publishes the task again until an instance
holds the session, for up to the wake wait. A closing connection also
ends a pending liveness wait, so a page that closes without a last
heartbeat is not waited for in vain.
2026-10-26 11:41:44 +01:00
..