Skip to content

refactor!: remove cwd from ResumeSessionOptions (CLI-72)#42

Merged
varin-nair-factory merged 1 commit into
mainfrom
vn/cli-72-resume-cwd
May 21, 2026
Merged

refactor!: remove cwd from ResumeSessionOptions (CLI-72)#42
varin-nair-factory merged 1 commit into
mainfrom
vn/cli-72-resume-cwd

Conversation

@varin-nair-factory
Copy link
Copy Markdown
Contributor

What

Remove cwd from ResumeSessionOptions. Resolves CLI-72.

Why

cwd on resumeSession was misleading. It only controlled subprocess startup and was never sent in the droid.load_session request, so it could not change the resumed session's working directory. Callers who passed cwd expecting it to override the persisted session cwd would be silently surprised.

This change makes the contract explicit:

  • createSession uses the caller's cwd.
  • resumeSession always uses the persisted session's cwd. To run in a different directory, create a new session or fork the existing one.

Changes

  • src/session.ts: drop cwd from ResumeSessionOptions; add TSDoc on resumeSession documenting the contract.
  • tests/session.test.ts: new CLI-72: cwd behavior on resume describe block.
    • Asserts loadSession params never contain cwd.
    • @ts-expect-error test confirming cwd is rejected at the type level.
  • Examples: drop cwd from resumeSession calls in examples/fork-session.ts and examples/init-metadata.ts.
  • Docs: update README.md and docs/typescript-sdk-reference.md.

Breaking change

resumeSession(id, { cwd }) no longer typechecks. Callers should drop the cwd option. SDK is internal, breakage is acceptable.

Validation

  • npm run typecheck
  • npm test — 632 passed ✓
  • npm run lint
  • npm run format:check

cwd on resumeSession was misleading: it only controlled subprocess startup
and was never sent to droid.load_session, so it could not change the resumed
session's working directory. Remove it from ResumeSessionOptions to make the
contract explicit: createSession uses the caller's cwd; resumeSession uses
the persisted session's cwd.

BREAKING CHANGE: resumeSession() no longer accepts cwd. To run in a different
directory, create a new session or fork the existing one.

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
@varin-nair-factory varin-nair-factory merged commit dd9e8e3 into main May 21, 2026
4 checks passed
@varin-nair-factory varin-nair-factory deleted the vn/cli-72-resume-cwd branch May 21, 2026 00:46
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