Skip to content

Conversation

@mateoCuervo
Copy link
Contributor

@mateoCuervo mateoCuervo commented Nov 26, 2025

Checklist


Note

Adds Chromium-focused clipboard sync in video.vue via focus/visibility listeners and a focused polling fallback, with proper cleanup.

  • Frontend:
    • images/chromium-headful/client/src/components/video.vue:
      • Add Chromium clipboard synchronization:
        • Sync clipboard on window focus and on tab visibility change.
        • Poll clipboard every 500ms while focused as a fallback.
      • Introduce private _clipboardPollInterval?: number for polling control.
      • Clear polling interval in beforeDestroy() to prevent leaks.

Written by Cursor Bugbot for commit f6acd4f. This will update automatically on new commits. Configure here.

Tested

Was only able to test locally via

cd kernel-images/images/chromium-headful
./build-docker.sh && ENABLE_WEBRTC=true ./run-docker.sh

Loom screen recording with video recording tested in localhost:8080

https://www.loom.com/share/a04ce4073afd48e8a65e33b393c16bda

if (!document.hidden) {
this.syncClipboard()
}
})
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Event listeners not removed causing memory leak

The window focus and document visibilitychange event listeners added in mounted() are never removed in beforeDestroy(). This creates a memory leak because the listeners hold references to the component instance, preventing garbage collection. Each time the component is mounted and destroyed, additional listeners accumulate on these global objects.

Fix in Cursor Fix in Web

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mateoCuervo i think bugbot has a valid point here

Copy link

@mesa-dot-dev mesa-dot-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Performed full review of 3dfcec2...f6acd4f

Analysis

  1. Memory leak due to event listeners (window 'focus' and document 'visibilitychange') not being cleaned up in the beforeDestroy() lifecycle hook, which will cause issues when the video component is destroyed and recreated.

  2. Potential race condition in the clipboard synchronization polling mechanism, where the syncClipboard() method could have overlapping executions if operations take longer than the polling interval.

  3. Performance impact from aggressive clipboard polling every 500ms, which may be excessive and resource-intensive, especially on lower-end devices.

  4. Missing concurrency guards to prevent multiple simultaneous clipboard operations when synchronization takes longer than expected.

Tip

Help

Slash Commands:

  • /review - Request a full code review
  • /review latest - Review only changes since the last review
  • /describe - Generate PR description. This will update the PR body or issue comment depending on your configuration
  • /help - Get help with Mesa commands and configuration options

1 files reviewed | 0 comments | Edit Agent SettingsRead Docs

@mesa-dot-dev
Copy link

mesa-dot-dev bot commented Nov 26, 2025

Mesa Description

Checklist

  • A link to a related issue in our repository
    -https://linear.app/onkernel/issue/KERNEL-459/fix-copy-and-paste-intoout-of-live-view
  • A description of the changes proposed in the pull request.
    This PR fixes a clipboard synchronization bug in the browser. It introduces Chromium-specific clipboard synchronization in images/chromium-headful/client/src/components/video.vue. This is achieved by syncing the clipboard on window focus and tab visibility changes, and by adding a 500ms polling fallback when the component is focused. The polling interval is properly managed to prevent resource leaks, ensuring the client clipboard is regularly synced with the host when the video.vue component is active.
  • @mentions of the person or team responsible for reviewing proposed changes.

Note

Adds Chromium-focused clipboard sync in video.vue via focus/visibility listeners and a focused polling fallback, with proper cleanup.

  • Frontend:
    • images/chromium-headful/client/src/components/video.vue:
      • Add Chromium clipboard synchronization:
        • Sync clipboard on window focus and on tab visibility change.
        • Poll clipboard every 500ms while focused as a fallback.
      • Introduce private _clipboardPollInterval?: number for polling control.
      • Clear polling interval in beforeDestroy() to prevent leaks.

Written by Cursor Bugbot for commit f6acd4f. This will update automatically on new commits. Configure here.

Description generated by Mesa. Update settings

@mateoCuervo mateoCuervo requested a review from rgarcia November 28, 2025 18:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants