perf(models): make provider auth checks non-blocking#85152
Conversation
|
Codex review: needs real behavior proof before merge. Latest ClawSweeper review: 2026-05-22 05:34 UTC / May 22, 2026, 1:34 AM ET. Workflow note: Future ClawSweeper reviews update this same comment in place. How this review workflow works
Summary Reproducibility: no. high-confidence live reproduction was run in this read-only review. Source inspection plus the PR's before logs make the cold-path event-loop starvation plausible, but after-fix Discord PR rating Rank-up moves:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. Real behavior proof Mantis proof suggestion Risk before merge
Maintainer options:
Next step before merge Security Review detailsBest possible solution: Land the mechanical async/yield conversion only after redacted live Discord Do we have a high-confidence way to reproduce the issue? No high-confidence live reproduction was run in this read-only review. Source inspection plus the PR's before logs make the cold-path event-loop starvation plausible, but after-fix Discord Is this the best way to solve the issue? Yes, the current head looks like a narrow mechanical async/yield mitigation that preserves the existing auth decision path. The merge-safe path still requires live proof because this mitigates, rather than removes, synchronous provider probes. Label justifications:
What I checked:
Likely related people:
Codex review notes: model gpt-5.5, reasoning high; reviewed against e32e0f3f7f3e. |
|
ClawSweeper PR egg 🎁 Pass real behavior proof to wake the egg and unlock a hatchable treat. Where did the egg go?
|
1f50e29 to
06d514a
Compare
5acc480 to
69a4f80
Compare
…r event-loop yields
69a4f80 to
2393543
Compare
|
/review Please review the current PR head for the async provider-auth change. Focus on whether this is a mechanical async conversion only and whether any provider-auth decision logic changed unintentionally. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
Summary
Make the provider-auth check path asynchronous without changing the auth decision logic.
When the prepared provider-auth map misses, model-listing surfaces can walk the catalog and compute auth for many providers. Each provider check can do sync filesystem reads and external-CLI discovery.
hasAuthForModelProvidernow yields once withsetImmediatebefore that slow path, and the existing callers now await the same checker so long provider sweeps release the event loop between providers.This PR intentionally does not change prepared-auth cache semantics, invalidation, auth-profile failure handling, watchers, TTL behavior, or provider eligibility rules.
Changes
hasAuthForModelProvidernow returnsPromise<boolean>.createProviderAuthCheckernow returns an async checker with the same per-provider cache.warmCurrentProviderAuthStateawaits the existing provider check while preparing the current auth map./modelsprovider data, gatewaymodels.list, and model-picker call sites now await the async checker directly.Evidence
Before this change, logs showed slow
/modelscalls when the prepared auth map missed:The matching gateway diagnostic showed the event loop blocked for the same window:
Verification
node scripts/run-vitest.mjs src/agents/model-provider-auth.test.ts src/agents/model-catalog-visibility.test.ts src/agents/model-auth.profiles.test.ts src/agents/model-auth.workspace-plugin.test.tsnode scripts/run-vitest.mjs src/commands/model-picker.test.ts src/auto-reply/reply/commands-models.test.ts src/gateway/server-methods/models.test.ts/modelsinteraction during a prepared-auth miss, to confirm the interaction ack is no longer starved while the provider sweep continues.