Public: anyone can read this; the crew can change it.

A sign-in refused by any window gives back the per-account and per-source budget it took #15129

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

This adds a test proving that a source refused by the forge-wide sign-in window keeps its full per-source budget. The code fix itself was already on main in 2ab8fdaf7 (#14924), so the pull only adds the test. Code: in src/core/signin-window.ts, admitSignin records each window it takes in taken.

Notes

shipped production is serving it deploy fe4d51f

opened this

This adds a test proving that a source refused by the forge-wide sign-in window keeps its full per-source budget. The code fix itself was already on main in 2ab8fdaf7 (#14924), so the pull only adds the test.

  • Code: in src/core/signin-window.ts, admitSignin records each window it takes in taken. When a later window refuses the attempt, refused() gives each one back, newest first: the source, the slow window, then the per-account window. So the first box in the issue is met by code that is already merged.
  • Existing test: the earlier one in test/signin-window-bounds.test.ts only checks that a refusal leaves no extra keys behind. It doesn't check what budget is left.
  • New test: "a source refused by the forge-wide window still has its full per-source budget". Four other sources fill the forge-wide window with 200 open attempts. One more source is then refused 60 times, which would use its whole per-source budget if those attempts were kept. The 200 open attempts are then given back. The refused source must get all 60 admitted, and the 61st is refused. With the give-back loop removed, this test and the earlier key-count test both fail.

The sign-in suites (test/signin-*.test.ts, test/signins.test.ts, test/forge-signin.test.ts) pass, 108 tests. scripts/gate.ts --fix and tsc --noEmit are clean. I didn't call the keep_plan or estimate tools the issue mentions, because they aren't available in this session.

To try it: bun test test/signin-window-bounds.test.ts

🤖 Generated with Claude Code

Closes #15038

commented

This adds a test proving that a source refused by the forge-wide sign-in window keeps its full per-source budget. The code fix itself was already on main in 2ab8fdaf7 (#14924), so the pull only adds the test.

  • Code: in src/core/signin-window.ts, admitSignin records each window it takes in taken. When a later window refuses the attempt, refused() gives each one back, newest first: the source, the slow window, then the per-account window. So the first box in the issue is met by code that is already merged.
  • Existing test: the earlier one in test/signin-window-bounds.test.ts only checks that a refusal leaves no extra keys behind. It doesn't check what budget is left.
  • New test: "a source refused by the forge-wide window still has its full per-source budget". Four other sources fill the forge-wide window with 200 open attempts. One more source is then refused 60 times, which would use its whole per-source budget if those attempts were kept. The 200 open attempts are then given back. The refused source must get all 60 admitted, and the 61st is refused. With the give-back loop removed, this test and the earlier key-count test both fail.

The sign-in suites (test/signin-*.test.ts, test/signins.test.ts, test/forge-signin.test.ts) pass, 108 tests. scripts/gate.ts --fix and tsc --noEmit are clean. I didn't call the keep_plan or estimate tools the issue mentions, because they aren't available in this session.

To try it: bun test test/signin-window-bounds.test.ts

🤖 Generated with Claude Code

Approved

Test-only pull; the fix is already on main (2ab8fdaf7). The new test is sound: it holds the forge window at 200 from four sources, has a fifth source refused 60 times, releases, and checks the full 60 per-source attempts then a 61st refusal. It passes here (9/9 in the file). No page, terminal or README surface is touched. Next: (1) add a companion assertion for the per-account window refused by the slow/forge window; (2) consider a helper for the fill loop to keep tests short.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs