Skip to content

improve(ui): rethink the failed settings save as one card - #191890

Merged
vyctorbrzezowski merged 2 commits into
mainfrom
brzezowski/settings-save-failed-state
Nov 3, 2026
Merged

vyctorbrzezowski merged 2 commits into
mainfrom
brzezowski/settings-save-failed-state

Conversation

@vyctorbrzezowski

Copy link
Copy Markdown
Member

What Problem This Solves

A failed settings save showed four loose pieces in one row: "Save failed", a "Show reason" link, "Retry" and a long "Discard draft and reload" button, all at the same weight. The reason was hidden behind a link, Retry did not stand out, and Discard threw away the unsaved edit in one click with no warning. A rejected save added a fifth piece, "Current settings are unchanged."

User Impact

A failed save is now one small card on the same spot as Saving and Saved: the state in danger color, the reason right below it as plain text, then Retry as the primary button and Discard changes as a quiet secondary one.

  • The reason is always in view. A long raw error scrolls inside the card.
  • Discard changes asks first ("Discard unsaved changes?"), and Cancel keeps the edit. Reload after "Settings changed elsewhere" asks the same way, because it also drops the edit.
  • Retry keeps the card in place, showing Saving… until the result comes back, so the card does not shrink to a pill and grow back when the save fails again.
  • The card has a fixed width (360px, the screen minus the gutters on a phone), so nothing moves when the reason or state changes. The page underneath never moves.
  • A rejected save shows "Settings not applied" with its reason. A config the Gateway could not restore shows "Save failed" with only Discard changes, as before.

Why This Change Was Made

This is the failed state of the shared save status from #191354. It is a status, so it stays on the status's anchor instead of becoming a toast, which can be dismissed and replaced, or an inline message, which would push the form down. One danger signal is enough: only the title is red, the reason is ordinary text, and the actions follow the app's primary and ghost buttons in every theme. The confirm uses the existing confirm dialog.

Evidence

The same failure in each image comes from an isolated real Gateway whose config file was made immutable, so its own write failed. Log Level was changed in Advanced → Logging.

Before and After, CRT dark, 1440:

Before: Save failed, Show reason, Retry and Discard draft and reload in one row After: one card with the state, the reason and Retry

After, Absolutely light, 390:

After: the failure card at 390

Discard changes asks first. Cancel kept the edit, and confirming reloaded the saved value:

Discard unsaved changes? confirm dialog

Checked in all 22 themes (11 families, light and dark) at 1440 and 390. CRT and Phosphor keep square corners.

Checks run locally: oxfmt, oxlint, stylelint, pnpm check:control-ui-controllers, pnpm tsgo:ui, unit tests for the save status and the settings sidebar (41 passed), and pnpm ui:check-performance:base (passes; total CSS −23 B gzip). The browser tests that click the old labels are updated; the failed-save and rejected-save ones passed, the rest were not rerun.

Stacked on #191354 (base brzezowski/settings-saved-confirmation). Land #191354 first, then this. #191394 also reads the shared status and needs no change; landing it before or after this works.

@vyctorbrzezowski vyctorbrzezowski self-assigned this Nov 3, 2026
@clawsweeper

clawsweeper Bot commented Nov 3, 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.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 3, 2026
@clawsweeper

clawsweeper Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes

This PR presents failed settings saves as one card with a visible reason, primary Retry action, and confirmation before discarding edits.

Example: Changing Log Level to debug fails because the Gateway config file is immutable.

  • Before: Save failed, Show reason, Retry, and Discard draft and reload appear as separate controls; discarding immediately removes the edit.
  • After: One card displays the failure reason and Retry, while Discard changes opens a confirmation dialog.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) Strong visual product evidence supports the direction, but confirmation lifecycle defects and reproducible consumer/check failures block merge.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (screenshot): Inspected before/after desktop screenshots, the mobile card, and the confirmation dialog map the changed shared indicator to an isolated real Gateway config-write failure; the body records cancel retaining the edit and confirmation reloading the saved value.
Patch quality 🦪 silver shellfish (2/6) 5 actionable review findings remain.

Product

Kind: Preference · Worth it: Yes · Fix scope: Complete
User problem: Failed saves scatter recovery controls, hide the reason, and discard unsaved edits without confirmation.
Reason: The maintainer-authored direction is approved, and the inspected desktop/mobile evidence shows a clearer recovery flow using existing UI owners.

Merge readiness

⛔ Needs changes before merge - 6 items remain

Keep open: this maintainer-authored PR provides a useful, demonstrated UI improvement, but its confirmation handling and incomplete consumer updates need repair before merge.

Priority: P2
Reviewed head: a846e8a3bb28589aa7923703ebaae4fd787c58d9

Before merge

  • Retire pending discard confirmations with their presentation (P2) - If the route or config connection changes while the dialog is open, its promise remains active and confirmation calls submit against the current props. submit captures the new presentation, so its existing lifetime checks cannot reject this stale request; discardDraft also captures its revision only at that later invocation. Capture the originating presentation before opening the dialog and reject confirmation after it retires, so a dialog opened for an earlier context cannot discard the successor draft.
  • Report confirmation-loading failures through the outcome slot (P2) - showConfirmDialog can reject when its lazy view or modal registration fails to load. This void promise has only a success handler and never reaches completion/outcome, leaving an unhandled rejection and no visible explanation when Discard or conflict Reload cannot open. Route dialog preparation failures through the existing visible command-error path while preserving the draft.
  • Accept the dialog in every affected reload scenario (P2) - The recovery test accepts confirmation only for the first discard. Its later recover.click calls at lines 132 and 142 still expect config.get immediately, and settings-reload-devices-draft.e2e.test.ts:62 has the same assumption for conflict Reload. Head CI times out at recovery line 133 and device-reload line 63 because the requests now wait for confirmation. Update each remaining caller to accept the dialog before asserting the original recovery and editor-lock behavior.
  • Migrate the agent-config failure assertion to visible reason text (P2) - FailureCard removes the previous status aria-label, but agent-config-save.e2e.test.ts:109 still reads it and calls toContain on null. The head check reports this exact failure. Assert the retained uncertainty explanation in the visible reason or accessible content instead, preserving the reconnect-draft contract rather than restoring a redundant label.
  • Preserve real exports in the new confirmation mock (P2) - This new closed first-party factory omits showConfirmChoiceDialog and has neither importOriginal pass-through nor an adjacent mock-isolation explanation. scripts/check-test-mock-exports.mts rejects precisely this factory shape, and the head baseline check reports mock-exports failure. Spread the real module and override showConfirmDialog, or document the specific isolation requirement using the supported annotation; do not expand the baseline.
  • Explain or restore the original intent of Command lifecycle and guarded recovery - d731b3f: Existing presentation lifetimes retire commands when their scope changes, while recovery reload retains invalid or missing-file safeguards; the new confirmation does not yet carry that lifetime across its wait.

Findings

  • [P2] Retire pending discard confirmations with their presentation — ui/src/components/settings-save-indicator.tsx:178-180
  • [P2] Report confirmation-loading failures through the outcome slot — ui/src/components/settings-save-indicator.tsx:173-182
  • [P2] Accept the dialog in every affected reload scenario — ui/src/e2e/settings-config-recovery.e2e.test.ts:115-118

Provenance

  • Command lifecycle and guarded recovery changes intended behavior without addressing why it exists (d731b3f: Existing presentation lifetimes retire commands when their scope changes, while recovery reload retains invalid or missing-file safeguards; the new confirmation does not yet carry that lifetime across its wait.)

Tests

  • Missing end-to-end proof: Base-red/head-green execution is not shown for the added regressions; the affected reload and agent-config browser consumers currently fail on the reviewed head.
Agent review details

How this fits together

The shared Control UI save indicator consumes config-owner status and command callbacks, renders save and recovery feedback, and sends retry, reload, save, and apply requests through the existing owner.

flowchart TD
  A[Settings edit] --> B[Runtime config owner]
  B --> C[Gateway config operation]
  C --> B
  B --> D[Shared save indicator]
  D --> E[Failure card]
  E --> F[Discard confirmation]
  F --> B
Loading

Technical review

Best possible solution:

Keep the card in the existing indicator, scope confirmation to its originating presentation, report dialog failures through the existing outcome slot, and complete the affected test migration.

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

The base source directly reloads on discard and hides the reason behind a toggle; supplied real-Gateway screenshots demonstrate that presentation and the replacement card.

Is this the best way to solve the issue?

The existing indicator and confirm dialog are the right owners, and the retained failure memo supports stable retry presentation without introducing another config owner.

Full review comments:

  • [P2] Retire pending discard confirmations with their presentation — ui/src/components/settings-save-indicator.tsx:178-180
    If the route or config connection changes while the dialog is open, its promise remains active and confirmation calls submit against the current props. submit captures the new presentation, so its existing lifetime checks cannot reject this stale request; discardDraft also captures its revision only at that later invocation. Capture the originating presentation before opening the dialog and reject confirmation after it retires, so a dialog opened for an earlier context cannot discard the successor draft.
    Confidence: 0.92
  • [P2] Report confirmation-loading failures through the outcome slot — ui/src/components/settings-save-indicator.tsx:173-182
    showConfirmDialog can reject when its lazy view or modal registration fails to load. This void promise has only a success handler and never reaches completion/outcome, leaving an unhandled rejection and no visible explanation when Discard or conflict Reload cannot open. Route dialog preparation failures through the existing visible command-error path while preserving the draft.
    Confidence: 0.99
  • [P2] Accept the dialog in every affected reload scenario — ui/src/e2e/settings-config-recovery.e2e.test.ts:115-118
    The recovery test accepts confirmation only for the first discard. Its later recover.click calls at lines 132 and 142 still expect config.get immediately, and settings-reload-devices-draft.e2e.test.ts:62 has the same assumption for conflict Reload. Head CI times out at recovery line 133 and device-reload line 63 because the requests now wait for confirmation. Update each remaining caller to accept the dialog before asserting the original recovery and editor-lock behavior.
    Confidence: 1
  • [P2] Migrate the agent-config failure assertion to visible reason text — ui/src/components/settings-save-indicator.tsx:191-195
    FailureCard removes the previous status aria-label, but agent-config-save.e2e.test.ts:109 still reads it and calls toContain on null. The head check reports this exact failure. Assert the retained uncertainty explanation in the visible reason or accessible content instead, preserving the reconnect-draft contract rather than restoring a redundant label.
    Confidence: 1
  • [P2] Preserve real exports in the new confirmation mock — ui/src/components/settings-save-indicator.test.ts:16
    This new closed first-party factory omits showConfirmChoiceDialog and has neither importOriginal pass-through nor an adjacent mock-isolation explanation. scripts/check-test-mock-exports.mts rejects precisely this factory shape, and the head baseline check reports mock-exports failure. Spread the real module and override showConfirmDialog, or document the specific isolation requirement using the supported annotation; do not expand the baseline.
    Confidence: 1

Overall correctness: patch is incorrect
Overall confidence: 0.96

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 9006d115c8e4.

Provenance checked

  • Failure layout and reason disclosure changes intended behavior with a stated reason (918a46d: The stacked parent intentionally anchored persistent feedback outside page flow and placed expanded reasons above a compact status; this PR explains replacing that arrangement with one fixed-width card.)
  • Validation rejection feedback changes intended behavior with a stated reason (0963fd5: fix: explain rejected settings without losing edits #157549 distinguished conclusively rejected settings from uncertain writes and reassured users that saved settings were unchanged; this PR retains the rejection distinction and displays its reason directly.)
  • English sidebar copy ownership keeps the original intent (5ad78d0: The narrow sidebar/save English fragment avoids loading broad Settings copy on unrelated routes; this PR keeps that registrar and its broad-catalog references.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

Acceptance criteria:

  • pnpm test ui/src/components/settings-save-indicator.test.ts
  • pnpm test:ui:e2e ui/src/e2e/settings-config-recovery.e2e.test.ts ui/src/e2e/settings-reload-devices-draft.e2e.test.ts ui/src/e2e/agent-config-save.e2e.test.ts ui/src/e2e/config-safe-write.e2e.test.ts ui/src/e2e/config-form-integrity.e2e.test.ts
  • pnpm check:test-mock-exports --base afbea16
  • pnpm tsgo:ui
  • git diff --check

What I checked:

  • Reviewed introduction and current main: The pinned parent-to-head diff contains the card, confirmation, retry presentation, English copy, CSS, and test changes; current main retains the earlier shared indicator and does not implement this card. (ui/src/components/settings-save-indicator.tsx:155, a846e8a3bb28)
  • Inspected visual proof: All four downloaded screenshots were inspected: comparable CRT desktop before/after views, the mobile failure card, and the discard dialog; the PR describes an isolated real Gateway write failure and successful cancel/confirm behavior. (a846e8a3bb28)
  • CI confirms incomplete reload migration: Head annotations report recovery tests timing out at settings-config-recovery.e2e.test.ts:133 and device reload tests timing out at settings-reload-devices-draft.e2e.test.ts:63; those callers click Reload or Discard without accepting the newly required dialog. (ui/src/e2e/settings-config-recovery.e2e.test.ts:133, a846e8a3bb28)
  • CI confirms stale accessibility assertion: Head CI fails agent-config-save.e2e.test.ts:109 because the failure status no longer has aria-label; the reason now exists as visible card content. (ui/src/e2e/agent-config-save.e2e.test.ts:109, a846e8a3bb28)
  • New mock violates enforced export contract: The new closed first-party mock has neither real-module pass-through nor an isolation explanation and has no existing baseline entry; head baseline-ratchets annotations specifically report mock-exports failure. (ui/src/components/settings-save-indicator.test.ts:16, a846e8a3bb28)
  • Existing scope and discard owners: The shell retires save presentations on route and connection changes, while discard captures its draft revision only when invoked; the new confirmation waits outside both protections. (ui/src/components/settings-sidebar-shell.tsx:17, a846e8a3bb28)

PR surface

Source +24, Tests +57. Total +81 across 8 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 4 180 156 +24
Tests 4 90 33 +57
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 8 270 189 +81

Labels

Label changes:

  • add P2: This is a bounded settings recovery improvement with concrete confirmation and test-consumer repairs.
  • add merge-risk: 🚨 session-state: A confirmation can survive presentation retirement and invoke the reload callback for the successor config context.
  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦞 diamond lobster and patch quality is 🦪 silver shellfish.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Label justifications:

  • P2: This is a bounded settings recovery improvement with concrete confirmation and test-consumer repairs.
  • merge-risk: 🚨 session-state: A confirmation can survive presentation retirement and invoke the reload callback for the successor config context.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦞 diamond lobster and patch quality is 🦪 silver shellfish.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.
  • proof: sufficient: Contributor real behavior proof is sufficient.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed November 3, 2026, 7:47 AM ET / 12:47 UTC.

Base automatically changed from brzezowski/settings-saved-confirmation to main November 3, 2026 13:33
@vyctorbrzezowski
vyctorbrzezowski force-pushed the brzezowski/settings-save-failed-state branch from a846e8a to 01d23e2 Compare November 3, 2026 14:40
@vyctorbrzezowski
vyctorbrzezowski merged commit e01e177 into main Nov 3, 2026
26 of 27 checks passed
@vyctorbrzezowski
vyctorbrzezowski deleted the brzezowski/settings-save-failed-state branch November 3, 2026 14:42
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 4, 2026
…91890)

Keep failed Settings saves in one stable card with the reason visible and Retry available. Confirm before discarding edits or reloading; cancel preserves the draft.

Update existing test consumers to confirm recovery, read the visible error, and preserve real confirm-dialog exports in the partial mock.

Validation: 15 indicator tests, 9 browser E2Es, and UI typecheck passed. The mock-export guard now reports only an unchanged main violation in config-secret-fields.test.ts; the failing test, target module, and baseline are byte-identical to main. Full CI remains pending under the authorized batch policy.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: M status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant