Skip to content

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

Closed

Description

@dezren39

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.

Activity

  1. added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    task/small-fixQueue packet kind: bounded fix with reproduction and targeted tests
    source/creatorFiled by the new-issue-creator job
    on Nov 4, 2026
  2. developing-today commented on Nov 4, 2026

    @developing-today
    Contributor
  3. added
    priority/normalOrdinary priority (the default)
    app/atlas-searchpkgs/atlas-search (Atlas search service + atlas-embed)
    on Nov 4, 2026
  4. dezren39 commented on Nov 4, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · picked up

    • Agent: new-issue-creator job (new-issue-creator-code-a)
    • 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
  5. added
    work/self-assignedAn agent grabbed this item directly, outside the queue
    app/fleetpkgs/fleet multicall binary + platform crates
    and removed on Nov 4, 2026
  6. dezren39 commented on Nov 4, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · done

  7. removed
    task/small-fixQueue packet kind: bounded fix with reproduction and targeted tests
    work/self-assignedAn agent grabbed this item directly, outside the queue
    on Nov 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    app/atlas-searchpkgs/atlas-search (Atlas search service + atlas-embed)app/fleetpkgs/fleet multicall binary + platform crateskind/bugSomething isn't working (prefixed form of the classic bug label)priority/normalOrdinary priority (the default)source/creatorFiled by the new-issue-creator jobstatus:done

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions