Upgrade: workspace scope, onWorkspaceDestroy, and workspaceLifetime removed (core major)
A2A R0(d) d3, the runtime-js step of the session-scoped workspaces spec. @helix-agents/core is a major release (PersistentAgentConfig.workspaceLifetime is removed); @helix-agents/runtime-js is a minor.
What to do
- Remove
workspaceLifetimefrom everypersistentAgentsentry: the setting is removed, and a companion keeps a fresh workspace per consult. - Optional:
scope: 'turn'on a root agent'sworkspacefor a workspace per turn (destroyed when the turn ends). The default,'session', is today's behaviour. - Optional:
onWorkspaceDestroyin the agent's hooks, to learn when the framework destroyed a workspace (itsreason, the session it belonged to). UnderonUnavailable: 'reset'it fires beforeonWorkspaceReset. - Handle
end_pendingwherever you switch overWorkspaceUnavailableReasonexhaustively (a new member is a type error there). AnonWorkspaceUnavailablehandler that callsresetWorkspaceshould skipreason: 'end_pending': that refusal is the run's own, and a later run opens fresh once the end has finished. - A custom provider whose
opennames the same resource for every open of a session setsreusesSessionIds: true, so a session's open follows the end of its previous workspace (the Cloudflare filestore and sandbox set it).
What changed
WorkspaceConfig.scope?: 'session' | 'turn'(core). A root's'turn'workspace is kept across the turn's suspensions and continuations, and destroyed when the turn ends (a stop ends the turn wherever it lands); a workspace an earlier turn left bound is destroyed at a later run's entry; a crash between a turn's end and its destroy leaves the workspace to the provider'sreap(), which the app schedules (user ruling 2026-11-19). A sub-agent's or a companion's own workspace follows the child lifetime whatever it says; a child declaring'session'is logged once per agent type per executor.AgentHooks.onWorkspaceDestroy(core,WorkspaceDestroyPayload,WorkspaceDestroyReason), andWorkspaceHooks.onDestroyfor registry hook integrations. It fires for framework destroys only.A companion's terminate and respawn end its workspace on runtime-js: a companion terminated while its consult is paused has its workspace destroyed once the stop is recorded, and a respawn destroys the old session's workspace before the session is replaced (core
CompanionToolDispatchDeps.endChildWorkspace, which runtime-js supplies).A session's open follows its previous end (runtime-js). A destroy the run stops waiting for (past the executor's
workspaceEndWaitMs, default 30 s, or at a Stop) is still the session's pending end: the next run waits for it, and its success, when it comes, firesonWorkspaceDestroyonce. On a provider whose per-session resource repeats (coreWorkspaceProvider.reusesSessionIds, set by the Cloudflare filestore and sandbox), a run whose wait ends first opens no workspace: its workspace tools fail withWorkspaceUnavailableError(reason: 'end_pending') andonWorkspaceUnavailablefires, for that run only; a later run opens fresh once the end has finished. This includes a'turn'workspace an inheriting companion still holds after its turn: the session's later turns wait for that companion to end. Any other provider opens a fresh workspace past the bound and logs the end, as before. On the CF Durable Object the runs of every drive wait for it: the DO's drives share one set of session workspace registries, and a drive's settle waits for the session's pending ends (at mostworkspaceEndWaitMs, never more than half ofconcurrentEntryTimeoutMs) before it admits the next entry. Hibernation or eviction drops that in-memory wait: the next drive rebuilds the registry from the stored binding, and a destroy an eviction cut is left to the provider'sreap()(user ruling 2026-11-19).
Scope by runtime
- runtime-js: all of the above.
- CF Durable Object:
scope, the turn end and the earlier-turn check, andonWorkspaceDestroyfor them, through the runtime-js run loop it runs, across all its drives (above). Its workspace operations and a companion's end are below. - CF Workflows, Temporal and DBOS refuse workspace agents, unchanged.
There is no framework idle TTL or sweep, and no text for the model (user rulings 2026-11-13 and 2026-11-19): the app ends a root session's workspace (destroyWorkspace / resetWorkspace), schedules reap, and renders any context it wants the model to see.
CF Durable Object: workspace operations and companion ends (A2A R0(d) d4)
- Operations.
DOFrontendExecutor.destroyWorkspace(sessionId)/resetWorkspace(sessionId)(POST /workspace/destroy//workspace/resetthroughhandle) end the session's workspace as runtime-js's executor does: refusedstate_already_runningwhile a run is live or holds it,framework_not_supportedfor a provider the DO does not register. A destroy still running pastworkspaceEndWaitMsresolves the call (logged at warn): the binding has ended, and the session's next run waits for the destroy. The methods returnvoid, as runtime-js's do. While the operation runs it holds the DO's producer claim, so another entry of the session is answered as against a running drive: one without a request key is refusedstate_already_running(409, nothing written), and a keyed one waits for the operation, up toconcurrentEntryTimeoutMs. A session's identity is fixed at creation: the operations refuse a request whose verdict names another identity (validation_error), as entries do. DurableObjectAgentConfig.workspaceEndWaitMs(default 30 000 ms): a run's wait for its session's previous end, and the bound of the operations' and a companion end's destroy. A drive's settle waits for the session's pending ends for at most this, and never more than half ofconcurrentEntryTimeoutMs.- Companions. A terminate or a respawn ends the companion's workspace in its own Durable Object. A destroy that finishes within the companion's
workspaceEndWaitMsfires the parent'sonWorkspaceDestroywith the companion'ssessionId, as on runtime-js. One still running past it fires the companion agent's ownonWorkspaceDestroywhen it succeeds (on runtime-js the parent's fires then), and a respawn ends a workspace still bound when the companion's session is wiped, firing the companion agent's own hook. A hook fired outside a run reads the session's state; itsupdateStateandemitdo nothing and itsaddContextis refused typed. The companion's own late hook fires while its Durable Object instance stays live (hibernation or eviction drops it, as it drops the pending end), and a Stop of the parent during a companion's workspace end can leave its hook unfired; the destroy itself still completes. - An agent resolver that switches exhaustively on the lookup context's
reasonhandles'workspace_hook'.
See also
- Workspaces (its
scopesection) - Sub-agents: workspaces
- Workspace provider durability and destroy