Skip to content

/resume from "All" scope doesn't update cwd and tools still operate from original directory #2024

@niklaas

Description

@niklaas

What happened?

When resuming a session from a different workspace using the "All" scope in /resume (Tab to toggle), the session's conversation history loads correctly, but the working directory is never updated. Tools continue to operate from the directory pi was originally launched from, not the directory the resumed session belongs to.

The session header stores the original cwd (e.g. {"type":"session","cwd":"/path/to/other/project",...}), but switchSession() in agent-session.ts only restores the model and thinking level instead of reading and/or applying the session's cwd.

Steps to reproduce

  1. Launch pi from /project-a
  2. Open /resume and press Tab to switch to the "All" scope
  3. Select a session that was created in /project-b
  4. Ask the model to list files or run any bash command
  5. Observe that results reflect /project-a, not /project-b

Expected behavior

Resuming a session from a different workspace should switch the working directory to the cwd stored in that session's header, so that tools operate in the correct project directory.

Version

0.57.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions