Uh oh!
There was an error while loading. Please reload this page.
feat(storage): read durable Session context refs - #4182
Conversation
| readonly sandboxDiagnostics: SandboxDiagnosticsProvider; | ||
| readonly memoryExtraction?: HostMemoryExtractionCoordinator; | ||
| readonly artifacts: HostExecutionArtifactAuthority; | ||
| readonly contextOffload?: InteractiveContextOffloadWriter; |
There was a problem hiding this comment.
[P1] The reader-only slice receives InteractiveContextOffloadWriter, which also exposes put, releaseReference, retireSession, and collectGarbage. Zero quotas do not constrain those destructive operations and even permit zero-byte puts, so the read-only invariant is not enforced by the authority boundary. Please introduce an authenticated read-only authority that exposes only read.
There was a problem hiding this comment.
Fixed in 91817d6. Model hydration now receives an authenticated InteractiveContextOffloadReader whose public surface is exactly kind, access, and read; the writer remains confined to storage composition and lifecycle preflight.
| // ============================================================================ | ||
| export type StorageRef = | ||
| | SessionContextRef |
There was a problem hiding this comment.
[P1] Adding session_context to the global StorageRef union makes it flow through conversation copy, but rewriteStorageRef only rewrites session_file. A copied message therefore retains the source sessionId, and the target Session later fails to hydrate it with session_mismatch; Session retirement also does not release these references. Please add lifecycle handling or fail these operations explicitly until that owner exists.
There was a problem hiding this comment.
Fixed in 91817d6 for the reader-only slice. Exact conversation copy now rejects source-owned session_context refs, and Session removal checks context usage under admission and fails before the tombstone if any refs exist or if the Store is unavailable. The stacked writer PR will replace these guards with copy and retire lifecycle handling.
| throw invalidProtocolFrame('Invalid AttachmentRef bytes'); | ||
| } | ||
| if (attachment.ref.kind === 'session_file') { | ||
| if (attachment.ref.kind === 'session_file' || attachment.ref.kind === 'session_context') { |
There was a problem hiding this comment.
[P1] This decoder is also used by turn.message.submit, so the reader-first widening lets a peer persist arbitrary or dangling session_context references before the claimed writer cutover. Please use a direction-specific decoder or admission rule, or validate the active capability and referenced record before accepting this durable input.
There was a problem hiding this comment.
Fixed in 91817d6. Client admission now uses a direction-specific decoder that rejects Host-owned session_context attachments for turn.start, turn.message.submit, and hosted execution, while snapshot and result decoding continues to accept the ref kind.
| return async (ref) => { | ||
| if (ref.kind === 'session_context') { | ||
| if (ref.sessionId !== input.sessionId) return { ok: false, reason: 'session_mismatch' }; | ||
| if (!input.readImageSnapshots) return { ok: false, reason: 'unsupported_ref_kind' }; |
There was a problem hiding this comment.
[P2] When context storage fails to open, readImageSnapshots is omitted and a valid session_context reference is reported as unsupported_ref_kind. The binary supports this kind; the authority is unavailable. Please preserve the existing unavailable failure semantics so callers receive the actionable cause.
There was a problem hiding this comment.
Fixed in 91817d6. The attachment reader now distinguishes an unavailable context authority from an unsupported ref kind and returns unavailable; Runtime Host wires that state explicitly when the optional Store cannot open.
Generated-by: OpenAI Codex
Generated-by: OpenAI Codex
91817d6 to
407a687CompareUh oh!
There was an error while loading. Please reload this page.
Summary
session_contextreferences as canonicalStorageRefvalues, including exact shape, bounded identity, equality, and Runtime Host protocol validation.session_contextuses the Session-bound Read image snapshot store, whilesession_filekeeps the legacy ArtifactStore path.session_file, production composition gives context offload zero Session/workspace write quotas, and no copy, retirement, migration, or writer cutover is activated here.Refs #4071
Verification
npm --workspace @maka/core run typechecknpm --workspace @maka/storage run typechecknpm --workspace @maka/runtime run typechecknpm --workspace @maka/runtime-host run typechecktest:distsuites for core, storage, runtime, and runtime-hostnpx biome lintandnpx biome formaton all changed source filesRollout
This PR only makes already-durable context references readable. It does not publish new
session_contextreferences, so the writer/lifecycle cutover and its compatibility boundary remain in the next contraction PR.AI use
Select exactly one:
Tool(s) and scope: OpenAI Codex implemented the reader-first storage and Runtime Host wiring, added tests, and ran verification.
Checklist
Does this PR entail a change in behavior?