feat(pool): runtime account pause and reset-priority sort - #656
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces runtime pool account controls to the gateway, allowing operators to pause individual accounts and rank available accounts by their soonest quota reset directly from the admin dashboard or via new admin API endpoints without modifying shunt.toml or restarting. These changes are supported by updated multilingual documentation, UI updates, and new integration tests. The code review identified a performance improvement opportunity in src/accounts.rs where a mutex lock is repeatedly acquired and released inside a loop, which can be optimized by locking it once outside the loop.
|
This comment has been minimized.
This comment has been minimized.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Rebase PR pleaseai#656 onto current upstream main and retain the existing runtime pool controls while preserving newer per-model Codex cooldown behavior. Account pauses are provider-scoped and addressed through an opaque account_ref returned by GET /admin/api/pool, so distinct credentials that share a display name remain independently controllable. The dashboard uses that reference for mutations and row identity. Keep the request-model-aware reset ordering, nullable runtime override, sticky-account handling, and one-lock pause lookup from the prior review fixes. Add backend and UI regressions for duplicate display names and provider-scoped pause state.
b0716a0 to
d5e6e5f
Compare
|
@codspeedbot explain why |
Summary
Two complementary runtime controls on top of the account pool, both operable from the admin dashboard or admin API with no
shunt.tomledit or restart:select_orderwithout signing it out or touching config.GET /admin/api/poolreturns an opaqueaccount_reffor each row; write-tier callers toggle it viaPATCH /admin/api/pool/{provider}/accounts/{account_ref}. Using the opaque identity rather than the displaynamekeeps distinct same-name credentials independently controllable.[server.pool] sort_by_reset(defaultfalse) ranks available accounts by soonest relevant quota reset instead of burn-rate headroom. Since[server.pool]is process-wide,PATCH /admin/api/poolprovides the matching runtime override;{"sort_by_reset": null}clears that override back to config-following behavior.Pause state is memory-only and provider-scoped: quota/cooldown health remains shared by the existing physical-account identity, while pausing one provider lane does not pause another provider that resolves to the same identity.
disabledremains the persistent config-side exclusion.Review follow-ups
This head incorporates the earlier review fixes and is updated onto current
main:sort_by_reset, explicitnull, and boolean runtime overrides;account_refrather than display name;needs_reloginas the dashboard's higher-priority status when a paused credential is permanently dead.Test plan
account_refdisambiguationaccount_reftargeting, snapshot/selection effects, and the process-wide reset-sort toggleaccount_ref