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
atlas-search + fleet-search: results-paging cursor guard catches only an immediate repeat — a cycling cursor (A→B→A) spins the no-sleep paging loop until the 330s deadline #5654
atlas-search + fleet-search: results-paging cursor guard catches only an immediate repeat — a cycling cursor (A→B→A) spins the no-sleep paging loop until the 330s deadline
Summary
The via-service results-paging loop in both client copies guards against a
non-advancing cursor only by comparing next_cursor with the cursor immediately before it (#5424). A service (buggy or malicious) that cycles
cursors with period ≥ 2 — A → B → A → B … — passes that check on every page.
The paging loop contains no sleep and no page/iteration cap, so the client
hammers the service's results endpoint at full loopback speed until the
330-second client deadline expires, accumulating duplicate results the whole
time (for a large --k, the results.len() >= k break does not save it).
Only then does the loud standalone fallback engage.
Evidence
pkgs/atlas-search/crates/atlas-search/src/service.rs, search_with_token,
paging loop (~lines 190–252): the only progress checks are page.next_cursor.is_none(), empty-page-with-cursor, and cursor.as_deref() == Some(next_cursor.as_str()) (immediate repeat).
No seen-cursor set, no page cap, no sleep between pages (the poll loop
sleeps 100 ms; the paging loop does not).
pkgs/fleet/crates/fleet-search/src/client.rs, search_with_token,
paging loop (~lines 300–390): the fleet-step-5 port carries the identical
loop and the identical guard ("The cursor guards from code#5424 ride
along unchanged").
Verified this run on the laptop with a stub service (fleet-search test
harness, StubMode::CyclingCursor added in probe worktree ~/git/fleet/wt-probe-cycle): the stub alternates cursor-A/cursor-B
with one result per page and k = 100_000. After 10 s the client was
still paging and the stub had received 2,307 results-endpoint hits
(~230 req/s). The existing repeating-cursor stub (period 1) is rejected
promptly by contrast (search_repeating_cursor_returns_err_promptly).
Why it matters
#5424's stated contract is that a non-advancing page stream "is a malformed
response and an error — never a loop". A period-2 cycle is exactly a
non-advancing page stream: the ranking never progresses, yet the client
burns up to 330 s and thousands of requests against the service before
falling back, and the spliced result list fills with duplicated pages.
The fleet-search port (#5433) doubles the exposed surface.
Acceptance criteria
Both copies (atlas-search/src/service.rs, fleet-search/src/client.rs)
reject any next_cursor already seen during this paging session (e.g. a HashSet of used cursors), returning the same style of malformed-page
error as the existing guards so the caller falls back to standalone loudly.
A regression test in each crate with a cycling-cursor stub (period ≥ 2)
returns Err promptly (comparable to the repeating-cursor test), and the
existing happy-path / repeating-cursor / empty-page tests still pass.
Behaviour for a well-behaved service is unchanged: distinct, advancing
cursors page exactly as before.
Session / ID: cron new-issue-creator-code-a, run 2026-11-04 ~15:05 CST
Found via: filed this run
Task: self-solving under the guarded trivial-fix rule (lifecycle §4): track seen cursors in both paging loops (atlas-search service.rs, fleet-search client.rs), reject any repeat as a malformed page, add cycling-cursor regression tests to both crates
Expectation: effort xs; done = PR merged with both crates' tests green on the laptop, issue closed
Links: probe worktree ~/git/fleet/wt-probe-cycle (laptop): cycling stub returned 2,307 results hits in 10s and was still paging
Activity
developing-today commentedon Nov 4, 2026
CODE-1410
dezren39 commentedon Nov 4, 2026
🤖 Agent note · picked up
fix(search): reject cycling paging cursors in both via-service clients (
dezren39 commentedon Nov 4, 2026
🤖 Agent note · done