Repository navigation
refactor(ui): share promise modal host lifecycle - #140746
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 7, 2026, 12:30 AM ET / 04:30 UTC. ClawSweeper reviewWhat this changesShares 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 Review scores
Verification
How this fits togetherControl 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]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource -9, Tests +43. Total +34 across 7 files. View PR surface stats
Review metricsNone. Technical reviewBest 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. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
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.
66d7a54 to
b8d3bde
Compare
|
Merged via squash.
|
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.
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, besidemodal-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
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 buildpassed in 43m 5.6s.node scripts/check-changed.mjsand explicitpnpm ui:check-performancepassed; 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 headb8d3bdecb865ca9932f03b502dd16b958bacd636passed 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: