You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(web-search): bound duplicate citation title updates - #8813
Repeated unusable titles for an existing titleless citation made the sidecar parser rebuild and revalidate its entire retained source list. Every append then serialized all preceding sources again. A small upstream response could therefore cause substantial synchronous work despite the existing source and wire limits.
Reject invalid offered titles before inspecting the retained list.
Update one previously validated citation using its serialized UTF-8 byte delta and a single aggregate-size pass, preserving its position and every other source.
Preserve the first usable later title, exact byte/count/URL limits, later shorter-title retries, and final-versus-streaming precedence.
Update the owning Search Data Plane contract.
Verification
Recorded local validation:
Independent prepatch validation used the exported production parser with at most 256 duplicate annotations. A 31,525-byte response triggered 54,180 source serializations, compared with 420 without duplicates. These are operation counts, not peak memory or production latency.
The new regression failed on the base: forty invalid duplicates increased source serializations from 420 to 8,820 while leaving the output unchanged. After the fix, invalid duplicates add no source serialization. A later valid title still fills the original position.
An exact UTF-8 boundary test confirms an over-budget title leaves every source intact and a later shorter Unicode title reaches the aggregate limit exactly.
bun test tests/web-search/web-search-sources.test.ts tests/web-search/web-search-eof.test.ts tests/web-search/fix-search-frame-shapes.test.ts: 168 passed / 577 assertions.
Typecheck: 2,536 files, no errors. Structure, privacy, file-size and staged whitespace gates passed; no caps were raised.
The companion credential-mask regression now times the excerpt masker directly and separately asserts full SSE rewrite output and secret removal, with a bounded whole-text restart count. It does not claim a new full-rewrite performance measurement.
Upstream validation for e54449b1ccb455f473b623735bd17f7af934ab38 passed: Cross-platform CI, Catalog async contracts, and PR gates. The changed-test subset passed; skipped full/native-platform shards are not claimed as executed. An additional read-only review of this exact commit found no blocking correctness or test-isolation issue; it did not rerun tests or performance measurements. Installed/live application validation and explicit maintainer security review before merge remain separate.
Checklist
Scope stays focused and avoids unrelated cleanup.
Docs or release notes were updated when needed.
Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults.
The security checkbox records implementation review; explicit maintainer security review remains required before merge.
Summary by CodeRabbit
Bug Fixes
Improved web-search citation titles: valid titles from completed results are used when available, while valid streamed titles are retained when no completed title is available.
Updated titles preserve citation order and are applied only when they fit within the source-size limit.
No actionable comments were generated in the recent review.
Walkthrough
The parser now uses shared logic to add valid titles to retained citation sources, subject to the aggregate serialized-byte limit. The tests also expand coverage for citation updates and credential masking.
Changes: Citation title updates
Layer / File(s)
Summary
Shared title replacement and citation coverage src/web-search/sources.ts, src/web-search/parse.ts, structure/data-planes/search.md, tests/web-search/web-search-sources.test.ts
The parser uses a shared helper to fill a missing title on the first matching source. The helper validates the title and applies the replacement only when the updated serialized sources fit the byte limit. Documentation and tests cover duplicate citations and exact replacement limits.
The tests check credential removal, preserved message content, elapsed time, and whole-text search counts for large terminal output and rewritten SSE payloads.
lidge-jun/opencodex#8491: Changes sidecar citation-title handling for repeated URLs, including title replacement and source position preservation. Its retained-title behavior relates directly to the title contract in this change.
Merge Risk: Minimal · up to e5444
This change bounds the work done for duplicate citation titles in web-search parsing while keeping the existing size limits. No concrete merge-blocking risk was identified. Installed-application validation remains outstanding.
Pre-merge checks: 4
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title "fix(web-search): bound duplicate citation title updates" matches the main change. The PR adds fillMissingWebSearchSourceTitle in src/web-search/sources.ts, which fills a missing title only …
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title "fix(web-search): bound duplicate citation title updates" matches the main change. The PR adds fillMissingWebSearchSourceTitle in src/web-search/sources.ts, which fills a missing title only on a matching source and rejects invalid titles early. parse.ts switches to this helper, and tests cover repeated invalid titles and the UTF-8 byte budget. The title names the bounded duplicate handling, which is the core fix. The title is concise, follows conventional-commit style, and does not use vague terms.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.
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
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
Repeated unusable titles for an existing titleless citation made the sidecar parser rebuild and revalidate its entire retained source list. Every append then serialized all preceding sources again. A small upstream response could therefore cause substantial synchronous work despite the existing source and wire limits.
Verification
Recorded local validation:
bun test tests/web-search/web-search-sources.test.ts tests/web-search/web-search-eof.test.ts tests/web-search/fix-search-frame-shapes.test.ts: 168 passed / 577 assertions.The companion credential-mask regression now times the excerpt masker directly and separately asserts full SSE rewrite output and secret removal, with a bounded whole-text restart count. It does not claim a new full-rewrite performance measurement.
Upstream validation for
e54449b1ccb455f473b623735bd17f7af934ab38passed: Cross-platform CI, Catalog async contracts, and PR gates. The changed-test subset passed; skipped full/native-platform shards are not claimed as executed. An additional read-only review of this exact commit found no blocking correctness or test-isolation issue; it did not rerun tests or performance measurements. Installed/live application validation and explicit maintainer security review before merge remain separate.Checklist
The security checkbox records implementation review; explicit maintainer security review remains required before merge.
Summary by CodeRabbit