Skip to content

fix: prevent leaked chat preview Escape listeners in tests - #143191

Merged
steipete merged 1 commit into
mainfrom
codex/fix-chat-preview-test-cleanup
Sep 9, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/fix-chat-preview-test-cleanup

Conversation

@steipete

@steipete steipete commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Related: #139428

Additional instructions The branch is hosted in this repository and remains editable by repository maintainers.

What Problem This Solves

Resolves a problem where shared UI test runs lose Escape events after the chat position rail Markdown preview tests, causing two otherwise passing picker tests to fail.

Why This Change Was Made

Clear the table's Lit-rendered fixture before disconnecting its transcript controller. This invokes the existing directive teardown and removes the preview's window listener. Removing the DOM alone does not notify a Lit AsyncDirective that its root part was disconnected.

User Impact

No product behavior changes. Developers get isolated test fixtures while retaining both Markdown preview cases and all existing picker assertions.

Evidence

  • The unchanged rail → picker sequence reproduced exactly two failures among 20 cases. Escape traces identified the detached chat preview's capture listener; the one-line cleanup makes all 20 pass with normal picker handling.
  • Replayed the recorded 277-file historical UI prefix: before, 7,568 passed and the same two failed; after, all 7,570 passed with no skips. The candidate run had no Escape instrumentation and retained the exact file order and case identities.
  • The historical replay uses frozen source 78e9b1432867356d47682de04ec68b6f840bbe45 on macOS/Node 26.8.1; the original failure was recorded on Linux/Node 24.19. This is not a full-suite performance acceptance result.
  • Mapped changed checks and independent review passed. The only source change is one test teardown line.

@clawsweeper

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

@steipete
steipete marked this pull request as ready for review September 9, 2026 14:43
@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: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 9, 2026
@clawsweeper

clawsweeper Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed September 9, 2026, 10:51 AM ET / 14:51 UTC.

ClawSweeper review

What this changes

The PR clears the rendered chat-preview test fixture so its Escape listener cannot interfere with later picker tests.

Merge readiness

⛔ Blocked before merge - 1 item remains

Keep open: this is a focused, correct fixture-lifecycle repair that current main still needs. No actionable patch defects were found.

Priority: P3
Reviewed head: f7bd9b69c57ee271e3fb4d5a3e78afb9207e05d7

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Recorded reviewer rating: A focused lifecycle repair with convincing source support and reported ordered regression validation. Real behavior proof remains required by host policy.
Proof confidence 🌊 off-meta tidepool Recorded reviewer rating; Required by policy: the recorded not-applicable assessment does not satisfy the current PR proof policy. Put relevant after-change evidence in the main PR body, then request a fresh review with @clawsweeper re-review. Recorded reviewer context: Live repository permissions verify a maintainer-authored PR, so the external-contributor gate does not apply. The changed owner is test teardown; the body reports ordered before/after replay through the real rail directive and picker handlers, with no production behavior change.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Required by policy Required by policy: the recorded not-applicable assessment does not satisfy the current PR proof policy. Put relevant after-change evidence in the main PR body, then request a fresh review with @clawsweeper re-review. Recorded reviewer context: Live repository permissions verify a maintainer-authored PR, so the external-contributor gate does not apply. The changed owner is test teardown; the body reports ordered before/after replay through the real rail directive and picker handlers, with no production behavior change.
Evidence reviewed 8 items Verified introduced change: The pinned merge-base-to-head diff adds only render(nothing, container) inside the Markdown preview table's finally block; assertions and production behavior remain unchanged.
Listener lifecycle owner: The rail directive registers a capture-phase window keydown listener. Its disconnected callback invokes bindPreview without an element, removing that listener; the transcript controller's hostDisconnected only disconnects its virtualizer.
Dependency teardown contract: The test imports Lit rendering directly, and OpenClaw pins Lit 3.3.3. At the verified [email protected] commit, rendering nothing clears the child part and notifies disconnectable children before removing DOM nodes; AsyncDirective then invokes disconnected.
Findings None None.
Security None None.

How this fits together

The Control UI conversation rail previews messages and captures Escape to dismiss previews. Its tests share a browser-like environment, so fixture teardown must release listeners before subsequent tests run.

flowchart TD
 A[Markdown preview test] --> B[Render conversation rail]
 B --> C[Window Escape listener]
 A --> D[Clear rendered fixture]
 D --> E[Directive teardown]
 E --> F[Remove Escape listener]
 F --> G[Later picker tests receive Escape]
Loading

Before merge

  • Add real behavior proof - Required by policy: the recorded not-applicable assessment does not satisfy the current PR proof policy. Put relevant after-change evidence in the main PR body, then request a fresh review with @clawsweeper re-review. Recorded reviewer context: Live repository permissions verify a maintainer-authored PR, so the external-contributor gate does not apply. The changed owner is test teardown; the body reports ordered before/after replay through the real rail directive and picker handlers, with no production behavior change.
Agent review details

Security

None.

PR surface

Tests +1. Total +1 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 1 0 +1
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 1 0 +1

Review metrics

None.

Technical review

Best possible solution:

Keep fixture cleanup at the rendering owner, preserving the Markdown safety cases and existing picker assertions.

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

Yes: source shows the preview listener surviving DOM-only fixture removal, and the PR describes the failing rail-to-picker order. No tests were executed during this read-only review.

Is this the best way to solve the issue?

Yes: rendering nothing invokes the existing Lit teardown contract at the fixture owner without weakening assertions or changing production listeners.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 425a90d0ccfc.

Labels

Label changes:

  • add P3: This narrowly repairs test isolation without changing shipped behavior.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit. This is the recorded reviewer rating; real behavior proof remains required by host policy.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Required by policy: the recorded not-applicable assessment does not satisfy the current PR proof policy. Put relevant after-change evidence in the main PR body, then request a fresh review with @clawsweeper re-review. Recorded reviewer context: Live repository permissions verify a maintainer-authored PR, so the external-contributor gate does not apply. The changed owner is test teardown; the body reports ordered before/after replay through the real rail directive and picker handlers, with no production behavior change.

Label justifications:

  • P3: This narrowly repairs test isolation without changing shipped behavior.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit. This is the recorded reviewer rating; real behavior proof remains required by host policy.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Required by policy: the recorded not-applicable assessment does not satisfy the current PR proof policy. Put relevant after-change evidence in the main PR body, then request a fresh review with @clawsweeper re-review. Recorded reviewer context: Live repository permissions verify a maintainer-authored PR, so the external-contributor gate does not apply. The changed owner is test teardown; the body reports ordered before/after replay through the real rail directive and picker handlers, with no production behavior change.

Evidence

What I checked:

  • Verified introduced change: The pinned merge-base-to-head diff adds only render(nothing, container) inside the Markdown preview table's finally block; assertions and production behavior remain unchanged. (ui/src/pages/chat/components/chat-position-rail.test.ts:262, f7bd9b69c57e)
  • Listener lifecycle owner: The rail directive registers a capture-phase window keydown listener. Its disconnected callback invokes bindPreview without an element, removing that listener; the transcript controller's hostDisconnected only disconnects its virtualizer. (ui/src/pages/chat/components/chat-position-rail.ts:299, f7bd9b69c57e)
  • Dependency teardown contract: The test imports Lit rendering directly, and OpenClaw pins Lit 3.3.3. At the verified [email protected] commit, rendering nothing clears the child part and notifies disconnectable children before removing DOM nodes; AsyncDirective then invokes disconnected. (packages/lit-html/src/lit-html.ts:1747, 20afabd3c5bf)
  • Still needed on main: Fetched main retains the Markdown preview fixture without Lit cleanup. The shared test cleanup only replaces document body children. Inspection of the latest release's corresponding blob failed because it was unavailable locally and retrieval failed; no shipped-fix claim is made. (ui/src/pages/chat/components/chat-position-rail.test.ts:261, 425a90d0ccfc)
  • Recorded ordered validation: The fully supplied PR body reports two failures before cleanup and 20 passing cases afterward in the rail-to-picker sequence, plus a preserved 277-file historical replay improving from 7,568 passes and two failures to 7,570 passes. It identifies frozen source, macOS/Node versions, unchanged case identities, and removal of diagnostic instrumentation. These are contributor-reported test results, not reviewer-executed proof or full-suite performance acceptance. Captured context identity: e1b4fbbb37490c2e03f51ad0cce6c50a47c500aa2dc1f2f1b96941fd925270ec. (f7bd9b69c57e)
  • Verified author role: Although the supplied association is CONTRIBUTOR, the live repository permissions endpoint identifies steipete as a repository admin, establishing the maintainer-authored proof exemption.

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; 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.

@steipete
steipete merged commit 04212fa into main Sep 9, 2026
124 of 126 checks passed
@steipete
steipete deleted the codex/fix-chat-preview-test-cleanup branch September 9, 2026 15:06
@steipete

steipete commented Sep 9, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Sep 9, 2026
…er-ownership-20260909

* origin/main: (147 commits)
  fix(cli): reject blank account selectors before command startup (#143088)
  fix(update): repair young runs after recorded drivers exit (#143136)
  test(telegram): close model callback fixture connections (#143197)
  improve(test): reduce Telegram policy fixture startup overhead (#143192)
  test(ci): stabilize systemd manager shim timing (#143134)
  fix(test): retire chat preview Escape listeners during teardown (#143191)
  test(memory-wiki): share visibility test callbacks (#143181)
  fix(ci): accept native iOS keychain filenames (#142968)
  fix(ci): show publication observations in FRV status (#143171)
  fix(github): point the stuck-FAQ auto-response at a live anchor (#143194)
  docs: correct verified accuracy defects in CLI, tools, and automation pages (#143179)
  refactor(tests): remove duplicate Mistral cache-cost test (#143172)
  fix(doctor): complete canonical model-reference migration (#142284)
  fix(ci): reject stale and empty timing sample cohorts (#143182)
  fix(ui): remove first-reply confetti from chat (#143167)
  docs: split help/faq into 13 topic pages (#143150)
  refactor(docs): require caller-owned route indexes (#143164)
  fix(android): distinguish connection status from chat readiness (#143128)
  refactor: share agent-turn execution test defaults (#143166)
  fix(cli): print immutable-config refusals without crash framing (#143140)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant