Repository navigation
feat(runtime): bound company load and database waits - #421
Conversation
Astra reviewReviewed StandardsNo blocking method or YAGNI findings. The pool drain-and-replace logic supports the requested live per-company overrides without overlapping retained backend budgets. The token bucket and inventory upgrade hook are explicitly requested by #390. SpecNo blocking intent findings. The change covers the bounded connection queue, structured refusals, per-company pool overrides, company admission for operations without a database connection, and repeatable inventory upgrades. The API documentation, ADR-0009, development notes, glossary, and generated limits tables reflect those changes. Tier 2 execution remains assigned to later tickets, not missing work for this PR. Verification:
Standards: 0 blocking findings, worst issue none. Spec: 0 blocking findings, worst issue none. |
Opus reviewReviewed 1. Anonymous public traffic spends the company's admission bucket (correctness). 2. An override swap stalls the whole company until every old lease ends (correctness/method). 3. Four sequential platform round trips per company operation, ahead of the bounded wait and not bounded by it (method/perf). 4. Docs carry a work record and a misleading role name (convention). Checked with no findings: the token bucket (burst/refill, override changes, clock skew, fail-closed capacity), the queue bound (32 waiters then |
|
Reviewed The structure matches the ticket. Runtime spends one token bucket per incoming operation. The company pool queues acquisitions. Inventory upgrades are idempotent. Neon role grants stay an operator step, and cancellation stays in the Effect driver. The problems are places where a bound the code claims is not the bound it holds. StandardsHard. The frame drops The project skills that tell an agent how to handle a refusal were not updated with the table. ADR-0009 says a queued acquisition waits at most 1 second and still inside the caller deadline. Judgement.
SpecPartial. Issue #384 section 2 replaces fail-at-once with a bounded wait: at most 32 waiters, at most 1 second inside the call's deadline, then Not asked for.
Wrong. Cold open can lend one connection past the pool size. A resize that does not fit A burst refusal is named Issue #390Met. The queue cap, the 1 second Partial, and the partial matches "admitted at merge". Tier 2 has no caller yet. The override test raises one company from 4 to 6. It does not assert the other company is still capped at 4. The lookup is per company, so the behavior is there. MethodPer-company Fix the notify order. Increment Check the host budget, including the reservation you are about to release, before closing the live pool. Keep the counter updates uninterruptible. Do not hold the fiber uninterruptible across Every
YAGNIDelete the Leave Leave cancellation and idle-client disposal in the driver. The monotonic clock and the full-map eviction in
SummaryStandards: 3 hard, 2 judgement. Worst: the shell drops |
|
Reviewed Astra, Opus, and Grok Build's conversation comments, plus both GitHub review-body and inline-comment endpoints. The latter two were empty. Astra reported no blockers. Fixed
Kept as is
Local verification
Latest commit and merge readinessCommitted and pushed as GitHub reports |
22df82f to
1f08b25
Compare
Isolate public calls from company tokens, batch effective limit reads, preserve retry timing through the broker, and fix cold-open and refused-resize pool races. Add focused coverage and clarify the reviewed admission contracts.
0c8c567 to
add47ac
Compare
Runtime requests need company-wide admission even when they do not use SQL, and saturated company pools need a bounded wait rather than immediate rejection.
Add a per-company token bucket at 100 calls/second with a burst of 200. Company pools default to four connections with up to 32 waiters for at most one second within the caller deadline. Effective overrides, retained-backend budgeting, structured refusals, and wait metrics keep those bounds explicit.
Inventory initialization now applies idempotent upgrades. Neon provisioning uses template0 to avoid the observed template1 scheduler conflict. Updated the API, operating-limit documentation, and generated server skill.
Stacked on
tier2/389-tier2-contract; this PR targets that branch and contains only the issue #390 changes. Implements the admission requirements from #384.Closes #390.
Verification
pnpm typecheckandpnpm lintpassed.pnpm test --maxWorkers=4: 95 files and 1,067 tests passed.Implemented with openai-codex/gpt-6-astra in the omp harness.