Repository navigation
fix: session detail 404 — use resolveSessionFilePath + parseSessionInfoFromLite - #20
Merged
Merged
Conversation
…foFromLite The GET /api/sessions/:id handler had two bugs: 1. readSessionLite(projectDir, sessionId) passes 2 args but it only accepts filePath — sessionId was silently ignored, so it tried to read a directory as a file, always returning null → 404 2. Manual path construction (getProjectsDir + sanitizePath) skips canonicalizePath, findProjectDir, and worktree fallback that listSessionsImpl uses — path mismatches cause 404 even if the file read worked Fix: use resolveSessionFilePath() for proper path resolution (handles symlinks, hash mismatches, worktrees), then readSessionLite(filePath) with the correct single-arg call, then parseSessionInfoFromLite() to return the same SessionInfo format as the list endpoint. Closes #18 🤖 Generated with [Claude Code](https://claude.com/claude-code)
dahai80
added a commit
that referenced
this pull request
Jul 31, 2026
- feat: session-project association — projectId field + project API + knowledge injection (#21) - feat: code generation API — POST /api/code/generate (#22) - feat: LSP operation API — POST /api/lsp/operation (#23) - fix: session detail 404 — use resolveSessionFilePath + parseSessionInfoFromLite (#20) - fix: WS chat binary resolution + Buffer handling + error detail - fix: ServerWebSocket type for Bun.serve WebSocket handlers - style: normalize formatting in projectApiServer and listSessionsImpl Co-Authored-By: Claude <[email protected]>
dahai80
added a commit
that referenced
this pull request
Aug 28, 2026
…ontext (audit §1.1.1 slice #20) (#190) updateFileHistoryState + updateAttributionState were two 14-LOC methods inside getToolUseContext with identical structure: same-ref-skip setAppState wrappers over a top-level slice. Both perf-critical (the skip avoids notifying all store listeners on every fileHistory no-op). Extract to a single generic helper applyNestedStateUpdater<K extends 'fileHistory'|'attribution'>(setAppState, key, updater) in src/utils/nestedStateUpdater.ts. TS infers the slice type from the literal key, so the REPL thin wrappers carry no inline type literal and match the ToolUseContext signatures via inference. Same-ref skip preserved verbatim. REPL 6386 -> 6361 (-25 net: -27 body +2 wrapper). 19 -> 20 slices, cumulative -710 -> -735. Byte-identical: downstream reads the same updateFileHistoryState / updateAttributionState fields on the context. 4 gates: typecheck 0 / bun test src/__tests__/ 902 pass / biome new files clean (REPL untouched, no autofix churn) / build:dev pass. Co-authored-by: Claude Fable 5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
GET /api/sessions/:idalways returns 404 even with valid sessionId (see #18).Root Cause
Two bugs in the handler:
Wrong function signature:
readSessionLite(projectDir, sessionId)passes 2 args, butreadSessionLiteonly acceptsfilePath— thesessionIdarg is silently ignored. It tries to read a directory as a file → always null → 404.Path resolution mismatch: The handler builds the project dir manually (
getProjectsDir() + sanitizePath(cwd)), skippingcanonicalizePath,findProjectDir, and worktree fallback thatlistSessionsImpluses. This causes path mismatches between list and detail endpoints.Fix
resolveSessionFilePath(sessionId, cwd)— handles symlink resolution, hash mismatches, and worktree fallback (same logic aslistSessionsImpl)readSessionLite(filePath)with correct single-arg signatureparseSessionInfoFromLite()to return the sameSessionInfoformat as the list endpoint (sessionId, summary, firstPrompt, lastModified, createdAt, gitBranch, cwd, fileSize, customTitle, tag)Closes #18
🤖 Generated with Claude Code