Skip to content

Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.

chore(relay): comments state the relay broker's settled listener expiry

review8c9015a48994
diff --git a/src/core/relay/hosted-scheduler.ts b/src/core/relay/hosted-scheduler.ts
index 905be6854..8cfa7682f 100644
--- a/src/core/relay/hosted-scheduler.ts
+++ b/src/core/relay/hosted-scheduler.ts
@@ -148,11 +148,11 @@ export function createHostedScheduler(deps: SchedulerDeps, now: () => number) {
e.refresh = deps.setTimeout(() => {
e.refresh = null
// A bridged listener has no refresh (its timer is cleared on bridging); this is only defence.
- // It is never cut for a refresh — whether the relay ends a bridged socket at its token's
- // lifetime is UNVERIFIED (the broker's source checks a token only when a socket joins; the
- // device checklist in docs/hosted-team-relay.md settles it), and if it does, onClose takes it
- // from there — and it is never re-armed: a bridged refresh would prove nothing (see the header), so a timer
- // for it would be a timer per session that does nothing, forever for one whose close is lost.
+ // It is never cut for a refresh: nodeterm-server's relay broker never expires or evicts a
+ // bridged socket (it closes only an UNBRIDGED listener, at its token's exp + 30 s), and if one
+ // closes anyway, onClose takes it from there. It is never re-armed either: a bridged refresh
+ // would prove nothing (see the header), so a timer for it would be a timer per session that
+ // does nothing, forever for one whose close is lost.
if (state !== 'running' || !live.has(e) || e.bridged) return
// This IDLE listener held its registration for a whole token lifetime: new registrations work.
proven()
diff --git a/src/main/remote/standing-host.ts b/src/main/remote/standing-host.ts
index 8ee4bb06f..fec11203a 100644
--- a/src/main/remote/standing-host.ts
+++ b/src/main/remote/standing-host.ts
@@ -334,10 +334,13 @@ export function initStandingHost(
// what resets it (see connectOne).
reconnectAttempt = 0
// A listener serving a client (bridged) is left alone — never cut an active session for a
- // token refresh. Whether the relay ends a bridged socket at its token's lifetime is
- // UNVERIFIED (the broker's source checks a token only when a socket joins; the device
- // checklist in docs/hosted-team-relay.md settles it); if it does, onClose replaces it. Only an
- // IDLE listener is re-minted with a fresh token by dropping it and topping the pool back up.
+ // token refresh. nodeterm-server's relay broker never expires or evicts a bridged socket: it
+ // closes only an UNBRIDGED listener, at its token's exp + 30 s (and evicts the oldest past 8
+ // pending per host). If a bridged socket closes anyway, onClose replaces it. Only an IDLE
+ // listener is re-minted with a fresh token by dropping it and topping the pool back up. That
+ // refresh fires 30 s before exp, so it has 60 s of slack: a timer that runs later than that
+ // (sleep, App Nap) finds the relay already closed the listener, and onClose's reconnect backoff
+ // brings a new one up.
if (p.bridged) {
scheduleRefreshFor(p, DEFAULT_TTL_MS)
return