fix: sidebar display issues — Codex titles, OpenCode visibility, Node 22#267
Conversation
Replace the single-pass full-enrichment startup with a two-stage approach: Stage 1 — Lightweight scan (~250ms): Read head 4KB + tail 16KB of every session file in parallel. Extracts sessionId, cwd, title, and lastActivityAt (from tail, skipping timestampless file-history-snapshot records). Emits to sidebar immediately when file count exceeds the enrichment batch size. Stage 2 — Selective enrichment (~100ms): Only the top 150 most recent non-subagent sessions get the full 256KB snippet read + parse. This provides accurate isNonInteractive filtering for the first sidebar page. Remaining sessions keep lightweight metadata and are enriched on-demand. On cold start with 800 files: ~280ms total vs ~1,100ms before. At scale (8,000+ files reported in danshapiro#237): sidebar populates in <1s vs 4-16s of empty sidebar. Also fixes: - Repair service startup deadlock (danshapiro#261): move queue.start() before discoverTopLevelSessions() so waitForSession() doesn't hang. - Skip redundant repair service discovery: the indexer already discovers all session files, so the repair service no longer globs at startup. Fixes danshapiro#237 Fixes danshapiro#261 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…er content The previous regex `^<[a-zA-Z_][\w_-]*[>\s]` matched ANY XML-opening tag, including user content like `<image name=...>`, `<file>`, `<analysis>`. This caused Codex sessions to show the cwd basename as title instead of the actual user prompt, because the real user message (containing `<image>` tags) was falsely classified as system context and skipped. Replace with an allowlist of known system context tag names: environment_context, system_context, system, context, INSTRUCTIONS, user_instructions, permissions, collaboration_mode, skills_instructions. Refs danshapiro#264 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Three fixes for danshapiro#264: 1. Codex title shows cwd basename instead of user prompt: Strip <image> markup tags from Codex user messages before title extraction so the actual prompt text is used. 2. OpenCode sessions not appearing: Upgrade warn level for the node:sqlite unavailability message. Add .nvmrc pinning Node 22 and engines field in package.json (>=22.5.0) since node:sqlite requires it. The project CI and Docker already target Node 22. 3. Enrichment handles Codex's large first lines: Codex session_meta lines can exceed 14KB, making the 4KB lightweight scan unable to extract cwd. The enrichment now falls back to file mtime for sort ordering when no cache entry exists, ensuring recent Codex sessions are enriched. Also tightens isSystemContext() to use an allowlist of known system context XML tags instead of matching all XML, preventing false-positives on user content like <image>, <file>, <analysis>. Refs danshapiro#264 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d826f671bf
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| if (a.isSubagent !== b.isSubagent) return a.isSubagent ? 1 : -1 | ||
| return b.lastActivityAt - a.lastActivityAt | ||
| }) | ||
| batch = candidates.slice(0, ENRICHMENT_BATCH_SIZE) |
There was a problem hiding this comment.
Parse all cold-start candidates missing lightweight metadata
During cold start, files that fail lightweight extraction are skipped from cache (lightweightScan drops entries with no cwd), and this enrichment path only reparses candidates.slice(0, ENRICHMENT_BATCH_SIZE). For repositories with more than 150 sessions, any non-selected files remain unparsed for this refresh, so those sessions do not appear in grouped sidebar results until a later full-scan cycle. This is user-visible for large Codex histories where session_meta can exceed the lightweight head window.
Useful? React with 👍 / 👎.
Resolve conflicts in session-indexer.ts: - Take upstream's bounded concurrency (LIGHTWEIGHT_SCAN_CONCURRENCY) - Keep our mtime fallback for Codex files that exceed lightweight head window - Keep our statCache for enrichment candidate sorting Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary
<image>markup tags before extracting title so the actual user prompt is shown instead of cwd basenameenvironment_context,permissions,collaboration_mode, etc.) to avoid falsely filtering user content like<image>,<file>,<analysis>node:sqliteunavailability log from debug to warn level. Add.nvmrc(22) andenginesfield (>=22.5.0) to match CI/Docker which already target Node 22session_metalines can exceed 14KB, exceeding the lightweight scan's 4KB head read. Enrichment now falls back to file mtime for sort ordering when no cache entry existsRefs #264
Depends on #265 (two-stage indexing)
Test plan
"[Image #1] - can you quickly summarize..."instead of"bitbucket"🤖 Generated with Claude Code