Skip to content

fix(responses): keep search replay ID allocation linear - #7419

Merged
lidge-jun merged 1 commit into
lidge-jun:devfrom
luvs01:fix/search-replay-id-allocation-20261020
Oct 21, 2026
Merged

lidge-jun merged 1 commit into
lidge-jun:devfrom
luvs01:fix/search-replay-id-allocation-20261020

Conversation

@luvs01

@luvs01 luvs01 commented Oct 20, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Replaying several hosted search cells without usable IDs repeatedly rescanned already allocated suffixes. Keep a request-local next-suffix cursor for each base while retaining the request-wide collision set, so allocation grows linearly and still chooses the smallest available ID.

The regression coverage preserves seeded client IDs, alternate bases, duplicate-cell handling, batching order, and original input indices. The runtime contract is updated alongside the implementation.

Verification

  • Bun 1.4.3: bun scripts/test.ts --changed=12025981e5a304cdb6b1b54f525ba8554f623977 tests/web-search/web-search-sidecar-replay.test.ts tests/responses/responses-parser.test.ts — 112 passed, 0 failed, 307 assertions; exactly 2/2 selected test files.
  • Bun 1.4.2: the same focused files — 112 passed, 0 failed.
  • bun node_modules/typescript/bin/tsc --noEmit, bun scripts/structure-ssot.ts, bun scripts/privacy-scan.ts, and git diff --check passed.
  • Independent source review found no additional actionable regression. The allocation-work assertion fails on the original allocator and passes with this change.

The full local suite and live provider calls were not run. Local validation was bounded to the allocator and its existing parser consumers; the hosted CI on this exact head passed all required checks, including all four test shards. Platform-specific jobs outside this PR's CI policy were skipped.

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.

@coderabbitai

coderabbitai Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: lidge-jun/opencodex/.coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 6bb2eee4-d97e-4a49-8021-82ab7aed683c
📥 Commits

Reviewing files that changed from the base of the PR and between 1202598 and d2f23f1.

📒 Files selected for processing: 3
  • src/responses/web-search-replay.ts
  • structure/runtime.md
  • tests/web-search/web-search-sidecar-replay.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

📝 Walkthrough

Replayed web-search cells now use per-base suffix cursors to allocate synthetic call IDs. Allocation checks the request-wide set for collisions. Tests cover allocation performance, suffix selection, duplicate-cell removal, and preserved source-index mappings.

Changes: Web-search replay ID allocation

Layer / File(s) Summary
ID allocation and replay validation
src/responses/web-search-replay.ts, structure/runtime.md, tests/web-search/web-search-sidecar-replay.test.ts
The allocator checks the unsuffixed base ID, then resumes suffix allocation from a per-base cursor while checking the shared set. Tests cover linear probing, seeded and alternate-base collisions, duplicate removal, rewritten IDs, and source-index mappings. The runtime documentation describes the allocation behavior.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to d2f23

The change keeps replay ID allocation linear while preserving collision avoidance. No actionable merge-blocking risk remains.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: keeping web-search replay ID allocation linear. It matches the implementation and test coverage.
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files. (1 skipped: 1 …
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: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files. (1 skipped: 1 unsupported.)

✨ 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.

❤️ Share

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

@github-actions

Copy link
Copy Markdown
Contributor

✅ Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the bug Something isn't working label Oct 20, 2026
@luvs01
luvs01 marked this pull request as ready for review October 20, 2026 01:30

@Ingwannu Ingwannu left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Correctness approval at d2f23f1a4a5f7616e2efbb77a5f9a5d683db6d4d against dev 12025981e5a304cdb6b1b54f525ba8554f623977: request-local suffix cursors preserve the smallest free ID under the shared collision set, seeded IDs, alternate bases, duplicate cells, batching and original input positions.

Independent bounded Bun 1.4.3 regression: 112 pass / 0 fail across two files. Each workload ran alone under CPU/RAM/swap/process/time caps and fresh private HOME/CODEX_HOME/OPENCODEX_HOME/TMPDIR. Existing frozen dependency maps and lock matched; no live account/provider/client config was used. Current-head hosted ci/gates and the latest effective hygiene/enforce-target checks pass; older cancelled repetitions are superseded by later successful executions of those checks. Typecheck is evidenced by hosted gates, not a claimed new local compiler run. The changed contract and relevant negative controls were reviewed. This approval does not merge, release, certify unselected platforms, or authorize live operations.

@lidge-jun
lidge-jun merged commit dc98a20 into lidge-jun:dev Oct 21, 2026
44 of 45 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants