release: session archive side effects + stopSandboxOnArchive (#578)
Merged
SW
6mo ago+163+163+012345678901234567890123456789-0-0-0123456789
Promotes test to main. Headline change:
- #578 — feat(sessions): archive side effects +
stopSandboxOnArchive. PR brought to parity with open-agents on snapshot fallback preservation andlifecycle_errorcleanup; live verified on preview.
Also includes other commits already merged to test.
Summary by cubic
Promotes test to main. Adds reliable session archive/unarchive lifecycle handling with deferred sandbox teardown and a 409 guard while a sandbox is pausing. Also brings recent chat workflow, credits, chats API, and session-create improvements.
-
Sessions lifecycle and sandbox management
PATCH /api/sessions/{sessionId}appliesARCHIVE_LIFECYCLE_PATCH/UNARCHIVE_LIFECYCLE_PATCHto set lifecycle fields synchronously.- Defers sandbox stop with
after()fromnext/server, runningstopSandboxOnArchiveto stop and clear runtime state; preserves snapshot as a fallback and only nulls it after a successful stop; on stop failure, writeslifecycle_errorand clears runtime state if no snapshot exists. - Rejects unarchive with 409 when the sandbox is still pausing and no snapshot is available via
isSandboxPausing+isUnarchiveConflict. - Tests updated to mock
after()andstopSandboxOnArchive.
-
Other updates
- Chat workflow: persists assistant message per step, charges credits atomically with audit via RPC, and auto-commits/pushes after natural finishes (including persisting the commit data chunk on the message).
- Sessions create: automatically provisions a workspace repo on GitHub (
recoupable/<accountId>or org), addsorganizationId, and removescloneUrlandbranchfrom the request. - Chats API: migrates GET/PATCH/DELETE for session chats with camelCase responses.
Summary by CodeRabbit
-
New Features
- Added session archive and unarchive functionality with lifecycle state management.
- Implemented automatic sandbox cleanup and resource management when sessions are archived.
-
Improvements
- Prevents unarchive conflicts by detecting when sandboxes are pausing, returning appropriate conflict responses until the pause completes.