refactor!: remove cwd from ResumeSessionOptions (CLI-72)#42
Merged
Conversation
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>
factory-davidgu
approved these changes
May 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Remove
cwdfromResumeSessionOptions. Resolves CLI-72.Why
cwdonresumeSessionwas misleading. It only controlled subprocess startup and was never sent in thedroid.load_sessionrequest, so it could not change the resumed session's working directory. Callers who passedcwdexpecting it to override the persisted session cwd would be silently surprised.This change makes the contract explicit:
createSessionuses the caller'scwd.resumeSessionalways uses the persisted session'scwd. To run in a different directory, create a new session or fork the existing one.Changes
src/session.ts: dropcwdfromResumeSessionOptions; add TSDoc onresumeSessiondocumenting the contract.tests/session.test.ts: newCLI-72: cwd behavior on resumedescribe block.loadSessionparams never containcwd.@ts-expect-errortest confirmingcwdis rejected at the type level.cwdfromresumeSessioncalls inexamples/fork-session.tsandexamples/init-metadata.ts.README.mdanddocs/typescript-sdk-reference.md.Breaking change
resumeSession(id, { cwd })no longer typechecks. Callers should drop thecwdoption. SDK is internal, breakage is acceptable.Validation
npm run typecheck✓npm test— 632 passed ✓npm run lint✓npm run format:check✓