Repository navigation
fix(auth): keep setup replacements inactive until activation - #144524
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. |
|
landpr-approve-admin-merge |
|
Codex review: blocked before merge. Reviewed September 10, 2026, 9:48 PM ET / September 11, 2026, 01:48 UTC (Revision 4). ClawSweeper reviewWhat this changesSetup saves replacement credentials as inactive, retains their retry settings across restarts, and requires successful verification and explicit activation before normal use. Merge readiness⛔ Blocked before merge - 2 items remain This remains a useful repair absent from current main. The earlier CLI findings are addressed, and this review found no additional blocking defect. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw setup turns provider sign-ins into stored credentials and configured model connections. The shared credential store feeds runtime selection, while Gateway and CLI setup control verification and activation. flowchart TD
A[Provider sign-in] --> B[Save candidate credential]
B --> C{Replacement connection?}
C -->|Yes| D[Inactive saved sign-in]
D --> E[Scoped connection test]
E --> F{Successful and confirmed?}
F -->|No| D
F -->|Yes| G[Apply config and promote credential]
C -->|No| E
G --> H[Normal model access]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +762, Tests +613, Docs +20, Other 0. Total +1395 across 38 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep verification and promotion with the existing setup and credential owners, preserving the working connection and the documented activation and downgrade boundaries. Do we have a high-confidence way to reproduce the issue? Yes, from source: current main saves replacement profiles without an inactivity marker, allowing normal selection to consider them after a rejected setup attempt; this review did not execute the flow. Is this the best way to solve the issue? Yes. Extending the existing credential owner and setup activation flow avoids a parallel pending store, and the prior CLI corrections preserve confirmation across entry points. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 1c1f85474f5b. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (3 earlier review cycles)
|
|
Design decision for this repair: keep saved replacement state in the existing auth-profile credential payload, with no schema change or migration. The approved work order delegates this choice and requires an additive, lenient implementation. The auth-profile store owns the credential and retry settings. Setup owns scoped verification and explicit promotion. Normal readers in this version exclude inactive replacements. Reopening this version preserves the saved candidate and requires fresh verification; no verification verdict is persisted. Ordinary login and existing credential payloads remain valid. Older binaries do not understand the descriptor. Downgrading with inactive replacements present is unsupported: remove those saved replacements or restore pre-setup state first. A schema/version fence would reject older readers for an otherwise additive payload change; this repair does not add that fence. The documentation records this limitation rather than claiming older-reader inactivity. Promotion rereads the credential under the existing store lock. Failed verification, cancellation, or rejection retains the saved row and does not publish candidate config. No retention policy, table, column, or parallel pending store is added. The retained restart proof covers reopening and retry on the new reader; live OAuth refresh and mixed-version operation are not claimed. |
|
landpr-approve-admin-merge |
|
landpr-approve-admin-merge |
|
landpr-approve-admin-merge |
|
landpr-approve-admin-merge |
|
Landed as a305caf. Proof: Real first-run and replacement setup verified rejection preservation, decline/cancellation, retry after restart using the saved profile, explicit activation, and stale-deletion rejection. Control UI end-to-end proof and focused CLI/OAuth tests passed. Final exact-head review had zero findings and cleared security.
Final CI: https://github.com/openclaw/openclaw/actions/runs/34551602406 — success. No red-CI waiver was used. Earlier Matrix download and terminal timing failures cleared on their bounded hosted retries; the preceding size failure was reproduced on main base 17819a7 (353130 gzip bytes against 353107, command exit 1). Guarded admin merge used the owner-review approval at #144524 (comment). The accepted storage/downgrade boundary remains documented at #144524 (comment); noninteractive replacements intentionally require later activation. Live proof used one approved credential under separate profile IDs; live OAuth refresh and two-account coverage were not claimed. Deleted-test ledger: |
…144568) ## What Problem This Solves Fixes an issue where users preparing a provider through Gateway setup received a raw config-changed error after saving credentials if another config edit occurred during login. The unrelated edit survived, but the provider settings were not applied and the error did not explain that the credential was already saved. ## Why This Change Was Made CLI login and Gateway preparation now share one config writer. It applies only the provider's changes to the latest authored config, merges model rows by ID, rejects conflicting or invalid edits, and uses the existing saved-credential/settings-failure error. Pending plugin-install records remain with their existing commit owner. The setup path no longer binds publication to the snapshot taken before login. Strict snapshot checks remain for migration promotion and verified setup operations that require them. Credential persistence, cancellation, and default-model policy retain their existing owners. ## User Impact Unrelated edits made while provider setup waits for input survive, and setup can complete. If settings cannot be applied, setup explains that credentials were saved and retains the config owner's recovery guidance. ## Evidence - Reproduced on main `a321595f496e5a95d2bd0ffe81f7a080b4fcdfc8` through the shipped Gateway client: start preparation, edit an unrelated setting while the provider key prompt waits, then complete. Before: raw config-changed error with credential saved. After: setup completes with the edit and credential retained. - Real config-directory permission failure: before, config-only error despite a saved credential; after, explicit saved-credential/settings-failure message. Used isolated state and synthetic credentials. - 45 targeted Gateway setup tests and 55 CLI auth tests pass. The three original new regressions fail on main. Added protection for a config that becomes invalid during login. - Focused lint, formatting, line-count and assertion checks pass. Full type checks run in GitHub CI. Related: #144181, #144436. No changes to the credential replacement paths under #144524. Co-authored-by: Ayaan Zaidi <[email protected]>
…w#144524) Related: openclaw#136257 ## What Problem This Solves Fixes an issue where replacing credentials in setup could add a rejected credential to normal rotation. A successful test also activated the replacement without a separate decision, and retry details were lost when the process stopped. ## Why This Change Was Made Keep the existing per-submission profile IDs from openclaw#144195. Save the retry details in the credential's existing payload, exclude inactive replacements from normal use and copying, and activate only after a tool-free test, explicit confirmation, and config application. Both setup and Model Setup use the same credential owner; the in-memory retry cache is removed. No database schema change is required. Noninteractive replacements are prepared in an isolated store and saved for later activation. Existing credential reuse and first-run noninteractive behavior remain available. ## User Impact - Rejection, decline, or cancellation keeps the working connection and rotation unchanged. - Saved credentials can be retried after restart without another login. - Status distinguishes saved inactive credentials from usable access. - Ordinary login remains immediate. ## Evidence - Baseline: a targeted owner regression showed that a rejected replacement entered implicit rotation; the configured-profile sibling passed. - Baseline real Gateway flow: a successful replacement activated without a separate confirmation. - Candidate: targeted setup, discovery, shared credential-persistence, and noninteractive replacement/reuse checks pass. - Real Gateway proof and independent source-blind acceptance cover first-run setup, invalid replacement, continued use of the old credential, decline, cancellation, restart retry, explicit activation, and deletion rejecting stale activation. - Control UI end-to-end proof covers saved retry and explicit No/Yes choices. Focused rendering checks also pass. - Targeted lint and whitespace checks pass. Full type checks and the complete test matrix run in CI. The live provider proof used one approved credential under distinct profile IDs; it does not claim coverage across two provider accounts. OAuth provider refresh and external browser login are outside the live proof. ## Review Corrections - OAuth reconciliation excludes inactive shared replacements before it can displace working agent-local credentials. - Remote CLI onboarding relays the existing activation wizard's confirmation and cancellation; local CLI completes promotion after an accepted plugin-install restart receipt. - A failed replacement test can return to the current connection without activating the candidate. - The UI status renderer shares its translation call; the existing compressed-size budget is unchanged. [Storage design and downgrade boundary](openclaw#144524 (comment)): the existing payload owns saved state. Older binaries do not enforce inactivity; remove inactive replacements or restore pre-setup state before downgrading. ## Deleted Test Ledger The standalone test `keeps a working configured credential when a replacement is rejected` at `src/system-agent/setup-inference-activate.test.ts:331` on base `df8884dc1d7da20b4110163c497dc0016ee8cd91` was removed. Its behavior moved to the table at `src/system-agent/setup-inference-activate.test.ts:350`, named `keeps a working credential and rotation when a replacement is rejected (configured: $explicitProfile, restart: $restartRequired)`. The configured-profile case retains the old credential/config assertions; the table adds implicit rotation and plugin-restart cases. No tested behavior was removed. ## Shared CI Budget The startup-size limit is also failing on main: retained base proof at `7052ef9371a31744510429d66ddf5b974cd5f6ff` reports 353,134 gzip bytes against 353,107, exit 1. This lane's prior candidate and base had identical raw startup bytes; the compressed result varies with lazy asset references. The owner authorized the guarded shared-failure exception. No size budget is changed. All candidate-caused type/lint failures are repaired separately. Co-authored-by: Ayaan Zaidi <[email protected]>
…penclaw#144568) ## What Problem This Solves Fixes an issue where users preparing a provider through Gateway setup received a raw config-changed error after saving credentials if another config edit occurred during login. The unrelated edit survived, but the provider settings were not applied and the error did not explain that the credential was already saved. ## Why This Change Was Made CLI login and Gateway preparation now share one config writer. It applies only the provider's changes to the latest authored config, merges model rows by ID, rejects conflicting or invalid edits, and uses the existing saved-credential/settings-failure error. Pending plugin-install records remain with their existing commit owner. The setup path no longer binds publication to the snapshot taken before login. Strict snapshot checks remain for migration promotion and verified setup operations that require them. Credential persistence, cancellation, and default-model policy retain their existing owners. ## User Impact Unrelated edits made while provider setup waits for input survive, and setup can complete. If settings cannot be applied, setup explains that credentials were saved and retains the config owner's recovery guidance. ## Evidence - Reproduced on main `c073aed1cfd1ae78c62b1920e76456b595e26950` through the shipped Gateway client: start preparation, edit an unrelated setting while the provider key prompt waits, then complete. Before: raw config-changed error with credential saved. After: setup completes with the edit and credential retained. - Real config-directory permission failure: before, config-only error despite a saved credential; after, explicit saved-credential/settings-failure message. Used isolated state and synthetic credentials. - 45 targeted Gateway setup tests and 55 CLI auth tests pass. The three original new regressions fail on main. Added protection for a config that becomes invalid during login. - Focused lint, formatting, line-count and assertion checks pass. Full type checks run in GitHub CI. Related: openclaw#144181, openclaw#144436. No changes to the credential replacement paths under openclaw#144524. Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
A rejected replacement credential could enter normal rotation. Successful testing activated replacements without a separate choice, and retry details were lost after restart.
Why This Change Was Made
The shared credential owner persists retry state in the existing payload, excludes inactive replacements from use and copying, and activates only after testing, confirmation, and config application. Setup and Model Setup use this same flow.
User Impact
Working connections survive rejection or cancellation. Saved replacements can be retried after restart; ordinary login remains immediate. Before downgrading to older binaries, remove inactive replacements or restore pre-setup state because older versions do not enforce inactivity.
Evidence
Real Gateway and browser checks cover rejected replacements, continued use of the old credential, decline, cancellation, restart retry, explicit activation, and stale activation after deletion. Targeted setup, credential-persistence, noninteractive, and rendering tests passed. Live proof used one credential with distinct profiles; external browser login and refresh were not covered.
Related: #136257, #144195. Downgrade boundary.