You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug] Session history does not respect custom project-local sessionDir #1732
When Pi is configured to store sessions inside the project's .pi directory, PI-Desktop correctly respects this configuration when creating new sessions.
However, after reopening PI-Desktop or the project, previously created sessions are not discovered.
It appears that PI-Desktop only searches Pi's default global session directory (~/.pi/agent/sessions/) instead of the custom session directory configured for the project.
Steps to reproduce / 复现步骤
Steps to Reproduce
Configure Pi to use a project-local session directory in .pi/settings.json:
{
"sessionDir": ".pi/sessions"
}
Open the project in PI-Desktop.
Create a new session and send a message.
Verify that the session file is correctly saved under the project's .pi/sessions directory.
Close and reopen PI-Desktop.
Open the same project and check the session history.
Expected behavior / 预期行为
Expected Behavior
PI-Desktop should discover and load existing sessions from the configured sessionDir, just as it uses that directory when creating new sessions.
Actual behavior / 实际行为
Actual Behavior
New sessions are saved to the correct custom directory, but previously created sessions do not appear in the session history after reopening the application.
PI-Desktop appears to search only the default global Pi session directory.
Suggested Fix
Ensure that session discovery and session creation use the same resolved session directory, respecting the project's sessionDir configuration.
Ideally, session discovery should follow Pi's native session directory resolution behavior rather than assuming the default global path.
Statically confirmed the asymmetry, with one important correction to the framing: sessionDir is not a setting PI-Desktop implements at all — the key has zero references across apps/, packages/ and crates/ (verified by grep over main @ 4f9f051e5).
What each layer actually does:
@earendil-works/pi-coding-agent 1.1.0, core/session-manager.js: the default session directory for a cwd is the encoded global path ~/.pi/agent/sessions/--encoded-cwd-- (getDefaultSessionDirPath()); the SessionManageraccepts a custom sessionDir parameter, but only if its caller passes one.
PI-Desktop's session history never passes one — so the desktop's list/discovery path reads only the encoded global dirs, exactly as you observed.
So the likely split is: whatever created your sessions inside the project's .pi/sessions was honoring the project setting at a layer below the desktop (the pi CLI/agent entry — main.js does reference sessionDir), while the desktop's embedding never forwards that override. Net effect: creation and discovery disagree on the directory, which is your bug.
Fix direction for the maintainers: either (a) have the desktop read the project sessionDir override and pass it through to the same SessionManager used for listing, so creation and history share one source of truth, or (b) document sessionDir as a CLI-only setting and have the desktop ignore it on creation too — currently the two halves of the product disagree, which is the worst of both.
Activity
muzimu217 commentedon Oct 17, 2026
Statically confirmed the asymmetry, with one important correction to the framing:
sessionDiris not a setting PI-Desktop implements at all — the key has zero references acrossapps/,packages/andcrates/(verified by grep overmain@4f9f051e5).What each layer actually does:
@earendil-works/pi-coding-agent1.1.0,core/session-manager.js: the default session directory for a cwd is the encoded global path~/.pi/agent/sessions/--encoded-cwd--(getDefaultSessionDirPath()); theSessionManageraccepts a customsessionDirparameter, but only if its caller passes one.So the likely split is: whatever created your sessions inside the project's
.pi/sessionswas honoring the project setting at a layer below the desktop (the pi CLI/agent entry —main.jsdoes referencesessionDir), while the desktop's embedding never forwards that override. Net effect: creation and discovery disagree on the directory, which is your bug.Fix direction for the maintainers: either (a) have the desktop read the project
sessionDiroverride and pass it through to the sameSessionManagerused for listing, so creation and history share one source of truth, or (b) documentsessionDiras a CLI-only setting and have the desktop ignore it on creation too — currently the two halves of the product disagree, which is the worst of both.fix(agent-runtime): discover native sessions in project sessionDir
fix(agent-runtime): tolerate the Windows symlink privilege in the ses…
perf(sessions): cache file-derived session summaries by file identity (…