Repository navigation
fix(client): a cloud box idles when its user leaves, not when its last tab closes - #139
Conversation
…er is here Adds the shared presence model (visible, and touched within the hour) with its own tests. The registry tests fail today: a hidden or idle client keeps renewing a box's lease every 4 minutes, and wakes a paused box at once. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Any connected client renewed its box's lease every 4 minutes for as long as it stayed open, so a forgotten tab or a minimized desktop app kept a Mac running around the clock. Presence is now shared in client-runtime: the app is visible (in the foreground on mobile) and the user touched it within the hour. Web and desktop report document visibility and input; mobile reports app state and touches at its root. The registry renews a box's lease and wakes a paused box only while the user is here, and their return retries every box that is down, so a paused chat still wakes by itself. The host never pauses a box whose agent is busy, so long turns stay covered. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…ed, then come back --away-seconds checks nothing wakes the box while its user is away, and that it reconnects by itself once they return. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Thread transfer impact✅ Thread transfer remains within every enforced ceiling.
Baseline: Scenario and decoded snapshot size10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed. |
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
Verdict: PASS. Reviewed by an agent that did not write this change. Presence (visible, plus input within 60 min) is derived once in |
Problem
After #137, every client connected to a cloud box renewed the box's lease every 4 minutes for as long as the client stayed open. A forgotten tab, or a minimized desktop app, kept the box's Mac running around the clock, at about $3.60/hour on Namespace.
Fix
A box's idleness now follows its user, not an open connection.
UserPresenceinpackages/client-runtimedecides whether the user is here: the app is visible (in the foreground on mobile) and the user touched it within the last 60 minutes. Coming back on screen counts as input.Verification
packages/client-runtime. The two registry tests failed before the fix:src/connection/(145 tests), websrc/connection/and mobilesrc/connectionpass.scripts/cloud/verify-box-reconnect.ts --away-seconds 120runs on E2B against a local manager. It hides the app as the box is paused, checks the box stays asleep, then comes back.waking → connected2.1 s after the user returned.--away-seconds, the box reconnected 7.7 s after the pause, as before.Opus 5.5 in Claude Code.
🤖 Generated with Claude Code