Skip to content

E9-1 route 2 S2b-3c (lane MB): POST /v1/reduction-sessions, implemented, and refresh refusing a route-2 session - #2175

Merged
github-actions[bot] merged 93 commits into
mainfrom
claude/mb-reduction-open-route-impl
Oct 25, 2026
Merged

github-actions[bot] merged 93 commits into
mainfrom
claude/mb-reduction-open-route-impl

Conversation

@kunwarshivam

@kunwarshivam kunwarshivam commented Oct 22, 2026 •

Copy link
Copy Markdown
Owner

Story

E9-1, route 2, slice S2b-3c: the implementation half of DEC-77. Spec: workspace API spec §4.10 route 2 items 1 and 3 to 5. Decisions: DEC-2117, DEC-2119, DEC-2127, DEC-2319 item 2, DEC-2324.

Stacked on #2174 (its tests), with main merged in (merge commits only).

reduction::open runs these steps, in this order, for every request:

  1. Browser check: 403 without the marks.
  2. The client key: the address, read as the challenge route reads it, and the device cookie's digest. A missing or malformed cookie is the digest of the empty value, the one shared budget of DEC-2127.
  3. Request::parse: exactly five string members. The base64url ones are unpadded and at most 8,192 characters.
  4. take the challenge before anything is judged.
  5. Judge, only for a parsed request with a taken challenge:
    • read the hosted control stream once, and parse its passkey and membership records;
    • call opening::judge with the deployment's RP and the artifact store's keys;
    • answer the judge's standing lookup from Sessions::standing(member), so the session store stays the standing's one owner and lends out no Standings.
  6. settle with the gate: an opening counts no failure. The failure that first reaches a limit calls alerted(), which writes alert_line() to stderr, operator_alert reduction_failures_over_limit docs/runbooks/RB-20-reduction-failures.md, and counts it in alerts_raised().
  7. Answer: on an opening, open_reduction_only replaces a presented session, and the answer is 201 with no-store and the session cookie for REDUCTION_ONLY_LIFETIME_S. Every other outcome is the one 401 with no-store. No reply sets or clears the device cookie.

Refresh: POST /v1/sessions/refresh checks opened_by_passkey before any token is read or any refresh runs. It answers 403 reduction_only (Refused::ReductionOnly), keeps the session, and sets or clears nothing.

Non-Rust changes: only two, besides the tests' 10 deleted #[ignore = "pending E9-1"] lines:

Spec clause → test

The tests are #2174's: 10 in reduction_sessions_http.rs (its table, plus an_opening_counts_no_failure), now served.

Dependencies

None.

Journal events added

None.

Not done

S2b-4: agent_ids and connection_ids, /me/session, the reach tests, and the spec's served status.

Decisions needed

None.

Safety checklist (safety-critical changes)

  • No floats in money or quantity paths
  • No clock reads or randomness in the core
  • No unwrap, expect, or panics on trading paths
  • Ordering: inputs processed in journal order
  • Replay: same inputs give identical outputs
  • No secrets or trading content in logs or notifications (the alert line is the code and the runbook's path)
  • No x-planned or (planned: ...) marker added to a value the code already serves, or a reviewer signed it off (DEC-683)

Checks

  • cargo xtask ci fast parts are green locally.
  • cargo xtask ci mutants on the diff vs main: 33 mutants, 25 caught, 8 unviable, 0 missed.
  • 10 planted bugs, each caught: refresh not refusing, an extra member accepted, Max-Age 1800, an opening settled as a failure, the presented session not replaced, no-store dropped, alerted not counting, alert_line carrying a field, the judge's standing asked of a fixed member, and an opening's settle skipped.
  • Review agent report attached

Review record

Pair #2174 (S2b-3c tests, 722f88d) + #2175 (S2b-3c impl, fb22cb5), E9-1 route 2 (reduction-only sessions, AGENTS.md rule 13). Builder: lane L1 builder 2. Independent review on a different model: PASS for both and for the pair; no blockers, no majors.

  • Scope: code only in mandate-api-server http.rs and reduction.rs; docs RB-20 runbook plus infrastructure §8.2/§8.4 rows; tests changed only by 10 deleted #[ignore = "pending E9-1"] lines (DEC-77).
  • Gates (reviewer): fmt, markers, clippy -D warnings clean; mandate-api-server nextest 547/547; ci pending all 21 remaining fail at a stub; spec-guard no protected paths.
  • Mutants on the diff: reviewer 18 tested / 13 caught / 5 unviable / 0 missed; builder (wider base) 22 / 16 / 6 / 0 missed.
  • Planted bugs: builder 10/10 caught; reviewer's own 10, 9 caught (opening counted as failure, peeked challenge, limit refusing an opening, refresh without the route-2 guard, presented session not ended, cookie Max-Age, per-call device key, no alert, no browser check). The tenth (B10, an extra attribute on the session Set-Cookie) survived a contains check; fixed before landing at the coordinator's hold (below).
  • E9-1 route 2 S2b-3c tests (lane MB): POST /v1/reduction-sessions, its stub, route, and pending tests #2174 review notes met: RB-20 exists and quotes alert_line() exactly; a reduction-only session's refresh answers 403 reduction_only before the token is read and ends nothing.
  • Risk: a verified assertion is never refused for a limit; a control-stream read failure refuses the opening (no membership, safe default); nothing opens more than a reduction-only session. Known gap recorded in RB-20 (verified assertion whose session cannot open counts no failure).
  • B10 fix (coordinator hold, safety-critical auth path): E9-1 route 2 S2b-3c tests (lane MB): POST /v1/reduction-sessions, its stub, route, and pending tests #2174 gained one test-only commit (722f88d); E9-1 route 2 S2b-3c (lane MB): POST /v1/reduction-sessions, implemented, and refresh refusing a route-2 session #2175 merged it (fb22cb5), whose tests still differ from E9-1 route 2 S2b-3c tests (lane MB): POST /v1/reduction-sessions, its stub, route, and pending tests #2174's only by the 10 deleted ignore lines and whose src diff is byte-identical to 5642daa's. The 15-minute test now asserts exactly one Set-Cookie, its name COOKIE_NAME with a non-empty value, and the attribute list equal to ["Path=/", "Max-Age=900", "Secure", "HttpOnly", "SameSite=Strict"] in order. Delta review PASS for both heads: B10 (; Domain=x), dropped HttpOnly, SameSite=Lax, dropped Secure, reordered attributes, and a second Set-Cookie each now fail; nextest 547/547; mutants 0 missed.
  • CI: ci run 40242143866 (pull_request) is green on fb22cb5.

Coordinator-approved-head: fb22cb5

https://claude.ai/code/session_01XaatUQzQSGvN12QXK3pnJh


Generated by Claude Code

claude added 30 commits October 22, 2026 02:21
… reserve and max_failure_keys; pending tests (E9-1 S2a, DEC-2119 items 4 and 11)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018iKGDLLDHxGNmpHbTwqW8K
…failure_keys with the oldest key dropped first (E9-1 S2a, DEC-2119 items 4 and 11)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018iKGDLLDHxGNmpHbTwqW8K
Stop dropping failure keys when a removal removes nothing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018iKGDLLDHxGNmpHbTwqW8K
…9-1 S2b-1)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018iKGDLLDHxGNmpHbTwqW8K
… and DEC-2319 (Proposed) (E9-1 S2b-2)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018iKGDLLDHxGNmpHbTwqW8K
…-2, DEC-2319 item 2)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018iKGDLLDHxGNmpHbTwqW8K
…e, and bound a failure's cost (review of #2128, B1 and B2)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018iKGDLLDHxGNmpHbTwqW8K
…cost no scan of the keys (review of #2131, B2)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018iKGDLLDHxGNmpHbTwqW8K
…2324 (E9-1 S2b-2b)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018iKGDLLDHxGNmpHbTwqW8K
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018iKGDLLDHxGNmpHbTwqW8K
…wrong secret (review of #2135, B1 and B2)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018iKGDLLDHxGNmpHbTwqW8K
…5, DEC-2319 item 2)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018iKGDLLDHxGNmpHbTwqW8K
…item 2)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018iKGDLLDHxGNmpHbTwqW8K
…s and pending tests (E9-1 S2b-3b)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018iKGDLLDHxGNmpHbTwqW8K
…emented (E9-1 S2b-3b)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018iKGDLLDHxGNmpHbTwqW8K
… S2b-3c)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018iKGDLLDHxGNmpHbTwqW8K
…session reduction_only (E9-1 S2b-3c)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018iKGDLLDHxGNmpHbTwqW8K
…: stubs, pending tests, DEC-2324 item 4 (review of #2153)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018iKGDLLDHxGNmpHbTwqW8K
…it: one ES256 and one Ed25519 check on every call (DEC-2324 item 4)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018iKGDLLDHxGNmpHbTwqW8K
claude added 14 commits October 25, 2026 16:53
Main took RB-19 for the connect teardown (#2289), so the route 2
failed-assertion runbook this branch adds is renumbered RB-20.

Claude-Session: https://claude.ai/code/session_01XaatUQzQSGvN12QXK3pnJh
…poisoned lock (review of #2166)

The review found the T0+339 assertion vacuous: settle answers false there
whether or not the failure lapsed. Two devices now pin the window to the
second, one reaching its limit at 338 s only if a failure at 39 s still
counts, the other reaching it afresh at 339 s only if it lapsed then.
Sixteen threads taking one challenge must find exactly one Some, and a
panic inside issue that poisons the store's locks must leave take and
settle working. Sessions::standing's doc names Standings as the standing's
one owner, which the session store alone writes.

Claude-Session: https://claude.ai/code/session_01XaatUQzQSGvN12QXK3pnJh
…cookie; reserve DEC-2127 (review of #2174)

The review's majors: a verified assertion past a device's and past an
address's failure limit still answers 201 and raises nothing, and a
challenge refused once is refused again with a correct assertion. Its
minors: no reply of the assertion route sets or clears the device cookie,
an expired challenge is the one 401, the alert's line is a function of
nothing a request carried (alert_line, a stub), and the shared
cookie-less device budget is DEC-2127. Reads takes a standing lookup in
place of Standings, so the session store stays the standing's one owner,
and a test pins that the judge asks it once per request, of the decoy for
an unknown passkey.

Claude-Session: https://claude.ai/code/session_01XaatUQzQSGvN12QXK3pnJh
…ute-impl

Implements what #2174's review added: alert_line writes the code and
RB-20's path and nothing else, alerted writes it, and the route answers
the judge's standing lookup from Sessions::standing, so Sessions no longer
lends out its Standings. The three new HTTP tests lose their ignore.

Claude-Session: https://claude.ai/code/session_01XaatUQzQSGvN12QXK3pnJh
@kunwarshivam
kunwarshivam changed the base branch from claude/mb-reduction-open-route to main October 25, 2026 22:24
@kunwarshivam
kunwarshivam marked this pull request as ready for review October 25, 2026 22:24
…(B10, review of #2175)

The 15-minute test checked the Set-Cookie with contains, so an extra
attribute such as Domain passed. It now checks the one Set-Cookie's name,
then Path, Max-Age, Secure, HttpOnly and SameSite in that order, and
nothing else.

Claude-Session: https://claude.ai/code/session_01XaatUQzQSGvN12QXK3pnJh
@github-actions
github-actions Bot merged commit 981eb90 into main Oct 25, 2026
44 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants