Repository navigation
fix(runtime): an open tab nobody uses lets its company's server go - #802
Conversation
Address review of #802: - A call's or set change's activity lands on the document's current connected generation, so a reauthentication replacing the stream between admission and activation no longer loses it; a document that disconnected meanwhile still keeps none. Barrier tests cover both handoffs. - The idle browser case now shows the resumed call holds the company past execution.company.idle until the document's window passes, which fails without Runtime's call forwarding or the server's wiring. - The disconnected-record bounds are module defaults (4096, one hour) that tests lower through a Context reference, not registry limits. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Address review of #802: - A call's or set change's activity lands on the document's current connected generation, so a reauthentication replacing the stream between admission and activation no longer loses it; a document that disconnected meanwhile still keeps none. Barrier tests cover both handoffs. - The idle browser case now shows the resumed call holds the company past execution.company.idle until the document's window passes, which fails without Runtime's call forwarding or the server's wiring. - The disconnected-record bounds are module defaults (4096, one hour) that tests lower through a Context reference, not registry limits. Co-Authored-By: Claude Opus 5.5 <[email protected]>
d8c4a34 to
b57d1f5
Compare
Address review of #802: - A call's or set change's activity lands on the document's current connected generation, so a reauthentication replacing the stream between admission and activation no longer loses it; a document that disconnected meanwhile still keeps none. Barrier tests cover both handoffs. - The idle browser case now shows the resumed call holds the company past execution.company.idle until the document's window passes, which fails without Runtime's call forwarding or the server's wiring. - The disconnected-record bounds are module defaults (4096, one hour) that tests lower through a Context reference, not registry limits. Co-Authored-By: Claude Opus 5.5 <[email protected]>
bc3bc72 to
5683b26
Compare
Acceptance: PASS with notesChecked Done means
Golden journeys
Evidence All exact-head CI checks also passed, including Mirrored surfaces checked: API descriptions/docs, the limit registry/generated docs/server skill, analytics fields, runtime vocabulary, product/ADRs and operations. Reactivation supplies the reverse state; no CLI wire shape, migrations, company-resource policy, served-page layout or package layout changed. Rollback answers: They match the diff. There are no migrations, infrastructure changes, changed durable row shapes or wire-schema changes. Activity is host memory. The older release ignores an override row for the new limit; its configuration loader rejects an unknown environment-configured limit, so remove Not run
Notes
|
A connected tier 2 document now holds its company task and keeps its version warm only while its viewer is active: its first stream, a change to its logical desired set, or an admitted server.call from its viewer. After execution.document.idle (10 minutes, per company) without activity it lets both go, stays ready, and binds on demand for its next call or live update. One warm-hold owner per document is fenced across stream generations, and disconnected activity records live in a bounded cache. Closes #800 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Address review of #802: - A call's or set change's activity lands on the document's current connected generation, so a reauthentication replacing the stream between admission and activation no longer loses it; a document that disconnected meanwhile still keeps none. Barrier tests cover both handoffs. - The idle browser case now shows the resumed call holds the company past execution.company.idle until the document's window passes, which fails without Runtime's call forwarding or the server's wiring. - The disconnected-record bounds are module defaults (4096, one hour) that tests lower through a Context reference, not registry limits. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The owner race asserted a released company lock right after advancing the test clock, while the release could still be finishing behind a limits read, and failed on CI's Node 22 run. Each test now waits for the fleet to reach the counts it expects, and the owner race checks the replacement's stream event for no second hold. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The idle case checked the company 3 s after the resumed call's reply, but the document's window starts at admission, so a slow reply could use it up first. It now watches, from before the call, for the company's activity lock, which only an active document's hold takes, and waits for the release with a deadline instead of a fixed sleep. Co-Authored-By: Claude Opus 5.5 <[email protected]>
5683b26 to
99ac540
Compare
…connection (#814) Release 15's What's new entry, written from `9e4b0df`. It covers everything merged since release 14's `through` (`7694bab`), and sets the `patchy` release to `0.15.0` (`packages/patchy/package.json` and `CURRENT_RELEASE`). | Change | PRs | | --- | --- | | New: Your agent can read a tool's log | #786 | | Fixed: Tools with server code keep one steady connection | #798 | | Behind the scenes: an unused open tool lets its server rest | #802 | #783 is release 14's own entry, so it's left out. #795, #796, #797, #799, #803, #804, #806 and #807 are agent docs, CI and dev tooling, with no line. None of the PRs in the range are `one-way`; #786 and #798 predate the rollback questions, and their diffs leave nothing an older release can't run with (a new read-only route and CLI command, and the load balancer's stickiness setting, which the older commit restores). If this release misbehaves, roll back to `03891e4` (release 14). Made by Claude Opus 5.5 via Claude Code. Co-authored-by: Claude Opus 5.5 <[email protected]>
What changed
A tier 2 tab that stayed open held its company's server task, and its version's process, for as long as it was connected, whether anyone used it or not. In production one forgotten tab kept a company's task running for 36.5 hours, until a deploy ended it.
Now an open document holds the company task and keeps its version warm only while its viewer is active. After
execution.document.idle(a new operating limit: 10 minutes by default, per company, overridable) without activity, it lets both go. The screen and the stream stay: the document stays ready, live updates still arrive, and its next call binds the company on demand.server.callfrom its viewer for that version on this host. Reauthentication reconnects, reconciliation and re-runs for other people's writes don't count.Subscriptions.updatenow says whether an admitted request changed the logical set. It compares a generation's first set with the one the previous generation left, so thereplacethe shell sends after every reconnect only counts when it carries changes. Runtime tells the streams about each admittedserver.callthrough a newcalledoption. Activity lands on whichever generation of the document is connected when it runs, so a reauthentication that replaces the stream in between doesn't lose it; a document that disconnected meanwhile keeps none.RuntimeStreamkeeps an activity record per document across generations. The owner is one fiber holdingExecutionLifecycle.connectandConnectedVersions.connectuntil the window passes or its generation ends. Expiry gives up ownership in the same step that decides it, and finalizers only clear their own owner. An old generation's expiry, acquisition or finalizer therefore never touches its replacement's holds. Reactivation re-holds in the background withwarm: falseand sends no frames; if it fails, the next activity retries.readyand reconciles, without connecting or warming. If the window outlasts a startup, the startup still ends inready, so held calls always settle throughready,start_failedor closure. A document the host has no record of starts active.Context.Reference. Connected records are never evicted, and a record leaves the cache when it reattaches.keepaliveevent gainsendReason(idleorleft). A tier 2 stream event beside the fleet countsidledandreactivated. Itslimitscarryexecution.document.idlewith the window, its configuration revision and, aspeak, the longest stretch without activity.execution.company.idledescription, the generated limits docs and server-skill table, the runtime stream description withdocs/API.md, the analytics and runtime glossaries (a new Active entry) anddocs/product.md.Closes #800
Look at
1. A visible tab lets go, and comes back on use. This ran on the local instance with a second, local-fleet host, an 8 s window and a 5 s company idle. A real browser opened the starter tier 2 patch, left it visible for 20 s, added a note and stayed another 15 s. Below is the host's wide events, trimmed to the fields that matter, with seconds from the open:
The company's task was released 13.7 s after the open while the tab was still connected and visible. That is the window plus
execution.company.idle. The note bound a fresh task on demand, the call made the document active again without a warmup, and the task was released again once the tab went quiet.2. The browser test, red then green.
starting.spec.ts› idle documents runs a real server and fleet, with an 8 s window and a 1 s company idle.Each wiring point fails it on its own. With Runtime's call forwarding in
RuntimeProduction.tsremoved, or withServer.tsback to merging Runtime and the streams side by side:With the window at 10 minutes, it fails at the first check, with no idle release in 30 s. As committed it passes in 20 s, along with the rest of the spec.
3. Activity across a reconnect. Two barrier tests construct a call's activity, or hold an admitted set change before its activity lands, then let reauthentication replace the generation. The replacement must take the company back. Before activity was forwarded to the current generation, both stalled waiting for that hold, and the replacement stayed idle.
How it was verified
RuntimeStream.test.tscover the following. An active document holds both and lets both go after the window, the keepalive saying idle. A non-empty set whose revisions and vectors advance stays idle across 30 reconnects spanning two more windows. A set change re-holds and a repeat doesn't. A call re-holds the caller's connected documents, not a colleague's or a hidden one. Another viewer's write reaches an idle document through an on-demand admission. An unknown document starts active, and a startup the window outlasts ends inready. A barrier-controlled race covers expiry against reactivation against generation replacement, with the old owner's lock finalizer landing after the new owner took over. Two more cover a call's and a set change's activity landing on the generation that replaced their document meanwhile, and not on one that left. The cache tests evict the longest-disconnected first, never a connected record, and never one that reattached.Subscriptions.test.tscovers the logical set across order, revisions, vectors, stale, repeated and buffered deltas, and across generations.ConnectedVersions.test.tscoversendReason.InvocationAdmission.test.tschecks that only an admitted call reachescalled.Fleet.test.tsnow shows that an active holder alone, then an admitted invocation alone, on another host prevents release.pnpm verifypassed on the review-fix commit: format, lint, typecheck, synth, test (1,965 offline tests), postgres-concurrency, cli-smoke, tier2-smoke and browser. The two later commits only change tests: the activity tests wait for background holds to settle, and the idle browser case watches for the company lock.pnpm checkand the full browser suite (81 tests) passed on the last one.Release impact
Breaking — requires action from anyone already running this
Not breaking — no action required. The stream wire and API shapes are unchanged; documents just let go sooner.
What does a revert leave behind? Nothing durable: activity lives in each host's memory, and the new limit is a registry entry with a default. If
PATCHY_LIMITS_JSONnamesexecution.document.idleby then, take it out first, because an older release refuses an unknown limit id at startup. A per-company override row for it is ignored.Does the release before it still work with that? Yes. Open documents hold their company again for as long as they're connected.
Made by Claude Opus 5.5 via Claude Code; reviewed with GPT-6.1-Sol.