Skip to content

fix: retain setup credentials after a failed connection check - #144195

Merged
obviyus merged 10 commits into
mainfrom
feat/setup-inference-verification
Sep 10, 2026
Merged

obviyus merged 10 commits into
mainfrom
feat/setup-inference-verification

Conversation

@obviyus

@obviyus obviyus commented Sep 10, 2026 •

Copy link
Copy Markdown
Collaborator

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.

@clawsweeper

clawsweeper Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review in progress

ClawSweeper is reviewing this revision. This supersedes any previous blocked status.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui gateway Gateway runtime scripts Repository scripts commands Command implementations extensions: openai size: XL maintainer Maintainer-authored PR labels Sep 10, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 10, 2026
@clawsweeper

clawsweeper Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 10, 2026, 2:35 PM ET / 18:35 UTC (Revision 5).

ClawSweeper review

What this changes

Setup 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
Reviewed head: cfb4cef8b49e284e250c4d8cf4428f06252dd15d

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A coherent owner-level repair with focused regression coverage and resolved prior credential findings; discovery's documented availability tradeoff remains visible.
Proof confidence 🌊 off-meta tidepool Not applicable: Repository State identifies a MEMBER author, so the ordinary contributor-proof gate is exempt. The captured body reports public Gateway setup runs covering success, rejection, saved retry, and working-credential preservation; private traces were not independently inspected, and the browser lane is explicitly mocked.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Repository State identifies a MEMBER author, so the ordinary contributor-proof gate is exempt. The captured body reports public Gateway setup runs covering success, rejection, saved retry, and working-credential preservation; private traces were not independently inspected, and the browser lane is explicitly mocked.
Evidence reviewed 11 items Review continuity: The complete comparison against the previous reviewed head contains only an async callback correction in the provider-install ownership test; production behavior is unchanged in this revision.
Working credential preservation: New submissions receive distinct profile IDs and use the existing provider-auth persistence owner. Activation tests cover rejected replacement, preservation of the original credential and configuration, and saved-profile retry without another login.
Selected connection and commit boundary: The shared confirmation owner disables tools and auth-profile fallback, checks the reported winning profile, and closes run admission. Activation revalidates the configuration and execution owner before its config transform commits.
Findings None None.
Security None None.

How this fits together

OpenClaw 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
Loading

Before merge

  • Resolve merge risk (P1) - The documented discovery-worker removal exposes Gateway responsiveness to synchronous provider imports; the 30-second timer bounds asynchronous waits but cannot interrupt an event-loop stall.
  • Review config compatibility - Confirm compatibility and upgrade impact for the changed config or default surface before merge.
  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.
Agent review details

Security

None.

PR surface

PR surface statistics unavailable: the file list is incomplete.

Review metrics

None.

Stored data model

Persistent data-model change detected: migration/backfill/repair: src/infra/update-repair-inference.ts, serialized state: src/commands/doctor/shared/plugin-registry-migration.ts, serialized state: src/system-agent/setup-inference-core.ts, serialized state: src/system-agent/setup-inference-persist.ts, serialized state: src/system-agent/setup-inference-plan-provider-auth.ts, serialized state: src/wizard/setup.inference-verification.ts, and 5 more. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Retain the documented extraction scope (recommended)
    Accept the explicitly documented synchronous-import exposure while retaining the existing asynchronous deadline and partial-result behavior.
  2. Reconsider isolation if the tradeoff is unacceptable
    Pause landing and revisit a bounded discovery boundary without restoring the superseded credential-staging machinery.

Technical review

Best 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.

Labels

Label justifications:

  • P2: This fixes a bounded setup-recovery problem that otherwise forces users to repeat provider sign-in.
  • merge-risk: 🚨 availability: Removing worker isolation allows synchronous provider imports during discovery to block the Gateway event loop.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Repository State identifies a MEMBER author, so the ordinary contributor-proof gate is exempt. The captured body reports public Gateway setup runs covering success, rejection, saved retry, and working-credential preservation; private traces were not independently inspected, and the browser lane is explicitly mocked.

Evidence

What I checked:

  • Review continuity: The complete comparison against the previous reviewed head contains only an async callback correction in the provider-install ownership test; production behavior is unchanged in this revision. (src/system-agent/setup-inference.provider-install-owner.test.ts:249, cfb4cef8b49e)
  • Working credential preservation: New submissions receive distinct profile IDs and use the existing provider-auth persistence owner. Activation tests cover rejected replacement, preservation of the original credential and configuration, and saved-profile retry without another login. (src/system-agent/setup-inference-credentials.ts:163, cfb4cef8b49e)
  • Selected connection and commit boundary: The shared confirmation owner disables tools and auth-profile fallback, checks the reported winning profile, and closes run admission. Activation revalidates the configuration and execution owner before its config transform commits. (src/system-agent/setup-inference-turn.ts:233, cfb4cef8b49e)
  • Discovery disposition and remaining tradeoff: The captured author comment explicitly retains worker removal as accepted extraction scope. Current source preserves the 30-second asynchronous deadline, partial results, cancellation checks, and rejection of late hook results; synchronous plugin loading remains on the Gateway event loop. (src/system-agent/setup-inference-detect.ts:212, cfb4cef8b49e)
  • Current-main necessity: Fetched main still stages credentials for verification and reaches persistent activation only after a successful test; it does not contain this branch's save-before-confirmation flow. (src/system-agent/setup-inference-activate.ts:516, e0b7f1d46e90)
  • Latest-release check: The v2026.9.3 source also uses staged credentials, a verification test, and later persistent activation. Direct GitHub source inspection succeeded after local release-blob hydration failed; no released implementation of this fix is established. (src/system-agent/setup-inference-activate.ts:514, 1391f7cd2d40)

Likely related people:

  • miguelbranco80: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (4 earlier review cycles)
  • reviewed 2026-09-10T16:43:43.878Z sha 278ca19 :: blocked before merge. :: [P1] [P1] Preserve active credentials when saving a setup candidate | [P1] [P1] Preserve bounded isolation for setup discovery
  • reviewed 2026-09-10T17:32:24.010Z sha 586be20 :: blocked before merge. :: [P1] [P1] Preserve bounded isolation for setup discovery
  • reviewed 2026-09-10T17:44:58.006Z sha 6bbe328 :: blocked before merge. :: none
  • reviewed 2026-09-10T18:12:40.189Z sha 149179f :: blocked before merge. :: none

@obviyus
obviyus requested a review from a team as a code owner September 10, 2026 17:15
@openclaw-barnacle openclaw-barnacle Bot added cli CLI command changes agents Agent runtime and tooling extensions: lmstudio extensions: github-copilot labels Sep 10, 2026
@clawsweeper clawsweeper Bot removed the merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. label Sep 10, 2026
@obviyus

obviyus commented Sep 10, 2026

Copy link
Copy Markdown
Collaborator Author

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.

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. labels Sep 10, 2026
obviyus added a commit that referenced this pull request Sep 11, 2026
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]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 11, 2026
…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]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 11, 2026
…#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]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 11, 2026
…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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: web-ui App: web-ui cli CLI command changes commands Command implementations docs Improvements or additions to documentation extensions: github-copilot extensions: lmstudio extensions: openai gateway Gateway runtime maintainer Maintainer-authored PR merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts size: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant