diff --git a/src/main/runtime/orca-runtime-schedule-mobile-session-tabs-changed.ts b/src/main/runtime/orca-runtime-schedule-mobile-session-tabs-changed.ts index 7ad872c2a65..f3cf8ba2fb2 100644 --- a/src/main/runtime/orca-runtime-schedule-mobile-session-tabs-changed.ts +++ b/src/main/runtime/orca-runtime-schedule-mobile-session-tabs-changed.ts @@ -34,6 +34,8 @@ export class OrcaRuntimeWithScheduleMobileSessionTabsChanged extends OrcaRuntime } protected notifyMobileSessionTabsChangedNow(worktreeId: string, changeSequence: number): void { + const diagnosticSnapshot = this.mobileSessionTabsByWorktree.get(worktreeId) + console.info('[paired-host-tab-delivery] ' + JSON.stringify({ phase: 'notify', worktreeId, changeSequence, listeners: this.mobileSessionTabListeners.size, epoch: diagnosticSnapshot?.publicationEpoch, version: diagnosticSnapshot?.snapshotVersion, tabs: diagnosticSnapshot?.tabs.map(tab => tab.id) })) if (this.mobileSessionTabListeners.size === 0) { return } diff --git a/src/main/runtime/rpc/methods/session-tabs-inventory.ts b/src/main/runtime/rpc/methods/session-tabs-inventory.ts index 5ab29ae51b5..4c928fd4588 100644 --- a/src/main/runtime/rpc/methods/session-tabs-inventory.ts +++ b/src/main/runtime/rpc/methods/session-tabs-inventory.ts @@ -211,6 +211,7 @@ export async function subscribeSessionTabsInventory( } const unsubscribe = runtime.onMobileSessionTabsChanged((runtimeSnapshot, changeSequence) => { const snapshot = runtimeSnapshot as SessionTabsChange + console.info('[paired-host-tab-delivery] ' + JSON.stringify({ phase: 'listener', subscriptionId, initialized, closed, changeSequence, censusChangeSequence, delivered: deliveredChangeSequenceByWorktree.get(snapshot.worktree), epoch: snapshot.publicationEpoch, version: snapshot.snapshotVersion, tabs: snapshot.tabs.map(tab => tab.id) })) if (!initialized) { bufferChange(snapshot, changeSequence) return @@ -226,6 +227,7 @@ export async function subscribeSessionTabsInventory( runtime.registerSubscriptionCleanup( subscriptionId, () => { + console.info('[paired-host-tab-delivery] ' + JSON.stringify({ phase: 'cleanup', subscriptionId, initialized })) closed = true inventoryController.abort() unsubscribe() @@ -273,6 +275,7 @@ export async function subscribeSessionTabsInventory( } const { inventory, changeSequence } = collected censusChangeSequence = changeSequence + console.info('[paired-host-tab-delivery] ' + JSON.stringify({ phase: 'census', subscriptionId, changeSequence })) emit({ type: 'snapshots', ...inventory }) for (const snapshot of inventory.snapshots) { publishedSnapshotsByWorktree.set(snapshot.worktree, withoutNavigationIntent(snapshot)) diff --git a/src/renderer/src/runtime/web-session-tabs-sync/global-session-subscription.ts b/src/renderer/src/runtime/web-session-tabs-sync/global-session-subscription.ts index f0483c0407f..8222a58ddfa 100644 --- a/src/renderer/src/runtime/web-session-tabs-sync/global-session-subscription.ts +++ b/src/renderer/src/runtime/web-session-tabs-sync/global-session-subscription.ts @@ -164,6 +164,10 @@ export function installGlobalSessionTabsSubscriptions({ }, { onResponse: (response) => { + const diagnostic = globalThis as typeof globalThis & { __pairedTabRawTrace?: unknown[] } + const trace = (diagnostic.__pairedTabRawTrace ??= []) + trace.push({ current: isCurrent(), revision: getRuntimeEnvironmentRevision(environmentId), expectedRevision: expectedEnvironmentPairingRevision, response }) + if (trace.length > 80) trace.shift() if ( !isCurrent() || getRuntimeEnvironmentRevision(environmentId) !== expectedEnvironmentPairingRevision diff --git a/tests/e2e/paired-remote-terminal-parked-reveal-interactivity.spec.ts b/tests/e2e/paired-remote-terminal-parked-reveal-interactivity.spec.ts index 427cc817dc4..ee38c9eb7cd 100644 --- a/tests/e2e/paired-remote-terminal-parked-reveal-interactivity.spec.ts +++ b/tests/e2e/paired-remote-terminal-parked-reveal-interactivity.spec.ts @@ -482,6 +482,8 @@ test('paired client keeps revealed remote terminals interactive', async ({ } finally { const frameTrace = await client.page.evaluate(() => (window as any).__pairedTabFrameTrace).catch(() => null) console.info(`[paired-tab-frame-trace] ${JSON.stringify(frameTrace)}`) + const rawTrace = await client.page.evaluate(() => (globalThis as typeof globalThis & { __pairedTabRawTrace?: unknown[] }).__pairedTabRawTrace ?? []) + console.info('[paired-tab-raw-trace] ' + JSON.stringify(rawTrace)) await testInfo.attach('paired-tab-frame-trace', { body: JSON.stringify(frameTrace), contentType: 'application/json' }) if (previousParkDelay === undefined) { delete process.env.ORCA_E2E_TERMINAL_PARKING_DELAY_MS