Repository navigation
fix(agents): stop runtime rebuild storms during auth cooldowns - #185250
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: eed303f801
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // Cooldown views still refresh, but they do not announce a changed model inventory. | ||
| const modelCatalogChanged = | ||
| !previous || !facts || !generationFactsMatch(previous, facts, "catalog"); | ||
| !previous || !facts || !generationFactsMatch(previous, facts, "catalog-notification"); |
There was a problem hiding this comment.
Update catalog consumers before suppressing availability invalidations
When a connected Control UI has already cached a model catalog, an availability change now emits modelCatalogChanged: false and commandsChanged: false, but the existing UI consumers do not refresh model availability on authChanged alone. modelCatalogEventInvalidation in ui/src/lib/model-catalog-cache.ts ignores this payload, and ui/src/app/app-shell-gateway.ts consequently skips chat-metadata invalidation. A previously healthy catalog has an infinite expiry, so newly blocked or disabled models remain selectable until an unrelated refresh; conversely, an early cooldown clear leaves models disabled until the old deadline. Migrate these consumers to invalidate availability-sensitive projections without triggering inventory discovery before suppressing the existing signal.
AGENTS.md reference: AGENTS.md:L52-L52
Useful? React with 👍 / 👎.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
eed303f to
9a6ce5b
Compare
|
Codex review: needs changes before merge. What this changesThis PR separates auth availability updates from catalog identity changes so cooldowns preserve prepared plugin generations. Example: The test:primary profile enters and clears a 60-second cooldown repeatedly during concurrent runtime requests.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 2 items remain Keep open: this maintainer-authored fix addresses a current runtime starvation path, but its notification change leaves Control UI model availability stale. Priority: P1 Before merge
Findings
Tests
Agent review detailsHow this fits togetherAuth workers publish committed profile state into the runtime snapshot owner, which supplies prepared runtimes and Gateway metadata consumed by client model catalogs. flowchart LR
A[Auth worker commits] --> B[Runtime auth snapshot owner]
B --> C[Availability classification]
C --> D[Prepared runtime generations]
B --> E[Gateway metadata projections]
E --> F[Control UI catalog cache]
Technical reviewBest possible solution: Preserve prepared generations for availability-only changes and refresh every availability-sensitive consumer through the existing auth owner. Do we have a high-confidence way to reproduce the issue? Current-main source connects availability mutations to prepared-owner retirement, matching the measured reproduction in #161468; this review executed no target code. Is this the best way to solve the issue? Separating availability from catalog identity at the existing snapshot owner is a focused repair, provided all consumers retain fresh availability without restarting discovery. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against c7cfa1f9971d. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +106, Tests +204, Docs +6, Other +250. Total +566 across 31 files. Added test files: 0. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed October 26, 2026, 9:03 PM ET / October 27, 2026, 01:03 UTC. |
Keep cooldown, blocked, and disabled updates on the current plugin generation and coalesce metadata notifications without catalog-change broadcasts. Preserve immediate availability reads and full credential, profile, order, ownership, and compensation invalidation.
c542509 to
a7e74a9
Compare
…law#185250) * fix(agents): keep prepared runtimes through auth availability changes Keep cooldown, blocked, and disabled updates on the current plugin generation and coalesce metadata notifications without catalog-change broadcasts. Preserve immediate availability reads and full credential, profile, order, ownership, and compensation invalidation. * test(agents): align availability fixtures with owner contracts * test(gateway): use explicit API-key rotation fixture
* fix(agents): keep prepared runtimes through auth availability changes Keep cooldown, blocked, and disabled updates on the current plugin generation and coalesce metadata notifications without catalog-change broadcasts. Preserve immediate availability reads and full credential, profile, order, ownership, and compensation invalidation. * test(agents): align availability fixtures with owner contracts * test(gateway): use explicit API-key rotation fixture (cherry picked from commit 77af976) Co-authored-by: RomneyDa <[email protected]>
…olved peer identity; realign quota catalog e2e (#187594) * test(ui): expect held catalog refresh to complete across quota recovery Backport e8dd49e (#185250, main 77af976) keeps the prepared runtime and its catalog owner through cooldown/blocked availability updates, so a quota recovery no longer supersedes an in-flight catalog generation. The automatic-during-catalog quota e2e still expected the held models.list refresh to fail with "catalog generation was superseded". Main realigned this assertion to the intended behavior in fc0e45a (#184971); that commit is a large CI change, so carry only the assertion: the held refresh resolves ok and the published catalog still reports gpt-5.5 available after it lands. Refs fc0e45a * fix(control-ui): keep the admitted sidebar scope while hello identity is unresolved Backport 99e458b (#185762, main 8d0f6fb) stopped an unresolved peer tab from persisting a profile-less boot record, but on main that fix sits on top of #179254 (5b1b96b), which also keeps the admitted boot profile in the sidebar snapshot scope until hello's selfUser resolves. Release lacks #179254 (Solid-era handoff/perf work), so a peer tab that booted with the operator's sidebar scope still recomputed profileId as null on hello, retired that scope, and deleted the operator's cached sidebar snapshot. The next reload then rendered the sidebar live instead of from cache. Port only #179254's identity rule into the Lit SidebarSnapshotController: keep the admitted profile while selfUser is undefined (a resolved different user or an explicit null still replaces the scope) and skip capture under a profile scope until identity resolves. Add main's unit regression adapted to the release controller (fails without the runtime change). The #185762 e2e waited for an 11th recent row, which main serves through its #172946 sessions.list owner fixture; the backport dropped those handlers, so the count could never be reached on release (it failed at 99e458b itself). Assert instead that the cached reload shows the rows the operator's page saved, which exceeds the single live row a held connect renders. Refs 5b1b96b
What Problem This Solves
Fixes repeated prepared-runtime rebuilds and model-catalog refresh broadcasts when provider rate limits repeatedly set and clear auth cooldowns.
User Impact
Concurrent chat turns and metadata reads keep their prepared plugins through availability changes. Model selection still sees committed cooldown, blocked, and disabled windows immediately. Credential, profile membership, explicit order, ownership, and compensation changes retain full invalidation.
Why This Change Was Made
The auth snapshot owner now distinguishes availability from catalog identity. Prepared runtimes read current usage through the existing owner-bound usage reader; chat metadata keeps availability-sensitive caches fresh while coalescing notifications without
modelCatalogChanged. Shared durable state updates preserve inherited snapshots when credential bytes and explicit order are unchanged.No config options, database changes, or migrations. Production source delta: +106 lines (+174/−68); benchmark tooling is separate. Production growth is needed to preserve immediate availability reads and security invalidation while separating their publication lifecycles.
Evidence
Owner-decision microbenchmark: five alternating runs per side, 4,000 availability events per run, four configured owners, 40 plugin descriptors. This excludes plugin loading, publication, and Gateway RPC work.
Timing GC: four collections per baseline pass (3.04–5.86 ms total), zero in candidate; sample counts are too small for tail claims. Timing host load was 30.7–42.0. The committed script documents reproduction and measurement scope.
Built-Gateway smoke proof: the isolated mock provider alternates HTTP 429 (
Retry-After: 1) and success. In 60 measured seconds, 44 availability-only mutations caused zero plugin preparations and zero supersessions. All instrumentation hooks were verified. This is smoke evidence only; full 10-minute timing/allocation arms and heap captures are in progress.CI follow-up: required listener/usage-reader test fixtures and explicitly typed credential/usage cases were corrected. The embedding lifecycle file passed 11 tests and the two catalog fixture files passed 20 tests. The inherited
models.listexpectation mismatch was resolved by rebasing onto #185244; that file now passes all 51 tests. Exact-head CI is running on9a6ce5b3b1022474a1ba79e511659450a13cae92.Remaining gates: UI cached-availability consumer coordination, full built-Gateway comparison, and exact-head CI. This PR is intentionally unmerged.