Repository navigation
fix(ai-vault): index Codex agent replies whose content blocks are typed Text - #20763
Conversation
…ed Text Codex 0.153+ writes paginated rollouts whose completed agent messages carry content blocks typed `Text`. The transcript reader matched block types case-sensitively, so every assistant turn from those sessions was dropped before it reached the search index while user turns and tool output were kept. Match case-insensitively and bump the index schema so existing indexes are rebuilt with the replies present.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (4)
Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review. 📝 WalkthroughWalkthroughThe change makes transcript block type matching case-insensitive, so capitalized Codex Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to The change is narrowly scoped to transcript recognition and index rebuilding, with tests covering both behaviors; it is ready to merge. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Description checkResolution Add the required Linked Issue with an issue number, include Visual Proof with ✨ Finishing Touches 💡 2📝 Generate docstrings 💡
🛠️ Fix failing CI checks 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — the full 4-file diff for this single-commit fix.
- Case-insensitive block type match (
session-transcript-message-content.ts:96-97) — lowercasesitem.typebefore theTEXT_BLOCK_TYPES/tool_use/tool_resultcomparisons, so Codex 0.153+ paginatedAgentMessageblocks typedTextare no longer dropped on the way to the search transcript sink. - Schema version bump (
session-search-schema.ts:13) —SESSION_SEARCH_SCHEMA_VERSION5 → 6 forces a drop/rebuild so the missing assistant rows are re-read. - Two new tests —
session-transcript-message-content.test.tsandsession-scanner-codex-parser.test.tspin theText-block assistant path end to end.
I verified the new tests are genuine coverage: reverting the one-line lowercase change makes both fail with expected [] to deeply equal [...]. The full src/main/ai-vault + src/main/ai-vault-search suite (149 files / 1318 tests) and oxlint on the changed files are green. The diagnosis also lines up with the existing real fixture at src/main/native-chat/transcript-reader-codex-history-mode.test.ts:124-153, where paginated user turns carry lowercase text while the agent reply carries Text — confirming the fix is scoped to exactly the rows that were missing.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
…ed Text (stablyai#20763) Codex 0.153+ writes paginated rollouts whose completed agent messages carry content blocks typed `Text`. The transcript reader matched block types case-sensitively, so every assistant turn from those sessions was dropped before it reached the search index while user turns and tool output were kept. Match case-insensitively and bump the index schema so existing indexes are rebuilt with the replies present.

Bug
Searching for a sentence an agent wrote in a recent Codex session finds nothing, even as an exact phrase. Sessions from Codex 0.153+ are written in paginated history mode, where each completed agent message is an
item_completedevent whose content blocks are typedText.transcriptMessagesFromContentmatched block types against a lowercase set, so every assistant turn from those sessions was dropped before it reached the search index. User turns (typedtext) and tool output were kept, which is why the gap was invisible in the status counts.On one local index: 3,216 Codex sessions, and every one written since the Codex format change has zero assistant rows.
Fix
session-transcript-message-content.ts: compare the block type case-insensitively.session-search-schema.ts: bumpSESSION_SEARCH_SCHEMA_VERSION5 → 6 so an existing index is dropped and rebuilt with the replies present. Rows for the affected files are marked fully read, so nothing short of a rebuild re-reads them.The panel preview path does not filter by block type, so it was already showing these replies.
Tests
session-transcript-message-content.test.ts: aTextblock on an assistant record yields an assistant message.session-scanner-codex-parser.test.ts: a paginatedAgentMessagewith aTextblock reaches the transcript sink as an assistant message.Gates:
pnpm tc,pnpm test src/main/ai-vault src/main/ai-vault-search,pnpm run check:code-quality:changed.