feat(seats): accounts without a 5-hour limit

Anthropic is removing the 5-hour limit in stages (from 2026-10-31), and
an account without it reports the weekly window alone. Until now the pool
took such an account for an unprobed seat: always eligible, ranked after
every other, never held to the weekly cutoff, with no cap on its passes.

- The burst window is the 5-hour one, else the weekly one
  (Seats::BurstWindow). An account whose burst window is the weekly one is
  ranked by it and admitted under the 95 % cutoff with the passes in
  flight projected on it, at the measured share per pass (0.04 at xhigh,
  0.125 otherwise; REVIEW_GATES_LENS_COST_7D_PCT), and waits for the weekly
  reset when over it.
- Every OAuth account and the local login takes at most 128 passes at once,
  every driver's counted (REVIEW_GATES_OAUTH_CONCURRENCY): every run
  measured with 149 or more in flight on one account drew usage-limit
  rejections, none of the 119 with 139 or fewer.
- A 'concurrents' rejection pauses the seat for 20 s or its retry-after,
  not until a window's reset (a seat sat two hours at 10 % on one).
- Board entries, the folded foreign record and the board's view carry
  cost7d, so the drivers see each other's weekly load.
- `seats` and the log table say `no limit` in such an account's 5-hour
  column; the board's others-line names its weekly projection.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Jorijn van der Graaf 2026-10-31 17:07:17 +01:00
commit c28307601b
Signed by: jorijnvdgraaf
GPG key ID: 2937E59CDCC1BCFB
11 changed files with 209 additions and 26 deletions

View file

@ -32,6 +32,17 @@ export namespace Crafter::Review::SeatPool {
// An API seat's pause after a 429.
constexpr double ApiBackoffS = 90;
constexpr double OauthFallbackPauseS = 300;
// An OAuth seat's pause after a 'concurrents' rejection: too many requests
// at once on the account, cleared as the ones in flight answer. Not the
// window's reset (2026-10-31: a seat sat two hours at 10 % on one).
constexpr double ConcurrentBackoffS = 20;
// The passes one OAuth account (or the local login) takes at once, every
// driver's counted. Until 2026-10-31 the 5-hour projection was the only
// limit, and an account without a 5-hour limit has none: on the record,
// every run with 149 or more in flight on one account drew usage-limit
// rejections, none of the 119 with 139 or fewer.
// REVIEW_GATES_OAUTH_CONCURRENCY overrides.
constexpr std::int64_t OauthConcurrency = 128;
// The kinds whose processes cost money the ledger counts.
constexpr std::array<std::string_view, 2> Paid = {"api", "openrouter"};
// The kinds whose out/invalid verdict crosses drivers on the board.
@ -90,9 +101,13 @@ export namespace Crafter::Review::SeatPool {
void ApplyProbe(Json& seat, const Json& result);
std::string Describe(const Json& seat);
// The OAuth placement knobs, with the pool's own per-process default (0.25:
// the 2026-10-15 load test moved a 20x seat's window 0.08 points a pass).
Json PoolConfig(const std::map<std::string, std::string>& env);
// The OAuth placement knobs, with the pool's own per-process projections:
// 0.25 of the 5-hour window (the 2026-10-15 load test moved a 20x seat's
// window 0.08 points a pass) and, for an account without a 5-hour limit,
// the measured share of the weekly window at the run's effort (0.04 at
// xhigh, 0.125 otherwise; REVIEW_GATES_LENS_COST_7D_PCT); and the
// per-account cap.
Json PoolConfig(const std::map<std::string, std::string>& env, std::string_view effort = {});
double OauthProjected(const Json& seat, const Json& config);
// A window whose reset has passed counts as empty until the next reading.
std::vector<std::string> ExpireWindows(Json& seat, double now);