fix: index CLI-created Claude sessions into Web UI#142
Merged
Zhang-Henry merged 1 commit intoOpenLAIR:mainfrom Apr 9, 2026
Merged
fix: index CLI-created Claude sessions into Web UI#142Zhang-Henry merged 1 commit intoOpenLAIR:mainfrom
Zhang-Henry merged 1 commit intoOpenLAIR:mainfrom
Conversation
Address code review feedback from OpenLAIR#93: - Wrap reconcile loops in per-item try/catch to prevent single failure from aborting the batch - Clear pendingClaudeSessionEvents on watcher reinit - Add path traversal guard for projectName (reject "." and "..") - Filter temp files with alphanumeric/hyphen regex on sessionId - Use console.warn instead of console.error for warnings - Track reconciled count separately from total project count Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
7 tasks
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.
Summary
Supersedes #93 — rebased on latest main and addresses all review feedback.
CLI sessions created via the
claudebinary were not visible in the Web UI because they bypass the dr-claw server and write.jsonlfiles directly to~/.claude/projects/. This PR adds two hooks to index them:.jsonlchange events and callreconcileClaudeSessionIndex()for each before broadcastingChanges from #93
All review feedback from @Zhang-Henry addressed:
reconcileClaudeSessionIndexfailure aborts entire batchpendingClaudeSessionEventsnot cleared on watcher reinitprojectsWatchers = []projectNamepath traversal (.,..).#session.jsonl) pass throughsessionIdvalidated with/^[\w-]+$/regexconsole.error('[WARN]')inconsistencyconsole.warnreconciledCountseparatelyAdditionally fixed:
reconcileClaudeSessionIndex()full-scan passedlimit=0togetSessions(), which triggered the early-exit optimization immediately (allSessions.size >= 0is always true). Changed tolimit=Infinityso full scans read all.jsonlfiles.Test plan
cd /path/to/project && claude)