Skip to content

fix(hub): pass resumeSessionId when resuming session#337

Merged
tiann merged 1 commit intotiann:mainfrom
xyzhang626:pr/upstream-fix-claude-resume-session-id
Mar 21, 2026
Merged

fix(hub): pass resumeSessionId when resuming session#337
tiann merged 1 commit intotiann:mainfrom
xyzhang626:pr/upstream-fix-claude-resume-session-id

Conversation

@xyzhang626
Copy link
Contributor

Summary

Fixes a resume argument wiring bug in SyncEngine.resumeSession() that prevents hub-triggered session resume from passing the actual resume token to the CLI spawn RPC.

Root cause

rpcGateway.spawnSession() takes params in this order:

  1. machineId
  2. directory
  3. agent
  4. model
  5. modelReasoningEffort
  6. yolo
  7. sessionType
  8. worktreeName
  9. resumeSessionId

In hub/src/sync/syncEngine.ts, resumeToken was passed as the 8th argument (worktreeName) instead of the 9th argument (resumeSessionId).

So for resume flow:

  • hub found metadata.claudeSessionId (or other flavor token)
  • but CLI never received resumeSessionId
  • runner spawn command missed --resume <id>
  • session could start as a new session instead of resuming the target one.

Fix

In hub/src/sync/syncEngine.ts:

  • add explicit undefined for worktreeName
  • pass resumeToken as the 9th arg (resumeSessionId)

Tests

Added regression test in hub/src/sync/sessionModel.test.ts:

  • passes resume session ID to rpc gateway when resuming claude session
  • verifies engine.resumeSession() forwards metadata.claudeSessionId into rpc spawnSession(..., resumeSessionId)

Also keeps existing model-forwarding resume test intact.

Validation

  • cd hub && bun run test src/sync/sessionModel.test.ts
  • all tests in this file pass

Impact

  • fixes resume correctness for Claude (and same call path shared by other flavors)
  • prevents silent new-session fallback caused by missing resume token at spawn RPC boundary

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review mode: initial

No issues found in added/modified lines. Residual risk: resume flow not exercised end-to-end beyond unit test coverage. Testing: Not run (automation).

@tiann tiann merged commit b6ecdc7 into tiann:main Mar 21, 2026
2 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.

2 participants