Skip to content

feat(control-ui): add gateway restart confirmation dialog and related…#63807

Merged
BunsDev merged 4 commits intoopenclaw:mainfrom
bbddbb1:feature/gateway-restart-ui-fix
Apr 27, 2026
Merged

feat(control-ui): add gateway restart confirmation dialog and related…#63807
BunsDev merged 4 commits intoopenclaw:mainfrom
bbddbb1:feature/gateway-restart-ui-fix

Conversation

@bbddbb1
Copy link
Copy Markdown
Contributor

@bbddbb1 bbddbb1 commented Apr 9, 2026

Summary

  • Problem: Toggling Dreaming mode could trigger a gateway restart-impacting config update without an explicit confirmation step in the click flow.
  • Why it matters: Users can unintentionally cause temporary service interruption (chat/channels/automations) and interpret the restart/disconnect as a failure.
  • What changed: Added a confirmation modal with warning copy, Cancel and Confirm Restart actions, and Restarting… loading feedback; wired toggle to run only after explicit confirm.
  • What did NOT change (scope boundary): No backend gateway restart implementation changes, no protocol/API contract changes, no unrelated UI refactors.

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor required for the fix
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

Root Cause (if applicable)

  • Root cause: The Dreaming toggle path executed mode update logic immediately, with no user confirmation gate before restart-impacting behavior.
  • Missing detection / guardrail: No UX contract/test asserting confirm-before-execution for restart-sensitive actions.
  • Contributing context (if known): Existing toggle was optimized for direct state change, not restart-risk communication.

Regression Test Plan (if applicable)

  • Coverage level that should have caught this:
    • Unit test
    • Seam / integration test
    • End-to-end test
    • Existing coverage already sufficient
  • Target test or file: ui/src/ui/navigation.browser.test.ts
  • Scenario the test should lock in: Clicking Dreaming toggle does not send config patch until Confirm Restart is pressed; after confirm, patch is sent.
  • Why this is the smallest reliable guardrail: It validates real rendered UI interaction + event wiring + client request side effects in one focused test.
  • Existing test that already covers this (if any): None for this exact confirmation gate.
  • If no new test is added, why not: N/A (new test added).

User-visible / Behavior Changes

  • Dreaming toggle now opens a warning confirmation dialog before applying restart-impacting change.
  • Dialog presents Cancel and Confirm Restart actions.
  • Confirm action shows Restarting… loading state while request is in-flight.
  • No immediate silent restart-triggering action on first click.

Diagram (if applicable)

Before:
[user clicks dreaming toggle] -> [mode update request sent immediately] -> [gateway restart side effects]

After:
[user clicks dreaming toggle] -> [confirmation dialog shown]
  -> [Cancel] -> [no request]
  -> [Confirm Restart] -> [request sent + Restarting… feedback] -> [status refresh]

Security Impact (required)

  • New permissions/capabilities? (No)
  • Secrets/tokens handling changed? (No)
  • New/changed network calls? (No)
  • Command/tool execution surface changed? (No)
  • Data access scope changed? (No)
  • If any Yes, explain risk + mitigation: N/A

Repro + Verification

Environment

  • OS: Linux
  • Runtime/container: Node 22+
  • Model/provider: N/A
  • Integration/channel (if any): Control UI Dreaming tab
  • Relevant config (redacted): Dreaming enabled with memory plugin config path available

Steps

  1. Open Control UI Dreaming page with Dreaming currently on.
  2. Click the Dreaming phase toggle.
  3. Observe modal; click Cancel, then click toggle again and choose Confirm Restart.

Expected

  • First click only opens confirmation.
  • Cancel performs no mode update request.
  • Confirm Restart performs update and shows Restarting… feedback.

Actual

  • Matches expected behavior after this change.

Evidence

  • Failing test/log before + passing after
  • Trace/log snippets
  • Screenshot/recording
  • Perf numbers (if relevant)
image

Human Verification (required)

  • Verified scenarios:
    • Toggle interception opens confirmation modal.
    • Cancel path does not execute update.
    • Confirm path executes update and shows loading state.
  • Edge cases checked:
    • Re-click while loading is blocked.
    • Existing status/error surfaces remain intact.
  • What you did not verify:
    • Full cross-locale copy review for all translated locale bundles.

Review Conversations

  • I replied to or resolved every bot review conversation I addressed in this PR.
  • I left unresolved only the conversations that still need reviewer or maintainer judgment.

Compatibility / Migration

  • Backward compatible? (Yes)
  • Config/env changes? (No)
  • Migration needed? (No)
  • If yes, exact upgrade steps: N/A

Risks and Mitigations

  • Risk: Modal could accidentally block toggle flow if state is not cleared correctly.
    • Mitigation: Explicit open/close/pending state handling and browser test coverage for cancel/confirm behavior.
  • Risk: Users may still perceive restart as failure if warning copy is unclear.
    • Mitigation: High-visibility warning copy with explicit restart/interruption language and in-flight Restarting… feedback.
      … state management

@openclaw-barnacle openclaw-barnacle Bot added the app: web-ui App: web-ui label Apr 9, 2026
@bbddbb1 bbddbb1 marked this pull request as ready for review April 9, 2026 15:26
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 9, 2026

Greptile Summary

This PR adds a confirmation dialog before applying Dreaming mode changes that trigger a gateway restart, replacing the previous immediate-action toggle. The implementation wires three new reactive state fields (dreamingRestartConfirmOpen, dreamingRestartConfirmLoading, dreamingPendingEnabled) through the render layer and adds a browser test that locks in the confirm-gate behavior.

  • cancelDreamingRestart does not clear dreamingStatusError, so if a confirm attempt fails (network/patch error) and the user then cancels, the dreaming view shows a stale failure message from the abandoned operation. Adding state.dreamingStatusError = null to the cancel handler would fix this.

Confidence Score: 4/5

Safe to merge with one state-cleanup fix recommended before landing.

One P1 defect identified (stale error after cancel) that's distinct from the two prior thread findings. The core confirmation gate is correctly implemented and test-covered. The P1 is a one-line fix with no architectural impact.

ui/src/ui/app-render.ts — cancelDreamingRestart needs state.dreamingStatusError = null

Prompt To Fix All With AI
This is a comment left during a code review.
Path: ui/src/ui/app-render.ts
Line: 390-396

Comment:
**Stale error shown on dreaming view after cancel**

`cancelDreamingRestart` clears `dreamingRestartConfirmOpen` and `dreamingPendingEnabled`, but does not clear `dreamingStatusError`. If the user clicked Confirm, got a patch failure (which sets `dreamingStatusError`), and then clicks Cancel to dismiss the dialog, the error string remains in state and is immediately rendered in the dreaming view's `dreams__controls-error` section — showing a stale failure message for an operation the user just abandoned.

```suggestion
  const cancelDreamingRestart = () => {
    if (state.dreamingRestartConfirmLoading) {
      return;
    }
    state.dreamingRestartConfirmOpen = false;
    state.dreamingPendingEnabled = null;
    state.dreamingStatusError = null;
  };
```

How can I resolve this? If you propose a fix, please make it concise.

---

This is a comment left during a code review.
Path: ui/src/ui/views/dreaming-restart-confirmation.ts
Line: 31-38

Comment:
**Cancel/Confirm button order differs from sibling dialogs**

`gateway-url-confirmation.ts` and `exec-approval.ts` both render the primary action first, secondary (Cancel) last. This dialog inverts that — Cancel appears first, Confirm Restart second — which is inconsistent with the existing pattern in the codebase.

How can I resolve this? If you propose a fix, please make it concise.

Reviews (2): Last reviewed commit: "feat(control-ui): add gateway restart co..." | Re-trigger Greptile

Comment thread ui/src/ui/app-render.ts
Comment thread ui/src/ui/app-render.ts
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e2f4655eb1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread ui/src/i18n/locales/en.ts Outdated
@bbddbb1 bbddbb1 closed this Apr 11, 2026
@bbddbb1 bbddbb1 reopened this Apr 11, 2026
Comment thread ui/src/ui/app-render.ts
@bbddbb1 bbddbb1 force-pushed the feature/gateway-restart-ui-fix branch from e2f4655 to d53ca72 Compare April 11, 2026 14:31
@bbddbb1
Copy link
Copy Markdown
Contributor Author

bbddbb1 commented Apr 12, 2026

Hi @BunsDev, I’ve implemented a confirmation modal for the Dreaming mode toggle to prevent accidental gateway restarts. I've also added integration tests to cover the new flow. Ready for review!

@BunsDev
Copy link
Copy Markdown
Member

BunsDev commented Apr 17, 2026

Absolutely, this is an intelligent and thoughtful addition to ensure trust and transparency. Thanks for your contribution @bbddbb1

@BunsDev BunsDev self-assigned this Apr 17, 2026
@bbddbb1
Copy link
Copy Markdown
Contributor Author

bbddbb1 commented Apr 17, 2026

Absolutely, this is an intelligent and thoughtful addition to ensure trust and transparency. Thanks for your contribution @bbddbb1

Thanks, appreciate it!

Happy to iterate further if needed.

@BunsDev
Copy link
Copy Markdown
Member

BunsDev commented Apr 19, 2026

Mind removing anything out of scope from this PR and opening the MiniMax addition, for example, etc in another PR, please? @bbddbb1 that'll get us to main much faster with this request (which is a valuable addition).

@bbddbb1
Copy link
Copy Markdown
Contributor Author

bbddbb1 commented Apr 19, 2026

Mind removing anything out of scope from this PR and opening the MiniMax addition, for example, etc in another PR, please? @bbddbb1 that'll get us to main much faster with this request (which is a valuable addition).

Got it.

Just to confirm — is the i18n part what you had in mind as out of scope, or are there other pieces you'd like split out as well? @BunsDev

@bbddbb1 bbddbb1 force-pushed the feature/gateway-restart-ui-fix branch from d4cd733 to 8c94b48 Compare April 19, 2026 05:09
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8c94b48e5f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread ui/src/ui/views/dreaming-restart-confirmation.ts
@bbddbb1 bbddbb1 force-pushed the feature/gateway-restart-ui-fix branch from dadabeb to f27aa1a Compare April 19, 2026 05:28
@clawsweeper
Copy link
Copy Markdown
Contributor

clawsweeper Bot commented Apr 27, 2026

Codex automated review: keeping this open.

Keep open. Current main still applies the Dreaming toggle immediately through config.patch with no confirmation dialog, pending-confirm state, or confirmation-flow test. The PR remains an active implementation candidate, and the discussion points to scope cleanup/review rather than conservative closure.

Best possible solution:

Keep this PR open and finish the narrow Control UI change: review the latest scoped diff, settle the generated locale handling, keep the confirmation-flow browser coverage, and merge this PR or an equivalent main-branch implementation. If maintainers decide not to ship the UX change, close it as a product decision rather than as already implemented or obsolete.

What I checked:

  • Current main sends the Dreaming toggle immediately: applyDreamingEnabled returns only for saving/no-op states, then immediately calls updateDreamingEnabled(state, enabled) and reloads config/status. The header toggle calls this path directly on click. (ui/src/ui/app-render.ts:740, bfdee5fa72cc)
  • No confirmation state exists on main: The app view state has dreamingModeSaving but no dreamingRestartConfirmOpen, dreamingRestartConfirmLoading, or dreamingPendingEnabled fields from the PR. (ui/src/ui/app-view-state.ts:154, bfdee5fa72cc)
  • The affected config path can require restart: updateDreamingEnabled writes plugins.entries.<pluginId>.config.dreaming.enabled, and gateway reload planning treats plugins config paths as restart-required. (ui/src/ui/controllers/dreaming.ts:1019, bfdee5fa72cc)
  • Current tests cover direct patching, not a confirmation gate: The existing Dreaming controller test asserts updateDreamingEnabled calls config.patch; repository search found no restartConfirmation, Confirm Restart, or Dreaming restart confirmation test on main. (ui/src/ui/controllers/dreaming.test.ts:593, bfdee5fa72cc)
  • PR discussion supports continued review: Provided GitHub context shows this PR links to [Feature]: Improving UX for Gateway Restart Confirmation on Dreaming Toggle #63804, adds a confirmation dialog/state/test path, received positive maintainer feedback, and was later asked to remove out-of-scope pieces to get to main faster. That is an iteration path, not evidence the PR is obsolete. (73c8dec46c3d)
  • Security review pass found no supply-chain surface in the provided diff: The provided PR file list is limited to Control UI rendering/state, UI tests, and i18n locale/meta files. It does not touch workflows, package metadata, lockfiles, dependency sources, install/build/release scripts, permissions, secrets handling, downloaded artifacts, or command execution paths. (73c8dec46c3d)

Remaining risk / open question:

  • The PR still needs normal maintainer review and CI validation before merge.
  • The PR touches generated locale/meta files; per ui/AGENTS.md, maintainers should verify the generated i18n sync is acceptable and not hand-maintained drift.

Codex Review notes: model gpt-5.5, reasoning high; reviewed against bfdee5fa72cc.

@BunsDev BunsDev force-pushed the feature/gateway-restart-ui-fix branch from 73c8dec to 51bcf31 Compare April 27, 2026 07:53
Copy link
Copy Markdown
Member

@BunsDev BunsDev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved on code review for the scoped Control UI change.

What this fixes: #63804 / the Dreaming page toggle previously sent the restart-impacting config patch immediately. This PR now opens an explicit confirmation dialog first, keeps Cancel as a true no-op, shows Restarting... while the confirmed patch is in flight, and refreshes config/status after success.

Why this is the right shape: the behavior stays in the Control UI layer, reuses the existing Dreaming config patch controller, keeps restart semantics out of core, and includes generated locale sync from the English source copy. The prior review issues are addressed: cancel clears stale error state and the button order now matches sibling confirmation dialogs.

Local validation on head 51bcf318c16d27a5e60c7882dad5822c07f19b78:

  • pnpm ui:i18n:check
  • OPENCLAW_TEST_HEAVY_CHECK_LOCK_HELD=1 pnpm test ui/src/ui/navigation.browser.test.ts
  • pnpm exec oxfmt --check $(git diff --name-only origin/main...HEAD)
  • OPENCLAW_TSGO_HEAVY_CHECK_LOCK_HELD=1 pnpm tsgo:core
  • OPENCLAW_TSGO_HEAVY_CHECK_LOCK_HELD=1 pnpm tsgo:core:test
  • OPENCLAW_OXLINT_SKIP_LOCK=1 pnpm lint:core
  • pnpm check:no-conflict-markers
  • pnpm check:import-cycles

Exact-head CI is still red, but the failures I checked are outside this PR's touched files: docs formatting in docs/plugins/sdk-subpaths.md, tmpdir guard in extensions/migrate-hermes/test/provider-helpers.ts, an existing agent/plugin import-cycle report, and migrate-hermes model expectation failures. This is review-approved, not merge-ready until CI is cleaned up or the unrelated failures are separately handled.

@BunsDev BunsDev force-pushed the feature/gateway-restart-ui-fix branch from 51bcf31 to fcf4a46 Compare April 27, 2026 08:00
@BunsDev
Copy link
Copy Markdown
Member

BunsDev commented Apr 27, 2026

Post-rebase update: the PR is now on fcf4a4688ccc1ce0020fa896235acd26048ce70e, is mergeable, and remains approved.

I reran the focused local gates after rebasing on latest origin/main:

  • pnpm changed:lanes --json
  • pnpm ui:i18n:check
  • OPENCLAW_TEST_HEAVY_CHECK_LOCK_HELD=1 pnpm test ui/src/ui/navigation.browser.test.ts
  • pnpm exec oxfmt --check $(git diff --name-only origin/main...HEAD)
  • OPENCLAW_TSGO_HEAVY_CHECK_LOCK_HELD=1 pnpm tsgo:core
  • OPENCLAW_TSGO_HEAVY_CHECK_LOCK_HELD=1 pnpm tsgo:core:test
  • OPENCLAW_OXLINT_SKIP_LOCK=1 pnpm lint:core
  • pnpm check:no-conflict-markers

Exact-head CI completed red, but the remaining failures are outside this PR's touched files:

  • checks-node-extensions-shard-5: extensions/migrate-hermes/model.apply.test.ts model expectation drift.
  • check-additional-runtime-topology-architecture: existing madge cycle through src/agents/** and src/plugins/**.
  • checks-node-extensions and check-additional: aggregate failures from the two jobs above.

No merge action taken.

@BunsDev BunsDev merged commit 563718c into openclaw:main Apr 27, 2026
61 of 65 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Improving UX for Gateway Restart Confirmation on Dreaming Toggle

2 participants