Repository navigation
fix: avoid partial API-key saves during credential publication - #176166
Conversation
Join pending credential catalog publications before applying the saved key's provider binding. Keep synchronous authority checks and refuse unknown outcomes, retired owners, and competing agent overrides. Wake retained readers on publication settlement and owner closure, including worker-only state owners without native-handle events. A real batch held during config transformation reproduced the partial-save error from main hourly 39112003675. Exact hourly attribution remains unproven; ten native baseline repetitions passed locally.
|
🦞👀 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. |
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. |
|
|
Codex review: needs maintainer review before merge. What this changesAPI-key saves wait for credential publication to settle before applying provider settings. Example: Saving sample:manual while a credential catalog publication overlaps configuration preparation.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR fixes a current credential-save failure, and the follow-up resolves the previous fixture finding; no actionable defects remain in the reviewed diff. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherModels and CLI saves share a credential writer and configuration transformer; the credential authority owner supplies current store facts before provider bindings change. flowchart TD
A[Models or CLI save] --> B[Shared API key owner]
B --> C[Credential store write]
B --> D[Credential authority owner]
E[Catalog publication] --> D
D --> F[Configuration transformer]
F --> G[Provider binding]
Technical reviewBest possible solution: Keep settlement waiting in the existing credential authority owner and retain the corrected asynchronous CLI fixture. Do we have a high-confidence way to reproduce the issue? Current-main source exposes the failing ordering, and the supplied command-boundary regression holds a real publication during configuration transformation; no target code was executed during this review. Is this the best way to solve the issue? The patch restores the existing save contract through its current owner without retrying credential writes, adding storage, or weakening synchronous authority checks. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 066c207b69e8. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +54, Tests +66. Total +120 across 5 files. Added test files: 0. View PR surface stats
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 HistoryReview history (1 earlier review cycle)
Reviewed October 18, 2026, 5:58 AM ET / 09:58 UTC (Revision 2). |
Match the production updateConfig contract in the auth command fixture: await the mutator before recording and committing its configuration. The settlement wait made the API-key mutator asynchronous, exposing the mock's stored Promise as a missing requested-agent profile binding. Keep the existing requested-agent assertions and additionally verify the provider/mode binding through the real persisted-store test matrix.
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
…law#176166) * fix(models): wait for credential publication before applying API keys Join pending credential catalog publications before applying the saved key's provider binding. Keep synchronous authority checks and refuse unknown outcomes, retired owners, and competing agent overrides. Wake retained readers on publication settlement and owner closure, including worker-only state owners without native-handle events. A real batch held during config transformation reproduced the partial-save error from main hourly 39112003675. Exact hourly attribution remains unproven; ten native baseline repetitions passed locally. * test(models): await async auth configuration mutations Match the production updateConfig contract in the auth command fixture: await the mutator before recording and committing its configuration. The settlement wait made the API-key mutator asynchronous, exposing the mock's stored Promise as a missing requested-agent profile binding. Keep the existing requested-agent assertions and additionally verify the provider/mode binding through the real persisted-store test matrix.
What Problem This Solves
Fixes a partial API-key save in Models and the CLI when an in-flight credential catalog publication overlaps application of the provider settings.
User Impact
A save waits for known credential publication before applying the provider binding. Unknown outcomes, retired owners, revoked callers, and competing agent overrides still refuse the operation. Genuine configuration failures retain the existing partial-save diagnostic.
Why This Change Was Made
The config transformer previously treated a pending publication as unavailable authority after the key had been persisted. The existing credential owner now supplies settlement waiting and wakes readers during publication, revocation, and state-owner closure. Synchronous reads keep their refusal checks; this does not retry a credential write or provide cross-store atomicity.
PR CI also caught a sibling fixture that stored the new async mutator's Promise as a config object. Production
updateConfigalready awaits async mutators. The follow-up makes the mock match that contract, preserves the requested-agent assertion, and strengthens the real-store test to verify its provider/mode binding. No additional production change was needed.Evidence
src/commands/modelsandsrc/agents/auth-profilespassed: 1,089 tests with--maxWorkers=1(78 in the two changed files, then 1,011 in the remaining files). The requested-agent regression reproduced before the fixture fix and passes afterward, with the real-store binding assertion included.38ede6108351(1/1), including durable-state parity. Production/private-QA builds and CLI-bootstrap validation passed. That proof is unchanged by the test-only follow-up.The exact trigger of hourly 39112003675 remains unproven: ten baseline native repetitions passed on macOS/Node 26.12.0; CI used Node 24. The first patched native attempt hit the intended dirty-checkout artifact-publication refusal before its CLI request; canonical clean-commit preparation allowed the full native test to pass. No guard was bypassed. The optional max-lines ratchet reports existing suppressions in three unchanged UI files; this patch adds none. No CI reruns.