Repository navigation
refactor(agents): compress auth availability projections - #131863
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 28, 2026, 11:43 AM ET / 15:43 UTC. ClawSweeper reviewWhat this changesThe PR removes redundant model-auth availability projections while retaining the evaluator’s availability, reason, retry-time, selected-auth, and evidence behavior. Merge readinessKeep open. The introduced refactor is source-equivalent at both projection sites and has no concrete correctness or security finding; it remains an active maintainer PR pending its normal exact-head checks and a fresh automated review in a provisioned environment. Priority: P3 Review scores
Verification
How this fits togetherThe model-auth resolver combines provider configuration, credential profiles, and route selection into an availability result. Gateway model-list generation consumes that result to expose model availability and actionable auth state to clients. flowchart LR
A[Provider configuration] --> C[Auth availability resolver]
B[Credential profile state] --> C
C --> D[Auth source selection]
D --> E[Availability evaluation]
E --> F[Gateway model list]
F --> G[Model picker and composer]
Before merge
Agent review detailsSecurityNone. PR surfaceSource -12. Total -12 across 1 file. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the canonical evaluator projection, land this net-negative cleanup only after fresh automated review and exact-head checks confirm the preserved auth-availability contract. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR claims a behavior-preserving refactor, not a user-reported failure; the relevant projection paths are directly inspectable in source. Is this the best way to solve the issue? Yes. Reusing the direct policy’s recorded facts removes duplicate conversion while retaining the selector as the single owner of readiness and rejection decisions. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 9022e0e1cf3f. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Rank-up move status: exact-head CI is now complete and green on 514f92b. The pre-commit Codex autoreview ran through the standard credential-scanned helper (clean, no accepted/actionable findings); the TruffleHog note reflects the automated reviewer's own provisioning, not a gap in the change. Landing via the native wrapper. |
|
Merged via squash.
|
What Problem This Solves
Follow-up compression of the availability-reason feature landed in #131697. That change added +275/−124 production lines; two of its projection sites carried provable redundancy: the non-profile
sourceEvaluationbranch re-derived availability/mode/evidence facts that the direct policy evaluation already owned (via a lossless readiness round-trip), and the indeterminate-route caller re-projectedautomaticSourceRejection's result field by field after the helper had leaked the full selector decision.Why This Change Was Made
Behavior-frozen refactor: reuse the recorded direct-policy facts instead of re-deriving them, and let
automaticSourceRejectionreturn the projectedAuthSourceEvaluationitself so its only caller just attaches route resolution. No selector inputs change; the deliberately load-bearing seams (the profile recompute compensating forrequiredProfileSource's cooldown-bypass contract, and the empty-plan reason override that also covers the deferred branch) are byte-identical to the base.Two further candidate folds were evaluated and skipped with recorded reasons: a typed unusable-window result (breaks the primitive's numeric contract and ripples into status/display adapters) and the gateway projection spreads (each conditional encodes a distinct property-presence rule for legacy clients).
User Impact
None — pure production-LOC reduction. Wire payloads, field values, and property presence are unchanged.
Evidence
src/agents/model-auth-availability.ts); zero test-file changes (git diff --stat -- '*test*'empty).provider-model-auth-source-plan.ts:109/:115/:122), plus two ephemeral differential checks comparing old vs new projection functions over 1,680 direct/none combinations and 1,536 indeterminate-route cases with own-property presence compared viadeepStrictEqual.node scripts/check-changed.mjsexit 0 (formatting, lint, all type shards, dead exports, import cycles, guards); Codex autoreview clean at the default threshold.