Skip to content

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 workspaceLifetime from every persistentAgents entry: the setting is removed, and a companion keeps a fresh workspace per consult.
  • Optional: scope: 'turn' on a root agent's workspace for a workspace per turn (destroyed when the turn ends). The default, 'session', is today's behaviour.
  • Optional: onWorkspaceDestroy in the agent's hooks, to learn when the framework destroyed a workspace (its reason, the session it belonged to). Under onUnavailable: 'reset' it fires before onWorkspaceReset.
  • Handle end_pending wherever you switch over WorkspaceUnavailableReason exhaustively (a new member is a type error there). An onWorkspaceUnavailable handler that calls resetWorkspace should skip reason: 'end_pending': that refusal is the run's own, and a later run opens fresh once the end has finished.
  • A custom provider whose open names the same resource for every open of a session sets reusesSessionIds: 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's reap(), 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), and WorkspaceHooks.onDestroy for 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, fires onWorkspaceDestroy once. On a provider whose per-session resource repeats (core WorkspaceProvider.reusesSessionIds, set by the Cloudflare filestore and sandbox), a run whose wait ends first opens no workspace: its workspace tools fail with WorkspaceUnavailableError (reason: 'end_pending') and onWorkspaceUnavailable fires, 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 most workspaceEndWaitMs, never more than half of concurrentEntryTimeoutMs) 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's reap() (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, and onWorkspaceDestroy for 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/reset through handle) end the session's workspace as runtime-js's executor does: refused state_already_running while a run is live or holds it, framework_not_supported for a provider the DO does not register. A destroy still running past workspaceEndWaitMs resolves the call (logged at warn): the binding has ended, and the session's next run waits for the destroy. The methods return void, 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 refused state_already_running (409, nothing written), and a keyed one waits for the operation, up to concurrentEntryTimeoutMs. 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 of concurrentEntryTimeoutMs.
  • Companions. A terminate or a respawn ends the companion's workspace in its own Durable Object. A destroy that finishes within the companion's workspaceEndWaitMs fires the parent's onWorkspaceDestroy with the companion's sessionId, as on runtime-js. One still running past it fires the companion agent's own onWorkspaceDestroy when 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; its updateState and emit do nothing and its addContext is 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 reason handles 'workspace_hook'.

See also ​

Released under the MIT License.