Skip to content

atlas-search: CLI get-chunk --neighbors has no upper bound — standalone returns the whole message, bypassing the service's 100-neighbor cap #5600

Closed

Description

@dezren39

atlas-search: CLI get-chunk --neighbors has no upper bound — standalone returns the whole message, bypassing the service's 100-neighbor cap

Summary

The service caps get-chunk neighbor context at 100, but the standalone CLI path for the same command enforces no maximum at all:

  • The service's get-chunk handler rejects neighbors > 100: pkgs/atlas-search/crates/atlas-search/src/server.rs:2078-2079 — if neighbors > 100 { return Err(bad_request("neighbors must be at most 100")) }.
  • The CLI's count() validation — documented as validating "against the service's request contract" (pkgs/atlas-search/crates/atlas-search/src/main.rs:583-591) — validates --neighbors only as non-negative, no maximum: main.rs:664 calls count("--neighbors", args.neighbors, 0, None).
  • The standalone path then calls run_get_chunk(backend, chunk_id, neighbors) (main.rs:669), which feeds neighbor_map in pkgs/atlas-search/crates/atlas-core/src/search.rs:283-284, 401-402 — the same chunk_idx ± n range machinery, with no cap.

So the identical request is a bad_request error via the service and an unbounded whole-message dump via the standalone CLI. This is the sibling of #5593 (--expand on the search surfaces, same missing bound, different flag/command/server check); #5593 does not cover the CLI get-chunk path.

Verified this run (2026-11-04, laptop probe)

Probe DB ~/git/fleet/probe-atlas-neighbors/probe.db (same fixture schema as the #5593 probe: one message with 300 chunks, chunk 151 mid-message), the atlas-search binary built from laptop main 8a8d509f8, local backend:

  • get-chunk 151 --neighbors 2 → context: 2 before + 2 after (control, as expected).
  • get-chunk 151 --neighbors 100 → 100 before + 100 after (the service cap, honored only by coincidence of the request).
  • get-chunk 151 --neighbors 250 → 150 before + 149 after = 299 context chunks, exit 0 — the whole message, nearly 3× the total the service allows for this exact command.

Why it matters

Acceptance criteria

  • The CLI's count() validation for --neighbors enforces the same maximum the service enforces (100), exit 2 with a message naming the bound, before any backend work — mirroring the --pool max handling.
  • A pinning test covers --neighbors at the bound (accepted) and above it (rejected), alongside the existing count_validation_mirrors_the_service_contract test in main.rs.
  • If the fix for atlas-search: expand has no upper bound — one hit returns its whole message, bypassing the 100-neighbor cap get-chunk enforces #5593 introduces a shared neighbor-bound constant, this cap uses it too (one source of truth for the neighbor bound across expand, get-chunk service, and get-chunk CLI).

Evidence

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
    priority/normalOrdinary priority (the default)
    on Nov 4, 2026
  2. developing-today commented on Nov 4, 2026

    @developing-today
    Contributor
  3. added
    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 · filed

  5. added
    queue/claimedQueue worker lifecycle state
    work/assignedQueue worker lifecycle state
    and removed on Nov 4, 2026
  6. dezren39 commented on Nov 4, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · handed off

  7. 85 remaining items

  8. added
    status/parkedDeliberately paused with a recorded resume condition
    on Nov 5, 2026
  9. dezren39 commented on Nov 5, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · handed off

  10. dezren39 commented on Nov 5, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · picked up

  11. added
    queue/claimedQueue worker lifecycle state
    and removed
    status/parkedDeliberately paused with a recorded resume condition
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    on Nov 5, 2026
  12. dezren39 commented on Nov 5, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · done — PR opened

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

app/atlas-searchpkgs/atlas-search (Atlas search service + atlas-embed)kind/bugSomething isn't working (prefixed form of the classic bug label)priority/normalOrdinary priority (the default)source/creatorFiled by the new-issue-creator jobstatus:donetask/small-fixQueue packet kind: bounded fix with reproduction and targeted tests

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions