Repository navigation
Closed
Labels
app/atlas-searchpkgs/atlas-search (Atlas search service + atlas-embed)pkgs/atlas-search (Atlas search service + atlas-embed)kind/bugSomething isn't working (prefixed form of the classic bug label)Something isn't working (prefixed form of the classic bug label)priority/normalOrdinary priority (the default)Ordinary priority (the default)source/creatorFiled by the new-issue-creator jobFiled by the new-issue-creator jobtask/small-fixQueue packet kind: bounded fix with reproduction and targeted testsQueue packet kind: bounded fix with reproduction and targeted tests
Description
Bug
Grouped search computes its consideration window as (opts.k * 10).max(opts.pool) with no bound on k anywhere in the stack (pkgs/atlas-search/crates/atlas-core/src/search.rs:451, grouped_output):
let consideration = &ranked[..(opts.k * 10).max(opts.pool).min(ranked.len())];- The service's
validate_requestcapspoolat 1..=400 but checkskonly for zero (pkgs/atlas-search/crates/atlas-search/src/server.rs:509-524). - The CLI mirrors that contract deliberately (atlas-search(CLI): --k/--pool 0 and negative (=form) counts silently clamp to 0 — standalone returns empty success where the service rejects the same request #5407):
count("--k", args.k, 1, None)— minimum 1, no maximum (crates/atlas-search/src/main.rs:589; the pinning test at main.rs:728ff documents the mirror). - So a huge but well-formed
kreaches the multiplication. In a release build theusizemultiply wraps; in a debug build (cargo test / nix check) it panics on overflow and aborts the search.
Evidence (verified this run, main d4539fc)
k = 5534023222112865485— a validi64, so reachable from the CLI as--k 5534023222112865485and from any service client as JSON — gives(10 * k) mod 2^64 = 2(modular arithmetic checked this run). The consideration window becomesmax(2, pool): with--pool 10, the fused ranking can hold 20 candidates (10 FTS + 10 vector) but grouped output considers only 10, silently dropping sessions that should appear in the grouped results.k = 9223372036854775808(2^63, service-JSON reachable) wrapsk * 10to exactly 0; the window collapses topoolregardless of the ranking's size.- Nothing downstream notices:
sorted.truncate(opts.k)is a no-op at these values and the envelope renders normally — the grouped answer is silently incomplete, not an error.
Why it matters
--group-by-session is the view operators use to see which sessions a search hit. A crafted or fat-fingered --k (the flag takes any positive integer today, and scripts generate it) turns that view silently partial in release builds and crashes the search outright in debug builds. The pool parameter right next to it has a design maximum (400, design section 2); k needs the same treatment, or the arithmetic needs to stop overflowing.
Acceptance criteria
- A
kabove a stated maximum is refused with a clear error at both boundaries — the CLI'scount()for--kand the service'svalidate_request— with the two kept in mirror (the atlas-search(CLI): --k/--pool 0 and negative (=form) counts silently clamp to 0 — standalone returns empty success where the service rejects the same request #5407 pinning test extended to the new bound), ORgrouped_outputcomputes the window with saturating arithmetic and a test pins the huge-kbehavior. Either route must make the wrapped-window outcome impossible. - A regression test exercises grouped search with a
kin the wrap range (e.g. 5534023222112865485) and shows all fused candidates are considered (or the request is refused up front). - Existing atlas-core / atlas-search test suites stay green (
cargo test -p atlas-core -p atlas-search, run on the laptop or CI per fleet norms).
Metadata
Metadata
Assignees
Labels
app/atlas-searchpkgs/atlas-search (Atlas search service + atlas-embed)pkgs/atlas-search (Atlas search service + atlas-embed)kind/bugSomething isn't working (prefixed form of the classic bug label)Something isn't working (prefixed form of the classic bug label)priority/normalOrdinary priority (the default)Ordinary priority (the default)source/creatorFiled by the new-issue-creator jobFiled by the new-issue-creator jobtask/small-fixQueue packet kind: bounded fix with reproduction and targeted testsQueue packet kind: bounded fix with reproduction and targeted tests
Activity
dezren39 commentedon Nov 4, 2026
🤖 Agent note · filed
dezren39 commentedon Nov 4, 2026
agent-note:v1
event: picked_up
task: task 9436 (repo-health-code-pilot; worker repo-worker-code; lane code-a)
by: repo-worker-code (lane code-a shift)
at: 2026-11-04T12:20:00Z
state: claimed — direct execution lane
action: implement the grouped_output k bound/saturating fix for issue #5423 on a laptop worktree branch, open a PR, and complete task 9436 at the first verified outcome
dezren39 commentedon Nov 4, 2026
agent-note:v1
event: parked
task: task 9436 (repo-health-code-pilot; worker repo-worker-code; lane code-a)
by: repo-worker-code (lane code-a shift)
at: 2026-11-04T12:22:00Z
state: parked 1200s — PR #5435 opened (branch queue/9436-5423-bound-k, commit e29c59a); PR checks queued and Codex review still running at park time, no findings posted yet
verified: fix implemented on laptop worktree ~/git/fleet/9436 (saturating_mul window in grouped_output, acceptance route 2 for issue #5423); cargo test -p atlas-core -p atlas-search all green on the laptop including new grouped_wrap_range_k_considers_all_candidates regression test; changed files rustfmt-clean. Push went through the sandbox clone because the laptop gh token is invalid (gh auth status on amd-6: token in default is invalid) — branch SHA on GitHub verified identical to the laptop commit.
resume: read PR #5435 fresh — disposition any Codex findings, and merge under the standing criteria once checks/Codex are settled; then complete task 9436 as fixed_merged
links: #5435
fix(atlas-search): saturate grouped_output k*10 window so wrap-range …
dezren39 commentedon Nov 4, 2026
agent-note:v1
task: 9436
lane: code-w
state: done
artifact: PR #5435 (merged, squash merge commit 28cc850)
note: Resumed task 9436 at stage pr_opened. Codex review on PR #5435: "didn't find any major issues" — no findings to disposition. Basic checks SUCCESS (production line limit, proxy port fallbacks). Merged under the standing criteria 2026-11-04T12:46:45Z; issue #5423 closed by the merge. Task 9436 completed as fixed_merged.