Skip to content

fix: scope session listing and continue to the header cwd - #226

Merged
liuedcson merged 2 commits into
mainfrom
fix/continue-session-cwd-collision
Oct 9, 2026
Merged

liuedcson merged 2 commits into
mainfrom
fix/continue-session-cwd-collision

Conversation

@liuedcson

Copy link
Copy Markdown
Collaborator

Summary

  • The default session directory name is a lossy encoding of the cwd (path separators collapse to -), so /tmp/case/project-a and /tmp/case/project/a map to the same directory.
  • SessionManager.list() and SessionManager.continueRecent() only filtered by the session header cwd when an explicit non-default sessionDir was supplied, so under a collision the current project's listing showed the other project's sessions and --continue appended to whichever file was newest, ignoring its header cwd.
  • Both now always match the header cwd; listAll() still scans every project directory, and sessions without a header cwd remain reachable through the global listing paths.
  • Fixes [bug] --continue can append to another project session when paths collide #156.

Testing

  • pnpm --filter @step-harness/coding-agent test -- test/session-manager/file-operations.test.ts test/step-session-wrapper.test.ts (regression tests fail without the fix, pass with it)
  • session-related suites: test/session-manager, session-cwd, session-info-modified-timestamp, step-resume-command-compat, step-pi-storage-wrapper, step-session-file-compat, feedback-session-root, sdk-session-manager, step-sdk-wrapper
  • apps/cli session-selector and resume-command tests
  • repository pre-commit checks (pnpm check)

The default session directory name is a lossy encoding of the cwd (path
separators collapse to '-'), so /tmp/case/project-a and /tmp/case/project/a
map to the same directory. SessionManager.list() and continueRecent() only
filtered by the session header cwd when an explicit non-default sessionDir
was supplied, so under a collision the current project's listing showed the
other project's sessions and --continue appended to whichever file was
newest, ignoring its header cwd.

Both now always match the header cwd; listAll() still scans every project
directory. Regression tests cover the colliding-paths scenario at the native
and Step facade levels (issue #156).
Provider requests and the public getPiUserAgent() helper identified the
client as `step`, while the update checker already sends `stepcode`.
Use `stepcode` in both user-agent builders so the client is attributed
consistently across requests.
@liuedcson
liuedcson merged commit 9fcc6e6 into main Oct 9, 2026
2 of 3 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.

[bug] --continue can append to another project session when paths collide

1 participant