Skip to content

fix(setup): activate saved sign-ins through Gateway reload - #148312

Merged
obviyus merged 6 commits into
mainfrom
codex/gateway-setup-activation
Sep 15, 2026
Merged

obviyus merged 6 commits into
mainfrom
codex/gateway-setup-activation

Conversation

@obviyus

@obviyus obviyus commented Sep 14, 2026 •

Copy link
Copy Markdown
Collaborator

What Problem This Solves

A refused saved-sign-in activation can still select an inactive credential in the agent's saved settings. The current conversation works until Gateway restart, then fails authentication.

Why This Change Was Made

The existing config reloader prepares activation before publishing the runtime. Config and credential owners undo only their own changes, preserving newer edits. Setup waits outside its execution queue. Initial and deferred errors share secret-safe handling and retain their error types.

User Impact

A refused switch keeps the working selection usable before and after restart. Successful activation makes the next reply use the replacement. Reload-disabled or restart-dependent setup reports the prerequisite before changing the selected connection.

Evidence

A running pre-change Gateway at 75ca643 verified the saved connection and received real wizard confirmation. Its reload-disabled refusal persisted the inactive per-agent selection. The same conversation worked immediately, then failed after restarting unchanged state with an unconfigured-profile error and no provider request.

The matching corrected build at aa8a2e284453 preserved the working agent/model settings. After the same refusal and unchanged-state restart, the same conversation completed through the working provider with the expected credential. The affected reload, recovery, and credential owners are unchanged at 41f365e.

The installed v2026.9.4 CLI also updated itself to the corrected build. Hot reload activated a saved secret reference, and the next reply used it in the same conversation. The secret stayed out of config, profile plaintext, and captured output.

The earlier d9dbb0e checks passed: 79 runtime/dependency controls, 76 CI planner checks, lint, types, and protocol generation. The 41f365e refresh preserves all 22 changed files, passes lint/types/protocol checks and 92 checks covering the repaired test routing from main.

Compatibility

No new schema, storage format, or config option. Doctor preview preserved settings; repair retained connection intent; repeated repair was idempotent. The existing fixture warnings remain documented. Successful activation and its conversation also survived Doctor and restart.

Recovery requires the Gateway process to stay alive; a process exit between saving config and preparing activation can leave saved settings selecting an inactive credential.

Consumers

CLI, guided setup, and Gateway activation share the coordinator. Existing config and credential owners retain publication and conditional recovery.

Refs #136257. Builds on #148195.

@clawsweeper

clawsweeper Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@obviyus
obviyus marked this pull request as ready for review September 14, 2026 14:31
@obviyus
obviyus requested a review from a team as a code owner September 14, 2026 14:31
@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime commands Command implementations agents Agent runtime and tooling size: XL maintainer Maintainer-authored PR labels Sep 14, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 14, 2026
@clawsweeper

clawsweeper Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 14, 2026, 10:20 PM ET / September 15, 2026, 02:20 UTC (Revision 6).

ClawSweeper review

What this changes

Coordinates saved-sign-in activation with Gateway reload, restores owned settings and credentials after failure, and shares secret-safe error handling across immediate and deferred completion.

Merge readiness

⛔ Blocked before merge - 5 items remain

This remains a useful fix: current main retains the failing deferred-activation path, and the supplied recovery proof matches this head’s central implementation. No blocking code defect was found.

Priority: P2
Reviewed head: 41f365ef2163ff1ebbb4bbc6421a3d470890bd59
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A coherent repair with relevant real setup and upgrade observations, meaningful regression coverage, and no blocking correctness finding.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The captured body records actual Gateway setup refusal/restart recovery and successful SecretRef activation after a v2026.9.4 update. The demonstrated build’s four central production owners have identical blobs at this head; focused fault and revocation tests supplement those observations.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The captured body records actual Gateway setup refusal/restart recovery and successful SecretRef activation after a v2026.9.4 update. The demonstrated build’s four central production owners have identical blobs at this head; focused fault and revocation tests supplement those observations.
Evidence reviewed 10 items Current main still needs the fix: Current main waits for the application receipt, then promotes the credential separately; failed or superseded application throws without the new coordinated recovery. The merged predecessor #148195 covers classic wizard recovery, not this remaining Gateway path.
Activation and recovery ownership: The coordinator supplies preparation to the existing reload receipt, checks current ownership, and delegates reversal to the existing config and credential owners. Gateway completion waits outside the setup queue.
Real setup and upgrade observations: The captured body at sourceRevision 6b3a0f3f0a9f9ba0c8cd0838d821a6d76687f6d02cb0e88704301e2a485e1d40 reports real wizard confirmation, failure after unchanged-state restart before the fix, and successful same-conversation replies after refusal and restart on the corrected build. It also records an installed v2026.9.4 updater reaching the corrected build, successful SecretRef activation, and Doctor/restart continuity. These are contributor-supplied observations; this read-only review did not execute them.
Findings None None.
Security None None.

How this fits together

Setup verifies a saved provider credential before selecting it for an agent. The Gateway config reloader then publishes the selected connection, while the config and credential stores own conditional recovery.

flowchart TD
  A[Saved sign-in] --> B[Setup verification and confirmation]
  B --> C[Config write preflight]
  C --> D{Can apply immediately?}
  D -->|No| E[Preserve working connection and explain prerequisite]
  D -->|Yes| F[Gateway reload and credential activation]
  F -->|Success| G[Next conversation reply]
  F -->|Failure| H[Restore still-owned settings and credentials]
Loading

Decision needed

Question Recommendation
Does the recorded owner-review approval establish the required openclaw/openclaw-secops involvement for these auth-profile changes? Confirm existing owner coverage: Verify that the recorded approval represents qualifying listed-owner involvement and retain the documented activation tradeoff.

Why: The approval names the exact head, but neither its text nor the available review metadata establishes the listed-owner relationship.

Before merge

  • Resolve merge risk (P1) - Existing users with reload disabled or plugin/restart prerequisites must complete those prerequisites and retry replacement activation; the PR intentionally refuses a one-step switch.
  • Resolve merge risk (P1) - Recovery remains in-process: termination between config persistence and credential preparation can still leave an inactive credential selected, as disclosed in the PR body.
  • Resolve merge risk (P1) - The recorded owner-review approval has not been verified as satisfying the listed security-owner involvement required for auth-profile changes.
  • Complete next step (P2) - Confirm that the recorded owner-review approval satisfies listed secops involvement, or obtain that review before landing.
  • Resolve maintainer decision - Resolve the maintainer decision shown above before merge.
Agent review details

Security

None.

PR surface

Source +233, Tests +457. Total +690 across 22 files.

View PR surface stats
Area Files Added Removed Net
Source 13 559 326 +233
Tests 9 579 122 +457
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 22 1138 448 +690

Review metrics

Metric Value Why it matters
Production versus test growth production +233 net; tests and test support +457 net Production growth supplies shared activation settlement and guarded recovery while reusing existing persistence owners.

Merge-risk options

Maintainer options:

  1. Retain prerequisite-first activation (recommended)
    Accept the documented extra retry for reload-disabled or restart-dependent replacements because it preserves the working selection, supported by the supplied upgrade and restart observations.

Technical review

Best possible solution:

Keep activation and conditional recovery with the existing Gateway, config, and credential owners, preserving the working connection and explaining prerequisites before a refused switch.

Do we have a high-confidence way to reproduce the issue?

Yes: verify and confirm a saved replacement with Gateway reload disabled, then restart unchanged state. Current-main source retains the failure mechanism, and the PR supplies before/after observations; this review did not execute the scenario.

Is this the best way to solve the issue?

Yes: extending the existing reload receipt and conditional recovery owners addresses the failure without another persistence system or public configuration option.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 210907758ea0.

Labels

Label justifications:

  • P2: Repairs a bounded saved-sign-in activation failure that can break authentication after restart.
  • merge-risk: 🚨 compatibility: Replacement activation now refuses reload-disabled and plugin/restart-dependent switches until the operator completes the prerequisite.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The captured body records actual Gateway setup refusal/restart recovery and successful SecretRef activation after a v2026.9.4 update. The demonstrated build’s four central production owners have identical blobs at this head; focused fault and revocation tests supplement those observations.
  • proof: sufficient: Contributor real behavior proof is sufficient. The captured body records actual Gateway setup refusal/restart recovery and successful SecretRef activation after a v2026.9.4 update. The demonstrated build’s four central production owners have identical blobs at this head; focused fault and revocation tests supplement those observations.

Evidence

What I checked:

  • Current main still needs the fix: Current main waits for the application receipt, then promotes the credential separately; failed or superseded application throws without the new coordinated recovery. The merged predecessor fix(setup): restore the working connection after wizard activation fails #148195 covers classic wizard recovery, not this remaining Gateway path. (src/gateway/server-methods/system-agent-execution.ts:81, 210907758ea0)
  • Activation and recovery ownership: The coordinator supplies preparation to the existing reload receipt, checks current ownership, and delegates reversal to the existing config and credential owners. Gateway completion waits outside the setup queue. (src/system-agent/setup-inference-transition.ts:106, 41f365ef2163)
  • Real setup and upgrade observations: The captured body at sourceRevision 6b3a0f3f0a9f9ba0c8cd0838d821a6d76687f6d02cb0e88704301e2a485e1d40 reports real wizard confirmation, failure after unchanged-state restart before the fix, and successful same-conversation replies after refusal and restart on the corrected build. It also records an installed v2026.9.4 updater reaching the corrected build, successful SecretRef activation, and Doctor/restart continuity. These are contributor-supplied observations; this read-only review did not execute them. (aa8a2e284453)
  • Proof remains applicable to this head: The GitHub tree for the demonstrated build was complete. Its blob hashes for config-reload.ts, server-startup-finish.ts, setup-inference-credential-access.ts, and setup-inference-transition.ts exactly match the reviewed checkout, independently confirming the body's unchanged-owner claim. (src/system-agent/setup-inference-transition.ts:106, 41f365ef2163)
  • Deliberate compatibility boundary: Replacement activation requests immediate application. Preflight refuses disabled reload and plugin/restart prerequisites before changing the selected connection; the reloader checks changing prerequisites again before publication. (src/gateway/server-startup-finish.ts:462, 41f365ef2163)
  • Credential authority and regression coverage: Credential promotion rechecks cancellation, reload ownership, exact credential contents, and SecretRef generation before persistence. Added coverage exercises abort and replacement during final revalidation, runtime-preparation failure, supersession, derived SecretRef publication, and secret-safe deferred errors; these tests were inspected, not run. (src/system-agent/setup-inference-credential-access.ts:211, 41f365ef2163)

Likely related people:

  • Ayaan Zaidi: Raw commit e33dc97 adds src/system-agent/setup-inference-transition.ts:39 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: e33dc973ce21; files: src/system-agent/setup-inference-transition.ts)
  • 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 (5 earlier review cycles)
  • reviewed 2026-09-14T15:40:32.987Z sha aa8a2e28445330586f6225f3f8ab7df4fe5b43f1 :: blocked before merge. :: none
  • reviewed 2026-09-14T17:23:51.502Z sha e0e625db4b67187144613cc8e8ee6219b6406e5e :: blocked before merge. :: none
  • reviewed 2026-09-14T19:41:42.929Z sha d9dbb0e :: blocked before merge. :: none
  • reviewed 2026-09-14T20:41:57.334Z sha d9dbb0e :: blocked before merge. :: none
  • reviewed 2026-09-14T21:06:24.263Z sha 41f365e :: blocked before merge. :: none

@obviyus
obviyus force-pushed the codex/gateway-setup-activation branch from 0d131cf to e0e625d Compare September 14, 2026 17:03
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Sep 14, 2026
@obviyus
obviyus force-pushed the codex/gateway-setup-activation branch from e0e625d to d9dbb0e Compare September 14, 2026 19:30
@obviyus
obviyus force-pushed the codex/gateway-setup-activation branch from d9dbb0e to 41f365e Compare September 14, 2026 20:57
@obviyus

obviyus commented Sep 15, 2026

Copy link
Copy Markdown
Collaborator Author

landpr-approve-admin-merge
pr: 148312
head: 41f365e
scope: owner-review

@obviyus
obviyus merged commit dd33833 into main Sep 15, 2026
330 of 333 checks passed
@obviyus
obviyus deleted the codex/gateway-setup-activation branch September 15, 2026 02:43
@obviyus

obviyus commented Sep 15, 2026

Copy link
Copy Markdown
Collaborator Author

Proof: The same conversation completed before and after restart following a refused saved-sign-in activation. Installed stable-update and Doctor checks also preserved successful activation and conversation use.

  • Bug: Refused activation could save an inactive credential selection that failed authentication after restart.
  • Fix: The existing reloader coordinates activation and restores still-owned settings and credentials after failure.

| Before | After |
| Conversation worked immediately after refusal, then failed after restart. | The working connection remains usable after refusal and restart. |

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 15, 2026
…148312)

Prepare saved-credential activation inside the existing Gateway reload transaction. Recover only owned config and credential writes after refusal or failure, preserving newer edits and the working connection.

Reload prerequisites require an explicit retry. Recovery from process termination during the handoff remains outside this change.

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 commands Command implementations gateway Gateway runtime maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. 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