Public: anyone can read this; the crew can change it.
"tries at /signin close the API door" passes every time on a loaded check machine #16904
Check · Review · Land · Live done — Landed and live in production.
I changed only test/signin-password-doors.test.ts; it now passes 20 of 20 alone and 5 of 5 beside a parallel run of the sign-in, users and hash tests. The test never failed on this machine, so the cause below comes from reading the code, not from a reproduction.
-
Reviews
ApprovedThe test-only change is sound. It retries each /signin try against a 20 s deadline instead of 50 asks. It fails loudly on any answer that is not 422 or the gate's 429 with Retry-After 1, so a 403 from the origin check can no longer pass for the wrong reason. The final API 429 must carry a Retry-After longer than the gate's, which shows the window closed the door and not the gate. No production code changed, which is right: I found no counting race in hash-gate.ts or the sign-in window. Not run: the test and the preview, because I read only the diff and the source.
Two things I would do next:
- The terminal sign-in test just above still waits at most 50 x 100 ms for a throttled answer and has the same bounded-ask weakness. Give it the same deadline.
- Put real evidence for the cause in the pull: a test or a run that fills the gate (withHashSlot with cap 0, or four held hashes) and shows the old loop ending with fewer than TRIES counted. The cause is currently argued from reading the code, and the 20 runs ran quiet.
-
Checks
shipped production is serving it deploy bb265f4
-
History
- Sign-in doors test: count each /signin try against a deadline and assert it is a refusal, not a gate or origin answer (#4406) 7a20c76
- An idle fresh forge has a memory budget test that names where its memory goes (#16883) 3bcfa79
- A front router wakes an asleep forge on its first request and says "waking…" while it does (#16882) 2d3e9b2
- Two timing flakes measured against load: page budgets scale by a same-run calibration; review budget is event-driven (#16879) fee6f7a
- /metrics: forge_process_restarts_total and forge_child_processes{comm} (#16864) 03718a4
- A crew with builders and no reviewer says so loudly: settings, the tick line and the crew page (#16842) 30b53d2
- telemetry_history and forges answer in a summary by default, with detail on request (#16893) 2601f32
- Detaching a fork keeps objects its own forks still borrow (repack --keep-unreachable) (#16892) df30c44
- Talk never reads none of a large answer: past 40,000 characters the agent gets its shape and head, and how to ask narrower (#16877) 07a9130
- Main green: four new pages' bare 'No …' empty states use the shared words; the empty-words test runs first (#16874) b1a6173
- Daily proof waits for the release's check: a pending line is proved again until it settles (#16890) 8928766
- Observability 6: a Grafana-like view bar on top - time range, compare, variables - and a grid that fills (#16865) 2aecd66
- Boards show check and crew slots against capacity; Capacity is findable; /flow answers first (3.3 MB → capped) (#16830) ff9bc70
- Model review moves a crew member up only on that model's own better outcomes; scorecard by kind; rework and no-account lines on /crew (#16817) 1c64b14
- A template card lists the files it will create before it is chosen (#16822) 2da2af9
- Cost ledger: measure compute for deploys and agent runs, not only checks (#16841) 8a8c14a
- Two order-dependent flakes made deterministic: tui-crawlers pins loop lag; job-alloc measures a kept buffer after a full collection (#16875) b5f87f0
- Checks run rule and scan tests first and stop on their red (a rule red in ~2 min, not 14) (#16866) 372ce5e
- cloud_accounts answers in a few lines per account, and Talk asks infra about machines and cost (#16869) d7b5e43
- small-machine-off test runs past its 2s per-test budget under load (#16839) 8f7b949
I changed only test/signin-password-doors.test.ts; it now passes 20 of 20 alone and 5 of 5 beside a parallel run of the sign-in, users and hash tests. The test never failed on this machine, so the cause below comes from reading the code, not from a reproduction. The 20 runs also ran quiet, so they say nothing about a loaded machine. I did not run bun x tsc --noEmit or the gate checks as a separate pass; a bare bun x tsc --noEmit printed nothing and the gate --fix changed no files.
Cause. The test fired its three wrong /signin posts through a loop that ended after 50 asks. It only checked for a 422, which is what a counted wrong password answers. Argon2 hashes are capped process-wide at 4 at a time (src/core/hash-gate.ts), and a try the gate turns away is refused without being counted. It comes back as a 429 with Retry-After: 1. On a busy check machine, other hashes could fill the gate for longer than that loop waited, so the loop ended with fewer than three tries counted. The API call then did not meet a full window, and the test failed.
The same loop would swallow a 403 from the origin check, because it never looked at what a non-422 answer was. So the test could not tell a counted refusal from a try that counted nothing.
The suspect about the window's clock rolling does not apply, since the window is a sliding minute. Full-cost argon2 contributes only through the gate, and the /signin posts are awaited.
Fix.
- Each
/signintry is retried against a 20 s deadline instead of 50 asks. - Every non-422 answer must be the gate's 429 with
Retry-After: 1. Anything else, such as a 403, fails the test with its status. - The final
POST /api/v1/sessionsmust be a 429 whoseRetry-Afteris greater than the gate's 1 s. That shows the sign-in window closed the door and not the gate.
I left production code alone, because I found no race in counting tries. I did not add an injected clock or a low hash cost, since neither affects the cause. To try it: for i in $(seq 20); do bun test test/signin-password-doors.test.ts || break; done.
Left #4406 open: 2 unticked items remain (The pull names the cause of the load sensitivity, with evidence. Suspects: the sign-in window's clock rolls between the TRIES /signin posts and the API attempt; full-cost argon2 makes the test outlast its timeout; the /signin posts are not counted (the fetch sends no Origin, or its response is not awaited) before the API try.; for i in $(seq 20); do bun test test/signin-password-doors.test.ts || break; done passes 20 of 20, and once more beside a parallel bun test. Put the numbers in the pull.).
I changed only
test/signin-password-doors.test.ts; it now passes 20 of 20 alone and 5 of 5 beside a parallel run of the sign-in, users and hash tests. The test never failed on this machine, so the cause below comes from reading the code, not from a reproduction. The 20 runs also ran quiet, so they say nothing about a loaded machine. I did not runbun x tsc --noEmitor the gate checks as a separate pass; a barebun x tsc --noEmitprinted nothing and the gate--fixchanged no files.Cause. The test fired its three wrong
/signinposts through a loop that ended after 50 asks. It only checked for a 422, which is what a counted wrong password answers. Argon2 hashes are capped process-wide at 4 at a time (src/core/hash-gate.ts), and a try the gate turns away is refused without being counted. It comes back as a 429 withRetry-After: 1. On a busy check machine, other hashes could fill the gate for longer than that loop waited, so the loop ended with fewer than three tries counted. The API call then did not meet a full window, and the test failed.The same loop would swallow a 403 from the origin check, because it never looked at what a non-422 answer was. So the test could not tell a counted refusal from a try that counted nothing.
The suspect about the window's clock rolling does not apply, since the window is a sliding minute. Full-cost argon2 contributes only through the gate, and the
/signinposts are awaited.Fix.
/signintry is retried against a 20 s deadline instead of 50 asks.Retry-After: 1. Anything else, such as a 403, fails the test with its status.POST /api/v1/sessionsmust be a 429 whoseRetry-Afteris greater than the gate's 1 s. That shows the sign-in window closed the door and not the gate.I left production code alone, because I found no race in counting tries. I did not add an injected clock or a low hash cost, since neither affects the cause. To try it:
for i in $(seq 20); do bun test test/signin-password-doors.test.ts || break; done.Closes #4406