Skip to content

Atlas step 4: serve mode — job protocol, temp store, dedupe cache (#5354) - #5392

Merged
dezren39 merged 1 commit into
mainfrom
atlas-step4-serve
Nov 4, 2026
Merged

dezren39 merged 1 commit into
mainfrom
atlas-step4-serve

Conversation

@dezren39

@dezren39 dezren39 commented Nov 4, 2026 •

Copy link
Copy Markdown
Member

Implements epic #5350 step 4 per the approved design (doc/2026-11-04T08-07-13Z_design_atlas_binary_service §2-§3) plus Drew's two in-flight rulings: the bounded async queue with TTL-from-completion, the per-client job recovery list, and the dedupe cache keyed by the effective (post-clamp) request.

Full detail is in the commit message. Highlights:

  • atlas-proto (new crate): wire types shared by server + CLI client — search/jobs/status/page/delete/health, the recovery list, error shapes.
  • serve mode: loopback HTTP+JSON, one shared embedder, read-only Turso token only; branches concurrent via a new atlas-core BranchPoolExecutor seam (standalone semantics untouched); single-branch vector/index jobs — the primary laptop-local unfiltered path — execute inline under a one-slot reservation.
  • Queue: bounded strict-FIFO queue in front of ≤4 branch executions; overflow 429 + Retry-After + queue depth; accepted queued jobs never expire in queue; ranking TTL 10 min from completion.
  • Dedupe: exact-key sharing on the effective request (query, mode, k, pool, render flags, model, embedder, trunc, vector backend, full filter tuple, effective ceiling); in-flight coalescing; per-submission job handles; failures evicted.
  • Auth/clamp: 0600 service.json from the new init verb (v1 table: drew-cli secret-bearing cap; openchamber/fork-server/sandbox-scripts personal); job reads via owner client token or per-job capability token; job-scoped get-chunk ceiling-checked with the missing-chunk shape.
  • CLI: --via-service runs the real submit→poll→page protocol behind step 3's unchanged loud-fallback contract.

Gates: workspace tests green (43 passed), clippy 0, fmt clean; protocol tests for paging/no-reexecution, ceilings on every path, TTL-from-completion, FIFO overflow, index modes, recovery list, and all four dedupe cases; live production E2E 15/15 + fallback + restart gates (details on #5354).


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

… dedupe cache (#5354)

New atlas-proto crate carries the wire types shared by server and CLI client: search/job/page/error/health shapes, the per-client recovery list, and the sensitivity ladder used by the server-side clamp.

Serve mode (new server.rs, ~2,300 lines with tests): loopback HTTP+JSON on the design endpoints (one-shot, jobs, status, results paging, job-scoped chunk, delete, health, recovery list). One shared embedder behind a load-state handle; Turso backend with a read-only token only. Branches run concurrently through a new atlas-core BranchPoolExecutor seam (run_search_with_executor; standalone semantics unchanged) — hybrid jobs fan out, single-branch jobs (the primary laptop-local unfiltered vector/index path) execute inline under a one-slot reservation.

Jobs: a bounded strict-FIFO execution queue sits in front of the <=4 concurrent branch executions (per-client caps 2 running + 8 queued, global queue cap 8); overflow is 429 + Retry-After with queue depth. Accepted queued jobs never expire in the queue; the stored ranking TTL (10 min) runs from completion (60 min hard cap retained as the pre-completion bound). Temp store is in-memory only — a restart fails every job expired-or-unknown, and no result data is ever written to disk.

Dedupe cache (Drew's ruling, 2026-11-04): execution is shared by effective request. The cache key is the post-clamp request — query, mode, k, pool, grouping/expand/message flags, model, embedder, trunc, vector backend, the full filter tuple, and the EFFECTIVE ceiling. In-flight coalescing attaches identical submits to a queued/running computation; completed hits within TTL return the ready ranking. Every submitter still gets its own job id + capability handle; failed computations are evicted so later submits retry.

Auth: per-client bearer tokens from a 0600 service.json (generated by the new init verb with the v1 client table: drew-cli secret-bearing; openchamber, fork-server, sandbox-scripts personal); requests clamp to the token cap and the effective ceiling is recorded on the job. Job-scoped reads accept the owning client token or the per-job capability token only; get-chunk under a job returns the missing-chunk shape for anything above the job ceiling. The recovery list (GET /v1/search/jobs) returns the caller's own jobs, metadata only.

CLI: --via-service now runs the real protocol (submit -> poll -> page) behind step 3's untouched loud-fallback contract; get-chunk keeps the loud fallback (chunk reads are job-scoped in the protocol).

Verification: workspace tests green (43 passed, Gate A ignored as a ceremony test), clippy 0 warnings, fmt clean. Protocol tests cover paging without re-execution, ceiling/capability on every path, TTL-from-completion with queue wait > TTL, bounded FIFO + overflow 429, index modes as single-branch jobs, the recovery list, and all four dedupe gates. Live E2E against production (read-only, worktree server on a scratch port/config): 15/15 — hybrid/scan parity x4, index-fixed + index-fill unfiltered parity, dedupe 6s -> 0.00s, recovery list + pickup, 3-parallel queueing, warm health; fallback gate (warning + note + standalone-identical) and restart gate (404 expired-or-unknown, zero result files on disk) also pass.
@dezren39
dezren39 requested a review from a team as a code owner November 4, 2026 10:32
@dezren39
dezren39 merged commit 5acabc8 into main Nov 4, 2026
@coderabbitai

coderabbitai Bot commented Nov 4, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 41 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 841b3881-716f-46e1-9d58-7a37f13cc2e6
Commits

Reviewing files that changed from the base of the PR and between 4d13062 and 1272cd7.

Files ignored due to path filters: 1
  • pkgs/atlas-search/Cargo.lock is excluded by !**/*.lock
Files selected for processing: 9
  • pkgs/atlas-search/Cargo.toml
  • pkgs/atlas-search/crates/atlas-core/src/lib.rs
  • pkgs/atlas-search/crates/atlas-core/src/search.rs
  • pkgs/atlas-search/crates/atlas-proto/Cargo.toml
  • pkgs/atlas-search/crates/atlas-proto/src/lib.rs
  • pkgs/atlas-search/crates/atlas-search/Cargo.toml
  • pkgs/atlas-search/crates/atlas-search/src/main.rs
  • pkgs/atlas-search/crates/atlas-search/src/server.rs
  • pkgs/atlas-search/crates/atlas-search/src/service.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@dezren39
dezren39 deleted the atlas-step4-serve branch November 4, 2026 10:32
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-04T10:33:33.456627Z 1272cd7 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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