Skip to content

fix: persist configure changes before gateway checks - #125751

Merged
steipete merged 1 commit into
mainfrom
steipete/wizardly-bassi-09aa27
Aug 18, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/wizardly-bassi-09aa27

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Closes #125749

What Problem This Solves

Fixes an issue where operators starting with gateway.mode=remote could choose Local, run only Health check or Daemon, and finish with a configuration-success message even though Local had not been persisted before the side effect. It also corrects channel-removal copy that described removal as complete before the owning config write.

Why This Change Was Made

The configure wizard now explicitly tracks pending versus persisted config and durably flushes pending changes before daemon or health side effects. Daemon and health paths return closed outcomes so completion text reflects failures or side-effect-only runs, while channel removal uses intent-only precommit wording. This changes no authentication, config schema, public API, dependency, or broader product behavior.

User Impact

Selecting Local now survives the configure flow before gateway checks or daemon setup run, and the final message truthfully distinguishes configuration writes, successful or skipped side effects, and failed side effects.

Evidence

Pre-fix ordering proof:

health observed ["health"] instead of ["commit", "health"]
daemon observed ["daemon"] instead of ["commit", "daemon"]

Focused regression command:

node scripts/run-vitest.mjs src/commands/configure.wizard.persistence.test.ts src/commands/configure.wizard.test.ts src/commands/configure.wizard.default-agent.test.ts src/commands/configure.daemon.test.ts src/commands/configure.channels.test.ts
  • Original verified patch: 5 files, 47/47 tests passed.
  • After rebase onto a80ffd043168fa2e5c20323f59ffffc80d94f4ee: 5 files, 50/50 tests passed.

Full changed gate:

node scripts/check-changed.mjs -- src/commands/configure.wizard.ts src/commands/configure.wizard.test.ts src/commands/configure.wizard.persistence.test.ts src/commands/configure.daemon.ts src/commands/configure.daemon.test.ts src/commands/configure.channels.ts src/commands/configure.channels.test.ts

Exit 0 before and after rebase; dead exports, core production/test typechecks, lint, formatting, import cycles, architecture, and repository guards passed.

Fresh post-rebase Codex autoreview: clean, no accepted/actionable findings, patch-correct confidence 0.98.

Production LOC: +55/−20 (net +35). Tests: +170/−21 (net +149). The production growth is the explicit pending/persisted owner state and closed side-effect outcome contract required to prevent false success; no config/API/schema/dependency surface was added.

Source-blind live proof gap: an isolated pnpm openclaw configure attempt could not reach prompts because a dirty-watched-tree artifact rebuild remained in progress under host contention. The daemon live flow was intentionally not attempted because it could alter the operator's real service. Focused tests are not presented as live proof.

AI-assisted: Yes.

Local mode is persisted before health and daemon actions, and failed actions no longer receive a bare success outro.
@clawsweeper

clawsweeper Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@openclaw-barnacle openclaw-barnacle Bot added the commands Command implementations label Aug 18, 2026
@steipete
steipete marked this pull request as ready for review August 18, 2026 09:26
@openclaw-barnacle openclaw-barnacle Bot added size: M maintainer Maintainer-authored PR labels Aug 18, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

Land-ready evidence for #125751

Root cause: in interactive configure, choosing Local only mutated nextConfig. Daemon and health were side-effect-only sections, ran before any write, and set ranSection, which suppressed the no-section persistence fallback. The wizard could therefore leave the old remote mode on disk and still print a bare success outro. Channel removal also described completion before the wizard-owned write.

Architectural owner and canonical fix: src/commands/configure.wizard.ts now owns explicit pending-versus-persisted config state and flushes it through the existing writeWizardConfigFile merge owner before daemon/health. Closed health/daemon outcomes drive truthful completion. The old didSetGatewayMode/ranSection inference path was replaced; maybeInstallDaemon now returns a closed outcome, and channel removal uses intent-only precommit copy. No config/API/schema/dependency/auth surface changed.

Production LOC: +55/-20 (net +35). Tests: +170/-21 (net +149). The production growth is the explicit owner state and side-effect outcome contract required to eliminate false-success states.

Sibling coverage: remote setup's existing commit-before-health path, explicit section ordering, interactive config-producing sections, no-section Local persistence, default-agent ownership, daemon success/failure/skip, health success/failure/skip, and channel removal copy.

Pre-fix order proof:

health observed ["health"] instead of ["commit", "health"]
daemon observed ["daemon"] instead of ["commit", "daemon"]

Local commands:

node scripts/run-vitest.mjs src/commands/configure.wizard.persistence.test.ts src/commands/configure.wizard.test.ts src/commands/configure.wizard.default-agent.test.ts src/commands/configure.daemon.test.ts src/commands/configure.channels.test.ts
node scripts/check-changed.mjs -- src/commands/configure.wizard.ts src/commands/configure.wizard.test.ts src/commands/configure.wizard.persistence.test.ts src/commands/configure.daemon.ts src/commands/configure.daemon.test.ts src/commands/configure.channels.ts src/commands/configure.channels.test.ts
.agents/skills/autoreview/scripts/autoreview --mode uncommitted

Results: focused proof passed 5 files / 47 tests before rebase and 5 files / 50 tests after rebase; the full changed gate exited 0; fresh autoreview reported no accepted/actionable findings with patch-correct confidence 0.98.

Exact-head CI: run 32121573454 completed success for source head 64ee7d83f8a9f4e8e5465e212692dc06c3443e58. Native OPENCLAW_TESTBOX=1 scripts/pr prepare-run 125751 completed with GATES_MODE=hosted_exact_or_recent_parent; it reused the exact-head hosted gate and generated no separate remote Testbox lease or run URL (REMOTE_GATES_* empty).

ClawSweeper: the latest exact-head comment remains the review-started placeholder. No findings or Rank-up moves: have been published; dispatch run 32121727345 completed successfully. Per policy this queued/late publisher is not a merge blocker, and the comment will be checked once more immediately before merge.

Known source-blind proof gaps: isolated pnpm openclaw configure did not reach prompts because a dirty-watched-tree artifact rebuild remained in progress under host contention. Live daemon proof was intentionally not attempted because it could alter the operator's real service. Focused tests are not claimed as live proof.

@steipete
steipete merged commit 2272300 into main Aug 18, 2026
276 checks passed
@steipete
steipete deleted the steipete/wizardly-bassi-09aa27 branch August 18, 2026 09:42
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 20, 2026
Local mode is persisted before health and daemon actions, and failed actions no longer receive a bare success outro.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands Command implementations maintainer Maintainer-authored PR size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Configure can report success before Local mode is persisted

1 participant