Skip to content

fix(search): allow auto cursor follow-up - #1563

Merged
Sinity merged 1 commit into
masterfrom
feature/fix/search-cursor-auto-lane
May 25, 2026
Merged

Sinity merged 1 commit into
masterfrom
feature/fix/search-cursor-auto-lane

Conversation

@Sinity

@Sinity Sinity commented May 25, 2026

Copy link
Copy Markdown
Owner

Summary

Allows search cursors minted for a resolved concrete lane, such as dialogue, to be reused on the normal follow-up request that still asks for retrieval_lane=auto.

Problem

Ranked search cursors encode the resolved lane so concrete lane switches can be rejected. But auto is a planner request, not a concrete ranking lane. A first page with default auto can resolve to dialogue and mint a dialogue cursor; the Python API search-envelope builder rejected the next default auto request before it could fetch the successor page. The shared cursor helper also rejected empty follow-up pages before any hit could establish a resolved lane.

Solution

  • Add a shared cursor/request lane compatibility predicate.
  • Treat auto, empty, or unspecified requested lanes as compatible with a concrete cursor lane.
  • Keep concrete lane switches rejected (dialogue cursor with hybrid request still fails).
  • Cover both apply_search_cursor and build_archive_search_envelope with focused regressions.

Ref #873

Verification

  • pytest -q tests/unit/surfaces/test_search_cursor_pagination.py tests/unit/api/test_search_envelope_builder.py tests/unit/surfaces/test_search_envelope_contract.py --tb=short — 21 passed.
  • ruff format --check polylogue/surfaces/payloads.py polylogue/api/search_envelope_builder.py tests/unit/surfaces/test_search_cursor_pagination.py tests/unit/api/test_search_envelope_builder.py && ruff check ... — passed.
  • mypy polylogue/surfaces/payloads.py polylogue/api/search_envelope_builder.py tests/unit/surfaces/test_search_cursor_pagination.py tests/unit/api/test_search_envelope_builder.py — passed.
  • devtools render-all --check — passed.
  • devtools verify --json — exit 0; 299 pytest-testmon selected tests passed; total 110.03s.
  • pre-push devtools verify --quick — exit 0; total 35.68s.

Problem: search cursors are minted for the resolved retrieval lane, but callers often leave follow-up requests at the default retrieval_lane=auto. The Python API path rejected a dialogue cursor on an auto follow-up, and the shared cursor helper could also reject empty successor pages before any hit resolved the lane.

What changed: centralize cursor/request lane compatibility so auto remains compatible with any concrete cursor lane while concrete lane switches still fail. Cover both apply_search_cursor and the archive search-envelope builder follow-up path.

Verification: pytest -q tests/unit/surfaces/test_search_cursor_pagination.py tests/unit/api/test_search_envelope_builder.py tests/unit/surfaces/test_search_envelope_contract.py --tb=short; ruff format/check touched files; mypy touched files; devtools render-all --check; devtools verify --json.
@coderabbitai

coderabbitai Bot commented May 25, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@Sinity, we couldn't start this review because you've used your available PR reviews for now.

Your plan includes 1 review of capacity. Refill in 9 minutes and 53 seconds.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more review capacity refills, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than trial, open-source, and free plans. In all cases, review capacity refills continuously over time.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: de7ac676-1b86-48e2-9688-353d0c9d2c60

📥 Commits

Reviewing files that changed from the base of the PR and between 0dbc2e6 and c63b41a.

📒 Files selected for processing (4)
  • polylogue/api/search_envelope_builder.py
  • polylogue/surfaces/payloads.py
  • tests/unit/api/test_search_envelope_builder.py
  • tests/unit/surfaces/test_search_cursor_pagination.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/fix/search-cursor-auto-lane

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 and usage tips.

@Sinity
Sinity merged commit 265b5e7 into master May 25, 2026
6 checks passed
@Sinity
Sinity deleted the feature/fix/search-cursor-auto-lane branch May 25, 2026 09:20
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