Repository navigation
fix: retain setup credentials after a failed connection check - #144195
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review in progressClawSweeper is reviewing this revision. This supersedes any previous blocked status. |
|
Codex review: blocked before merge. Reviewed September 10, 2026, 2:35 PM ET / 18:35 UTC (Revision 5). ClawSweeper reviewWhat this changesSetup retains submitted credentials after failed checks, offers saved-sign-in retries, and uses one tool-free confirmation before saving model configuration. Merge readiness⛔ Blocked before merge - 3 items remain This remains useful, protected work that current main does not replace. The credential-replacement finding is resolved, and no new actionable defect was found in this revision. The author explicitly documents and retains the discovery-worker removal. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw setup connects CLI and Gateway clients to provider authentication and model selection. It saves credentials through the existing auth store, tests the selected connection, and updates configuration after successful confirmation. flowchart LR
A[CLI or Gateway setup] --> B[Select connection]
B --> C[Save distinct credential]
C --> D[Tool-free confirmation]
D --> E{Connection succeeds}
E -->|Yes| F[Validate and save configuration]
E -->|No| G[Keep credential for retry]
G --> B
Before merge
Agent review detailsSecurityNone. PR surfacePR surface statistics unavailable: the file list is incomplete. Review metricsNone. Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep one confirmation owner, preserve working credentials and authored settings, and carry the explicitly accepted in-process discovery tradeoff into the landing review. Do we have a high-confidence way to reproduce the issue? Yes, from source: submit credentials through Gateway setup and fail confirmation; current main stages them privately and exits before persistent activation. The body reports that reproduction, but this review did not execute it. Is this the best way to solve the issue? Yes: separating credential retention from successful model selection fixes the retry problem through existing owners, and distinct profiles address the earlier replacement defect. The documented discovery tradeoff remains explicit. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against e0b7f1d46e90. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
|
The credential replacement finding is resolved. New submissions use separate saved profiles, and confirmation disables credential fallback. Real-provider proof shows one request each for initial success, rejected replacement, and successful verification of the original route. Both credentials remain saved, and rejection leaves the working configuration unchanged. The accepted extraction scope from #136257 explicitly removes the detection worker. This PR keeps that cutover and documents the remaining synchronous plugin-loading risk. The timer does not claim to restore worker isolation. The detector now retains the shipped 30-second allowance, with cancellation and completed partial results. The earlier 10-second value was taken from historical source and has been corrected. A regression covers a valid choice that takes 20 seconds to discover. All four detector cases and 79 LM Studio cases pass. The separate local review accepted the credential implementation and live proof; its only remaining discovery timing choice is addressed by retaining the existing allowance. No schema, table, column, or migration is added. Saved credentials continue to use the existing auth-profile store and its existing record format. |
Related: #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 #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](#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 `448a48c6521f1a13bc0aa7c2ab054f73cef79145` 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 `cd9be2bbe7d89f4df2389cb633401d812fbd335a` 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]>
…aw#144195) Related: openclaw#136257 ## What Problem This Solves First-run setup discarded a credential after a failed connection check, which forced another sign-in. Managed local models could also receive a second verification turn with tools enabled. ## Why This Change Was Made One setup owner now saves the selected credential through the existing auth-profile store, confirms the candidate configuration in memory with one tool-free provider turn, and commits configuration only after success. New submissions receive distinct profile identities. A rejected replacement therefore preserves both the working credential and the rejected credential, and setup cannot fall back to another profile during confirmation. Saved-sign-in retry reuses the saved profile without another login. Gateway activation reports completion only after releasing setup admission, so an immediate follow-up can start. The cutover removes staged credential stores, promotion/rollback helpers, the detection worker, and the parallel verification path. Existing provider installation, scoped runtime generations, cancellation, relevant config conflict checks, protected credential checks, and error redaction remain with their owners. CLI wizard, Gateway setup, completion, and update-repair callers use the shared confirmation owner. Custom endpoint setup defers its preliminary completion to that owner. ## User Impact - Failed confirmation preserves the credential and leaves configuration unchanged. - Rejected replacement credentials cannot overwrite a working sign-in. - Saved-sign-in retry runs a fresh confirmation without repeating login. A saved replacement remains selectable when it uses the current model. - Local models receive one tool-free confirmation turn. - No SQLite table, column, or migration is added. Discovery retains the previous 30-second asynchronous deadline and returns completed saved/native/manual choices when a provider hook stalls. The worker is removed as part of this extraction. Synchronous plugin imports still share the Gateway event loop; the deadline does not restore worker isolation. Custom endpoint settings remain available for retry while the Gateway runs; after restart, those endpoint settings may need to be supplied again. ## Evidence Pinned main `e15d39907a749787a8ae17ba23fe3363ef9dc0e6` reproduced the credential-loss defect through the shipped setup Gateway request with no configured default. Rejection left configuration unchanged but discarded the submitted credential. Real-provider proof drives the compiled CLI Gateway in scratch state through the public setup requests. It records complete provider requests/responses and config/credential state before the request and after the result. Success, real HTTP 401 rejection, saved-sign-in recovery, and working-credential replacement are covered. Each setup confirmation uses the selected credential with `tools: []`; only success writes the selected configuration. Failed attempts and corrections remain in the private evidence record. Focused validation includes setup activation, turn ownership, stalled discovery, Gateway/Control UI admission, wizard import and retry, provider adapters, protected routes, plugin persistence/index/registry, and auth planning. The initial cutover passed 816 targeted tests; the correction reruns the affected owners and adds replacement, exclusive-auth, and stalled-discovery cases. Formatting, syntax lint, unused-export scans, the max-lines/environment ratchets, normal commit hooks, and runtime builds passed. Full type checking and CI run on GitHub. A real Chromium regression and independent browser pass show the saved replacement row on desktop and mobile, verify the saved-profile activation request contains no key or new sign-in, and observe success. This browser lane uses a mocked Gateway; the separate real-provider lane proves credential/configuration behavior. The complete deletion ledger classifies every deleted or rewritten test file and identifies the current behavior owner. Production TypeScript remains smaller after the cutover. Co-authored-by: Ayaan Zaidi <[email protected]>
…#144181) Related: openclaw#136257 ## Problem Provider login could overwrite settings changed during sign-in and could hide that credentials were already saved when settings application failed. CLI auth changes used a read-only status refresh that did not acknowledge publication to the Gateway's prepared auth state. ## Solution Login saves credentials through the existing owner and replays only its configuration changes against the writer's current source. Independent additions also merge when their parent object was absent at login start; overlapping edits still report a conflict. Model identities are normalized through the existing config owner. ID-keyed model rows merge as upserts: unchanged fields and concurrent entries survive, while overlapping changes report a settings conflict separately from the saved credential. The administrator-only `models.authRefresh` method uses the existing Gateway publication owner and waits for prepared auth state. It reloads shared-store ownership after external writes and rekeys configured owners before queuing publication. Login, logout, profile order, and local-store notifications share that owner. Generated protocol artifacts and the dependent Workboard manifest are updated without a protocol version bump. When an older Gateway returns `INVALID_REQUEST` with `unknown method: models.authRefresh`, the CLI makes one guarded legacy `models.authStatus { refresh: true }` request and still prints restart guidance. Legacy status refresh is not reported as acknowledged publication. ## Impact - Full-provider logout cancels matching active runs immediately after credential removal, even when later auth refresh fails. Targeted logout and unrelated runs remain unchanged. - Unset and existing defaults are preserved unless `--set-default` is requested. - Concurrent model IDs and independent fields survive sign-in; partial rows retain existing settings. - Read-only status access stays unchanged. The read-to-admin scope narrowing is intentional for the new mutation; permission errors do not trigger the compatibility path. - Order acknowledgement includes auth publication. A committed order still returns a warning if refresh fails. - Omitted workspace is supported by configured-owner lookup; refresh uses current configuration rather than stale request facts. ## Evidence - 398 current-owner targeted tests pass across retained and refreshed owner/sibling proof, including CLI login/logout/order, config replay, ID normalization, partial model rows, fallback classification, runtime notifications, scoped/overlapping publication, and public method admission. - Baseline real CLI proof shows a concurrent logging edit being overwritten before the repair. Credential readback confirms persistence even when settings are rejected. - Fresh eight-scenario CLI acceptance on `f6044cbdd60a` passes default controls, ordinary ID upserts, concurrent new IDs, independent field edits, and saved-credential reporting for genuine conflicts. The prior failed partial-row run is retained in the evidence history. - Real Gateway proof shows acknowledged publication, visible credentials/model availability, overlapping agent refreshes, read-only denial with status access retained, local-agent logout, and remote-store separation. - Fresh real-Gateway proof with older-method response controls on `f6044cbdd60a` passes login, order, and local logout: exactly one legacy status request follows the typed unknown-method response, restart guidance remains, and no publication success is claimed. Wrong method/code, permission failures, and mismatched state do not use the fallback. The same pass verifies the updated prepared-catalog behavior from main. - Live logout fault proof on `117f47d41b4a` starts two real provider HTTP requests through `chat.send`, then makes provider auth preparation fail during publication. Full-provider logout still closes the matching request and emits `auth-revoked`; the unrelated request stays active and completes. The response remains `UNAVAILABLE`. The registered-handler regression is red before the fix and green afterward. - The absent-parent regression fails on `117f47d41b4a` and passes after the one-condition conflict-check correction. The existing registered-provider login test verifies both provider entries, credentials, and the original default; 52 selected login/config tests pass. No further live fixture experiments were run. - Formatting, syntax lint, assertion safety, max-lines limits, protocol generation/validation, and relevant generated-output checks pass. Full CI runs on GitHub. Fixtures use synthetic credentials; no live vendor OAuth or model inference is claimed. Existing limitation: shared-main CLI logout reports an auth-store lock failure on both the pinned baseline and candidate before refresh. Agent-local logout and its refresh are verified; this PR does not change the shared-profile remover. An additional targeted-profile fault attempt stopped at credential removal before reaching publication; it is retained as a limitation. Existing targeted-logout preservation tests pass. The separate setup lifecycle is owned by openclaw#144195. Shared login results and chat/Telegram completion presentation follow in the next extraction PR. 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]>
Related: #136257.
What Problem This Solves
Fixes an issue where setup discarded credentials after a failed connection check and forced another sign-in. Managed local models could also receive a second verification turn with tools enabled.
Why This Change Was Made
One setup operation saves the selected credential, confirms configuration in memory with one tool-free provider turn, and commits configuration only after success. Distinct profile identities preserve working credentials when a replacement fails. Saved-sign-in retry reuses the saved profile.
User Impact
Failed confirmation retains credentials and leaves configuration unchanged. Local models receive one tool-free check. No schema change. Custom endpoint settings may need re-entry after restart; synchronous plugin imports still share the Gateway event loop.
Consumers: setup, wizard, completion and update-repair callers use the shared confirmation operation.
Evidence
The public setup request reproduced credential loss. Real-provider checks covered success, rejection, retry and replacement with exact credential/configuration readback. Focused tests and builds passed. Browser checks verified saved-profile retry using a mocked Gateway; provider behavior was checked separately.