Skip to content

fix(ai-vault): index Codex agent replies whose content blocks are typed Text - #20763

Merged
Jinwoo-H merged 4 commits into
mainfrom
session-search-fix-codex-text-blocks
Sep 16, 2026
Merged

Jinwoo-H merged 4 commits into
mainfrom
session-search-fix-codex-text-blocks

Conversation

@Jinwoo-H

@Jinwoo-H Jinwoo-H commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​29 $\color{#cf222e}{\Huge{\mathbf{−}}}$​1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​28
Prod 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​3 $\color{#cf222e}{\Huge{\mathbf{−}}}$​2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1

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_completed event whose content blocks are typed Text. transcriptMessagesFromContent matched block types against a lowercase set, so every assistant turn from those sessions was dropped before it reached the search index. User turns (typed text) 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: bump SESSION_SEARCH_SCHEMA_VERSION 5 → 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: a Text block on an assistant record yields an assistant message.
  • session-scanner-codex-parser.test.ts: a paginated AgentMessage with a Text block 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.

…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.
@coderabbitai

coderabbitai Bot commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 317f060f-2ee6-4a5b-a713-571ada6d325b

📥 Commits

Reviewing files that changed from the base of the PR and between 438603f and e3635b6.

📒 Files selected for processing (4)
  • src/main/ai-vault-search/session-search-schema.ts
  • src/main/ai-vault/session-scanner-codex-parser.test.ts
  • src/main/ai-vault/session-transcript-message-content.test.ts
  • src/main/ai-vault/session-transcript-message-content.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.


📝 Walkthrough

Walkthrough

The change makes transcript block type matching case-insensitive, so capitalized Codex Text blocks produce assistant messages. New tests cover direct content parsing and paginated Codex replies. The session search schema version increases from 5 to 6, causing existing indexes to be dropped and rebuilt on the next open.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 6cc61

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)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description accurately explains the bug, fix, schema rebuild requirement, and tests, but it omits several required template sections and confirmations. Add the required Linked Issue with an issue number, include Visual Proof with N/A and a reason because this is not a UI change, complete the Testing checkboxes and platform coverage, and include the remaining template sections and checkli…
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 4 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: indexing Codex agent replies with capitalized Text content blocks.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Resolution

Add the required Linked Issue with an issue number, include Visual Proof with N/A and a reason because this is not a UI change, complete the Testing checkboxes and platform coverage, and include the remaining template sections and checklist confirmations.

✨ Finishing Touches 💡 2
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 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) — lowercases item.type before the TEXT_BLOCK_TYPES / tool_use / tool_result comparisons, so Codex 0.153+ paginated AgentMessage blocks typed Text are no longer dropped on the way to the search transcript sink.
  • Schema version bump (session-search-schema.ts:13) — SESSION_SEARCH_SCHEMA_VERSION 5 → 6 forces a drop/rebuild so the missing assistant rows are re-read.
  • Two new tests — session-transcript-message-content.test.ts and session-scanner-codex-parser.test.ts pin the Text-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.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

Jinwoo-H added a commit that referenced this pull request Sep 15, 2026
… placeholder rows are rebuilt

Integration builds already shipped schema 6 with the Codex fix; main-bound
PR #20870 bumps 5 to 6 and will need 6 to 7 once #20763 lands first.
@Jinwoo-H
Jinwoo-H merged commit f6197db into main Sep 16, 2026
28 checks passed
ivanvykopal pushed a commit to ivanvykopal/orca that referenced this pull request Sep 20, 2026
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant