Skip to content

fix(web): address desktop preview tabs by runtime id in automation - #483

Merged
patroza merged 1 commit into
fork/devfrom
fix/preview-automation-runtime-tab-id
Sep 23, 2026
Merged

patroza merged 1 commit into
fork/devfrom
fix/preview-automation-runtime-tab-id

Conversation

@patroza

@patroza patroza commented Sep 23, 2026

Copy link
Copy Markdown
Owner

Problem

Browser automation broke in the desktop app. preview_status and preview_open succeeded, but preview_snapshot, preview_navigate, preview_evaluate, preview_wait_for (and click/type/press/scroll/color scheme/recording) failed with PreviewAutomationExecutionError. Desktop traces show the actual cause:

PreviewTabNotFoundError: Preview tab not found: tab_1
PreviewWebviewNotInitializedError: Preview tab "tab_1" has no webview registered

Root cause

Upstream moved desktop preview tabs to a runtime identity: previewRuntimeTabId(threadRef, serverEpoch, tabId). An upstream merge into the fork kept a stale fork copy of PreviewAutomationHosts.tsx. In that copy, status and the overlay-ready wait use the runtime id, but every other bridge call still passes the bare server id (tab_1). So status reports a healthy tab while everything else misses it in the desktop PreviewManager.

This is unrelated to the Discord browser host. The failing client was the desktop renderer host (preview-…), not discord-browser-*.

Fix

  • Restore PreviewAutomationHosts.tsx from the last merged upstream commit (829af7b73a). That brings back runtime ids everywhere, the viewport rollback, the presentation settle, and the shared waitForNavigationReadiness.
  • Keep the one intentional fork change: resolveNavigableUrl for open/navigate.
  • I checked every other file that uses runtimeTabId; none diverge from upstream.

Tests

The new test PreviewAutomationHosts desktop operations checks that a snapshot request reaches the desktop bridge with the runtime tab id. It fails on the current fork/dev file and passes with this change.

🤖 Generated with Claude Code

A conflict resolution in an upstream merge kept a stale fork copy of
PreviewAutomationHosts. Status and the overlay wait used upstream's
previewRuntimeTabId, but navigate, snapshot, click, type, press, scroll,
evaluate, waitFor, setColorScheme and recordings still passed the bare
server tab id. The desktop registers webviews under the runtime id, so
every one of those failed with "Preview tab not found: tab_N" while
preview_status kept reporting a healthy tab.

Restore upstream's file (runtime ids, viewport rollback, presentation
settle, shared navigation readiness) and keep only the fork's
resolveNavigableUrl for open/navigate. Add a regression test that the
snapshot bridge call receives the runtime tab id.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@patroza
patroza marked this pull request as ready for review September 23, 2026 10:09
@patroza
patroza merged commit ce3ef6b into fork/dev Sep 23, 2026
3 of 7 checks passed
patroza added a commit that referenced this pull request Sep 23, 2026
#484)

Fork CI on `ce3ef6b4` (#483) failed all four `citation comment source
disappearance` tests in `AssistantCitationChip.test.tsx` with
`TypeError: Cannot read properties of null (reading 'isServer')` from
the real TanStack `Link`.

The file mocks `@tanstack/react-router`, but in the `unit` project
(`isolate: false`) a sibling file can bind the real module first. The
file passes on its own, and the failure depends on test order, the same
hazard already documented for the other entries in
`isolatedUnitTestFiles`. This PR moves the file into the isolated
project.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: T3 Code PR Stack <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.

1 participant