githubnext/chopinPublic

Let's compose rich plans together

Share worker session setup and teardown between background jobs

The description and research workers repeated the same sandbox, credential
and agent-session opening, including the abort race that destroys a
late-arriving session, and the same session -> sandbox -> credential
teardown chain. openWorkerSession now owns both. The description worker
also races its sandbox opening against abort, which the research worker
already did.

Assistant-model: Claude Opus 5.5
Assistant-workflow: inline
Assistant-verification: bun test unit passed: worker-session.test.ts covers teardown order, destroy failure, open failure, late session and late sandbox after abort, and a real just-bash sandbox
Assistant-verification: mutation check passed: removing late-open destroy or credential release fails the helper tests
Assistant-verification: bun test passed: 1611 pass, 2 skip, 0 fail
Assistant-verification: bun run types passed: all workspaces and E2E
Assistant-verification: bun run ci passed: dprint, oxlint, tokens
Co-authored-by: Alex Lavaee <lavaman131@github.com>
ALAlex Lavaee authored
d87d6e6Patch
Parentfadb3e6
4 files changed+232-56
StackedSplit
apps/server/src/jobs/document-summary.ts+8 โˆ’24
apps/server/src/jobs/research-workspace.ts+10 โˆ’32
apps/server/src/jobs/worker-session.test.ts+147 โˆ’0
apps/server/src/jobs/worker-session.ts+67 โˆ’0