Skip to content

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

Description

@dangzitou

What happened?

step --continue can open and append to another project's session. The paths /tmp/case/project-a and /tmp/case/project/a both map to the same default session directory. list() shows both projects' sessions and --continue picks whichever file is newest, ignoring its header cwd. This mixes conversation history and can modify the wrong project's session file. Reproduced 5/5 times on cb5fc14 with extensions disabled.

Steps to reproduce

  1. Use an isolated STEP_CODING_AGENT_DIR, with STEP_CODING_AGENT_SESSION_DIR unset.
  2. Create and persist a session in each of the two paths above. Make the project/a session newer.
  3. From project-a, list sessions and continue the latest one. Both sessions appear; continue opens the project/a file. A new message from project-a is appended to that file.

Expected behavior

Current-project listing and continue should match the session header's actual cwd; a colliding directory name must not select a foreign session. I can implement the fix.

Version

0.84.4

Activity

  1. xuxujo97-coder commented on Sep 28, 2026

    @xuxujo97-coder
    Collaborator

    This comment was generated by AI during triage.

    The collision mechanism is visible in source — verified below.

    Verification (against current main)

    • packages/coding-agent/src/core/session-manager.ts:476-481 encodes cwd into the session directory name by replacing every /, \ and : with -: /tmp/case/project-a and /tmp/case/project/a both map to the same directory, so the two projects share one session dir and --continue's newest-file pick can cross projects regardless of the header cwd.

    Fix direction: a collision-free encoding (e.g. hash suffix) plus honoring header cwd on continue. Maintainers will follow up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/sessionsrc/sessionbugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions