Skip to content

test(ui): clean up navigation browser teardown - #76625

Merged
amknight merged 1 commit into
mainfrom
ak/ui-navigation-flake-cleanup
May 3, 2026
Merged

amknight merged 1 commit into
mainfrom
ak/ui-navigation-flake-cleanup

Conversation

@amknight

@amknight amknight commented May 3, 2026

Copy link
Copy Markdown
Member

Summary

  • Centralize mounted Control UI app cleanup in the shared app-mount test helper.
  • Drain pending app updates, frames, and timers before clearing DOM and restoring mocks.
  • Cancel delayed tab-visible and scroll work when the app disconnects so teardown does not leave pending console/log work behind.

This targets the intermittent Vitest teardown error from ui/src/ui/navigation.browser.test.ts without serializing the broader UI suite.

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui size: S maintainer Maintainer-authored PR labels May 3, 2026
@clawsweeper

clawsweeper Bot commented May 3, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

Summary
The PR centralizes Control UI app teardown in the shared app-mount test helper and cancels queued scroll/tab-paint work on disconnect.

Reproducibility: no. high-confidence failing reproduction was established. Source inspection on current main shows pending updateComplete, frame, and timer work can outlive the navigation browser test teardown path, but the intermittent Vitest error was not reproduced in this read-only review.

Next step before merge
The remaining action is maintainer and exact-head CI validation of an intermittent UI test flake; there is no narrow automated repair finding to hand off.

Security
Cleared: The diff is limited to Control UI test teardown and app lifecycle cancellation paths, with no dependency, workflow, package, secrets, or external code execution changes.

Review details

Best possible solution:

Land the shared helper teardown and disconnect-time cancellation after maintainer review and exact-head CI confirm the navigation browser teardown flake is gone.

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

No high-confidence failing reproduction was established. Source inspection on current main shows pending updateComplete, frame, and timer work can outlive the navigation browser test teardown path, but the intermittent Vitest error was not reproduced in this read-only review.

Is this the best way to solve the issue?

Yes, with source-level confidence. Centralizing mounted-app teardown in the shared helper and canceling app-owned frame/timer work on disconnect is the narrow maintainable direction; maintainer/CI validation should confirm the flake is actually gone.

What I checked:

  • Protected PR state: Public PR metadata shows the PR is open, ready for review, has the protected maintainer label, and targets head 281da47914f314714772574c064cdcbd2fba4fd8 against current main 9772ce6ce975ed0b5b0f3fa371cbddcddcd3a447. (281da47914f3)
  • Patch scope: The public diff only changes Control UI lifecycle/test teardown files: ui/src/ui/app-lifecycle.ts, ui/src/ui/control-ui-performance.ts, ui/src/ui/navigation.browser.test.ts, and ui/src/ui/test-helpers/app-mount.ts; it does not touch workflows, dependencies, lockfiles, package metadata, or release scripts. (281da47914f3)
  • Current helper teardown: On current main, registerAppMountHooks clears storage and document.body.innerHTML, then unstubs globals and waits one timer tick, but it does not remove mounted openclaw-app elements through their disconnected lifecycle or explicitly drain app-owned frame/timer work first. (ui/src/ui/test-helpers/app-mount.ts:98, 9772ce6ce975)
  • Queued scroll/timer source: Current main schedules chat scroll work after updateComplete, then via requestAnimationFrame, and may leave a retry setTimeout queued; logs scrolling follows the same frame pattern. (ui/src/ui/app-scroll.ts:45, 9772ce6ce975)
  • Current disconnect gap: Current handleDisconnected stops polling and disconnects observers, but it does not cancel the stored chat/log scroll frames, chat retry timeout, or invalidate pending tab-visible paint callbacks. (ui/src/ui/app-lifecycle.ts:82, 9772ce6ce975)
  • Tab visible timing path: Current main records tab-visible performance after updateComplete and paint frames, which matches the PR's guard against recording after the app has disconnected. (ui/src/ui/control-ui-performance.ts:91, 9772ce6ce975)

Likely related people:

  • Vincent Koc: Current-main blame and file history for the affected Control UI app lifecycle, scroll, performance timing, navigation browser test, and app-mount helper all point to the same recent commit by Vincent Koc. (role: introduced behavior / recent Control UI maintainer; confidence: medium; commits: c7bbb3f9af36; files: ui/src/ui/app-lifecycle.ts, ui/src/ui/app-scroll.ts, ui/src/ui/control-ui-performance.ts)

Remaining risk / open question:

  • The reported Vitest teardown failure is intermittent, and this read-only review did not establish a failing local reproduction or prove the flake is eliminated.
  • Some PR CI jobs were still queued or in progress when checked, so final merge confidence depends on the exact head finishing cleanly.

Codex review notes: model gpt-5.5, reasoning high; reviewed against 9772ce6ce975.

@amknight
amknight marked this pull request as ready for review May 3, 2026 10:57
@amknight
amknight merged commit 8a0e3b6 into main May 3, 2026
109 of 112 checks passed
@amknight
amknight deleted the ak/ui-navigation-flake-cleanup branch May 3, 2026 11:41
lxe pushed a commit to lxe/openclaw that referenced this pull request May 6, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 24, 2026
jameslcowan pushed a commit to jameslcowan/openclaw that referenced this pull request Jun 2, 2026
sablehead pushed a commit to sablehead/openclaw that referenced this pull request Jun 10, 2026
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 size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant