Skip to content

fix(ui): keep newer Appearance choices after delayed theme imports [AI-assisted] - #117292

Merged
steipete merged 8 commits into
mainfrom
codex/autoqa-custom-theme-generation-20260731
Aug 1, 2026
Merged

steipete merged 8 commits into
mainfrom
codex/autoqa-custom-theme-generation-20260731

Conversation

@steipete

@steipete steipete commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

Closes #117291

What Problem This Solves

Fixes an issue where a delayed tweakcn custom-theme import could overwrite a newer Appearance action. If an operator clicked Clear, changed the URL, started another import, selected a built-in theme, received a newer server theme, left the page, switched Gateways, or began editing config before the old response finished, that stale completion could still publish its palette, selection, URL cleanup, message, or busy state.

Why This Change Was Made

The Appearance page now delegates custom-theme operations to one lifecycle owner. It records the import request generation, ordered theme-activation intent, serving Gateway scope, and server-theme revision; every later owner action retires or supersedes the old generation. The owner also refuses to start while canonical config is loading or an older full-config write can still commit.

This is the canonical operation boundary rather than a timeout, retry, or consumer guard. ConfigPage remains exactly 1,218 lines—unchanged from main—because the lifecycle was extracted into a focused 228-line module. No public config, protocol, environment, dependency, storage, auth, or migration surface changes.

Maintainer decision: accept the tested precedence where a newer Gateway-scoped Custom selection may activate the palette when the pending import completes. That server selection is the latest authoritative intent; any newer Clear, built-in, or non-Custom server selection still prevents activation.

User Impact

Later Appearance choices stay final. In particular, Clear cannot be silently reversed by a slow replacement; newer imports and URLs keep their own state; built-in and server-provided themes retain precedence; and leaving or changing Gateway/config context cannot let an older import write back into the active page.

Evidence

{
  "scenario": "delayed-replace-then-clear",
  "beforeReplace": {
    "renderedThemeMode": "custom",
    "titleColor": "oklch(0.39 0.09 152)",
    "clawSelected": false,
    "customThemeMetadataCount": 1,
    "importUrl": "",
    "message": "",
    "importButtonDisabled": true,
    "persistedTheme": "custom",
    "hasPersistedCustomTheme": true
  },
  "afterClear": {
    "renderedThemeMode": "dark",
    "titleColor": "rgb(255, 92, 92)",
    "clawSelected": true,
    "customThemeMetadataCount": 0,
    "importUrl": "replacement",
    "message": "Custom theme removed.",
    "importButtonDisabled": false,
    "persistedTheme": "claw",
    "hasPersistedCustomTheme": false
  },
  "afterDelayedResponse": {
    "renderedThemeMode": "dark",
    "titleColor": "rgb(255, 92, 92)",
    "clawSelected": true,
    "customThemeMetadataCount": 0,
    "importUrl": "replacement",
    "message": "Custom theme removed.",
    "importButtonDisabled": false,
    "persistedTheme": "claw",
    "hasPersistedCustomTheme": false
  },
  "pass": true
}

Review metrics:

  • Production TypeScript: +320/-70 (+250 net), almost entirely the explicit lifecycle owner; tests: +713/-1.
  • Config/default surfaces: 0 added, 0 changed, 0 removed.
  • ConfigPage line count: 1,218 before and after; new owner module: 228 lines.

Release-note context: delayed Control UI custom-theme imports no longer overwrite newer Clear, URL, import, theme-selection, page, Gateway, or config-edit intent.

AI-assisted: yes. The root cause, owner boundary, browser behavior, screenshots, and exact-head proof were reviewed directly. A sanitized agent transcript was not included because it was not explicitly approved.

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui size: XL maintainer Maintainer-authored PR labels Aug 1, 2026
@steipete
steipete marked this pull request as ready for review August 1, 2026 08:02
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. labels Aug 1, 2026
@clawsweeper

clawsweeper Bot commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 1, 2026, 4:57 AM ET / 08:57 UTC.

ClawSweeper review

What this changes

The branch moves custom-theme import lifecycle state into a dedicated Control UI owner so late imports cannot overwrite newer Appearance, Gateway, configuration, or server-preference choices.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

This PR addresses a real current-main ordering bug with a coherent lifecycle owner and strong browser proof. Keep it open for explicit maintainer confirmation of the compatibility-sensitive rule that a newer scoped server custom selection may authorize a pending older import to activate its palette.

Priority: P2
Reviewed head: 7cac40f05ae5fc24c10b5451645d7c0d728a2ce9
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Strong browser proof and focused regression coverage support a coherent race repair; remaining merge readiness is the explicit precedence decision, not a discovered patch defect.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The PR body provides completed Chromium mocked-Gateway E2E proof with a redacted rendered/control/persistence verdict showing that Clear remains final after the delayed response; it also links a newer-server-theme race run.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The PR body provides completed Chromium mocked-Gateway E2E proof with a redacted rendered/control/persistence verdict showing that Clear remains final after the delayed response; it also links a newer-server-theme race run.
Evidence reviewed 6 items Current-main defect: Current main still awaits the remote import and then unconditionally writes the imported custom theme, clears the URL, publishes success, and clears busy state; no intervening intent or scope check exists on this path.
Proposed owner boundary: The branch gives every delayed import a request revision and activation revision, retires it for later state changes, and only applies or clears busy state while it still owns the request.
Sibling reconciliation coverage: The PR records a changed server theme even when no local settings patch is needed, so the import owner can observe authoritative server intent rather than inferring it from a local write.
Findings None None.
Security None None.

How this fits together

The Control UI Appearance page imports a remote custom theme, stores the selected theme in browser settings, and reconciles gateway-scoped server preferences. A delayed import response previously wrote directly into that state after later user or server actions had already changed the intended theme.

flowchart LR
  A[Appearance controls] --> B[Theme import request]
  B --> C[Import lifecycle owner]
  D[Gateway server preferences] --> C
  E[Config edits and page or Gateway changes] --> C
  C --> F[Browser theme settings]
  F --> G[Rendered Control UI]
Loading

Decision needed

Question Recommendation
Should a newer gateway-scoped server selection of custom authorize a still-pending earlier import to activate its imported palette, as this branch implements? Accept server-custom authorization: Merge the tested rule that a newer scoped server custom selection may activate the pending imported palette, while every later non-custom or local superseding action prevents it.

Why: The code and tests establish a deterministic implementation, but choosing whether server custom is affirmative authorization rather than merely a selected mode changes precedence for existing persisted Appearance preferences.

Before merge

  • Resolve merge risk (P1) - The patch intentionally changes precedence for an existing persisted Appearance state: a newer gateway-scoped server custom selection can allow an older pending import to activate its palette. That behavior is covered by tests but still needs maintainer acceptance as the compatibility contract.
Agent review details

Security

None.

PR surface

Source +250, Tests +712. Total +962 across 11 files.

View PR surface stats
Area Files Added Removed Net
Source 6 320 70 +250
Tests 5 713 1 +712
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 11 1033 71 +962

Review metrics

Metric Value Why it matters
Theme-precedence contract 1 new server-selection handoff The branch adds one explicit bridge from gateway preference reconciliation into local import ordering, which is the compatibility-sensitive behavior requiring approval.

Stored data model

Persistent data-model change detected: serialized state: ui/src/app/server-prefs.test.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Accept the tested precedence (recommended)
    Confirm that a newer scoped server custom selection is authoritative authorization for the pending palette, then merge with the existing race coverage.
  2. Retire on every server selection
    Change the owner and regression tests so all newer server theme selections retire pending imports if maintainer policy requires an explicit fresh import.
  3. Pause pending UI contract decision
    Keep the PR open without merge until an owner chooses the durable server-versus-local Appearance precedence rule.

Technical review

Best possible solution:

Adopt one lifecycle owner for delayed imports and explicitly document the accepted precedence: later Clear, built-in, URL, import, navigation, Gateway, and non-custom server actions retire the request, while a newer scoped server custom selection is authoritative authorization to activate it.

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

Yes, from source: current main awaits the import and then writes its result without checking later intent, and the branch supplies deterministic delayed-response browser and unit scenarios for the resulting race. This review did not execute the test suite locally.

Is this the best way to solve the issue?

Unclear until the maintainer chooses the server-custom precedence contract. A single import lifecycle owner is the best implementation boundary; the unresolved question is the policy encoded by its mayActivate rule, not whether the race needs owner-level repair.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 41051fe37c7f.

Labels

Label justifications:

  • P2: This deterministically repairs a user-visible Appearance race that can silently reverse a later operator choice, without an outage, security, or data-loss signal.
  • merge-risk: 🚨 compatibility: The new precedence rule affects how existing persisted local theme preferences reconcile with gateway-scoped server selections during a delayed import.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster 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 PR body provides completed Chromium mocked-Gateway E2E proof with a redacted rendered/control/persistence verdict showing that Clear remains final after the delayed response; it also links a newer-server-theme race run.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides completed Chromium mocked-Gateway E2E proof with a redacted rendered/control/persistence verdict showing that Clear remains final after the delayed response; it also links a newer-server-theme race run.

Evidence

What I checked:

  • Current-main defect: Current main still awaits the remote import and then unconditionally writes the imported custom theme, clears the URL, publishes success, and clears busy state; no intervening intent or scope check exists on this path. (ui/src/pages/config/config-page.ts:842, 41051fe37c7f)
  • Proposed owner boundary: The branch gives every delayed import a request revision and activation revision, retires it for later state changes, and only applies or clears busy state while it still owns the request. (ui/src/pages/config/custom-theme-import-owner.ts:128, 7cac40f05ae5)
  • Sibling reconciliation coverage: The PR records a changed server theme even when no local settings patch is needed, so the import owner can observe authoritative server intent rather than inferring it from a local write. (ui/src/app/server-prefs.ts:461, 7cac40f05ae5)
  • Merge-aware current-main comparison: Current main has no changes under the PR's affected ui/src/app or ui/src/pages/config paths since the PR base, so the reviewed UI patch does not overlap later main-branch edits in those surfaces. (ui/src/pages/config/config-page.ts:842, 41051fe37c7f)
  • Regression coverage and real behavior proof: The branch adds focused tests for Clear, URL, newer import, built-in theme, server selection, navigation, Gateway scope, config mutation, initial load, and disconnect; the PR body also links completed Chromium mocked-Gateway E2E runs for delayed Replace-to-Clear and newer server-theme scenarios. (ui/src/pages/config/config-page.custom-theme.test.ts:97, 7cac40f05ae5)
  • Feature provenance: The unconditional import completion and existing server-preference reconciliation lines are attributed to the current-main commit that introduced the surrounding configuration work; the PR’s first repair commit is 664766f1f72b83ec1eb2c56596616e59ad68ff07. (ui/src/pages/config/config-page.ts:850, 664766f1f72b)

Likely related people:

  • steipete: History sampling shows Peter Steinberger as the dominant contributor across the affected Control UI files, and the current branch’s lifecycle repair was authored under this handle. (role: feature-history contributor and proposed repair author; confidence: high; commits: 664766f1f72b, 7cac40f05ae5; files: ui/src/pages/config/config-page.ts, ui/src/app/server-prefs.ts, ui/src/app/bootstrap.ts)
  • Yuval Dinodia: Current-main blame attributes the pre-fix import completion and adjacent server-preference reconciliation to the July 31 configuration change. (role: recent current-main contributor; confidence: high; commits: c13a0493aa10; files: ui/src/pages/config/config-page.ts, ui/src/app/server-prefs.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Get explicit maintainer confirmation for the scoped server-custom authorization rule before merge.

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 (3 earlier review cycles)
  • reviewed 2026-08-01T08:07:12.065Z sha 031a4f4 :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-01T08:22:28.336Z sha b5dbaf4 :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-01T08:46:26.034Z sha 7cac40f :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added the merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. label Aug 1, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 1, 2026
@steipete

steipete commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

Land-ready proof for 7cac40f05ae5fc24c10b5451645d7c0d728a2ce9.

Maintainer decision: accept the tested precedence where a newer Gateway-scoped custom selection is affirmative authorization for the still-pending imported palette. Later Clear, built-in selection, non-custom server selection, URL/import replacement, navigation, Gateway change, config edit, or teardown still supersedes the old request.

Root cause: the previous Appearance path awaited the remote theme and then unconditionally published its palette, URL cleanup, success message, and busy-state completion. The canonical fix moves request generation, activation intent, Gateway scope, server-selection revision, and view-state publication into ui/src/pages/config/custom-theme-import-owner.ts; ConfigPage now routes every superseding owner event through that lifecycle. Timeout, retry, and consumer-only guards were rejected because they leave the stale publication owner intact.

Sibling coverage includes server theme changes that require no local settings patch, built-in/reset actions, replacement URL/import ordering, page and Gateway lifecycle, full-config edits, initial config loading, and disconnect. Production TypeScript is +320/-70 (+250 net); tests are +713/-1. ConfigPage remains 1,218 lines, with the new 228-line lifecycle owner carrying the added state machine. No public config, protocol, storage schema, environment, auth, dependency, or migration surface changes.

Exact-head proof:

Observed behavior: the Chromium verdict shows the existing green Custom palette before replacement, immediate red/Claw state after Clear, and byte-for-byte equivalent control/persistence state after the delayed response. The newer-server-theme race also preserves the server-selected built-in theme while retaining only the newly imported palette. The known evidence gap remains screenshot publication: both approved upload routes rejected the upload, so no image was committed or sent to an unapproved host; the public Chromium run and redacted verdict remain inspectable.

Best-fix verdict: this is the clean, appropriately bounded owner-level repair. Current main has no overlapping edits in the affected UI owner surface, and the branch is cleanly mergeable.

@steipete
steipete merged commit d585c0c into main Aug 1, 2026
145 of 151 checks passed
@steipete
steipete deleted the codex/autoqa-custom-theme-generation-20260731 branch August 1, 2026 09:07
@steipete

steipete commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit to Alix-007/openclaw that referenced this pull request Aug 1, 2026
* origin/main:
  fix(update): keep rolled-back Git installs runnable (openclaw#117294)
  refactor(ui): centralize chat outbox projections (openclaw#117284)
  fix(sessions): preserve target rows during legacy migration (openclaw#117272)
  fix(security): detect multiline skill prompt injection (openclaw#117254)
  fix(qa): lease credentials for Telegram startup proof (openclaw#116842)
  refactor(memory): unify session ingestion (openclaw#117293)
  fix(channels): strip internal tool text in Reef and Zalo Personal (openclaw#112621)
  fix(ui): keep newer Appearance choices after delayed theme imports [AI-assisted] (openclaw#117292)
  fix(inference): simplify lifecycle and preserve Codex tool identity (openclaw#117298)
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 2, 2026
…I-assisted] (openclaw#117292)

* fix(ui): fence stale custom theme imports

* test(ui): split custom theme ownership coverage

* fix(ui): fence external theme import ownership

* fix(ui): separate theme import activation ownership

* fix(ui): bind theme imports to authoritative intent

* refactor(ui): own custom theme import lifecycles

* test(ui): refresh memory helper routing expectation

* test(ui): emit custom theme race verdict
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 2, 2026
* origin/main:
  fix(update): keep rolled-back Git installs runnable (openclaw#117294)
  refactor(ui): centralize chat outbox projections (openclaw#117284)
  fix(sessions): preserve target rows during legacy migration (openclaw#117272)
  fix(security): detect multiline skill prompt injection (openclaw#117254)
  fix(qa): lease credentials for Telegram startup proof (openclaw#116842)
  refactor(memory): unify session ingestion (openclaw#117293)
  fix(channels): strip internal tool text in Reef and Zalo Personal (openclaw#112621)
  fix(ui): keep newer Appearance choices after delayed theme imports [AI-assisted] (openclaw#117292)
  fix(inference): simplify lifecycle and preserve Codex tool identity (openclaw#117298)
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 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.

[Bug]: Delayed custom-theme import can overwrite newer Appearance intent

1 participant