take the first cwd of a transcript, not the last
Opening a chat from a non-default folder moved the cwd picker into a subdirectory of
that folder — three of the four sessions under ~/dockers/officer.dev jumped to
`platform`, the fourth to `Lyrics` — and everything after it was scoped to the wrong
directory. The list itself stayed correct, which is what made it confusing.
Two functions in claude-sessions.ts derived the cwd in opposite directions. parseSummary
(:103) keeps the first `cwd` it sees; parseClaudeTranscript (:182) overwrote it on every
entry, so it ended up with whatever a tool last cd'd into. A session's home is where it
was launched — that is how Claude Code files the transcript on disk and how the list
groups it — so the first one is right and the two now agree. It also stops a late entry
clobbering `fallbackCwd` when the caller already knew which group it was loading from.
Pre-existing, but only reachable since rows became real links (3682269): clicking one is
a route change now, so the deep-link resolver in ChatHistory/index.tsx:69 — previously
hit only on refresh or a pasted URL — runs on every click, and it feeds detail.cwd
straight into setActiveCwd.
Verified against the four real transcripts in that group: all four now resolve to
~/dockers/officer.dev. C4/C5/C6 pass in the browser (click, refresh, and fresh-tab
deep-link all land on the right folder).
Also adds docs/nav-test-checklist.md — the 56-check matrix for the navigation refactor
and the sidecar work, recovered from the transcript of the session that wrote it and
lost it (eff24773). The X block no longer needs its own branch now that sidecars is
merged. C is done, L/J/D/P/X/R are not.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -179,7 +179,12 @@ function parseClaudeTranscript(filePath: string, sessionId: string, fallbackCwd
|
||||
} catch {
|
||||
continue;
|
||||
}
|
||||
if (entry.cwd) sessionCwd = entry.cwd;
|
||||
// First cwd wins — a session's home is where it was launched, which is how Claude Code files the
|
||||
// transcript on disk and how parseSummary groups it in the list. Later entries record wherever a tool
|
||||
// happened to cd to, so taking the last one made the detail disagree with the list: opening a session
|
||||
// moved the cwd picker to a subdirectory. It also let a stale entry clobber `fallbackCwd` even when the
|
||||
// caller already knew the group it was loading from.
|
||||
if (entry.cwd && !sessionCwd) sessionCwd = entry.cwd;
|
||||
if (entry.message?.model && !model) model = entry.message.model;
|
||||
|
||||
const content = entry.message?.content;
|
||||
|
||||
Reference in New Issue
Block a user