Repository navigation
Description
Summary
On the P4 microVM sandbox tier, an agent's short-term (working) memory cannot span a session's
turns, because the tier's isolation unit is the run, not the session. Long-term memory is
unaffected — P4.1 routes it to an external store over the egress proxy — but working memory has no
home on this tier today.
Why
Standard agent-memory decomposition puts working memory as volatile per-session state that is
cleared when the session ends, and long-term memory in an external database / vector store / graph
that persists across sessions. The tier serves neither shape cleanly:
| Fact | Citation |
|---|---|
ExecRequest.workspace_key is "populated by the harness from the lease's run id" |
P4 §3.4 |
Leases are keyed on leaf id, not session (member = leaf id) |
harness/src/sandbox-lease.ts:3 |
WorkspaceRoot/<workspace_key> is created on first Exec for an unseen key and removed on Reclaim |
P4 §4.4 |
The tier's load-bearing gate is "No cross-run bleed — two interleaved workspace_keys; neither sees the other's files. The property this slice exists for" |
P4 §8 |
Writable guest layers are tmpfs (/tmp, /var), "discarded on kill. The workspace is the only durable thing" |
P4 §5.1 |
So a session's working set dies at run boundaries, and anything that deliberately crossed a run
boundary would be crossing the exact line §8 asserts nothing crosses.
How P4 currently avoids the problem
P4 §9 keeps interactive /turn on the container tier entirely: "It never leases
(run-turn.ts:57), so it has no run id to populate workspace_key with, and §3.4 refuses an empty
one on the VM path rather than letting it mean 'share one workspace'."
That is a legitimate deferral, but it means the microVM tier as designed and as measured (E10,
E11) cannot host a multi-turn interactive session at all. The gap is not a bug in the tier; it is
an unclaimed scope boundary that will block the tier from serving interactive work.
What closing it involves
Not decided here — this issue exists to make the decision explicit rather than implicit:
- A session-scoped key alongside the run-scoped one. Spends the "one wire change" budget P4 §3.4
sets and P4 §9 is already guarding forRelease{workspace_key}, and requires restating §8's gate
as "no bleed between sessions" plus a new test for the positive half (two runs of the same
session do share, two runs of different sessions do not). Nothing tests that today, because
nothing was supposed to be shared. - Give
/turna request-scoped key. P4 §9 notes this is "the same plumbing the next multi-user
slice (MU1 is docs(spec): MU1 multi-user control plane — owned sessions, per-user credentials #238) owes it for pool selection" — so it may be cheaper as MU-track work than as
P-track work. - Accept the boundary. Interactive sessions stay on the container tier permanently, and the
microVM tier serves only run-to-completion work. Cheapest, and possibly correct — but it should
be a recorded decision, not a side effect.
The ext4 constraint matters for option 1: P4 §4.3 establishes that only one VM may hold a
workspace_key's rw mount, so a session that fans out concurrent leaf runs would contend. Whether
a session ever does that is an open product question and is worth settling before designing.
Relationship to P4.1
P4.1 — MicroVM egress transport
§3 marks this explicitly out of scope, and resolves the long-term memory half by making it an
allowlisted destination behind the egress proxy (no mount, no new key, no wire change). This issue
is the remaining half.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
pdettori commentedon Sep 17, 2026
Follow-up from a brainstorming pass on this issue's option 1 ("a session-scoped key alongside the run-scoped one"), scoped specifically to the microVM tier (no leases — see below):
The
run/sessionsplit collapses. On the microVM tier there is no lease concept at all:sandbox-lease.ts's Redis ZSET is a container-tier-only mechanism (P2's shared-pod-pool admission cap), andvmpoolhas its own independent per-key lifecycle (P4 §4.2) with no lease involved. So "run id" here is just whatever key the harness chooses to populateworkspace_keywith — nothing forces it to be leaf/dispatch-scoped. The fix is: populate it fromsessionId, not from a per-dispatch id.No concurrency to design around. A session runs exactly one turn/leaf at a time — never two runs concurrently against the same workspace. That removes the ext4/single-writer contention worry this issue flagged as "an open product question... worth settling before designing": there's nothing to arbitrate, because there's never more than one holder.
What actually changes:
ExecRequest.workspace_key := sessionId(wire shape unchanged, P4 §3.4's "one wire change" still holds — just re-keyed).vmpool's state machine (RunWarming → RunActive → RunParked → RunReclaiming, §4.2) doesn't need new states — it's already structurally per-key, not per-dispatch. The real change is inWorkspaceIdle/Reclaim(§4.4): a key must stop being reclaimed just because one dispatch/turn ended. It should only reclaim when the session is actually over (or idle past a much longer threshold) — that threshold-ownership question is the one real open design decision.run-leaf.ts's outerfinallycallscleanupWorkspaceunconditionally on every dispatch exit — including a mid-turn gate pause (realProduceVerdict,run-leaf.ts:674-820). A verdict leaf that pauses for human approval already loses its workspace on resume, today, on the container path. Worth fixing there too, not just on the microVM tier.Separately: the per-
ExecVM lifetime question this issue's design touches (P4 §4.1, "a VM is NEVER reused") turned out to be its own, adjacent architectural question — filed as #274 rather than folded in here, since it's about VM-process lifetime, not workspace lifetime.pdettori commentedon Sep 17, 2026
Epic: rossoctl/rossoctl#2546 (Stream 2 — microVM sandbox tier, via sub-epic rossoctl/serverless-harness#256)
Status update (2026-09-17)
Still open, no PR yet. No change since #251 (P4 microVM
sandbox tier) merged — the per-run workspace keying this issue describes is as-shipped.
Assisted-By: Claude (Anthropic AI) [email protected]
docs(specs): add P4.1 microVM egress transport design
pdettori commentedon Sep 24, 2026
Stale — the workspace is keyed by the SESSION now, and cross-turn continuity is tested
Checked against
main(2026-09-23). All three factual premises of this issue have been overtaken, and the gap it was filed to make explicit has been closed by the/turnwork.The three claims, as they stand now
ExecRequest.workspace_keyis populated by the harness from the lease's run id"harness/src/select-sandbox.tspasses{ workspaceKey: sessionId }, with a doc comment stating "The SESSION id becomes the Exec's workspace_key — never the lease holder id."/turnnever leases, so it has no run id to populateworkspace_keywith"/turnleases and goes throughselectPoolSandbox(run-turn.ts), which throws rather than falling back when there is no pool.The commit that did it is
4b00eb1, and it is worth reading because the defect arrived through a rename, not a design change: #279 renamed this path'srunIdtosessionId, which silently routed a per-turn value into the parameter feedingworkspace_key. That would have opened turn 2 of a session in an empty workspace and multiplied standby pools per turn instead of per session. It was caught by reasoning about the semantics of the conflict rather than by a test, because — exactly as this issue predicted — no test covered the positive half at the time.Both identities are now real and separate:
sessionIdkeys the workspace and is stable across a session's turns;holderIdis the lease ZSET member and is unique per concurrent holder.The tests that now cover it
select-sandbox.test.ts— "keys the workspace by the session id even when the LEASE holder differs": assertsworkspaceKey === 'sess-1'while the lease is taken under a per-turn holder.turn-lease-holder.test.ts— "passes the SESSION id unchanged, so both turns key one workspace", and "leases under a distinct holder id on every turn of one session".So the §8 gate now has both halves: two different sessions do not share a workspace, and two turns of one session do.
What is actually left, and it is narrower than this issue
The workspace spans turns. Nothing else does, and that is the tier's isolation claim rather than a gap: every Exec gets a microVM created for it and destroyed after it, and the writable guest layers (
/tmp,/var) are tmpfs discarded on kill./workspace— 2 GiB ext4 by default (DefaultWorkspaceImageBytes) — is the only durable thing.So between turns of one session there is no surviving process, no held shell or dev server, and nothing installed outside
/workspace: apip installorgit config --globalfrom turn 1 is gone in turn 2. If "working memory" means files the agent wrote, it now has a home. If it means process state, it does not and will not on this tier.Two residual limitations worth tracking if they matter, either here re-scoped or as new issues:
WorkspaceRoot/<workspace_key>lives until an idle Reclaim (§4.4), so a session idle long enough loses its workspace and the next turn silently starts empty. Nothing surfaces that to the caller.turn-lease-holder.test.tspins that an anonymous turn falls back to the unique holder as the workspace key — correct, since there is no session to continue, but it means the continuity property is conditional on having a session id.Recommendation
Close this, or re-scope it to (1) above. Its headline — "the microVM tier as designed and as measured cannot host a multi-turn interactive session at all" — is no longer true, and leaving it open will send someone to re-plumb a session key that already exists.
One thing to carry forward rather than lose: this issue was right that the session, not the run, is the correct isolation unit, and it named the standby-pool consequence (
§4.3) that made the rename defect a real bug rather than a naming nit. That reasoning is what caught it.Also relevant to #274 (per-Exec VM lifetime): the session is already the unit that owns both the workspace and the standby pool, so a longer-lived VM should probably be scoped to it rather than introducing a third lifetime. Worth settling in #274's design note instead of discovering later.
pdettori commentedon Sep 24, 2026
Closing. The premise —
workspace_keypopulated from the run id, so a session's working set dies at run boundaries — is stale: it is the session id, and cross-turn continuity is pinned by tests. Detail in the comment above.One residual from this review was real and is now #338, and it is a correction to what I wrote above rather than a restatement of it: I called the 30-minute
WorkspaceIdle"correct design, a session idle half an hour is over." That is wrong for human-in-the-loop work, where a turn boundary can be hours while a person responds. The workspace is deleted mid-session and the next turn resumes in an empty/workspacewith no signal. Compounding it, workspace disk is not admission-controlled, so the idle sweep is the only backstop against exhaustion and the TTL cannot simply be raised.So this issue was right that the session is the correct isolation unit, and right that the tier had an unclaimed scope boundary. The boundary turned out to be the workspace's lifetime, not its identity.
Carried into #274: the session already owns the workspace (
WorkspaceIdle) and the standby pool (StandbyIdle), so a longer-lived VM should be scoped to it rather than introducing a third lifetime.