Skip to content

refactor(ui): share promise modal host lifecycle - #140746

Merged
steipete merged 1 commit into
mainfrom
steipete/dedup-ui-0906-modals
Sep 7, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/dedup-ui-0906-modals

Conversation

@steipete

@steipete steipete commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

The confirmation, text input, secret reveal, group-defaults, and placement dialogs duplicate imperative host creation, promise settlement, and teardown. The placement dialog can also recreate a modal subtree inside its detached host when a catalog request completes after cancellation.

Why This Change Was Made

components/promise-modal-host.ts, beside modal-dialog.ts, now owns one host, abort-listener cleanup, once-only settlement, synchronous Lit unmount, and rejection of late rendering. Each dialog retains its dismissal rules, module reentrancy gate, validation, request generations, and submission policy. Production changes total +85/-94 (net -9); the placement regression adds 43 test lines.

User Impact

Dialog appearance and interactions are preserved. All 30 tagged templates are byte-identical. Cancelled placement dialogs leave their retired host empty even if catalog loading completes later. Secret acknowledgment still requires the explicit action, and busy input submission still refuses incidental dismissal.

Evidence

  • The placement regression fails on the original implementation (detached host has 1 child instead of 0) and passes with the shared host.
  • Focused confirmation, input, modal, placement, and chat-placement proof: 47 unit and 9 browser cases passed. A warmed browser rerun passed all 9 cases without the initial Vite optimization/reload warning.
  • Mocked Gateway Playwright suites for group defaults, placement moves, and device-token reconnect: 22/22 passed.
  • UI typecheck and UI build passed; startup performance passed at 346193 B gzip and 8 JavaScript requests, with no baseline edits.
  • Independent Codex review: no actionable P0–P2 findings.

No protocol, persistent-state, configuration, or public SDK contract changes. This is the modal-host item in the maintainer-requested UI consolidation campaign.

Full pnpm build passed in 43m 5.6s. node scripts/check-changed.mjs and explicit pnpm ui:check-performance passed; final startup JavaScript is 346197 B gzip across 8 requests, with no baseline edit. The first changed-check run caught an implicit timer return in the new regression; the block-body correction preserves its assertions and timing. Both independent reviews were clean through P2.

Local proof ran before rebasing onto b7ec235a5cc05ae9577095498de5cfd6b8e2d293; complete pre/post-rebase patches compare byte-identically. Current head b8d3bdecb865ca9932f03b502dd16b958bacd636 passed hosted CI, native review validation, and native prepare. Prepare used the repository's hosted-proof mode (OPENCLAW_TESTBOX=1); no separate Testbox lease was allocated.

Focused commands:

node scripts/run-vitest.mjs ui/src/components/confirm-dialog.test.ts ui/src/components/input-dialog.test.ts ui/src/components/modal-dialog.test.ts ui/src/components/session-placement-move-dialog.test.ts ui/src/pages/chat/chat-pane-placement.test.ts ui/src/pages/chat/chat-pane-placement-restart.test.ts
node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner ui/src/e2e/session-management.group-defaults.e2e.test.ts ui/src/e2e/session-placement.move.e2e.test.ts ui/src/e2e/device-token-reconnect.e2e.test.ts

@clawsweeper

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

@openclaw-barnacle openclaw-barnacle Bot added the app: web-ui App: web-ui label Sep 7, 2026
@steipete
steipete marked this pull request as ready for review September 7, 2026 03:45
@openclaw-barnacle openclaw-barnacle Bot added size: M maintainer Maintainer-authored PR labels Sep 7, 2026
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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 7, 2026
@clawsweeper

clawsweeper Bot commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 7, 2026, 12:30 AM ET / 04:30 UTC.

ClawSweeper review

What this changes

Shares lifecycle management across five Control UI dialogs and prevents delayed catalog responses from rebuilding a cancelled placement dialog.

Merge readiness

✅ Ready for maintainer review

This remains useful: current main retains the delayed-catalog repaint defect, and the reviewed patch introduces no actionable correctness findings. The maintainer-authored, protected PR should proceed through normal landing gates.

Likely related people: steipete and Josh Lehman (unverified routing candidates from area history).

Priority: P3
Reviewed head: b8d3bdecb865ca9932f03b502dd16b958bacd636

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, maintainable consolidation with a meaningful regression test and no identified blocking defect.
Proof confidence 🌊 off-meta tidepool Not applicable: The external-contributor proof gate does not apply to this maintainer-authored PR, and no material authority change triggers additional proof. Reported browser and regression coverage supports the shared-host path but was not independently executed here.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The external-contributor proof gate does not apply to this maintainer-authored PR, and no material authority change triggers additional proof. Reported browser and regression coverage supports the shared-host path but was not independently executed here.
Evidence reviewed 7 items Shared lifecycle owner: The helper checks settlement before rendering, marks settlement before synchronous Lit unmount, removes the abort listener, removes the host, and resolves once. Dialog-specific cancellation and submission policies remain in their callers.
Current main still needs the repair: Fetched main removes the placement host on cancellation but unconditionally calls paint when catalog loading finishes; paint still invokes Lit directly on that retired host.
Latest release comparison: The same direct-render teardown and unconditional catalog-finally repaint are present in v2026.9.2; the inspected release does not already contain this repair.
Findings None None.
Security None None.

How this fits together

Control UI dialogs collect confirmations, input, and session placement choices or display issued secrets. The shared host manages their DOM lifetime and returns results to the calling UI workflow.

flowchart TD
  A[UI workflow] --> B[Dialog-specific rules]
  B --> C[Shared modal host]
  D[Async catalog response] --> C
  C --> E{Already settled?}
  E -->|No| F[Render dialog]
  E -->|Yes| G[Ignore late rendering]
  F -->|Confirm or cancel| H[Unmount and return result]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source -9, Tests +43. Total +34 across 7 files.

View PR surface stats
Area Files Added Removed Net
Source 6 85 94 -9
Tests 1 43 0 +43
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 7 128 94 +34

Review metrics

None.

Technical review

Best possible solution:

Keep teardown and late-render suppression in one shared owner while preserving each dialog’s existing interaction policy.

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

Yes, from source: cancel placement selection before its catalog resolves, then complete the request; current main repaints the detached host. The added regression exercises this order, but this review did not execute it.

Is this the best way to solve the issue?

Yes. Centralizing settlement and rendering guards removes duplicated lifecycle code without moving dialog policy or changing caller contracts.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 86f5429e5a61.

Labels

Label justifications:

  • P3: This is bounded internal UI lifecycle consolidation with a detached-host cleanup fix and preserved visible interactions.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The external-contributor proof gate does not apply to this maintainer-authored PR, and no material authority change triggers additional proof. Reported browser and regression coverage supports the shared-host path but was not independently executed here.

Evidence

What I checked:

  • Shared lifecycle owner: The helper checks settlement before rendering, marks settlement before synchronous Lit unmount, removes the abort listener, removes the host, and resolves once. Dialog-specific cancellation and submission policies remain in their callers. (ui/src/components/promise-modal-host.ts:25, b8d3bdecb865)
  • Current main still needs the repair: Fetched main removes the placement host on cancellation but unconditionally calls paint when catalog loading finishes; paint still invokes Lit directly on that retired host. (ui/src/components/session-placement-move-dialog.ts:65, 86f5429e5a61)
  • Latest release comparison: The same direct-render teardown and unconditional catalog-finally repaint are present in v2026.9.2; the inspected release does not already contain this repair. (ui/src/components/session-placement-move-dialog.ts:65, 3928bad9badf)
  • Focused regression and sibling coverage: The new test cancels while catalog loading is pending, checks null settlement and host removal, then resolves the catalog and checks that the retired host stays empty. Existing confirmation and input tests cover abort, reentrancy, and busy submission. Tests were inspected, not executed. (ui/src/components/session-placement-move-dialog.test.ts:19, b8d3bdecb865)
  • Captured validation and review continuity: The supplied complete PR body reports an original-code regression failure, passing focused unit/browser coverage, 22 mocked-Gateway flows, build and performance checks. Prior completed review retained no findings or rank-up moves. The earlier reviewed commit could not be loaded locally, so patch-identical rebase continuity remains an author-reported fact rather than independently verified evidence. (b8d3bdecb865)
  • Area history and inspection limits: Available main history identifies Peter Steinberger and Josh Lehman in placement-dialog maintenance. Deeper blame and historical patch inspection encountered unavailable objects and failed network retrieval; no source-line introduction attribution is asserted. (ui/src/components/session-placement-move-dialog.ts, 86f5429e5a61)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Josh Lehman: 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 (1 earlier review cycle)
  • reviewed 2026-09-07T03:52:14.421Z sha 66d7a54 :: needs maintainer review before merge. :: none

Keep dialog dismissal and reentrancy policies local; settled hosts cannot repaint after delayed catalog loading. Focused modal and placement tests plus 22 mocked Gateway browser flows pass.
@steipete
steipete force-pushed the steipete/dedup-ui-0906-modals branch from 66d7a54 to b8d3bde Compare September 7, 2026 04:24
@steipete
steipete merged commit 292b304 into main Sep 7, 2026
134 of 136 checks passed
@steipete
steipete deleted the steipete/dedup-ui-0906-modals branch September 7, 2026 04:37
@steipete

steipete commented Sep 7, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 8, 2026
Keep dialog dismissal and reentrancy policies local; settled hosts cannot repaint after delayed catalog loading. Focused modal and placement tests plus 22 mocked Gateway browser flows pass.
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 P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M 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