Skip to content

fix(open): Reuse the prior session when resuming an open - #101

Merged
4ndreello merged 1 commit into
mainfrom
fix/open-resume-linkage
Sep 22, 2026
Merged

4ndreello merged 1 commit into
mainfrom
fix/open-resume-linkage

Conversation

@4ndreello

Copy link
Copy Markdown
Owner

codedeck open --resume <nativeId> created a new session row on every resume. The harness then got a new CODEDECK_RUN_ID, and since the agents pane filters by that run id, every worker dispatched before the resume disappeared from the orchestrator's view.

Seen on a real run: orchestrator 8b3c (native id 07e82648-…) dispatched worker 29b6; reopening with --resume 07e82648-… produced a fresh row 2a7a with no children.

Now open passes resume to session.adopt, and the daemon revives the most recently updated open row with the same agent and native id: same id and run id, status back to working, stale pid, completion and failure cleared, worktree/branch/baseCommit kept, and a session.started event appended. If that row is still alive under the same pid identity, adopt creates a new row as before instead of taking over a running session. No match, or no --resume, behaves as today.

SessionStore.update/setStatus now accept null for pid, pidStartTime, completedAt, lastEvent and failure so a revival can clear them, and the store gains listOpenByNativeId.

Spec: .specs/features/open-resume-linkage/spec.md (ORL-01 to ORL-07).

Not covered: rows already orphaned are not relinked, and a codedeck run worker still does not pass its run id to sessions it dispatches itself.

Tests

  • npx vitest run tests/session-adopt.test.ts: 21 passed
  • npx vitest run tests/open-action.test.ts tests/release-interrupted.test.ts tests/run-linkage.test.ts tests/session-store.test.ts: 49 passed
  • npx tsc --noEmit: clean
  • Mutation probes: dropping the agent match failed ORL-01, dropping the liveness guard failed ORL-03, dropping the resume passthrough in open.ts failed passes the resume value to session.adopt.

Pass --resume through adoption and revive the matching open row so the
launcher keeps the original session and run identity.

Co-Authored-By: Codex <noreply@openai.com>
@sonarqubecloud

Copy link
Copy Markdown

@4ndreello
4ndreello merged commit 544b3b2 into main Sep 22, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant