From cc1d2e251489236fb702ef4ddd17d53dc7692467 Mon Sep 17 00:00:00 2001 From: Brennan Benson <79079362+brennanb2025@users.noreply.github.com> Date: Tue, 10 Nov 2026 15:24:54 -0800 Subject: [PATCH 01/11] fix(chat): apply window material to Chat UI backgrounds (#40535) * fix(chat): apply window material to chat surfaces Use the existing backdrop path for chat canvases and split groups, keeping neighboring terminal backgrounds and readable chat surfaces intact. Co-authored-by: medox * test(chat): verify painted backdrop surfaces and isolate fixture state * Update backdrop imports after renderer module relocation --------- Co-authored-by: medox --- .../src/app-shell/use-document-appearance.ts | 6 ++ .../appearance/NativeChatBackdrop.fixture.tsx | 96 +++++++++++++++++++ .../appearance/native-chat-appearance.css | 35 +++---- ...StructuredAgentSessionPaneOverlayLayer.tsx | 8 +- .../components/tab-group/TabGroupPanel.tsx | 6 +- .../controller/TerminalPaneSurface.tsx | 6 +- .../mounting/TerminalPaneOverlayLayer.tsx | 8 +- .../native-chat-backdrop.spec.ts | 43 +++++++++ 8 files changed, 177 insertions(+), 31 deletions(-) create mode 100644 src/renderer/src/components/native-chat/appearance/NativeChatBackdrop.fixture.tsx create mode 100644 tests/component-fixtures/native-chat-backdrop.spec.ts diff --git a/src/renderer/src/app-shell/use-document-appearance.ts b/src/renderer/src/app-shell/use-document-appearance.ts index a8b0ff240cf..44ed5a220e7 100644 --- a/src/renderer/src/app-shell/use-document-appearance.ts +++ b/src/renderer/src/app-shell/use-document-appearance.ts @@ -99,6 +99,12 @@ export function useDocumentAppearance(): void { usePluginFontRegistration() const reduceEffects = useReduceVisualEffects(useAppStore((s) => s.settings?.reduceVisualEffects)) const surfaceOpacity = useAppStore((s) => s.settings?.terminalBackgroundOpacity ?? 1) + useEffect(() => { + document.documentElement.style.setProperty( + '--orca-window-surface-opacity', + String(surfaceOpacity) + ) + }, [surfaceOpacity]) // Why re-parse: the theme list keeps the registration as received, and a newer host may send // a background this build cannot paint; it must drop to no image, never reach CSS. const registeredBackground = pluginTheme?.background diff --git a/src/renderer/src/components/native-chat/appearance/NativeChatBackdrop.fixture.tsx b/src/renderer/src/components/native-chat/appearance/NativeChatBackdrop.fixture.tsx new file mode 100644 index 00000000000..7f56629b408 --- /dev/null +++ b/src/renderer/src/components/native-chat/appearance/NativeChatBackdrop.fixture.tsx @@ -0,0 +1,96 @@ +import { useEffect, useState } from 'react' +import { createPortal } from 'react-dom' +import { Terminal } from '@xterm/xterm' +import { defineFixture } from '../../../component-fixtures/component-fixture' +import { NativeChatPaneCover } from '../../terminal-pane/chat/NativeChatPaneCover' +import { + NATIVE_CHAT_APPEARANCE_ROOT_CLASS, + nativeChatAppearanceStyle +} from './native-chat-appearance-style' + +function ChatCanvas({ sample }: { sample: string }): React.JSX.Element { + return ( +
+
+
+ ) +} + +function TerminalPane({ + covered, + sample +}: { + covered: boolean + sample: string +}): React.JSX.Element { + const [container, setContainer] = useState(null) + const [terminal] = useState(() => new Terminal()) + useEffect(() => () => terminal.dispose(), [terminal]) + return ( +
+
+
+
+ {!covered &&
} + {covered && container + ? createPortal( + + + , + container + ) + : null} +
+ ) +} + +function Backdrops(): React.JSX.Element { + const [covered, setCovered] = useState(false) + useEffect(() => { + const root = document.documentElement + const previousMaterial = root.getAttribute('data-window-material') + const previousOpacity = root.style.getPropertyValue('--orca-window-surface-opacity') + root.dataset.windowMaterial = 'blur' + root.style.setProperty('--orca-window-surface-opacity', '0.3') + return () => { + if (previousMaterial === null) { + root.removeAttribute('data-window-material') + } else { + root.setAttribute('data-window-material', previousMaterial) + } + root.style.setProperty('--orca-window-surface-opacity', previousOpacity) + } + }, []) + const terminalBackground = 'color-mix(in srgb, var(--background) 30%, transparent)' + return ( + <> + +
+
+
+ +
+
+ + +
+
+ +
+
+ + ) +} + +export const material = defineFixture({ + width: 800, + render: () => +}) diff --git a/src/renderer/src/components/native-chat/appearance/native-chat-appearance.css b/src/renderer/src/components/native-chat/appearance/native-chat-appearance.css index ba550b8559c..28e22d1d2de 100644 --- a/src/renderer/src/components/native-chat/appearance/native-chat-appearance.css +++ b/src/renderer/src/components/native-chat/appearance/native-chat-appearance.css @@ -39,35 +39,31 @@ initial-value: 0px; } -/* Over a theme image (main.css) a chat that fills its pane paints the canvas once and the layers - under it go clear. The canvas follows Background Opacity, floored at 0.8 so body text stays near - 4.5:1 even over white or black pixels. A chat split beside terminals stays opaque, since the pane - manager paints the terminal color under every pane of the split. */ -:root[data-theme-background] [data-terminal-chat-view]:not(.has-multiple-panes) { +/* Chat keeps a readable canvas over either backdrop. Mixed splits retain their shared terminal + paint beneath it so neighboring terminals keep their background. */ +:root:is([data-theme-background], [data-window-material]) + [data-terminal-chat-pane]:not(.has-multiple-panes) { /* Beats the pane manager's inline split paint (pane-divider.ts applyRootBackground). */ background: transparent !important; } -:root[data-theme-background] - [data-terminal-chat-view]:not(.has-multiple-panes) +:root:is([data-theme-background], [data-window-material]) + [data-terminal-chat-pane] .native-chat-pane-shell { background-color: transparent; } /* The opaque cover used to hide the terminal and its banners (layers below its z-10); overlays above it stay. Opacity, not visibility, so the covered terminal can still take focus handoffs. */ -:root[data-theme-background] - [data-terminal-chat-view]:not(.has-multiple-panes) - .pane +:root:is([data-theme-background], [data-window-material]) + [data-terminal-chat-pane] + .pane:has(> .native-chat-pane-shell) > :is(.xterm-container, .session-restored-banner, .pane-top-banner) { opacity: 0; } -:root[data-theme-background] - :is( - [data-terminal-chat-view]:not(.has-multiple-panes), - [data-structured-agent-session-overlay-tab-id] - ) +:root:is([data-theme-background], [data-window-material]) + :is([data-terminal-chat-pane], [data-structured-agent-session-overlay-tab-id]) [data-native-chat-root] { --chat-pane: transparent; /* Text-bearing surfaces keep an opaque base, as in the light scheme. */ @@ -90,7 +86,14 @@ ); background-color: color-mix( in srgb, - var(--chat-canvas) calc(max(var(--orca-theme-background-surface-opacity), 0.8) * 100%), + var(--chat-canvas) + calc( + max( + var(--orca-theme-background-surface-opacity, var(--orca-window-surface-opacity, 1)), + 0.8 + ) * + 100% + ), transparent ); } diff --git a/src/renderer/src/components/native-chat/pane/routing/StructuredAgentSessionPaneOverlayLayer.tsx b/src/renderer/src/components/native-chat/pane/routing/StructuredAgentSessionPaneOverlayLayer.tsx index 45369165f09..8072d12b811 100644 --- a/src/renderer/src/components/native-chat/pane/routing/StructuredAgentSessionPaneOverlayLayer.tsx +++ b/src/renderer/src/components/native-chat/pane/routing/StructuredAgentSessionPaneOverlayLayer.tsx @@ -2,7 +2,7 @@ import { memo, useCallback, useMemo } from 'react' import { useShallow } from 'zustand/react/shallow' import type { Tab, TabGroup } from '../../../../../../shared/tab-types' import { useAppStore } from '@/store' -import { useThemeBackgroundStore } from '@/store/appearance/theme-background' +import { useWindowBackdropActive } from '@/app-shell/appearance/window-backdrop' import { structuredAgentSessionOwnerForTab, structuredAgentSessionTargetForHost @@ -37,7 +37,7 @@ const StructuredAgentSessionOverlaySlot = memo(function StructuredAgentSessionOv // Resolve from the tab’s recorded host because workspace ids can collide across hosts. const owner = useAppStore((state) => structuredAgentSessionOwnerForTab(state, tab)) const target = useMemo(() => structuredAgentSessionTargetForHost(owner), [owner]) - const themeBackgroundActive = useThemeBackgroundStore((state) => state.active) + const backdropActive = useWindowBackdropActive() if (!target) { return null } @@ -45,8 +45,8 @@ const StructuredAgentSessionOverlaySlot = memo(function StructuredAgentSessionOv diff --git a/src/renderer/src/components/tab-group/TabGroupPanel.tsx b/src/renderer/src/components/tab-group/TabGroupPanel.tsx index 0e42786c307..98e7d402b01 100644 --- a/src/renderer/src/components/tab-group/TabGroupPanel.tsx +++ b/src/renderer/src/components/tab-group/TabGroupPanel.tsx @@ -23,7 +23,6 @@ import { useEditorGroupFileDropOwner } from '../editor/use-editor-group-file-dro import { cn } from '@/lib/class-names' import { UNFOCUSED_SPLIT_GROUP_OPACITY } from './split-group-dim' import { useWindowBackdropActive } from '@/app-shell/appearance/window-backdrop' -import { useThemeBackgroundStore } from '@/store/appearance/theme-background' import { EditorRevealFlash } from './EditorRevealFlash' import { SplitPaneLanding } from './SplitPaneLanding' import { isSplitLandingGroup } from '@/store/slices/tabs/split-landing-groups' @@ -127,7 +126,6 @@ export default function TabGroupPanel({ ) const attachEditorFileDropOwner = useEditorGroupFileDropOwner({ worktreeId, groupId }) const backdropActive = useWindowBackdropActive() - const themeBackgroundActive = useThemeBackgroundStore((state) => state.active) // Why: per-group anchor-name lets the worktree-level overlay position panes via CSS anchor positioning, so moving a tab between groups re-targets the anchor instead of remounting xterm (loses alt-screen TUI state) or reloading ``. const bodyAnchorName = tabGroupBodyAnchorName(groupId) // Why: memoize so a fresh style object each render doesn't break downstream memoization keyed on referential equality. @@ -337,10 +335,10 @@ export default function TabGroupPanel({
{ - openTerminalBesideTab(tabId) - }} + onOpenNewTerminal={() => void openTerminalBesideTab(tabId)} onClosePane={() => handleRequestClosePane(activePane.id)} />, activePane.container, diff --git a/src/renderer/src/components/terminal-pane/mounting/TerminalPaneOverlayLayer.tsx b/src/renderer/src/components/terminal-pane/mounting/TerminalPaneOverlayLayer.tsx index 3a551672315..39b58931847 100644 --- a/src/renderer/src/components/terminal-pane/mounting/TerminalPaneOverlayLayer.tsx +++ b/src/renderer/src/components/terminal-pane/mounting/TerminalPaneOverlayLayer.tsx @@ -3,7 +3,7 @@ import { useShallow } from 'zustand/react/shallow' import type { Tab, TabGroup } from '../../../../../shared/tab-types' import type { TerminalTab } from '../../../../../shared/workspace-layout/terminal-tab-types' import { useAppStore } from '../../../store/index' -import { useThemeBackgroundStore } from '@/store/appearance/theme-background' +import { useWindowBackdropActive } from '@/app-shell/appearance/window-backdrop' import { findActivityTerminalPortal, type ActivityTerminalPortalTarget @@ -76,7 +76,7 @@ const TerminalPaneOverlayLayer = memo(function TerminalPaneOverlayLayer({ [worktreeId] ) - const themeBackgroundActive = useThemeBackgroundStore((state) => state.active) + const backdropActive = useWindowBackdropActive() const focusOwningGroup = useCallback( (groupId: string) => focusGroup(worktreeId, groupId), [focusGroup, worktreeId] @@ -173,8 +173,8 @@ const TerminalPaneOverlayLayer = memo(function TerminalPaneOverlayLayer({ isVisible={isVisible} isActive={isActive} hiddenPrewarm={assignment?.isActiveInGroup === true ? hiddenTerminalPrewarm : null} - // Why not over a theme image: a chat there is translucent, so a dim would bleed the image in. - dimmed={groups.length > 1 && isVisible && !isActive && !themeBackgroundActive} + // Why not over a backdrop: group dimming also fades terminal and chat text. + dimmed={groups.length > 1 && isVisible && !isActive && !backdropActive} activityTerminalPortal={activityTerminalPortal} onFocusOwningGroup={focusOwningGroup} consumeSuppressedPtyExit={consumeSuppressedPtyExit} diff --git a/tests/component-fixtures/native-chat-backdrop.spec.ts b/tests/component-fixtures/native-chat-backdrop.spec.ts new file mode 100644 index 00000000000..b7f60f98a1c --- /dev/null +++ b/tests/component-fixtures/native-chat-backdrop.spec.ts @@ -0,0 +1,43 @@ +import { expect, test, type Page } from '@playwright/test' + +async function pixels(page: Page, sample: string): Promise { + return page.locator(`[data-paint-sample="${sample}"]`).screenshot() +} + +test('material reaches chat without changing the neighboring terminal or exposing covered content', async ({ + page +}) => { + await page.goto('/fixtures.html?id=native-chat/appearance/NativeChatBackdrop:material&theme=dark') + await expect(page.locator('html')).toHaveAttribute('data-fixture-state', 'ready') + const backdrop = page.locator('[data-test-backdrop]') + await backdrop.evaluate((element) => (element.style.background = 'white')) + const neighbor = await pixels(page, 'neighbor') + await page.getByRole('button', { name: 'Toggle split chat' }).click() + expect(await pixels(page, 'neighbor')).toEqual(neighbor) + + const samples = ['single', 'split', 'structured'] + const lightBare = await pixels(page, 'bare') + const light = await Promise.all(samples.map((sample) => pixels(page, sample))) + for (const painted of light) { + expect(painted.equals(lightBare)).toBe(false) + } + await backdrop.evaluate((element) => (element.style.background = 'black')) + const darkBare = await pixels(page, 'bare') + for (const [index, sample] of samples.entries()) { + const painted = await pixels(page, sample) + expect(painted.equals(light[index])).toBe(false) + expect(painted.equals(darkBare)).toBe(false) + } + + const covered = await pixels(page, 'split') + const neighborDark = await pixels(page, 'neighbor') + await page.locator('[data-terminal-ink]').evaluateAll((elements) => { + for (const element of elements) { + if (element instanceof HTMLElement) { + element.style.background = 'red' + } + } + }) + expect(await pixels(page, 'split')).toEqual(covered) + expect((await pixels(page, 'neighbor')).equals(neighborDark)).toBe(false) +}) From a775acc7809557c59472addcfdfb2e88d8437098 Mon Sep 17 00:00:00 2001 From: Brennan Benson <79079362+brennanb2025@users.noreply.github.com> Date: Tue, 10 Nov 2026 15:25:16 -0800 Subject: [PATCH 02/11] Keep loading Git Graph commits until a tall pane can scroll (#40884) * fix(git-graph): keep loading commits while the end of history is in view Git Graph only asked for the next page from a scroll event, so a pane taller than the first 50 commits (or one enlarged later) had no scrollbar and never loaded older history. The next page is now requested whenever the end of the loaded rows is within the visible range, once per loaded result; a failed page waits for Load more or Refresh, and a page that adds no commits keeps the previous result so it cannot repeat. Tracked in STA-14490. * fix(git-graph): keep viewport paging's once-per-result latch across remounts without retaining old history * fix(git-graph): page only the result whose rows were measured in view * test(git-graph): replaced history is released while the pane stays mounted --- .../git-graph/git-graph-history-controller.ts | 13 +- .../git-graph/git-graph-rendering.test.tsx | 130 +++++++++++++++++- .../editor/git-graph/git-graph-tab.tsx | 26 ++-- .../git-graph/git-graph-viewport-paging.ts | 18 +++ 4 files changed, 170 insertions(+), 17 deletions(-) create mode 100644 src/renderer/src/components/editor/git-graph/git-graph-viewport-paging.ts diff --git a/src/renderer/src/components/editor/git-graph/git-graph-history-controller.ts b/src/renderer/src/components/editor/git-graph/git-graph-history-controller.ts index cd5a139ea05..359bdde7739 100644 --- a/src/renderer/src/components/editor/git-graph/git-graph-history-controller.ts +++ b/src/renderer/src/components/editor/git-graph/git-graph-history-controller.ts @@ -268,15 +268,18 @@ export class GitGraphHistoryController { if (!current()) { return undefined } - const result = error !== undefined ? previous : (accumulated ?? previous) - const selection = this.view.getState().selectedId - const selectedId = - result?.items.find((item) => item.id === selection)?.id ?? result?.items[0]?.id - const selectionGone = selection !== undefined && selection !== selectedId + // A page that added nothing keeps the result identity, so viewport paging can't repeat it. + const stalled = + append && !recovered && accumulated?.hasMore && items.length === previous?.items.length + const result = error !== undefined || stalled ? previous : (accumulated ?? previous) + const selected = this.view.getState().selectedId + const selectedId = result?.items.find(({ id }) => id === selected)?.id ?? result?.items[0]?.id + const selectionGone = selected !== undefined && selected !== selectedId if (selectionGone) { this.actions.cancel() this.scrollOffset = 0 } + this.pending = undefined this.view.setState({ result, error, diff --git a/src/renderer/src/components/editor/git-graph/git-graph-rendering.test.tsx b/src/renderer/src/components/editor/git-graph/git-graph-rendering.test.tsx index 61a4f918161..e4340803411 100644 --- a/src/renderer/src/components/editor/git-graph/git-graph-rendering.test.tsx +++ b/src/renderer/src/components/editor/git-graph/git-graph-rendering.test.tsx @@ -13,7 +13,11 @@ import * as commitSupport from '@/runtime/source-control/git/git-commit-actions- import { useGitGraphHistory } from './use-git-graph-history' import type { GitHistoryResult } from '../../../../../shared/git/history/git-history-types' -const { getHistory, getRefs } = vi.hoisted(() => ({ getHistory: vi.fn(), getRefs: vi.fn() })) +const { getHistory, getRefs, viewport } = vi.hoisted(() => ({ + getHistory: vi.fn(), + getRefs: vi.fn(), + viewport: { rows: 20, rendered: Infinity } +})) vi.mock('@/runtime/source-control/git/runtime-git-status-client', async (original) => ({ ...(await original()), getRuntimeGitHistory: getHistory, @@ -27,7 +31,15 @@ vi.mock('@tanstack/react-virtual', () => ({ useVirtualizer: (options: { count: number; getScrollElement: () => HTMLElement | null }) => ({ getTotalSize: () => options.count * 28, getVirtualItems: () => - Array.from({ length: options.count }, (_, index) => ({ index, start: index * 28 })), + Array.from({ length: Math.min(options.count, viewport.rendered) }, (_, index) => ({ + index, + start: index * 28 + })), + get range() { + return options.count + ? { startIndex: 0, endIndex: Math.min(options.count, viewport.rows) - 1 } + : null + }, measureElement: () => {}, scrollToIndex: (index: number) => { const element = options.getScrollElement() @@ -53,6 +65,8 @@ beforeEach(() => { afterEach(async () => { await act(async () => root.unmount()) root = createRoot(container) + viewport.rows = 20 + viewport.rendered = Infinity disposeGitGraphHistory(`${workspaceId}::git-graph`) useAppStore.setState(initialState, true) vi.restoreAllMocks() @@ -520,3 +534,115 @@ it('keeps the confirm strip across tab switches, discarding it on navigation, fi await act(async () => root.render(render())) expect(container.textContent).not.toContain('Revert a?') }) +const longHistory = Array.from({ length: 200 }, (_, index) => ({ + id: `commit-${index}`, + subject: `Commit ${index}`, + message: `Commit ${index}`, + parentIds: [] +})) +const longPage = (skip: number): GitHistoryResult => ({ + ...result, + refs: 'all', + historyToken: 'long', + items: longHistory.slice(skip, skip + 50), + hasMore: skip + 50 < longHistory.length +}) +const renderTab = () => + act(async () => + root.render( + + + + ) + ) +const loadedCount = () => gitGraphHistoryForTab(workspaceId).view.getState().result?.items.length + +it('pages a pane taller than the loaded commits until they overflow it, and again when it grows', async () => { + viewport.rows = 120 + getHistory.mockReset().mockImplementation(async (_owner, options) => longPage(options.skip)) + await renderTab() + expect(loadedCount()).toBe(150) + viewport.rows = 400 + await renderTab() + expect(loadedCount()).toBe(200) + expect(container.textContent).not.toContain('Load more') +}) + +it('leaves a failed page to Load more, even after switching tabs away and back', async () => { + viewport.rows = Infinity + getHistory + .mockReset() + .mockResolvedValueOnce(longPage(0)) + .mockRejectedValueOnce(new Error('network down')) + .mockImplementation(async (_owner, options) => longPage(options.skip)) + await renderTab() + await act(async () => root.render(
Another tab
)) + await renderTab() + expect(loadedCount()).toBe(50) + expect(container.textContent).toContain('network down') + await act(async () => { + Array.from(container.querySelectorAll('button')) + .find((button) => button.textContent === 'Load more')! + .click() + }) + expect(loadedCount()).toBe(200) +}) + +it('stops paging on a page that adds no commits, and ends on an empty last page', async () => { + viewport.rows = Infinity + getHistory.mockReset().mockResolvedValue(longPage(0)) + await renderTab() + await renderTab() + expect(loadedCount()).toBe(50) + expect(getHistory).toHaveBeenCalledTimes(2) + getHistory.mockResolvedValue({ ...longPage(0), items: [], hasMore: false }) + await act(async () => { + await gitGraphHistoryForTab(workspaceId).loadMore() + }) + expect(container.textContent).not.toContain('Load more') +}) + +it.each([50_000, 500_000])( + 'releases %i commits of replaced history while the pane stays mounted', + async (count) => { + viewport.rows = Infinity + viewport.rendered = 40 + getHistory + .mockReset() + .mockImplementationOnce(async () => ({ + ...result, + refs: 'all', + hasMore: true, + items: Array.from({ length: count }, (_, index) => ({ + id: `old-${index}`, + subject: `Old ${index}`, + message: `Old ${index}`, + parentIds: [] + })) + })) + .mockRejectedValueOnce(new Error('network down')) + .mockResolvedValue({ ...result, refs: 'head' }) + await renderTab() + const replaced = (() => { + const loaded = gitGraphHistoryForTab(workspaceId).view.getState().result! + expect(loaded.items).toHaveLength(count) + return new WeakRef(loaded) + })() + await act(async () => + useAppStore.setState({ gitGraphFiltersByWorktree: { [workspaceId]: 'head' } }) + ) + await act(async () => { + await gitGraphHistoryForTab(workspaceId).settledResult() + }) + expect(loadedCount()).toBe(1) + getHistory.mockReset() + if (typeof globalThis.gc !== 'function') { + throw new Error('Run with the repository Vitest --expose-gc config') + } + for (let round = 0; round < 3; round++) { + await new Promise((resolve) => setImmediate(resolve)) + globalThis.gc() + } + expect(replaced.deref()).toBeUndefined() + } +) diff --git a/src/renderer/src/components/editor/git-graph/git-graph-tab.tsx b/src/renderer/src/components/editor/git-graph/git-graph-tab.tsx index 4e581dd97fc..359c7035182 100644 --- a/src/renderer/src/components/editor/git-graph/git-graph-tab.tsx +++ b/src/renderer/src/components/editor/git-graph/git-graph-tab.tsx @@ -3,7 +3,7 @@ import { GitGraphCommitActionControls, GitGraphCommitConfirmStrip } from './git-graph-commit-action-controls' -import { useCallback, useLayoutEffect, useMemo, useRef, useState } from 'react' +import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react' import { useSidebarResize } from '@/hooks/useSidebarResize' import { useVirtualizer } from '@tanstack/react-virtual' import { RefreshCw } from 'lucide-react' @@ -20,18 +20,21 @@ import { } from '../../../../../shared/git/history/git-history-graph' import { useGitGraphHistory, gitGraphFilterSupported } from './use-git-graph-history' import { GitGraphFilter } from './git-graph-filter' +import { loadMoreInView } from './git-graph-viewport-paging' import { GitGraphDetails } from './git-graph-details' import { GitGraphRefs, useGitGraphWorkspaces } from './git-graph-ref-menu' import { cn } from '@/lib/class-names' import { useIntlLocale, useTranslate } from '@/i18n/use-translate' const sameGroup = () => undefined +// About 200px of rows, so scrolling fetches before the end shows. +const PAGE_AHEAD_ROWS = 8 export function GitGraphTab({ worktreeId }: { worktreeId: string }) { const t = useTranslate() const intlLocale = useIntlLocale() const history = useGitGraphHistory(worktreeId) - const { result, scope, selectedId, revealId, controller } = history + const { result, scope, selectedId, revealId, controller, loading } = history const commitActionSupport = useGitCommitActionsSupport( scope?.target ?? null, scope?.route.executionHostId ?? undefined @@ -88,6 +91,16 @@ export function GitGraphTab({ worktreeId }: { worktreeId: string }) { overscan: 12, getItemKey: (index) => rows[index]!.historyItem.id }) + const virtualItems = virtualizer.getVirtualItems() + // Null while the pane has no height; read after getVirtualItems() recomputes it. + const lastVisibleIndex = virtualizer.range?.endIndex ?? -1 + const endInView = lastVisibleIndex >= 0 && lastVisibleIndex >= rows.length - 1 - PAGE_AHEAD_ROWS + useEffect(() => { + // Viewport demand, not scroll events: page whenever the end of loaded rows is in view. + if (endInView) { + loadMoreInView(controller, result) + } + }, [endInView, result, loading, controller]) const selected = result?.items.find((item) => item.id === selectedId) useLayoutEffect(() => { if (scroll.current) { @@ -189,20 +202,13 @@ export function GitGraphTab({ worktreeId }: { worktreeId: string }) { if (element) { controller.scrollOffset = element.scrollTop } - if ( - element && - element.scrollHeight - element.scrollTop - element.clientHeight < 200 && - !history.loading - ) { - void history.loadMore() - } }} >
- {virtualizer.getVirtualItems().map((virtualRow) => { + {virtualItems.map((virtualRow) => { const viewModel = rows[virtualRow.index]! const item = viewModel.historyItem return ( diff --git a/src/renderer/src/components/editor/git-graph/git-graph-viewport-paging.ts b/src/renderer/src/components/editor/git-graph/git-graph-viewport-paging.ts new file mode 100644 index 00000000000..1b1145571a7 --- /dev/null +++ b/src/renderer/src/components/editor/git-graph/git-graph-viewport-paging.ts @@ -0,0 +1,18 @@ +import type { GitGraphHistoryController } from './git-graph-history-controller' +import type { GitHistoryResult } from '../../../../../shared/git/history/git-history-types' + +// Keyed by result so it outlives tab remounts without keeping replaced history alive. +const pagedInView = new WeakSet() + +/** Asks for the next page once per result; a failed or no-progress page keeps its result, so only Load more or Refresh retries it. */ +export function loadMoreInView( + controller: GitGraphHistoryController, + rendered: GitHistoryResult | undefined +): void { + const { result, loading } = controller.view.getState() + // Only page the result whose rows were measured in view; a newer one gets its own check. + if (result && result === rendered && result.hasMore && !loading && !pagedInView.has(result)) { + pagedInView.add(result) + void controller.loadMore() + } +} From 8d45e467437a672d0814c56ce02023d2178c7c48 Mon Sep 17 00:00:00 2001 From: Brennan Benson <79079362+brennanb2025@users.noreply.github.com> Date: Tue, 10 Nov 2026 15:26:00 -0800 Subject: [PATCH 03/11] fix(claude): preserve each account's runtime state during refresh (#40558) * fix(claude): preserve profile-owned state during configuration refresh * test(claude): bound profile state publications at workspace scale * fix(claude): honor profile API approval before shared rejection --- .../claude-profile-provisioning.test.ts | 101 ++++++++-- .../claude-profile-provisioning.ts | 92 +--------- .../claude-accounts/claude-profile-state.ts | 172 ++++++++++++++++++ .../claude/claude-rejected-api-key.test.ts | 40 ++++ src/main/claude/claude-rejected-api-key.ts | 25 ++- 5 files changed, 319 insertions(+), 111 deletions(-) create mode 100644 src/main/claude-accounts/claude-profile-state.ts create mode 100644 src/main/claude/claude-rejected-api-key.test.ts diff --git a/src/main/claude-accounts/claude-profile-provisioning.test.ts b/src/main/claude-accounts/claude-profile-provisioning.test.ts index 58b70c7aa23..98684a185df 100644 --- a/src/main/claude-accounts/claude-profile-provisioning.test.ts +++ b/src/main/claude-accounts/claude-profile-provisioning.test.ts @@ -131,18 +131,37 @@ describe('Claude profile refresh from the default home', () => { expect((await provision(f)).surfaces['settings.json']).toBe('user-owned') expect(f.read(elsewhere)).toEqual({ mine: true }) }) - it('copies state except the login, caches and install ids, and never copies credentials', async () => { + it('shares configuration while keeping profile runtime state and API authorizations private', async () => { const f = fixture() fs.writeFileSync(join(f.source, '.credentials.json'), 'SOURCE_CREDENTIAL_BYTES') const shared = { mcpServers: { local: { command: 'example' } }, theme: 'dark', hasCompletedOnboarding: true, - autoModeAccepted: true, + bypassPermissionsModeAccepted: true, + favoritePlugins: ['favorite@example'], + preferTmuxOverIterm2: true, + codeReviewLastEffort: 'high', + codeReviewLastMaxFindings: 3, + installMethod: 'global', + autoUpdates: false, + autoUpdatesProtectedForNative: false, + customApiKeyResponses: { rejected: ['PERSONAL_REJECTED_SUFFIX'] }, projects: { '/work': { hasTrustDialogAccepted: true } } } - f.json(join(f.userHome, '.claude.json'), { + const personal = { ...shared, + customApiKeyResponses: { + approved: ['PERSONAL_APPROVED_SUFFIX'], + rejected: ['PERSONAL_REJECTED_SUFFIX'] + }, + groveChoiceSeenAt: { personal: 1 }, + numStartups: 2, + tipsHistory: { tip: 1 }, + seenNotifications: { notice: 1 }, + penguinModeOrgEnabled: false, + futureRuntimeState: { personal: true }, + autoModeAccepted: true, oauthAccount: { emailAddress: 'source@example.com' }, primaryApiKey: 'sk-source', userID: 'source-id', @@ -150,7 +169,6 @@ describe('Claude profile refresh from the default home', () => { firstStartTime: 'source-start', firstStartVersion: '1.0.0', groveConfigCache: { a: 1 }, - groveChoiceSeenAt: { 'account-a': 99, 'account-b': 10 }, cachedArtifactRoster: [], clientDataCacheSlots: {}, passesEligibilityCache: {}, @@ -162,21 +180,32 @@ describe('Claude profile refresh from the default home', () => { lastSeenOrgDefaultUpdatedAt: 1, hasAvailableSubscription: true, subscriptionNoticeCount: 2 - }) + } + f.json(join(f.userHome, '.claude.json'), personal) expect((await provision(f)).surfaces['.claude.json']).toBe('synced') - expect(f.read(join(f.profileHome, '.claude.json'))).toEqual({ - ...shared, - groveChoiceSeenAt: { 'account-a': 99, 'account-b': 10 } - }) + expect(f.read(join(f.profileHome, '.claude.json'))).toEqual(shared) expect(fs.readdirSync(f.profileHome).filter((name) => name.endsWith('.tmp'))).toEqual([]) expect(fs.existsSync(join(f.profileHome, '.credentials.json'))).toBe(false) fs.writeFileSync(join(f.profileHome, '.credentials.json'), 'PROFILE_CREDENTIAL_BYTES') + const profileRuntime = { + groveChoiceSeenAt: { profile: 20 }, + numStartups: 30, + tipsHistory: { tip: 8 }, + seenNotifications: { profileNotice: 9 }, + penguinModeOrgEnabled: true, + futureRuntimeState: { profile: true }, + customApiKeyResponses: { + approved: ['PROFILE_APPROVED_SUFFIX', 'PERSONAL_REJECTED_SUFFIX'], + rejected: ['PROFILE_REJECTED_SUFFIX', 'PERSONAL_APPROVED_SUFFIX'], + profileOnly: true + } + } f.json(join(f.profileHome, '.claude.json'), { + ...profileRuntime, oauthAccount: { emailAddress: 'profile@example.com' }, userID: 'profile-id', groveConfigCache: { b: 2 }, - groveChoiceSeenAt: { 'account-a': 120, 'account-b': 5 }, theme: 'light', onlyHere: true }) @@ -185,11 +214,30 @@ describe('Claude profile refresh from the default home', () => { oauthAccount: { emailAddress: 'profile@example.com' }, userID: 'profile-id', groveConfigCache: { b: 2 }, - groveChoiceSeenAt: { 'account-a': 120, 'account-b': 10 }, onlyHere: true, - ...shared + ...shared, + ...profileRuntime, + hasCompletedOnboarding: true, + customApiKeyResponses: { + approved: ['PROFILE_APPROVED_SUFFIX', 'PERSONAL_REJECTED_SUFFIX'], + rejected: [ + 'PROFILE_REJECTED_SUFFIX', + 'PERSONAL_APPROVED_SUFFIX', + 'PERSONAL_REJECTED_SUFFIX' + ], + profileOnly: true + } + }) + const reset = { ...f.read(join(f.profileHome, '.claude.json')), hasCompletedOnboarding: false } + f.json(join(f.profileHome, '.claude.json'), reset) + f.json(join(f.userHome, '.claude.json'), { + ...personal, + numStartups: 1000, + groveChoiceSeenAt: { personal: 1000 }, + futureRuntimeState: { changed: true } }) expect((await provision(f)).surfaces['.claude.json']).toBe('unchanged') + expect(f.read(join(f.profileHome, '.claude.json'))).toEqual(reset) expect(fs.readFileSync(join(f.source, '.credentials.json'), 'utf8')).toBe( 'SOURCE_CREDENTIAL_BYTES' ) @@ -202,7 +250,13 @@ describe('Claude profile refresh from the default home', () => { const f = fixture() f.json(join(f.userHome, '.claude.json'), { projects: { - '/shared': { hasTrustDialogAccepted: false, allowedTools: ['Read'] }, + '/shared': { + hasTrustDialogAccepted: false, + allowedTools: ['Read'], + lastSessionId: 'personal' + }, + '/runtime-only': { lastSessionId: 'personal' }, + '/malformed': 'invalid', '/default-only': { hasTrustDialogAccepted: true } }, mcpServers: { shared: { command: 'default' } } @@ -210,7 +264,15 @@ describe('Claude profile refresh from the default home', () => { f.json(join(f.profileHome, '.claude.json'), { oauthAccount: LOGIN, projects: { - '/shared': { hasTrustDialogAccepted: true }, + '/shared': { + hasTrustDialogAccepted: true, + hasCompletedProjectOnboarding: true, + projectOnboardingSeenCount: 4, + lastSessionId: 'profile', + exampleFiles: ['profile.ts'], + futureProjectState: true + }, + '/malformed': { lastSessionId: 'keep' }, '/account-only': { hasTrustDialogAccepted: true, allowedTools: ['Bash'] } }, mcpServers: { shared: { command: 'account' }, mine: { command: 'mine' } } @@ -219,7 +281,16 @@ describe('Claude profile refresh from the default home', () => { expect(f.read(join(f.profileHome, '.claude.json'))).toEqual({ oauthAccount: LOGIN, projects: { - '/shared': { hasTrustDialogAccepted: true, allowedTools: ['Read'] }, + '/shared': { + hasTrustDialogAccepted: true, + allowedTools: ['Read'], + hasCompletedProjectOnboarding: true, + projectOnboardingSeenCount: 4, + lastSessionId: 'profile', + exampleFiles: ['profile.ts'], + futureProjectState: true + }, + '/malformed': { lastSessionId: 'keep' }, '/account-only': { hasTrustDialogAccepted: true, allowedTools: ['Bash'] }, '/default-only': { hasTrustDialogAccepted: true } }, diff --git a/src/main/claude-accounts/claude-profile-provisioning.ts b/src/main/claude-accounts/claude-profile-provisioning.ts index ffd28dbb913..42bcdd1a8e5 100644 --- a/src/main/claude-accounts/claude-profile-provisioning.ts +++ b/src/main/claude-accounts/claude-profile-provisioning.ts @@ -19,6 +19,7 @@ import { type ClaudeProfileSurfaceOutcome } from './claude-profile-report' import { syncClaudeProfileSettings } from './claude-profile-settings' +import { mergeClaudeProfileState, selectSharedClaudeProfileState } from './claude-profile-state' import { copyClaudeProfileFile, linkClaudeProfileDirectory } from './claude-profile-sharing' const CLAUDE_PROFILE_MEMORY_IMPORT = '@~/.claude/CLAUDE.md\n' @@ -108,88 +109,6 @@ function isSharedEntry(name: string): boolean { ) } -// Claude 2.1.295 logout keys and subscription notices; onboarding remains shareable. -const CLAUDE_LOGOUT_STATE_KEYS = [ - 'oauthAccount', - 'additionalModelOptionsCache', - 'additionalModelOptionsAnsweredAt', - 'additionalModelCostsCache', - 'modelAccessCache', - 'orgModelDefaultCache', - 'cachedArtifactRoster', - 'artifactRosterDenied', - 'lastSeenOrgDefaultUpdatedAt', - 'clientDataCache', - 'clientDataCacheSlots', - 'autoCompactWindowsCache', - 'cachedUsageUtilization', - 'metricsStatusCache', - 'metricsStatusCacheByPrincipal', - 'githubWebConnectionStatusCache', - 'startupPrefetchedAt', - 'subscriptionNoticeCount', - 'hasAvailableSubscription' -] as const - -const ACCOUNT_BOUND_STATE_KEYS: ReadonlySet = new Set([ - ...CLAUDE_LOGOUT_STATE_KEYS, - 'userID', - 'machineID', - 'firstStartTime', - 'firstStartVersion', - // A copied Console key would override the account's own login. - 'primaryApiKey', - // Claude never refetches this account-specific date. - 'claudeCodeFirstTokenDate' -]) - -function isAccountBoundState(key: string): boolean { - // Logout leaves additional account caches such as groveConfigCache and passes*. - return ( - ACCOUNT_BOUND_STATE_KEYS.has(key) || - key.includes('Cache') || - key.startsWith('cached') || - key.startsWith('passes') - ) -} - -// Merge per entry so a profile keeps its own projects, servers, and Grove confirmations. -const MERGED_BY_ENTRY: ReadonlySet = new Set([ - 'projects', - 'mcpServers', - 'groveChoiceSeenAt' -]) - -function isPlainRecord(value: unknown): value is Record { - return typeof value === 'object' && value !== null && !Array.isArray(value) -} - -function mergeEntries(key: string, current: unknown, source: unknown): unknown { - if (!isPlainRecord(current) || !isPlainRecord(source)) { - return source - } - const merged: Record = { ...current, ...source } - if (key === 'projects') { - for (const [path, entry] of Object.entries(source)) { - const own = current[path] - // Preserve trust granted in this account, including just before launch. - if (isPlainRecord(own) && own.hasTrustDialogAccepted === true && isPlainRecord(entry)) { - merged[path] = { ...entry, hasTrustDialogAccepted: true } - } - } - } - if (key === 'groveChoiceSeenAt') { - // Claude trusts a confirmation only while it is fresh, so keep each account's newest one. - for (const [account, seenAt] of Object.entries(current)) { - const theirs = source[account] - if (typeof seenAt === 'number' && (typeof theirs !== 'number' || seenAt > theirs)) { - merged[account] = seenAt - } - } - } - return merged -} - async function copyState(source: string, target: string): Promise { if (lstatIfPresent(target)?.isSymbolicLink()) { return 'user-owned' @@ -201,11 +120,11 @@ async function copyState(source: string, target: string): Promise !isAccountBoundState(key)) + const shared = selectSharedClaudeProfileState(input.value) if (!lstatIfPresent(target)) { const staged = `${target}.${process.pid}.${randomUUID()}.tmp` try { - writeFileSync(staged, `${JSON.stringify(Object.fromEntries(shared), null, 2)}\n`, { + writeFileSync(staged, `${JSON.stringify(mergeClaudeProfileState({}, shared), null, 2)}\n`, { flag: 'wx', mode: 0o600 }) @@ -219,10 +138,7 @@ async function copyState(source: string, target: string): Promise { - const config = { ...current } - for (const [key, value] of shared) { - config[key] = MERGED_BY_ENTRY.has(key) ? mergeEntries(key, current[key], value) : value - } + const config = mergeClaudeProfileState(current, shared) return JSON.stringify(config) === JSON.stringify(current) ? { kind: 'unchanged' } : { kind: 'changed', config } diff --git a/src/main/claude-accounts/claude-profile-state.ts b/src/main/claude-accounts/claude-profile-state.ts new file mode 100644 index 00000000000..52cf971041a --- /dev/null +++ b/src/main/claude-accounts/claude-profile-state.ts @@ -0,0 +1,172 @@ +// Unknown state belongs to the profile; only deliberate user configuration is shared. +const SHARED_CONFIG_KEYS = [ + 'apiKeyHelper', + 'installMethod', + 'autoUpdates', + 'autoUpdatesProtectedForNative', + 'theme', + 'verbose', + 'preferredNotifChannel', + 'shiftEnterKeyBindingInstalled', + 'editorMode', + 'hasUsedBackslashReturn', + 'autoCompactEnabled', + 'autoScrollEnabled', + 'showTurnDuration', + 'externalEditorContext', + 'showMessageTimestamps', + 'diffTool', + 'env', + 'todoFeatureEnabled', + 'showExpandedTodos', + 'briefTranscript', + 'diffSidebarOpen', + 'messageIdleNotifThresholdMs', + 'autoConnectIde', + 'autoInstallIdeExtension', + 'fileCheckpointingEnabled', + 'terminalProgressBarEnabled', + 'showStatusInTerminalTab', + 'taskCompleteNotifEnabled', + 'inputNeededNotifEnabled', + 'agentPushNotifEnabled', + 'respectGitignore', + 'claudeInChromeDefaultEnabled', + 'hasCompletedClaudeInChromeOnboarding', + 'lspRecommendationDisabled', + 'lspRecommendationNeverPlugins', + 'copyFullResponse', + 'copyOnSelect', + 'leftArrowOpensAgents', + 'defaultToAgentsView', + 'prStatusFooterEnabled', + 'remoteControlAtStartup', + 'autoUploadSessions', + 'autoAddRemoteControlDaemonWorker', + 'remoteDialogSeen', + 'workflowSizeGuideline', + 'favoritePlugins', + 'preferTmuxOverIterm2', + 'codeReviewLastEffort', + 'codeReviewLastMaxFindings', + 'bypassPermissionsModeAccepted', + 'mcpServers' +] as const + +const SHARED_PROJECT_KEYS = [ + 'allowedTools', + 'mcpContextUris', + 'mcpServers', + 'enabledMcpjsonServers', + 'disabledMcpjsonServers', + 'hasClaudeMdExternalIncludesApproved', + 'hasTrustDialogAccepted' +] as const + +function isPlainRecord(value: unknown): value is Record { + return typeof value === 'object' && value !== null && !Array.isArray(value) +} + +function selectConfigFields( + source: Record, + keys: readonly string[] +): Record { + return Object.fromEntries( + keys.filter((key) => Object.hasOwn(source, key)).map((key) => [key, source[key]]) + ) +} + +export function selectSharedClaudeProfileState( + source: Record +): Record { + const shared = selectConfigFields(source, SHARED_CONFIG_KEYS) + if (isPlainRecord(source.projects)) { + const projects: Record = {} + for (const [path, entry] of Object.entries(source.projects)) { + if (isPlainRecord(entry)) { + const selected = selectConfigFields(entry, SHARED_PROJECT_KEYS) + if (Object.keys(selected).length > 0) { + projects[path] = selected + } + } + } + if (Object.keys(projects).length > 0) { + shared.projects = projects + } + } + if (source.hasCompletedOnboarding === true) { + shared.hasCompletedOnboarding = true + } + if ( + isPlainRecord(source.customApiKeyResponses) && + Array.isArray(source.customApiKeyResponses.rejected) + ) { + const rejected = source.customApiKeyResponses.rejected.filter( + (value) => typeof value === 'string' + ) + if (rejected.length > 0) { + shared.customApiKeyResponses = { rejected } + } + } + return shared +} + +function mergeProjects(current: unknown, source: Record): unknown { + if (current !== undefined && !isPlainRecord(current)) { + return current + } + const projects: Record = { ...current } + for (const [path, entry] of Object.entries(source)) { + const own = projects[path] + if (isPlainRecord(entry) && (own === undefined || isPlainRecord(own))) { + projects[path] = { + ...own, + ...entry, + ...(own?.hasTrustDialogAccepted === true ? { hasTrustDialogAccepted: true } : {}) + } + } + } + return projects +} + +function mergeRejectedApiKeys(current: unknown, source: Record): unknown { + if (current !== undefined && !isPlainRecord(current)) { + return current + } + const previous = current?.rejected + if ((previous !== undefined && !Array.isArray(previous)) || !Array.isArray(source.rejected)) { + return current + } + const rejected = [...(previous ?? [])] + const seen = new Set(rejected) + for (const value of source.rejected) { + if (!seen.has(value)) { + seen.add(value) + rejected.push(value) + } + } + return { ...current, rejected } +} + +export function mergeClaudeProfileState( + current: Record, + shared: Record +): Record { + const config = { ...current } + for (const [key, value] of Object.entries(shared)) { + if (key === 'hasCompletedOnboarding') { + if (!Object.hasOwn(current, key)) { + config[key] = true + } + } else if (key === 'customApiKeyResponses' && isPlainRecord(value)) { + config[key] = mergeRejectedApiKeys(current[key], value) + } else if (key === 'projects' && isPlainRecord(value)) { + config[key] = mergeProjects(current[key], value) + } else if (key === 'mcpServers' && isPlainRecord(current[key]) && isPlainRecord(value)) { + config[key] = { ...current[key], ...value } + } else { + config[key] = value + } + } + return config +} diff --git a/src/main/claude/claude-rejected-api-key.test.ts b/src/main/claude/claude-rejected-api-key.test.ts new file mode 100644 index 00000000000..be29004e40c --- /dev/null +++ b/src/main/claude/claude-rejected-api-key.test.ts @@ -0,0 +1,40 @@ +import { mkdtempSync, mkdirSync, rmSync, writeFileSync } from 'node:fs' +import { tmpdir } from 'node:os' +import { join } from 'node:path' +import { expect, it } from 'vitest' +import { withoutRejectedClaudeApiKey } from './claude-rejected-api-key' + +it('honors profile approval ahead of a shared rejection, while dropping rejected-only keys', async () => { + const home = mkdtempSync(join(tmpdir(), 'claude-api-key-')) + const config = join(home, 'claude') + mkdirSync(config) + const env = { + HOME: home, + CLAUDE_CONFIG_DIR: config, + ANTHROPIC_API_KEY: 'fixture-prefix-0123456789abcdefghij' + } + try { + writeFileSync( + join(config, '.claude.json'), + JSON.stringify({ + customApiKeyResponses: { + approved: ['0123456789abcdefghij'], + rejected: ['0123456789abcdefghij'] + } + }) + ) + expect(await withoutRejectedClaudeApiKey({ ...env })).toEqual(env) + writeFileSync( + join(config, '.claude.json'), + JSON.stringify({ + customApiKeyResponses: { approved: [], rejected: ['0123456789abcdefghij'] } + }) + ) + expect(await withoutRejectedClaudeApiKey({ ...env })).toEqual({ + HOME: home, + CLAUDE_CONFIG_DIR: config + }) + } finally { + rmSync(home, { recursive: true, force: true }) + } +}) diff --git a/src/main/claude/claude-rejected-api-key.ts b/src/main/claude/claude-rejected-api-key.ts index 38c61451579..d9afa94d907 100644 --- a/src/main/claude/claude-rejected-api-key.ts +++ b/src/main/claude/claude-rejected-api-key.ts @@ -3,19 +3,27 @@ import { readFile } from 'node:fs/promises' import { homedir } from 'node:os' import { resolveClaudeGlobalConfigFile } from './claude-folder-trust-file' -async function readRejectedApiKeyIds(configFile: string): Promise { +type ClaudeApiKeyResponses = { approved: readonly unknown[]; rejected: readonly unknown[] } + +async function readApiKeyResponses(configFile: string): Promise { + const empty = { approved: [], rejected: [] } try { const parsed: unknown = JSON.parse(await readFile(configFile, 'utf8')) if (typeof parsed !== 'object' || parsed === null || !('customApiKeyResponses' in parsed)) { - return [] + return empty } const responses = parsed.customApiKeyResponses - if (typeof responses !== 'object' || responses === null || !('rejected' in responses)) { - return [] + if (typeof responses !== 'object' || responses === null) { + return empty + } + return { + approved: + 'approved' in responses && Array.isArray(responses.approved) ? responses.approved : [], + rejected: + 'rejected' in responses && Array.isArray(responses.rejected) ? responses.rejected : [] } - return Array.isArray(responses.rejected) ? responses.rejected : [] } catch { - return [] + return empty } } @@ -38,9 +46,10 @@ export async function withoutRejectedClaudeApiKey( style, exists: existsSync }) - const rejected = await readRejectedApiKeyIds(configFile) + const responses = await readApiKeyResponses(configFile) // Claude records answers by the trimmed key's last 20 characters. - if (rejected.includes(apiKey.trim().slice(-20))) { + const suffix = apiKey.trim().slice(-20) + if (!responses.approved.includes(suffix) && responses.rejected.includes(suffix)) { for (const name of keyNames) { delete env[name] } From bc1427f6ce8a5daa2a41eaa4063a39fc5f95f89b Mon Sep 17 00:00:00 2001 From: Brennan Benson <79079362+brennanb2025@users.noreply.github.com> Date: Tue, 10 Nov 2026 15:26:25 -0800 Subject: [PATCH 04/11] Keep repositories on their known public forge (#40542) * fix(git): keep public forge ownership ahead of auth evidence * test(git): exercise forge admission with complete auth fixtures --- src/main/git/remotes/hosted-remote-url.ts | 17 +++--- src/main/gitea/repository-ref.test.ts | 20 +++++++ src/main/gitea/repository-ref.ts | 16 ++---- .../github-enterprise-repository.test.ts | 18 +++++++ .../github/github-enterprise-repository.ts | 5 ++ .../gitlab/gitlab-project-ref-resolution.ts | 12 +---- src/main/gitlab/project-ref-parser.test.ts | 29 ++++++++++- src/main/gitlab/project-ref-parser.ts | 43 ++++++--------- .../gitlab/task-project-eligibility.test.ts | 7 +++ ...review-creation-gitlab-self-hosted.test.ts | 52 +++++++++++++++++-- src/shared/git/remotes/public-forge-host.ts | 25 +++++++++ .../workspace-reference-identity.ts | 28 ++++++---- 12 files changed, 198 insertions(+), 74 deletions(-) create mode 100644 src/main/gitea/repository-ref.test.ts create mode 100644 src/shared/git/remotes/public-forge-host.ts diff --git a/src/main/git/remotes/hosted-remote-url.ts b/src/main/git/remotes/hosted-remote-url.ts index 9f10984fa05..5361b6ffac4 100644 --- a/src/main/git/remotes/hosted-remote-url.ts +++ b/src/main/git/remotes/hosted-remote-url.ts @@ -1,4 +1,5 @@ import { normalizeForgeWebHost } from '../../../shared/git/remotes/git-remote-host-alias' +import { getPublicForgeProviderForHost } from '../../../shared/git/remotes/public-forge-host' // Scoped local fork of the hosted-git-info@9.0.3 behavior Orca used. // Keep only the provider parsing and file/commit URL construction needed by source links. @@ -23,14 +24,14 @@ const shorthandHosts: Record { + for (const remote of [ + 'git@ssh.github.com:team/repo.git', + 'ssh://git@altssh.gitlab.com:443/team/repo.git', + 'https://acme.ghe.com/team/repo.git' + ]) { + expect(parseGiteaRepoRef(remote)).toBeNull() + } + expect(parseGiteaRepoRef('https://codeberg.org/team/repo.git')).toMatchObject({ + owner: 'team', + repo: 'repo' + }) + expect(parseGiteaRepoRef('https://git.acme.test/team/repo.git')).toMatchObject({ + owner: 'team', + repo: 'repo' + }) +}) diff --git a/src/main/gitea/repository-ref.ts b/src/main/gitea/repository-ref.ts index 89162701eda..d5ed49c716b 100644 --- a/src/main/gitea/repository-ref.ts +++ b/src/main/gitea/repository-ref.ts @@ -1,4 +1,5 @@ import { createRemoteRefProbeCache } from '../git/remotes/remote-ref-probe-cache' +import { getPublicForgeProviderForHost } from '../../shared/git/remotes/public-forge-host' export type GiteaRepoRef = { host: string @@ -12,14 +13,6 @@ type LocalGitExecOptions = { wslDistro?: string } -const KNOWN_NON_GITEA_HOSTS = new Set([ - 'github.com', - 'gitlab.com', - 'bitbucket.org', - 'ssh.bitbucket.org', - 'dev.azure.com', - 'ssh.dev.azure.com' -]) const repoRefProbeCache = createRemoteRefProbeCache(parseGiteaRepoRef) /** @internal - exposed for tests only */ @@ -69,11 +62,8 @@ function apiBaseUrlFromWebBase(webBaseUrl: string): string { function makeRepoRef(host: string, path: string, webOrigin: string): GiteaRepoRef | null { const normalizedHost = host.toLowerCase() - if ( - !normalizedHost || - KNOWN_NON_GITEA_HOSTS.has(normalizedHost) || - normalizedHost.endsWith('.visualstudio.com') - ) { + const owner = getPublicForgeProviderForHost(normalizedHost) + if (!normalizedHost || (owner && owner !== 'gitea')) { return null } diff --git a/src/main/github/github-enterprise-repository.test.ts b/src/main/github/github-enterprise-repository.test.ts index 99885cc2254..6a97404c2b7 100644 --- a/src/main/github/github-enterprise-repository.test.ts +++ b/src/main/github/github-enterprise-repository.test.ts @@ -70,6 +70,24 @@ describe('getEnterpriseGitHubRepoSlug', () => { _resetOriginGitHubApiRepositoryCache() }) + it.each([ + ['https://bitbucket.org/team/orca.git', 'bitbucket.org'], + ['ssh://git@altssh.gitlab.com:443/team/orca.git', 'altssh.gitlab.com'], + ['https://codeberg.org/team/orca.git', 'codeberg.org'] + ])('does not promote a foreign public remote from gh inventory: %s', async (url, host) => { + mockOriginRemote(url) + mockHostAuthenticated(host) + await expect(getEnterpriseGitHubRepoSlug('/repo')).resolves.toBeFalsy() + await expect(isGitHubHostAuthenticated(host, '/repo')).resolves.toBe(false) + }) + + it('uses the effective SSH hostname before admitting an Enterprise identity', async () => { + mockOriginRemote('git@work-forge:team/orca.git') + resolveWithSshGMock.mockResolvedValue({ hostname: 'bitbucket.org' }) + mockHostAuthenticated('bitbucket.org') + await expect(getEnterpriseGitHubRepoSlug('/repo')).resolves.toBeNull() + }) + it.each([ 'https://ghe.acme.com:8443/team/orca.git', 'https://ghe.acme.com:80/team/orca.git', diff --git a/src/main/github/github-enterprise-repository.ts b/src/main/github/github-enterprise-repository.ts index a0d590a6fb7..89a50c28ef2 100644 --- a/src/main/github/github-enterprise-repository.ts +++ b/src/main/github/github-enterprise-repository.ts @@ -22,6 +22,7 @@ import { parseWslPath } from '../wsl/filesystem/unc-path-access' import { isStableMissingGitRemoteError } from '../git/remotes/stable-missing-git-remote-error' import { requireReachableGitRoute } from '../providers/execution-host-provider-dispatch' import { getConnectionExecutionHostId } from '../../shared/execution-host' +import { getPublicForgeProviderForHost } from '../../shared/git/remotes/public-forge-host' export type GitHubEnterpriseRepoSlug = GitHubOwnerRepo & { host: string } @@ -131,6 +132,10 @@ async function resolveAuthenticatedGitHubHost( connectionId?: string | null, localGitOptions: LocalGitExecOptions = {} ): Promise { + const owner = getPublicForgeProviderForHost(host) + if (owner && owner !== 'github') { + return null + } const normalizedHost = normalizeGitHubHost(host)?.authority ?? host.trim().toLowerCase() const execOptions = ghRepoExecOptions(githubRepoContext(repoPath, connectionId, localGitOptions)) const cacheKey = `${runtimeCacheKey(repoPath, connectionId, localGitOptions.wslDistro)}\0${normalizedHost}\0${githubReadExecutionScope(execOptions)}` diff --git a/src/main/gitlab/gitlab-project-ref-resolution.ts b/src/main/gitlab/gitlab-project-ref-resolution.ts index 3e3b57a90df..90d69bf6052 100644 --- a/src/main/gitlab/gitlab-project-ref-resolution.ts +++ b/src/main/gitlab/gitlab-project-ref-resolution.ts @@ -1,7 +1,6 @@ import { glabExecFileAsync } from '../git/runner' import type { GitAdmissionTier } from '../git/command-runner/git-exec-options' import { addWslEnvKeys } from '../../shared/wsl-env' -import { normalizeForgeWebHost } from '../../shared/git/remotes/git-remote-host-alias' import { isTransientGitProbeError, readRemoteUrl } from '../git/remotes/remote-url-probe' import { NEGATIVE_ENTRY_TTL_MS } from '../git/remotes/remote-ref-probe-cache' import { readLocalGitConfigSignature } from '../github/local-git-config-signature' @@ -19,7 +18,7 @@ import { DEFAULT_GITLAB_HOSTS, normalizeGitLabHost, parseGitLabProjectRef, - parseRemoteProjectRefCandidate, + parseGitLabProjectRefCandidate, type ProjectRef } from './project-ref-parser' @@ -154,19 +153,12 @@ async function resolveProjectRefForRemote( if (stdout === null) { return null } - // Stray glab host entries for GitHub/Bitbucket hosts must not claim their remotes (#40386). - // Match the real host only: `github:team/project` is an scp remote on an SSH alias named github. - const remoteCandidate = parseRemoteProjectRefCandidate(stdout) - const remoteHost = remoteCandidate && normalizeForgeWebHost(remoteCandidate.host) - if (remoteHost === 'github.com' || remoteHost === 'bitbucket.org') { - publish(null) - return null - } const result = parseGitLabProjectRef(stdout, knownHosts) if (result) { publish(result) return result } + const remoteCandidate = parseGitLabProjectRefCandidate(stdout) if ( remoteCandidate && (await isGlabConfiguredForRemoteHost( diff --git a/src/main/gitlab/project-ref-parser.test.ts b/src/main/gitlab/project-ref-parser.test.ts index 6550aa5e402..c83ef13fe26 100644 --- a/src/main/gitlab/project-ref-parser.test.ts +++ b/src/main/gitlab/project-ref-parser.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from 'vitest' -import { parseGitLabProjectRef } from './project-ref-parser' +import { parseGitLabProjectRef, parseRemoteProjectRefCandidate } from './project-ref-parser' describe('gitlab project ref parsing', () => { it.each([ @@ -43,4 +43,31 @@ describe('gitlab project ref parsing', () => { parseGitLabProjectRef('http://gitea.example.com:3030/team/api.git', knownHosts) ).toBeNull() }) + + it('keeps public ownership authoritative without narrowing generic mirror parsing', () => { + for (const [remote, host] of [ + ['https://github.com:8443/team/project.git', 'github.com:8443'], + ['git@SSH.GITHUB.COM:team/project.git', 'ssh.github.com'], + ['git@acme.ghe.com:team/project.git', 'acme.ghe.com'], + ['git@ssh.bitbucket.org:team/project.git', 'ssh.bitbucket.org'], + ['https://dev.azure.com/acme/project/_git/repo', 'dev.azure.com'], + ['git@ssh.dev.azure.com:v3/acme/project/repo', 'ssh.dev.azure.com'], + ['https://acme.visualstudio.com/project/_git/repo', 'acme.visualstudio.com'], + ['https://codeberg.org/team/project.git', 'codeberg.org'] + ]) { + expect(parseGitLabProjectRef(remote, [host])).toBeNull() + } + expect(parseRemoteProjectRefCandidate('git@github.com:team/project.git')).toEqual({ + host: 'github.com', + path: 'team/project' + }) + expect( + parseGitLabProjectRef('https://git.bitbucket.acme.com/team/project.git', [ + 'git.bitbucket.acme.com' + ]) + ).toEqual({ + host: 'git.bitbucket.acme.com', + path: 'team/project' + }) + }) }) diff --git a/src/main/gitlab/project-ref-parser.ts b/src/main/gitlab/project-ref-parser.ts index 051fdf1d062..96f083a6783 100644 --- a/src/main/gitlab/project-ref-parser.ts +++ b/src/main/gitlab/project-ref-parser.ts @@ -1,5 +1,6 @@ import type { GitLabProjectRef } from '../../shared/gitlab-types' import { normalizeGitLabRemoteHost } from '../../shared/git/remotes/git-remote-host-alias' +import { getPublicForgeProviderForHost } from '../../shared/git/remotes/public-forge-host' export type ProjectRef = GitLabProjectRef @@ -47,19 +48,6 @@ function knownHostMatches(urlHost: string, knownHost: string): boolean { return false } -function makeProjectRef( - host: string, - path: string, - knownHosts: readonly string[] -): ProjectRef | null { - const normalizedHost = normalizeGitLabRemoteHost(host) - const normalizedKnownHosts = knownHosts.map(normalizeGitLabHost) - if (!normalizedKnownHosts.some((knownHost) => knownHostMatches(normalizedHost, knownHost))) { - return null - } - return makeProjectRefForTrustedHost(normalizedHost, path) -} - export function parseRemoteProjectRefCandidate(remoteUrl: string): ProjectRef | null { const trimmed = remoteUrl.trim() if (!/^[a-z][a-z0-9+.-]*:\/\//i.test(trimmed)) { @@ -80,25 +68,24 @@ export function parseRemoteProjectRefCandidate(remoteUrl: string): ProjectRef | } } +export function parseGitLabProjectRefCandidate(remoteUrl: string): ProjectRef | null { + const candidate = parseRemoteProjectRefCandidate(remoteUrl) + if (!candidate) { + return null + } + const owner = getPublicForgeProviderForHost(candidate.host) + return owner && owner !== 'gitlab' ? null : candidate +} + export function parseGitLabProjectRef( remoteUrl: string, knownHosts: readonly string[] = DEFAULT_GITLAB_HOSTS ): ProjectRef | null { - const trimmed = remoteUrl.trim() - if (!/^[a-z][a-z0-9+.-]*:\/\//i.test(trimmed)) { - const scpLike = trimmed.match(/^(?:[^@/:]+@)?([^:\s/]+):([^\s]+?)(?:\.git)?$/) - if (scpLike) { - return makeProjectRef(scpLike[1], scpLike[2], knownHosts) - } - } - - try { - const url = new URL(trimmed) - if (!['http:', 'https:', 'ssh:', 'git:', 'git+ssh:'].includes(url.protocol.toLowerCase())) { - return null - } - return makeProjectRef(hostIdentityFromUrl(url), url.pathname, knownHosts) - } catch { + const candidate = parseGitLabProjectRefCandidate(remoteUrl) + if (!candidate) { return null } + return knownHosts.some((host) => knownHostMatches(candidate.host, normalizeGitLabHost(host))) + ? candidate + : null } diff --git a/src/main/gitlab/task-project-eligibility.test.ts b/src/main/gitlab/task-project-eligibility.test.ts index 894a356e3d7..1844b499abb 100644 --- a/src/main/gitlab/task-project-eligibility.test.ts +++ b/src/main/gitlab/task-project-eligibility.test.ts @@ -25,6 +25,8 @@ vi.mock('../git/command-runner/gh-exec-file', async (importOriginal) => ({ })) import { listMergeRequests } from './merge-request-list' +import { isTaskRepositoryIneligible } from '../git/task-repository-eligibility' +import { rememberGlabKnownHosts } from './gitlab-known-host-probe' import { listIssues } from './issues' import { _resetProjectRefCache, _resetKnownHostsCache } from './gitlab-project-ref-resolution' import { _resetRemoteNameListingCache } from '../git/remotes/remote-name-listing' @@ -132,4 +134,9 @@ describe('GitLab task project admission', () => { expect(result.items).toEqual([]) expect(glab.mock.calls.filter(([args]) => args[0] !== 'auth')).toEqual([]) }) + + it('does not exclude GitHub tasks because glab remembers github.com', async () => { + rememberGlabKnownHosts(['github.com']) + await expect(isTaskRepositoryIneligible('/github', 'github')).resolves.toBe(false) + }) }) diff --git a/src/main/source-control/hosted-review-creation-gitlab-self-hosted.test.ts b/src/main/source-control/hosted-review-creation-gitlab-self-hosted.test.ts index bdd3a654baa..ab4d4387e4e 100644 --- a/src/main/source-control/hosted-review-creation-gitlab-self-hosted.test.ts +++ b/src/main/source-control/hosted-review-creation-gitlab-self-hosted.test.ts @@ -35,11 +35,6 @@ vi.mock('../git/command-runner/gh-exec-file', async (importOriginal) => ({ ghExecFileAsync: ghExecFileAsyncMock })) -vi.mock('../git/exec-error', async (importOriginal) => ({ - ...(await importOriginal>()), - extractExecError: vi.fn() -})) - vi.mock('../github/client', () => ({ createGitHubPullRequest: vi.fn(), getRepoSlug: getRepoSlugMock, @@ -71,6 +66,8 @@ vi.mock('./hosted-review', () => ({ import { _resetKnownHostsCache, _resetProjectRefCache } from '../gitlab/gl-utils' import { diagnoseAuth } from '../gitlab/client' import { getHostedReviewCreationEligibility } from './hosted-review-creation' +import { detectHostedReviewProvider } from './forge-provider-detection' +import { rememberGlabKnownHosts } from '../gitlab/gitlab-known-host-probe' function resetMocks(): void { for (const mock of [ @@ -167,4 +164,49 @@ describe('GitLab self-hosted hosted review creation eligibility', () => { blockedReason: null }) }) + + it.each(['per-host failure', 'global inventory', 'remembered inventory'])( + 'keeps GitHub PR identity across repositories despite glab %s', + async (evidence) => { + gitExecFileAsyncMock.mockResolvedValue({ stdout: 'git@github.com:team/orca.git\n' }) + getRepoSlugMock.mockResolvedValue({ owner: 'team', repo: 'orca' }) + if (evidence === 'remembered inventory') { + rememberGlabKnownHosts(['github.com']) + } + glabExecFileAsyncMock.mockImplementation(async (args: string[]) => { + if (args.includes('--hostname')) { + // Captured glab 1.115 output for a configured host without a token. + throw Object.assign(new Error('glab auth status failed'), { + stdout: '', + stderr: + 'github.com\n x github.com: API call failed\n ! No token found (checked config file, keyring, and environment variables).\n' + }) + } + return { + stdout: + evidence === 'global inventory' + ? 'github.com\n ✓ Logged in to github.com as example-user (config file)\n' + : 'gitlab.com\n ✓ Logged in to gitlab.com as example-user (config file)\n', + stderr: '' + } + }) + for (const repoPath of ['/first-repo', '/second-repo']) { + await expect( + detectHostedReviewProvider({ repoPath, executionHostId: 'local' }) + ).resolves.toBe('github') + } + + gitExecFileAsyncMock.mockResolvedValue({ stdout: 'https://forge.acme.test/team/orca.git\n' }) + glabExecFileAsyncMock.mockRejectedValue( + Object.assign(new Error('glab auth status failed'), { + stdout: '', + stderr: + 'forge.acme.test\n x forge.acme.test: API call failed\n ! No token found (checked config file, keyring, and environment variables).\n' + }) + ) + await expect( + detectHostedReviewProvider({ repoPath: '/custom', executionHostId: 'local' }) + ).resolves.toBe('gitlab') + } + ) }) diff --git a/src/shared/git/remotes/public-forge-host.ts b/src/shared/git/remotes/public-forge-host.ts new file mode 100644 index 00000000000..800f9430025 --- /dev/null +++ b/src/shared/git/remotes/public-forge-host.ts @@ -0,0 +1,25 @@ +import { foldWwwHostAlias, normalizeForgeWebHost } from './git-remote-host-alias' + +type PublicForgeProvider = 'github' | 'gitlab' | 'bitbucket' | 'azure-devops' | 'gitea' + +/** Ownership only: callers retain their original endpoint and persisted host identity. */ +export function getPublicForgeProviderForHost(host: string): PublicForgeProvider | null { + const hostname = normalizeForgeWebHost(foldWwwHostAlias(host).replace(/:\d+$/, '')) + if (hostname === 'github.com' || hostname === 'ghe.com' || hostname.endsWith('.ghe.com')) { + return 'github' + } + if (hostname === 'gitlab.com') { + return 'gitlab' + } + if (hostname === 'bitbucket.org') { + return 'bitbucket' + } + if ( + hostname === 'dev.azure.com' || + hostname.endsWith('.dev.azure.com') || + hostname.endsWith('.visualstudio.com') + ) { + return 'azure-devops' + } + return hostname === 'codeberg.org' ? 'gitea' : null +} diff --git a/src/shared/workspace-attachments/workspace-reference-identity.ts b/src/shared/workspace-attachments/workspace-reference-identity.ts index 179e355c7fd..408a047d1e1 100644 --- a/src/shared/workspace-attachments/workspace-reference-identity.ts +++ b/src/shared/workspace-attachments/workspace-reference-identity.ts @@ -2,6 +2,7 @@ import { parseJiraIssueUrl, JIRA_ISSUE_KEY_PATTERN } from '../jira/jira-issue-ur import { parseLinearIssueInput, parseLinearIssueUrlIntent } from '../linear/links' import { getTaskSourceCacheScope } from '../work-items/task-source-context' import type { WorkspaceAttachment } from '../worktree/types' +import { getPublicForgeProviderForHost } from '../git/remotes/public-forge-host' export type WorkspaceReferenceQuery = | { kind: 'url'; identity: string } @@ -9,13 +10,22 @@ export type WorkspaceReferenceQuery = | { kind: 'issue-url'; route: string } | { kind: 'issue-key'; identifier: string } -const HOST_PROVIDERS: Readonly> = { - 'github.com': 'github', - 'gitlab.com': 'gitlab', - 'linear.app': 'linear', - 'codeberg.org': 'gitea', - 'bitbucket.org': 'bitbucket', - 'dev.azure.com': 'azure-devops' +// Keep existing saved-reference URL normalization separate from remote-host ownership. +const PUBLIC_REFERENCE_HOSTS = new Set([ + 'github.com', + 'gitlab.com', + 'codeberg.org', + 'bitbucket.org', + 'dev.azure.com' +]) + +function referenceHostProvider(host: string): WorkspaceAttachment['provider'] | undefined { + if (host === 'linear.app') { + return 'linear' + } + return PUBLIC_REFERENCE_HOSTS.has(host) + ? (getPublicForgeProviderForHost(host) ?? undefined) + : undefined } const CASE_INSENSITIVE_PATH_PROVIDERS: ReadonlySet = new Set([ @@ -37,7 +47,7 @@ function referenceUrl(input: string): URL { url.search = '' url.hash = '' url.pathname = url.pathname.replace(/\/+$/, '') - if (url.hostname.startsWith('www.') && HOST_PROVIDERS[url.hostname.slice(4)]) { + if (url.hostname.startsWith('www.') && referenceHostProvider(url.hostname.slice(4))) { url.hostname = url.hostname.slice(4) } return url @@ -63,7 +73,7 @@ export function parseWorkspaceReferenceUrl( providerHint?: WorkspaceAttachment['provider'] ): WorkspaceAttachment { const url = referenceUrl(input) - const knownProvider = HOST_PROVIDERS[url.hostname] + const knownProvider = referenceHostProvider(url.hostname) const item = parseReferenceRoute(url, knownProvider ?? providerHint) if ( (knownProvider && item.provider !== knownProvider) || From c4e4428af7d399a23e2e916943b7a2cb7dcf7560 Mon Sep 17 00:00:00 2001 From: Kelvin Amoaba <97001695+AmoabaKelvin@users.noreply.github.com> Date: Tue, 10 Nov 2026 23:32:37 +0000 Subject: [PATCH 05/11] fix(mobile): say which WebView to install when Android's is too old to open a workspace (#40907) * fix(mobile): tell Android users which WebView to update when it is too old The page shell needs androidx's DOCUMENT_START_SCRIPT:1, which stable WebView only reports from Chromium 101; the comments claimed 83/88. Name the required WebView and the one installed, and how to switch it. * fix(mobile): read the WebView provider through the shell module index Tests stub the module index; a direct file import loaded expo-modules-core unstubbed. --- .../MobileWebShellBridge.kt | 2 +- .../MobileWebShellDocument.kt | 2 +- .../MobileWebShellNetworkApiBlocker.kt | 2 +- .../OrcaMobileWebShellModule.kt | 13 ++++++++ .../orca-mobile-web-shell/src/index.ts | 19 +++++++++++- mobile/src/i18n/locales/en.json | 2 ++ .../src/mobile-web-shell/ShellStateScreen.tsx | 30 +++++++++++++++++-- 7 files changed, 64 insertions(+), 6 deletions(-) diff --git a/mobile/modules/orca-mobile-web-shell/android/src/main/java/expo/modules/orcamobilewebshell/MobileWebShellBridge.kt b/mobile/modules/orca-mobile-web-shell/android/src/main/java/expo/modules/orcamobilewebshell/MobileWebShellBridge.kt index 045cce54908..99f8bfc2713 100644 --- a/mobile/modules/orca-mobile-web-shell/android/src/main/java/expo/modules/orcamobilewebshell/MobileWebShellBridge.kt +++ b/mobile/modules/orca-mobile-web-shell/android/src/main/java/expo/modules/orcamobilewebshell/MobileWebShellBridge.kt @@ -38,7 +38,7 @@ internal enum class MobileWebShellBridgeInstall { /** The prop is false, so nothing is registered and Phase B behaviour is byte-identical. */ SKIP, INSTALL, - /** The WebView provider is older than `WEB_MESSAGE_LISTENER` (Chromium 88). Terminal. */ + /** The WebView provider is older than `WEB_MESSAGE_LISTENER` (Chromium 83). Terminal. */ UNAVAILABLE } diff --git a/mobile/modules/orca-mobile-web-shell/android/src/main/java/expo/modules/orcamobilewebshell/MobileWebShellDocument.kt b/mobile/modules/orca-mobile-web-shell/android/src/main/java/expo/modules/orcamobilewebshell/MobileWebShellDocument.kt index af1aff6a343..0d8f77c5fc5 100644 --- a/mobile/modules/orca-mobile-web-shell/android/src/main/java/expo/modules/orcamobilewebshell/MobileWebShellDocument.kt +++ b/mobile/modules/orca-mobile-web-shell/android/src/main/java/expo/modules/orcamobilewebshell/MobileWebShellDocument.kt @@ -201,7 +201,7 @@ internal class MobileWebShellDocument(private val context: Context) { view.destroy() } - // Keep explicit settings for the Chromium 83 floor, even where newer WebViews ignore deprecated options. + // Keep explicit settings even where newer WebViews ignore deprecated options; the floor is Chromium 101. // B4 requires device proofs: no network, persistent state, file/content access, cleartext or navigation escape. @Suppress("DEPRECATION") private fun createWebView(): WebView { diff --git a/mobile/modules/orca-mobile-web-shell/android/src/main/java/expo/modules/orcamobilewebshell/MobileWebShellNetworkApiBlocker.kt b/mobile/modules/orca-mobile-web-shell/android/src/main/java/expo/modules/orcamobilewebshell/MobileWebShellNetworkApiBlocker.kt index 4c0397fdd0a..0b94103df6e 100644 --- a/mobile/modules/orca-mobile-web-shell/android/src/main/java/expo/modules/orcamobilewebshell/MobileWebShellNetworkApiBlocker.kt +++ b/mobile/modules/orca-mobile-web-shell/android/src/main/java/expo/modules/orcamobilewebshell/MobileWebShellNetworkApiBlocker.kt @@ -17,7 +17,7 @@ internal val MOBILE_WEB_SHELL_NETWORK_API_BLOCKER = """ })(); """.trimIndent() -/** Query document-start-script capability (Chromium 83 floor), not version strings. */ +/** Query capability, not version strings; stable WebView has it from Chromium 101. */ internal fun installMobileWebShellNetworkApiBlocker( webView: WebView, allowedOrigin: String diff --git a/mobile/modules/orca-mobile-web-shell/android/src/main/java/expo/modules/orcamobilewebshell/OrcaMobileWebShellModule.kt b/mobile/modules/orca-mobile-web-shell/android/src/main/java/expo/modules/orcamobilewebshell/OrcaMobileWebShellModule.kt index abba9fd7675..e08436bd126 100644 --- a/mobile/modules/orca-mobile-web-shell/android/src/main/java/expo/modules/orcamobilewebshell/OrcaMobileWebShellModule.kt +++ b/mobile/modules/orca-mobile-web-shell/android/src/main/java/expo/modules/orcamobilewebshell/OrcaMobileWebShellModule.kt @@ -8,6 +8,8 @@ import android.content.res.Configuration import android.net.Uri import android.os.Handler import android.os.Looper +import androidx.webkit.WebViewCompat +import androidx.webkit.WebViewFeature import expo.modules.kotlin.exception.CodedException import expo.modules.kotlin.exception.Exceptions import expo.modules.kotlin.functions.Queues @@ -68,6 +70,17 @@ class OrcaMobileWebShellModule : Module() { Uri.fromFile(directory).toString() } + // Lets isolation-unavailable name the WebView to update. + Function("currentWebViewProvider") { + val context = appContext.reactContext ?: return@Function null + val info = WebViewCompat.getCurrentWebViewPackage(context) ?: return@Function null + val version = info.versionName ?: return@Function null + val name = info.applicationInfo?.loadLabel(context.packageManager)?.toString() ?: info.packageName + val hasShellFeatures = WebViewFeature.isFeatureSupported(WebViewFeature.DOCUMENT_START_SCRIPT) && + WebViewFeature.isFeatureSupported(WebViewFeature.WEB_MESSAGE_LISTENER) + mapOf("name" to name, "version" to version, "hasShellFeatures" to hasShellFeatures) + } + AsyncFunction("prepareSpareDocument") { directory: String, sessionId: String -> val activity = appContext.currentActivity ?: return@AsyncFunction false MobileWebShellSparePool.prepare(activity, directory, sessionId) diff --git a/mobile/modules/orca-mobile-web-shell/src/index.ts b/mobile/modules/orca-mobile-web-shell/src/index.ts index 97979cd7019..4e072e2efb2 100644 --- a/mobile/modules/orca-mobile-web-shell/src/index.ts +++ b/mobile/modules/orca-mobile-web-shell/src/index.ts @@ -18,7 +18,7 @@ export type OrcaMobileWebShellViewProps = ViewProps & { generationDirectory: string /** `[A-Za-z0-9_-]{1,128}`. Scopes the private origin, so every mount must mint a fresh one. */ sessionId: string - // Bridge is off by default with nothing registered. Opt-in on Android below WEB_MESSAGE_LISTENER/Chromium 88 fails isolation-unavailable instead of loading unfenced. + // Bridge is off by default with nothing registered. Opt-in on Android below WEB_MESSAGE_LISTENER/Chromium 83 fails isolation-unavailable instead of loading unfenced. bridgeEnabled?: boolean onLoadState?: (event: NativeSyntheticEvent) => void // Raw JSON from window.orcaBridge; native silently rejects other origins/frames/WebViews and envelopes above 640 KiB (MobileWebShellBridge.maxMessageByteCount). @@ -82,6 +82,23 @@ export function warmUpWebShell(): void { } } +export type WebViewProvider = { name: string; version: string; hasShellFeatures: boolean } + +// Android only: the WebView provider and whether it has the shell's fences. Null when unknown. +export function currentWebViewProvider(): WebViewProvider | null { + if (Platform.OS !== 'android') { + return null + } + const shell = requireOptionalNativeModule<{ + currentWebViewProvider?: () => WebViewProvider | null + }>('OrcaMobileWebShell') + try { + return shell?.currentWebViewProvider?.() ?? null + } catch { + return null + } +} + export { MOBILE_WEB_SHELL_FAILURE_REASONS, parseMobileWebShellLoadState, diff --git a/mobile/src/i18n/locales/en.json b/mobile/src/i18n/locales/en.json index f14faed6778..cac5f2aa90f 100644 --- a/mobile/src/i18n/locales/en.json +++ b/mobile/src/i18n/locales/en.json @@ -820,6 +820,8 @@ "webShell": { "shellStateScreen": { "isolationUnavailable": "This device's WebView is too old to open the workspace safely.", + "isolationUnavailableAndroid": "Orca needs Android System WebView or Chrome 101 or newer. Update it from the Play Store, or pick a newer one in Developer options > WebView implementation.", + "webViewInUse": "This device has {{name}} {{version}}.", "downloadFailed": "The latest app could not be downloaded from this host.", "hostProfileUnreadable": "Could not read this host on your device. Try again.", "statusUnreadable": "Could not read this host's status. Go back and reopen it.", diff --git a/mobile/src/mobile-web-shell/ShellStateScreen.tsx b/mobile/src/mobile-web-shell/ShellStateScreen.tsx index d22e7e2c055..bc9d7ccaa91 100644 --- a/mobile/src/mobile-web-shell/ShellStateScreen.tsx +++ b/mobile/src/mobile-web-shell/ShellStateScreen.tsx @@ -1,5 +1,6 @@ import type { ReactNode } from 'react' -import { Pressable, Text, View } from 'react-native' +import { Platform, Pressable, Text, View } from 'react-native' +import { currentWebViewProvider } from '../../modules/orca-mobile-web-shell/src' import { ProtocolBlockScreen } from '../components/ProtocolBlockScreen' import { colors, radii, spacing, typography } from '../theme/mobile-theme' import { themedStyleSheet } from '../theme/themed-styles' @@ -65,11 +66,30 @@ function Failed({ useMobileColorScheme() // Retry cannot change a settled isolation gate or give an unsupported WebView the missing fence. const retryable = state.reason !== 'isolation-unavailable' && state.reason !== 'status-unreadable' + const provider = state.reason === 'isolation-unavailable' ? currentWebViewProvider() : null + // Unknown provider (older binary): a missing feature is still the likely cause. + const webViewTooOld = + Platform.OS === 'android' && + state.reason === 'isolation-unavailable' && + provider?.hasShellFeatures !== true return ( - {failureMessage(state.reason, t)} + {webViewTooOld + ? t( + 'webShell.shellStateScreen.isolationUnavailableAndroid', + 'Orca needs Android System WebView or Chrome 101 or newer. Update it from the Play Store, or pick a newer one in Developer options > WebView implementation.' + ) + : failureMessage(state.reason, t)} + {webViewTooOld && provider ? ( + + {t('webShell.shellStateScreen.webViewInUse', 'This device has {{name}} {{version}}.', { + name: provider.name, + version: provider.version + })} + + ) : null} {retryable ? ( [styles.retryButton, pressed && styles.pressed]} @@ -160,6 +180,12 @@ const styles = themedStyleSheet(() => ({ textAlign: 'center', marginBottom: spacing.lg }, + failedDetail: { + fontSize: typography.metaSize, + color: colors.textSecondary, + textAlign: 'center', + marginBottom: spacing.lg + }, retryButton: { backgroundColor: colors.bgRaised, paddingVertical: spacing.sm + 2, From 9cedbae881788bf642de2ae81d6d32d36c6b9b8c Mon Sep 17 00:00:00 2001 From: Kelvin Amoaba <97001695+AmoabaKelvin@users.noreply.github.com> Date: Tue, 10 Nov 2026 23:32:57 +0000 Subject: [PATCH 06/11] fix(native-chat): browser run's Show button opens its own chat's page, not another agent's (#40910) * fix(native-chat): show the page a browser run drove, not another chat's * fix(browser): run each queued agent command in its own RPC call * fix(native-chat): once a chat claims its browser activity, ignore unclaimed activity --- .../orchestration-compatibility-envelope.ts | 16 +++--- .../orchestration-request-evidence.test.ts | 15 ++++++ .../agent-browser-bridge-queue.ts | 16 +++--- .../agent-browser-bridge-tab-routing.test.ts | 51 +++++++++++++++++++ .../browser-agent-activity.test.ts | 12 +++++ .../page-activity/browser-agent-activity.ts | 31 ++++++++--- src/main/runtime/rpc/dispatcher.ts | 36 +++++++------ src/main/runtime/rpc/rpc-active-caller.ts | 36 +++++++++++-- .../browser-agent-activity-state.ts | 24 ++++++--- .../runs/NativeChatBrowserPageButton.test.tsx | 27 +++++++++- .../runs/NativeChatBrowserPageButton.tsx | 2 +- .../ipc-events/browser-state-ipc-bridge.ts | 10 +++- src/shared/browser-agent-activity-contract.ts | 2 + 13 files changed, 226 insertions(+), 52 deletions(-) diff --git a/src/cli/runtime/orchestration-compatibility-envelope.ts b/src/cli/runtime/orchestration-compatibility-envelope.ts index be78e8dee2f..c7f2d62f6cb 100644 --- a/src/cli/runtime/orchestration-compatibility-envelope.ts +++ b/src/cli/runtime/orchestration-compatibility-envelope.ts @@ -15,9 +15,9 @@ export function createOrchestrationCompatibilityEnvelope( } } -/** The chat an agent launch came from, so the host can show the launched agent there. +/** The chat a launch or browser command came from, so the host can show its agent or page there. * Only a same-host session can be named: host-stamped (WSL) environments send nothing. */ -export function createAgentLaunchCallerEvidence( +export function createChatCallerEvidence( env: NodeJS.ProcessEnv ): RuntimeOrchestrationEnvelope['orchestrationCompatibilityEvidence'] { const agentSessionId = readInjectedAgentSessionId(env) @@ -29,12 +29,16 @@ export function createAgentLaunchCallerEvidence( const AGENT_LAUNCH_METHODS: ReadonlySet = new Set(['agent.launch', 'agent.launchReplay']) +function namesChatCaller(method: string): boolean { + return AGENT_LAUNCH_METHODS.has(method) || method.startsWith('browser.') +} + /** The caller evidence one request carries, read from this process's environment once. */ export class OrchestrationRequestEvidence { private readonly orchestration: RuntimeOrchestrationEnvelope // A chat's session id means nothing on another server, so reads there go like a shell's. private readonly remoteRead: RuntimeOrchestrationEnvelope - private readonly agentLaunchCaller: RuntimeOrchestrationEnvelope['orchestrationCompatibilityEvidence'] + private readonly chatCaller: RuntimeOrchestrationEnvelope['orchestrationCompatibilityEvidence'] constructor(env: NodeJS.ProcessEnv) { this.orchestration = createOrchestrationCompatibilityEnvelope(env) @@ -44,7 +48,7 @@ export class OrchestrationRequestEvidence { ...this.orchestration, orchestrationCompatibilityEvidence: Object.keys(shell).length > 0 ? shell : undefined } - this.agentLaunchCaller = createAgentLaunchCallerEvidence(env) + this.chatCaller = createChatCallerEvidence(env) } envelopeFor( @@ -58,8 +62,8 @@ export class OrchestrationRequestEvidence { compatibilityInvocationId: request.requestId ?? base.compatibilityInvocationId } } - return AGENT_LAUNCH_METHODS.has(method) && !request.remote && this.agentLaunchCaller - ? { orchestrationCompatibilityEvidence: this.agentLaunchCaller } + return namesChatCaller(method) && !request.remote && this.chatCaller + ? { orchestrationCompatibilityEvidence: this.chatCaller } : {} } } diff --git a/src/cli/runtime/orchestration-request-evidence.test.ts b/src/cli/runtime/orchestration-request-evidence.test.ts index aceef390bc2..e8234f2223a 100644 --- a/src/cli/runtime/orchestration-request-evidence.test.ts +++ b/src/cli/runtime/orchestration-request-evidence.test.ts @@ -26,3 +26,18 @@ describe('caller evidence on requests to another server', () => { ).toEqual({ agentSessionId: '11111111-1111-4111-8111-111111111111' }) }) }) + +describe('caller evidence on browser commands', () => { + it('names the chat on this host, so its run can show the page it drove', () => { + const evidence = new OrchestrationRequestEvidence(CHAT) + const request = { mutation: false, requestId: undefined } + expect( + evidence.envelopeFor('browser.click', { ...request, remote: false }) + .orchestrationCompatibilityEvidence + ).toEqual({ agentSessionId: '11111111-1111-4111-8111-111111111111' }) + expect( + evidence.envelopeFor('browser.click', { ...request, remote: true }) + .orchestrationCompatibilityEvidence + ).toBeUndefined() + }) +}) diff --git a/src/main/browser/agent-browser/command-queue/agent-browser-bridge-queue.ts b/src/main/browser/agent-browser/command-queue/agent-browser-bridge-queue.ts index eafd92c5188..5b4969e02da 100644 --- a/src/main/browser/agent-browser/command-queue/agent-browser-bridge-queue.ts +++ b/src/main/browser/agent-browser/command-queue/agent-browser-bridge-queue.ts @@ -20,7 +20,7 @@ import { captureRemoteCliBrowserScope, runOutsideRemoteCliBrowserScope } from '../../../runtime/desktop-browser-bridge/remote-cli-browser-scope' -import { getActiveRpcCaller } from '../../../runtime/rpc/rpc-active-caller' +import { captureActiveRpcCall, getActiveRpcCaller } from '../../../runtime/rpc/rpc-active-caller' export abstract class AgentBrowserBridgeQueue extends AgentBrowserBridgeActionEffects { // Serialize tab switches behind commands targeting the current tab. @@ -97,8 +97,10 @@ export abstract class AgentBrowserBridgeQueue extends AgentBrowserBridgeActionEf assertNoJavaScriptDialog(webContentsId, pageId, assertNotRevoked) const sessionName = `${ORCA_TAB_SESSION_PREFIX}${pageId}` const agentCommand = this.browserManager.beginAgentCommand(pageId) - // Queued commands run under the caller ahead of them, so read this one's caller now. + // Queued commands run under the caller ahead of them, so read this one's caller now + // and re-enter its call, or what it marks would count as that other chat's. const caller = getActiveRpcCaller() + const inThisCall = captureActiveRpcCall() // Decided at enqueue: a queued command runs under the caller of the command ahead of it. const reportEffects = options.reportEffects === true && agentCommand.agent const expectedUrl = getRequestedPageUrl() @@ -167,10 +169,12 @@ export abstract class AgentBrowserBridgeQueue extends AgentBrowserBridgeActionEf }, options ) - return origin.run(() => { - started = true - return this.browserManager.runPageCommand(pageId, caller, () => agentCommand.run(run)) - }) + return inThisCall(() => + origin.run(() => { + started = true + return this.browserManager.runPageCommand(pageId, caller, () => agentCommand.run(run)) + }) + ) }, resolve: resolve as (value: unknown) => void, reject diff --git a/src/main/browser/agent-browser/session-routing/agent-browser-bridge-tab-routing.test.ts b/src/main/browser/agent-browser/session-routing/agent-browser-bridge-tab-routing.test.ts index ce28eaa77df..7f8838bd535 100644 --- a/src/main/browser/agent-browser/session-routing/agent-browser-bridge-tab-routing.test.ts +++ b/src/main/browser/agent-browser/session-routing/agent-browser-bridge-tab-routing.test.ts @@ -59,6 +59,10 @@ vi.mock('../../cdp/commands/cdp-bridge', async () => { }) import { AgentBrowserBridge } from '../agent-browser-bridge' +import { + getActiveRpcAgentSessionId, + runWithActiveRpcCaller +} from '../../../runtime/rpc/rpc-active-caller' import { answerAgentBrowserCommands, mockBrowserManager, @@ -125,4 +129,51 @@ describe('AgentBrowserBridge', () => { await b.click('@e2', 'wt-1') expect(clickSessions).toEqual(['orca-tab-tab-a', 'orca-tab-tab-b']) }) + + it("marks a tab switch queued behind another chat's command as the switching chat's", async () => { + const chatA = '11111111-1111-4111-8111-111111111111' + const chatB = '22222222-2222-4222-8222-222222222222' + const tabs = new Map([ + ['tab-a', 1], + ['tab-b', 2] + ]) + const worktrees = new Map([ + ['tab-a', 'wt-1'], + ['tab-b', 'wt-1'] + ]) + const wc1 = mockWebContents(1) + const wc2 = mockWebContents(2) + webContentsFromIdMock.mockImplementation((id: number) => (id === 1 ? wc1 : wc2)) + const marks: [string, string | undefined][] = [] + const b = new AgentBrowserBridge( + mockBrowserManager(tabs, worktrees, { + beginAgentCommand: (pageId: string) => { + marks.push([pageId, getActiveRpcAgentSessionId()]) + return { agent: true, run: (execute) => execute(), end: () => {} } + } + }) + ) + b.setActiveTab(1, 'wt-1') + const held: { releaseA?: () => void } = {} + answerAgentBrowserCommands(execFileMock, stdinWrites, (_command, cb) => { + const answer = (): void => + cb(null, JSON.stringify({ success: true, data: { snapshot: '' } }), '') + if (held.releaseA) { + answer() + } else { + held.releaseA = answer + } + }) + const inChat = (chat: string, run: () => T): T => + runWithActiveRpcCaller({ kind: 'local-cli' }, run, chat) + + const snapshot = inChat(chatA, () => b.snapshot('wt-1')) + await vi.waitFor(() => expect(execFileMock).toHaveBeenCalled()) + const tabSwitch = inChat(chatB, () => b.tabSwitch(undefined, 'wt-1', 'tab-b')) + held.releaseA?.() + await Promise.all([snapshot, tabSwitch]) + + expect(marks).toContainEqual(['tab-b', chatB]) + expect(marks).not.toContainEqual(['tab-b', chatA]) + }) }) diff --git a/src/main/browser/guest-lifecycle/page-activity/browser-agent-activity.test.ts b/src/main/browser/guest-lifecycle/page-activity/browser-agent-activity.test.ts index 8a2148e204f..d11c363277f 100644 --- a/src/main/browser/guest-lifecycle/page-activity/browser-agent-activity.test.ts +++ b/src/main/browser/guest-lifecycle/page-activity/browser-agent-activity.test.ts @@ -90,6 +90,18 @@ describe('BrowserAgentActivity', () => { expect(sent).toEqual([]) }) + it("names the chat whose agent's CLI sent the command", () => { + const { activity, sent } = setup() + const chat = '11111111-1111-4111-8111-111111111111' + runWithActiveRpcCaller({ kind: 'local-cli' }, () => activity.beginCommand(PAGE), chat).end() + expect(sent.at(-1)?.data).toEqual({ + browserPageId: PAGE, + worktreeId: 'wt-1', + active: true, + agentSessionId: chat + }) + }) + it('clears the mark once the agent stays idle, and at once when the page closes', () => { const { activity, sent, agentCommand } = setup() agentCommand().end() diff --git a/src/main/browser/guest-lifecycle/page-activity/browser-agent-activity.ts b/src/main/browser/guest-lifecycle/page-activity/browser-agent-activity.ts index b698b215aab..33bd6cf2ef6 100644 --- a/src/main/browser/guest-lifecycle/page-activity/browser-agent-activity.ts +++ b/src/main/browser/guest-lifecycle/page-activity/browser-agent-activity.ts @@ -9,7 +9,10 @@ import { type BrowserAgentActivityEvent, type BrowserAgentCursorEvent } from '../../../../shared/browser-agent-activity-contract' -import { getActiveRpcCaller } from '../../../runtime/rpc/rpc-active-caller' +import { + getActiveRpcAgentSessionId, + getActiveRpcCaller +} from '../../../runtime/rpc/rpc-active-caller' import { remoteCliBrowserScopeController, type RemoteCliBrowserController @@ -35,6 +38,8 @@ type PageActivity = { idleTimer: ReturnType | null /** The SSH host whose command marked the page last, if it came through the desktop bridge. */ controller: RemoteCliBrowserController | null + /** The chat whose agent marked the page last, when its CLI named one. */ + agentSessionId: string | undefined } /** One page-targeted command, held from when it is queued until it settles. */ @@ -80,12 +85,19 @@ export class BrowserAgentActivity { } let page = this.pages.get(browserPageId) if (!page) { - page = { commands: 0, executing: false, idleTimer: null, controller: null } + page = { + commands: 0, + executing: false, + idleTimer: null, + controller: null, + agentSessionId: undefined + } this.pages.set(browserPageId, page) } page.controller = remoteCliBrowserScopeController() ?? null + page.agentSessionId = getActiveRpcAgentSessionId() // Every command republishes, so a reloaded or newly attached window catches up. - this.publish(browserPageId, true, page.controller) + this.publish(browserPageId, true, page) if (page.idleTimer) { clearTimeout(page.idleTimer) page.idleTimer = null @@ -122,20 +134,22 @@ export class BrowserAgentActivity { /** The agent continues on another page (a closed popup's opener), so its claim moves there. */ handOver(fromPageId: string, toPageId: string): void { const existing = this.pages.get(toPageId) + const from = this.pages.get(fromPageId) // A running command restarts the idle window itself when it settles. - if (!this.pages.has(fromPageId) || (existing && existing.commands > 0)) { + if (!from || (existing && existing.commands > 0)) { return } const page = existing ?? { commands: 0, executing: false, idleTimer: null, - controller: this.pages.get(fromPageId)?.controller ?? null + controller: from.controller, + agentSessionId: from.agentSessionId } this.restartIdleWindow(toPageId, page) if (!existing) { this.pages.set(toPageId, page) - this.publish(toPageId, true, page.controller) + this.publish(toPageId, true, page) } } @@ -251,7 +265,7 @@ export class BrowserAgentActivity { private publish( browserPageId: string, active: boolean, - controller: RemoteCliBrowserController | null = null + { controller, agentSessionId }: Partial = {} ): void { const renderer = this.deps.rendererForPage(browserPageId) if (renderer && !renderer.isDestroyed()) { @@ -259,7 +273,8 @@ export class BrowserAgentActivity { browserPageId, worktreeId: this.deps.worktreeForPage(browserPageId), active, - ...(controller ? { controllerHostLabel: controller.hostLabel } : {}) + ...(controller ? { controllerHostLabel: controller.hostLabel } : {}), + ...(agentSessionId ? { agentSessionId } : {}) } renderer.send(BROWSER_AGENT_ACTIVITY_CHANNEL, event) } diff --git a/src/main/runtime/rpc/dispatcher.ts b/src/main/runtime/rpc/dispatcher.ts index 8ad691b1fda..6262e75373b 100644 --- a/src/main/runtime/rpc/dispatcher.ts +++ b/src/main/runtime/rpc/dispatcher.ts @@ -256,22 +256,26 @@ export class RpcDispatcher { legacyCoordinator?.mutationCallerFingerprint ?? fallbackCallerFingerprint const invoke = (mutation?: DurableMutationInvocation) => { const legacyCoordinatorRunId = legacyCoordinator?.revalidate() - return runWithActiveRpcCaller(context.caller, () => - method.handler(effectiveParams, { - ...context, - authenticatedCallerFingerprint: mutation?.identity.callerFingerprint ?? callerFingerprint, - recordMutationReceipt: mutation?.recordReceipt, - markWorkerDoneMutationEffectFree: mutation?.markWorkerDoneEffectFree, - markMutationEffectPossible: mutation?.markEffectPossible, - orchestrationMutation: mutation?.identity, - replayedMutationReceipt: mutation?.replayedReceipt, - legacyCoordinatorRunId, - legacyCoordinatorAuthority: legacyCoordinator?.authority, - revalidateLegacyCoordinator: legacyCoordinator?.revalidate, - orchestrationCompatibilityCallerAuthority: - compatibility.orchestrationCompatibilityCallerAuthority, - orchestrationCompatibilityEvidence: request.orchestrationCompatibilityEvidence - }) + return runWithActiveRpcCaller( + context.caller, + () => + method.handler(effectiveParams, { + ...context, + authenticatedCallerFingerprint: + mutation?.identity.callerFingerprint ?? callerFingerprint, + recordMutationReceipt: mutation?.recordReceipt, + markWorkerDoneMutationEffectFree: mutation?.markWorkerDoneEffectFree, + markMutationEffectPossible: mutation?.markEffectPossible, + orchestrationMutation: mutation?.identity, + replayedMutationReceipt: mutation?.replayedReceipt, + legacyCoordinatorRunId, + legacyCoordinatorAuthority: legacyCoordinator?.authority, + revalidateLegacyCoordinator: legacyCoordinator?.revalidate, + orchestrationCompatibilityCallerAuthority: + compatibility.orchestrationCompatibilityCallerAuthority, + orchestrationCompatibilityEvidence: request.orchestrationCompatibilityEvidence + }), + request.orchestrationCompatibilityEvidence?.agentSessionId ) } const result = await orchestrationMutations.run( diff --git a/src/main/runtime/rpc/rpc-active-caller.ts b/src/main/runtime/rpc/rpc-active-caller.ts index 51b324d3993..975ec4fbdcc 100644 --- a/src/main/runtime/rpc/rpc-active-caller.ts +++ b/src/main/runtime/rpc/rpc-active-caller.ts @@ -1,14 +1,40 @@ import { AsyncLocalStorage } from 'node:async_hooks' -import type { RpcCallerIdentity } from './rpc-caller-identity' +import { isOrcaSessionId } from '../../../shared/orca-session-address' +import { isAgentRpcCaller, type RpcCallerIdentity } from './rpc-caller-identity' + +type ActiveRpcCall = { + caller: RpcCallerIdentity | undefined + agentSessionId: string | undefined +} // Lets code far below a handler tell an agent's CLI call from a person's relayed input. -const activeCaller = new AsyncLocalStorage() +const activeCall = new AsyncLocalStorage() -export function runWithActiveRpcCaller(caller: RpcCallerIdentity | undefined, run: () => T): T { - return activeCaller.run(caller, run) +export function runWithActiveRpcCaller( + caller: RpcCallerIdentity | undefined, + run: () => T, + claimedAgentSessionId?: string +): T { + // Only this host's CLI can name a chat here; as in the handoff card, other callers act for a person. + const agentSessionId = + isAgentRpcCaller(caller) && claimedAgentSessionId && isOrcaSessionId(claimedAgentSessionId) + ? claimedAgentSessionId + : undefined + return activeCall.run({ caller, agentSessionId }, run) } /** The caller of the RPC handler this code runs under; undefined outside any handler. */ export function getActiveRpcCaller(): RpcCallerIdentity | undefined { - return activeCaller.getStore() + return activeCall.getStore()?.caller +} + +/** The chat whose agent sent this call, as its CLI claims it: display attribution, never authority. */ +export function getActiveRpcAgentSessionId(): string | undefined { + return activeCall.getStore()?.agentSessionId +} + +/** Re-enters this call later, for work a queue runs from inside another caller's call. */ +export function captureActiveRpcCall(): (run: () => T) => T { + const call = activeCall.getStore() + return (run) => (call ? activeCall.run(call, run) : activeCall.exit(run)) } diff --git a/src/renderer/src/components/browser-pane/agent-cursor/browser-agent-activity-state.ts b/src/renderer/src/components/browser-pane/agent-cursor/browser-agent-activity-state.ts index b9f95154d4f..98ce6117002 100644 --- a/src/renderer/src/components/browser-pane/agent-cursor/browser-agent-activity-state.ts +++ b/src/renderer/src/components/browser-pane/agent-cursor/browser-agent-activity-state.ts @@ -14,7 +14,9 @@ type BrowserAgentActivityMark = { pageId: string; revision: number } const activePageIds = new Set() /** The SSH host driving a page through the desktop browser bridge, by its label. */ const controllerHostByPage = new Map() -const lastActivityByWorktree = new Map() +/** Activity no chat claimed: older CLIs, remote hosts and terminal agents. */ +const lastUnclaimedActivityByWorktree = new Map() +const lastActivityByChatSession = new Map() const lastCursorByPage = new Map() const sinksByPage = new Map() const listeners = new Set<() => void>() @@ -37,7 +39,8 @@ export function setBrowserAgentPageActive( browserPageId: string, active: boolean, worktreeId: string | null, - controllerHostLabel?: string + controllerHostLabel?: string, + agentSessionId?: string ): void { if (active) { revision += 1 @@ -47,8 +50,11 @@ export function setBrowserAgentPageActive( } else { controllerHostByPage.delete(browserPageId) } - if (worktreeId) { - lastActivityByWorktree.set(worktreeId, { pageId: browserPageId, revision }) + const mark = { pageId: browserPageId, revision } + if (agentSessionId) { + lastActivityByChatSession.set(agentSessionId, mark) + } else if (worktreeId) { + lastUnclaimedActivityByWorktree.set(worktreeId, mark) } } else { activePageIds.delete(browserPageId) @@ -112,11 +118,15 @@ export function useBrowserAgentControllerHost( return useSyncExternalStore(subscribe, read, read) } -/** What an agent in this worktree drove most recently, while this window has been open. */ +/** What this chat's agent drove most recently; until it has claimed any, what an unclaimed agent in its worktree did. */ export function useLastBrowserAgentActivity( - worktreeId: string | null + worktreeId: string | null, + chatSessionId: string | null ): BrowserAgentActivityMark | null { + // A chat that claimed activity names itself on this host, so unclaimed activity is another agent's. const read = (): BrowserAgentActivityMark | null => - worktreeId ? (lastActivityByWorktree.get(worktreeId) ?? null) : null + (chatSessionId ? lastActivityByChatSession.get(chatSessionId) : undefined) ?? + (worktreeId ? lastUnclaimedActivityByWorktree.get(worktreeId) : undefined) ?? + null return useSyncExternalStore(subscribe, read, read) } diff --git a/src/renderer/src/components/native-chat/tools/runs/NativeChatBrowserPageButton.test.tsx b/src/renderer/src/components/native-chat/tools/runs/NativeChatBrowserPageButton.test.tsx index 50845d73e13..1ef00b0357f 100644 --- a/src/renderer/src/components/native-chat/tools/runs/NativeChatBrowserPageButton.test.tsx +++ b/src/renderer/src/components/native-chat/tools/runs/NativeChatBrowserPageButton.test.tsx @@ -1,6 +1,6 @@ // @vitest-environment happy-dom -import { act, render, screen } from '@testing-library/react' +import { act, render, screen, within } from '@testing-library/react' import type { ReactNode } from 'react' import { describe, expect, it, vi } from 'vitest' import type { BrowserPage } from '../../../../../../shared/browser-workspace-types' @@ -71,4 +71,29 @@ describe('NativeChatBrowserRunPageButton', () => { act(() => setBrowserAgentPageActive('p2', true, 'wt-1')) expect(screen.getByRole('button').getAttribute('title')).toBe('First') }) + + it("ignores other agents driving a different page before this run's command lands", () => { + state.browserPagesByWorkspace = { 'ws-1': [page('p1', 'Mine'), page('p2', 'Theirs')] } + // An earlier run in this chat, so it is known to claim its activity. + setBrowserAgentPageActive('p1', true, 'wt-1', undefined, 'session-1') + const { container } = render( + , + { wrapper } + ) + + act(() => setBrowserAgentPageActive('p2', true, 'wt-1')) + act(() => setBrowserAgentPageActive('p2', true, 'wt-1', undefined, 'session-2')) + act(() => setBrowserAgentPageActive('p1', true, 'wt-1', undefined, 'session-1')) + act(() => setBrowserAgentPageActive('p2', true, 'wt-1')) + expect(within(container).getByRole('button').getAttribute('title')).toBe('Mine') + }) }) diff --git a/src/renderer/src/components/native-chat/tools/runs/NativeChatBrowserPageButton.tsx b/src/renderer/src/components/native-chat/tools/runs/NativeChatBrowserPageButton.tsx index ccd667ade63..d11c156f520 100644 --- a/src/renderer/src/components/native-chat/tools/runs/NativeChatBrowserPageButton.tsx +++ b/src/renderer/src/components/native-chat/tools/runs/NativeChatBrowserPageButton.tsx @@ -62,7 +62,7 @@ function BrowserPageButton({ }): React.JSX.Element | null { const t = useTranslate() const owner = useNativeChatVisualOwner() - const latest = useLastBrowserAgentActivity(owner?.worktreeId ?? null) + const latest = useLastBrowserAgentActivity(owner?.worktreeId ?? null, owner?.sessionId ?? null) // A call appears before its command reaches the browser, so only later activity is its own. const [baseline, setBaseline] = useState(() => startRun(runCallId)) if (baseline.runCallId !== runCallId) { diff --git a/src/renderer/src/hooks/ipc-events/browser-state-ipc-bridge.ts b/src/renderer/src/hooks/ipc-events/browser-state-ipc-bridge.ts index 4efa5d36310..a2158cb750c 100644 --- a/src/renderer/src/hooks/ipc-events/browser-state-ipc-bridge.ts +++ b/src/renderer/src/hooks/ipc-events/browser-state-ipc-bridge.ts @@ -164,8 +164,14 @@ export function registerBrowserStateIpcBridge( // Why: the bootstrap lease is fixed at creation; an agent's page in a hidden worktree must keep drawing while it drives it. const agentActivityPaintHolds = createMainOwnedPaintHolds() const unsubscribeAgentActivity = window.api.browser.onAgentActivity?.( - ({ browserPageId, worktreeId, active, controllerHostLabel }) => { - setBrowserAgentPageActive(browserPageId, active, worktreeId, controllerHostLabel) + ({ browserPageId, worktreeId, active, controllerHostLabel, agentSessionId }) => { + setBrowserAgentPageActive( + browserPageId, + active, + worktreeId, + controllerHostLabel, + agentSessionId + ) agentActivityPaintHolds.set(browserPageId, active) } ) diff --git a/src/shared/browser-agent-activity-contract.ts b/src/shared/browser-agent-activity-contract.ts index bd48faf32e3..3f1e479f2f1 100644 --- a/src/shared/browser-agent-activity-contract.ts +++ b/src/shared/browser-agent-activity-contract.ts @@ -11,6 +11,8 @@ export type BrowserAgentActivityEvent = { active: boolean /** Set while an SSH host's orca CLI drives the page through the desktop browser bridge. */ controllerHostLabel?: string + /** The chat whose agent sent the command; absent for older CLIs, remote hosts and terminal agents. */ + agentSessionId?: string } /** Where the agent is about to act, in the page's CSS px. */ From 0db5747634a6aa5c3bd6a2ed5d26720efdeb7b10 Mon Sep 17 00:00:00 2001 From: OrcaWin Date: Tue, 10 Nov 2026 15:36:37 -0800 Subject: [PATCH 07/11] test: retire low-value renderer projections and unused HTTP fixture (#40915) Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com> --- config/reliability-gates.jsonc | 49 ++-- .../scripts/ci/sharding/ci-shard-timings.json | 4 - .../minimax/minimax-request-context.test.ts | 23 +- ...e-runtime-connect-failure-recovery.test.ts | 32 --- ...-runtime-pty-query-reply-immediate.test.ts | 28 --- .../pty-shutdown-data-suspension.test.ts | 21 -- .../worktree-activation-web-runtime.test.ts | 32 --- .../remote-host-file-delete-repro.test.ts | 182 --------------- .../mirrored-agent-status-clock-skew.test.ts | 12 - ...ssion-tabs-sync-unverifiable-host.test.tsx | 189 ---------------- ...orkspace-layout-frame-editor-views.test.ts | 138 ----------- ...github-pr-manual-refresh-broadcast.test.ts | 6 - .../repos/project-removal-owner-host.test.ts | 15 -- ...pos-ephemeral-vm-cleanup-retention.test.ts | 77 ------- .../cleanup/browser-cleanup-close.test.ts | 43 ---- .../editor-check-details-reading.test.ts | 23 -- .../closing/editor-close-file-cleanup.test.ts | 214 ------------------ .../hosted-review/hosted-review.test.ts | 100 -------- .../slices/tabs/tabs-unread-and-focus.test.ts | 42 ---- .../worktrees-unread-state.test.ts | 117 +--------- ...orkspace-cleanup-removal-preflight.test.ts | 46 ---- .../workspace-activation-preparation.test.ts | 38 ---- ...rees-terminal-pr-exact-observation.test.ts | 37 --- ...trees-terminal-reference-admission.test.ts | 22 -- .../store-worktree-removal-cascade.test.ts | 54 ----- .../worktrees-always-force-delete.test.ts | 57 ----- .../worktrees-removal-state-cleanup.test.ts | 81 ------- .../store-create-tab-start-in-main.test.ts | 16 -- 28 files changed, 30 insertions(+), 1668 deletions(-) delete mode 100644 src/renderer/src/runtime/files/mutations/remote-host-file-delete-repro.test.ts delete mode 100644 src/renderer/src/runtime/web-session-tabs-sync/subscriptions/web-session-tabs-sync-unverifiable-host.test.tsx delete mode 100644 src/renderer/src/runtime/workspace-layout/frames/workspace-layout-frame-editor-views.test.ts delete mode 100644 src/renderer/src/store/slices/editor/closing/editor-close-file-cleanup.test.ts diff --git a/config/reliability-gates.jsonc b/config/reliability-gates.jsonc index 041095770ae..3a31a26d5fb 100644 --- a/config/reliability-gates.jsonc +++ b/config/reliability-gates.jsonc @@ -2586,14 +2586,14 @@ "providers": ["orca-server", "direct-ssh"], "coveredPlatforms": ["macos"], "coveredProviders": ["orca-server", "direct-ssh"], - "coverageNotes": "Audit2056 (sources2054/2055): Intentionally retire these low-value alarms without replacement: src/renderer/src/lib/ephemeral-vm-failed-create-cleanup.test.ts: removes the imported project setup before destroying its VM; retains the VM when setup deletion throws; retains the VM when setup deletion reports no result. Existing unrelated evidenceRuns retain their original scope; unchanged dated receipt objects do not validate changed source bytes or reduced selectors. No fresh gate execution or historical import-closure equivalence is claimed. Exact retired assertionRefs, preserved as historical objects only: {\n \"file\": \"src/renderer/src/lib/ephemeral-vm-failed-create-cleanup.test.ts\",\n \"assertions\": [\"failed or unconfirmed project-host rollback prevents provider destroy\"]\n } Historical prior account (preserved verbatim): Audit1634 removes low-value IPC, filesystem and runtime projections, argument inventories and duplicate examples without equivalent replacement coverage. Per-source reviews record retained cancellation, ownership, authorization, filesystem and SQLite boundaries with injected/native/remote limits. Affected historical receipts are retired; gates without active current evidence are downgraded. Historical scope before this audit: Audit1627 removes low-value mocked daemon projections, scalar tables and duplicate terminal examples without equivalent replacement coverage. Per-source reviews record retained terminal content preservation, process ownership refusal and recovery boundaries together with injected/native/remote limits. Affected historical receipts are retired; gates without active current evidence are downgraded. Historical scope before this audit: Audit1441 removes the complete renderer VM-runtime settings suite: display filter/status/SSH-retry flags, cleanup and stop RPC-to-toast/dialog plumbing, manual-copy plumbing and polling toast silence. The suite did not execute provider teardown or process cancellation. Its rendered stop/retry and hidden-SSH display alarms are intentionally retired; no equivalent replacement or fresh reduced-selector runtime result is claimed. Retained exact unchanged-source receipts remain the only current execution evidence. Reduced selectors have no fresh execution result. Audit1417 intentionally deletes src/renderer/src/lib/ephemeral-vm-workspace-target.test.ts: Loses wrapper-level host rebinding, incompatible provisioned-root refusal and best-effort cleanup-call alarms; all are mock-only orchestration projections. No equivalent replacement coverage or fresh result is claimed. Historical coverage account: Audit1342 changes referenced sources. Retained unchanged-source receipts apply only to their unchanged commands; the reduced selectors have no new execution result. Historical coverage account (not a current claim for changed sources): A pinned exact-source harness runs the pre-#14352 reader and lifecycle service against baseline, affected-main, candidate, and fix-reverted stores. Platform-neutral tests cover store compatibility, user-cancellable cleanup, branch/ref adoption; audit885 removes the direct resume ownership predicate alarms. The direct-SSH provisioned-root Electron journey remains the live transport and destroy proof; this desktop sidecar is not mobile-facing and changes no RPC or remote wire payload. The test-value audit removed the renderer provisioned-root create-options suite. Its two incomplete-identity rejection assertions are lost: one omitted workspaceRunContext and other identity fields, and one supplied the context but omitted ephemeralVmExpectedRefHead. The suite did not test successful option mapping. Retained source-ref and lifecycle suites do not establish equivalent renderer guard coverage. Audit1342: src/renderer/src/lib/ephemeral-vm-runtime-cleanup.test.ts removed. Runtime/SSH ownership, encoded target, retry/failure/listing-error cleanup projection samples disappear. No equivalent replacement coverage is claimed.", + "coverageNotes": "Audit 3292 retires the direct-SSH failed-project retention, managed-server failed-project retention and ordinary confirmed managed-VM destruction/no-repo.rm examples from repos-ephemeral-vm-cleanup-retention.test.ts. Host-scoped same-workspace isolation and stale renderer catalog reconciliation remain byte-identical. These three supplied-result alarms are intentionally lost without equivalent replacement. Existing selectors/assertionRefs, unrelated cross-version rollback receipt and archived complete 122-case cleanup receipt remain exact; no fresh broad runtime, provider, platform or mixed-version result is claimed. Audit2056 (sources2054/2055): Intentionally retire these low-value alarms without replacement: src/renderer/src/lib/ephemeral-vm-failed-create-cleanup.test.ts: removes the imported project setup before destroying its VM; retains the VM when setup deletion throws; retains the VM when setup deletion reports no result. Existing unrelated evidenceRuns retain their original scope; unchanged dated receipt objects do not validate changed source bytes or reduced selectors. No fresh gate execution or historical import-closure equivalence is claimed. Exact retired assertionRefs, preserved as historical objects only: {\n \"file\": \"src/renderer/src/lib/ephemeral-vm-failed-create-cleanup.test.ts\",\n \"assertions\": [\"failed or unconfirmed project-host rollback prevents provider destroy\"]\n } Historical prior account (preserved verbatim): Audit1634 removes low-value IPC, filesystem and runtime projections, argument inventories and duplicate examples without equivalent replacement coverage. Per-source reviews record retained cancellation, ownership, authorization, filesystem and SQLite boundaries with injected/native/remote limits. Affected historical receipts are retired; gates without active current evidence are downgraded. Historical scope before this audit: Audit1627 removes low-value mocked daemon projections, scalar tables and duplicate terminal examples without equivalent replacement coverage. Per-source reviews record retained terminal content preservation, process ownership refusal and recovery boundaries together with injected/native/remote limits. Affected historical receipts are retired; gates without active current evidence are downgraded. Historical scope before this audit: Audit1441 removes the complete renderer VM-runtime settings suite: display filter/status/SSH-retry flags, cleanup and stop RPC-to-toast/dialog plumbing, manual-copy plumbing and polling toast silence. The suite did not execute provider teardown or process cancellation. Its rendered stop/retry and hidden-SSH display alarms are intentionally retired; no equivalent replacement or fresh reduced-selector runtime result is claimed. Retained exact unchanged-source receipts remain the only current execution evidence. Reduced selectors have no fresh execution result. Audit1417 intentionally deletes src/renderer/src/lib/ephemeral-vm-workspace-target.test.ts: Loses wrapper-level host rebinding, incompatible provisioned-root refusal and best-effort cleanup-call alarms; all are mock-only orchestration projections. No equivalent replacement coverage or fresh result is claimed. Historical coverage account: Audit1342 changes referenced sources. Retained unchanged-source receipts apply only to their unchanged commands; the reduced selectors have no new execution result. Historical coverage account (not a current claim for changed sources): A pinned exact-source harness runs the pre-#14352 reader and lifecycle service against baseline, affected-main, candidate, and fix-reverted stores. Platform-neutral tests cover store compatibility, user-cancellable cleanup, branch/ref adoption; audit885 removes the direct resume ownership predicate alarms. The direct-SSH provisioned-root Electron journey remains the live transport and destroy proof; this desktop sidecar is not mobile-facing and changes no RPC or remote wire payload. The test-value audit removed the renderer provisioned-root create-options suite. Its two incomplete-identity rejection assertions are lost: one omitted workspaceRunContext and other identity fields, and one supplied the context but omitted ephemeralVmExpectedRefHead. The suite did not test successful option mapping. Retained source-ref and lifecycle suites do not establish equivalent renderer guard coverage. Audit1342: src/renderer/src/lib/ephemeral-vm-runtime-cleanup.test.ts removed. Runtime/SSH ownership, encoded target, retry/failure/listing-error cleanup projection samples disappear. No equivalent replacement coverage is claimed.", "motivatingLinks": [ "https://linear.app/stably/issue/STA-4274", "https://github.com/stablyai/orca/pull/14352", "https://github.com/stablyai/orca/issues/13044" ], "invariant": "A sidecar written by the new build cannot make the previous production build lose otherwise compatible VM runtimes. Downgrade lifecycle writes remain authoritative after re-upgrade, provisioned-root metadata remains recoverable, and corrupt or future feature metadata is preserved without poisoning the rollback-readable v1 store. Destroy attempts have no automatic wall-clock cutoff; a user stop terminates the process tree, retains cleanup ownership, and permits a fresh retry. Provider failure retains the SSH/project context needed for safe cleanup. Unrecoverable recipe context releases only the hidden SSH registration while preserving lifecycle/provider metadata. Provisioned-root create receives the source ref's pinned commit, adoption verifies the requested branch/ref, and resume preserves the connection mode plus stable SSH ownership identity while allowing endpoint rotation.", - "oracle": "Audit2056 (sources2054/2055): Intentionally retire these low-value alarms without replacement: src/renderer/src/lib/ephemeral-vm-failed-create-cleanup.test.ts: removes the imported project setup before destroying its VM; retains the VM when setup deletion throws; retains the VM when setup deletion reports no result. Existing unrelated evidenceRuns retain their original scope; unchanged dated receipt objects do not validate changed source bytes or reduced selectors. No fresh gate execution or historical import-closure equivalence is claimed. Exact retired assertionRefs, preserved as historical objects only: {\n \"file\": \"src/renderer/src/lib/ephemeral-vm-failed-create-cleanup.test.ts\",\n \"assertions\": [\"failed or unconfirmed project-host rollback prevents provider destroy\"]\n } Historical prior account (preserved verbatim): Retained exact unchanged-source receipts remain the only current execution evidence. Reduced selectors have no fresh execution result. Historical pre-audit oracle account for changed sources: The retained unchanged-source receipts are the only current execution evidence; reduced-source assertions await validation. Historical oracle account (not a current claim for changed sources): Write one ordinary schema-v1 runtime and one provisioned-root runtime. Require the exact pre-#14352 reader to return both, run the old destroy lifecycle against the projected provisioned record, then require the candidate to retain the cleaned state while restoring schema-v2 and checkout-mode metadata. The same old reader must reject affected-main and fix-reverted bytes. Malformed, oversized, unknown-record, and future-version feature sidecars must leave rollback-compatible records accessible and must not be overwritten during compatible lifecycle mutations. Require destroy to have no implicit deadline, stop a hung destroy through the public desktop action, require cleanup_failed plus a fresh successful retry, prove provider or project-host rollback failure retains every ownership record required to retry, and prove missing recipe context cannot leave an unremovable hidden SSH registration. Supply the source ref's captured commit to create, reject a provisioned checkout on the wrong branch/ref, and reject a resume that changes connection mode or SSH ownership.", + "oracle": "Audit 3292 retires the direct-SSH failed-project retention, managed-server failed-project retention and ordinary confirmed managed-VM destruction/no-repo.rm examples from repos-ephemeral-vm-cleanup-retention.test.ts. Host-scoped same-workspace isolation and stale renderer catalog reconciliation remain byte-identical. These three supplied-result alarms are intentionally lost without equivalent replacement. Existing selectors/assertionRefs, unrelated cross-version rollback receipt and archived complete 122-case cleanup receipt remain exact; no fresh broad runtime, provider, platform or mixed-version result is claimed. Audit2056 (sources2054/2055): Intentionally retire these low-value alarms without replacement: src/renderer/src/lib/ephemeral-vm-failed-create-cleanup.test.ts: removes the imported project setup before destroying its VM; retains the VM when setup deletion throws; retains the VM when setup deletion reports no result. Existing unrelated evidenceRuns retain their original scope; unchanged dated receipt objects do not validate changed source bytes or reduced selectors. No fresh gate execution or historical import-closure equivalence is claimed. Exact retired assertionRefs, preserved as historical objects only: {\n \"file\": \"src/renderer/src/lib/ephemeral-vm-failed-create-cleanup.test.ts\",\n \"assertions\": [\"failed or unconfirmed project-host rollback prevents provider destroy\"]\n } Historical prior account (preserved verbatim): Retained exact unchanged-source receipts remain the only current execution evidence. Reduced selectors have no fresh execution result. Historical pre-audit oracle account for changed sources: The retained unchanged-source receipts are the only current execution evidence; reduced-source assertions await validation. Historical oracle account (not a current claim for changed sources): Write one ordinary schema-v1 runtime and one provisioned-root runtime. Require the exact pre-#14352 reader to return both, run the old destroy lifecycle against the projected provisioned record, then require the candidate to retain the cleaned state while restoring schema-v2 and checkout-mode metadata. The same old reader must reject affected-main and fix-reverted bytes. Malformed, oversized, unknown-record, and future-version feature sidecars must leave rollback-compatible records accessible and must not be overwritten during compatible lifecycle mutations. Require destroy to have no implicit deadline, stop a hung destroy through the public desktop action, require cleanup_failed plus a fresh successful retry, prove provider or project-host rollback failure retains every ownership record required to retry, and prove missing recipe context cannot leave an unremovable hidden SSH registration. Supply the source ref's captured commit to create, reject a provisioned checkout on the wrong branch/ref, and reject a resume that changes connection mode or SSH ownership.", "commands": [ "node config/scripts/runtime-verification/ephemeral-store/run-ephemeral-vm-runtime-store-rollback-repro.mjs config/scripts/runtime-verification/ephemeral-store/ephemeral-vm-runtime-store-cross-version.test.ts", "pnpm exec vitest run --config config/vitest.config.ts src/shared/ephemeral-vm-runtime-store.test.ts src/shared/ephemeral-vm-runtime-store-rollback.test.ts src/shared/ephemeral-vm-recipe-process.test.ts src/main/ephemeral-vm/runtime-service.test.ts src/main/ephemeral-vm/recipe-runner.test.ts src/main/ephemeral-vm/runtime-ssh-cleanup.test.ts src/main/ipc/ephemeral-vm-runtime-handler-cleanup.test.ts src/main/ipc/ephemeral-vm-provision-cancel.test.ts src/main/ipc/ephemeral-vm-provisioned-root-ref.test.ts src/main/ipc/ephemeral-vm.test.ts src/renderer/src/store/repos/repos-ephemeral-vm-cleanup-retention.test.ts", @@ -2720,7 +2720,8 @@ "Audit1417 intentionally deletes src/renderer/src/lib/ephemeral-vm-workspace-target.test.ts: Loses wrapper-level host rebinding, incompatible provisioned-root refusal and best-effort cleanup-call alarms; all are mock-only orchestration projections. No equivalent replacement coverage or fresh result is claimed.", "Audit1853 accepts removal of the runtime-ssh-cleanup.test.ts alarm for repairing cleanup_failed/provider-succeeded records that already lack a target ID. No equivalent replacement coverage is claimed. Keep the surviving cleanup selector and unchanged cross-version rollback receipt; the historical 2026-08-14 122-case cleanup receipt remains archived verbatim in knownGaps.", "Audit1863 removes the standalone default-source-ref provisioning example. Its direct default-ref pinning alarm is intentionally lost; selected-ref pinning and invalid-ref cases remain without an equivalent replacement claim. Focused survivor execution does not validate the broad rollback selector or physical cross-version provisioning. Existing receipts retain their original commands and counts.", - "Audit2056 (sources2054/2055): Intentionally retire these low-value alarms without replacement: src/renderer/src/lib/ephemeral-vm-failed-create-cleanup.test.ts: removes the imported project setup before destroying its VM; retains the VM when setup deletion throws; retains the VM when setup deletion reports no result. Existing unrelated evidenceRuns retain their original scope; unchanged dated receipt objects do not validate changed source bytes or reduced selectors. No fresh gate execution or historical import-closure equivalence is claimed. Exact retired assertionRefs, preserved as historical objects only: {\n \"file\": \"src/renderer/src/lib/ephemeral-vm-failed-create-cleanup.test.ts\",\n \"assertions\": [\"failed or unconfirmed project-host rollback prevents provider destroy\"]\n }" + "Audit2056 (sources2054/2055): Intentionally retire these low-value alarms without replacement: src/renderer/src/lib/ephemeral-vm-failed-create-cleanup.test.ts: removes the imported project setup before destroying its VM; retains the VM when setup deletion throws; retains the VM when setup deletion reports no result. Existing unrelated evidenceRuns retain their original scope; unchanged dated receipt objects do not validate changed source bytes or reduced selectors. No fresh gate execution or historical import-closure equivalence is claimed. Exact retired assertionRefs, preserved as historical objects only: {\n \"file\": \"src/renderer/src/lib/ephemeral-vm-failed-create-cleanup.test.ts\",\n \"assertions\": [\"failed or unconfirmed project-host rollback prevents provider destroy\"]\n }", + "Audit 3292 retires the direct-SSH failed-project retention, managed-server failed-project retention and ordinary confirmed managed-VM destruction/no-repo.rm examples from repos-ephemeral-vm-cleanup-retention.test.ts. Host-scoped same-workspace isolation and stale renderer catalog reconciliation remain byte-identical. These three supplied-result alarms are intentionally lost without equivalent replacement. Existing selectors/assertionRefs, unrelated cross-version rollback receipt and archived complete 122-case cleanup receipt remain exact; no fresh broad runtime, provider, platform or mixed-version result is claimed." ], "demotionRule": "Demote if a new write fails the pinned rollback reader, a downgrade lifecycle mutation is lost after re-upgrade, malformed/future metadata overwrites recoverable bytes, ordinary v1 bytes change, user stop cannot settle a destroy process tree, cleanup loses retry ownership, an unrecoverable context leaves a permanent hidden SSH registration, or the focused gate flakes without an identified harness defect." }, @@ -4201,10 +4202,10 @@ "providers": ["remote-runtime"], "coveredPlatforms": ["macos"], "coveredProviders": ["remote-runtime"], - "coverageNotes": "Audit 3283 removes 20 authored declarations and 31 expanded scenarios, including two whole suites. Retired alarms cover PR refresh-state pruning, shared runtime subscription cleanup and store isolation, language content-change routing and older completion ownership, ordinary panel retry-timer cleanup and pending loading, four hosted-review lifetime permutations, mocked terminal creation error/order wiring, five sleep-inventory variants with pending-frame-only assertions, palette fallback/composite highlights, Windows/UNC encoded-editor input rows, mixed-repository partial failure counts, title setters and generated-title bypass/replacement, five window-close coordinator delegation/guard/finally branches, and ambiguous-old-record frame reveal. These regression checks are intentionally lost under the test-value audit; retained cases are not equivalent replacements. Prior coverage notes and receipts remain historical. Audit 3273 removes 14 authored declarations and 19 expanded scenarios across four whole suites and eight partial suites. Retired alarms cover saved-local cancellation/layout ownership, ambiguous-owner warning reset, folder attachment routing, VM false-capability bypass, abandoned reveal warmup cleanup and viewport claim deduplication/rearming, quiet unrelated remote-removal refusal, startup-command one-shot consumption, repository/floating recovery-ledger rows, fake-React pinned-scroll intent, split-ratio state identity/subscriber suppression and fractional change, cross-host project-group join refusal, three PR request-lifetime permutations, upstream-status preservation on error, and unresolved Git-owner refusal. These regression checks are intentionally lost under the test-value audit; retained scenarios are not equivalent replacements. Historical coverage receipts remain historical, including gate35 subscriber claims. Audit 3256 removes these specific alarms from the broad root unit commands: skill dialog active-share selection, close and pending-share handoff; simple keyed-record deletion; marker live-region insertion, simple landing and nine baseline policy examples; General search/control navigation inventory; orphan-count cache bootstrap; seven Codex code classifications and HTTP 429 warning mapping; two skill unread-root verdict examples; peer-mail payload and conversation-ID rejection; and the GitHub organization TABLE text-field optimistic rollback/failed-envelope example. These include real behaviors; retained tests do not provide equivalent coverage for every removed scenario. Mobile losses are recorded separately and are not coverage of these root commands. Audit3246 retires NewRowsMarker reveal/no-repeat and pane-scoped beforeinput checks; skill-owner option availability/count/dedup/order; six styled Input/Textarea IME forwarding rows; the static Codex/OpenCode smart-key inventory; tab-map AST ratchet diagnostic fixtures; child-roster work-budget and retained-aggregate alarms; malformed persisted floating-cwd fallback/no-crash/empty exact-root checks; the unanswered-host empty-list discriminator; the direct invalidated-cache commit-false assertion; one redundant digit-keyup IME row; cached non-supported Claude title-generator rows; and the duplicate late naming-result singleton. These root broad commands lose those specific alarms without equivalent replacement. Distinct retained owner/state checks have their own bounded claims; the real scheduler still rejects stale response data, while the direct false-return alarm is retired. Audit3231 retires supported-host restore-pane key mapping, closed/open creation-sidebar toggle visibility, unrelated scope-error/null classification and quick-submit reveal/no-create checks. These broad commands lose those real narrow alarms; no replacement coverage is claimed. Audit3219 removes the synthetic Cmd+J extra-source suite; this broad command no longer checks its match/tie placement and selection, announced count, empty-query cap, or workspace hiding with retained recent tabs. No replacement coverage is claimed. Audit3209 composes approved sources3202/3206: deliberately retires seven authored/expanded cases in four whole suites without equivalent replacement. Work-item queries lose real GitHub/GitLab oversized ASCII secret-prefix empty-query and whitespace-before-trim refusal alarms; inputs share the imported size bound and exercise only its fast length branch, with no multibyte or actual provider/exposure guarantee. Skill sharing loses complete/partial managed-bundle and destination-ambiguity association checks plus three negative origin/path/scheme admission examples; these do not establish uploaded contents, arbitrary-URL fetching, authorization or execution. Retain exact originless-project direct-link fallback, cloud-delete confirmation, bundled-target repair/owner isolation and explicit Windows-host preference over stale WSL suites. Rejected3201 runtime-preference removal is excluded. No real cloud/network/host/disk, mobile or mixed-version execution validation is claimed. Audit3200 composes approved source3194: deliberately retires thirteen authored registrations/twenty-seven expanded cases in six whole automation host/list policy suites without equivalent replacement. Real RPC category/retryability and wrapped-timeout recognition, unscoped-failure/scoped-success health evidence precedence, exact-ID create selectors and per-run workspace omission, paired-web local/SSH/absent host catalog routing, incompatible/removed/unhydrated/offline execution health, runtime-before-nested-SSH recovery dispatch, and no-owned-focus/successor/foreign-list focus policy alarms are consciously lost. Retain exact20line orphan allow/refuse/precondition and exact90line cross-host same-ID search suites. No retry-timer/fence lifecycle, actual reconnect/network/write delivery, native focus, mobile/mixed-version runtime or disk persistence coverage is claimed. Audit3191 combines approved source3182/3187/3188: deliberately retires thirteen authored Vitest registrations and fifteen expanded cases, including five whole suites, without equivalent replacement. Attachment intake loses real portal/native-capture terminal interception and unowned-container refusal, immediate child-only committed availability/claim-ref negotiation and delivery, and direct-target over stable focused/background composer routing through disable/re-enable/remount and independent question focus. Exact destination/cache/draft and final-stat owner/workspace/File-release suites remain; they do not replace Surface recipient routing. Automation authoring loses destination runtime catalog membership, local/direct-SSH exclusion of paired-runtime repos, unknown-runtime empty catalog, logical project/host/setup/repo/path context payload, and missing/nonready setup refusal; these were genuine direct helper alarms, while exact schedule transformation, legacy schedule and setup-decision suites remain. Agent picker loses setup-chat/terminal/missing-installer/unsupported-or-unknown-host row projection samples and the ordinary unsearched menu variant; the entire original26-line resume recipe suite remains, including reported bypass versus default/absent permission modes, as does the exact search-result menu callback with its fixtures, model/effort commits and staged Arguments reopen outcome. Rejected predecessor3180 full recipe deletion is excluded. No actual native drag/cursor/focus/IME, upload bytes or disk/restart persistence, full automation save/scheduler/runtime transport, real resume-process flags/environment delivery, or native menu/rendered layout validation is claimed. Audit3178 combines source3169/3170/3175: deliberately retires eight authored units (six Vitest cases and two imperative custom relay scenarios), including two whole suites, without equivalent replacement. Voice Section loses per-model pending-delete isolation across interleaved A/B completion and the two-success refresh-call alarm; exact VoicePane delayed key-clear/newer enabled-toggle merge remains and does not replace row deletion coverage. Speech loses dedicated rating-scale/inclusive-ceiling, unsupported-versus-unmeasured, explicit/system-language precedence/locale alias, accuracy versus fast named/default/best-measured selection, and unmeasured/no-match examples; exact offered-user-pick versus retired-selection case and its fixture remain. Relay loses legacy ping-delivery count/liveness sampled before the silence deadline and grouped malformed Bearer/host-ID 401/429 routing checks; twelve real Worker/DurableObject/shipped-client scenarios remain, not equivalent replacement for those narrow alarms. Six prior speech cases are not all deleted: approved successor3175 keeps the original user-choice case. No actual credential/file persistence, native/GPU/engine/download delivery, production assignment policy or deployed-runtime validation is claimed by this reduction. Audit3165 combines source3160/3162: deliberately retires six authored/expanded cases across three whole suites without equivalent replacement. Launch/status losses: observed React-render pending/resuming coordination across settings and deferred offer read; stale-offer reread suppressing dialog reopen; held-local-chat recovery visibility with new-chat preferences off; disabled-local admission avoiding offer RPC despite an injected but unconsumed paired-tab fixture; and run-only lost-reply uncertainty reachability until direct viewed-run retirement. Launch probe does not prove arbitrary synchronous-store atomicity, the paired fixture is not remote runtime enrollment, and the status case directly marks viewed state rather than rendering the summary. Crew-hook losses: old-host method_not_found cache persists across party changes but is released by independently supplied connection generation/verified pairing status or pairing revision, with actual frame publication and teardown. These are real narrow coordination, admission, uncertainty and mixed-version cache alarms consciously lost. Exact web verified-runtime writer handoff guard remains; it does not replace those alarms or prove live host/native/mobile delivery. Audit3156 combines3147/3150/3152/3153/3154: deliberately retires39authored/40expanded native-chat recovery cases, eight whole suites and two orphan test-support files without equivalent replacement. Lost alarms: lost-reply unconfirmed reconciliation, skipped rows/counts and missed-frame repair, unknown/pending outcome and omitted-failure-list compatibility, uncertain history after dismissal, retry/refusal/dismiss lifecycle, hidden/consumed picker ownership, result-tree keyboard focus/disclosure and all-skipped retirement; unconfirmed-over-conflict guidance and failed-chat changes despite older host timestamps; nearest-listed ancestor/cyclic forest shape, descendant membership, host ordering/missing-host local fallback; skipped/readiness/admission counts, provisional skip/progress monotonicity, early per-chat verdicts with batch pending protection, older-host waiting, start-slot/delivery distinction, retry-over-failure and unknown-after-withdrawal attention; remote snooze/reconnect/reoffer, unseen mixed summary through open/close, watched completion retirement, new success beside old failure, failed-reread mixed-result preservation, filter/collapse completion resets, retry summary replacement and current-offer/history selection; cross-host workspace identity, rendered cyclic reachability, nested tri-state/toggle propagation, project eligibility isolation and collapse preserving selection. Exact fallback-list completion barrier, batched verdict/cleanup retention, stale-read versus dismissal publication race, and requested-but-never-rendered finished-run retirement remain; they do not replace retired alarms. Audit3146 combines source reviews3132/3133/3135/3138/3143: intentionally retire20authored/31expanded cases without equivalent replacement. Provider-session losses: structured-native terminal-resume exclusion, metadata-less completed identity, new-turn completion clearing, Pi provider-only/periodic/manual promotion, changed-transcript launch-config isolation, Pi/omp/prime-agent completed-session remote/manual-shutdown promotion, and quit/done precedence over heartbeat. Side-thread/question losses: finished-pane acquisition, hidden title/recap states, local/relay/relay-done conversation takeover with prompt/session/child resets, plain-message abandonment, compaction/session replacement and completion resets. Codex startup losses: incoming-owner cached child replacement, old-relay foreign live-session correction, completed foreign-root turn-fact permutations. Transcript losses: real temporary-JSONL partial sibling/final-child completion, unlabelled child attribution, compact cached replay preservation and100/1000completed-child roster retention/release. Compiler-ratchet losses: valid-line uncompiled-list parser grammar examples and injected-existence stale-path filtering; these did not exercise actual filesystem canonicalization or build exclusion. These are real lifecycle, ownership, replay, liveness and retention alarms, including recent#40246 regressions, deliberately lost. Retained conditional record replacement, clockless root/SSH owner isolation, persisted main-thread fork rejection, partial/final question-answer lifetime, cached-roster/missing-ID/live HTTP/durable startup boundaries and restarted-relay refusal/acceptance do not replace those losses. No native/SSH/WSL execution or equivalent coverage is claimed. Audit3128 scoped coverage reduction: Audit3121 removes VoiceDictationLanguageSetting.test.tsx (Spanish-to-es callback and unsupported-model Korean option presence) and voice-speech-model-rows.test.ts (provider/language-order/retired-on-disk list policy); these real narrow alarms are deliberately retired without replacement. VoiceSpeechModelSection per-model concurrent deletion remains unchanged. Audit3122 removes the direct absolute/parent-segment sparse-directory exception-type sample and the five-row IPC sparse-preset error-code/non-save table (two authored/six expanded cases). Those real typed-validation and IPC refusal/error-code alarms are deliberately retired. Keep both real symlink/junction floating-directory trust cases and the minimal RPC structured validation-reason serialization case. The RPC case does not replace IPC save/refusal behavior, typed normalization for both path inputs, actual Git sparse checkout or rendered localization. No equivalent replacement or fresh test/runtime/platform/remote/performance validation is claimed. Audit3124 removes ExperimentalPane.test.tsx (ordinary Pet switch callback), WorkspaceDirectorySetting.test.tsx (padded absolute saved-path normalization/no-write blur), and repository-search.perf.test.ts (navigation/selected-pane builder-call policy, fixture cardinality/nonempty entries and renamed project keyword inclusion). These real narrow alarms are retired without replacement; RepositoryPane.search.test.tsx search-to-sparse-editor request remains unchanged. Audit3129: resolver Windows case-insensitive and POSIX case-sensitive configured-env composition plus mocked-base launch-preflight Windows composition are intentionally no longer checked by the two deleted suites. No equivalent coverage claimed. Keep runtime-structured-agent-host-env.test.ts unchanged: configured Windows Claude-home account identity and host-account precedence remain checked. Audit3114 incorporates source3101: retire three structured Claude child-environment wrapper cases covering inherited stamp isolation/default and explicit entrypoint, Windows SDK-key canonicalization/default/duplicate-key order, and configured lookup/final environment/config-dir conjunction. Keep direct auth/session sanitation and Windows-versus-Linux overlay checks, actual executable lookup from supplied inherited PATH, native Windows child environment delivery, and stale option-mutation fencing. These are not equivalent replacements for the retired wrapper alarms. No fresh test/runtime, real login-shell probe, Claude SDK startup, remote/mixed-version, UI or performance result is claimed. Audit3114 incorporates source3105: retire 17 authored/20 expanded daemon launch-note cases, including the entire two-case SessionLaunchNote suite. Deliberately lose split-marker carry across same-token re-arm, stale-token retirement refusal, foreground tri-state and serial settlement, omitted-note/no-incarnation mixed-version policy, sticky retirement, first-incarnation/replacement launch preservation and held-launch precedence. Keep only the unchanged unresolved foreground-read race against a later finished attach. Supplied notes/foreground and runtime calls do not establish actual daemon/main restart, SSH, native Windows observation, mobile UI, equivalent replacement or fresh runtime/performance validation. Audit3114 incorporates source3109: retire six authored/35 expanded pricing cases: 21 accepted model-name examples, 10 unsupported/future-model fail-closed examples, malformed TTL clamp, unknown-model estimate refusal, flat-model long-context disregard and oversized long-context clamp. Keep mixed five-minute/one-hour write allocation and short/all-long/mixed long-context allocation with original fixed oracles. Real parser/refusal/bounds alarms are knowingly lost without equivalent replacement; retained tests do not validate provider rates, actual billing or request threshold classification. Preserve the archived usage-scan-append source-freeze receipt without transferring historical execution/performance credit. No fresh runtime result is claimed. Audit3108 source-only reduction (3094/3095/3100): retire 27 authored/30 expanded cases, including complete markdown view-state, file-preview link-open and CLI agent-server-route suites, without replacement. Deliberate losses include preview visibility/reference lifetime and same-path owners; SSH stat, directory/missing-target, explicit-null owner, nonmarkdown line/column, local URI routing, remote-to-client guard and same-file reuse; document-preview source-owner/folder/reuse routing, stable grant location and outside-workspace POSIX/Windows request projection; and verified remote CLI send/check refusal, suggested --on argv/copy, shell no-probe bypass, unverified-launch admission and older-peer refusal. Retain two markdown source-runtime/qualified-reveal alarms, one stale grant-rejection fence and two remote read/mutation evidence policies, with original callbacks. Final last-wins reveal did not prove transient cancellation; CLI prerequisite did not prove no real send, and envelope tests do not execute server refusal. No fresh runtime, rendered UI, actual file/SSH/paired transport, authorization, mixed-version or performance result is claimed. Audit3096 source-only reduction (3087/3088): retire 69 authored/76 expanded cases, including complete recovery-portals and reconnect-banner suites. Intentionally lose dead/default TUI replay, generated alternate-frame style composition, reset/mode/dimension and legacy missing-mode-boundary alarms, UI notice/action/reveal policies, and isolated recovery lifecycle variants, without equivalent replacement. Retained registrations and callbacks are unchanged; headless cells are not pixels, and no fresh runtime, host, SSH, WSL, rendered-app or performance result is claimed. Audit3086 source-only reduction (3079/3080/3081): intentionally retire 93 authored/100 expanded mock-boundary cases, including the complete spawn-errors and SSH reconnect overlay suites, without replacement. Retired alarms include spawn classification/ownership, reply ceilings and renderer-write failure recovery, disconnect/detach fencing branches, authority facts, and overlay retry/visibility wiring. Retained callbacks are unchanged; no fresh execution, real PTY/SSH, rendered UI, or performance result is claimed. Audit2432: The broad unit command loses the isolated BranchPicker open-change notification sample. Its unique true/false callback alarm is intentionally retired; reopening/status-refresh behavior was not exercised. No equivalent replacement or fresh validation of the reduced selector is claimed. Audit2425: The broad unit command loses the workspace-copy-status supplied readError forwarding sample. It did not exercise the branch-switch blocking promised by its title. This alarm is intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2417: The broad unit command loses two ordinary clean Git cherry-pick/revert success samples and two terminal startup foreground-read work-budget samples. These unique alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2412: The broad unit command loses the whole six-case fake-React-hook scroll-anchor suite, two generic draft-retention samples, a simple new-agent order sample, a real history-publication batching-count sample, an unmounted handoff abort/timer sample and three basic WSL preview/error samples. These alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2404: The broad unit command loses the standalone share-name lookup 503 propagation suite, initial deletion placement-kind sample, direct changed-mtime stale sample, first-pass rollback existence example and abandoned-preparation directory sample. These exact alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2397 review amendment: The broad unit command loses three standalone suites, two partial-case definitions and two URL table rows across package/download/placement tests. Keep initial wrong-port authorization, modified independent-copy digest refusal and abort-after-begin cancellation dispatch. The remaining alarms are deliberately retired; no equivalent complete replacement or fresh validation of the reduced selector is claimed. Audit2393 current-parent refresh2401: Remove the basic skill-install service alias sample and original public managed-remove receiptless refusal case. Preserve the upstream request ownership suite and transaction interruption coverage. No equivalent complete replacement or fresh validation of the reduced selector is claimed. Audit2389: The broad unit command loses the missing-preview suite, plain-global destination sample and prepublished-receipt recovery example. No equivalent replacement or fresh validation of the reduced selector is claimed. Audit2385: The broad unit command loses four authored walker/staging/protocol examples (six expanded cases); no equivalent replacement or fresh validation is claimed for the reduced suite. Audit2383: The unscoped Vitest command no longer includes the removed Antigravity catalogue suite; its exact provider-root/owner example has no equivalent replacement or fresh validation claim. Audit2377/2381: The unscoped Vitest command includes the reduced bundled-skill and native-discovery suites; the eight removed backup/legacy/catalogue/symlink/SSH-builder examples have no replacement-equivalence or fresh validation claim here. Audit2133 current-parent preparation: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2095 current-parent preparation2126: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit1640 removes low-value IPC, SSH, workspace and transcript-watcher tests without equivalent replacement coverage. Per-source reviews record retained public refusal, cancellation, execution-host and real-filesystem outcomes with injected/native/remote limits. Affected historical receipts are retired; gates without active current evidence are downgraded. Historical scope before this audit: Deterministic main-IPC contract tests cover disconnect-driven close delivery, exactly-once close, per-subscription teardown isolation against a failing socket close and a throwing liveness probe, containment of a throwing renderer send on the unguarded host-close path, and continued suppression of stale payloads from a retired transport. A headed paired-server journey (real Orca host plus a separate paired Orca desktop client) covers hidden-but-mounted reveal, cold-parked reveal, and cold-parked reveal across a disconnect/reconnect. Live Linux and Windows paired-server evidence and real sleep/wake transport loss remain uncollected.", + "coverageNotes": "Audit 3292 combines adopted 3285/3287/3289/3293 removals: 40 authored declarations and 47 expanded scenarios, including whole frame-editor-view, ambiguous remote-delete-refusal, unverifiable-host subscription and editor-close cleanup suites. The previously reviewed dock-badge suite was already removed upstream in PR 40895 and receives zero new removal credit. Intentionally retired alarms include background browser selection and last-tab landing; main startup fallback, SSH project cleanup/survivor routing, exact-PR contradiction/saved-push positives, replay/sidecar rollback and wrapped remote error normalization; records/snapshot missing-diff hydration, ambiguous folder-owner delete refusal, focus no-op notifications, nested editor context-only cache check, pending broadcast-first status and ordinary four-confirmation aggregation; preview-source frontmatter pruning, approved local/runtime agent dispatch, non-GitHub legacy PR cache invalidation, stale merged-head transient-error fallback, empty-queue immediate query reply and unverified-to-concrete preflight risk. Additional intentionally retired alarms are injected host subscription/unsubscribe counts, synthetic editor reveal/draft/fallback/scoped close, ambiguous unread refusals and hidden mark/read roundtrip, immediate connect backoff/noError, positive mirrored evidence-clock renewal, supplied VM failure/success projections and git-local/folder-SSH wake permutations. Remaining temporal/ownership cases are narrower; no equivalent replacement or fresh execution is claimed. Audit 3283 removes 20 authored declarations and 31 expanded scenarios, including two whole suites. Retired alarms cover PR refresh-state pruning, shared runtime subscription cleanup and store isolation, language content-change routing and older completion ownership, ordinary panel retry-timer cleanup and pending loading, four hosted-review lifetime permutations, mocked terminal creation error/order wiring, five sleep-inventory variants with pending-frame-only assertions, palette fallback/composite highlights, Windows/UNC encoded-editor input rows, mixed-repository partial failure counts, title setters and generated-title bypass/replacement, five window-close coordinator delegation/guard/finally branches, and ambiguous-old-record frame reveal. These regression checks are intentionally lost under the test-value audit; retained cases are not equivalent replacements. Prior coverage notes and receipts remain historical. Audit 3273 removes 14 authored declarations and 19 expanded scenarios across four whole suites and eight partial suites. Retired alarms cover saved-local cancellation/layout ownership, ambiguous-owner warning reset, folder attachment routing, VM false-capability bypass, abandoned reveal warmup cleanup and viewport claim deduplication/rearming, quiet unrelated remote-removal refusal, startup-command one-shot consumption, repository/floating recovery-ledger rows, fake-React pinned-scroll intent, split-ratio state identity/subscriber suppression and fractional change, cross-host project-group join refusal, three PR request-lifetime permutations, upstream-status preservation on error, and unresolved Git-owner refusal. These regression checks are intentionally lost under the test-value audit; retained scenarios are not equivalent replacements. Historical coverage receipts remain historical, including gate35 subscriber claims. Audit 3256 removes these specific alarms from the broad root unit commands: skill dialog active-share selection, close and pending-share handoff; simple keyed-record deletion; marker live-region insertion, simple landing and nine baseline policy examples; General search/control navigation inventory; orphan-count cache bootstrap; seven Codex code classifications and HTTP 429 warning mapping; two skill unread-root verdict examples; peer-mail payload and conversation-ID rejection; and the GitHub organization TABLE text-field optimistic rollback/failed-envelope example. These include real behaviors; retained tests do not provide equivalent coverage for every removed scenario. Mobile losses are recorded separately and are not coverage of these root commands. Audit3246 retires NewRowsMarker reveal/no-repeat and pane-scoped beforeinput checks; skill-owner option availability/count/dedup/order; six styled Input/Textarea IME forwarding rows; the static Codex/OpenCode smart-key inventory; tab-map AST ratchet diagnostic fixtures; child-roster work-budget and retained-aggregate alarms; malformed persisted floating-cwd fallback/no-crash/empty exact-root checks; the unanswered-host empty-list discriminator; the direct invalidated-cache commit-false assertion; one redundant digit-keyup IME row; cached non-supported Claude title-generator rows; and the duplicate late naming-result singleton. These root broad commands lose those specific alarms without equivalent replacement. Distinct retained owner/state checks have their own bounded claims; the real scheduler still rejects stale response data, while the direct false-return alarm is retired. Audit3231 retires supported-host restore-pane key mapping, closed/open creation-sidebar toggle visibility, unrelated scope-error/null classification and quick-submit reveal/no-create checks. These broad commands lose those real narrow alarms; no replacement coverage is claimed. Audit3219 removes the synthetic Cmd+J extra-source suite; this broad command no longer checks its match/tie placement and selection, announced count, empty-query cap, or workspace hiding with retained recent tabs. No replacement coverage is claimed. Audit3209 composes approved sources3202/3206: deliberately retires seven authored/expanded cases in four whole suites without equivalent replacement. Work-item queries lose real GitHub/GitLab oversized ASCII secret-prefix empty-query and whitespace-before-trim refusal alarms; inputs share the imported size bound and exercise only its fast length branch, with no multibyte or actual provider/exposure guarantee. Skill sharing loses complete/partial managed-bundle and destination-ambiguity association checks plus three negative origin/path/scheme admission examples; these do not establish uploaded contents, arbitrary-URL fetching, authorization or execution. Retain exact originless-project direct-link fallback, cloud-delete confirmation, bundled-target repair/owner isolation and explicit Windows-host preference over stale WSL suites. Rejected3201 runtime-preference removal is excluded. No real cloud/network/host/disk, mobile or mixed-version execution validation is claimed. Audit3200 composes approved source3194: deliberately retires thirteen authored registrations/twenty-seven expanded cases in six whole automation host/list policy suites without equivalent replacement. Real RPC category/retryability and wrapped-timeout recognition, unscoped-failure/scoped-success health evidence precedence, exact-ID create selectors and per-run workspace omission, paired-web local/SSH/absent host catalog routing, incompatible/removed/unhydrated/offline execution health, runtime-before-nested-SSH recovery dispatch, and no-owned-focus/successor/foreign-list focus policy alarms are consciously lost. Retain exact20line orphan allow/refuse/precondition and exact90line cross-host same-ID search suites. No retry-timer/fence lifecycle, actual reconnect/network/write delivery, native focus, mobile/mixed-version runtime or disk persistence coverage is claimed. Audit3191 combines approved source3182/3187/3188: deliberately retires thirteen authored Vitest registrations and fifteen expanded cases, including five whole suites, without equivalent replacement. Attachment intake loses real portal/native-capture terminal interception and unowned-container refusal, immediate child-only committed availability/claim-ref negotiation and delivery, and direct-target over stable focused/background composer routing through disable/re-enable/remount and independent question focus. Exact destination/cache/draft and final-stat owner/workspace/File-release suites remain; they do not replace Surface recipient routing. Automation authoring loses destination runtime catalog membership, local/direct-SSH exclusion of paired-runtime repos, unknown-runtime empty catalog, logical project/host/setup/repo/path context payload, and missing/nonready setup refusal; these were genuine direct helper alarms, while exact schedule transformation, legacy schedule and setup-decision suites remain. Agent picker loses setup-chat/terminal/missing-installer/unsupported-or-unknown-host row projection samples and the ordinary unsearched menu variant; the entire original26-line resume recipe suite remains, including reported bypass versus default/absent permission modes, as does the exact search-result menu callback with its fixtures, model/effort commits and staged Arguments reopen outcome. Rejected predecessor3180 full recipe deletion is excluded. No actual native drag/cursor/focus/IME, upload bytes or disk/restart persistence, full automation save/scheduler/runtime transport, real resume-process flags/environment delivery, or native menu/rendered layout validation is claimed. Audit3178 combines source3169/3170/3175: deliberately retires eight authored units (six Vitest cases and two imperative custom relay scenarios), including two whole suites, without equivalent replacement. Voice Section loses per-model pending-delete isolation across interleaved A/B completion and the two-success refresh-call alarm; exact VoicePane delayed key-clear/newer enabled-toggle merge remains and does not replace row deletion coverage. Speech loses dedicated rating-scale/inclusive-ceiling, unsupported-versus-unmeasured, explicit/system-language precedence/locale alias, accuracy versus fast named/default/best-measured selection, and unmeasured/no-match examples; exact offered-user-pick versus retired-selection case and its fixture remain. Relay loses legacy ping-delivery count/liveness sampled before the silence deadline and grouped malformed Bearer/host-ID 401/429 routing checks; twelve real Worker/DurableObject/shipped-client scenarios remain, not equivalent replacement for those narrow alarms. Six prior speech cases are not all deleted: approved successor3175 keeps the original user-choice case. No actual credential/file persistence, native/GPU/engine/download delivery, production assignment policy or deployed-runtime validation is claimed by this reduction. Audit3165 combines source3160/3162: deliberately retires six authored/expanded cases across three whole suites without equivalent replacement. Launch/status losses: observed React-render pending/resuming coordination across settings and deferred offer read; stale-offer reread suppressing dialog reopen; held-local-chat recovery visibility with new-chat preferences off; disabled-local admission avoiding offer RPC despite an injected but unconsumed paired-tab fixture; and run-only lost-reply uncertainty reachability until direct viewed-run retirement. Launch probe does not prove arbitrary synchronous-store atomicity, the paired fixture is not remote runtime enrollment, and the status case directly marks viewed state rather than rendering the summary. Crew-hook losses: old-host method_not_found cache persists across party changes but is released by independently supplied connection generation/verified pairing status or pairing revision, with actual frame publication and teardown. These are real narrow coordination, admission, uncertainty and mixed-version cache alarms consciously lost. Exact web verified-runtime writer handoff guard remains; it does not replace those alarms or prove live host/native/mobile delivery. Audit3156 combines3147/3150/3152/3153/3154: deliberately retires39authored/40expanded native-chat recovery cases, eight whole suites and two orphan test-support files without equivalent replacement. Lost alarms: lost-reply unconfirmed reconciliation, skipped rows/counts and missed-frame repair, unknown/pending outcome and omitted-failure-list compatibility, uncertain history after dismissal, retry/refusal/dismiss lifecycle, hidden/consumed picker ownership, result-tree keyboard focus/disclosure and all-skipped retirement; unconfirmed-over-conflict guidance and failed-chat changes despite older host timestamps; nearest-listed ancestor/cyclic forest shape, descendant membership, host ordering/missing-host local fallback; skipped/readiness/admission counts, provisional skip/progress monotonicity, early per-chat verdicts with batch pending protection, older-host waiting, start-slot/delivery distinction, retry-over-failure and unknown-after-withdrawal attention; remote snooze/reconnect/reoffer, unseen mixed summary through open/close, watched completion retirement, new success beside old failure, failed-reread mixed-result preservation, filter/collapse completion resets, retry summary replacement and current-offer/history selection; cross-host workspace identity, rendered cyclic reachability, nested tri-state/toggle propagation, project eligibility isolation and collapse preserving selection. Exact fallback-list completion barrier, batched verdict/cleanup retention, stale-read versus dismissal publication race, and requested-but-never-rendered finished-run retirement remain; they do not replace retired alarms. Audit3146 combines source reviews3132/3133/3135/3138/3143: intentionally retire20authored/31expanded cases without equivalent replacement. Provider-session losses: structured-native terminal-resume exclusion, metadata-less completed identity, new-turn completion clearing, Pi provider-only/periodic/manual promotion, changed-transcript launch-config isolation, Pi/omp/prime-agent completed-session remote/manual-shutdown promotion, and quit/done precedence over heartbeat. Side-thread/question losses: finished-pane acquisition, hidden title/recap states, local/relay/relay-done conversation takeover with prompt/session/child resets, plain-message abandonment, compaction/session replacement and completion resets. Codex startup losses: incoming-owner cached child replacement, old-relay foreign live-session correction, completed foreign-root turn-fact permutations. Transcript losses: real temporary-JSONL partial sibling/final-child completion, unlabelled child attribution, compact cached replay preservation and100/1000completed-child roster retention/release. Compiler-ratchet losses: valid-line uncompiled-list parser grammar examples and injected-existence stale-path filtering; these did not exercise actual filesystem canonicalization or build exclusion. These are real lifecycle, ownership, replay, liveness and retention alarms, including recent#40246 regressions, deliberately lost. Retained conditional record replacement, clockless root/SSH owner isolation, persisted main-thread fork rejection, partial/final question-answer lifetime, cached-roster/missing-ID/live HTTP/durable startup boundaries and restarted-relay refusal/acceptance do not replace those losses. No native/SSH/WSL execution or equivalent coverage is claimed. Audit3128 scoped coverage reduction: Audit3121 removes VoiceDictationLanguageSetting.test.tsx (Spanish-to-es callback and unsupported-model Korean option presence) and voice-speech-model-rows.test.ts (provider/language-order/retired-on-disk list policy); these real narrow alarms are deliberately retired without replacement. VoiceSpeechModelSection per-model concurrent deletion remains unchanged. Audit3122 removes the direct absolute/parent-segment sparse-directory exception-type sample and the five-row IPC sparse-preset error-code/non-save table (two authored/six expanded cases). Those real typed-validation and IPC refusal/error-code alarms are deliberately retired. Keep both real symlink/junction floating-directory trust cases and the minimal RPC structured validation-reason serialization case. The RPC case does not replace IPC save/refusal behavior, typed normalization for both path inputs, actual Git sparse checkout or rendered localization. No equivalent replacement or fresh test/runtime/platform/remote/performance validation is claimed. Audit3124 removes ExperimentalPane.test.tsx (ordinary Pet switch callback), WorkspaceDirectorySetting.test.tsx (padded absolute saved-path normalization/no-write blur), and repository-search.perf.test.ts (navigation/selected-pane builder-call policy, fixture cardinality/nonempty entries and renamed project keyword inclusion). These real narrow alarms are retired without replacement; RepositoryPane.search.test.tsx search-to-sparse-editor request remains unchanged. Audit3129: resolver Windows case-insensitive and POSIX case-sensitive configured-env composition plus mocked-base launch-preflight Windows composition are intentionally no longer checked by the two deleted suites. No equivalent coverage claimed. Keep runtime-structured-agent-host-env.test.ts unchanged: configured Windows Claude-home account identity and host-account precedence remain checked. Audit3114 incorporates source3101: retire three structured Claude child-environment wrapper cases covering inherited stamp isolation/default and explicit entrypoint, Windows SDK-key canonicalization/default/duplicate-key order, and configured lookup/final environment/config-dir conjunction. Keep direct auth/session sanitation and Windows-versus-Linux overlay checks, actual executable lookup from supplied inherited PATH, native Windows child environment delivery, and stale option-mutation fencing. These are not equivalent replacements for the retired wrapper alarms. No fresh test/runtime, real login-shell probe, Claude SDK startup, remote/mixed-version, UI or performance result is claimed. Audit3114 incorporates source3105: retire 17 authored/20 expanded daemon launch-note cases, including the entire two-case SessionLaunchNote suite. Deliberately lose split-marker carry across same-token re-arm, stale-token retirement refusal, foreground tri-state and serial settlement, omitted-note/no-incarnation mixed-version policy, sticky retirement, first-incarnation/replacement launch preservation and held-launch precedence. Keep only the unchanged unresolved foreground-read race against a later finished attach. Supplied notes/foreground and runtime calls do not establish actual daemon/main restart, SSH, native Windows observation, mobile UI, equivalent replacement or fresh runtime/performance validation. Audit3114 incorporates source3109: retire six authored/35 expanded pricing cases: 21 accepted model-name examples, 10 unsupported/future-model fail-closed examples, malformed TTL clamp, unknown-model estimate refusal, flat-model long-context disregard and oversized long-context clamp. Keep mixed five-minute/one-hour write allocation and short/all-long/mixed long-context allocation with original fixed oracles. Real parser/refusal/bounds alarms are knowingly lost without equivalent replacement; retained tests do not validate provider rates, actual billing or request threshold classification. Preserve the archived usage-scan-append source-freeze receipt without transferring historical execution/performance credit. No fresh runtime result is claimed. Audit3108 source-only reduction (3094/3095/3100): retire 27 authored/30 expanded cases, including complete markdown view-state, file-preview link-open and CLI agent-server-route suites, without replacement. Deliberate losses include preview visibility/reference lifetime and same-path owners; SSH stat, directory/missing-target, explicit-null owner, nonmarkdown line/column, local URI routing, remote-to-client guard and same-file reuse; document-preview source-owner/folder/reuse routing, stable grant location and outside-workspace POSIX/Windows request projection; and verified remote CLI send/check refusal, suggested --on argv/copy, shell no-probe bypass, unverified-launch admission and older-peer refusal. Retain two markdown source-runtime/qualified-reveal alarms, one stale grant-rejection fence and two remote read/mutation evidence policies, with original callbacks. Final last-wins reveal did not prove transient cancellation; CLI prerequisite did not prove no real send, and envelope tests do not execute server refusal. No fresh runtime, rendered UI, actual file/SSH/paired transport, authorization, mixed-version or performance result is claimed. Audit3096 source-only reduction (3087/3088): retire 69 authored/76 expanded cases, including complete recovery-portals and reconnect-banner suites. Intentionally lose dead/default TUI replay, generated alternate-frame style composition, reset/mode/dimension and legacy missing-mode-boundary alarms, UI notice/action/reveal policies, and isolated recovery lifecycle variants, without equivalent replacement. Retained registrations and callbacks are unchanged; headless cells are not pixels, and no fresh runtime, host, SSH, WSL, rendered-app or performance result is claimed. Audit3086 source-only reduction (3079/3080/3081): intentionally retire 93 authored/100 expanded mock-boundary cases, including the complete spawn-errors and SSH reconnect overlay suites, without replacement. Retired alarms include spawn classification/ownership, reply ceilings and renderer-write failure recovery, disconnect/detach fencing branches, authority facts, and overlay retry/visibility wiring. Retained callbacks are unchanged; no fresh execution, real PTY/SSH, rendered UI, or performance result is claimed. Audit2432: The broad unit command loses the isolated BranchPicker open-change notification sample. Its unique true/false callback alarm is intentionally retired; reopening/status-refresh behavior was not exercised. No equivalent replacement or fresh validation of the reduced selector is claimed. Audit2425: The broad unit command loses the workspace-copy-status supplied readError forwarding sample. It did not exercise the branch-switch blocking promised by its title. This alarm is intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2417: The broad unit command loses two ordinary clean Git cherry-pick/revert success samples and two terminal startup foreground-read work-budget samples. These unique alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2412: The broad unit command loses the whole six-case fake-React-hook scroll-anchor suite, two generic draft-retention samples, a simple new-agent order sample, a real history-publication batching-count sample, an unmounted handoff abort/timer sample and three basic WSL preview/error samples. These alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2404: The broad unit command loses the standalone share-name lookup 503 propagation suite, initial deletion placement-kind sample, direct changed-mtime stale sample, first-pass rollback existence example and abandoned-preparation directory sample. These exact alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2397 review amendment: The broad unit command loses three standalone suites, two partial-case definitions and two URL table rows across package/download/placement tests. Keep initial wrong-port authorization, modified independent-copy digest refusal and abort-after-begin cancellation dispatch. The remaining alarms are deliberately retired; no equivalent complete replacement or fresh validation of the reduced selector is claimed. Audit2393 current-parent refresh2401: Remove the basic skill-install service alias sample and original public managed-remove receiptless refusal case. Preserve the upstream request ownership suite and transaction interruption coverage. No equivalent complete replacement or fresh validation of the reduced selector is claimed. Audit2389: The broad unit command loses the missing-preview suite, plain-global destination sample and prepublished-receipt recovery example. No equivalent replacement or fresh validation of the reduced selector is claimed. Audit2385: The broad unit command loses four authored walker/staging/protocol examples (six expanded cases); no equivalent replacement or fresh validation is claimed for the reduced suite. Audit2383: The unscoped Vitest command no longer includes the removed Antigravity catalogue suite; its exact provider-root/owner example has no equivalent replacement or fresh validation claim. Audit2377/2381: The unscoped Vitest command includes the reduced bundled-skill and native-discovery suites; the eight removed backup/legacy/catalogue/symlink/SSH-builder examples have no replacement-equivalence or fresh validation claim here. Audit2133 current-parent preparation: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2095 current-parent preparation2126: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit1640 removes low-value IPC, SSH, workspace and transcript-watcher tests without equivalent replacement coverage. Per-source reviews record retained public refusal, cancellation, execution-host and real-filesystem outcomes with injected/native/remote limits. Affected historical receipts are retired; gates without active current evidence are downgraded. Historical scope before this audit: Deterministic main-IPC contract tests cover disconnect-driven close delivery, exactly-once close, per-subscription teardown isolation against a failing socket close and a throwing liveness probe, containment of a throwing renderer send on the unguarded host-close path, and continued suppression of stale payloads from a retired transport. A headed paired-server journey (real Orca host plus a separate paired Orca desktop client) covers hidden-but-mounted reveal, cold-parked reveal, and cold-parked reveal across a disconnect/reconnect. Live Linux and Windows paired-server evidence and real sleep/wake transport loss remain uncollected.", "motivatingLinks": ["tests/e2e/paired-remote-terminal-parked-reveal-interactivity.spec.ts"], "invariant": "Every renderer-held runtime subscription receives exactly one terminal close event when its transport is retired, including when the retirement advanced the transport generation first, and a single failing teardown never abandons that environment's remaining subscriptions nor escapes into the transport that reported the close. Payload frames from a retired transport stay suppressed. A revealed remote terminal therefore reattaches over a live multiplex connection: its buffer restores, typed input reaches the host PTY, the echo paints without a tab flip, and the PTY converges on the revealed pane grid.", - "oracle": "Audit 3283 removes 20 authored declarations and 31 expanded scenarios, including two whole suites. Retired alarms cover PR refresh-state pruning, shared runtime subscription cleanup and store isolation, language content-change routing and older completion ownership, ordinary panel retry-timer cleanup and pending loading, four hosted-review lifetime permutations, mocked terminal creation error/order wiring, five sleep-inventory variants with pending-frame-only assertions, palette fallback/composite highlights, Windows/UNC encoded-editor input rows, mixed-repository partial failure counts, title setters and generated-title bypass/replacement, five window-close coordinator delegation/guard/finally branches, and ambiguous-old-record frame reveal. These regression checks are intentionally lost under the test-value audit; retained cases are not equivalent replacements. Prior coverage notes and receipts remain historical. Audit 3273 removes 14 authored declarations and 19 expanded scenarios across four whole suites and eight partial suites. Retired alarms cover saved-local cancellation/layout ownership, ambiguous-owner warning reset, folder attachment routing, VM false-capability bypass, abandoned reveal warmup cleanup and viewport claim deduplication/rearming, quiet unrelated remote-removal refusal, startup-command one-shot consumption, repository/floating recovery-ledger rows, fake-React pinned-scroll intent, split-ratio state identity/subscriber suppression and fractional change, cross-host project-group join refusal, three PR request-lifetime permutations, upstream-status preservation on error, and unresolved Git-owner refusal. These regression checks are intentionally lost under the test-value audit; retained scenarios are not equivalent replacements. Historical coverage receipts remain historical, including gate35 subscriber claims. Audit 3256 removes these specific alarms from the broad root unit commands: skill dialog active-share selection, close and pending-share handoff; simple keyed-record deletion; marker live-region insertion, simple landing and nine baseline policy examples; General search/control navigation inventory; orphan-count cache bootstrap; seven Codex code classifications and HTTP 429 warning mapping; two skill unread-root verdict examples; peer-mail payload and conversation-ID rejection; and the GitHub organization TABLE text-field optimistic rollback/failed-envelope example. These include real behaviors; retained tests do not provide equivalent coverage for every removed scenario. Mobile losses are recorded separately and are not coverage of these root commands. Audit3246 retires NewRowsMarker reveal/no-repeat and pane-scoped beforeinput checks; skill-owner option availability/count/dedup/order; six styled Input/Textarea IME forwarding rows; the static Codex/OpenCode smart-key inventory; tab-map AST ratchet diagnostic fixtures; child-roster work-budget and retained-aggregate alarms; malformed persisted floating-cwd fallback/no-crash/empty exact-root checks; the unanswered-host empty-list discriminator; the direct invalidated-cache commit-false assertion; one redundant digit-keyup IME row; cached non-supported Claude title-generator rows; and the duplicate late naming-result singleton. These root broad commands lose those specific alarms without equivalent replacement. Distinct retained owner/state checks have their own bounded claims; the real scheduler still rejects stale response data, while the direct false-return alarm is retired. Audit3231 retires supported-host restore-pane key mapping, closed/open creation-sidebar toggle visibility, unrelated scope-error/null classification and quick-submit reveal/no-create checks. These broad commands lose those real narrow alarms; no replacement coverage is claimed. Audit3219 removes the synthetic Cmd+J extra-source suite; this broad command no longer checks its match/tie placement and selection, announced count, empty-query cap, or workspace hiding with retained recent tabs. No replacement coverage is claimed. Audit3209 composes approved sources3202/3206: deliberately retires seven authored/expanded cases in four whole suites without equivalent replacement. Work-item queries lose real GitHub/GitLab oversized ASCII secret-prefix empty-query and whitespace-before-trim refusal alarms; inputs share the imported size bound and exercise only its fast length branch, with no multibyte or actual provider/exposure guarantee. Skill sharing loses complete/partial managed-bundle and destination-ambiguity association checks plus three negative origin/path/scheme admission examples; these do not establish uploaded contents, arbitrary-URL fetching, authorization or execution. Retain exact originless-project direct-link fallback, cloud-delete confirmation, bundled-target repair/owner isolation and explicit Windows-host preference over stale WSL suites. Rejected3201 runtime-preference removal is excluded. No real cloud/network/host/disk, mobile or mixed-version execution validation is claimed. Audit3200 composes approved source3194: deliberately retires thirteen authored registrations/twenty-seven expanded cases in six whole automation host/list policy suites without equivalent replacement. Real RPC category/retryability and wrapped-timeout recognition, unscoped-failure/scoped-success health evidence precedence, exact-ID create selectors and per-run workspace omission, paired-web local/SSH/absent host catalog routing, incompatible/removed/unhydrated/offline execution health, runtime-before-nested-SSH recovery dispatch, and no-owned-focus/successor/foreign-list focus policy alarms are consciously lost. Retain exact20line orphan allow/refuse/precondition and exact90line cross-host same-ID search suites. No retry-timer/fence lifecycle, actual reconnect/network/write delivery, native focus, mobile/mixed-version runtime or disk persistence coverage is claimed. Audit3191 combines approved source3182/3187/3188: deliberately retires thirteen authored Vitest registrations and fifteen expanded cases, including five whole suites, without equivalent replacement. Attachment intake loses real portal/native-capture terminal interception and unowned-container refusal, immediate child-only committed availability/claim-ref negotiation and delivery, and direct-target over stable focused/background composer routing through disable/re-enable/remount and independent question focus. Exact destination/cache/draft and final-stat owner/workspace/File-release suites remain; they do not replace Surface recipient routing. Automation authoring loses destination runtime catalog membership, local/direct-SSH exclusion of paired-runtime repos, unknown-runtime empty catalog, logical project/host/setup/repo/path context payload, and missing/nonready setup refusal; these were genuine direct helper alarms, while exact schedule transformation, legacy schedule and setup-decision suites remain. Agent picker loses setup-chat/terminal/missing-installer/unsupported-or-unknown-host row projection samples and the ordinary unsearched menu variant; the entire original26-line resume recipe suite remains, including reported bypass versus default/absent permission modes, as does the exact search-result menu callback with its fixtures, model/effort commits and staged Arguments reopen outcome. Rejected predecessor3180 full recipe deletion is excluded. No actual native drag/cursor/focus/IME, upload bytes or disk/restart persistence, full automation save/scheduler/runtime transport, real resume-process flags/environment delivery, or native menu/rendered layout validation is claimed. Audit3178 combines source3169/3170/3175: deliberately retires eight authored units (six Vitest cases and two imperative custom relay scenarios), including two whole suites, without equivalent replacement. Voice Section loses per-model pending-delete isolation across interleaved A/B completion and the two-success refresh-call alarm; exact VoicePane delayed key-clear/newer enabled-toggle merge remains and does not replace row deletion coverage. Speech loses dedicated rating-scale/inclusive-ceiling, unsupported-versus-unmeasured, explicit/system-language precedence/locale alias, accuracy versus fast named/default/best-measured selection, and unmeasured/no-match examples; exact offered-user-pick versus retired-selection case and its fixture remain. Relay loses legacy ping-delivery count/liveness sampled before the silence deadline and grouped malformed Bearer/host-ID 401/429 routing checks; twelve real Worker/DurableObject/shipped-client scenarios remain, not equivalent replacement for those narrow alarms. Six prior speech cases are not all deleted: approved successor3175 keeps the original user-choice case. No actual credential/file persistence, native/GPU/engine/download delivery, production assignment policy or deployed-runtime validation is claimed by this reduction. Audit3165 combines source3160/3162: deliberately retires six authored/expanded cases across three whole suites without equivalent replacement. Launch/status losses: observed React-render pending/resuming coordination across settings and deferred offer read; stale-offer reread suppressing dialog reopen; held-local-chat recovery visibility with new-chat preferences off; disabled-local admission avoiding offer RPC despite an injected but unconsumed paired-tab fixture; and run-only lost-reply uncertainty reachability until direct viewed-run retirement. Launch probe does not prove arbitrary synchronous-store atomicity, the paired fixture is not remote runtime enrollment, and the status case directly marks viewed state rather than rendering the summary. Crew-hook losses: old-host method_not_found cache persists across party changes but is released by independently supplied connection generation/verified pairing status or pairing revision, with actual frame publication and teardown. These are real narrow coordination, admission, uncertainty and mixed-version cache alarms consciously lost. Exact web verified-runtime writer handoff guard remains; it does not replace those alarms or prove live host/native/mobile delivery. Audit3156 combines3147/3150/3152/3153/3154: deliberately retires39authored/40expanded native-chat recovery cases, eight whole suites and two orphan test-support files without equivalent replacement. Lost alarms: lost-reply unconfirmed reconciliation, skipped rows/counts and missed-frame repair, unknown/pending outcome and omitted-failure-list compatibility, uncertain history after dismissal, retry/refusal/dismiss lifecycle, hidden/consumed picker ownership, result-tree keyboard focus/disclosure and all-skipped retirement; unconfirmed-over-conflict guidance and failed-chat changes despite older host timestamps; nearest-listed ancestor/cyclic forest shape, descendant membership, host ordering/missing-host local fallback; skipped/readiness/admission counts, provisional skip/progress monotonicity, early per-chat verdicts with batch pending protection, older-host waiting, start-slot/delivery distinction, retry-over-failure and unknown-after-withdrawal attention; remote snooze/reconnect/reoffer, unseen mixed summary through open/close, watched completion retirement, new success beside old failure, failed-reread mixed-result preservation, filter/collapse completion resets, retry summary replacement and current-offer/history selection; cross-host workspace identity, rendered cyclic reachability, nested tri-state/toggle propagation, project eligibility isolation and collapse preserving selection. Exact fallback-list completion barrier, batched verdict/cleanup retention, stale-read versus dismissal publication race, and requested-but-never-rendered finished-run retirement remain; they do not replace retired alarms. Audit3146 combines source reviews3132/3133/3135/3138/3143: intentionally retire20authored/31expanded cases without equivalent replacement. Provider-session losses: structured-native terminal-resume exclusion, metadata-less completed identity, new-turn completion clearing, Pi provider-only/periodic/manual promotion, changed-transcript launch-config isolation, Pi/omp/prime-agent completed-session remote/manual-shutdown promotion, and quit/done precedence over heartbeat. Side-thread/question losses: finished-pane acquisition, hidden title/recap states, local/relay/relay-done conversation takeover with prompt/session/child resets, plain-message abandonment, compaction/session replacement and completion resets. Codex startup losses: incoming-owner cached child replacement, old-relay foreign live-session correction, completed foreign-root turn-fact permutations. Transcript losses: real temporary-JSONL partial sibling/final-child completion, unlabelled child attribution, compact cached replay preservation and100/1000completed-child roster retention/release. Compiler-ratchet losses: valid-line uncompiled-list parser grammar examples and injected-existence stale-path filtering; these did not exercise actual filesystem canonicalization or build exclusion. These are real lifecycle, ownership, replay, liveness and retention alarms, including recent#40246 regressions, deliberately lost. Retained conditional record replacement, clockless root/SSH owner isolation, persisted main-thread fork rejection, partial/final question-answer lifetime, cached-roster/missing-ID/live HTTP/durable startup boundaries and restarted-relay refusal/acceptance do not replace those losses. No native/SSH/WSL execution or equivalent coverage is claimed. Audit3128 scoped coverage reduction: Audit3121 removes VoiceDictationLanguageSetting.test.tsx (Spanish-to-es callback and unsupported-model Korean option presence) and voice-speech-model-rows.test.ts (provider/language-order/retired-on-disk list policy); these real narrow alarms are deliberately retired without replacement. VoiceSpeechModelSection per-model concurrent deletion remains unchanged. Audit3122 removes the direct absolute/parent-segment sparse-directory exception-type sample and the five-row IPC sparse-preset error-code/non-save table (two authored/six expanded cases). Those real typed-validation and IPC refusal/error-code alarms are deliberately retired. Keep both real symlink/junction floating-directory trust cases and the minimal RPC structured validation-reason serialization case. The RPC case does not replace IPC save/refusal behavior, typed normalization for both path inputs, actual Git sparse checkout or rendered localization. No equivalent replacement or fresh test/runtime/platform/remote/performance validation is claimed. Audit3124 removes ExperimentalPane.test.tsx (ordinary Pet switch callback), WorkspaceDirectorySetting.test.tsx (padded absolute saved-path normalization/no-write blur), and repository-search.perf.test.ts (navigation/selected-pane builder-call policy, fixture cardinality/nonempty entries and renamed project keyword inclusion). These real narrow alarms are retired without replacement; RepositoryPane.search.test.tsx search-to-sparse-editor request remains unchanged. Audit3129: resolver Windows case-insensitive and POSIX case-sensitive configured-env composition plus mocked-base launch-preflight Windows composition are intentionally no longer checked by the two deleted suites. No equivalent coverage claimed. Keep runtime-structured-agent-host-env.test.ts unchanged: configured Windows Claude-home account identity and host-account precedence remain checked. Audit3114 incorporates source3101: retire three structured Claude child-environment wrapper cases covering inherited stamp isolation/default and explicit entrypoint, Windows SDK-key canonicalization/default/duplicate-key order, and configured lookup/final environment/config-dir conjunction. Keep direct auth/session sanitation and Windows-versus-Linux overlay checks, actual executable lookup from supplied inherited PATH, native Windows child environment delivery, and stale option-mutation fencing. These are not equivalent replacements for the retired wrapper alarms. No fresh test/runtime, real login-shell probe, Claude SDK startup, remote/mixed-version, UI or performance result is claimed. Audit3114 incorporates source3105: retire 17 authored/20 expanded daemon launch-note cases, including the entire two-case SessionLaunchNote suite. Deliberately lose split-marker carry across same-token re-arm, stale-token retirement refusal, foreground tri-state and serial settlement, omitted-note/no-incarnation mixed-version policy, sticky retirement, first-incarnation/replacement launch preservation and held-launch precedence. Keep only the unchanged unresolved foreground-read race against a later finished attach. Supplied notes/foreground and runtime calls do not establish actual daemon/main restart, SSH, native Windows observation, mobile UI, equivalent replacement or fresh runtime/performance validation. Audit3114 incorporates source3109: retire six authored/35 expanded pricing cases: 21 accepted model-name examples, 10 unsupported/future-model fail-closed examples, malformed TTL clamp, unknown-model estimate refusal, flat-model long-context disregard and oversized long-context clamp. Keep mixed five-minute/one-hour write allocation and short/all-long/mixed long-context allocation with original fixed oracles. Real parser/refusal/bounds alarms are knowingly lost without equivalent replacement; retained tests do not validate provider rates, actual billing or request threshold classification. Preserve the archived usage-scan-append source-freeze receipt without transferring historical execution/performance credit. No fresh runtime result is claimed. Audit3108 source-only reduction (3094/3095/3100): retire 27 authored/30 expanded cases, including complete markdown view-state, file-preview link-open and CLI agent-server-route suites, without replacement. Deliberate losses include preview visibility/reference lifetime and same-path owners; SSH stat, directory/missing-target, explicit-null owner, nonmarkdown line/column, local URI routing, remote-to-client guard and same-file reuse; document-preview source-owner/folder/reuse routing, stable grant location and outside-workspace POSIX/Windows request projection; and verified remote CLI send/check refusal, suggested --on argv/copy, shell no-probe bypass, unverified-launch admission and older-peer refusal. Retain two markdown source-runtime/qualified-reveal alarms, one stale grant-rejection fence and two remote read/mutation evidence policies, with original callbacks. Final last-wins reveal did not prove transient cancellation; CLI prerequisite did not prove no real send, and envelope tests do not execute server refusal. No fresh runtime, rendered UI, actual file/SSH/paired transport, authorization, mixed-version or performance result is claimed. Audit3096 source-only reduction (3087/3088): retire 69 authored/76 expanded cases, including complete recovery-portals and reconnect-banner suites. Intentionally lose dead/default TUI replay, generated alternate-frame style composition, reset/mode/dimension and legacy missing-mode-boundary alarms, UI notice/action/reveal policies, and isolated recovery lifecycle variants, without equivalent replacement. Retained registrations and callbacks are unchanged; headless cells are not pixels, and no fresh runtime, host, SSH, WSL, rendered-app or performance result is claimed. Audit3086 source-only reduction (3079/3080/3081): intentionally retire 93 authored/100 expanded mock-boundary cases, including the complete spawn-errors and SSH reconnect overlay suites, without replacement. Retired alarms include spawn classification/ownership, reply ceilings and renderer-write failure recovery, disconnect/detach fencing branches, authority facts, and overlay retry/visibility wiring. Retained callbacks are unchanged; no fresh execution, real PTY/SSH, rendered UI, or performance result is claimed. Audit2432: The broad unit command loses the isolated BranchPicker open-change notification sample. Its unique true/false callback alarm is intentionally retired; reopening/status-refresh behavior was not exercised. No equivalent replacement or fresh validation of the reduced selector is claimed. Audit2425: The broad unit command loses the workspace-copy-status supplied readError forwarding sample. It did not exercise the branch-switch blocking promised by its title. This alarm is intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2417: The broad unit command loses two ordinary clean Git cherry-pick/revert success samples and two terminal startup foreground-read work-budget samples. These unique alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2412: The broad unit command loses the whole six-case fake-React-hook scroll-anchor suite, two generic draft-retention samples, a simple new-agent order sample, a real history-publication batching-count sample, an unmounted handoff abort/timer sample and three basic WSL preview/error samples. These alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2404: The broad unit command loses the standalone share-name lookup 503 propagation suite, initial deletion placement-kind sample, direct changed-mtime stale sample, first-pass rollback existence example and abandoned-preparation directory sample. These exact alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2397 review amendment: The broad unit command loses three standalone suites, two partial-case definitions and two URL table rows across package/download/placement tests. Keep initial wrong-port authorization, modified independent-copy digest refusal and abort-after-begin cancellation dispatch. The remaining alarms are deliberately retired; no equivalent complete replacement or fresh validation of the reduced selector is claimed. Audit2393 current-parent refresh2401: Remove the basic skill-install service alias sample and original public managed-remove receiptless refusal case. Preserve the upstream request ownership suite and transaction interruption coverage. No equivalent complete replacement or fresh validation of the reduced selector is claimed. Audit2389: The broad unit command loses the missing-preview suite, plain-global destination sample and prepublished-receipt recovery example. No equivalent replacement or fresh validation of the reduced selector is claimed. Audit2385: The broad unit command loses four authored walker/staging/protocol examples (six expanded cases); no equivalent replacement or fresh validation is claimed for the reduced suite. Audit2383: The unscoped Vitest command no longer includes the removed Antigravity catalogue suite; its exact provider-root/owner example has no equivalent replacement or fresh validation claim. Audit2377/2381: The unscoped Vitest command includes the reduced bundled-skill and native-discovery suites; the eight removed backup/legacy/catalogue/symlink/SSH-builder examples have no replacement-equivalence or fresh validation claim here. Audit2133 current-parent preparation: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2095 current-parent preparation2126: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): The main IPC contract test subscribes terminal.multiplex through the real handler, disconnects the environment, and asserts the renderer received exactly one {type: close} subscription event. Two isolation tests subscribe a second stream to the same environment and make the first one fail -- in its socket close, and in the liveness probe inside notifyClosed -- then assert the disconnect does not throw, both transports closed, and every close the renderer could still receive was delivered. A third drives a host-initiated close through the transport callback, which is the one notifyClosed call site with no surrounding guard, with a renderer send that throws, and asserts it cannot escape into the WebSocket close handler. A fourth test asserts that after retirement a late response frame is not forwarded and a late transport close does not re-send. The paired-server journey runs three reveal scenarios against one real host and one real paired desktop client, and for each records buffer restore, host-side receipt of the typed marker through an out-of-band host sink file, live paint without a tab flip, and PTY-versus-pane grid convergence.", + "oracle": "Audit 3292 combines adopted 3285/3287/3289/3293 removals: 40 authored declarations and 47 expanded scenarios, including whole frame-editor-view, ambiguous remote-delete-refusal, unverifiable-host subscription and editor-close cleanup suites. The previously reviewed dock-badge suite was already removed upstream in PR 40895 and receives zero new removal credit. Intentionally retired alarms include background browser selection and last-tab landing; main startup fallback, SSH project cleanup/survivor routing, exact-PR contradiction/saved-push positives, replay/sidecar rollback and wrapped remote error normalization; records/snapshot missing-diff hydration, ambiguous folder-owner delete refusal, focus no-op notifications, nested editor context-only cache check, pending broadcast-first status and ordinary four-confirmation aggregation; preview-source frontmatter pruning, approved local/runtime agent dispatch, non-GitHub legacy PR cache invalidation, stale merged-head transient-error fallback, empty-queue immediate query reply and unverified-to-concrete preflight risk. Additional intentionally retired alarms are injected host subscription/unsubscribe counts, synthetic editor reveal/draft/fallback/scoped close, ambiguous unread refusals and hidden mark/read roundtrip, immediate connect backoff/noError, positive mirrored evidence-clock renewal, supplied VM failure/success projections and git-local/folder-SSH wake permutations. Remaining temporal/ownership cases are narrower; no equivalent replacement or fresh execution is claimed. Audit 3283 removes 20 authored declarations and 31 expanded scenarios, including two whole suites. Retired alarms cover PR refresh-state pruning, shared runtime subscription cleanup and store isolation, language content-change routing and older completion ownership, ordinary panel retry-timer cleanup and pending loading, four hosted-review lifetime permutations, mocked terminal creation error/order wiring, five sleep-inventory variants with pending-frame-only assertions, palette fallback/composite highlights, Windows/UNC encoded-editor input rows, mixed-repository partial failure counts, title setters and generated-title bypass/replacement, five window-close coordinator delegation/guard/finally branches, and ambiguous-old-record frame reveal. These regression checks are intentionally lost under the test-value audit; retained cases are not equivalent replacements. Prior coverage notes and receipts remain historical. Audit 3273 removes 14 authored declarations and 19 expanded scenarios across four whole suites and eight partial suites. Retired alarms cover saved-local cancellation/layout ownership, ambiguous-owner warning reset, folder attachment routing, VM false-capability bypass, abandoned reveal warmup cleanup and viewport claim deduplication/rearming, quiet unrelated remote-removal refusal, startup-command one-shot consumption, repository/floating recovery-ledger rows, fake-React pinned-scroll intent, split-ratio state identity/subscriber suppression and fractional change, cross-host project-group join refusal, three PR request-lifetime permutations, upstream-status preservation on error, and unresolved Git-owner refusal. These regression checks are intentionally lost under the test-value audit; retained scenarios are not equivalent replacements. Historical coverage receipts remain historical, including gate35 subscriber claims. Audit 3256 removes these specific alarms from the broad root unit commands: skill dialog active-share selection, close and pending-share handoff; simple keyed-record deletion; marker live-region insertion, simple landing and nine baseline policy examples; General search/control navigation inventory; orphan-count cache bootstrap; seven Codex code classifications and HTTP 429 warning mapping; two skill unread-root verdict examples; peer-mail payload and conversation-ID rejection; and the GitHub organization TABLE text-field optimistic rollback/failed-envelope example. These include real behaviors; retained tests do not provide equivalent coverage for every removed scenario. Mobile losses are recorded separately and are not coverage of these root commands. Audit3246 retires NewRowsMarker reveal/no-repeat and pane-scoped beforeinput checks; skill-owner option availability/count/dedup/order; six styled Input/Textarea IME forwarding rows; the static Codex/OpenCode smart-key inventory; tab-map AST ratchet diagnostic fixtures; child-roster work-budget and retained-aggregate alarms; malformed persisted floating-cwd fallback/no-crash/empty exact-root checks; the unanswered-host empty-list discriminator; the direct invalidated-cache commit-false assertion; one redundant digit-keyup IME row; cached non-supported Claude title-generator rows; and the duplicate late naming-result singleton. These root broad commands lose those specific alarms without equivalent replacement. Distinct retained owner/state checks have their own bounded claims; the real scheduler still rejects stale response data, while the direct false-return alarm is retired. Audit3231 retires supported-host restore-pane key mapping, closed/open creation-sidebar toggle visibility, unrelated scope-error/null classification and quick-submit reveal/no-create checks. These broad commands lose those real narrow alarms; no replacement coverage is claimed. Audit3219 removes the synthetic Cmd+J extra-source suite; this broad command no longer checks its match/tie placement and selection, announced count, empty-query cap, or workspace hiding with retained recent tabs. No replacement coverage is claimed. Audit3209 composes approved sources3202/3206: deliberately retires seven authored/expanded cases in four whole suites without equivalent replacement. Work-item queries lose real GitHub/GitLab oversized ASCII secret-prefix empty-query and whitespace-before-trim refusal alarms; inputs share the imported size bound and exercise only its fast length branch, with no multibyte or actual provider/exposure guarantee. Skill sharing loses complete/partial managed-bundle and destination-ambiguity association checks plus three negative origin/path/scheme admission examples; these do not establish uploaded contents, arbitrary-URL fetching, authorization or execution. Retain exact originless-project direct-link fallback, cloud-delete confirmation, bundled-target repair/owner isolation and explicit Windows-host preference over stale WSL suites. Rejected3201 runtime-preference removal is excluded. No real cloud/network/host/disk, mobile or mixed-version execution validation is claimed. Audit3200 composes approved source3194: deliberately retires thirteen authored registrations/twenty-seven expanded cases in six whole automation host/list policy suites without equivalent replacement. Real RPC category/retryability and wrapped-timeout recognition, unscoped-failure/scoped-success health evidence precedence, exact-ID create selectors and per-run workspace omission, paired-web local/SSH/absent host catalog routing, incompatible/removed/unhydrated/offline execution health, runtime-before-nested-SSH recovery dispatch, and no-owned-focus/successor/foreign-list focus policy alarms are consciously lost. Retain exact20line orphan allow/refuse/precondition and exact90line cross-host same-ID search suites. No retry-timer/fence lifecycle, actual reconnect/network/write delivery, native focus, mobile/mixed-version runtime or disk persistence coverage is claimed. Audit3191 combines approved source3182/3187/3188: deliberately retires thirteen authored Vitest registrations and fifteen expanded cases, including five whole suites, without equivalent replacement. Attachment intake loses real portal/native-capture terminal interception and unowned-container refusal, immediate child-only committed availability/claim-ref negotiation and delivery, and direct-target over stable focused/background composer routing through disable/re-enable/remount and independent question focus. Exact destination/cache/draft and final-stat owner/workspace/File-release suites remain; they do not replace Surface recipient routing. Automation authoring loses destination runtime catalog membership, local/direct-SSH exclusion of paired-runtime repos, unknown-runtime empty catalog, logical project/host/setup/repo/path context payload, and missing/nonready setup refusal; these were genuine direct helper alarms, while exact schedule transformation, legacy schedule and setup-decision suites remain. Agent picker loses setup-chat/terminal/missing-installer/unsupported-or-unknown-host row projection samples and the ordinary unsearched menu variant; the entire original26-line resume recipe suite remains, including reported bypass versus default/absent permission modes, as does the exact search-result menu callback with its fixtures, model/effort commits and staged Arguments reopen outcome. Rejected predecessor3180 full recipe deletion is excluded. No actual native drag/cursor/focus/IME, upload bytes or disk/restart persistence, full automation save/scheduler/runtime transport, real resume-process flags/environment delivery, or native menu/rendered layout validation is claimed. Audit3178 combines source3169/3170/3175: deliberately retires eight authored units (six Vitest cases and two imperative custom relay scenarios), including two whole suites, without equivalent replacement. Voice Section loses per-model pending-delete isolation across interleaved A/B completion and the two-success refresh-call alarm; exact VoicePane delayed key-clear/newer enabled-toggle merge remains and does not replace row deletion coverage. Speech loses dedicated rating-scale/inclusive-ceiling, unsupported-versus-unmeasured, explicit/system-language precedence/locale alias, accuracy versus fast named/default/best-measured selection, and unmeasured/no-match examples; exact offered-user-pick versus retired-selection case and its fixture remain. Relay loses legacy ping-delivery count/liveness sampled before the silence deadline and grouped malformed Bearer/host-ID 401/429 routing checks; twelve real Worker/DurableObject/shipped-client scenarios remain, not equivalent replacement for those narrow alarms. Six prior speech cases are not all deleted: approved successor3175 keeps the original user-choice case. No actual credential/file persistence, native/GPU/engine/download delivery, production assignment policy or deployed-runtime validation is claimed by this reduction. Audit3165 combines source3160/3162: deliberately retires six authored/expanded cases across three whole suites without equivalent replacement. Launch/status losses: observed React-render pending/resuming coordination across settings and deferred offer read; stale-offer reread suppressing dialog reopen; held-local-chat recovery visibility with new-chat preferences off; disabled-local admission avoiding offer RPC despite an injected but unconsumed paired-tab fixture; and run-only lost-reply uncertainty reachability until direct viewed-run retirement. Launch probe does not prove arbitrary synchronous-store atomicity, the paired fixture is not remote runtime enrollment, and the status case directly marks viewed state rather than rendering the summary. Crew-hook losses: old-host method_not_found cache persists across party changes but is released by independently supplied connection generation/verified pairing status or pairing revision, with actual frame publication and teardown. These are real narrow coordination, admission, uncertainty and mixed-version cache alarms consciously lost. Exact web verified-runtime writer handoff guard remains; it does not replace those alarms or prove live host/native/mobile delivery. Audit3156 combines3147/3150/3152/3153/3154: deliberately retires39authored/40expanded native-chat recovery cases, eight whole suites and two orphan test-support files without equivalent replacement. Lost alarms: lost-reply unconfirmed reconciliation, skipped rows/counts and missed-frame repair, unknown/pending outcome and omitted-failure-list compatibility, uncertain history after dismissal, retry/refusal/dismiss lifecycle, hidden/consumed picker ownership, result-tree keyboard focus/disclosure and all-skipped retirement; unconfirmed-over-conflict guidance and failed-chat changes despite older host timestamps; nearest-listed ancestor/cyclic forest shape, descendant membership, host ordering/missing-host local fallback; skipped/readiness/admission counts, provisional skip/progress monotonicity, early per-chat verdicts with batch pending protection, older-host waiting, start-slot/delivery distinction, retry-over-failure and unknown-after-withdrawal attention; remote snooze/reconnect/reoffer, unseen mixed summary through open/close, watched completion retirement, new success beside old failure, failed-reread mixed-result preservation, filter/collapse completion resets, retry summary replacement and current-offer/history selection; cross-host workspace identity, rendered cyclic reachability, nested tri-state/toggle propagation, project eligibility isolation and collapse preserving selection. Exact fallback-list completion barrier, batched verdict/cleanup retention, stale-read versus dismissal publication race, and requested-but-never-rendered finished-run retirement remain; they do not replace retired alarms. Audit3146 combines source reviews3132/3133/3135/3138/3143: intentionally retire20authored/31expanded cases without equivalent replacement. Provider-session losses: structured-native terminal-resume exclusion, metadata-less completed identity, new-turn completion clearing, Pi provider-only/periodic/manual promotion, changed-transcript launch-config isolation, Pi/omp/prime-agent completed-session remote/manual-shutdown promotion, and quit/done precedence over heartbeat. Side-thread/question losses: finished-pane acquisition, hidden title/recap states, local/relay/relay-done conversation takeover with prompt/session/child resets, plain-message abandonment, compaction/session replacement and completion resets. Codex startup losses: incoming-owner cached child replacement, old-relay foreign live-session correction, completed foreign-root turn-fact permutations. Transcript losses: real temporary-JSONL partial sibling/final-child completion, unlabelled child attribution, compact cached replay preservation and100/1000completed-child roster retention/release. Compiler-ratchet losses: valid-line uncompiled-list parser grammar examples and injected-existence stale-path filtering; these did not exercise actual filesystem canonicalization or build exclusion. These are real lifecycle, ownership, replay, liveness and retention alarms, including recent#40246 regressions, deliberately lost. Retained conditional record replacement, clockless root/SSH owner isolation, persisted main-thread fork rejection, partial/final question-answer lifetime, cached-roster/missing-ID/live HTTP/durable startup boundaries and restarted-relay refusal/acceptance do not replace those losses. No native/SSH/WSL execution or equivalent coverage is claimed. Audit3128 scoped coverage reduction: Audit3121 removes VoiceDictationLanguageSetting.test.tsx (Spanish-to-es callback and unsupported-model Korean option presence) and voice-speech-model-rows.test.ts (provider/language-order/retired-on-disk list policy); these real narrow alarms are deliberately retired without replacement. VoiceSpeechModelSection per-model concurrent deletion remains unchanged. Audit3122 removes the direct absolute/parent-segment sparse-directory exception-type sample and the five-row IPC sparse-preset error-code/non-save table (two authored/six expanded cases). Those real typed-validation and IPC refusal/error-code alarms are deliberately retired. Keep both real symlink/junction floating-directory trust cases and the minimal RPC structured validation-reason serialization case. The RPC case does not replace IPC save/refusal behavior, typed normalization for both path inputs, actual Git sparse checkout or rendered localization. No equivalent replacement or fresh test/runtime/platform/remote/performance validation is claimed. Audit3124 removes ExperimentalPane.test.tsx (ordinary Pet switch callback), WorkspaceDirectorySetting.test.tsx (padded absolute saved-path normalization/no-write blur), and repository-search.perf.test.ts (navigation/selected-pane builder-call policy, fixture cardinality/nonempty entries and renamed project keyword inclusion). These real narrow alarms are retired without replacement; RepositoryPane.search.test.tsx search-to-sparse-editor request remains unchanged. Audit3129: resolver Windows case-insensitive and POSIX case-sensitive configured-env composition plus mocked-base launch-preflight Windows composition are intentionally no longer checked by the two deleted suites. No equivalent coverage claimed. Keep runtime-structured-agent-host-env.test.ts unchanged: configured Windows Claude-home account identity and host-account precedence remain checked. Audit3114 incorporates source3101: retire three structured Claude child-environment wrapper cases covering inherited stamp isolation/default and explicit entrypoint, Windows SDK-key canonicalization/default/duplicate-key order, and configured lookup/final environment/config-dir conjunction. Keep direct auth/session sanitation and Windows-versus-Linux overlay checks, actual executable lookup from supplied inherited PATH, native Windows child environment delivery, and stale option-mutation fencing. These are not equivalent replacements for the retired wrapper alarms. No fresh test/runtime, real login-shell probe, Claude SDK startup, remote/mixed-version, UI or performance result is claimed. Audit3114 incorporates source3105: retire 17 authored/20 expanded daemon launch-note cases, including the entire two-case SessionLaunchNote suite. Deliberately lose split-marker carry across same-token re-arm, stale-token retirement refusal, foreground tri-state and serial settlement, omitted-note/no-incarnation mixed-version policy, sticky retirement, first-incarnation/replacement launch preservation and held-launch precedence. Keep only the unchanged unresolved foreground-read race against a later finished attach. Supplied notes/foreground and runtime calls do not establish actual daemon/main restart, SSH, native Windows observation, mobile UI, equivalent replacement or fresh runtime/performance validation. Audit3114 incorporates source3109: retire six authored/35 expanded pricing cases: 21 accepted model-name examples, 10 unsupported/future-model fail-closed examples, malformed TTL clamp, unknown-model estimate refusal, flat-model long-context disregard and oversized long-context clamp. Keep mixed five-minute/one-hour write allocation and short/all-long/mixed long-context allocation with original fixed oracles. Real parser/refusal/bounds alarms are knowingly lost without equivalent replacement; retained tests do not validate provider rates, actual billing or request threshold classification. Preserve the archived usage-scan-append source-freeze receipt without transferring historical execution/performance credit. No fresh runtime result is claimed. Audit3108 source-only reduction (3094/3095/3100): retire 27 authored/30 expanded cases, including complete markdown view-state, file-preview link-open and CLI agent-server-route suites, without replacement. Deliberate losses include preview visibility/reference lifetime and same-path owners; SSH stat, directory/missing-target, explicit-null owner, nonmarkdown line/column, local URI routing, remote-to-client guard and same-file reuse; document-preview source-owner/folder/reuse routing, stable grant location and outside-workspace POSIX/Windows request projection; and verified remote CLI send/check refusal, suggested --on argv/copy, shell no-probe bypass, unverified-launch admission and older-peer refusal. Retain two markdown source-runtime/qualified-reveal alarms, one stale grant-rejection fence and two remote read/mutation evidence policies, with original callbacks. Final last-wins reveal did not prove transient cancellation; CLI prerequisite did not prove no real send, and envelope tests do not execute server refusal. No fresh runtime, rendered UI, actual file/SSH/paired transport, authorization, mixed-version or performance result is claimed. Audit3096 source-only reduction (3087/3088): retire 69 authored/76 expanded cases, including complete recovery-portals and reconnect-banner suites. Intentionally lose dead/default TUI replay, generated alternate-frame style composition, reset/mode/dimension and legacy missing-mode-boundary alarms, UI notice/action/reveal policies, and isolated recovery lifecycle variants, without equivalent replacement. Retained registrations and callbacks are unchanged; headless cells are not pixels, and no fresh runtime, host, SSH, WSL, rendered-app or performance result is claimed. Audit3086 source-only reduction (3079/3080/3081): intentionally retire 93 authored/100 expanded mock-boundary cases, including the complete spawn-errors and SSH reconnect overlay suites, without replacement. Retired alarms include spawn classification/ownership, reply ceilings and renderer-write failure recovery, disconnect/detach fencing branches, authority facts, and overlay retry/visibility wiring. Retained callbacks are unchanged; no fresh execution, real PTY/SSH, rendered UI, or performance result is claimed. Audit2432: The broad unit command loses the isolated BranchPicker open-change notification sample. Its unique true/false callback alarm is intentionally retired; reopening/status-refresh behavior was not exercised. No equivalent replacement or fresh validation of the reduced selector is claimed. Audit2425: The broad unit command loses the workspace-copy-status supplied readError forwarding sample. It did not exercise the branch-switch blocking promised by its title. This alarm is intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2417: The broad unit command loses two ordinary clean Git cherry-pick/revert success samples and two terminal startup foreground-read work-budget samples. These unique alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2412: The broad unit command loses the whole six-case fake-React-hook scroll-anchor suite, two generic draft-retention samples, a simple new-agent order sample, a real history-publication batching-count sample, an unmounted handoff abort/timer sample and three basic WSL preview/error samples. These alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2404: The broad unit command loses the standalone share-name lookup 503 propagation suite, initial deletion placement-kind sample, direct changed-mtime stale sample, first-pass rollback existence example and abandoned-preparation directory sample. These exact alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2397 review amendment: The broad unit command loses three standalone suites, two partial-case definitions and two URL table rows across package/download/placement tests. Keep initial wrong-port authorization, modified independent-copy digest refusal and abort-after-begin cancellation dispatch. The remaining alarms are deliberately retired; no equivalent complete replacement or fresh validation of the reduced selector is claimed. Audit2393 current-parent refresh2401: Remove the basic skill-install service alias sample and original public managed-remove receiptless refusal case. Preserve the upstream request ownership suite and transaction interruption coverage. No equivalent complete replacement or fresh validation of the reduced selector is claimed. Audit2389: The broad unit command loses the missing-preview suite, plain-global destination sample and prepublished-receipt recovery example. No equivalent replacement or fresh validation of the reduced selector is claimed. Audit2385: The broad unit command loses four authored walker/staging/protocol examples (six expanded cases); no equivalent replacement or fresh validation is claimed for the reduced suite. Audit2383: The unscoped Vitest command no longer includes the removed Antigravity catalogue suite; its exact provider-root/owner example has no equivalent replacement or fresh validation claim. Audit2377/2381: The unscoped Vitest command includes the reduced bundled-skill and native-discovery suites; the eight removed backup/legacy/catalogue/symlink/SSH-builder examples have no replacement-equivalence or fresh validation claim here. Audit2133 current-parent preparation: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2095 current-parent preparation2126: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): The main IPC contract test subscribes terminal.multiplex through the real handler, disconnects the environment, and asserts the renderer received exactly one {type: close} subscription event. Two isolation tests subscribe a second stream to the same environment and make the first one fail -- in its socket close, and in the liveness probe inside notifyClosed -- then assert the disconnect does not throw, both transports closed, and every close the renderer could still receive was delivered. A third drives a host-initiated close through the transport callback, which is the one notifyClosed call site with no surrounding guard, with a renderer send that throws, and asserts it cannot escape into the WebSocket close handler. A fourth test asserts that after retirement a late response frame is not forwarded and a late transport close does not re-send. The paired-server journey runs three reveal scenarios against one real host and one real paired desktop client, and for each records buffer restore, host-side receipt of the typed marker through an out-of-band host sink file, live paint without a tab flip, and PTY-versus-pane grid convergence.", "commands": [ "pnpm exec vitest run --config config/vitest.config.ts", "pnpm exec playwright test tests/e2e/paired-remote-terminal-parked-reveal-interactivity.spec.ts --config tests/playwright.config.ts --project electron-headless --workers=1" @@ -4308,7 +4309,8 @@ "Audit3246 retires NewRowsMarker reveal/no-repeat and pane-scoped beforeinput checks; skill-owner option availability/count/dedup/order; six styled Input/Textarea IME forwarding rows; the static Codex/OpenCode smart-key inventory; tab-map AST ratchet diagnostic fixtures; child-roster work-budget and retained-aggregate alarms; malformed persisted floating-cwd fallback/no-crash/empty exact-root checks; the unanswered-host empty-list discriminator; the direct invalidated-cache commit-false assertion; one redundant digit-keyup IME row; cached non-supported Claude title-generator rows; and the duplicate late naming-result singleton. These root broad commands lose those specific alarms without equivalent replacement. Distinct retained owner/state checks have their own bounded claims; the real scheduler still rejects stale response data, while the direct false-return alarm is retired.", "Audit 3256 removes these specific alarms from the broad root unit commands: skill dialog active-share selection, close and pending-share handoff; simple keyed-record deletion; marker live-region insertion, simple landing and nine baseline policy examples; General search/control navigation inventory; orphan-count cache bootstrap; seven Codex code classifications and HTTP 429 warning mapping; two skill unread-root verdict examples; peer-mail payload and conversation-ID rejection; and the GitHub organization TABLE text-field optimistic rollback/failed-envelope example. These include real behaviors; retained tests do not provide equivalent coverage for every removed scenario. Mobile losses are recorded separately and are not coverage of these root commands.", "Audit 3273 removes 14 authored declarations and 19 expanded scenarios across four whole suites and eight partial suites. Retired alarms cover saved-local cancellation/layout ownership, ambiguous-owner warning reset, folder attachment routing, VM false-capability bypass, abandoned reveal warmup cleanup and viewport claim deduplication/rearming, quiet unrelated remote-removal refusal, startup-command one-shot consumption, repository/floating recovery-ledger rows, fake-React pinned-scroll intent, split-ratio state identity/subscriber suppression and fractional change, cross-host project-group join refusal, three PR request-lifetime permutations, upstream-status preservation on error, and unresolved Git-owner refusal. These regression checks are intentionally lost under the test-value audit; retained scenarios are not equivalent replacements. Historical coverage receipts remain historical, including gate35 subscriber claims.", - "Audit 3283 removes 20 authored declarations and 31 expanded scenarios, including two whole suites. Retired alarms cover PR refresh-state pruning, shared runtime subscription cleanup and store isolation, language content-change routing and older completion ownership, ordinary panel retry-timer cleanup and pending loading, four hosted-review lifetime permutations, mocked terminal creation error/order wiring, five sleep-inventory variants with pending-frame-only assertions, palette fallback/composite highlights, Windows/UNC encoded-editor input rows, mixed-repository partial failure counts, title setters and generated-title bypass/replacement, five window-close coordinator delegation/guard/finally branches, and ambiguous-old-record frame reveal. These regression checks are intentionally lost under the test-value audit; retained cases are not equivalent replacements. Prior coverage notes and receipts remain historical." + "Audit 3283 removes 20 authored declarations and 31 expanded scenarios, including two whole suites. Retired alarms cover PR refresh-state pruning, shared runtime subscription cleanup and store isolation, language content-change routing and older completion ownership, ordinary panel retry-timer cleanup and pending loading, four hosted-review lifetime permutations, mocked terminal creation error/order wiring, five sleep-inventory variants with pending-frame-only assertions, palette fallback/composite highlights, Windows/UNC encoded-editor input rows, mixed-repository partial failure counts, title setters and generated-title bypass/replacement, five window-close coordinator delegation/guard/finally branches, and ambiguous-old-record frame reveal. These regression checks are intentionally lost under the test-value audit; retained cases are not equivalent replacements. Prior coverage notes and receipts remain historical.", + "Audit 3292 combines adopted 3285/3287/3289/3293 removals: 40 authored declarations and 47 expanded scenarios, including whole frame-editor-view, ambiguous remote-delete-refusal, unverifiable-host subscription and editor-close cleanup suites. The previously reviewed dock-badge suite was already removed upstream in PR 40895 and receives zero new removal credit. Intentionally retired alarms include background browser selection and last-tab landing; main startup fallback, SSH project cleanup/survivor routing, exact-PR contradiction/saved-push positives, replay/sidecar rollback and wrapped remote error normalization; records/snapshot missing-diff hydration, ambiguous folder-owner delete refusal, focus no-op notifications, nested editor context-only cache check, pending broadcast-first status and ordinary four-confirmation aggregation; preview-source frontmatter pruning, approved local/runtime agent dispatch, non-GitHub legacy PR cache invalidation, stale merged-head transient-error fallback, empty-queue immediate query reply and unverified-to-concrete preflight risk. Additional intentionally retired alarms are injected host subscription/unsubscribe counts, synthetic editor reveal/draft/fallback/scoped close, ambiguous unread refusals and hidden mark/read roundtrip, immediate connect backoff/noError, positive mirrored evidence-clock renewal, supplied VM failure/success projections and git-local/folder-SSH wake permutations. Remaining temporal/ownership cases are narrower; no equivalent replacement or fresh execution is claimed." ], "demotionRule": "Demote if a retired runtime transport can leave a renderer subscription without a close event, if a close is delivered more than once, if one failing teardown strands its sibling subscriptions, if payload frames from a retired transport reach the renderer, or if a revealed remote terminal can stay blank or reject input after a reconnect." }, @@ -8531,13 +8533,13 @@ "providers": ["paired-runtime", "ssh"], "coveredPlatforms": ["macos", "linux"], "coveredProviders": [], - "coverageNotes": "Audit 3283 removes 20 authored declarations and 31 expanded scenarios, including two whole suites. Retired alarms cover PR refresh-state pruning, shared runtime subscription cleanup and store isolation, language content-change routing and older completion ownership, ordinary panel retry-timer cleanup and pending loading, four hosted-review lifetime permutations, mocked terminal creation error/order wiring, five sleep-inventory variants with pending-frame-only assertions, palette fallback/composite highlights, Windows/UNC encoded-editor input rows, mixed-repository partial failure counts, title setters and generated-title bypass/replacement, five window-close coordinator delegation/guard/finally branches, and ambiguous-old-record frame reveal. These regression checks are intentionally lost under the test-value audit; retained cases are not equivalent replacements. Prior coverage notes and receipts remain historical. Audit 3273 removes 14 authored declarations and 19 expanded scenarios across four whole suites and eight partial suites. Retired alarms cover saved-local cancellation/layout ownership, ambiguous-owner warning reset, folder attachment routing, VM false-capability bypass, abandoned reveal warmup cleanup and viewport claim deduplication/rearming, quiet unrelated remote-removal refusal, startup-command one-shot consumption, repository/floating recovery-ledger rows, fake-React pinned-scroll intent, split-ratio state identity/subscriber suppression and fractional change, cross-host project-group join refusal, three PR request-lifetime permutations, upstream-status preservation on error, and unresolved Git-owner refusal. These regression checks are intentionally lost under the test-value audit; retained scenarios are not equivalent replacements. Historical coverage receipts remain historical, including gate35 subscriber claims. Audit 3256 removes these specific alarms from the broad root unit commands: skill dialog active-share selection, close and pending-share handoff; simple keyed-record deletion; marker live-region insertion, simple landing and nine baseline policy examples; General search/control navigation inventory; orphan-count cache bootstrap; seven Codex code classifications and HTTP 429 warning mapping; two skill unread-root verdict examples; peer-mail payload and conversation-ID rejection; and the GitHub organization TABLE text-field optimistic rollback/failed-envelope example. These include real behaviors; retained tests do not provide equivalent coverage for every removed scenario. Mobile losses are recorded separately and are not coverage of these root commands. Audit3246 retires NewRowsMarker reveal/no-repeat and pane-scoped beforeinput checks; skill-owner option availability/count/dedup/order; six styled Input/Textarea IME forwarding rows; the static Codex/OpenCode smart-key inventory; tab-map AST ratchet diagnostic fixtures; child-roster work-budget and retained-aggregate alarms; malformed persisted floating-cwd fallback/no-crash/empty exact-root checks; the unanswered-host empty-list discriminator; the direct invalidated-cache commit-false assertion; one redundant digit-keyup IME row; cached non-supported Claude title-generator rows; and the duplicate late naming-result singleton. These root broad commands lose those specific alarms without equivalent replacement. Distinct retained owner/state checks have their own bounded claims; the real scheduler still rejects stale response data, while the direct false-return alarm is retired. Audit3231 retires supported-host restore-pane key mapping, closed/open creation-sidebar toggle visibility, unrelated scope-error/null classification and quick-submit reveal/no-create checks. These broad commands lose those real narrow alarms; no replacement coverage is claimed. Audit3219 removes the synthetic Cmd+J extra-source suite; this broad command no longer checks its match/tie placement and selection, announced count, empty-query cap, or workspace hiding with retained recent tabs. No replacement coverage is claimed. Audit3209 composes approved sources3202/3206: deliberately retires seven authored/expanded cases in four whole suites without equivalent replacement. Work-item queries lose real GitHub/GitLab oversized ASCII secret-prefix empty-query and whitespace-before-trim refusal alarms; inputs share the imported size bound and exercise only its fast length branch, with no multibyte or actual provider/exposure guarantee. Skill sharing loses complete/partial managed-bundle and destination-ambiguity association checks plus three negative origin/path/scheme admission examples; these do not establish uploaded contents, arbitrary-URL fetching, authorization or execution. Retain exact originless-project direct-link fallback, cloud-delete confirmation, bundled-target repair/owner isolation and explicit Windows-host preference over stale WSL suites. Rejected3201 runtime-preference removal is excluded. No real cloud/network/host/disk, mobile or mixed-version execution validation is claimed. Audit3200 composes approved source3194: deliberately retires thirteen authored registrations/twenty-seven expanded cases in six whole automation host/list policy suites without equivalent replacement. Real RPC category/retryability and wrapped-timeout recognition, unscoped-failure/scoped-success health evidence precedence, exact-ID create selectors and per-run workspace omission, paired-web local/SSH/absent host catalog routing, incompatible/removed/unhydrated/offline execution health, runtime-before-nested-SSH recovery dispatch, and no-owned-focus/successor/foreign-list focus policy alarms are consciously lost. Retain exact20line orphan allow/refuse/precondition and exact90line cross-host same-ID search suites. No retry-timer/fence lifecycle, actual reconnect/network/write delivery, native focus, mobile/mixed-version runtime or disk persistence coverage is claimed. Audit3191 combines approved source3182/3187/3188: deliberately retires thirteen authored Vitest registrations and fifteen expanded cases, including five whole suites, without equivalent replacement. Attachment intake loses real portal/native-capture terminal interception and unowned-container refusal, immediate child-only committed availability/claim-ref negotiation and delivery, and direct-target over stable focused/background composer routing through disable/re-enable/remount and independent question focus. Exact destination/cache/draft and final-stat owner/workspace/File-release suites remain; they do not replace Surface recipient routing. Automation authoring loses destination runtime catalog membership, local/direct-SSH exclusion of paired-runtime repos, unknown-runtime empty catalog, logical project/host/setup/repo/path context payload, and missing/nonready setup refusal; these were genuine direct helper alarms, while exact schedule transformation, legacy schedule and setup-decision suites remain. Agent picker loses setup-chat/terminal/missing-installer/unsupported-or-unknown-host row projection samples and the ordinary unsearched menu variant; the entire original26-line resume recipe suite remains, including reported bypass versus default/absent permission modes, as does the exact search-result menu callback with its fixtures, model/effort commits and staged Arguments reopen outcome. Rejected predecessor3180 full recipe deletion is excluded. No actual native drag/cursor/focus/IME, upload bytes or disk/restart persistence, full automation save/scheduler/runtime transport, real resume-process flags/environment delivery, or native menu/rendered layout validation is claimed. Audit3178 combines source3169/3170/3175: deliberately retires eight authored units (six Vitest cases and two imperative custom relay scenarios), including two whole suites, without equivalent replacement. Voice Section loses per-model pending-delete isolation across interleaved A/B completion and the two-success refresh-call alarm; exact VoicePane delayed key-clear/newer enabled-toggle merge remains and does not replace row deletion coverage. Speech loses dedicated rating-scale/inclusive-ceiling, unsupported-versus-unmeasured, explicit/system-language precedence/locale alias, accuracy versus fast named/default/best-measured selection, and unmeasured/no-match examples; exact offered-user-pick versus retired-selection case and its fixture remain. Relay loses legacy ping-delivery count/liveness sampled before the silence deadline and grouped malformed Bearer/host-ID 401/429 routing checks; twelve real Worker/DurableObject/shipped-client scenarios remain, not equivalent replacement for those narrow alarms. Six prior speech cases are not all deleted: approved successor3175 keeps the original user-choice case. No actual credential/file persistence, native/GPU/engine/download delivery, production assignment policy or deployed-runtime validation is claimed by this reduction. Audit3165 combines source3160/3162: deliberately retires six authored/expanded cases across three whole suites without equivalent replacement. Launch/status losses: observed React-render pending/resuming coordination across settings and deferred offer read; stale-offer reread suppressing dialog reopen; held-local-chat recovery visibility with new-chat preferences off; disabled-local admission avoiding offer RPC despite an injected but unconsumed paired-tab fixture; and run-only lost-reply uncertainty reachability until direct viewed-run retirement. Launch probe does not prove arbitrary synchronous-store atomicity, the paired fixture is not remote runtime enrollment, and the status case directly marks viewed state rather than rendering the summary. Crew-hook losses: old-host method_not_found cache persists across party changes but is released by independently supplied connection generation/verified pairing status or pairing revision, with actual frame publication and teardown. These are real narrow coordination, admission, uncertainty and mixed-version cache alarms consciously lost. Exact web verified-runtime writer handoff guard remains; it does not replace those alarms or prove live host/native/mobile delivery. Audit3156 combines3147/3150/3152/3153/3154: deliberately retires39authored/40expanded native-chat recovery cases, eight whole suites and two orphan test-support files without equivalent replacement. Lost alarms: lost-reply unconfirmed reconciliation, skipped rows/counts and missed-frame repair, unknown/pending outcome and omitted-failure-list compatibility, uncertain history after dismissal, retry/refusal/dismiss lifecycle, hidden/consumed picker ownership, result-tree keyboard focus/disclosure and all-skipped retirement; unconfirmed-over-conflict guidance and failed-chat changes despite older host timestamps; nearest-listed ancestor/cyclic forest shape, descendant membership, host ordering/missing-host local fallback; skipped/readiness/admission counts, provisional skip/progress monotonicity, early per-chat verdicts with batch pending protection, older-host waiting, start-slot/delivery distinction, retry-over-failure and unknown-after-withdrawal attention; remote snooze/reconnect/reoffer, unseen mixed summary through open/close, watched completion retirement, new success beside old failure, failed-reread mixed-result preservation, filter/collapse completion resets, retry summary replacement and current-offer/history selection; cross-host workspace identity, rendered cyclic reachability, nested tri-state/toggle propagation, project eligibility isolation and collapse preserving selection. Exact fallback-list completion barrier, batched verdict/cleanup retention, stale-read versus dismissal publication race, and requested-but-never-rendered finished-run retirement remain; they do not replace retired alarms. Audit3146 combines source reviews3132/3133/3135/3138/3143: intentionally retire20authored/31expanded cases without equivalent replacement. Provider-session losses: structured-native terminal-resume exclusion, metadata-less completed identity, new-turn completion clearing, Pi provider-only/periodic/manual promotion, changed-transcript launch-config isolation, Pi/omp/prime-agent completed-session remote/manual-shutdown promotion, and quit/done precedence over heartbeat. Side-thread/question losses: finished-pane acquisition, hidden title/recap states, local/relay/relay-done conversation takeover with prompt/session/child resets, plain-message abandonment, compaction/session replacement and completion resets. Codex startup losses: incoming-owner cached child replacement, old-relay foreign live-session correction, completed foreign-root turn-fact permutations. Transcript losses: real temporary-JSONL partial sibling/final-child completion, unlabelled child attribution, compact cached replay preservation and100/1000completed-child roster retention/release. Compiler-ratchet losses: valid-line uncompiled-list parser grammar examples and injected-existence stale-path filtering; these did not exercise actual filesystem canonicalization or build exclusion. These are real lifecycle, ownership, replay, liveness and retention alarms, including recent#40246 regressions, deliberately lost. Retained conditional record replacement, clockless root/SSH owner isolation, persisted main-thread fork rejection, partial/final question-answer lifetime, cached-roster/missing-ID/live HTTP/durable startup boundaries and restarted-relay refusal/acceptance do not replace those losses. No native/SSH/WSL execution or equivalent coverage is claimed. Audit3128 scoped coverage reduction: Audit3121 removes VoiceDictationLanguageSetting.test.tsx (Spanish-to-es callback and unsupported-model Korean option presence) and voice-speech-model-rows.test.ts (provider/language-order/retired-on-disk list policy); these real narrow alarms are deliberately retired without replacement. VoiceSpeechModelSection per-model concurrent deletion remains unchanged. Audit3122 removes the direct absolute/parent-segment sparse-directory exception-type sample and the five-row IPC sparse-preset error-code/non-save table (two authored/six expanded cases). Those real typed-validation and IPC refusal/error-code alarms are deliberately retired. Keep both real symlink/junction floating-directory trust cases and the minimal RPC structured validation-reason serialization case. The RPC case does not replace IPC save/refusal behavior, typed normalization for both path inputs, actual Git sparse checkout or rendered localization. No equivalent replacement or fresh test/runtime/platform/remote/performance validation is claimed. Audit3124 removes ExperimentalPane.test.tsx (ordinary Pet switch callback), WorkspaceDirectorySetting.test.tsx (padded absolute saved-path normalization/no-write blur), and repository-search.perf.test.ts (navigation/selected-pane builder-call policy, fixture cardinality/nonempty entries and renamed project keyword inclusion). These real narrow alarms are retired without replacement; RepositoryPane.search.test.tsx search-to-sparse-editor request remains unchanged. Audit3129: resolver Windows case-insensitive and POSIX case-sensitive configured-env composition plus mocked-base launch-preflight Windows composition are intentionally no longer checked by the two deleted suites. No equivalent coverage claimed. Keep runtime-structured-agent-host-env.test.ts unchanged: configured Windows Claude-home account identity and host-account precedence remain checked. Audit3114 incorporates source3101: retire three structured Claude child-environment wrapper cases covering inherited stamp isolation/default and explicit entrypoint, Windows SDK-key canonicalization/default/duplicate-key order, and configured lookup/final environment/config-dir conjunction. Keep direct auth/session sanitation and Windows-versus-Linux overlay checks, actual executable lookup from supplied inherited PATH, native Windows child environment delivery, and stale option-mutation fencing. These are not equivalent replacements for the retired wrapper alarms. No fresh test/runtime, real login-shell probe, Claude SDK startup, remote/mixed-version, UI or performance result is claimed. Audit3114 incorporates source3105: retire 17 authored/20 expanded daemon launch-note cases, including the entire two-case SessionLaunchNote suite. Deliberately lose split-marker carry across same-token re-arm, stale-token retirement refusal, foreground tri-state and serial settlement, omitted-note/no-incarnation mixed-version policy, sticky retirement, first-incarnation/replacement launch preservation and held-launch precedence. Keep only the unchanged unresolved foreground-read race against a later finished attach. Supplied notes/foreground and runtime calls do not establish actual daemon/main restart, SSH, native Windows observation, mobile UI, equivalent replacement or fresh runtime/performance validation. Audit3114 incorporates source3109: retire six authored/35 expanded pricing cases: 21 accepted model-name examples, 10 unsupported/future-model fail-closed examples, malformed TTL clamp, unknown-model estimate refusal, flat-model long-context disregard and oversized long-context clamp. Keep mixed five-minute/one-hour write allocation and short/all-long/mixed long-context allocation with original fixed oracles. Real parser/refusal/bounds alarms are knowingly lost without equivalent replacement; retained tests do not validate provider rates, actual billing or request threshold classification. Preserve the archived usage-scan-append source-freeze receipt without transferring historical execution/performance credit. No fresh runtime result is claimed. Audit3108 source-only reduction (3094/3095/3100): retire 27 authored/30 expanded cases, including complete markdown view-state, file-preview link-open and CLI agent-server-route suites, without replacement. Deliberate losses include preview visibility/reference lifetime and same-path owners; SSH stat, directory/missing-target, explicit-null owner, nonmarkdown line/column, local URI routing, remote-to-client guard and same-file reuse; document-preview source-owner/folder/reuse routing, stable grant location and outside-workspace POSIX/Windows request projection; and verified remote CLI send/check refusal, suggested --on argv/copy, shell no-probe bypass, unverified-launch admission and older-peer refusal. Retain two markdown source-runtime/qualified-reveal alarms, one stale grant-rejection fence and two remote read/mutation evidence policies, with original callbacks. Final last-wins reveal did not prove transient cancellation; CLI prerequisite did not prove no real send, and envelope tests do not execute server refusal. No fresh runtime, rendered UI, actual file/SSH/paired transport, authorization, mixed-version or performance result is claimed. Audit3096 source-only reduction (3087/3088): retire 69 authored/76 expanded cases, including complete recovery-portals and reconnect-banner suites. Intentionally lose dead/default TUI replay, generated alternate-frame style composition, reset/mode/dimension and legacy missing-mode-boundary alarms, UI notice/action/reveal policies, and isolated recovery lifecycle variants, without equivalent replacement. Retained registrations and callbacks are unchanged; headless cells are not pixels, and no fresh runtime, host, SSH, WSL, rendered-app or performance result is claimed. Audit3086 source-only reduction (3079/3080/3081): intentionally retire 93 authored/100 expanded mock-boundary cases, including the complete spawn-errors and SSH reconnect overlay suites, without replacement. Retired alarms include spawn classification/ownership, reply ceilings and renderer-write failure recovery, disconnect/detach fencing branches, authority facts, and overlay retry/visibility wiring. Retained callbacks are unchanged; no fresh execution, real PTY/SSH, rendered UI, or performance result is claimed. The direct side-effect-facts selector retains six cases: replay exclusion, live sequence handling, stale disposer ownership, one handoff drain, drain-before-snapshot, and stale replacement-snapshot refusal. Successful current-entry snapshot application is not witnessed by the retained snapshot case. Audit2432: The broad unit command loses the isolated BranchPicker open-change notification sample. Its unique true/false callback alarm is intentionally retired; reopening/status-refresh behavior was not exercised. No equivalent replacement or fresh validation of the reduced selector is claimed. Audit2425: The broad unit command loses the workspace-copy-status supplied readError forwarding sample. It did not exercise the branch-switch blocking promised by its title. This alarm is intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2417: The broad unit command loses two ordinary clean Git cherry-pick/revert success samples and two terminal startup foreground-read work-budget samples. These unique alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2412: The broad unit command loses the whole six-case fake-React-hook scroll-anchor suite, two generic draft-retention samples, a simple new-agent order sample, a real history-publication batching-count sample, an unmounted handoff abort/timer sample and three basic WSL preview/error samples. These alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2404: The broad unit command loses the standalone share-name lookup 503 propagation suite, initial deletion placement-kind sample, direct changed-mtime stale sample, first-pass rollback existence example and abandoned-preparation directory sample. These exact alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2397 review amendment: The broad unit command loses three standalone suites, two partial-case definitions and two URL table rows across package/download/placement tests. Keep initial wrong-port authorization, modified independent-copy digest refusal and abort-after-begin cancellation dispatch. The remaining alarms are deliberately retired; no equivalent complete replacement or fresh validation of the reduced selector is claimed. Audit2393 current-parent refresh2401: Remove the basic skill-install service alias sample and original public managed-remove receiptless refusal case. Preserve the upstream request ownership suite and transaction interruption coverage. No equivalent complete replacement or fresh validation of the reduced selector is claimed. Audit2389: The broad unit command loses the missing-preview suite, plain-global destination sample and prepublished-receipt recovery example. No equivalent replacement or fresh validation of the reduced selector is claimed. Audit2385: The broad unit command loses four authored walker/staging/protocol examples (six expanded cases); no equivalent replacement or fresh validation is claimed for the reduced suite. Audit2383: The unscoped Vitest command no longer includes the removed Antigravity catalogue suite; its exact provider-root/owner example has no equivalent replacement or fresh validation claim. Audit2377/2381: The unscoped Vitest command includes the reduced bundled-skill and native-discovery suites; the eight removed backup/legacy/catalogue/symlink/SSH-builder examples have no replacement-equivalence or fresh validation claim here. Audit2162: Reduced inventory-authority source intentionally loses the examples recorded in knownGaps; historical execution is not validation of changed bytes. Historical prior account (preserved verbatim): Audit2133 current-parent preparation: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2095 current-parent preparation2126: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2090 (sources2088/2089): Current reduced suites intentionally retire the alarms listed in knownGaps; prior dated execution and replacement claims do not validate changed source bytes or selectors. Historical prior account (preserved verbatim): Audit2086 (sources2082/2083): Current reduced suites intentionally retire the alarms listed in knownGaps; prior dated execution and replacement claims do not validate changed source bytes or selectors. Historical prior account (preserved verbatim): Audit2076 (sources2073/2074): Intentionally retire these low-value alarms without replacement: src/main/runtime/orca-runtime-tests/terminal-handles-part-02.spec.ts: recovers a moved SSH pane through the tab it now sits in, not the one its lease froze; reports a plain expired orphan; does not report a pane whose only recent lease was superseded; does not report a pane whose only recent lease had its relay id recycled; picks the eligible orphan over a superseded predecessor that matches first; collects the same tabs the per-tab reader reports, in one sweep of the leases; reports no candidate when no lease names any of the worktree tabs. src/main/runtime/orca-runtime-tests/runtime-availability.spec.ts: starts unavailable with no authoritative window; reports the configured Windows terminal shell on status; reports floating workspace availability from settings on status; polls floating tabs with targeted PTY liveness and no repo/provider inventory; hydrates persisted tabs when the store cannot report repos; advertises browser screencast only when a renderer window is available; routes mobile Codex reset consumption through the account mutation coordinator; maps a definite pre-provider rejection into an authoritative current snapshot. Existing unrelated evidenceRuns retain their original scope; unchanged dated receipt objects do not validate changed source bytes or reduced selectors. No fresh gate execution or historical import-closure equivalence is claimed. Frozen current literal-import graph reaches these changed test bytes; unresolved local and computed edges remain debt, and current reachability is not historical execution or equivalent replacement evidence. Historical prior account (preserved verbatim): Audit2003: Remove SSH/absent-inventory attach refusal, later-subscriber retry, no-view adoption/takeback, provider-tail/unknown-read projections, failed-keystroke retry and simpler loss reattach examples. Keep the existing-subscriber inventory-ready retry alias only at its retained callback, plus retained held-input cancellation/replacement and overlapping attach/loss fences. The inventory driver also loses the whole empty-worktree-publication registration and folder-host/unverifiable scalar examples. Retire the entire dated10-case attach receipt; retain16 independent receipts only in their original scopes. No retained-memory or real-daemon measurement follows from supplied provider inventories. Changed-source prior results do not validate reduced-source bytes. No fresh execution, equivalent replacement, red/green, measured budget, soak, physical provider/PTY, rendered, live remote/mobile or cross-platform result is claimed. Historical prior account (preserved verbatim): Audit1991: Remove initial-snapshot sequence-domain, limited-tail/truncation and unknown-output-sequence aliases whose callbacks are removed. The source retains partial-chunk replay and requested-snapshot retry/admission at supplied snapshot/data seams, not equivalent replacement or measured retained-memory proof. Preserve the existing stream/pending-wait capacity aliases only to their retained owning multiplex callbacks with supplied PTY resolutions. Removing the sibling-PTY heartbeat dedup work-count sample does not establish a new decorative fanout budget; the unrelated-PTY cancellation fence survives. Preserve17 unrelated dated receipts. Changed-source prior results do not validate reduced-source bytes. No fresh execution, equivalent replacement, red/green, measured budget, soak, physical provider/PTY, rendered, live remote/mobile or cross-platform result is claimed. Historical prior account (preserved verbatim): Audit1983: Remove the reasonless-close selector and narrow census aliases to actual retained runtime and injected-inventory callbacks. The removed synthetic census-dedup and isolated pre-boundary timing cases receive no replacement credit; preserve17 unrelated dated receipts. Changed-source prior results do not validate reduced-source bytes. No fresh execution, equivalent replacement, red/green, measured budget, soak, provider/PTY, rendered, live remote/mobile or cross-platform result is claimed. Historical prior account (preserved verbatim): Audit1939 (sources1934/1935): Delete the synthetic watcher-synchronization and partial-reconciliation suites. Retire all affected host-fact, capability-owner, activation-residue and retention-cap aliases because the remaining callbacks do not establish those full claims. Keep exact local hook/timer, byte-stream side effects, exit/disposal, scroll-intent cleanup and deterministic local rank/TTL progression callbacks within their mocked-host scope. No physical paired-host retention, resource budget or equivalent replacement evidence is assigned. The generic broad test command remains a runnable discovery command, never a dated execution receipt. Preserve meaningful remaining selectors/assertions and unchanged dated receipts within their original scope. Reduced selectors have no fresh gate execution evidence in this metadata packet. No equivalent replacement, physical watcher/PTY/provider, live SSH/remote/mobile, rendered, cross-platform, soak or measured-budget result is claimed. Historical prior account (preserved verbatim): Audit1931 (sources1928/1929): Delete the complete hook-agent-status projection suite and its two behavioral assertion aliases. Supplied stored hook/title/resume/staleness/rename/question/generation/PTY-retirement/snapshot-version projections are intentionally lost. The separate osc-status-scan gate mentions this source only in existing historical notes and receives no mutation. No measured hidden-output retention, CPU/RSS or resource budget result is claimed by the deleted source or this audit. Preserve meaningful remaining selectors/assertions and unchanged dated receipts within their original scope. Reduced selectors have no fresh gate execution evidence in this metadata packet. No equivalent replacement, physical watcher/PTY/provider, live SSH/remote/mobile, rendered, cross-platform, soak or measured-budget result is claimed. Historical prior account (preserved verbatim): Module ownership cleanup retires the modeled cold-park private watcher/render/work-count suites under the current test policy. Their assertions are no longer active evidence. Retained lifecycle tests and headed/headless journeys do not establish equivalent coverage for those removed harness alarms. Audit1640 removes low-value IPC, SSH, workspace and transcript-watcher tests without equivalent replacement coverage. Per-source reviews record retained public refusal, cancellation, execution-host and real-filesystem outcomes with injected/native/remote limits. Affected historical receipts are retired; gates without active current evidence are downgraded. Historical scope before this audit: Audit1634 removes low-value IPC, filesystem and runtime projections, argument inventories and duplicate examples without equivalent replacement coverage. Per-source reviews record retained cancellation, ownership, authorization, filesystem and SQLite boundaries with injected/native/remote limits. Affected historical receipts are retired; gates without active current evidence are downgraded. Historical scope before this audit: Audit1627 removes low-value mocked daemon projections, scalar tables and duplicate terminal examples without equivalent replacement coverage. Per-source reviews record retained terminal content preservation, process ownership refusal and recovery boundaries together with injected/native/remote limits. Affected historical receipts are retired; gates without active current evidence are downgraded. Historical scope before this audit: Retained exact unchanged-source receipts remain the only current execution evidence. Reduced selectors have no fresh execution result. Audit1417 intentionally deletes src/renderer/src/components/terminal-pane/pty-connection-hidden-tui-snapshot-replay.spec.ts: Loses rich hidden snapshot sequence replay/grid resize and forced repaint after hidden snapshot alarms, including live-trigger deduplication. deletes src/renderer/src/components/terminal-pane/terminal-cold-park-verdict-loop.test.tsx: Loses modeled React oscillation alarm; real pane/watchers are not exercised. deletes src/renderer/src/runtime/remote-runtime-terminal-parse-backpressure.test.ts: Loses delayed credit until parsing, malformed frame/unknown stream handling, discarded transformed output recovery and failed ACK rearm alarms. No equivalent replacement coverage or fresh result is claimed. Historical coverage account: Audit1412 changes referenced sources. Retained unchanged-source receipts apply only to their unchanged commands; the reduced selectors have no new execution result. Historical coverage account (not a current claim for changed sources): This audit removes the browser response-after-manual-disconnect example. Its distinct in-flight response fencing alarm is lost; retained queued-call disconnect tests are not an equivalent replacement. Historical commands and results remain historical. Deterministic headed macOS runs launch an isolated Orca desktop server and a separate paired web client. A byte-identical headless run uses an isolated `orca serve` host. Both create six real paired host PTYs with bounded high-output scrollback, prove sustained output while all six client xterms are warm-mounted but hidden causes zero renderer scheduler work, then drive 180 timed real-PTY spinner frames through a second production `session.tabs.subscribeAll` transport and the real Zustand store. Each worktree must publish and apply only its exact initial-working and final-idle titles. Both topologies ordinary-park five xterms without enabling the lossy retention budget, assert bounded cells/heap/timer lag, then restore the bounded authoritative tail exactly once on the original PTY including output produced while parked and continued input/output. The headed oracle additionally keeps every remote target workspace and terminal unmounted in the host renderer before and after client recovery. Production-parity React contracts reproduce and remove the independent cold-park watcher/title feedback loop, including memo-cache discard, StrictMode cleanup replay, detached split-PTY replacement, and the zero-park fast path. A deterministic cross-boundary contract drives 24 real PTY trackers in distinct worktrees through 2,880 decorative spinner and bare-native redraw chunks and counts host publications, serialized bytes, renderer apply calls, and store mutations while preserving exact per-PTY raw chunks and per-worktree semantic transitions. Fake-clock continuation beyond the 30-minute stale boundary requires one deduplicated refresh per worktree every 15 minutes, globally spaced by at least 50 ms, with every mirrored working status still fresh. Exact-identical Pi plus rotating normalized Pi/Grok frames renew coarse working/permission state; rich prompt/tool/question fields retain their original 30-minute lease, and `stateStartedAt`/acknowledgement identity remain stable across title/hook source swaps. A separate headed desktop-client journey relaunches the host main process while retaining the daemon and a daemon-backgrounded PTY, then requires first-observation foreground sync and continued input/output on the same PTY. Unit coverage keeps layout versions out of snapshot output high-waters when a restored snapshot has no output sequence and retries an existing subscriber only after authoritative provider inventory proves the retained PTY exists. Separate headed/headless ACK-starvation tests recover one stalled stream without replacing its PTY. A headed output-drop oracle proves a successful snapshot probe cannot certify a stale live stream when the authoritative PTY sequence advanced beyond the client high-water. Unit coverage requires an unsequenced client to establish a first-probe baseline, remain attached at the same sequence, and recover only after a later probe advances. A capability-disabled run proves legacy hosts retain the prior lossy limit/TTL fallback. Unit tests cover exact-owner capability routing, raw-stream release, singleton side-effect facts with timed handoff cleanup, 64 simultaneous synthetic-title sources with zero decorative client events after convergence, per-client late-subscribe recovery, semantic bell/title transitions, local animation-frame preservation, legacy no-output-pause delivery gating with exact snapshot restore, provider-authoritative snapshots, 128 active streams plus retry after a 129th-stream capacity rejection, capacity-pressure backoff, full split-leaf remint reconciliation, truncation, and manual-disconnect queue fencing. Linux, Windows, live SSH, and production-scale paired hosts remain gaps. The audit removed the E2E parking override/debug-handle suite. Override exposure guards, delay/retention independence, TTL filtering and debug-handle forwarding alarms are lost. Retained real parking journeys do not establish equivalent test-harness configuration coverage. The test-value audit removes separate responsive-stream, intervening-control-frame and capacity-error classification examples. Retained multiplexer checks use fake clocks and captured transport callbacks; their per-stream isolation, deadline and probe-baseline assertions do not prove an actual host restart or equivalent replacement coverage. Historical run commands and results remain historical. The test-value audit removes the standalone retained/live metadata projection and additive-preference negative example from runtime-client-events.test.ts. Its remaining case checks partial-authority event admission through a captured callback; it does not establish full-pair projection, actual peer delivery or equivalent replacement coverage. Historical commands and results remain historical. The isolated accepted-handle-events observer suite is removed. Its runtime/worktree/pane membership, once-only delivery and listener-release ledger alarms are lost. Live hidden-retention evidence does not establish equivalent observer coverage. Audit1292: The entire host-session mirror empty-inventory settle suite is removed. Live-unpublished versus genuinely-empty hydration, same-ID revision response/in-flight fencing and cleared-tracking pending-probe invalidation alarms are lost. The singleton store and inventories were mocked; no real host census or resume delivery or equivalent replacement coverage is claimed. Audit1302: src/main/runtime/session-tabs-inventory-publication.test.ts: Keep actual runtime public inventory authority across renderer epochs/resync, fallback, aborts and invalid graph publishers. Remove copied nonempty publication, private scan counters/collector and known-host replacement, fake refresh that performs the restoration itself, environment capability flag, and private resume-store characterization whose fixture supplies reservation/rollback ordering. Lose isolated refresh/churn/receiver/capability and copied-payload wiring alarms; no equivalent replacement. Reduced selectors require fresh validation; prior full-suite receipts do not validate removed or changed coverage. No equivalent replacement or physical-provider claim. Audit1312 removes low-value imported specs from aggregate test drivers; old whole-driver execution receipts are archived. Retained registrations are unchanged. No equivalent replacement coverage is claimed. Audit1318: src/shared/remote-runtime/control/remote-runtime-shared-control-connection.test.ts: Retain real local encrypted WebSocket regressions for pre-ready socket replacement preserving a request, close-before-ready logical subscription cleanup, unrelated RPC surviving another deadline, and pending setup abort leaving a sibling pending. Host server is synthetic and uses production crypto; kept scenarios also retain internal diagnostics/memory assertions unchanged. Remove happy routing, authority-envelope, unknown-ID/log, cleanup enum, binary, keepalive/liveness and production-budget/private socket inventories; intentionally lose those alarms, no physical host authorization, independent crypto or remote provider claim. Reduced selectors need fresh validation; historical full-suite receipts do not validate the changed coverage. No equivalent replacement or physical-provider claim. Audit1346 removes the entire private-state-injected session-tabs rich-status boundary suite. Its stale task/question, neutral-title preservation, owner-change and provider-generation alarms are intentionally lost. Retained real terminal journeys do not establish equivalent replacement coverage. The prior mixed 42-contract execution receipt is historical and must not validate the reduced current selector; fresh validation remains required. Audit1352: focused Linux unit selections validated on source head b638e07d395b76af3ba6b03761a1a0fe7e5e026e. Historical statements above retain their original scope. Intentional test losses are recorded in knownGaps; these runs claim no physical-provider, p95, rendered E2E or cross-platform validation. Audit1360: focused Linux unit selections validated on source head 415c9cffc2d10024131ec4b6721767a22195de6d. Historical statements above retain their original scope. Intentional test losses are recorded in knownGaps; these runs claim no physical-provider, p95, rendered E2E or cross-platform validation. Audit1383: src/main/runtime/orca-runtime-tests/worktree-native-chat-setup.spec.ts reduced. Lose command-list/receipt/default/background activation matrices whose provider spawn returns canned IDs. Retained test proves actual tab allocation separation, not terminal startup. No equivalent replacement coverage is claimed. Existing exact unaffected receipts and their platform/provider/budget claims remain scoped to unchanged selectors. Changed optional selectors have no new execution result. Audit1391: src/renderer/src/components/terminal-pane/pty-connection-remote-pause-drop-notice.spec.ts reduced. Lose repeated quiet switches avoiding snapshots and legacy host without drop-report capability requesting a snapshot. Retained imported registrar uses fake transport/xterm writes, exercising real gap/restore lifecycle rather than actual terminal rendering. No equivalent replacement coverage is claimed. The existing primary-selector receipt and its claims remain scoped to their unchanged sources; the broad optional command has no new execution result. Audit1396: src/renderer/src/components/terminal-pane/terminal-parked-watcher-reconciliation.test.ts reduced. Retire standalone reconcile set output and positive untouchedFreshSpawn/workspaceOwner copying alarms; no native watcher execution claim. No equivalent replacement coverage is claimed. Existing exact unaffected receipts remain unchanged and apply only to their unchanged selectors. Changed optional selectors have no new execution result. Audit1401: src/main/runtime/orca-runtime-tests/mobile-session-tabs-duplicate-pty-repair.spec.ts removed. Loses listing-on-already-repaired-data alarm; it never established runtime repair invocation. src/main/runtime/orca-runtime-tests/mobile-session-tabs-split-agent-tab.spec.ts removed. Loses actual mobile split sibling shell versus recorded-agent resume command alarms; no equivalent coverage asserted. src/main/runtime/orca-runtime-tests/worktree-native-chat-setup.spec.ts removed. Loses separate setup/startup tab result in that manually assembled path. src/main/runtime/orca-runtime.test.ts reduced. Driver registration/import of a whole-deleted selected spec is removed; directly authored cases remain unchanged. No extra authored removal credit. No equivalent replacement coverage is claimed. Existing exact unaffected receipts remain unchanged and apply only to their unchanged selectors. Changed optional selectors have no new execution result. Audit1402: src/renderer/src/components/terminal-pane/pty-connection-park-reveal-model-snapshot.spec.ts reduced. Loses basic paired serialize/initial replay forwarding check; hidden alt-frame grid/precedence policy remains. No real terminal renderer claim. No equivalent replacement coverage is claimed. The existing primary-selector receipt and its claims remain scoped to their unchanged sources; the broad optional command has no new execution result. Audit1412: src/main/runtime/mobile-session-tabs-agent-status-heartbeat.test.ts reduced. Loses FIFO fairness/spacing, semantic bypass/cancellation, delayed-boundary scheduling and teardown timer-cleanup alarms. Retained fixed emission cases do not replace those outcomes. No equivalent replacement coverage is claimed.", + "coverageNotes": "Audit 3292 combines adopted 3285/3287/3289/3293 removals: 40 authored declarations and 47 expanded scenarios, including whole frame-editor-view, ambiguous remote-delete-refusal, unverifiable-host subscription and editor-close cleanup suites. The previously reviewed dock-badge suite was already removed upstream in PR 40895 and receives zero new removal credit. Intentionally retired alarms include background browser selection and last-tab landing; main startup fallback, SSH project cleanup/survivor routing, exact-PR contradiction/saved-push positives, replay/sidecar rollback and wrapped remote error normalization; records/snapshot missing-diff hydration, ambiguous folder-owner delete refusal, focus no-op notifications, nested editor context-only cache check, pending broadcast-first status and ordinary four-confirmation aggregation; preview-source frontmatter pruning, approved local/runtime agent dispatch, non-GitHub legacy PR cache invalidation, stale merged-head transient-error fallback, empty-queue immediate query reply and unverified-to-concrete preflight risk. Additional intentionally retired alarms are injected host subscription/unsubscribe counts, synthetic editor reveal/draft/fallback/scoped close, ambiguous unread refusals and hidden mark/read roundtrip, immediate connect backoff/noError, positive mirrored evidence-clock renewal, supplied VM failure/success projections and git-local/folder-SSH wake permutations. Remaining temporal/ownership cases are narrower; no equivalent replacement or fresh execution is claimed. Audit 3283 removes 20 authored declarations and 31 expanded scenarios, including two whole suites. Retired alarms cover PR refresh-state pruning, shared runtime subscription cleanup and store isolation, language content-change routing and older completion ownership, ordinary panel retry-timer cleanup and pending loading, four hosted-review lifetime permutations, mocked terminal creation error/order wiring, five sleep-inventory variants with pending-frame-only assertions, palette fallback/composite highlights, Windows/UNC encoded-editor input rows, mixed-repository partial failure counts, title setters and generated-title bypass/replacement, five window-close coordinator delegation/guard/finally branches, and ambiguous-old-record frame reveal. These regression checks are intentionally lost under the test-value audit; retained cases are not equivalent replacements. Prior coverage notes and receipts remain historical. Audit 3273 removes 14 authored declarations and 19 expanded scenarios across four whole suites and eight partial suites. Retired alarms cover saved-local cancellation/layout ownership, ambiguous-owner warning reset, folder attachment routing, VM false-capability bypass, abandoned reveal warmup cleanup and viewport claim deduplication/rearming, quiet unrelated remote-removal refusal, startup-command one-shot consumption, repository/floating recovery-ledger rows, fake-React pinned-scroll intent, split-ratio state identity/subscriber suppression and fractional change, cross-host project-group join refusal, three PR request-lifetime permutations, upstream-status preservation on error, and unresolved Git-owner refusal. These regression checks are intentionally lost under the test-value audit; retained scenarios are not equivalent replacements. Historical coverage receipts remain historical, including gate35 subscriber claims. Audit 3256 removes these specific alarms from the broad root unit commands: skill dialog active-share selection, close and pending-share handoff; simple keyed-record deletion; marker live-region insertion, simple landing and nine baseline policy examples; General search/control navigation inventory; orphan-count cache bootstrap; seven Codex code classifications and HTTP 429 warning mapping; two skill unread-root verdict examples; peer-mail payload and conversation-ID rejection; and the GitHub organization TABLE text-field optimistic rollback/failed-envelope example. These include real behaviors; retained tests do not provide equivalent coverage for every removed scenario. Mobile losses are recorded separately and are not coverage of these root commands. Audit3246 retires NewRowsMarker reveal/no-repeat and pane-scoped beforeinput checks; skill-owner option availability/count/dedup/order; six styled Input/Textarea IME forwarding rows; the static Codex/OpenCode smart-key inventory; tab-map AST ratchet diagnostic fixtures; child-roster work-budget and retained-aggregate alarms; malformed persisted floating-cwd fallback/no-crash/empty exact-root checks; the unanswered-host empty-list discriminator; the direct invalidated-cache commit-false assertion; one redundant digit-keyup IME row; cached non-supported Claude title-generator rows; and the duplicate late naming-result singleton. These root broad commands lose those specific alarms without equivalent replacement. Distinct retained owner/state checks have their own bounded claims; the real scheduler still rejects stale response data, while the direct false-return alarm is retired. Audit3231 retires supported-host restore-pane key mapping, closed/open creation-sidebar toggle visibility, unrelated scope-error/null classification and quick-submit reveal/no-create checks. These broad commands lose those real narrow alarms; no replacement coverage is claimed. Audit3219 removes the synthetic Cmd+J extra-source suite; this broad command no longer checks its match/tie placement and selection, announced count, empty-query cap, or workspace hiding with retained recent tabs. No replacement coverage is claimed. Audit3209 composes approved sources3202/3206: deliberately retires seven authored/expanded cases in four whole suites without equivalent replacement. Work-item queries lose real GitHub/GitLab oversized ASCII secret-prefix empty-query and whitespace-before-trim refusal alarms; inputs share the imported size bound and exercise only its fast length branch, with no multibyte or actual provider/exposure guarantee. Skill sharing loses complete/partial managed-bundle and destination-ambiguity association checks plus three negative origin/path/scheme admission examples; these do not establish uploaded contents, arbitrary-URL fetching, authorization or execution. Retain exact originless-project direct-link fallback, cloud-delete confirmation, bundled-target repair/owner isolation and explicit Windows-host preference over stale WSL suites. Rejected3201 runtime-preference removal is excluded. No real cloud/network/host/disk, mobile or mixed-version execution validation is claimed. Audit3200 composes approved source3194: deliberately retires thirteen authored registrations/twenty-seven expanded cases in six whole automation host/list policy suites without equivalent replacement. Real RPC category/retryability and wrapped-timeout recognition, unscoped-failure/scoped-success health evidence precedence, exact-ID create selectors and per-run workspace omission, paired-web local/SSH/absent host catalog routing, incompatible/removed/unhydrated/offline execution health, runtime-before-nested-SSH recovery dispatch, and no-owned-focus/successor/foreign-list focus policy alarms are consciously lost. Retain exact20line orphan allow/refuse/precondition and exact90line cross-host same-ID search suites. No retry-timer/fence lifecycle, actual reconnect/network/write delivery, native focus, mobile/mixed-version runtime or disk persistence coverage is claimed. Audit3191 combines approved source3182/3187/3188: deliberately retires thirteen authored Vitest registrations and fifteen expanded cases, including five whole suites, without equivalent replacement. Attachment intake loses real portal/native-capture terminal interception and unowned-container refusal, immediate child-only committed availability/claim-ref negotiation and delivery, and direct-target over stable focused/background composer routing through disable/re-enable/remount and independent question focus. Exact destination/cache/draft and final-stat owner/workspace/File-release suites remain; they do not replace Surface recipient routing. Automation authoring loses destination runtime catalog membership, local/direct-SSH exclusion of paired-runtime repos, unknown-runtime empty catalog, logical project/host/setup/repo/path context payload, and missing/nonready setup refusal; these were genuine direct helper alarms, while exact schedule transformation, legacy schedule and setup-decision suites remain. Agent picker loses setup-chat/terminal/missing-installer/unsupported-or-unknown-host row projection samples and the ordinary unsearched menu variant; the entire original26-line resume recipe suite remains, including reported bypass versus default/absent permission modes, as does the exact search-result menu callback with its fixtures, model/effort commits and staged Arguments reopen outcome. Rejected predecessor3180 full recipe deletion is excluded. No actual native drag/cursor/focus/IME, upload bytes or disk/restart persistence, full automation save/scheduler/runtime transport, real resume-process flags/environment delivery, or native menu/rendered layout validation is claimed. Audit3178 combines source3169/3170/3175: deliberately retires eight authored units (six Vitest cases and two imperative custom relay scenarios), including two whole suites, without equivalent replacement. Voice Section loses per-model pending-delete isolation across interleaved A/B completion and the two-success refresh-call alarm; exact VoicePane delayed key-clear/newer enabled-toggle merge remains and does not replace row deletion coverage. Speech loses dedicated rating-scale/inclusive-ceiling, unsupported-versus-unmeasured, explicit/system-language precedence/locale alias, accuracy versus fast named/default/best-measured selection, and unmeasured/no-match examples; exact offered-user-pick versus retired-selection case and its fixture remain. Relay loses legacy ping-delivery count/liveness sampled before the silence deadline and grouped malformed Bearer/host-ID 401/429 routing checks; twelve real Worker/DurableObject/shipped-client scenarios remain, not equivalent replacement for those narrow alarms. Six prior speech cases are not all deleted: approved successor3175 keeps the original user-choice case. No actual credential/file persistence, native/GPU/engine/download delivery, production assignment policy or deployed-runtime validation is claimed by this reduction. Audit3165 combines source3160/3162: deliberately retires six authored/expanded cases across three whole suites without equivalent replacement. Launch/status losses: observed React-render pending/resuming coordination across settings and deferred offer read; stale-offer reread suppressing dialog reopen; held-local-chat recovery visibility with new-chat preferences off; disabled-local admission avoiding offer RPC despite an injected but unconsumed paired-tab fixture; and run-only lost-reply uncertainty reachability until direct viewed-run retirement. Launch probe does not prove arbitrary synchronous-store atomicity, the paired fixture is not remote runtime enrollment, and the status case directly marks viewed state rather than rendering the summary. Crew-hook losses: old-host method_not_found cache persists across party changes but is released by independently supplied connection generation/verified pairing status or pairing revision, with actual frame publication and teardown. These are real narrow coordination, admission, uncertainty and mixed-version cache alarms consciously lost. Exact web verified-runtime writer handoff guard remains; it does not replace those alarms or prove live host/native/mobile delivery. Audit3156 combines3147/3150/3152/3153/3154: deliberately retires39authored/40expanded native-chat recovery cases, eight whole suites and two orphan test-support files without equivalent replacement. Lost alarms: lost-reply unconfirmed reconciliation, skipped rows/counts and missed-frame repair, unknown/pending outcome and omitted-failure-list compatibility, uncertain history after dismissal, retry/refusal/dismiss lifecycle, hidden/consumed picker ownership, result-tree keyboard focus/disclosure and all-skipped retirement; unconfirmed-over-conflict guidance and failed-chat changes despite older host timestamps; nearest-listed ancestor/cyclic forest shape, descendant membership, host ordering/missing-host local fallback; skipped/readiness/admission counts, provisional skip/progress monotonicity, early per-chat verdicts with batch pending protection, older-host waiting, start-slot/delivery distinction, retry-over-failure and unknown-after-withdrawal attention; remote snooze/reconnect/reoffer, unseen mixed summary through open/close, watched completion retirement, new success beside old failure, failed-reread mixed-result preservation, filter/collapse completion resets, retry summary replacement and current-offer/history selection; cross-host workspace identity, rendered cyclic reachability, nested tri-state/toggle propagation, project eligibility isolation and collapse preserving selection. Exact fallback-list completion barrier, batched verdict/cleanup retention, stale-read versus dismissal publication race, and requested-but-never-rendered finished-run retirement remain; they do not replace retired alarms. Audit3146 combines source reviews3132/3133/3135/3138/3143: intentionally retire20authored/31expanded cases without equivalent replacement. Provider-session losses: structured-native terminal-resume exclusion, metadata-less completed identity, new-turn completion clearing, Pi provider-only/periodic/manual promotion, changed-transcript launch-config isolation, Pi/omp/prime-agent completed-session remote/manual-shutdown promotion, and quit/done precedence over heartbeat. Side-thread/question losses: finished-pane acquisition, hidden title/recap states, local/relay/relay-done conversation takeover with prompt/session/child resets, plain-message abandonment, compaction/session replacement and completion resets. Codex startup losses: incoming-owner cached child replacement, old-relay foreign live-session correction, completed foreign-root turn-fact permutations. Transcript losses: real temporary-JSONL partial sibling/final-child completion, unlabelled child attribution, compact cached replay preservation and100/1000completed-child roster retention/release. Compiler-ratchet losses: valid-line uncompiled-list parser grammar examples and injected-existence stale-path filtering; these did not exercise actual filesystem canonicalization or build exclusion. These are real lifecycle, ownership, replay, liveness and retention alarms, including recent#40246 regressions, deliberately lost. Retained conditional record replacement, clockless root/SSH owner isolation, persisted main-thread fork rejection, partial/final question-answer lifetime, cached-roster/missing-ID/live HTTP/durable startup boundaries and restarted-relay refusal/acceptance do not replace those losses. No native/SSH/WSL execution or equivalent coverage is claimed. Audit3128 scoped coverage reduction: Audit3121 removes VoiceDictationLanguageSetting.test.tsx (Spanish-to-es callback and unsupported-model Korean option presence) and voice-speech-model-rows.test.ts (provider/language-order/retired-on-disk list policy); these real narrow alarms are deliberately retired without replacement. VoiceSpeechModelSection per-model concurrent deletion remains unchanged. Audit3122 removes the direct absolute/parent-segment sparse-directory exception-type sample and the five-row IPC sparse-preset error-code/non-save table (two authored/six expanded cases). Those real typed-validation and IPC refusal/error-code alarms are deliberately retired. Keep both real symlink/junction floating-directory trust cases and the minimal RPC structured validation-reason serialization case. The RPC case does not replace IPC save/refusal behavior, typed normalization for both path inputs, actual Git sparse checkout or rendered localization. No equivalent replacement or fresh test/runtime/platform/remote/performance validation is claimed. Audit3124 removes ExperimentalPane.test.tsx (ordinary Pet switch callback), WorkspaceDirectorySetting.test.tsx (padded absolute saved-path normalization/no-write blur), and repository-search.perf.test.ts (navigation/selected-pane builder-call policy, fixture cardinality/nonempty entries and renamed project keyword inclusion). These real narrow alarms are retired without replacement; RepositoryPane.search.test.tsx search-to-sparse-editor request remains unchanged. Audit3129: resolver Windows case-insensitive and POSIX case-sensitive configured-env composition plus mocked-base launch-preflight Windows composition are intentionally no longer checked by the two deleted suites. No equivalent coverage claimed. Keep runtime-structured-agent-host-env.test.ts unchanged: configured Windows Claude-home account identity and host-account precedence remain checked. Audit3114 incorporates source3101: retire three structured Claude child-environment wrapper cases covering inherited stamp isolation/default and explicit entrypoint, Windows SDK-key canonicalization/default/duplicate-key order, and configured lookup/final environment/config-dir conjunction. Keep direct auth/session sanitation and Windows-versus-Linux overlay checks, actual executable lookup from supplied inherited PATH, native Windows child environment delivery, and stale option-mutation fencing. These are not equivalent replacements for the retired wrapper alarms. No fresh test/runtime, real login-shell probe, Claude SDK startup, remote/mixed-version, UI or performance result is claimed. Audit3114 incorporates source3105: retire 17 authored/20 expanded daemon launch-note cases, including the entire two-case SessionLaunchNote suite. Deliberately lose split-marker carry across same-token re-arm, stale-token retirement refusal, foreground tri-state and serial settlement, omitted-note/no-incarnation mixed-version policy, sticky retirement, first-incarnation/replacement launch preservation and held-launch precedence. Keep only the unchanged unresolved foreground-read race against a later finished attach. Supplied notes/foreground and runtime calls do not establish actual daemon/main restart, SSH, native Windows observation, mobile UI, equivalent replacement or fresh runtime/performance validation. Audit3114 incorporates source3109: retire six authored/35 expanded pricing cases: 21 accepted model-name examples, 10 unsupported/future-model fail-closed examples, malformed TTL clamp, unknown-model estimate refusal, flat-model long-context disregard and oversized long-context clamp. Keep mixed five-minute/one-hour write allocation and short/all-long/mixed long-context allocation with original fixed oracles. Real parser/refusal/bounds alarms are knowingly lost without equivalent replacement; retained tests do not validate provider rates, actual billing or request threshold classification. Preserve the archived usage-scan-append source-freeze receipt without transferring historical execution/performance credit. No fresh runtime result is claimed. Audit3108 source-only reduction (3094/3095/3100): retire 27 authored/30 expanded cases, including complete markdown view-state, file-preview link-open and CLI agent-server-route suites, without replacement. Deliberate losses include preview visibility/reference lifetime and same-path owners; SSH stat, directory/missing-target, explicit-null owner, nonmarkdown line/column, local URI routing, remote-to-client guard and same-file reuse; document-preview source-owner/folder/reuse routing, stable grant location and outside-workspace POSIX/Windows request projection; and verified remote CLI send/check refusal, suggested --on argv/copy, shell no-probe bypass, unverified-launch admission and older-peer refusal. Retain two markdown source-runtime/qualified-reveal alarms, one stale grant-rejection fence and two remote read/mutation evidence policies, with original callbacks. Final last-wins reveal did not prove transient cancellation; CLI prerequisite did not prove no real send, and envelope tests do not execute server refusal. No fresh runtime, rendered UI, actual file/SSH/paired transport, authorization, mixed-version or performance result is claimed. Audit3096 source-only reduction (3087/3088): retire 69 authored/76 expanded cases, including complete recovery-portals and reconnect-banner suites. Intentionally lose dead/default TUI replay, generated alternate-frame style composition, reset/mode/dimension and legacy missing-mode-boundary alarms, UI notice/action/reveal policies, and isolated recovery lifecycle variants, without equivalent replacement. Retained registrations and callbacks are unchanged; headless cells are not pixels, and no fresh runtime, host, SSH, WSL, rendered-app or performance result is claimed. Audit3086 source-only reduction (3079/3080/3081): intentionally retire 93 authored/100 expanded mock-boundary cases, including the complete spawn-errors and SSH reconnect overlay suites, without replacement. Retired alarms include spawn classification/ownership, reply ceilings and renderer-write failure recovery, disconnect/detach fencing branches, authority facts, and overlay retry/visibility wiring. Retained callbacks are unchanged; no fresh execution, real PTY/SSH, rendered UI, or performance result is claimed. The direct side-effect-facts selector retains six cases: replay exclusion, live sequence handling, stale disposer ownership, one handoff drain, drain-before-snapshot, and stale replacement-snapshot refusal. Successful current-entry snapshot application is not witnessed by the retained snapshot case. Audit2432: The broad unit command loses the isolated BranchPicker open-change notification sample. Its unique true/false callback alarm is intentionally retired; reopening/status-refresh behavior was not exercised. No equivalent replacement or fresh validation of the reduced selector is claimed. Audit2425: The broad unit command loses the workspace-copy-status supplied readError forwarding sample. It did not exercise the branch-switch blocking promised by its title. This alarm is intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2417: The broad unit command loses two ordinary clean Git cherry-pick/revert success samples and two terminal startup foreground-read work-budget samples. These unique alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2412: The broad unit command loses the whole six-case fake-React-hook scroll-anchor suite, two generic draft-retention samples, a simple new-agent order sample, a real history-publication batching-count sample, an unmounted handoff abort/timer sample and three basic WSL preview/error samples. These alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2404: The broad unit command loses the standalone share-name lookup 503 propagation suite, initial deletion placement-kind sample, direct changed-mtime stale sample, first-pass rollback existence example and abandoned-preparation directory sample. These exact alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2397 review amendment: The broad unit command loses three standalone suites, two partial-case definitions and two URL table rows across package/download/placement tests. Keep initial wrong-port authorization, modified independent-copy digest refusal and abort-after-begin cancellation dispatch. The remaining alarms are deliberately retired; no equivalent complete replacement or fresh validation of the reduced selector is claimed. Audit2393 current-parent refresh2401: Remove the basic skill-install service alias sample and original public managed-remove receiptless refusal case. Preserve the upstream request ownership suite and transaction interruption coverage. No equivalent complete replacement or fresh validation of the reduced selector is claimed. Audit2389: The broad unit command loses the missing-preview suite, plain-global destination sample and prepublished-receipt recovery example. No equivalent replacement or fresh validation of the reduced selector is claimed. Audit2385: The broad unit command loses four authored walker/staging/protocol examples (six expanded cases); no equivalent replacement or fresh validation is claimed for the reduced suite. Audit2383: The unscoped Vitest command no longer includes the removed Antigravity catalogue suite; its exact provider-root/owner example has no equivalent replacement or fresh validation claim. Audit2377/2381: The unscoped Vitest command includes the reduced bundled-skill and native-discovery suites; the eight removed backup/legacy/catalogue/symlink/SSH-builder examples have no replacement-equivalence or fresh validation claim here. Audit2162: Reduced inventory-authority source intentionally loses the examples recorded in knownGaps; historical execution is not validation of changed bytes. Historical prior account (preserved verbatim): Audit2133 current-parent preparation: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2095 current-parent preparation2126: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2090 (sources2088/2089): Current reduced suites intentionally retire the alarms listed in knownGaps; prior dated execution and replacement claims do not validate changed source bytes or selectors. Historical prior account (preserved verbatim): Audit2086 (sources2082/2083): Current reduced suites intentionally retire the alarms listed in knownGaps; prior dated execution and replacement claims do not validate changed source bytes or selectors. Historical prior account (preserved verbatim): Audit2076 (sources2073/2074): Intentionally retire these low-value alarms without replacement: src/main/runtime/orca-runtime-tests/terminal-handles-part-02.spec.ts: recovers a moved SSH pane through the tab it now sits in, not the one its lease froze; reports a plain expired orphan; does not report a pane whose only recent lease was superseded; does not report a pane whose only recent lease had its relay id recycled; picks the eligible orphan over a superseded predecessor that matches first; collects the same tabs the per-tab reader reports, in one sweep of the leases; reports no candidate when no lease names any of the worktree tabs. src/main/runtime/orca-runtime-tests/runtime-availability.spec.ts: starts unavailable with no authoritative window; reports the configured Windows terminal shell on status; reports floating workspace availability from settings on status; polls floating tabs with targeted PTY liveness and no repo/provider inventory; hydrates persisted tabs when the store cannot report repos; advertises browser screencast only when a renderer window is available; routes mobile Codex reset consumption through the account mutation coordinator; maps a definite pre-provider rejection into an authoritative current snapshot. Existing unrelated evidenceRuns retain their original scope; unchanged dated receipt objects do not validate changed source bytes or reduced selectors. No fresh gate execution or historical import-closure equivalence is claimed. Frozen current literal-import graph reaches these changed test bytes; unresolved local and computed edges remain debt, and current reachability is not historical execution or equivalent replacement evidence. Historical prior account (preserved verbatim): Audit2003: Remove SSH/absent-inventory attach refusal, later-subscriber retry, no-view adoption/takeback, provider-tail/unknown-read projections, failed-keystroke retry and simpler loss reattach examples. Keep the existing-subscriber inventory-ready retry alias only at its retained callback, plus retained held-input cancellation/replacement and overlapping attach/loss fences. The inventory driver also loses the whole empty-worktree-publication registration and folder-host/unverifiable scalar examples. Retire the entire dated10-case attach receipt; retain16 independent receipts only in their original scopes. No retained-memory or real-daemon measurement follows from supplied provider inventories. Changed-source prior results do not validate reduced-source bytes. No fresh execution, equivalent replacement, red/green, measured budget, soak, physical provider/PTY, rendered, live remote/mobile or cross-platform result is claimed. Historical prior account (preserved verbatim): Audit1991: Remove initial-snapshot sequence-domain, limited-tail/truncation and unknown-output-sequence aliases whose callbacks are removed. The source retains partial-chunk replay and requested-snapshot retry/admission at supplied snapshot/data seams, not equivalent replacement or measured retained-memory proof. Preserve the existing stream/pending-wait capacity aliases only to their retained owning multiplex callbacks with supplied PTY resolutions. Removing the sibling-PTY heartbeat dedup work-count sample does not establish a new decorative fanout budget; the unrelated-PTY cancellation fence survives. Preserve17 unrelated dated receipts. Changed-source prior results do not validate reduced-source bytes. No fresh execution, equivalent replacement, red/green, measured budget, soak, physical provider/PTY, rendered, live remote/mobile or cross-platform result is claimed. Historical prior account (preserved verbatim): Audit1983: Remove the reasonless-close selector and narrow census aliases to actual retained runtime and injected-inventory callbacks. The removed synthetic census-dedup and isolated pre-boundary timing cases receive no replacement credit; preserve17 unrelated dated receipts. Changed-source prior results do not validate reduced-source bytes. No fresh execution, equivalent replacement, red/green, measured budget, soak, provider/PTY, rendered, live remote/mobile or cross-platform result is claimed. Historical prior account (preserved verbatim): Audit1939 (sources1934/1935): Delete the synthetic watcher-synchronization and partial-reconciliation suites. Retire all affected host-fact, capability-owner, activation-residue and retention-cap aliases because the remaining callbacks do not establish those full claims. Keep exact local hook/timer, byte-stream side effects, exit/disposal, scroll-intent cleanup and deterministic local rank/TTL progression callbacks within their mocked-host scope. No physical paired-host retention, resource budget or equivalent replacement evidence is assigned. The generic broad test command remains a runnable discovery command, never a dated execution receipt. Preserve meaningful remaining selectors/assertions and unchanged dated receipts within their original scope. Reduced selectors have no fresh gate execution evidence in this metadata packet. No equivalent replacement, physical watcher/PTY/provider, live SSH/remote/mobile, rendered, cross-platform, soak or measured-budget result is claimed. Historical prior account (preserved verbatim): Audit1931 (sources1928/1929): Delete the complete hook-agent-status projection suite and its two behavioral assertion aliases. Supplied stored hook/title/resume/staleness/rename/question/generation/PTY-retirement/snapshot-version projections are intentionally lost. The separate osc-status-scan gate mentions this source only in existing historical notes and receives no mutation. No measured hidden-output retention, CPU/RSS or resource budget result is claimed by the deleted source or this audit. Preserve meaningful remaining selectors/assertions and unchanged dated receipts within their original scope. Reduced selectors have no fresh gate execution evidence in this metadata packet. No equivalent replacement, physical watcher/PTY/provider, live SSH/remote/mobile, rendered, cross-platform, soak or measured-budget result is claimed. Historical prior account (preserved verbatim): Module ownership cleanup retires the modeled cold-park private watcher/render/work-count suites under the current test policy. Their assertions are no longer active evidence. Retained lifecycle tests and headed/headless journeys do not establish equivalent coverage for those removed harness alarms. Audit1640 removes low-value IPC, SSH, workspace and transcript-watcher tests without equivalent replacement coverage. Per-source reviews record retained public refusal, cancellation, execution-host and real-filesystem outcomes with injected/native/remote limits. Affected historical receipts are retired; gates without active current evidence are downgraded. Historical scope before this audit: Audit1634 removes low-value IPC, filesystem and runtime projections, argument inventories and duplicate examples without equivalent replacement coverage. Per-source reviews record retained cancellation, ownership, authorization, filesystem and SQLite boundaries with injected/native/remote limits. Affected historical receipts are retired; gates without active current evidence are downgraded. Historical scope before this audit: Audit1627 removes low-value mocked daemon projections, scalar tables and duplicate terminal examples without equivalent replacement coverage. Per-source reviews record retained terminal content preservation, process ownership refusal and recovery boundaries together with injected/native/remote limits. Affected historical receipts are retired; gates without active current evidence are downgraded. Historical scope before this audit: Retained exact unchanged-source receipts remain the only current execution evidence. Reduced selectors have no fresh execution result. Audit1417 intentionally deletes src/renderer/src/components/terminal-pane/pty-connection-hidden-tui-snapshot-replay.spec.ts: Loses rich hidden snapshot sequence replay/grid resize and forced repaint after hidden snapshot alarms, including live-trigger deduplication. deletes src/renderer/src/components/terminal-pane/terminal-cold-park-verdict-loop.test.tsx: Loses modeled React oscillation alarm; real pane/watchers are not exercised. deletes src/renderer/src/runtime/remote-runtime-terminal-parse-backpressure.test.ts: Loses delayed credit until parsing, malformed frame/unknown stream handling, discarded transformed output recovery and failed ACK rearm alarms. No equivalent replacement coverage or fresh result is claimed. Historical coverage account: Audit1412 changes referenced sources. Retained unchanged-source receipts apply only to their unchanged commands; the reduced selectors have no new execution result. Historical coverage account (not a current claim for changed sources): This audit removes the browser response-after-manual-disconnect example. Its distinct in-flight response fencing alarm is lost; retained queued-call disconnect tests are not an equivalent replacement. Historical commands and results remain historical. Deterministic headed macOS runs launch an isolated Orca desktop server and a separate paired web client. A byte-identical headless run uses an isolated `orca serve` host. Both create six real paired host PTYs with bounded high-output scrollback, prove sustained output while all six client xterms are warm-mounted but hidden causes zero renderer scheduler work, then drive 180 timed real-PTY spinner frames through a second production `session.tabs.subscribeAll` transport and the real Zustand store. Each worktree must publish and apply only its exact initial-working and final-idle titles. Both topologies ordinary-park five xterms without enabling the lossy retention budget, assert bounded cells/heap/timer lag, then restore the bounded authoritative tail exactly once on the original PTY including output produced while parked and continued input/output. The headed oracle additionally keeps every remote target workspace and terminal unmounted in the host renderer before and after client recovery. Production-parity React contracts reproduce and remove the independent cold-park watcher/title feedback loop, including memo-cache discard, StrictMode cleanup replay, detached split-PTY replacement, and the zero-park fast path. A deterministic cross-boundary contract drives 24 real PTY trackers in distinct worktrees through 2,880 decorative spinner and bare-native redraw chunks and counts host publications, serialized bytes, renderer apply calls, and store mutations while preserving exact per-PTY raw chunks and per-worktree semantic transitions. Fake-clock continuation beyond the 30-minute stale boundary requires one deduplicated refresh per worktree every 15 minutes, globally spaced by at least 50 ms, with every mirrored working status still fresh. Exact-identical Pi plus rotating normalized Pi/Grok frames renew coarse working/permission state; rich prompt/tool/question fields retain their original 30-minute lease, and `stateStartedAt`/acknowledgement identity remain stable across title/hook source swaps. A separate headed desktop-client journey relaunches the host main process while retaining the daemon and a daemon-backgrounded PTY, then requires first-observation foreground sync and continued input/output on the same PTY. Unit coverage keeps layout versions out of snapshot output high-waters when a restored snapshot has no output sequence and retries an existing subscriber only after authoritative provider inventory proves the retained PTY exists. Separate headed/headless ACK-starvation tests recover one stalled stream without replacing its PTY. A headed output-drop oracle proves a successful snapshot probe cannot certify a stale live stream when the authoritative PTY sequence advanced beyond the client high-water. Unit coverage requires an unsequenced client to establish a first-probe baseline, remain attached at the same sequence, and recover only after a later probe advances. A capability-disabled run proves legacy hosts retain the prior lossy limit/TTL fallback. Unit tests cover exact-owner capability routing, raw-stream release, singleton side-effect facts with timed handoff cleanup, 64 simultaneous synthetic-title sources with zero decorative client events after convergence, per-client late-subscribe recovery, semantic bell/title transitions, local animation-frame preservation, legacy no-output-pause delivery gating with exact snapshot restore, provider-authoritative snapshots, 128 active streams plus retry after a 129th-stream capacity rejection, capacity-pressure backoff, full split-leaf remint reconciliation, truncation, and manual-disconnect queue fencing. Linux, Windows, live SSH, and production-scale paired hosts remain gaps. The audit removed the E2E parking override/debug-handle suite. Override exposure guards, delay/retention independence, TTL filtering and debug-handle forwarding alarms are lost. Retained real parking journeys do not establish equivalent test-harness configuration coverage. The test-value audit removes separate responsive-stream, intervening-control-frame and capacity-error classification examples. Retained multiplexer checks use fake clocks and captured transport callbacks; their per-stream isolation, deadline and probe-baseline assertions do not prove an actual host restart or equivalent replacement coverage. Historical run commands and results remain historical. The test-value audit removes the standalone retained/live metadata projection and additive-preference negative example from runtime-client-events.test.ts. Its remaining case checks partial-authority event admission through a captured callback; it does not establish full-pair projection, actual peer delivery or equivalent replacement coverage. Historical commands and results remain historical. The isolated accepted-handle-events observer suite is removed. Its runtime/worktree/pane membership, once-only delivery and listener-release ledger alarms are lost. Live hidden-retention evidence does not establish equivalent observer coverage. Audit1292: The entire host-session mirror empty-inventory settle suite is removed. Live-unpublished versus genuinely-empty hydration, same-ID revision response/in-flight fencing and cleared-tracking pending-probe invalidation alarms are lost. The singleton store and inventories were mocked; no real host census or resume delivery or equivalent replacement coverage is claimed. Audit1302: src/main/runtime/session-tabs-inventory-publication.test.ts: Keep actual runtime public inventory authority across renderer epochs/resync, fallback, aborts and invalid graph publishers. Remove copied nonempty publication, private scan counters/collector and known-host replacement, fake refresh that performs the restoration itself, environment capability flag, and private resume-store characterization whose fixture supplies reservation/rollback ordering. Lose isolated refresh/churn/receiver/capability and copied-payload wiring alarms; no equivalent replacement. Reduced selectors require fresh validation; prior full-suite receipts do not validate removed or changed coverage. No equivalent replacement or physical-provider claim. Audit1312 removes low-value imported specs from aggregate test drivers; old whole-driver execution receipts are archived. Retained registrations are unchanged. No equivalent replacement coverage is claimed. Audit1318: src/shared/remote-runtime/control/remote-runtime-shared-control-connection.test.ts: Retain real local encrypted WebSocket regressions for pre-ready socket replacement preserving a request, close-before-ready logical subscription cleanup, unrelated RPC surviving another deadline, and pending setup abort leaving a sibling pending. Host server is synthetic and uses production crypto; kept scenarios also retain internal diagnostics/memory assertions unchanged. Remove happy routing, authority-envelope, unknown-ID/log, cleanup enum, binary, keepalive/liveness and production-budget/private socket inventories; intentionally lose those alarms, no physical host authorization, independent crypto or remote provider claim. Reduced selectors need fresh validation; historical full-suite receipts do not validate the changed coverage. No equivalent replacement or physical-provider claim. Audit1346 removes the entire private-state-injected session-tabs rich-status boundary suite. Its stale task/question, neutral-title preservation, owner-change and provider-generation alarms are intentionally lost. Retained real terminal journeys do not establish equivalent replacement coverage. The prior mixed 42-contract execution receipt is historical and must not validate the reduced current selector; fresh validation remains required. Audit1352: focused Linux unit selections validated on source head b638e07d395b76af3ba6b03761a1a0fe7e5e026e. Historical statements above retain their original scope. Intentional test losses are recorded in knownGaps; these runs claim no physical-provider, p95, rendered E2E or cross-platform validation. Audit1360: focused Linux unit selections validated on source head 415c9cffc2d10024131ec4b6721767a22195de6d. Historical statements above retain their original scope. Intentional test losses are recorded in knownGaps; these runs claim no physical-provider, p95, rendered E2E or cross-platform validation. Audit1383: src/main/runtime/orca-runtime-tests/worktree-native-chat-setup.spec.ts reduced. Lose command-list/receipt/default/background activation matrices whose provider spawn returns canned IDs. Retained test proves actual tab allocation separation, not terminal startup. No equivalent replacement coverage is claimed. Existing exact unaffected receipts and their platform/provider/budget claims remain scoped to unchanged selectors. Changed optional selectors have no new execution result. Audit1391: src/renderer/src/components/terminal-pane/pty-connection-remote-pause-drop-notice.spec.ts reduced. Lose repeated quiet switches avoiding snapshots and legacy host without drop-report capability requesting a snapshot. Retained imported registrar uses fake transport/xterm writes, exercising real gap/restore lifecycle rather than actual terminal rendering. No equivalent replacement coverage is claimed. The existing primary-selector receipt and its claims remain scoped to their unchanged sources; the broad optional command has no new execution result. Audit1396: src/renderer/src/components/terminal-pane/terminal-parked-watcher-reconciliation.test.ts reduced. Retire standalone reconcile set output and positive untouchedFreshSpawn/workspaceOwner copying alarms; no native watcher execution claim. No equivalent replacement coverage is claimed. Existing exact unaffected receipts remain unchanged and apply only to their unchanged selectors. Changed optional selectors have no new execution result. Audit1401: src/main/runtime/orca-runtime-tests/mobile-session-tabs-duplicate-pty-repair.spec.ts removed. Loses listing-on-already-repaired-data alarm; it never established runtime repair invocation. src/main/runtime/orca-runtime-tests/mobile-session-tabs-split-agent-tab.spec.ts removed. Loses actual mobile split sibling shell versus recorded-agent resume command alarms; no equivalent coverage asserted. src/main/runtime/orca-runtime-tests/worktree-native-chat-setup.spec.ts removed. Loses separate setup/startup tab result in that manually assembled path. src/main/runtime/orca-runtime.test.ts reduced. Driver registration/import of a whole-deleted selected spec is removed; directly authored cases remain unchanged. No extra authored removal credit. No equivalent replacement coverage is claimed. Existing exact unaffected receipts remain unchanged and apply only to their unchanged selectors. Changed optional selectors have no new execution result. Audit1402: src/renderer/src/components/terminal-pane/pty-connection-park-reveal-model-snapshot.spec.ts reduced. Loses basic paired serialize/initial replay forwarding check; hidden alt-frame grid/precedence policy remains. No real terminal renderer claim. No equivalent replacement coverage is claimed. The existing primary-selector receipt and its claims remain scoped to their unchanged sources; the broad optional command has no new execution result. Audit1412: src/main/runtime/mobile-session-tabs-agent-status-heartbeat.test.ts reduced. Loses FIFO fairness/spacing, semantic bypass/cancellation, delayed-boundary scheduling and teardown timer-cleanup alarms. Retained fixed emission cases do not replace those outcomes. No equivalent replacement coverage is claimed.", "motivatingLinks": [ "https://github.com/stablyai/orca/issues/8652", "https://github.com/stablyai/orca/pull/10625" ], "invariant": "A host advertising terminal.paired-parking.v1 keeps the PTY and bounded authoritative history alive while an ordinary hidden-view park destroys the client xterm and releases its raw per-PTY stream. Reveal must restore up to the requested 5,000 rows, parked-time side effects/output, the same PTY identity, and continued input/output. Parked watcher synchronization compares parking semantics rather than fresh object identity, owns setup and cleanup across StrictMode replay, reconciles real PTY/layout changes, and performs no terminal-state scan when nothing is parked. After a host main-process relaunch, unknown local delivery-sync state must not be treated as proof that a surviving daemon PTY is already foregrounded. An empty headed session-tab inventory is authoritative only after the current renderer graph generation publishes a complete inventory and every execution host answers the PTY census; unpublished, resync-pending, transport-failed, and partially scoped inventories remain unverifiable, while genuinely authoritative empty and non-empty inventories settle and a scope-less legacy empty keeps its pre-authority best-effort settle so outdated hosts retain agent auto-resume. The unpublished-empty regression must keep the resume dispatch parked with exactly one daemon process/writer; restoring unconditional empty hydration must release one dispatch and create two live writers. If subscription precedes provider readiness, authoritative inventory must reconsider that existing subscriber without spawning, resizing, or changing reconnect state. A snapshot without an output high-water must keep it unknown rather than borrowing a layout version that can suppress newer live output. Hosts without the capability must gate hidden raw output before xterm scheduling and repaint from the authoritative snapshot on reveal while retaining the existing limit/TTL force-parking fallback. After the first semantic title state, decorative spinner frequency must add zero paired client-event frames and zero full session-tabs work between status-freshness leases regardless of hidden worktree count. Continuous working or permission evidence may refresh each affected worktree once per 15 minutes through one globally spaced FIFO so current and legacy viewers do not decay before 30 minutes; sibling PTYs share that worktree refresh, while local title animation, raw output, and semantic title, status, bell, completion, and query facts remain intact. A paired terminal stream whose delivery credits stop progressing must replace only that stream; command silence first probes authoritative state and replaces the stream if the probe times out or proves the PTY advanced beyond the client's delivered output sequence. When no comparable delivery high-water exists, the first sequenced probe establishes a baseline and only later advancement proves staleness. A same-sequence snapshot remains valid proof of a responsive silent command. A successful status probe may replace a pre-ready shared-control socket without rejecting or duplicating calls already waiting for that transport. Manual disconnect must retain pairing while preventing queued or passive calls and subscriptions from recreating transport until explicit Connect. A paired pane reconnecting to a relaunched host that has not yet published its window graph (an unpublished frame, bare or client-projected) must stay in recovery rather than retire, and the host's first published snapshot carrying the surface must reattach it; a published frame lacking the surface still retires it. The placeholder is only ever sent before the host's graph first publishes; afterwards a worktree with no tabs gets a real empty answer, pushed once to any client that asked during startup, so a paired client opening a never-opened host worktree still gets its first terminal.", - "oracle": "Audit 3283 removes 20 authored declarations and 31 expanded scenarios, including two whole suites. Retired alarms cover PR refresh-state pruning, shared runtime subscription cleanup and store isolation, language content-change routing and older completion ownership, ordinary panel retry-timer cleanup and pending loading, four hosted-review lifetime permutations, mocked terminal creation error/order wiring, five sleep-inventory variants with pending-frame-only assertions, palette fallback/composite highlights, Windows/UNC encoded-editor input rows, mixed-repository partial failure counts, title setters and generated-title bypass/replacement, five window-close coordinator delegation/guard/finally branches, and ambiguous-old-record frame reveal. These regression checks are intentionally lost under the test-value audit; retained cases are not equivalent replacements. Prior coverage notes and receipts remain historical. Audit 3273 removes 14 authored declarations and 19 expanded scenarios across four whole suites and eight partial suites. Retired alarms cover saved-local cancellation/layout ownership, ambiguous-owner warning reset, folder attachment routing, VM false-capability bypass, abandoned reveal warmup cleanup and viewport claim deduplication/rearming, quiet unrelated remote-removal refusal, startup-command one-shot consumption, repository/floating recovery-ledger rows, fake-React pinned-scroll intent, split-ratio state identity/subscriber suppression and fractional change, cross-host project-group join refusal, three PR request-lifetime permutations, upstream-status preservation on error, and unresolved Git-owner refusal. These regression checks are intentionally lost under the test-value audit; retained scenarios are not equivalent replacements. Historical coverage receipts remain historical, including gate35 subscriber claims. Audit 3256 removes these specific alarms from the broad root unit commands: skill dialog active-share selection, close and pending-share handoff; simple keyed-record deletion; marker live-region insertion, simple landing and nine baseline policy examples; General search/control navigation inventory; orphan-count cache bootstrap; seven Codex code classifications and HTTP 429 warning mapping; two skill unread-root verdict examples; peer-mail payload and conversation-ID rejection; and the GitHub organization TABLE text-field optimistic rollback/failed-envelope example. These include real behaviors; retained tests do not provide equivalent coverage for every removed scenario. Mobile losses are recorded separately and are not coverage of these root commands. Audit3246 retires NewRowsMarker reveal/no-repeat and pane-scoped beforeinput checks; skill-owner option availability/count/dedup/order; six styled Input/Textarea IME forwarding rows; the static Codex/OpenCode smart-key inventory; tab-map AST ratchet diagnostic fixtures; child-roster work-budget and retained-aggregate alarms; malformed persisted floating-cwd fallback/no-crash/empty exact-root checks; the unanswered-host empty-list discriminator; the direct invalidated-cache commit-false assertion; one redundant digit-keyup IME row; cached non-supported Claude title-generator rows; and the duplicate late naming-result singleton. These root broad commands lose those specific alarms without equivalent replacement. Distinct retained owner/state checks have their own bounded claims; the real scheduler still rejects stale response data, while the direct false-return alarm is retired. Audit3231 retires supported-host restore-pane key mapping, closed/open creation-sidebar toggle visibility, unrelated scope-error/null classification and quick-submit reveal/no-create checks. These broad commands lose those real narrow alarms; no replacement coverage is claimed. Audit3219 removes the synthetic Cmd+J extra-source suite; this broad command no longer checks its match/tie placement and selection, announced count, empty-query cap, or workspace hiding with retained recent tabs. No replacement coverage is claimed. Audit3209 composes approved sources3202/3206: deliberately retires seven authored/expanded cases in four whole suites without equivalent replacement. Work-item queries lose real GitHub/GitLab oversized ASCII secret-prefix empty-query and whitespace-before-trim refusal alarms; inputs share the imported size bound and exercise only its fast length branch, with no multibyte or actual provider/exposure guarantee. Skill sharing loses complete/partial managed-bundle and destination-ambiguity association checks plus three negative origin/path/scheme admission examples; these do not establish uploaded contents, arbitrary-URL fetching, authorization or execution. Retain exact originless-project direct-link fallback, cloud-delete confirmation, bundled-target repair/owner isolation and explicit Windows-host preference over stale WSL suites. Rejected3201 runtime-preference removal is excluded. No real cloud/network/host/disk, mobile or mixed-version execution validation is claimed. Audit3200 composes approved source3194: deliberately retires thirteen authored registrations/twenty-seven expanded cases in six whole automation host/list policy suites without equivalent replacement. Real RPC category/retryability and wrapped-timeout recognition, unscoped-failure/scoped-success health evidence precedence, exact-ID create selectors and per-run workspace omission, paired-web local/SSH/absent host catalog routing, incompatible/removed/unhydrated/offline execution health, runtime-before-nested-SSH recovery dispatch, and no-owned-focus/successor/foreign-list focus policy alarms are consciously lost. Retain exact20line orphan allow/refuse/precondition and exact90line cross-host same-ID search suites. No retry-timer/fence lifecycle, actual reconnect/network/write delivery, native focus, mobile/mixed-version runtime or disk persistence coverage is claimed. Audit3191 combines approved source3182/3187/3188: deliberately retires thirteen authored Vitest registrations and fifteen expanded cases, including five whole suites, without equivalent replacement. Attachment intake loses real portal/native-capture terminal interception and unowned-container refusal, immediate child-only committed availability/claim-ref negotiation and delivery, and direct-target over stable focused/background composer routing through disable/re-enable/remount and independent question focus. Exact destination/cache/draft and final-stat owner/workspace/File-release suites remain; they do not replace Surface recipient routing. Automation authoring loses destination runtime catalog membership, local/direct-SSH exclusion of paired-runtime repos, unknown-runtime empty catalog, logical project/host/setup/repo/path context payload, and missing/nonready setup refusal; these were genuine direct helper alarms, while exact schedule transformation, legacy schedule and setup-decision suites remain. Agent picker loses setup-chat/terminal/missing-installer/unsupported-or-unknown-host row projection samples and the ordinary unsearched menu variant; the entire original26-line resume recipe suite remains, including reported bypass versus default/absent permission modes, as does the exact search-result menu callback with its fixtures, model/effort commits and staged Arguments reopen outcome. Rejected predecessor3180 full recipe deletion is excluded. No actual native drag/cursor/focus/IME, upload bytes or disk/restart persistence, full automation save/scheduler/runtime transport, real resume-process flags/environment delivery, or native menu/rendered layout validation is claimed. Audit3178 combines source3169/3170/3175: deliberately retires eight authored units (six Vitest cases and two imperative custom relay scenarios), including two whole suites, without equivalent replacement. Voice Section loses per-model pending-delete isolation across interleaved A/B completion and the two-success refresh-call alarm; exact VoicePane delayed key-clear/newer enabled-toggle merge remains and does not replace row deletion coverage. Speech loses dedicated rating-scale/inclusive-ceiling, unsupported-versus-unmeasured, explicit/system-language precedence/locale alias, accuracy versus fast named/default/best-measured selection, and unmeasured/no-match examples; exact offered-user-pick versus retired-selection case and its fixture remain. Relay loses legacy ping-delivery count/liveness sampled before the silence deadline and grouped malformed Bearer/host-ID 401/429 routing checks; twelve real Worker/DurableObject/shipped-client scenarios remain, not equivalent replacement for those narrow alarms. Six prior speech cases are not all deleted: approved successor3175 keeps the original user-choice case. No actual credential/file persistence, native/GPU/engine/download delivery, production assignment policy or deployed-runtime validation is claimed by this reduction. Audit3165 combines source3160/3162: deliberately retires six authored/expanded cases across three whole suites without equivalent replacement. Launch/status losses: observed React-render pending/resuming coordination across settings and deferred offer read; stale-offer reread suppressing dialog reopen; held-local-chat recovery visibility with new-chat preferences off; disabled-local admission avoiding offer RPC despite an injected but unconsumed paired-tab fixture; and run-only lost-reply uncertainty reachability until direct viewed-run retirement. Launch probe does not prove arbitrary synchronous-store atomicity, the paired fixture is not remote runtime enrollment, and the status case directly marks viewed state rather than rendering the summary. Crew-hook losses: old-host method_not_found cache persists across party changes but is released by independently supplied connection generation/verified pairing status or pairing revision, with actual frame publication and teardown. These are real narrow coordination, admission, uncertainty and mixed-version cache alarms consciously lost. Exact web verified-runtime writer handoff guard remains; it does not replace those alarms or prove live host/native/mobile delivery. Audit3156 combines3147/3150/3152/3153/3154: deliberately retires39authored/40expanded native-chat recovery cases, eight whole suites and two orphan test-support files without equivalent replacement. Lost alarms: lost-reply unconfirmed reconciliation, skipped rows/counts and missed-frame repair, unknown/pending outcome and omitted-failure-list compatibility, uncertain history after dismissal, retry/refusal/dismiss lifecycle, hidden/consumed picker ownership, result-tree keyboard focus/disclosure and all-skipped retirement; unconfirmed-over-conflict guidance and failed-chat changes despite older host timestamps; nearest-listed ancestor/cyclic forest shape, descendant membership, host ordering/missing-host local fallback; skipped/readiness/admission counts, provisional skip/progress monotonicity, early per-chat verdicts with batch pending protection, older-host waiting, start-slot/delivery distinction, retry-over-failure and unknown-after-withdrawal attention; remote snooze/reconnect/reoffer, unseen mixed summary through open/close, watched completion retirement, new success beside old failure, failed-reread mixed-result preservation, filter/collapse completion resets, retry summary replacement and current-offer/history selection; cross-host workspace identity, rendered cyclic reachability, nested tri-state/toggle propagation, project eligibility isolation and collapse preserving selection. Exact fallback-list completion barrier, batched verdict/cleanup retention, stale-read versus dismissal publication race, and requested-but-never-rendered finished-run retirement remain; they do not replace retired alarms. Audit3146 combines source reviews3132/3133/3135/3138/3143: intentionally retire20authored/31expanded cases without equivalent replacement. Provider-session losses: structured-native terminal-resume exclusion, metadata-less completed identity, new-turn completion clearing, Pi provider-only/periodic/manual promotion, changed-transcript launch-config isolation, Pi/omp/prime-agent completed-session remote/manual-shutdown promotion, and quit/done precedence over heartbeat. Side-thread/question losses: finished-pane acquisition, hidden title/recap states, local/relay/relay-done conversation takeover with prompt/session/child resets, plain-message abandonment, compaction/session replacement and completion resets. Codex startup losses: incoming-owner cached child replacement, old-relay foreign live-session correction, completed foreign-root turn-fact permutations. Transcript losses: real temporary-JSONL partial sibling/final-child completion, unlabelled child attribution, compact cached replay preservation and100/1000completed-child roster retention/release. Compiler-ratchet losses: valid-line uncompiled-list parser grammar examples and injected-existence stale-path filtering; these did not exercise actual filesystem canonicalization or build exclusion. These are real lifecycle, ownership, replay, liveness and retention alarms, including recent#40246 regressions, deliberately lost. Retained conditional record replacement, clockless root/SSH owner isolation, persisted main-thread fork rejection, partial/final question-answer lifetime, cached-roster/missing-ID/live HTTP/durable startup boundaries and restarted-relay refusal/acceptance do not replace those losses. No native/SSH/WSL execution or equivalent coverage is claimed. Audit3128 scoped coverage reduction: Audit3121 removes VoiceDictationLanguageSetting.test.tsx (Spanish-to-es callback and unsupported-model Korean option presence) and voice-speech-model-rows.test.ts (provider/language-order/retired-on-disk list policy); these real narrow alarms are deliberately retired without replacement. VoiceSpeechModelSection per-model concurrent deletion remains unchanged. Audit3122 removes the direct absolute/parent-segment sparse-directory exception-type sample and the five-row IPC sparse-preset error-code/non-save table (two authored/six expanded cases). Those real typed-validation and IPC refusal/error-code alarms are deliberately retired. Keep both real symlink/junction floating-directory trust cases and the minimal RPC structured validation-reason serialization case. The RPC case does not replace IPC save/refusal behavior, typed normalization for both path inputs, actual Git sparse checkout or rendered localization. No equivalent replacement or fresh test/runtime/platform/remote/performance validation is claimed. Audit3124 removes ExperimentalPane.test.tsx (ordinary Pet switch callback), WorkspaceDirectorySetting.test.tsx (padded absolute saved-path normalization/no-write blur), and repository-search.perf.test.ts (navigation/selected-pane builder-call policy, fixture cardinality/nonempty entries and renamed project keyword inclusion). These real narrow alarms are retired without replacement; RepositoryPane.search.test.tsx search-to-sparse-editor request remains unchanged. Audit3129: resolver Windows case-insensitive and POSIX case-sensitive configured-env composition plus mocked-base launch-preflight Windows composition are intentionally no longer checked by the two deleted suites. No equivalent coverage claimed. Keep runtime-structured-agent-host-env.test.ts unchanged: configured Windows Claude-home account identity and host-account precedence remain checked. Audit3114 incorporates source3101: retire three structured Claude child-environment wrapper cases covering inherited stamp isolation/default and explicit entrypoint, Windows SDK-key canonicalization/default/duplicate-key order, and configured lookup/final environment/config-dir conjunction. Keep direct auth/session sanitation and Windows-versus-Linux overlay checks, actual executable lookup from supplied inherited PATH, native Windows child environment delivery, and stale option-mutation fencing. These are not equivalent replacements for the retired wrapper alarms. No fresh test/runtime, real login-shell probe, Claude SDK startup, remote/mixed-version, UI or performance result is claimed. Audit3114 incorporates source3105: retire 17 authored/20 expanded daemon launch-note cases, including the entire two-case SessionLaunchNote suite. Deliberately lose split-marker carry across same-token re-arm, stale-token retirement refusal, foreground tri-state and serial settlement, omitted-note/no-incarnation mixed-version policy, sticky retirement, first-incarnation/replacement launch preservation and held-launch precedence. Keep only the unchanged unresolved foreground-read race against a later finished attach. Supplied notes/foreground and runtime calls do not establish actual daemon/main restart, SSH, native Windows observation, mobile UI, equivalent replacement or fresh runtime/performance validation. Audit3114 incorporates source3109: retire six authored/35 expanded pricing cases: 21 accepted model-name examples, 10 unsupported/future-model fail-closed examples, malformed TTL clamp, unknown-model estimate refusal, flat-model long-context disregard and oversized long-context clamp. Keep mixed five-minute/one-hour write allocation and short/all-long/mixed long-context allocation with original fixed oracles. Real parser/refusal/bounds alarms are knowingly lost without equivalent replacement; retained tests do not validate provider rates, actual billing or request threshold classification. Preserve the archived usage-scan-append source-freeze receipt without transferring historical execution/performance credit. No fresh runtime result is claimed. Audit3108 source-only reduction (3094/3095/3100): retire 27 authored/30 expanded cases, including complete markdown view-state, file-preview link-open and CLI agent-server-route suites, without replacement. Deliberate losses include preview visibility/reference lifetime and same-path owners; SSH stat, directory/missing-target, explicit-null owner, nonmarkdown line/column, local URI routing, remote-to-client guard and same-file reuse; document-preview source-owner/folder/reuse routing, stable grant location and outside-workspace POSIX/Windows request projection; and verified remote CLI send/check refusal, suggested --on argv/copy, shell no-probe bypass, unverified-launch admission and older-peer refusal. Retain two markdown source-runtime/qualified-reveal alarms, one stale grant-rejection fence and two remote read/mutation evidence policies, with original callbacks. Final last-wins reveal did not prove transient cancellation; CLI prerequisite did not prove no real send, and envelope tests do not execute server refusal. No fresh runtime, rendered UI, actual file/SSH/paired transport, authorization, mixed-version or performance result is claimed. Audit3096 source-only reduction (3087/3088): retire 69 authored/76 expanded cases, including complete recovery-portals and reconnect-banner suites. Intentionally lose dead/default TUI replay, generated alternate-frame style composition, reset/mode/dimension and legacy missing-mode-boundary alarms, UI notice/action/reveal policies, and isolated recovery lifecycle variants, without equivalent replacement. Retained registrations and callbacks are unchanged; headless cells are not pixels, and no fresh runtime, host, SSH, WSL, rendered-app or performance result is claimed. Audit3086 source-only reduction (3079/3080/3081): intentionally retire 93 authored/100 expanded mock-boundary cases, including the complete spawn-errors and SSH reconnect overlay suites, without replacement. Retired alarms include spawn classification/ownership, reply ceilings and renderer-write failure recovery, disconnect/detach fencing branches, authority facts, and overlay retry/visibility wiring. Retained callbacks are unchanged; no fresh execution, real PTY/SSH, rendered UI, or performance result is claimed. The direct side-effect-facts selector retains six cases: replay exclusion, live sequence handling, stale disposer ownership, one handoff drain, drain-before-snapshot, and stale replacement-snapshot refusal. Successful current-entry snapshot application is not witnessed by the retained snapshot case. Audit2432: The broad unit command loses the isolated BranchPicker open-change notification sample. Its unique true/false callback alarm is intentionally retired; reopening/status-refresh behavior was not exercised. No equivalent replacement or fresh validation of the reduced selector is claimed. Audit2425: The broad unit command loses the workspace-copy-status supplied readError forwarding sample. It did not exercise the branch-switch blocking promised by its title. This alarm is intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2417: The broad unit command loses two ordinary clean Git cherry-pick/revert success samples and two terminal startup foreground-read work-budget samples. These unique alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2412: The broad unit command loses the whole six-case fake-React-hook scroll-anchor suite, two generic draft-retention samples, a simple new-agent order sample, a real history-publication batching-count sample, an unmounted handoff abort/timer sample and three basic WSL preview/error samples. These alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2404: The broad unit command loses the standalone share-name lookup 503 propagation suite, initial deletion placement-kind sample, direct changed-mtime stale sample, first-pass rollback existence example and abandoned-preparation directory sample. These exact alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2397 review amendment: The broad unit command loses three standalone suites, two partial-case definitions and two URL table rows across package/download/placement tests. Keep initial wrong-port authorization, modified independent-copy digest refusal and abort-after-begin cancellation dispatch. The remaining alarms are deliberately retired; no equivalent complete replacement or fresh validation of the reduced selector is claimed. Audit2393 current-parent refresh2401: Remove the basic skill-install service alias sample and original public managed-remove receiptless refusal case. Preserve the upstream request ownership suite and transaction interruption coverage. No equivalent complete replacement or fresh validation of the reduced selector is claimed. Audit2389: The broad unit command loses the missing-preview suite, plain-global destination sample and prepublished-receipt recovery example. No equivalent replacement or fresh validation of the reduced selector is claimed. Audit2385: The broad unit command loses four authored walker/staging/protocol examples (six expanded cases); no equivalent replacement or fresh validation is claimed for the reduced suite. Audit2383: The unscoped Vitest command no longer includes the removed Antigravity catalogue suite; its exact provider-root/owner example has no equivalent replacement or fresh validation claim. Audit2377/2381: The unscoped Vitest command includes the reduced bundled-skill and native-discovery suites; the eight removed backup/legacy/catalogue/symlink/SSH-builder examples have no replacement-equivalence or fresh validation claim here. Audit2133 current-parent preparation: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2095 current-parent preparation2126: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2090 (sources2088/2089): Current reduced suites intentionally retire the alarms listed in knownGaps; prior dated execution and replacement claims do not validate changed source bytes or selectors. Historical prior account (preserved verbatim): Audit2086 (sources2082/2083): Current reduced suites intentionally retire the alarms listed in knownGaps; prior dated execution and replacement claims do not validate changed source bytes or selectors. Historical prior account (preserved verbatim): Audit2076 (sources2073/2074): Intentionally retire these low-value alarms without replacement: src/main/runtime/orca-runtime-tests/terminal-handles-part-02.spec.ts: recovers a moved SSH pane through the tab it now sits in, not the one its lease froze; reports a plain expired orphan; does not report a pane whose only recent lease was superseded; does not report a pane whose only recent lease had its relay id recycled; picks the eligible orphan over a superseded predecessor that matches first; collects the same tabs the per-tab reader reports, in one sweep of the leases; reports no candidate when no lease names any of the worktree tabs. src/main/runtime/orca-runtime-tests/runtime-availability.spec.ts: starts unavailable with no authoritative window; reports the configured Windows terminal shell on status; reports floating workspace availability from settings on status; polls floating tabs with targeted PTY liveness and no repo/provider inventory; hydrates persisted tabs when the store cannot report repos; advertises browser screencast only when a renderer window is available; routes mobile Codex reset consumption through the account mutation coordinator; maps a definite pre-provider rejection into an authoritative current snapshot. Existing unrelated evidenceRuns retain their original scope; unchanged dated receipt objects do not validate changed source bytes or reduced selectors. No fresh gate execution or historical import-closure equivalence is claimed. Frozen current literal-import graph reaches these changed test bytes; unresolved local and computed edges remain debt, and current reachability is not historical execution or equivalent replacement evidence. Historical prior account (preserved verbatim): Audit2003: Remove SSH/absent-inventory attach refusal, later-subscriber retry, no-view adoption/takeback, provider-tail/unknown-read projections, failed-keystroke retry and simpler loss reattach examples. Keep the existing-subscriber inventory-ready retry alias only at its retained callback, plus retained held-input cancellation/replacement and overlapping attach/loss fences. The inventory driver also loses the whole empty-worktree-publication registration and folder-host/unverifiable scalar examples. Retire the entire dated10-case attach receipt; retain16 independent receipts only in their original scopes. No retained-memory or real-daemon measurement follows from supplied provider inventories. Changed-source prior results do not validate reduced-source bytes. No fresh execution, equivalent replacement, red/green, measured budget, soak, physical provider/PTY, rendered, live remote/mobile or cross-platform result is claimed. Historical prior account (preserved verbatim): Audit1991: Remove initial-snapshot sequence-domain, limited-tail/truncation and unknown-output-sequence aliases whose callbacks are removed. The source retains partial-chunk replay and requested-snapshot retry/admission at supplied snapshot/data seams, not equivalent replacement or measured retained-memory proof. Preserve the existing stream/pending-wait capacity aliases only to their retained owning multiplex callbacks with supplied PTY resolutions. Removing the sibling-PTY heartbeat dedup work-count sample does not establish a new decorative fanout budget; the unrelated-PTY cancellation fence survives. Preserve17 unrelated dated receipts. Changed-source prior results do not validate reduced-source bytes. No fresh execution, equivalent replacement, red/green, measured budget, soak, physical provider/PTY, rendered, live remote/mobile or cross-platform result is claimed. Historical prior account (preserved verbatim): Audit1983: Remove the reasonless-close selector and narrow census aliases to actual retained runtime and injected-inventory callbacks. The removed synthetic census-dedup and isolated pre-boundary timing cases receive no replacement credit; preserve17 unrelated dated receipts. Changed-source prior results do not validate reduced-source bytes. No fresh execution, equivalent replacement, red/green, measured budget, soak, provider/PTY, rendered, live remote/mobile or cross-platform result is claimed. Historical prior account (preserved verbatim): Audit1939 (sources1934/1935): Delete the synthetic watcher-synchronization and partial-reconciliation suites. Retire all affected host-fact, capability-owner, activation-residue and retention-cap aliases because the remaining callbacks do not establish those full claims. Keep exact local hook/timer, byte-stream side effects, exit/disposal, scroll-intent cleanup and deterministic local rank/TTL progression callbacks within their mocked-host scope. No physical paired-host retention, resource budget or equivalent replacement evidence is assigned. The generic broad test command remains a runnable discovery command, never a dated execution receipt. Preserve meaningful remaining selectors/assertions and unchanged dated receipts within their original scope. Reduced selectors have no fresh gate execution evidence in this metadata packet. No equivalent replacement, physical watcher/PTY/provider, live SSH/remote/mobile, rendered, cross-platform, soak or measured-budget result is claimed. Historical prior account (preserved verbatim): Audit1931 (sources1928/1929): Delete the complete hook-agent-status projection suite and its two behavioral assertion aliases. Supplied stored hook/title/resume/staleness/rename/question/generation/PTY-retirement/snapshot-version projections are intentionally lost. The separate osc-status-scan gate mentions this source only in existing historical notes and receives no mutation. No measured hidden-output retention, CPU/RSS or resource budget result is claimed by the deleted source or this audit. Preserve meaningful remaining selectors/assertions and unchanged dated receipts within their original scope. Reduced selectors have no fresh gate execution evidence in this metadata packet. No equivalent replacement, physical watcher/PTY/provider, live SSH/remote/mobile, rendered, cross-platform, soak or measured-budget result is claimed. Historical prior account (preserved verbatim): Retained exact unchanged-source receipts remain the only current execution evidence. Reduced selectors have no fresh execution result. Historical pre-audit oracle account for changed sources: The retained unchanged-source receipts are the only current execution evidence; reduced-source assertions await validation. Historical oracle account (not a current claim for changed sources): Existing exact unchanged-selector receipts remain the only current execution evidence. Changed source selectors have no fresh execution result. Historical prior-source oracle account: Existing exact unchanged-selector receipts remain the only current execution evidence. Changed source selectors have no fresh execution result. Historical prior-source oracle account: Run one byte-identical six-terminal oracle against an isolated headed desktop host and an isolated headless `orca serve` host. Stage at least 1,000,000 xterm cells, hide all six warm managers, emit an initial working title followed by 30 timed real-PTY spinner frames and a final idle title per worktree, and observe a second real session-tabs subscription plus the production renderer store. Require exactly two transport envelopes and two title mutations per worktree, no decorative title crossing either boundary, and positive decoded-envelope bytes. Enable ordinary parking with the lossy retention budget disabled, require exactly one mounted manager and five parked tabs, at most 45% retained cells, no more than 16 MiB heap growth, and under 500 ms timer drift. In headed mode, require the host renderer to remain on its original workspace with zero target terminal managers mounted throughout client park, reveal, and live I/O. While a tab is parked, require authoritative terminal.read to observe new PTY output; reveal it and require the original PTY, a marker within the requested 5,000-row history, the parked marker, and post-reveal input/output. Drive 24 real PTY title trackers in distinct worktrees through 40 decorative spinner frames each, then 40 spinner frames alternating with Cursor's bare native identity redraw, using fake clocks. Require all 2,880 raw chunks exactly and zero host session-tabs publications, serialized bytes, renderer apply calls, and renderer store mutations. Continue decorative evidence beyond 30 minutes, require exactly one refresh per worktree per 15-minute lease through a FIFO spaced by at least 50 ms, and require all 24 viewer statuses to remain working and fresh; then require one exact semantic idle transition and one visible-output chunk per PTY. Require ordinary and interior-Braille title changes to publish. Drive 64 host PTYs through ten 80 ms synthetic title frames, require zero paired client events after the first frame per PTY while all 640 local frames remain observable, attach a late client and require one current frame per PTY, then require semantic bell and idle transitions on both clients. Reconstruct a legacy subscribed stream with no outputPause capability, hide a chatty pane, require no hidden xterm writes, reveal it, and require one authoritative snapshot plus continued live output. Drop and acknowledge output only for one original paired-client stream, prove the fixture process consumed input while the host model advanced and the client stayed stale, then require the command snapshot probe to replace that stream, repaint exact fixture output, preserve authoritative PTY identity and target-tab cardinality, and resume live I/O. For a client without a delivered sequence, require the first numeric probe to establish a baseline without replacement, a same-sequence probe to remain attached, and a later advanced probe to replace only that stream. Withhold the first encrypted shared-control ready frame, start one RPC, trigger a status-probe refresh, and require two connections, one host delivery, successful response, and zero retained request bytes. Admit 128 active streams, reject the 129th as retryable, release one stream, then require the retry to attach and publish a snapshot without multiplying retained subscribers. Disable terminal.paired-parking.v1 and require the same oracle to fail before parking, while the legacy limit-one fallback separately passes. Also preserve truncated first paint, ACK-starved same-PTY recovery, responsive silent-command snapshot probes, dead-stream probe timeout recovery, and queued manual-disconnect fencing.", + "oracle": "Audit 3292 combines adopted 3285/3287/3289/3293 removals: 40 authored declarations and 47 expanded scenarios, including whole frame-editor-view, ambiguous remote-delete-refusal, unverifiable-host subscription and editor-close cleanup suites. The previously reviewed dock-badge suite was already removed upstream in PR 40895 and receives zero new removal credit. Intentionally retired alarms include background browser selection and last-tab landing; main startup fallback, SSH project cleanup/survivor routing, exact-PR contradiction/saved-push positives, replay/sidecar rollback and wrapped remote error normalization; records/snapshot missing-diff hydration, ambiguous folder-owner delete refusal, focus no-op notifications, nested editor context-only cache check, pending broadcast-first status and ordinary four-confirmation aggregation; preview-source frontmatter pruning, approved local/runtime agent dispatch, non-GitHub legacy PR cache invalidation, stale merged-head transient-error fallback, empty-queue immediate query reply and unverified-to-concrete preflight risk. Additional intentionally retired alarms are injected host subscription/unsubscribe counts, synthetic editor reveal/draft/fallback/scoped close, ambiguous unread refusals and hidden mark/read roundtrip, immediate connect backoff/noError, positive mirrored evidence-clock renewal, supplied VM failure/success projections and git-local/folder-SSH wake permutations. Remaining temporal/ownership cases are narrower; no equivalent replacement or fresh execution is claimed. Audit 3283 removes 20 authored declarations and 31 expanded scenarios, including two whole suites. Retired alarms cover PR refresh-state pruning, shared runtime subscription cleanup and store isolation, language content-change routing and older completion ownership, ordinary panel retry-timer cleanup and pending loading, four hosted-review lifetime permutations, mocked terminal creation error/order wiring, five sleep-inventory variants with pending-frame-only assertions, palette fallback/composite highlights, Windows/UNC encoded-editor input rows, mixed-repository partial failure counts, title setters and generated-title bypass/replacement, five window-close coordinator delegation/guard/finally branches, and ambiguous-old-record frame reveal. These regression checks are intentionally lost under the test-value audit; retained cases are not equivalent replacements. Prior coverage notes and receipts remain historical. Audit 3273 removes 14 authored declarations and 19 expanded scenarios across four whole suites and eight partial suites. Retired alarms cover saved-local cancellation/layout ownership, ambiguous-owner warning reset, folder attachment routing, VM false-capability bypass, abandoned reveal warmup cleanup and viewport claim deduplication/rearming, quiet unrelated remote-removal refusal, startup-command one-shot consumption, repository/floating recovery-ledger rows, fake-React pinned-scroll intent, split-ratio state identity/subscriber suppression and fractional change, cross-host project-group join refusal, three PR request-lifetime permutations, upstream-status preservation on error, and unresolved Git-owner refusal. These regression checks are intentionally lost under the test-value audit; retained scenarios are not equivalent replacements. Historical coverage receipts remain historical, including gate35 subscriber claims. Audit 3256 removes these specific alarms from the broad root unit commands: skill dialog active-share selection, close and pending-share handoff; simple keyed-record deletion; marker live-region insertion, simple landing and nine baseline policy examples; General search/control navigation inventory; orphan-count cache bootstrap; seven Codex code classifications and HTTP 429 warning mapping; two skill unread-root verdict examples; peer-mail payload and conversation-ID rejection; and the GitHub organization TABLE text-field optimistic rollback/failed-envelope example. These include real behaviors; retained tests do not provide equivalent coverage for every removed scenario. Mobile losses are recorded separately and are not coverage of these root commands. Audit3246 retires NewRowsMarker reveal/no-repeat and pane-scoped beforeinput checks; skill-owner option availability/count/dedup/order; six styled Input/Textarea IME forwarding rows; the static Codex/OpenCode smart-key inventory; tab-map AST ratchet diagnostic fixtures; child-roster work-budget and retained-aggregate alarms; malformed persisted floating-cwd fallback/no-crash/empty exact-root checks; the unanswered-host empty-list discriminator; the direct invalidated-cache commit-false assertion; one redundant digit-keyup IME row; cached non-supported Claude title-generator rows; and the duplicate late naming-result singleton. These root broad commands lose those specific alarms without equivalent replacement. Distinct retained owner/state checks have their own bounded claims; the real scheduler still rejects stale response data, while the direct false-return alarm is retired. Audit3231 retires supported-host restore-pane key mapping, closed/open creation-sidebar toggle visibility, unrelated scope-error/null classification and quick-submit reveal/no-create checks. These broad commands lose those real narrow alarms; no replacement coverage is claimed. Audit3219 removes the synthetic Cmd+J extra-source suite; this broad command no longer checks its match/tie placement and selection, announced count, empty-query cap, or workspace hiding with retained recent tabs. No replacement coverage is claimed. Audit3209 composes approved sources3202/3206: deliberately retires seven authored/expanded cases in four whole suites without equivalent replacement. Work-item queries lose real GitHub/GitLab oversized ASCII secret-prefix empty-query and whitespace-before-trim refusal alarms; inputs share the imported size bound and exercise only its fast length branch, with no multibyte or actual provider/exposure guarantee. Skill sharing loses complete/partial managed-bundle and destination-ambiguity association checks plus three negative origin/path/scheme admission examples; these do not establish uploaded contents, arbitrary-URL fetching, authorization or execution. Retain exact originless-project direct-link fallback, cloud-delete confirmation, bundled-target repair/owner isolation and explicit Windows-host preference over stale WSL suites. Rejected3201 runtime-preference removal is excluded. No real cloud/network/host/disk, mobile or mixed-version execution validation is claimed. Audit3200 composes approved source3194: deliberately retires thirteen authored registrations/twenty-seven expanded cases in six whole automation host/list policy suites without equivalent replacement. Real RPC category/retryability and wrapped-timeout recognition, unscoped-failure/scoped-success health evidence precedence, exact-ID create selectors and per-run workspace omission, paired-web local/SSH/absent host catalog routing, incompatible/removed/unhydrated/offline execution health, runtime-before-nested-SSH recovery dispatch, and no-owned-focus/successor/foreign-list focus policy alarms are consciously lost. Retain exact20line orphan allow/refuse/precondition and exact90line cross-host same-ID search suites. No retry-timer/fence lifecycle, actual reconnect/network/write delivery, native focus, mobile/mixed-version runtime or disk persistence coverage is claimed. Audit3191 combines approved source3182/3187/3188: deliberately retires thirteen authored Vitest registrations and fifteen expanded cases, including five whole suites, without equivalent replacement. Attachment intake loses real portal/native-capture terminal interception and unowned-container refusal, immediate child-only committed availability/claim-ref negotiation and delivery, and direct-target over stable focused/background composer routing through disable/re-enable/remount and independent question focus. Exact destination/cache/draft and final-stat owner/workspace/File-release suites remain; they do not replace Surface recipient routing. Automation authoring loses destination runtime catalog membership, local/direct-SSH exclusion of paired-runtime repos, unknown-runtime empty catalog, logical project/host/setup/repo/path context payload, and missing/nonready setup refusal; these were genuine direct helper alarms, while exact schedule transformation, legacy schedule and setup-decision suites remain. Agent picker loses setup-chat/terminal/missing-installer/unsupported-or-unknown-host row projection samples and the ordinary unsearched menu variant; the entire original26-line resume recipe suite remains, including reported bypass versus default/absent permission modes, as does the exact search-result menu callback with its fixtures, model/effort commits and staged Arguments reopen outcome. Rejected predecessor3180 full recipe deletion is excluded. No actual native drag/cursor/focus/IME, upload bytes or disk/restart persistence, full automation save/scheduler/runtime transport, real resume-process flags/environment delivery, or native menu/rendered layout validation is claimed. Audit3178 combines source3169/3170/3175: deliberately retires eight authored units (six Vitest cases and two imperative custom relay scenarios), including two whole suites, without equivalent replacement. Voice Section loses per-model pending-delete isolation across interleaved A/B completion and the two-success refresh-call alarm; exact VoicePane delayed key-clear/newer enabled-toggle merge remains and does not replace row deletion coverage. Speech loses dedicated rating-scale/inclusive-ceiling, unsupported-versus-unmeasured, explicit/system-language precedence/locale alias, accuracy versus fast named/default/best-measured selection, and unmeasured/no-match examples; exact offered-user-pick versus retired-selection case and its fixture remain. Relay loses legacy ping-delivery count/liveness sampled before the silence deadline and grouped malformed Bearer/host-ID 401/429 routing checks; twelve real Worker/DurableObject/shipped-client scenarios remain, not equivalent replacement for those narrow alarms. Six prior speech cases are not all deleted: approved successor3175 keeps the original user-choice case. No actual credential/file persistence, native/GPU/engine/download delivery, production assignment policy or deployed-runtime validation is claimed by this reduction. Audit3165 combines source3160/3162: deliberately retires six authored/expanded cases across three whole suites without equivalent replacement. Launch/status losses: observed React-render pending/resuming coordination across settings and deferred offer read; stale-offer reread suppressing dialog reopen; held-local-chat recovery visibility with new-chat preferences off; disabled-local admission avoiding offer RPC despite an injected but unconsumed paired-tab fixture; and run-only lost-reply uncertainty reachability until direct viewed-run retirement. Launch probe does not prove arbitrary synchronous-store atomicity, the paired fixture is not remote runtime enrollment, and the status case directly marks viewed state rather than rendering the summary. Crew-hook losses: old-host method_not_found cache persists across party changes but is released by independently supplied connection generation/verified pairing status or pairing revision, with actual frame publication and teardown. These are real narrow coordination, admission, uncertainty and mixed-version cache alarms consciously lost. Exact web verified-runtime writer handoff guard remains; it does not replace those alarms or prove live host/native/mobile delivery. Audit3156 combines3147/3150/3152/3153/3154: deliberately retires39authored/40expanded native-chat recovery cases, eight whole suites and two orphan test-support files without equivalent replacement. Lost alarms: lost-reply unconfirmed reconciliation, skipped rows/counts and missed-frame repair, unknown/pending outcome and omitted-failure-list compatibility, uncertain history after dismissal, retry/refusal/dismiss lifecycle, hidden/consumed picker ownership, result-tree keyboard focus/disclosure and all-skipped retirement; unconfirmed-over-conflict guidance and failed-chat changes despite older host timestamps; nearest-listed ancestor/cyclic forest shape, descendant membership, host ordering/missing-host local fallback; skipped/readiness/admission counts, provisional skip/progress monotonicity, early per-chat verdicts with batch pending protection, older-host waiting, start-slot/delivery distinction, retry-over-failure and unknown-after-withdrawal attention; remote snooze/reconnect/reoffer, unseen mixed summary through open/close, watched completion retirement, new success beside old failure, failed-reread mixed-result preservation, filter/collapse completion resets, retry summary replacement and current-offer/history selection; cross-host workspace identity, rendered cyclic reachability, nested tri-state/toggle propagation, project eligibility isolation and collapse preserving selection. Exact fallback-list completion barrier, batched verdict/cleanup retention, stale-read versus dismissal publication race, and requested-but-never-rendered finished-run retirement remain; they do not replace retired alarms. Audit3146 combines source reviews3132/3133/3135/3138/3143: intentionally retire20authored/31expanded cases without equivalent replacement. Provider-session losses: structured-native terminal-resume exclusion, metadata-less completed identity, new-turn completion clearing, Pi provider-only/periodic/manual promotion, changed-transcript launch-config isolation, Pi/omp/prime-agent completed-session remote/manual-shutdown promotion, and quit/done precedence over heartbeat. Side-thread/question losses: finished-pane acquisition, hidden title/recap states, local/relay/relay-done conversation takeover with prompt/session/child resets, plain-message abandonment, compaction/session replacement and completion resets. Codex startup losses: incoming-owner cached child replacement, old-relay foreign live-session correction, completed foreign-root turn-fact permutations. Transcript losses: real temporary-JSONL partial sibling/final-child completion, unlabelled child attribution, compact cached replay preservation and100/1000completed-child roster retention/release. Compiler-ratchet losses: valid-line uncompiled-list parser grammar examples and injected-existence stale-path filtering; these did not exercise actual filesystem canonicalization or build exclusion. These are real lifecycle, ownership, replay, liveness and retention alarms, including recent#40246 regressions, deliberately lost. Retained conditional record replacement, clockless root/SSH owner isolation, persisted main-thread fork rejection, partial/final question-answer lifetime, cached-roster/missing-ID/live HTTP/durable startup boundaries and restarted-relay refusal/acceptance do not replace those losses. No native/SSH/WSL execution or equivalent coverage is claimed. Audit3128 scoped coverage reduction: Audit3121 removes VoiceDictationLanguageSetting.test.tsx (Spanish-to-es callback and unsupported-model Korean option presence) and voice-speech-model-rows.test.ts (provider/language-order/retired-on-disk list policy); these real narrow alarms are deliberately retired without replacement. VoiceSpeechModelSection per-model concurrent deletion remains unchanged. Audit3122 removes the direct absolute/parent-segment sparse-directory exception-type sample and the five-row IPC sparse-preset error-code/non-save table (two authored/six expanded cases). Those real typed-validation and IPC refusal/error-code alarms are deliberately retired. Keep both real symlink/junction floating-directory trust cases and the minimal RPC structured validation-reason serialization case. The RPC case does not replace IPC save/refusal behavior, typed normalization for both path inputs, actual Git sparse checkout or rendered localization. No equivalent replacement or fresh test/runtime/platform/remote/performance validation is claimed. Audit3124 removes ExperimentalPane.test.tsx (ordinary Pet switch callback), WorkspaceDirectorySetting.test.tsx (padded absolute saved-path normalization/no-write blur), and repository-search.perf.test.ts (navigation/selected-pane builder-call policy, fixture cardinality/nonempty entries and renamed project keyword inclusion). These real narrow alarms are retired without replacement; RepositoryPane.search.test.tsx search-to-sparse-editor request remains unchanged. Audit3129: resolver Windows case-insensitive and POSIX case-sensitive configured-env composition plus mocked-base launch-preflight Windows composition are intentionally no longer checked by the two deleted suites. No equivalent coverage claimed. Keep runtime-structured-agent-host-env.test.ts unchanged: configured Windows Claude-home account identity and host-account precedence remain checked. Audit3114 incorporates source3101: retire three structured Claude child-environment wrapper cases covering inherited stamp isolation/default and explicit entrypoint, Windows SDK-key canonicalization/default/duplicate-key order, and configured lookup/final environment/config-dir conjunction. Keep direct auth/session sanitation and Windows-versus-Linux overlay checks, actual executable lookup from supplied inherited PATH, native Windows child environment delivery, and stale option-mutation fencing. These are not equivalent replacements for the retired wrapper alarms. No fresh test/runtime, real login-shell probe, Claude SDK startup, remote/mixed-version, UI or performance result is claimed. Audit3114 incorporates source3105: retire 17 authored/20 expanded daemon launch-note cases, including the entire two-case SessionLaunchNote suite. Deliberately lose split-marker carry across same-token re-arm, stale-token retirement refusal, foreground tri-state and serial settlement, omitted-note/no-incarnation mixed-version policy, sticky retirement, first-incarnation/replacement launch preservation and held-launch precedence. Keep only the unchanged unresolved foreground-read race against a later finished attach. Supplied notes/foreground and runtime calls do not establish actual daemon/main restart, SSH, native Windows observation, mobile UI, equivalent replacement or fresh runtime/performance validation. Audit3114 incorporates source3109: retire six authored/35 expanded pricing cases: 21 accepted model-name examples, 10 unsupported/future-model fail-closed examples, malformed TTL clamp, unknown-model estimate refusal, flat-model long-context disregard and oversized long-context clamp. Keep mixed five-minute/one-hour write allocation and short/all-long/mixed long-context allocation with original fixed oracles. Real parser/refusal/bounds alarms are knowingly lost without equivalent replacement; retained tests do not validate provider rates, actual billing or request threshold classification. Preserve the archived usage-scan-append source-freeze receipt without transferring historical execution/performance credit. No fresh runtime result is claimed. Audit3108 source-only reduction (3094/3095/3100): retire 27 authored/30 expanded cases, including complete markdown view-state, file-preview link-open and CLI agent-server-route suites, without replacement. Deliberate losses include preview visibility/reference lifetime and same-path owners; SSH stat, directory/missing-target, explicit-null owner, nonmarkdown line/column, local URI routing, remote-to-client guard and same-file reuse; document-preview source-owner/folder/reuse routing, stable grant location and outside-workspace POSIX/Windows request projection; and verified remote CLI send/check refusal, suggested --on argv/copy, shell no-probe bypass, unverified-launch admission and older-peer refusal. Retain two markdown source-runtime/qualified-reveal alarms, one stale grant-rejection fence and two remote read/mutation evidence policies, with original callbacks. Final last-wins reveal did not prove transient cancellation; CLI prerequisite did not prove no real send, and envelope tests do not execute server refusal. No fresh runtime, rendered UI, actual file/SSH/paired transport, authorization, mixed-version or performance result is claimed. Audit3096 source-only reduction (3087/3088): retire 69 authored/76 expanded cases, including complete recovery-portals and reconnect-banner suites. Intentionally lose dead/default TUI replay, generated alternate-frame style composition, reset/mode/dimension and legacy missing-mode-boundary alarms, UI notice/action/reveal policies, and isolated recovery lifecycle variants, without equivalent replacement. Retained registrations and callbacks are unchanged; headless cells are not pixels, and no fresh runtime, host, SSH, WSL, rendered-app or performance result is claimed. Audit3086 source-only reduction (3079/3080/3081): intentionally retire 93 authored/100 expanded mock-boundary cases, including the complete spawn-errors and SSH reconnect overlay suites, without replacement. Retired alarms include spawn classification/ownership, reply ceilings and renderer-write failure recovery, disconnect/detach fencing branches, authority facts, and overlay retry/visibility wiring. Retained callbacks are unchanged; no fresh execution, real PTY/SSH, rendered UI, or performance result is claimed. The direct side-effect-facts selector retains six cases: replay exclusion, live sequence handling, stale disposer ownership, one handoff drain, drain-before-snapshot, and stale replacement-snapshot refusal. Successful current-entry snapshot application is not witnessed by the retained snapshot case. Audit2432: The broad unit command loses the isolated BranchPicker open-change notification sample. Its unique true/false callback alarm is intentionally retired; reopening/status-refresh behavior was not exercised. No equivalent replacement or fresh validation of the reduced selector is claimed. Audit2425: The broad unit command loses the workspace-copy-status supplied readError forwarding sample. It did not exercise the branch-switch blocking promised by its title. This alarm is intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2417: The broad unit command loses two ordinary clean Git cherry-pick/revert success samples and two terminal startup foreground-read work-budget samples. These unique alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2412: The broad unit command loses the whole six-case fake-React-hook scroll-anchor suite, two generic draft-retention samples, a simple new-agent order sample, a real history-publication batching-count sample, an unmounted handoff abort/timer sample and three basic WSL preview/error samples. These alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2404: The broad unit command loses the standalone share-name lookup 503 propagation suite, initial deletion placement-kind sample, direct changed-mtime stale sample, first-pass rollback existence example and abandoned-preparation directory sample. These exact alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2397 review amendment: The broad unit command loses three standalone suites, two partial-case definitions and two URL table rows across package/download/placement tests. Keep initial wrong-port authorization, modified independent-copy digest refusal and abort-after-begin cancellation dispatch. The remaining alarms are deliberately retired; no equivalent complete replacement or fresh validation of the reduced selector is claimed. Audit2393 current-parent refresh2401: Remove the basic skill-install service alias sample and original public managed-remove receiptless refusal case. Preserve the upstream request ownership suite and transaction interruption coverage. No equivalent complete replacement or fresh validation of the reduced selector is claimed. Audit2389: The broad unit command loses the missing-preview suite, plain-global destination sample and prepublished-receipt recovery example. No equivalent replacement or fresh validation of the reduced selector is claimed. Audit2385: The broad unit command loses four authored walker/staging/protocol examples (six expanded cases); no equivalent replacement or fresh validation is claimed for the reduced suite. Audit2383: The unscoped Vitest command no longer includes the removed Antigravity catalogue suite; its exact provider-root/owner example has no equivalent replacement or fresh validation claim. Audit2377/2381: The unscoped Vitest command includes the reduced bundled-skill and native-discovery suites; the eight removed backup/legacy/catalogue/symlink/SSH-builder examples have no replacement-equivalence or fresh validation claim here. Audit2133 current-parent preparation: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2095 current-parent preparation2126: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2090 (sources2088/2089): Current reduced suites intentionally retire the alarms listed in knownGaps; prior dated execution and replacement claims do not validate changed source bytes or selectors. Historical prior account (preserved verbatim): Audit2086 (sources2082/2083): Current reduced suites intentionally retire the alarms listed in knownGaps; prior dated execution and replacement claims do not validate changed source bytes or selectors. Historical prior account (preserved verbatim): Audit2076 (sources2073/2074): Intentionally retire these low-value alarms without replacement: src/main/runtime/orca-runtime-tests/terminal-handles-part-02.spec.ts: recovers a moved SSH pane through the tab it now sits in, not the one its lease froze; reports a plain expired orphan; does not report a pane whose only recent lease was superseded; does not report a pane whose only recent lease had its relay id recycled; picks the eligible orphan over a superseded predecessor that matches first; collects the same tabs the per-tab reader reports, in one sweep of the leases; reports no candidate when no lease names any of the worktree tabs. src/main/runtime/orca-runtime-tests/runtime-availability.spec.ts: starts unavailable with no authoritative window; reports the configured Windows terminal shell on status; reports floating workspace availability from settings on status; polls floating tabs with targeted PTY liveness and no repo/provider inventory; hydrates persisted tabs when the store cannot report repos; advertises browser screencast only when a renderer window is available; routes mobile Codex reset consumption through the account mutation coordinator; maps a definite pre-provider rejection into an authoritative current snapshot. Existing unrelated evidenceRuns retain their original scope; unchanged dated receipt objects do not validate changed source bytes or reduced selectors. No fresh gate execution or historical import-closure equivalence is claimed. Frozen current literal-import graph reaches these changed test bytes; unresolved local and computed edges remain debt, and current reachability is not historical execution or equivalent replacement evidence. Historical prior account (preserved verbatim): Audit2003: Remove SSH/absent-inventory attach refusal, later-subscriber retry, no-view adoption/takeback, provider-tail/unknown-read projections, failed-keystroke retry and simpler loss reattach examples. Keep the existing-subscriber inventory-ready retry alias only at its retained callback, plus retained held-input cancellation/replacement and overlapping attach/loss fences. The inventory driver also loses the whole empty-worktree-publication registration and folder-host/unverifiable scalar examples. Retire the entire dated10-case attach receipt; retain16 independent receipts only in their original scopes. No retained-memory or real-daemon measurement follows from supplied provider inventories. Changed-source prior results do not validate reduced-source bytes. No fresh execution, equivalent replacement, red/green, measured budget, soak, physical provider/PTY, rendered, live remote/mobile or cross-platform result is claimed. Historical prior account (preserved verbatim): Audit1991: Remove initial-snapshot sequence-domain, limited-tail/truncation and unknown-output-sequence aliases whose callbacks are removed. The source retains partial-chunk replay and requested-snapshot retry/admission at supplied snapshot/data seams, not equivalent replacement or measured retained-memory proof. Preserve the existing stream/pending-wait capacity aliases only to their retained owning multiplex callbacks with supplied PTY resolutions. Removing the sibling-PTY heartbeat dedup work-count sample does not establish a new decorative fanout budget; the unrelated-PTY cancellation fence survives. Preserve17 unrelated dated receipts. Changed-source prior results do not validate reduced-source bytes. No fresh execution, equivalent replacement, red/green, measured budget, soak, physical provider/PTY, rendered, live remote/mobile or cross-platform result is claimed. Historical prior account (preserved verbatim): Audit1983: Remove the reasonless-close selector and narrow census aliases to actual retained runtime and injected-inventory callbacks. The removed synthetic census-dedup and isolated pre-boundary timing cases receive no replacement credit; preserve17 unrelated dated receipts. Changed-source prior results do not validate reduced-source bytes. No fresh execution, equivalent replacement, red/green, measured budget, soak, provider/PTY, rendered, live remote/mobile or cross-platform result is claimed. Historical prior account (preserved verbatim): Audit1939 (sources1934/1935): Delete the synthetic watcher-synchronization and partial-reconciliation suites. Retire all affected host-fact, capability-owner, activation-residue and retention-cap aliases because the remaining callbacks do not establish those full claims. Keep exact local hook/timer, byte-stream side effects, exit/disposal, scroll-intent cleanup and deterministic local rank/TTL progression callbacks within their mocked-host scope. No physical paired-host retention, resource budget or equivalent replacement evidence is assigned. The generic broad test command remains a runnable discovery command, never a dated execution receipt. Preserve meaningful remaining selectors/assertions and unchanged dated receipts within their original scope. Reduced selectors have no fresh gate execution evidence in this metadata packet. No equivalent replacement, physical watcher/PTY/provider, live SSH/remote/mobile, rendered, cross-platform, soak or measured-budget result is claimed. Historical prior account (preserved verbatim): Audit1931 (sources1928/1929): Delete the complete hook-agent-status projection suite and its two behavioral assertion aliases. Supplied stored hook/title/resume/staleness/rename/question/generation/PTY-retirement/snapshot-version projections are intentionally lost. The separate osc-status-scan gate mentions this source only in existing historical notes and receives no mutation. No measured hidden-output retention, CPU/RSS or resource budget result is claimed by the deleted source or this audit. Preserve meaningful remaining selectors/assertions and unchanged dated receipts within their original scope. Reduced selectors have no fresh gate execution evidence in this metadata packet. No equivalent replacement, physical watcher/PTY/provider, live SSH/remote/mobile, rendered, cross-platform, soak or measured-budget result is claimed. Historical prior account (preserved verbatim): Retained exact unchanged-source receipts remain the only current execution evidence. Reduced selectors have no fresh execution result. Historical pre-audit oracle account for changed sources: The retained unchanged-source receipts are the only current execution evidence; reduced-source assertions await validation. Historical oracle account (not a current claim for changed sources): Existing exact unchanged-selector receipts remain the only current execution evidence. Changed source selectors have no fresh execution result. Historical prior-source oracle account: Existing exact unchanged-selector receipts remain the only current execution evidence. Changed source selectors have no fresh execution result. Historical prior-source oracle account: Run one byte-identical six-terminal oracle against an isolated headed desktop host and an isolated headless `orca serve` host. Stage at least 1,000,000 xterm cells, hide all six warm managers, emit an initial working title followed by 30 timed real-PTY spinner frames and a final idle title per worktree, and observe a second real session-tabs subscription plus the production renderer store. Require exactly two transport envelopes and two title mutations per worktree, no decorative title crossing either boundary, and positive decoded-envelope bytes. Enable ordinary parking with the lossy retention budget disabled, require exactly one mounted manager and five parked tabs, at most 45% retained cells, no more than 16 MiB heap growth, and under 500 ms timer drift. In headed mode, require the host renderer to remain on its original workspace with zero target terminal managers mounted throughout client park, reveal, and live I/O. While a tab is parked, require authoritative terminal.read to observe new PTY output; reveal it and require the original PTY, a marker within the requested 5,000-row history, the parked marker, and post-reveal input/output. Drive 24 real PTY title trackers in distinct worktrees through 40 decorative spinner frames each, then 40 spinner frames alternating with Cursor's bare native identity redraw, using fake clocks. Require all 2,880 raw chunks exactly and zero host session-tabs publications, serialized bytes, renderer apply calls, and renderer store mutations. Continue decorative evidence beyond 30 minutes, require exactly one refresh per worktree per 15-minute lease through a FIFO spaced by at least 50 ms, and require all 24 viewer statuses to remain working and fresh; then require one exact semantic idle transition and one visible-output chunk per PTY. Require ordinary and interior-Braille title changes to publish. Drive 64 host PTYs through ten 80 ms synthetic title frames, require zero paired client events after the first frame per PTY while all 640 local frames remain observable, attach a late client and require one current frame per PTY, then require semantic bell and idle transitions on both clients. Reconstruct a legacy subscribed stream with no outputPause capability, hide a chatty pane, require no hidden xterm writes, reveal it, and require one authoritative snapshot plus continued live output. Drop and acknowledge output only for one original paired-client stream, prove the fixture process consumed input while the host model advanced and the client stayed stale, then require the command snapshot probe to replace that stream, repaint exact fixture output, preserve authoritative PTY identity and target-tab cardinality, and resume live I/O. For a client without a delivered sequence, require the first numeric probe to establish a baseline without replacement, a same-sequence probe to remain attached, and a later advanced probe to replace only that stream. Withhold the first encrypted shared-control ready frame, start one RPC, trigger a status-probe refresh, and require two connections, one host delivery, successful response, and zero retained request bytes. Admit 128 active streams, reject the 129th as retryable, release one stream, then require the retry to attach and publish a snapshot without multiplying retained subscribers. Disable terminal.paired-parking.v1 and require the same oracle to fail before parking, while the legacy limit-one fallback separately passes. Also preserve truncated first paint, ACK-starved same-PTY recovery, responsive silent-command snapshot probes, dead-stream probe timeout recovery, and queued manual-disconnect fencing.", "commands": [ "pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/components/terminal-pane/pty-transport/remote-runtime/remote-runtime-pty-transport-unpublished-host-graph.test.ts", "ORCA_BACKGROUND_LAUNCH=1 pnpm exec playwright test tests/e2e/paired-remote-terminal-host-quit-reconnect-input.spec.ts --config tests/playwright.config.ts --project electron-headless --workers=1", @@ -9027,7 +9029,8 @@ "Terminal/runtime defining-owner cleanup retires complete parking timer, lifecycle, mocked close/disposal and render/flip/mount work-count cases under repository test policy. The retained watcher source has only two literal-oracle coverage decisions; the retained cold-parking hook source has only the layout-PTY exemption invalidation case. Lost alarms include cooldown/measure/pin wakeups, split exit/close attribution and cancellation, watcher disposal/restart, flood timer rearm, worktree verdict damping, and destroyed-transport cold restore. No equivalent replacement coverage or execution pass for the reduced cases is claimed; prior dated receipts retain their original scope.", "Audit 3256 removes these specific alarms from the broad root unit commands: skill dialog active-share selection, close and pending-share handoff; simple keyed-record deletion; marker live-region insertion, simple landing and nine baseline policy examples; General search/control navigation inventory; orphan-count cache bootstrap; seven Codex code classifications and HTTP 429 warning mapping; two skill unread-root verdict examples; peer-mail payload and conversation-ID rejection; and the GitHub organization TABLE text-field optimistic rollback/failed-envelope example. These include real behaviors; retained tests do not provide equivalent coverage for every removed scenario. Mobile losses are recorded separately and are not coverage of these root commands.", "Audit 3273 removes 14 authored declarations and 19 expanded scenarios across four whole suites and eight partial suites. Retired alarms cover saved-local cancellation/layout ownership, ambiguous-owner warning reset, folder attachment routing, VM false-capability bypass, abandoned reveal warmup cleanup and viewport claim deduplication/rearming, quiet unrelated remote-removal refusal, startup-command one-shot consumption, repository/floating recovery-ledger rows, fake-React pinned-scroll intent, split-ratio state identity/subscriber suppression and fractional change, cross-host project-group join refusal, three PR request-lifetime permutations, upstream-status preservation on error, and unresolved Git-owner refusal. These regression checks are intentionally lost under the test-value audit; retained scenarios are not equivalent replacements. Historical coverage receipts remain historical, including gate35 subscriber claims.", - "Audit 3283 removes 20 authored declarations and 31 expanded scenarios, including two whole suites. Retired alarms cover PR refresh-state pruning, shared runtime subscription cleanup and store isolation, language content-change routing and older completion ownership, ordinary panel retry-timer cleanup and pending loading, four hosted-review lifetime permutations, mocked terminal creation error/order wiring, five sleep-inventory variants with pending-frame-only assertions, palette fallback/composite highlights, Windows/UNC encoded-editor input rows, mixed-repository partial failure counts, title setters and generated-title bypass/replacement, five window-close coordinator delegation/guard/finally branches, and ambiguous-old-record frame reveal. These regression checks are intentionally lost under the test-value audit; retained cases are not equivalent replacements. Prior coverage notes and receipts remain historical." + "Audit 3283 removes 20 authored declarations and 31 expanded scenarios, including two whole suites. Retired alarms cover PR refresh-state pruning, shared runtime subscription cleanup and store isolation, language content-change routing and older completion ownership, ordinary panel retry-timer cleanup and pending loading, four hosted-review lifetime permutations, mocked terminal creation error/order wiring, five sleep-inventory variants with pending-frame-only assertions, palette fallback/composite highlights, Windows/UNC encoded-editor input rows, mixed-repository partial failure counts, title setters and generated-title bypass/replacement, five window-close coordinator delegation/guard/finally branches, and ambiguous-old-record frame reveal. These regression checks are intentionally lost under the test-value audit; retained cases are not equivalent replacements. Prior coverage notes and receipts remain historical.", + "Audit 3292 combines adopted 3285/3287/3289/3293 removals: 40 authored declarations and 47 expanded scenarios, including whole frame-editor-view, ambiguous remote-delete-refusal, unverifiable-host subscription and editor-close cleanup suites. The previously reviewed dock-badge suite was already removed upstream in PR 40895 and receives zero new removal credit. Intentionally retired alarms include background browser selection and last-tab landing; main startup fallback, SSH project cleanup/survivor routing, exact-PR contradiction/saved-push positives, replay/sidecar rollback and wrapped remote error normalization; records/snapshot missing-diff hydration, ambiguous folder-owner delete refusal, focus no-op notifications, nested editor context-only cache check, pending broadcast-first status and ordinary four-confirmation aggregation; preview-source frontmatter pruning, approved local/runtime agent dispatch, non-GitHub legacy PR cache invalidation, stale merged-head transient-error fallback, empty-queue immediate query reply and unverified-to-concrete preflight risk. Additional intentionally retired alarms are injected host subscription/unsubscribe counts, synthetic editor reveal/draft/fallback/scoped close, ambiguous unread refusals and hidden mark/read roundtrip, immediate connect backoff/noError, positive mirrored evidence-clock renewal, supplied VM failure/success projections and git-local/folder-SSH wake permutations. Remaining temporal/ownership cases are narrower; no equivalent replacement or fresh execution is claimed." ], "demotionRule": "Keep experimental or demote to protection none if decorative title frequency changes paired client-event or session-tabs publication volume after convergence, a semantic fact is dropped, paired first paint is blank, passive work reconnects after manual disconnect, a capable hidden paired manager survives ordinary parking, a legacy hidden pane schedules raw xterm output or bypasses its fallback, reveal loses requested bounded history or live PTY identity, retained buffer cells do not fall, or either headed/headless scenario flakes." }, @@ -9206,7 +9209,7 @@ "providers": ["local", "daemon", "ssh", "remote-runtime"], "coveredPlatforms": ["macos"], "coveredProviders": [], - "coverageNotes": "Audit 3283 removes 20 authored declarations and 31 expanded scenarios, including two whole suites. Retired alarms cover PR refresh-state pruning, shared runtime subscription cleanup and store isolation, language content-change routing and older completion ownership, ordinary panel retry-timer cleanup and pending loading, four hosted-review lifetime permutations, mocked terminal creation error/order wiring, five sleep-inventory variants with pending-frame-only assertions, palette fallback/composite highlights, Windows/UNC encoded-editor input rows, mixed-repository partial failure counts, title setters and generated-title bypass/replacement, five window-close coordinator delegation/guard/finally branches, and ambiguous-old-record frame reveal. These regression checks are intentionally lost under the test-value audit; retained cases are not equivalent replacements. Prior coverage notes and receipts remain historical. Audit 3273 removes 14 authored declarations and 19 expanded scenarios across four whole suites and eight partial suites. Retired alarms cover saved-local cancellation/layout ownership, ambiguous-owner warning reset, folder attachment routing, VM false-capability bypass, abandoned reveal warmup cleanup and viewport claim deduplication/rearming, quiet unrelated remote-removal refusal, startup-command one-shot consumption, repository/floating recovery-ledger rows, fake-React pinned-scroll intent, split-ratio state identity/subscriber suppression and fractional change, cross-host project-group join refusal, three PR request-lifetime permutations, upstream-status preservation on error, and unresolved Git-owner refusal. These regression checks are intentionally lost under the test-value audit; retained scenarios are not equivalent replacements. Historical coverage receipts remain historical, including gate35 subscriber claims. Audit 3256 removes these specific alarms from the broad root unit commands: skill dialog active-share selection, close and pending-share handoff; simple keyed-record deletion; marker live-region insertion, simple landing and nine baseline policy examples; General search/control navigation inventory; orphan-count cache bootstrap; seven Codex code classifications and HTTP 429 warning mapping; two skill unread-root verdict examples; peer-mail payload and conversation-ID rejection; and the GitHub organization TABLE text-field optimistic rollback/failed-envelope example. These include real behaviors; retained tests do not provide equivalent coverage for every removed scenario. Mobile losses are recorded separately and are not coverage of these root commands. Audit3246 retires NewRowsMarker reveal/no-repeat and pane-scoped beforeinput checks; skill-owner option availability/count/dedup/order; six styled Input/Textarea IME forwarding rows; the static Codex/OpenCode smart-key inventory; tab-map AST ratchet diagnostic fixtures; child-roster work-budget and retained-aggregate alarms; malformed persisted floating-cwd fallback/no-crash/empty exact-root checks; the unanswered-host empty-list discriminator; the direct invalidated-cache commit-false assertion; one redundant digit-keyup IME row; cached non-supported Claude title-generator rows; and the duplicate late naming-result singleton. These root broad commands lose those specific alarms without equivalent replacement. Distinct retained owner/state checks have their own bounded claims; the real scheduler still rejects stale response data, while the direct false-return alarm is retired. Audit3231 retires supported-host restore-pane key mapping, closed/open creation-sidebar toggle visibility, unrelated scope-error/null classification and quick-submit reveal/no-create checks. These broad commands lose those real narrow alarms; no replacement coverage is claimed. Audit3219 removes the synthetic Cmd+J extra-source suite; this broad command no longer checks its match/tie placement and selection, announced count, empty-query cap, or workspace hiding with retained recent tabs. No replacement coverage is claimed. Audit3209 composes approved sources3202/3206: deliberately retires seven authored/expanded cases in four whole suites without equivalent replacement. Work-item queries lose real GitHub/GitLab oversized ASCII secret-prefix empty-query and whitespace-before-trim refusal alarms; inputs share the imported size bound and exercise only its fast length branch, with no multibyte or actual provider/exposure guarantee. Skill sharing loses complete/partial managed-bundle and destination-ambiguity association checks plus three negative origin/path/scheme admission examples; these do not establish uploaded contents, arbitrary-URL fetching, authorization or execution. Retain exact originless-project direct-link fallback, cloud-delete confirmation, bundled-target repair/owner isolation and explicit Windows-host preference over stale WSL suites. Rejected3201 runtime-preference removal is excluded. No real cloud/network/host/disk, mobile or mixed-version execution validation is claimed. Audit3200 composes approved source3194: deliberately retires thirteen authored registrations/twenty-seven expanded cases in six whole automation host/list policy suites without equivalent replacement. Real RPC category/retryability and wrapped-timeout recognition, unscoped-failure/scoped-success health evidence precedence, exact-ID create selectors and per-run workspace omission, paired-web local/SSH/absent host catalog routing, incompatible/removed/unhydrated/offline execution health, runtime-before-nested-SSH recovery dispatch, and no-owned-focus/successor/foreign-list focus policy alarms are consciously lost. Retain exact20line orphan allow/refuse/precondition and exact90line cross-host same-ID search suites. No retry-timer/fence lifecycle, actual reconnect/network/write delivery, native focus, mobile/mixed-version runtime or disk persistence coverage is claimed. Audit3191 combines approved source3182/3187/3188: deliberately retires thirteen authored Vitest registrations and fifteen expanded cases, including five whole suites, without equivalent replacement. Attachment intake loses real portal/native-capture terminal interception and unowned-container refusal, immediate child-only committed availability/claim-ref negotiation and delivery, and direct-target over stable focused/background composer routing through disable/re-enable/remount and independent question focus. Exact destination/cache/draft and final-stat owner/workspace/File-release suites remain; they do not replace Surface recipient routing. Automation authoring loses destination runtime catalog membership, local/direct-SSH exclusion of paired-runtime repos, unknown-runtime empty catalog, logical project/host/setup/repo/path context payload, and missing/nonready setup refusal; these were genuine direct helper alarms, while exact schedule transformation, legacy schedule and setup-decision suites remain. Agent picker loses setup-chat/terminal/missing-installer/unsupported-or-unknown-host row projection samples and the ordinary unsearched menu variant; the entire original26-line resume recipe suite remains, including reported bypass versus default/absent permission modes, as does the exact search-result menu callback with its fixtures, model/effort commits and staged Arguments reopen outcome. Rejected predecessor3180 full recipe deletion is excluded. No actual native drag/cursor/focus/IME, upload bytes or disk/restart persistence, full automation save/scheduler/runtime transport, real resume-process flags/environment delivery, or native menu/rendered layout validation is claimed. Audit3178 combines source3169/3170/3175: deliberately retires eight authored units (six Vitest cases and two imperative custom relay scenarios), including two whole suites, without equivalent replacement. Voice Section loses per-model pending-delete isolation across interleaved A/B completion and the two-success refresh-call alarm; exact VoicePane delayed key-clear/newer enabled-toggle merge remains and does not replace row deletion coverage. Speech loses dedicated rating-scale/inclusive-ceiling, unsupported-versus-unmeasured, explicit/system-language precedence/locale alias, accuracy versus fast named/default/best-measured selection, and unmeasured/no-match examples; exact offered-user-pick versus retired-selection case and its fixture remain. Relay loses legacy ping-delivery count/liveness sampled before the silence deadline and grouped malformed Bearer/host-ID 401/429 routing checks; twelve real Worker/DurableObject/shipped-client scenarios remain, not equivalent replacement for those narrow alarms. Six prior speech cases are not all deleted: approved successor3175 keeps the original user-choice case. No actual credential/file persistence, native/GPU/engine/download delivery, production assignment policy or deployed-runtime validation is claimed by this reduction. Audit3165 combines source3160/3162: deliberately retires six authored/expanded cases across three whole suites without equivalent replacement. Launch/status losses: observed React-render pending/resuming coordination across settings and deferred offer read; stale-offer reread suppressing dialog reopen; held-local-chat recovery visibility with new-chat preferences off; disabled-local admission avoiding offer RPC despite an injected but unconsumed paired-tab fixture; and run-only lost-reply uncertainty reachability until direct viewed-run retirement. Launch probe does not prove arbitrary synchronous-store atomicity, the paired fixture is not remote runtime enrollment, and the status case directly marks viewed state rather than rendering the summary. Crew-hook losses: old-host method_not_found cache persists across party changes but is released by independently supplied connection generation/verified pairing status or pairing revision, with actual frame publication and teardown. These are real narrow coordination, admission, uncertainty and mixed-version cache alarms consciously lost. Exact web verified-runtime writer handoff guard remains; it does not replace those alarms or prove live host/native/mobile delivery. Audit3156 combines3147/3150/3152/3153/3154: deliberately retires39authored/40expanded native-chat recovery cases, eight whole suites and two orphan test-support files without equivalent replacement. Lost alarms: lost-reply unconfirmed reconciliation, skipped rows/counts and missed-frame repair, unknown/pending outcome and omitted-failure-list compatibility, uncertain history after dismissal, retry/refusal/dismiss lifecycle, hidden/consumed picker ownership, result-tree keyboard focus/disclosure and all-skipped retirement; unconfirmed-over-conflict guidance and failed-chat changes despite older host timestamps; nearest-listed ancestor/cyclic forest shape, descendant membership, host ordering/missing-host local fallback; skipped/readiness/admission counts, provisional skip/progress monotonicity, early per-chat verdicts with batch pending protection, older-host waiting, start-slot/delivery distinction, retry-over-failure and unknown-after-withdrawal attention; remote snooze/reconnect/reoffer, unseen mixed summary through open/close, watched completion retirement, new success beside old failure, failed-reread mixed-result preservation, filter/collapse completion resets, retry summary replacement and current-offer/history selection; cross-host workspace identity, rendered cyclic reachability, nested tri-state/toggle propagation, project eligibility isolation and collapse preserving selection. Exact fallback-list completion barrier, batched verdict/cleanup retention, stale-read versus dismissal publication race, and requested-but-never-rendered finished-run retirement remain; they do not replace retired alarms. Audit3146 combines source reviews3132/3133/3135/3138/3143: intentionally retire20authored/31expanded cases without equivalent replacement. Provider-session losses: structured-native terminal-resume exclusion, metadata-less completed identity, new-turn completion clearing, Pi provider-only/periodic/manual promotion, changed-transcript launch-config isolation, Pi/omp/prime-agent completed-session remote/manual-shutdown promotion, and quit/done precedence over heartbeat. Side-thread/question losses: finished-pane acquisition, hidden title/recap states, local/relay/relay-done conversation takeover with prompt/session/child resets, plain-message abandonment, compaction/session replacement and completion resets. Codex startup losses: incoming-owner cached child replacement, old-relay foreign live-session correction, completed foreign-root turn-fact permutations. Transcript losses: real temporary-JSONL partial sibling/final-child completion, unlabelled child attribution, compact cached replay preservation and100/1000completed-child roster retention/release. Compiler-ratchet losses: valid-line uncompiled-list parser grammar examples and injected-existence stale-path filtering; these did not exercise actual filesystem canonicalization or build exclusion. These are real lifecycle, ownership, replay, liveness and retention alarms, including recent#40246 regressions, deliberately lost. Retained conditional record replacement, clockless root/SSH owner isolation, persisted main-thread fork rejection, partial/final question-answer lifetime, cached-roster/missing-ID/live HTTP/durable startup boundaries and restarted-relay refusal/acceptance do not replace those losses. No native/SSH/WSL execution or equivalent coverage is claimed. Audit3128 scoped coverage reduction: Audit3121 removes VoiceDictationLanguageSetting.test.tsx (Spanish-to-es callback and unsupported-model Korean option presence) and voice-speech-model-rows.test.ts (provider/language-order/retired-on-disk list policy); these real narrow alarms are deliberately retired without replacement. VoiceSpeechModelSection per-model concurrent deletion remains unchanged. Audit3122 removes the direct absolute/parent-segment sparse-directory exception-type sample and the five-row IPC sparse-preset error-code/non-save table (two authored/six expanded cases). Those real typed-validation and IPC refusal/error-code alarms are deliberately retired. Keep both real symlink/junction floating-directory trust cases and the minimal RPC structured validation-reason serialization case. The RPC case does not replace IPC save/refusal behavior, typed normalization for both path inputs, actual Git sparse checkout or rendered localization. No equivalent replacement or fresh test/runtime/platform/remote/performance validation is claimed. Audit3124 removes ExperimentalPane.test.tsx (ordinary Pet switch callback), WorkspaceDirectorySetting.test.tsx (padded absolute saved-path normalization/no-write blur), and repository-search.perf.test.ts (navigation/selected-pane builder-call policy, fixture cardinality/nonempty entries and renamed project keyword inclusion). These real narrow alarms are retired without replacement; RepositoryPane.search.test.tsx search-to-sparse-editor request remains unchanged. Audit3129: resolver Windows case-insensitive and POSIX case-sensitive configured-env composition plus mocked-base launch-preflight Windows composition are intentionally no longer checked by the two deleted suites. No equivalent coverage claimed. Keep runtime-structured-agent-host-env.test.ts unchanged: configured Windows Claude-home account identity and host-account precedence remain checked. Audit3114 incorporates source3101: retire three structured Claude child-environment wrapper cases covering inherited stamp isolation/default and explicit entrypoint, Windows SDK-key canonicalization/default/duplicate-key order, and configured lookup/final environment/config-dir conjunction. Keep direct auth/session sanitation and Windows-versus-Linux overlay checks, actual executable lookup from supplied inherited PATH, native Windows child environment delivery, and stale option-mutation fencing. These are not equivalent replacements for the retired wrapper alarms. No fresh test/runtime, real login-shell probe, Claude SDK startup, remote/mixed-version, UI or performance result is claimed. Audit3114 incorporates source3105: retire 17 authored/20 expanded daemon launch-note cases, including the entire two-case SessionLaunchNote suite. Deliberately lose split-marker carry across same-token re-arm, stale-token retirement refusal, foreground tri-state and serial settlement, omitted-note/no-incarnation mixed-version policy, sticky retirement, first-incarnation/replacement launch preservation and held-launch precedence. Keep only the unchanged unresolved foreground-read race against a later finished attach. Supplied notes/foreground and runtime calls do not establish actual daemon/main restart, SSH, native Windows observation, mobile UI, equivalent replacement or fresh runtime/performance validation. Audit3114 incorporates source3109: retire six authored/35 expanded pricing cases: 21 accepted model-name examples, 10 unsupported/future-model fail-closed examples, malformed TTL clamp, unknown-model estimate refusal, flat-model long-context disregard and oversized long-context clamp. Keep mixed five-minute/one-hour write allocation and short/all-long/mixed long-context allocation with original fixed oracles. Real parser/refusal/bounds alarms are knowingly lost without equivalent replacement; retained tests do not validate provider rates, actual billing or request threshold classification. Preserve the archived usage-scan-append source-freeze receipt without transferring historical execution/performance credit. No fresh runtime result is claimed. Audit3108 source-only reduction (3094/3095/3100): retire 27 authored/30 expanded cases, including complete markdown view-state, file-preview link-open and CLI agent-server-route suites, without replacement. Deliberate losses include preview visibility/reference lifetime and same-path owners; SSH stat, directory/missing-target, explicit-null owner, nonmarkdown line/column, local URI routing, remote-to-client guard and same-file reuse; document-preview source-owner/folder/reuse routing, stable grant location and outside-workspace POSIX/Windows request projection; and verified remote CLI send/check refusal, suggested --on argv/copy, shell no-probe bypass, unverified-launch admission and older-peer refusal. Retain two markdown source-runtime/qualified-reveal alarms, one stale grant-rejection fence and two remote read/mutation evidence policies, with original callbacks. Final last-wins reveal did not prove transient cancellation; CLI prerequisite did not prove no real send, and envelope tests do not execute server refusal. No fresh runtime, rendered UI, actual file/SSH/paired transport, authorization, mixed-version or performance result is claimed. Audit3096 source-only reduction (3087/3088): retire 69 authored/76 expanded cases, including complete recovery-portals and reconnect-banner suites. Intentionally lose dead/default TUI replay, generated alternate-frame style composition, reset/mode/dimension and legacy missing-mode-boundary alarms, UI notice/action/reveal policies, and isolated recovery lifecycle variants, without equivalent replacement. Retained registrations and callbacks are unchanged; headless cells are not pixels, and no fresh runtime, host, SSH, WSL, rendered-app or performance result is claimed. Audit3086 source-only reduction (3079/3080/3081): intentionally retire 93 authored/100 expanded mock-boundary cases, including the complete spawn-errors and SSH reconnect overlay suites, without replacement. Retired alarms include spawn classification/ownership, reply ceilings and renderer-write failure recovery, disconnect/detach fencing branches, authority facts, and overlay retry/visibility wiring. Retained callbacks are unchanged; no fresh execution, real PTY/SSH, rendered UI, or performance result is claimed. Module layout SSH policy: Retire the multiplexer private-clock saturation registration, the writer saturation transition-count registration and the changed-source dated writer/backpressure receipt. Retained byte delivery, lane order, fairness, settlement and cancellation cases are unvalidated by that historical receipt. No equivalent replacement, new execution, measured performance, live SSH/WSL or cross-platform proof is claimed. The unchanged WSL protocol receipt retains only its original command scope. Historical prior account (preserved verbatim): Audit2432: The broad unit command loses the isolated BranchPicker open-change notification sample. Its unique true/false callback alarm is intentionally retired; reopening/status-refresh behavior was not exercised. No equivalent replacement or fresh validation of the reduced selector is claimed. Audit2425: The broad unit command loses the workspace-copy-status supplied readError forwarding sample. It did not exercise the branch-switch blocking promised by its title. This alarm is intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2417: The broad unit command loses two ordinary clean Git cherry-pick/revert success samples and two terminal startup foreground-read work-budget samples. These unique alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2412: The broad unit command loses the whole six-case fake-React-hook scroll-anchor suite, two generic draft-retention samples, a simple new-agent order sample, a real history-publication batching-count sample, an unmounted handoff abort/timer sample and three basic WSL preview/error samples. These alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2404: The broad unit command loses the standalone share-name lookup 503 propagation suite, initial deletion placement-kind sample, direct changed-mtime stale sample, first-pass rollback existence example and abandoned-preparation directory sample. These exact alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2397 review amendment: The broad unit command loses three standalone suites, two partial-case definitions and two URL table rows across package/download/placement tests. Keep initial wrong-port authorization, modified independent-copy digest refusal and abort-after-begin cancellation dispatch. The remaining alarms are deliberately retired; no equivalent complete replacement or fresh validation of the reduced selector is claimed. Audit2393 current-parent refresh2401: Remove the basic skill-install service alias sample and original public managed-remove receiptless refusal case. Preserve the upstream request ownership suite and transaction interruption coverage. No equivalent complete replacement or fresh validation of the reduced selector is claimed. Audit2389: The broad unit command loses the missing-preview suite, plain-global destination sample and prepublished-receipt recovery example. No equivalent replacement or fresh validation of the reduced selector is claimed. Audit2385: The broad unit command loses four authored walker/staging/protocol examples (six expanded cases); no equivalent replacement or fresh validation is claimed for the reduced suite. Audit2383: The unscoped Vitest command no longer includes the removed Antigravity catalogue suite; its exact provider-root/owner example has no equivalent replacement or fresh validation claim. Audit2377/2381: The unscoped Vitest command includes the reduced bundled-skill and native-discovery suites; the eight removed backup/legacy/catalogue/symlink/SSH-builder examples have no replacement-equivalence or fresh validation claim here. Audit2133 current-parent preparation: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2095 current-parent preparation2126: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2090 (sources2088/2089): Current reduced suites intentionally retire the alarms listed in knownGaps; prior dated execution and replacement claims do not validate changed source bytes or selectors. Historical prior account (preserved verbatim): Audit2086 (sources2082/2083): Current reduced suites intentionally retire the alarms listed in knownGaps; prior dated execution and replacement claims do not validate changed source bytes or selectors. Historical prior account (preserved verbatim): Audit2076 (sources2073/2074): Intentionally retire these low-value alarms without replacement: src/main/runtime/orca-runtime-tests/terminal-handles-part-02.spec.ts: recovers a moved SSH pane through the tab it now sits in, not the one its lease froze; reports a plain expired orphan; does not report a pane whose only recent lease was superseded; does not report a pane whose only recent lease had its relay id recycled; picks the eligible orphan over a superseded predecessor that matches first; collects the same tabs the per-tab reader reports, in one sweep of the leases; reports no candidate when no lease names any of the worktree tabs. src/main/runtime/orca-runtime-tests/runtime-availability.spec.ts: starts unavailable with no authoritative window; reports the configured Windows terminal shell on status; reports floating workspace availability from settings on status; polls floating tabs with targeted PTY liveness and no repo/provider inventory; hydrates persisted tabs when the store cannot report repos; advertises browser screencast only when a renderer window is available; routes mobile Codex reset consumption through the account mutation coordinator; maps a definite pre-provider rejection into an authoritative current snapshot. Existing unrelated evidenceRuns retain their original scope; unchanged dated receipt objects do not validate changed source bytes or reduced selectors. No fresh gate execution or historical import-closure equivalence is claimed. Frozen current literal-import graph reaches these changed test bytes; unresolved local and computed edges remain debt, and current reachability is not historical execution or equivalent replacement evidence. Historical prior account (preserved verbatim): Audit2070 (sources2068/2069): Intentionally retire these low-value alarms without replacement: src/main/runtime/orca-runtime.test.ts: ordinary registration cleanup removes only await import('./orca-runtime-tests/hooks-and-hosted-review.spec'). src/main/ssh/ssh-multiplexer-transport-writer.test.ts: reports saturated epochs and their drain boundary exactly once. src/main/runtime/orca-runtime-tests/worktree-removal-archive-hook-gate.spec.ts: removes and records the waiver when the failure is explicitly overridden; removes without an override record when the hook succeeds; removes when the hook is configured but not requested; removes when no archive hook is configured; holds a desktop removal in the same repo until this one is accepted; joins a desktop removal of the same worktree accepted while this one waited. src/main/runtime/orca-runtime-tests/worktree-ps-agent-row-dismissal.spec.ts: drops the row as soon as the user dismisses it, without waiting for the PTY to exit; tells paired clients to republish on the transition and on the dismissal; rejoins a row through its %s handle after pane ownership clears. src/main/runtime/orca-runtime-tests/hooks-and-hosted-review.spec.ts: reports an error when the SSH filesystem provider is unavailable; reports an SSH orca.yaml as an error without reading any filesystem; reports ok for a local repo hook check; reads SSH issue commands as absent and drops writes without touching any filesystem; allows host integration slug helpers for SSH repos through provider-aware GitHub clients; routes runtime GitHub repo identity helpers through the selected WSL project runtime; routes runtime GitHub issue and work-item actions through the selected WSL project runtime; pins explicit origin preference on runtime open-by-number work item lookups; forwards check-details cancellation without local Git overrides. Existing unrelated evidenceRuns retain their original scope; unchanged dated receipt objects do not validate changed source bytes or reduced selectors. No fresh gate execution or historical import-closure equivalence is claimed. Frozen current literal-import graph reaches these changed test bytes; unresolved local and computed edges remain debt, and current reachability is not historical execution or equivalent replacement evidence. The historical receipt/currentCommand selecting src/main/ssh/ssh-multiplexer-transport-writer.test.ts remains historical and is not a passing result for the reduced current command. Historical prior account (preserved verbatim): Audit1931 (sources1928/1929): Delete the complete tail-wait memo suite: its sole current authored callback checks supplied fromTail/blocked field values. Retire all three broader memoization/equivalence/eviction assertion aliases; they are not backed by retained source callbacks. No scan-work budget, sustained output, physical terminal or resource measurement is assigned to this removed test. Preserve meaningful remaining selectors/assertions and unchanged dated receipts within their original scope. Reduced selectors have no fresh gate execution evidence in this metadata packet. No equivalent replacement, physical watcher/PTY/provider, live SSH/remote/mobile, rendered, cross-platform, soak or measured-budget result is claimed. Historical prior account (preserved verbatim): Audit1674 removes low-value test projections, mock wiring, private-state assertions, inventories and duplicate examples without equivalent replacement coverage. Per-source reviews record retained public behavior and refusal boundaries with injected/native/remote limits. Affected historical receipts are retired; gates without active current evidence are downgraded. Historical scope before this audit: Audit1634 removes low-value IPC, filesystem and runtime projections, argument inventories and duplicate examples without equivalent replacement coverage. Per-source reviews record retained cancellation, ownership, authorization, filesystem and SQLite boundaries with injected/native/remote limits. Affected historical receipts are retired; gates without active current evidence are downgraded. Historical scope before this audit: Local macOS evidence covers main-process pending-output and projection-admission caps, saturated-tail wait detection, direct-SSH source retention/accounting, always-on V1 negotiation with legacy peer fallback, exact provider-generation pause ownership, renderer exit/data ordering, decoder input bounds, bounded reconnect scheduling, and WSL stdio transport settlement through deterministic unit contracts. A joined main/runtime oracle exercises renderer-sourced headed semantics and headless-model snapshot semantics without launching a live paired server. Separately, a macOS-hosted Docker OpenSSH run exercises only the deployed Linux relay and direct SSH provider with an exact 256 KiB source-credit plateau, concurrent PTY typing, fixed-size filesystem frames, Git churn, and owner-lease reconnect. Neither deterministic topology labels nor Docker SSH constitute live headed desktop, headless orca serve, or physical WSL evidence; local/daemon, prior-version daemons, Windows named pipes/ConPTY, folder workspaces, and mixed-version clients also remain uncovered. Audit1312 removes low-value imported specs from aggregate test drivers; old whole-driver execution receipts are archived. Retained registrations are unchanged. No equivalent replacement coverage is claimed. Audit1383: src/main/runtime/orca-runtime-tests/worktree-native-chat-setup.spec.ts reduced. Lose command-list/receipt/default/background activation matrices whose provider spawn returns canned IDs. Retained test proves actual tab allocation separation, not terminal startup. No equivalent replacement coverage is claimed. Existing exact unaffected receipts and their platform/provider/budget claims remain scoped to unchanged selectors. Changed optional selectors have no new execution result. Audit1401: src/main/runtime/orca-runtime-tests/mobile-session-tabs-duplicate-pty-repair.spec.ts removed. Loses listing-on-already-repaired-data alarm; it never established runtime repair invocation. src/main/runtime/orca-runtime-tests/mobile-session-tabs-split-agent-tab.spec.ts removed. Loses actual mobile split sibling shell versus recorded-agent resume command alarms; no equivalent coverage asserted. src/main/runtime/orca-runtime-tests/worktree-native-chat-setup.spec.ts removed. Loses separate setup/startup tab result in that manually assembled path. src/main/runtime/orca-runtime.test.ts reduced. Driver registration/import of a whole-deleted selected spec is removed; directly authored cases remain unchanged. No extra authored removal credit. No equivalent replacement coverage is claimed. Existing exact unaffected receipts remain unchanged and apply only to their unchanged selectors. Changed optional selectors have no new execution result.", + "coverageNotes": "Audit 3292 combines adopted 3285/3287/3289/3293 removals: 40 authored declarations and 47 expanded scenarios, including whole frame-editor-view, ambiguous remote-delete-refusal, unverifiable-host subscription and editor-close cleanup suites. The previously reviewed dock-badge suite was already removed upstream in PR 40895 and receives zero new removal credit. Intentionally retired alarms include background browser selection and last-tab landing; main startup fallback, SSH project cleanup/survivor routing, exact-PR contradiction/saved-push positives, replay/sidecar rollback and wrapped remote error normalization; records/snapshot missing-diff hydration, ambiguous folder-owner delete refusal, focus no-op notifications, nested editor context-only cache check, pending broadcast-first status and ordinary four-confirmation aggregation; preview-source frontmatter pruning, approved local/runtime agent dispatch, non-GitHub legacy PR cache invalidation, stale merged-head transient-error fallback, empty-queue immediate query reply and unverified-to-concrete preflight risk. Additional intentionally retired alarms are injected host subscription/unsubscribe counts, synthetic editor reveal/draft/fallback/scoped close, ambiguous unread refusals and hidden mark/read roundtrip, immediate connect backoff/noError, positive mirrored evidence-clock renewal, supplied VM failure/success projections and git-local/folder-SSH wake permutations. Remaining temporal/ownership cases are narrower; no equivalent replacement or fresh execution is claimed. Audit 3283 removes 20 authored declarations and 31 expanded scenarios, including two whole suites. Retired alarms cover PR refresh-state pruning, shared runtime subscription cleanup and store isolation, language content-change routing and older completion ownership, ordinary panel retry-timer cleanup and pending loading, four hosted-review lifetime permutations, mocked terminal creation error/order wiring, five sleep-inventory variants with pending-frame-only assertions, palette fallback/composite highlights, Windows/UNC encoded-editor input rows, mixed-repository partial failure counts, title setters and generated-title bypass/replacement, five window-close coordinator delegation/guard/finally branches, and ambiguous-old-record frame reveal. These regression checks are intentionally lost under the test-value audit; retained cases are not equivalent replacements. Prior coverage notes and receipts remain historical. Audit 3273 removes 14 authored declarations and 19 expanded scenarios across four whole suites and eight partial suites. Retired alarms cover saved-local cancellation/layout ownership, ambiguous-owner warning reset, folder attachment routing, VM false-capability bypass, abandoned reveal warmup cleanup and viewport claim deduplication/rearming, quiet unrelated remote-removal refusal, startup-command one-shot consumption, repository/floating recovery-ledger rows, fake-React pinned-scroll intent, split-ratio state identity/subscriber suppression and fractional change, cross-host project-group join refusal, three PR request-lifetime permutations, upstream-status preservation on error, and unresolved Git-owner refusal. These regression checks are intentionally lost under the test-value audit; retained scenarios are not equivalent replacements. Historical coverage receipts remain historical, including gate35 subscriber claims. Audit 3256 removes these specific alarms from the broad root unit commands: skill dialog active-share selection, close and pending-share handoff; simple keyed-record deletion; marker live-region insertion, simple landing and nine baseline policy examples; General search/control navigation inventory; orphan-count cache bootstrap; seven Codex code classifications and HTTP 429 warning mapping; two skill unread-root verdict examples; peer-mail payload and conversation-ID rejection; and the GitHub organization TABLE text-field optimistic rollback/failed-envelope example. These include real behaviors; retained tests do not provide equivalent coverage for every removed scenario. Mobile losses are recorded separately and are not coverage of these root commands. Audit3246 retires NewRowsMarker reveal/no-repeat and pane-scoped beforeinput checks; skill-owner option availability/count/dedup/order; six styled Input/Textarea IME forwarding rows; the static Codex/OpenCode smart-key inventory; tab-map AST ratchet diagnostic fixtures; child-roster work-budget and retained-aggregate alarms; malformed persisted floating-cwd fallback/no-crash/empty exact-root checks; the unanswered-host empty-list discriminator; the direct invalidated-cache commit-false assertion; one redundant digit-keyup IME row; cached non-supported Claude title-generator rows; and the duplicate late naming-result singleton. These root broad commands lose those specific alarms without equivalent replacement. Distinct retained owner/state checks have their own bounded claims; the real scheduler still rejects stale response data, while the direct false-return alarm is retired. Audit3231 retires supported-host restore-pane key mapping, closed/open creation-sidebar toggle visibility, unrelated scope-error/null classification and quick-submit reveal/no-create checks. These broad commands lose those real narrow alarms; no replacement coverage is claimed. Audit3219 removes the synthetic Cmd+J extra-source suite; this broad command no longer checks its match/tie placement and selection, announced count, empty-query cap, or workspace hiding with retained recent tabs. No replacement coverage is claimed. Audit3209 composes approved sources3202/3206: deliberately retires seven authored/expanded cases in four whole suites without equivalent replacement. Work-item queries lose real GitHub/GitLab oversized ASCII secret-prefix empty-query and whitespace-before-trim refusal alarms; inputs share the imported size bound and exercise only its fast length branch, with no multibyte or actual provider/exposure guarantee. Skill sharing loses complete/partial managed-bundle and destination-ambiguity association checks plus three negative origin/path/scheme admission examples; these do not establish uploaded contents, arbitrary-URL fetching, authorization or execution. Retain exact originless-project direct-link fallback, cloud-delete confirmation, bundled-target repair/owner isolation and explicit Windows-host preference over stale WSL suites. Rejected3201 runtime-preference removal is excluded. No real cloud/network/host/disk, mobile or mixed-version execution validation is claimed. Audit3200 composes approved source3194: deliberately retires thirteen authored registrations/twenty-seven expanded cases in six whole automation host/list policy suites without equivalent replacement. Real RPC category/retryability and wrapped-timeout recognition, unscoped-failure/scoped-success health evidence precedence, exact-ID create selectors and per-run workspace omission, paired-web local/SSH/absent host catalog routing, incompatible/removed/unhydrated/offline execution health, runtime-before-nested-SSH recovery dispatch, and no-owned-focus/successor/foreign-list focus policy alarms are consciously lost. Retain exact20line orphan allow/refuse/precondition and exact90line cross-host same-ID search suites. No retry-timer/fence lifecycle, actual reconnect/network/write delivery, native focus, mobile/mixed-version runtime or disk persistence coverage is claimed. Audit3191 combines approved source3182/3187/3188: deliberately retires thirteen authored Vitest registrations and fifteen expanded cases, including five whole suites, without equivalent replacement. Attachment intake loses real portal/native-capture terminal interception and unowned-container refusal, immediate child-only committed availability/claim-ref negotiation and delivery, and direct-target over stable focused/background composer routing through disable/re-enable/remount and independent question focus. Exact destination/cache/draft and final-stat owner/workspace/File-release suites remain; they do not replace Surface recipient routing. Automation authoring loses destination runtime catalog membership, local/direct-SSH exclusion of paired-runtime repos, unknown-runtime empty catalog, logical project/host/setup/repo/path context payload, and missing/nonready setup refusal; these were genuine direct helper alarms, while exact schedule transformation, legacy schedule and setup-decision suites remain. Agent picker loses setup-chat/terminal/missing-installer/unsupported-or-unknown-host row projection samples and the ordinary unsearched menu variant; the entire original26-line resume recipe suite remains, including reported bypass versus default/absent permission modes, as does the exact search-result menu callback with its fixtures, model/effort commits and staged Arguments reopen outcome. Rejected predecessor3180 full recipe deletion is excluded. No actual native drag/cursor/focus/IME, upload bytes or disk/restart persistence, full automation save/scheduler/runtime transport, real resume-process flags/environment delivery, or native menu/rendered layout validation is claimed. Audit3178 combines source3169/3170/3175: deliberately retires eight authored units (six Vitest cases and two imperative custom relay scenarios), including two whole suites, without equivalent replacement. Voice Section loses per-model pending-delete isolation across interleaved A/B completion and the two-success refresh-call alarm; exact VoicePane delayed key-clear/newer enabled-toggle merge remains and does not replace row deletion coverage. Speech loses dedicated rating-scale/inclusive-ceiling, unsupported-versus-unmeasured, explicit/system-language precedence/locale alias, accuracy versus fast named/default/best-measured selection, and unmeasured/no-match examples; exact offered-user-pick versus retired-selection case and its fixture remain. Relay loses legacy ping-delivery count/liveness sampled before the silence deadline and grouped malformed Bearer/host-ID 401/429 routing checks; twelve real Worker/DurableObject/shipped-client scenarios remain, not equivalent replacement for those narrow alarms. Six prior speech cases are not all deleted: approved successor3175 keeps the original user-choice case. No actual credential/file persistence, native/GPU/engine/download delivery, production assignment policy or deployed-runtime validation is claimed by this reduction. Audit3165 combines source3160/3162: deliberately retires six authored/expanded cases across three whole suites without equivalent replacement. Launch/status losses: observed React-render pending/resuming coordination across settings and deferred offer read; stale-offer reread suppressing dialog reopen; held-local-chat recovery visibility with new-chat preferences off; disabled-local admission avoiding offer RPC despite an injected but unconsumed paired-tab fixture; and run-only lost-reply uncertainty reachability until direct viewed-run retirement. Launch probe does not prove arbitrary synchronous-store atomicity, the paired fixture is not remote runtime enrollment, and the status case directly marks viewed state rather than rendering the summary. Crew-hook losses: old-host method_not_found cache persists across party changes but is released by independently supplied connection generation/verified pairing status or pairing revision, with actual frame publication and teardown. These are real narrow coordination, admission, uncertainty and mixed-version cache alarms consciously lost. Exact web verified-runtime writer handoff guard remains; it does not replace those alarms or prove live host/native/mobile delivery. Audit3156 combines3147/3150/3152/3153/3154: deliberately retires39authored/40expanded native-chat recovery cases, eight whole suites and two orphan test-support files without equivalent replacement. Lost alarms: lost-reply unconfirmed reconciliation, skipped rows/counts and missed-frame repair, unknown/pending outcome and omitted-failure-list compatibility, uncertain history after dismissal, retry/refusal/dismiss lifecycle, hidden/consumed picker ownership, result-tree keyboard focus/disclosure and all-skipped retirement; unconfirmed-over-conflict guidance and failed-chat changes despite older host timestamps; nearest-listed ancestor/cyclic forest shape, descendant membership, host ordering/missing-host local fallback; skipped/readiness/admission counts, provisional skip/progress monotonicity, early per-chat verdicts with batch pending protection, older-host waiting, start-slot/delivery distinction, retry-over-failure and unknown-after-withdrawal attention; remote snooze/reconnect/reoffer, unseen mixed summary through open/close, watched completion retirement, new success beside old failure, failed-reread mixed-result preservation, filter/collapse completion resets, retry summary replacement and current-offer/history selection; cross-host workspace identity, rendered cyclic reachability, nested tri-state/toggle propagation, project eligibility isolation and collapse preserving selection. Exact fallback-list completion barrier, batched verdict/cleanup retention, stale-read versus dismissal publication race, and requested-but-never-rendered finished-run retirement remain; they do not replace retired alarms. Audit3146 combines source reviews3132/3133/3135/3138/3143: intentionally retire20authored/31expanded cases without equivalent replacement. Provider-session losses: structured-native terminal-resume exclusion, metadata-less completed identity, new-turn completion clearing, Pi provider-only/periodic/manual promotion, changed-transcript launch-config isolation, Pi/omp/prime-agent completed-session remote/manual-shutdown promotion, and quit/done precedence over heartbeat. Side-thread/question losses: finished-pane acquisition, hidden title/recap states, local/relay/relay-done conversation takeover with prompt/session/child resets, plain-message abandonment, compaction/session replacement and completion resets. Codex startup losses: incoming-owner cached child replacement, old-relay foreign live-session correction, completed foreign-root turn-fact permutations. Transcript losses: real temporary-JSONL partial sibling/final-child completion, unlabelled child attribution, compact cached replay preservation and100/1000completed-child roster retention/release. Compiler-ratchet losses: valid-line uncompiled-list parser grammar examples and injected-existence stale-path filtering; these did not exercise actual filesystem canonicalization or build exclusion. These are real lifecycle, ownership, replay, liveness and retention alarms, including recent#40246 regressions, deliberately lost. Retained conditional record replacement, clockless root/SSH owner isolation, persisted main-thread fork rejection, partial/final question-answer lifetime, cached-roster/missing-ID/live HTTP/durable startup boundaries and restarted-relay refusal/acceptance do not replace those losses. No native/SSH/WSL execution or equivalent coverage is claimed. Audit3128 scoped coverage reduction: Audit3121 removes VoiceDictationLanguageSetting.test.tsx (Spanish-to-es callback and unsupported-model Korean option presence) and voice-speech-model-rows.test.ts (provider/language-order/retired-on-disk list policy); these real narrow alarms are deliberately retired without replacement. VoiceSpeechModelSection per-model concurrent deletion remains unchanged. Audit3122 removes the direct absolute/parent-segment sparse-directory exception-type sample and the five-row IPC sparse-preset error-code/non-save table (two authored/six expanded cases). Those real typed-validation and IPC refusal/error-code alarms are deliberately retired. Keep both real symlink/junction floating-directory trust cases and the minimal RPC structured validation-reason serialization case. The RPC case does not replace IPC save/refusal behavior, typed normalization for both path inputs, actual Git sparse checkout or rendered localization. No equivalent replacement or fresh test/runtime/platform/remote/performance validation is claimed. Audit3124 removes ExperimentalPane.test.tsx (ordinary Pet switch callback), WorkspaceDirectorySetting.test.tsx (padded absolute saved-path normalization/no-write blur), and repository-search.perf.test.ts (navigation/selected-pane builder-call policy, fixture cardinality/nonempty entries and renamed project keyword inclusion). These real narrow alarms are retired without replacement; RepositoryPane.search.test.tsx search-to-sparse-editor request remains unchanged. Audit3129: resolver Windows case-insensitive and POSIX case-sensitive configured-env composition plus mocked-base launch-preflight Windows composition are intentionally no longer checked by the two deleted suites. No equivalent coverage claimed. Keep runtime-structured-agent-host-env.test.ts unchanged: configured Windows Claude-home account identity and host-account precedence remain checked. Audit3114 incorporates source3101: retire three structured Claude child-environment wrapper cases covering inherited stamp isolation/default and explicit entrypoint, Windows SDK-key canonicalization/default/duplicate-key order, and configured lookup/final environment/config-dir conjunction. Keep direct auth/session sanitation and Windows-versus-Linux overlay checks, actual executable lookup from supplied inherited PATH, native Windows child environment delivery, and stale option-mutation fencing. These are not equivalent replacements for the retired wrapper alarms. No fresh test/runtime, real login-shell probe, Claude SDK startup, remote/mixed-version, UI or performance result is claimed. Audit3114 incorporates source3105: retire 17 authored/20 expanded daemon launch-note cases, including the entire two-case SessionLaunchNote suite. Deliberately lose split-marker carry across same-token re-arm, stale-token retirement refusal, foreground tri-state and serial settlement, omitted-note/no-incarnation mixed-version policy, sticky retirement, first-incarnation/replacement launch preservation and held-launch precedence. Keep only the unchanged unresolved foreground-read race against a later finished attach. Supplied notes/foreground and runtime calls do not establish actual daemon/main restart, SSH, native Windows observation, mobile UI, equivalent replacement or fresh runtime/performance validation. Audit3114 incorporates source3109: retire six authored/35 expanded pricing cases: 21 accepted model-name examples, 10 unsupported/future-model fail-closed examples, malformed TTL clamp, unknown-model estimate refusal, flat-model long-context disregard and oversized long-context clamp. Keep mixed five-minute/one-hour write allocation and short/all-long/mixed long-context allocation with original fixed oracles. Real parser/refusal/bounds alarms are knowingly lost without equivalent replacement; retained tests do not validate provider rates, actual billing or request threshold classification. Preserve the archived usage-scan-append source-freeze receipt without transferring historical execution/performance credit. No fresh runtime result is claimed. Audit3108 source-only reduction (3094/3095/3100): retire 27 authored/30 expanded cases, including complete markdown view-state, file-preview link-open and CLI agent-server-route suites, without replacement. Deliberate losses include preview visibility/reference lifetime and same-path owners; SSH stat, directory/missing-target, explicit-null owner, nonmarkdown line/column, local URI routing, remote-to-client guard and same-file reuse; document-preview source-owner/folder/reuse routing, stable grant location and outside-workspace POSIX/Windows request projection; and verified remote CLI send/check refusal, suggested --on argv/copy, shell no-probe bypass, unverified-launch admission and older-peer refusal. Retain two markdown source-runtime/qualified-reveal alarms, one stale grant-rejection fence and two remote read/mutation evidence policies, with original callbacks. Final last-wins reveal did not prove transient cancellation; CLI prerequisite did not prove no real send, and envelope tests do not execute server refusal. No fresh runtime, rendered UI, actual file/SSH/paired transport, authorization, mixed-version or performance result is claimed. Audit3096 source-only reduction (3087/3088): retire 69 authored/76 expanded cases, including complete recovery-portals and reconnect-banner suites. Intentionally lose dead/default TUI replay, generated alternate-frame style composition, reset/mode/dimension and legacy missing-mode-boundary alarms, UI notice/action/reveal policies, and isolated recovery lifecycle variants, without equivalent replacement. Retained registrations and callbacks are unchanged; headless cells are not pixels, and no fresh runtime, host, SSH, WSL, rendered-app or performance result is claimed. Audit3086 source-only reduction (3079/3080/3081): intentionally retire 93 authored/100 expanded mock-boundary cases, including the complete spawn-errors and SSH reconnect overlay suites, without replacement. Retired alarms include spawn classification/ownership, reply ceilings and renderer-write failure recovery, disconnect/detach fencing branches, authority facts, and overlay retry/visibility wiring. Retained callbacks are unchanged; no fresh execution, real PTY/SSH, rendered UI, or performance result is claimed. Module layout SSH policy: Retire the multiplexer private-clock saturation registration, the writer saturation transition-count registration and the changed-source dated writer/backpressure receipt. Retained byte delivery, lane order, fairness, settlement and cancellation cases are unvalidated by that historical receipt. No equivalent replacement, new execution, measured performance, live SSH/WSL or cross-platform proof is claimed. The unchanged WSL protocol receipt retains only its original command scope. Historical prior account (preserved verbatim): Audit2432: The broad unit command loses the isolated BranchPicker open-change notification sample. Its unique true/false callback alarm is intentionally retired; reopening/status-refresh behavior was not exercised. No equivalent replacement or fresh validation of the reduced selector is claimed. Audit2425: The broad unit command loses the workspace-copy-status supplied readError forwarding sample. It did not exercise the branch-switch blocking promised by its title. This alarm is intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2417: The broad unit command loses two ordinary clean Git cherry-pick/revert success samples and two terminal startup foreground-read work-budget samples. These unique alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2412: The broad unit command loses the whole six-case fake-React-hook scroll-anchor suite, two generic draft-retention samples, a simple new-agent order sample, a real history-publication batching-count sample, an unmounted handoff abort/timer sample and three basic WSL preview/error samples. These alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2404: The broad unit command loses the standalone share-name lookup 503 propagation suite, initial deletion placement-kind sample, direct changed-mtime stale sample, first-pass rollback existence example and abandoned-preparation directory sample. These exact alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2397 review amendment: The broad unit command loses three standalone suites, two partial-case definitions and two URL table rows across package/download/placement tests. Keep initial wrong-port authorization, modified independent-copy digest refusal and abort-after-begin cancellation dispatch. The remaining alarms are deliberately retired; no equivalent complete replacement or fresh validation of the reduced selector is claimed. Audit2393 current-parent refresh2401: Remove the basic skill-install service alias sample and original public managed-remove receiptless refusal case. Preserve the upstream request ownership suite and transaction interruption coverage. No equivalent complete replacement or fresh validation of the reduced selector is claimed. Audit2389: The broad unit command loses the missing-preview suite, plain-global destination sample and prepublished-receipt recovery example. No equivalent replacement or fresh validation of the reduced selector is claimed. Audit2385: The broad unit command loses four authored walker/staging/protocol examples (six expanded cases); no equivalent replacement or fresh validation is claimed for the reduced suite. Audit2383: The unscoped Vitest command no longer includes the removed Antigravity catalogue suite; its exact provider-root/owner example has no equivalent replacement or fresh validation claim. Audit2377/2381: The unscoped Vitest command includes the reduced bundled-skill and native-discovery suites; the eight removed backup/legacy/catalogue/symlink/SSH-builder examples have no replacement-equivalence or fresh validation claim here. Audit2133 current-parent preparation: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2095 current-parent preparation2126: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2090 (sources2088/2089): Current reduced suites intentionally retire the alarms listed in knownGaps; prior dated execution and replacement claims do not validate changed source bytes or selectors. Historical prior account (preserved verbatim): Audit2086 (sources2082/2083): Current reduced suites intentionally retire the alarms listed in knownGaps; prior dated execution and replacement claims do not validate changed source bytes or selectors. Historical prior account (preserved verbatim): Audit2076 (sources2073/2074): Intentionally retire these low-value alarms without replacement: src/main/runtime/orca-runtime-tests/terminal-handles-part-02.spec.ts: recovers a moved SSH pane through the tab it now sits in, not the one its lease froze; reports a plain expired orphan; does not report a pane whose only recent lease was superseded; does not report a pane whose only recent lease had its relay id recycled; picks the eligible orphan over a superseded predecessor that matches first; collects the same tabs the per-tab reader reports, in one sweep of the leases; reports no candidate when no lease names any of the worktree tabs. src/main/runtime/orca-runtime-tests/runtime-availability.spec.ts: starts unavailable with no authoritative window; reports the configured Windows terminal shell on status; reports floating workspace availability from settings on status; polls floating tabs with targeted PTY liveness and no repo/provider inventory; hydrates persisted tabs when the store cannot report repos; advertises browser screencast only when a renderer window is available; routes mobile Codex reset consumption through the account mutation coordinator; maps a definite pre-provider rejection into an authoritative current snapshot. Existing unrelated evidenceRuns retain their original scope; unchanged dated receipt objects do not validate changed source bytes or reduced selectors. No fresh gate execution or historical import-closure equivalence is claimed. Frozen current literal-import graph reaches these changed test bytes; unresolved local and computed edges remain debt, and current reachability is not historical execution or equivalent replacement evidence. Historical prior account (preserved verbatim): Audit2070 (sources2068/2069): Intentionally retire these low-value alarms without replacement: src/main/runtime/orca-runtime.test.ts: ordinary registration cleanup removes only await import('./orca-runtime-tests/hooks-and-hosted-review.spec'). src/main/ssh/ssh-multiplexer-transport-writer.test.ts: reports saturated epochs and their drain boundary exactly once. src/main/runtime/orca-runtime-tests/worktree-removal-archive-hook-gate.spec.ts: removes and records the waiver when the failure is explicitly overridden; removes without an override record when the hook succeeds; removes when the hook is configured but not requested; removes when no archive hook is configured; holds a desktop removal in the same repo until this one is accepted; joins a desktop removal of the same worktree accepted while this one waited. src/main/runtime/orca-runtime-tests/worktree-ps-agent-row-dismissal.spec.ts: drops the row as soon as the user dismisses it, without waiting for the PTY to exit; tells paired clients to republish on the transition and on the dismissal; rejoins a row through its %s handle after pane ownership clears. src/main/runtime/orca-runtime-tests/hooks-and-hosted-review.spec.ts: reports an error when the SSH filesystem provider is unavailable; reports an SSH orca.yaml as an error without reading any filesystem; reports ok for a local repo hook check; reads SSH issue commands as absent and drops writes without touching any filesystem; allows host integration slug helpers for SSH repos through provider-aware GitHub clients; routes runtime GitHub repo identity helpers through the selected WSL project runtime; routes runtime GitHub issue and work-item actions through the selected WSL project runtime; pins explicit origin preference on runtime open-by-number work item lookups; forwards check-details cancellation without local Git overrides. Existing unrelated evidenceRuns retain their original scope; unchanged dated receipt objects do not validate changed source bytes or reduced selectors. No fresh gate execution or historical import-closure equivalence is claimed. Frozen current literal-import graph reaches these changed test bytes; unresolved local and computed edges remain debt, and current reachability is not historical execution or equivalent replacement evidence. The historical receipt/currentCommand selecting src/main/ssh/ssh-multiplexer-transport-writer.test.ts remains historical and is not a passing result for the reduced current command. Historical prior account (preserved verbatim): Audit1931 (sources1928/1929): Delete the complete tail-wait memo suite: its sole current authored callback checks supplied fromTail/blocked field values. Retire all three broader memoization/equivalence/eviction assertion aliases; they are not backed by retained source callbacks. No scan-work budget, sustained output, physical terminal or resource measurement is assigned to this removed test. Preserve meaningful remaining selectors/assertions and unchanged dated receipts within their original scope. Reduced selectors have no fresh gate execution evidence in this metadata packet. No equivalent replacement, physical watcher/PTY/provider, live SSH/remote/mobile, rendered, cross-platform, soak or measured-budget result is claimed. Historical prior account (preserved verbatim): Audit1674 removes low-value test projections, mock wiring, private-state assertions, inventories and duplicate examples without equivalent replacement coverage. Per-source reviews record retained public behavior and refusal boundaries with injected/native/remote limits. Affected historical receipts are retired; gates without active current evidence are downgraded. Historical scope before this audit: Audit1634 removes low-value IPC, filesystem and runtime projections, argument inventories and duplicate examples without equivalent replacement coverage. Per-source reviews record retained cancellation, ownership, authorization, filesystem and SQLite boundaries with injected/native/remote limits. Affected historical receipts are retired; gates without active current evidence are downgraded. Historical scope before this audit: Local macOS evidence covers main-process pending-output and projection-admission caps, saturated-tail wait detection, direct-SSH source retention/accounting, always-on V1 negotiation with legacy peer fallback, exact provider-generation pause ownership, renderer exit/data ordering, decoder input bounds, bounded reconnect scheduling, and WSL stdio transport settlement through deterministic unit contracts. A joined main/runtime oracle exercises renderer-sourced headed semantics and headless-model snapshot semantics without launching a live paired server. Separately, a macOS-hosted Docker OpenSSH run exercises only the deployed Linux relay and direct SSH provider with an exact 256 KiB source-credit plateau, concurrent PTY typing, fixed-size filesystem frames, Git churn, and owner-lease reconnect. Neither deterministic topology labels nor Docker SSH constitute live headed desktop, headless orca serve, or physical WSL evidence; local/daemon, prior-version daemons, Windows named pipes/ConPTY, folder workspaces, and mixed-version clients also remain uncovered. Audit1312 removes low-value imported specs from aggregate test drivers; old whole-driver execution receipts are archived. Retained registrations are unchanged. No equivalent replacement coverage is claimed. Audit1383: src/main/runtime/orca-runtime-tests/worktree-native-chat-setup.spec.ts reduced. Lose command-list/receipt/default/background activation matrices whose provider spawn returns canned IDs. Retained test proves actual tab allocation separation, not terminal startup. No equivalent replacement coverage is claimed. Existing exact unaffected receipts and their platform/provider/budget claims remain scoped to unchanged selectors. Changed optional selectors have no new execution result. Audit1401: src/main/runtime/orca-runtime-tests/mobile-session-tabs-duplicate-pty-repair.spec.ts removed. Loses listing-on-already-repaired-data alarm; it never established runtime repair invocation. src/main/runtime/orca-runtime-tests/mobile-session-tabs-split-agent-tab.spec.ts removed. Loses actual mobile split sibling shell versus recorded-agent resume command alarms; no equivalent coverage asserted. src/main/runtime/orca-runtime-tests/worktree-native-chat-setup.spec.ts removed. Loses separate setup/startup tab result in that manually assembled path. src/main/runtime/orca-runtime.test.ts reduced. Driver registration/import of a whole-deleted selected spec is removed; directly authored cases remain unchanged. No extra authored removal credit. No equivalent replacement coverage is claimed. Existing exact unaffected receipts remain unchanged and apply only to their unchanged selectors. Changed optional selectors have no new execution result.", "motivatingLinks": [ "https://github.com/stablyai/orca/pull/6836", "https://github.com/stablyai/orca/pull/6858", @@ -9214,7 +9217,7 @@ "https://github.com/stablyai/orca/pull/7054" ], "invariant": "High-volume terminal output must stay bounded across daemon socket writes, SSH relay writer/decoder/source retention/reconnect, main model and projection admission, runtime metadata, detectors, and tail checks, main-to-renderer in-flight bytes, renderer scheduler queues, and hidden-output restore without starving focused input. Every new SSH session offers V1 and every same-build relay supports it; legacy delivery is reachable only when capability negotiation proves the peer cannot use V1. Negotiated SSH spans remain exact and contiguous through activation, exit, cancellation, recovery, desktop projection, and required remote replacement; provisional activation data cannot project, reconnect may release it only into the exact attempt's private recovery quarantine after contract validation, and exit seals that quarantine against later same-token frames until ordered admission or exact cancellation proof. Reconnect checkpoint capture freezes exact provider-generation/PTy admission, cancels queued old work, and waits for the running raw completion before exposing its accepted checkpoint; timeout or failure detaches only that PTy's old model, makes the checkpoint unavailable, and releases the bounded fence without closing the shared provider, while the same failure outside an active exact migration remains generation-fatal and overlapping reconnects preserve any earlier outstanding fence. Pending renderer projection IDs are capped and compacted across split remainders, exit preparation owns its renderer fence through finalization, exit-time cancellation transfers published projections before proof commit, generation close fences late proof while draining exact projection waiters, closed-generation identity compacts without weakening stale rejection, canceled source-delivery retirement retains at most one ordered token per PTY, and pause/resume targets only the exact provider generation. Additional subscribers cannot stall the owner, while the required legacy primary retains backpressure.", - "oracle": "Audit 3283 removes 20 authored declarations and 31 expanded scenarios, including two whole suites. Retired alarms cover PR refresh-state pruning, shared runtime subscription cleanup and store isolation, language content-change routing and older completion ownership, ordinary panel retry-timer cleanup and pending loading, four hosted-review lifetime permutations, mocked terminal creation error/order wiring, five sleep-inventory variants with pending-frame-only assertions, palette fallback/composite highlights, Windows/UNC encoded-editor input rows, mixed-repository partial failure counts, title setters and generated-title bypass/replacement, five window-close coordinator delegation/guard/finally branches, and ambiguous-old-record frame reveal. These regression checks are intentionally lost under the test-value audit; retained cases are not equivalent replacements. Prior coverage notes and receipts remain historical. Audit 3273 removes 14 authored declarations and 19 expanded scenarios across four whole suites and eight partial suites. Retired alarms cover saved-local cancellation/layout ownership, ambiguous-owner warning reset, folder attachment routing, VM false-capability bypass, abandoned reveal warmup cleanup and viewport claim deduplication/rearming, quiet unrelated remote-removal refusal, startup-command one-shot consumption, repository/floating recovery-ledger rows, fake-React pinned-scroll intent, split-ratio state identity/subscriber suppression and fractional change, cross-host project-group join refusal, three PR request-lifetime permutations, upstream-status preservation on error, and unresolved Git-owner refusal. These regression checks are intentionally lost under the test-value audit; retained scenarios are not equivalent replacements. Historical coverage receipts remain historical, including gate35 subscriber claims. Audit 3256 removes these specific alarms from the broad root unit commands: skill dialog active-share selection, close and pending-share handoff; simple keyed-record deletion; marker live-region insertion, simple landing and nine baseline policy examples; General search/control navigation inventory; orphan-count cache bootstrap; seven Codex code classifications and HTTP 429 warning mapping; two skill unread-root verdict examples; peer-mail payload and conversation-ID rejection; and the GitHub organization TABLE text-field optimistic rollback/failed-envelope example. These include real behaviors; retained tests do not provide equivalent coverage for every removed scenario. Mobile losses are recorded separately and are not coverage of these root commands. Audit3246 retires NewRowsMarker reveal/no-repeat and pane-scoped beforeinput checks; skill-owner option availability/count/dedup/order; six styled Input/Textarea IME forwarding rows; the static Codex/OpenCode smart-key inventory; tab-map AST ratchet diagnostic fixtures; child-roster work-budget and retained-aggregate alarms; malformed persisted floating-cwd fallback/no-crash/empty exact-root checks; the unanswered-host empty-list discriminator; the direct invalidated-cache commit-false assertion; one redundant digit-keyup IME row; cached non-supported Claude title-generator rows; and the duplicate late naming-result singleton. These root broad commands lose those specific alarms without equivalent replacement. Distinct retained owner/state checks have their own bounded claims; the real scheduler still rejects stale response data, while the direct false-return alarm is retired. Audit3231 retires supported-host restore-pane key mapping, closed/open creation-sidebar toggle visibility, unrelated scope-error/null classification and quick-submit reveal/no-create checks. These broad commands lose those real narrow alarms; no replacement coverage is claimed. Audit3219 removes the synthetic Cmd+J extra-source suite; this broad command no longer checks its match/tie placement and selection, announced count, empty-query cap, or workspace hiding with retained recent tabs. No replacement coverage is claimed. Audit3209 composes approved sources3202/3206: deliberately retires seven authored/expanded cases in four whole suites without equivalent replacement. Work-item queries lose real GitHub/GitLab oversized ASCII secret-prefix empty-query and whitespace-before-trim refusal alarms; inputs share the imported size bound and exercise only its fast length branch, with no multibyte or actual provider/exposure guarantee. Skill sharing loses complete/partial managed-bundle and destination-ambiguity association checks plus three negative origin/path/scheme admission examples; these do not establish uploaded contents, arbitrary-URL fetching, authorization or execution. Retain exact originless-project direct-link fallback, cloud-delete confirmation, bundled-target repair/owner isolation and explicit Windows-host preference over stale WSL suites. Rejected3201 runtime-preference removal is excluded. No real cloud/network/host/disk, mobile or mixed-version execution validation is claimed. Audit3200 composes approved source3194: deliberately retires thirteen authored registrations/twenty-seven expanded cases in six whole automation host/list policy suites without equivalent replacement. Real RPC category/retryability and wrapped-timeout recognition, unscoped-failure/scoped-success health evidence precedence, exact-ID create selectors and per-run workspace omission, paired-web local/SSH/absent host catalog routing, incompatible/removed/unhydrated/offline execution health, runtime-before-nested-SSH recovery dispatch, and no-owned-focus/successor/foreign-list focus policy alarms are consciously lost. Retain exact20line orphan allow/refuse/precondition and exact90line cross-host same-ID search suites. No retry-timer/fence lifecycle, actual reconnect/network/write delivery, native focus, mobile/mixed-version runtime or disk persistence coverage is claimed. Audit3191 combines approved source3182/3187/3188: deliberately retires thirteen authored Vitest registrations and fifteen expanded cases, including five whole suites, without equivalent replacement. Attachment intake loses real portal/native-capture terminal interception and unowned-container refusal, immediate child-only committed availability/claim-ref negotiation and delivery, and direct-target over stable focused/background composer routing through disable/re-enable/remount and independent question focus. Exact destination/cache/draft and final-stat owner/workspace/File-release suites remain; they do not replace Surface recipient routing. Automation authoring loses destination runtime catalog membership, local/direct-SSH exclusion of paired-runtime repos, unknown-runtime empty catalog, logical project/host/setup/repo/path context payload, and missing/nonready setup refusal; these were genuine direct helper alarms, while exact schedule transformation, legacy schedule and setup-decision suites remain. Agent picker loses setup-chat/terminal/missing-installer/unsupported-or-unknown-host row projection samples and the ordinary unsearched menu variant; the entire original26-line resume recipe suite remains, including reported bypass versus default/absent permission modes, as does the exact search-result menu callback with its fixtures, model/effort commits and staged Arguments reopen outcome. Rejected predecessor3180 full recipe deletion is excluded. No actual native drag/cursor/focus/IME, upload bytes or disk/restart persistence, full automation save/scheduler/runtime transport, real resume-process flags/environment delivery, or native menu/rendered layout validation is claimed. Audit3178 combines source3169/3170/3175: deliberately retires eight authored units (six Vitest cases and two imperative custom relay scenarios), including two whole suites, without equivalent replacement. Voice Section loses per-model pending-delete isolation across interleaved A/B completion and the two-success refresh-call alarm; exact VoicePane delayed key-clear/newer enabled-toggle merge remains and does not replace row deletion coverage. Speech loses dedicated rating-scale/inclusive-ceiling, unsupported-versus-unmeasured, explicit/system-language precedence/locale alias, accuracy versus fast named/default/best-measured selection, and unmeasured/no-match examples; exact offered-user-pick versus retired-selection case and its fixture remain. Relay loses legacy ping-delivery count/liveness sampled before the silence deadline and grouped malformed Bearer/host-ID 401/429 routing checks; twelve real Worker/DurableObject/shipped-client scenarios remain, not equivalent replacement for those narrow alarms. Six prior speech cases are not all deleted: approved successor3175 keeps the original user-choice case. No actual credential/file persistence, native/GPU/engine/download delivery, production assignment policy or deployed-runtime validation is claimed by this reduction. Audit3165 combines source3160/3162: deliberately retires six authored/expanded cases across three whole suites without equivalent replacement. Launch/status losses: observed React-render pending/resuming coordination across settings and deferred offer read; stale-offer reread suppressing dialog reopen; held-local-chat recovery visibility with new-chat preferences off; disabled-local admission avoiding offer RPC despite an injected but unconsumed paired-tab fixture; and run-only lost-reply uncertainty reachability until direct viewed-run retirement. Launch probe does not prove arbitrary synchronous-store atomicity, the paired fixture is not remote runtime enrollment, and the status case directly marks viewed state rather than rendering the summary. Crew-hook losses: old-host method_not_found cache persists across party changes but is released by independently supplied connection generation/verified pairing status or pairing revision, with actual frame publication and teardown. These are real narrow coordination, admission, uncertainty and mixed-version cache alarms consciously lost. Exact web verified-runtime writer handoff guard remains; it does not replace those alarms or prove live host/native/mobile delivery. Audit3156 combines3147/3150/3152/3153/3154: deliberately retires39authored/40expanded native-chat recovery cases, eight whole suites and two orphan test-support files without equivalent replacement. Lost alarms: lost-reply unconfirmed reconciliation, skipped rows/counts and missed-frame repair, unknown/pending outcome and omitted-failure-list compatibility, uncertain history after dismissal, retry/refusal/dismiss lifecycle, hidden/consumed picker ownership, result-tree keyboard focus/disclosure and all-skipped retirement; unconfirmed-over-conflict guidance and failed-chat changes despite older host timestamps; nearest-listed ancestor/cyclic forest shape, descendant membership, host ordering/missing-host local fallback; skipped/readiness/admission counts, provisional skip/progress monotonicity, early per-chat verdicts with batch pending protection, older-host waiting, start-slot/delivery distinction, retry-over-failure and unknown-after-withdrawal attention; remote snooze/reconnect/reoffer, unseen mixed summary through open/close, watched completion retirement, new success beside old failure, failed-reread mixed-result preservation, filter/collapse completion resets, retry summary replacement and current-offer/history selection; cross-host workspace identity, rendered cyclic reachability, nested tri-state/toggle propagation, project eligibility isolation and collapse preserving selection. Exact fallback-list completion barrier, batched verdict/cleanup retention, stale-read versus dismissal publication race, and requested-but-never-rendered finished-run retirement remain; they do not replace retired alarms. Audit3146 combines source reviews3132/3133/3135/3138/3143: intentionally retire20authored/31expanded cases without equivalent replacement. Provider-session losses: structured-native terminal-resume exclusion, metadata-less completed identity, new-turn completion clearing, Pi provider-only/periodic/manual promotion, changed-transcript launch-config isolation, Pi/omp/prime-agent completed-session remote/manual-shutdown promotion, and quit/done precedence over heartbeat. Side-thread/question losses: finished-pane acquisition, hidden title/recap states, local/relay/relay-done conversation takeover with prompt/session/child resets, plain-message abandonment, compaction/session replacement and completion resets. Codex startup losses: incoming-owner cached child replacement, old-relay foreign live-session correction, completed foreign-root turn-fact permutations. Transcript losses: real temporary-JSONL partial sibling/final-child completion, unlabelled child attribution, compact cached replay preservation and100/1000completed-child roster retention/release. Compiler-ratchet losses: valid-line uncompiled-list parser grammar examples and injected-existence stale-path filtering; these did not exercise actual filesystem canonicalization or build exclusion. These are real lifecycle, ownership, replay, liveness and retention alarms, including recent#40246 regressions, deliberately lost. Retained conditional record replacement, clockless root/SSH owner isolation, persisted main-thread fork rejection, partial/final question-answer lifetime, cached-roster/missing-ID/live HTTP/durable startup boundaries and restarted-relay refusal/acceptance do not replace those losses. No native/SSH/WSL execution or equivalent coverage is claimed. Audit3128 scoped coverage reduction: Audit3121 removes VoiceDictationLanguageSetting.test.tsx (Spanish-to-es callback and unsupported-model Korean option presence) and voice-speech-model-rows.test.ts (provider/language-order/retired-on-disk list policy); these real narrow alarms are deliberately retired without replacement. VoiceSpeechModelSection per-model concurrent deletion remains unchanged. Audit3122 removes the direct absolute/parent-segment sparse-directory exception-type sample and the five-row IPC sparse-preset error-code/non-save table (two authored/six expanded cases). Those real typed-validation and IPC refusal/error-code alarms are deliberately retired. Keep both real symlink/junction floating-directory trust cases and the minimal RPC structured validation-reason serialization case. The RPC case does not replace IPC save/refusal behavior, typed normalization for both path inputs, actual Git sparse checkout or rendered localization. No equivalent replacement or fresh test/runtime/platform/remote/performance validation is claimed. Audit3124 removes ExperimentalPane.test.tsx (ordinary Pet switch callback), WorkspaceDirectorySetting.test.tsx (padded absolute saved-path normalization/no-write blur), and repository-search.perf.test.ts (navigation/selected-pane builder-call policy, fixture cardinality/nonempty entries and renamed project keyword inclusion). These real narrow alarms are retired without replacement; RepositoryPane.search.test.tsx search-to-sparse-editor request remains unchanged. Audit3129: resolver Windows case-insensitive and POSIX case-sensitive configured-env composition plus mocked-base launch-preflight Windows composition are intentionally no longer checked by the two deleted suites. No equivalent coverage claimed. Keep runtime-structured-agent-host-env.test.ts unchanged: configured Windows Claude-home account identity and host-account precedence remain checked. Audit3114 incorporates source3101: retire three structured Claude child-environment wrapper cases covering inherited stamp isolation/default and explicit entrypoint, Windows SDK-key canonicalization/default/duplicate-key order, and configured lookup/final environment/config-dir conjunction. Keep direct auth/session sanitation and Windows-versus-Linux overlay checks, actual executable lookup from supplied inherited PATH, native Windows child environment delivery, and stale option-mutation fencing. These are not equivalent replacements for the retired wrapper alarms. No fresh test/runtime, real login-shell probe, Claude SDK startup, remote/mixed-version, UI or performance result is claimed. Audit3114 incorporates source3105: retire 17 authored/20 expanded daemon launch-note cases, including the entire two-case SessionLaunchNote suite. Deliberately lose split-marker carry across same-token re-arm, stale-token retirement refusal, foreground tri-state and serial settlement, omitted-note/no-incarnation mixed-version policy, sticky retirement, first-incarnation/replacement launch preservation and held-launch precedence. Keep only the unchanged unresolved foreground-read race against a later finished attach. Supplied notes/foreground and runtime calls do not establish actual daemon/main restart, SSH, native Windows observation, mobile UI, equivalent replacement or fresh runtime/performance validation. Audit3114 incorporates source3109: retire six authored/35 expanded pricing cases: 21 accepted model-name examples, 10 unsupported/future-model fail-closed examples, malformed TTL clamp, unknown-model estimate refusal, flat-model long-context disregard and oversized long-context clamp. Keep mixed five-minute/one-hour write allocation and short/all-long/mixed long-context allocation with original fixed oracles. Real parser/refusal/bounds alarms are knowingly lost without equivalent replacement; retained tests do not validate provider rates, actual billing or request threshold classification. Preserve the archived usage-scan-append source-freeze receipt without transferring historical execution/performance credit. No fresh runtime result is claimed. Audit3108 source-only reduction (3094/3095/3100): retire 27 authored/30 expanded cases, including complete markdown view-state, file-preview link-open and CLI agent-server-route suites, without replacement. Deliberate losses include preview visibility/reference lifetime and same-path owners; SSH stat, directory/missing-target, explicit-null owner, nonmarkdown line/column, local URI routing, remote-to-client guard and same-file reuse; document-preview source-owner/folder/reuse routing, stable grant location and outside-workspace POSIX/Windows request projection; and verified remote CLI send/check refusal, suggested --on argv/copy, shell no-probe bypass, unverified-launch admission and older-peer refusal. Retain two markdown source-runtime/qualified-reveal alarms, one stale grant-rejection fence and two remote read/mutation evidence policies, with original callbacks. Final last-wins reveal did not prove transient cancellation; CLI prerequisite did not prove no real send, and envelope tests do not execute server refusal. No fresh runtime, rendered UI, actual file/SSH/paired transport, authorization, mixed-version or performance result is claimed. Audit3096 source-only reduction (3087/3088): retire 69 authored/76 expanded cases, including complete recovery-portals and reconnect-banner suites. Intentionally lose dead/default TUI replay, generated alternate-frame style composition, reset/mode/dimension and legacy missing-mode-boundary alarms, UI notice/action/reveal policies, and isolated recovery lifecycle variants, without equivalent replacement. Retained registrations and callbacks are unchanged; headless cells are not pixels, and no fresh runtime, host, SSH, WSL, rendered-app or performance result is claimed. Audit3086 source-only reduction (3079/3080/3081): intentionally retire 93 authored/100 expanded mock-boundary cases, including the complete spawn-errors and SSH reconnect overlay suites, without replacement. Retired alarms include spawn classification/ownership, reply ceilings and renderer-write failure recovery, disconnect/detach fencing branches, authority facts, and overlay retry/visibility wiring. Retained callbacks are unchanged; no fresh execution, real PTY/SSH, rendered UI, or performance result is claimed. Module layout SSH policy: Retire the multiplexer private-clock saturation registration, the writer saturation transition-count registration and the changed-source dated writer/backpressure receipt. Retained byte delivery, lane order, fairness, settlement and cancellation cases are unvalidated by that historical receipt. No equivalent replacement, new execution, measured performance, live SSH/WSL or cross-platform proof is claimed. The unchanged WSL protocol receipt retains only its original command scope. Historical prior account (preserved verbatim): Audit2432: The broad unit command loses the isolated BranchPicker open-change notification sample. Its unique true/false callback alarm is intentionally retired; reopening/status-refresh behavior was not exercised. No equivalent replacement or fresh validation of the reduced selector is claimed. Audit2425: The broad unit command loses the workspace-copy-status supplied readError forwarding sample. It did not exercise the branch-switch blocking promised by its title. This alarm is intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2417: The broad unit command loses two ordinary clean Git cherry-pick/revert success samples and two terminal startup foreground-read work-budget samples. These unique alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2412: The broad unit command loses the whole six-case fake-React-hook scroll-anchor suite, two generic draft-retention samples, a simple new-agent order sample, a real history-publication batching-count sample, an unmounted handoff abort/timer sample and three basic WSL preview/error samples. These alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2404: The broad unit command loses the standalone share-name lookup 503 propagation suite, initial deletion placement-kind sample, direct changed-mtime stale sample, first-pass rollback existence example and abandoned-preparation directory sample. These exact alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2397 review amendment: The broad unit command loses three standalone suites, two partial-case definitions and two URL table rows across package/download/placement tests. Keep initial wrong-port authorization, modified independent-copy digest refusal and abort-after-begin cancellation dispatch. The remaining alarms are deliberately retired; no equivalent complete replacement or fresh validation of the reduced selector is claimed. Audit2393 current-parent refresh2401: Remove the basic skill-install service alias sample and original public managed-remove receiptless refusal case. Preserve the upstream request ownership suite and transaction interruption coverage. No equivalent complete replacement or fresh validation of the reduced selector is claimed. Audit2389: The broad unit command loses the missing-preview suite, plain-global destination sample and prepublished-receipt recovery example. No equivalent replacement or fresh validation of the reduced selector is claimed. Audit2385: The broad unit command loses four authored walker/staging/protocol examples (six expanded cases); no equivalent replacement or fresh validation is claimed for the reduced suite. Audit2383: The unscoped Vitest command no longer includes the removed Antigravity catalogue suite; its exact provider-root/owner example has no equivalent replacement or fresh validation claim. Audit2377/2381: The unscoped Vitest command includes the reduced bundled-skill and native-discovery suites; the eight removed backup/legacy/catalogue/symlink/SSH-builder examples have no replacement-equivalence or fresh validation claim here. Audit2133 current-parent preparation: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2095 current-parent preparation2126: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2090 (sources2088/2089): Current reduced suites intentionally retire the alarms listed in knownGaps; prior dated execution and replacement claims do not validate changed source bytes or selectors. Historical prior account (preserved verbatim): Audit2086 (sources2082/2083): Current reduced suites intentionally retire the alarms listed in knownGaps; prior dated execution and replacement claims do not validate changed source bytes or selectors. Historical prior account (preserved verbatim): Audit2076 (sources2073/2074): Intentionally retire these low-value alarms without replacement: src/main/runtime/orca-runtime-tests/terminal-handles-part-02.spec.ts: recovers a moved SSH pane through the tab it now sits in, not the one its lease froze; reports a plain expired orphan; does not report a pane whose only recent lease was superseded; does not report a pane whose only recent lease had its relay id recycled; picks the eligible orphan over a superseded predecessor that matches first; collects the same tabs the per-tab reader reports, in one sweep of the leases; reports no candidate when no lease names any of the worktree tabs. src/main/runtime/orca-runtime-tests/runtime-availability.spec.ts: starts unavailable with no authoritative window; reports the configured Windows terminal shell on status; reports floating workspace availability from settings on status; polls floating tabs with targeted PTY liveness and no repo/provider inventory; hydrates persisted tabs when the store cannot report repos; advertises browser screencast only when a renderer window is available; routes mobile Codex reset consumption through the account mutation coordinator; maps a definite pre-provider rejection into an authoritative current snapshot. Existing unrelated evidenceRuns retain their original scope; unchanged dated receipt objects do not validate changed source bytes or reduced selectors. No fresh gate execution or historical import-closure equivalence is claimed. Frozen current literal-import graph reaches these changed test bytes; unresolved local and computed edges remain debt, and current reachability is not historical execution or equivalent replacement evidence. Historical prior account (preserved verbatim): Audit2070 (sources2068/2069): Intentionally retire these low-value alarms without replacement: src/main/runtime/orca-runtime.test.ts: ordinary registration cleanup removes only await import('./orca-runtime-tests/hooks-and-hosted-review.spec'). src/main/ssh/ssh-multiplexer-transport-writer.test.ts: reports saturated epochs and their drain boundary exactly once. src/main/runtime/orca-runtime-tests/worktree-removal-archive-hook-gate.spec.ts: removes and records the waiver when the failure is explicitly overridden; removes without an override record when the hook succeeds; removes when the hook is configured but not requested; removes when no archive hook is configured; holds a desktop removal in the same repo until this one is accepted; joins a desktop removal of the same worktree accepted while this one waited. src/main/runtime/orca-runtime-tests/worktree-ps-agent-row-dismissal.spec.ts: drops the row as soon as the user dismisses it, without waiting for the PTY to exit; tells paired clients to republish on the transition and on the dismissal; rejoins a row through its %s handle after pane ownership clears. src/main/runtime/orca-runtime-tests/hooks-and-hosted-review.spec.ts: reports an error when the SSH filesystem provider is unavailable; reports an SSH orca.yaml as an error without reading any filesystem; reports ok for a local repo hook check; reads SSH issue commands as absent and drops writes without touching any filesystem; allows host integration slug helpers for SSH repos through provider-aware GitHub clients; routes runtime GitHub repo identity helpers through the selected WSL project runtime; routes runtime GitHub issue and work-item actions through the selected WSL project runtime; pins explicit origin preference on runtime open-by-number work item lookups; forwards check-details cancellation without local Git overrides. Existing unrelated evidenceRuns retain their original scope; unchanged dated receipt objects do not validate changed source bytes or reduced selectors. No fresh gate execution or historical import-closure equivalence is claimed. Frozen current literal-import graph reaches these changed test bytes; unresolved local and computed edges remain debt, and current reachability is not historical execution or equivalent replacement evidence. The historical receipt/currentCommand selecting src/main/ssh/ssh-multiplexer-transport-writer.test.ts remains historical and is not a passing result for the reduced current command. Historical prior account (preserved verbatim): Audit1931 (sources1928/1929): Delete the complete tail-wait memo suite: its sole current authored callback checks supplied fromTail/blocked field values. Retire all three broader memoization/equivalence/eviction assertion aliases; they are not backed by retained source callbacks. No scan-work budget, sustained output, physical terminal or resource measurement is assigned to this removed test. Preserve meaningful remaining selectors/assertions and unchanged dated receipts within their original scope. Reduced selectors have no fresh gate execution evidence in this metadata packet. No equivalent replacement, physical watcher/PTY/provider, live SSH/remote/mobile, rendered, cross-platform, soak or measured-budget result is claimed. Historical prior account (preserved verbatim): Audit1674 retires changed-source assertion and execution scope without equivalent replacement coverage. Existing unchanged-selector receipts remain scoped to their original sources. Historical prior-source oracle: Existing exact unchanged-selector receipts remain the only current execution evidence. Changed source selectors have no fresh execution result. Historical prior-source oracle account: The current executable slice injects main-process renderer backlog pressure, then asserts ordinary terminal-wait detection without a joined-tail allocation and with full prompt-family continuity, per-PTY and total pending-output caps, a 1,024-ID projection cap with split-remainder compaction, preserved sequenced-tail metadata, active-pending protection ahead of background trimming, exact provider-generation pause ownership, renderer exit/data ordering, and ACK-gated in-flight bounds. The negotiation seam proves every initial connection and reconnect offers V1, the same-build relay advertises V1 without launch flags, old clients remain token-free, and method-not-found peers fall back without installing source ACK publication. The joined source-intake/multiplex oracle blocks renderer or headless serialization, admits one snapshot-covered span and one trailing span, requires replacement reservation only after the authoritative sequence is known, advances upstream ACK eligibility exactly to the covered boundary after SnapshotEnd, and delivers then ACKs the trailing span through the ordinary live path without cancellation. Source-range ledger and multiplex seams additionally require cumulative byte ACK 40 then 100 for one 100-byte frame to release exact byte credit without early source settlement, admit a contiguous higher-generation recovered token while the prior token remains unsettled, and reject stale stream or source generations without releasing in-flight byte credit. Replacement reservation rolls back every earlier span on a later failure, commit requires the exact frozen transfer states, and an authoritatively reclaimed covered span rejects commit without local trim authority while rollback removes the reservation idempotently. The exit-deadline oracle publishes a source-backed desktop projection, advances a fake clock to cancellation, and requires one projection transfer, proof commit, preparation, and final exit with no provider close, retained obligation, duplicate finalization, or process-lifetime cancellation tombstone; a second controlled proof remains pending across generation close and must never publish final exit, while both paths release the renderer preparation lease exactly once. The model-migration oracle accepts span A, blocks span B's raw emulator completion, begins disconnect migration, and proves no checkpoint or reconnect attach can remain at A; releasing B advances the exact checkpoint to B and projects B once. Its fake-clock arm reaches the 10-second deadline, requires checkpoint-unavailable, one exact model reset, zero retained admission charge and timers, and no effect from late raw settlement. Its two-PTY failure arm rejects one running raw callback under an active exact migration and requires one checkpoint-unavailable result, one model reset, zero provider closes, retained sibling checkpoint and transport liveness, zero charges and timers, and an unaffected other generation; a non-migrating sibling oracle still requires generation close. The intake additionally closes 2,048 sequential provider generations into one exact range, rejects stale events across that range, and preserves an out-of-order live gap until its own close. Direct-SSH contracts additionally prove activation-response settlement before the first source frame, claim-gated projection under same-decoder-turn response/data delivery, exact early-ACK reservation through send settlement or same-token retry, recovery completion visible before lease-held frames transfers those frames only into the private quarantine and admits no output until exact checkpoint-to-recoveryEnd coverage, invalid-checkpoint restore retention through response settlement followed by fresh-token retry and one live source frame, isolated saturated-subscriber eviction with healthy owner liveness, preserved legacy-primary backpressure, one-write ownership across write(false)/drain, control selection ahead of queued ordinary PTY input with FIFO lanes and bounded fairness, liveness rebasing, failed-exit retention through late ACK or exact recovery, response-settlement cancellation authority, token-scoped exit cancellation, exact checkpoint-to-recoveryEnd continuity, stale-owner one-shot retry, no physical PTY teardown on recovery failure, exact provider-generation closure and once-only cleanup when recovery cancellation publication or proof rejects, 16 MiB-plus-1 MiB decoder caps, charged per-PTY/session retention budgets, and eight-wide isolated reattach. The live Electron perf oracle adds hidden-output floods, renderer scheduler queue depth, dropped-output-zero normal scenarios, and active key latency budgets before promotion.", + "oracle": "Audit 3292 combines adopted 3285/3287/3289/3293 removals: 40 authored declarations and 47 expanded scenarios, including whole frame-editor-view, ambiguous remote-delete-refusal, unverifiable-host subscription and editor-close cleanup suites. The previously reviewed dock-badge suite was already removed upstream in PR 40895 and receives zero new removal credit. Intentionally retired alarms include background browser selection and last-tab landing; main startup fallback, SSH project cleanup/survivor routing, exact-PR contradiction/saved-push positives, replay/sidecar rollback and wrapped remote error normalization; records/snapshot missing-diff hydration, ambiguous folder-owner delete refusal, focus no-op notifications, nested editor context-only cache check, pending broadcast-first status and ordinary four-confirmation aggregation; preview-source frontmatter pruning, approved local/runtime agent dispatch, non-GitHub legacy PR cache invalidation, stale merged-head transient-error fallback, empty-queue immediate query reply and unverified-to-concrete preflight risk. Additional intentionally retired alarms are injected host subscription/unsubscribe counts, synthetic editor reveal/draft/fallback/scoped close, ambiguous unread refusals and hidden mark/read roundtrip, immediate connect backoff/noError, positive mirrored evidence-clock renewal, supplied VM failure/success projections and git-local/folder-SSH wake permutations. Remaining temporal/ownership cases are narrower; no equivalent replacement or fresh execution is claimed. Audit 3283 removes 20 authored declarations and 31 expanded scenarios, including two whole suites. Retired alarms cover PR refresh-state pruning, shared runtime subscription cleanup and store isolation, language content-change routing and older completion ownership, ordinary panel retry-timer cleanup and pending loading, four hosted-review lifetime permutations, mocked terminal creation error/order wiring, five sleep-inventory variants with pending-frame-only assertions, palette fallback/composite highlights, Windows/UNC encoded-editor input rows, mixed-repository partial failure counts, title setters and generated-title bypass/replacement, five window-close coordinator delegation/guard/finally branches, and ambiguous-old-record frame reveal. These regression checks are intentionally lost under the test-value audit; retained cases are not equivalent replacements. Prior coverage notes and receipts remain historical. Audit 3273 removes 14 authored declarations and 19 expanded scenarios across four whole suites and eight partial suites. Retired alarms cover saved-local cancellation/layout ownership, ambiguous-owner warning reset, folder attachment routing, VM false-capability bypass, abandoned reveal warmup cleanup and viewport claim deduplication/rearming, quiet unrelated remote-removal refusal, startup-command one-shot consumption, repository/floating recovery-ledger rows, fake-React pinned-scroll intent, split-ratio state identity/subscriber suppression and fractional change, cross-host project-group join refusal, three PR request-lifetime permutations, upstream-status preservation on error, and unresolved Git-owner refusal. These regression checks are intentionally lost under the test-value audit; retained scenarios are not equivalent replacements. Historical coverage receipts remain historical, including gate35 subscriber claims. Audit 3256 removes these specific alarms from the broad root unit commands: skill dialog active-share selection, close and pending-share handoff; simple keyed-record deletion; marker live-region insertion, simple landing and nine baseline policy examples; General search/control navigation inventory; orphan-count cache bootstrap; seven Codex code classifications and HTTP 429 warning mapping; two skill unread-root verdict examples; peer-mail payload and conversation-ID rejection; and the GitHub organization TABLE text-field optimistic rollback/failed-envelope example. These include real behaviors; retained tests do not provide equivalent coverage for every removed scenario. Mobile losses are recorded separately and are not coverage of these root commands. Audit3246 retires NewRowsMarker reveal/no-repeat and pane-scoped beforeinput checks; skill-owner option availability/count/dedup/order; six styled Input/Textarea IME forwarding rows; the static Codex/OpenCode smart-key inventory; tab-map AST ratchet diagnostic fixtures; child-roster work-budget and retained-aggregate alarms; malformed persisted floating-cwd fallback/no-crash/empty exact-root checks; the unanswered-host empty-list discriminator; the direct invalidated-cache commit-false assertion; one redundant digit-keyup IME row; cached non-supported Claude title-generator rows; and the duplicate late naming-result singleton. These root broad commands lose those specific alarms without equivalent replacement. Distinct retained owner/state checks have their own bounded claims; the real scheduler still rejects stale response data, while the direct false-return alarm is retired. Audit3231 retires supported-host restore-pane key mapping, closed/open creation-sidebar toggle visibility, unrelated scope-error/null classification and quick-submit reveal/no-create checks. These broad commands lose those real narrow alarms; no replacement coverage is claimed. Audit3219 removes the synthetic Cmd+J extra-source suite; this broad command no longer checks its match/tie placement and selection, announced count, empty-query cap, or workspace hiding with retained recent tabs. No replacement coverage is claimed. Audit3209 composes approved sources3202/3206: deliberately retires seven authored/expanded cases in four whole suites without equivalent replacement. Work-item queries lose real GitHub/GitLab oversized ASCII secret-prefix empty-query and whitespace-before-trim refusal alarms; inputs share the imported size bound and exercise only its fast length branch, with no multibyte or actual provider/exposure guarantee. Skill sharing loses complete/partial managed-bundle and destination-ambiguity association checks plus three negative origin/path/scheme admission examples; these do not establish uploaded contents, arbitrary-URL fetching, authorization or execution. Retain exact originless-project direct-link fallback, cloud-delete confirmation, bundled-target repair/owner isolation and explicit Windows-host preference over stale WSL suites. Rejected3201 runtime-preference removal is excluded. No real cloud/network/host/disk, mobile or mixed-version execution validation is claimed. Audit3200 composes approved source3194: deliberately retires thirteen authored registrations/twenty-seven expanded cases in six whole automation host/list policy suites without equivalent replacement. Real RPC category/retryability and wrapped-timeout recognition, unscoped-failure/scoped-success health evidence precedence, exact-ID create selectors and per-run workspace omission, paired-web local/SSH/absent host catalog routing, incompatible/removed/unhydrated/offline execution health, runtime-before-nested-SSH recovery dispatch, and no-owned-focus/successor/foreign-list focus policy alarms are consciously lost. Retain exact20line orphan allow/refuse/precondition and exact90line cross-host same-ID search suites. No retry-timer/fence lifecycle, actual reconnect/network/write delivery, native focus, mobile/mixed-version runtime or disk persistence coverage is claimed. Audit3191 combines approved source3182/3187/3188: deliberately retires thirteen authored Vitest registrations and fifteen expanded cases, including five whole suites, without equivalent replacement. Attachment intake loses real portal/native-capture terminal interception and unowned-container refusal, immediate child-only committed availability/claim-ref negotiation and delivery, and direct-target over stable focused/background composer routing through disable/re-enable/remount and independent question focus. Exact destination/cache/draft and final-stat owner/workspace/File-release suites remain; they do not replace Surface recipient routing. Automation authoring loses destination runtime catalog membership, local/direct-SSH exclusion of paired-runtime repos, unknown-runtime empty catalog, logical project/host/setup/repo/path context payload, and missing/nonready setup refusal; these were genuine direct helper alarms, while exact schedule transformation, legacy schedule and setup-decision suites remain. Agent picker loses setup-chat/terminal/missing-installer/unsupported-or-unknown-host row projection samples and the ordinary unsearched menu variant; the entire original26-line resume recipe suite remains, including reported bypass versus default/absent permission modes, as does the exact search-result menu callback with its fixtures, model/effort commits and staged Arguments reopen outcome. Rejected predecessor3180 full recipe deletion is excluded. No actual native drag/cursor/focus/IME, upload bytes or disk/restart persistence, full automation save/scheduler/runtime transport, real resume-process flags/environment delivery, or native menu/rendered layout validation is claimed. Audit3178 combines source3169/3170/3175: deliberately retires eight authored units (six Vitest cases and two imperative custom relay scenarios), including two whole suites, without equivalent replacement. Voice Section loses per-model pending-delete isolation across interleaved A/B completion and the two-success refresh-call alarm; exact VoicePane delayed key-clear/newer enabled-toggle merge remains and does not replace row deletion coverage. Speech loses dedicated rating-scale/inclusive-ceiling, unsupported-versus-unmeasured, explicit/system-language precedence/locale alias, accuracy versus fast named/default/best-measured selection, and unmeasured/no-match examples; exact offered-user-pick versus retired-selection case and its fixture remain. Relay loses legacy ping-delivery count/liveness sampled before the silence deadline and grouped malformed Bearer/host-ID 401/429 routing checks; twelve real Worker/DurableObject/shipped-client scenarios remain, not equivalent replacement for those narrow alarms. Six prior speech cases are not all deleted: approved successor3175 keeps the original user-choice case. No actual credential/file persistence, native/GPU/engine/download delivery, production assignment policy or deployed-runtime validation is claimed by this reduction. Audit3165 combines source3160/3162: deliberately retires six authored/expanded cases across three whole suites without equivalent replacement. Launch/status losses: observed React-render pending/resuming coordination across settings and deferred offer read; stale-offer reread suppressing dialog reopen; held-local-chat recovery visibility with new-chat preferences off; disabled-local admission avoiding offer RPC despite an injected but unconsumed paired-tab fixture; and run-only lost-reply uncertainty reachability until direct viewed-run retirement. Launch probe does not prove arbitrary synchronous-store atomicity, the paired fixture is not remote runtime enrollment, and the status case directly marks viewed state rather than rendering the summary. Crew-hook losses: old-host method_not_found cache persists across party changes but is released by independently supplied connection generation/verified pairing status or pairing revision, with actual frame publication and teardown. These are real narrow coordination, admission, uncertainty and mixed-version cache alarms consciously lost. Exact web verified-runtime writer handoff guard remains; it does not replace those alarms or prove live host/native/mobile delivery. Audit3156 combines3147/3150/3152/3153/3154: deliberately retires39authored/40expanded native-chat recovery cases, eight whole suites and two orphan test-support files without equivalent replacement. Lost alarms: lost-reply unconfirmed reconciliation, skipped rows/counts and missed-frame repair, unknown/pending outcome and omitted-failure-list compatibility, uncertain history after dismissal, retry/refusal/dismiss lifecycle, hidden/consumed picker ownership, result-tree keyboard focus/disclosure and all-skipped retirement; unconfirmed-over-conflict guidance and failed-chat changes despite older host timestamps; nearest-listed ancestor/cyclic forest shape, descendant membership, host ordering/missing-host local fallback; skipped/readiness/admission counts, provisional skip/progress monotonicity, early per-chat verdicts with batch pending protection, older-host waiting, start-slot/delivery distinction, retry-over-failure and unknown-after-withdrawal attention; remote snooze/reconnect/reoffer, unseen mixed summary through open/close, watched completion retirement, new success beside old failure, failed-reread mixed-result preservation, filter/collapse completion resets, retry summary replacement and current-offer/history selection; cross-host workspace identity, rendered cyclic reachability, nested tri-state/toggle propagation, project eligibility isolation and collapse preserving selection. Exact fallback-list completion barrier, batched verdict/cleanup retention, stale-read versus dismissal publication race, and requested-but-never-rendered finished-run retirement remain; they do not replace retired alarms. Audit3146 combines source reviews3132/3133/3135/3138/3143: intentionally retire20authored/31expanded cases without equivalent replacement. Provider-session losses: structured-native terminal-resume exclusion, metadata-less completed identity, new-turn completion clearing, Pi provider-only/periodic/manual promotion, changed-transcript launch-config isolation, Pi/omp/prime-agent completed-session remote/manual-shutdown promotion, and quit/done precedence over heartbeat. Side-thread/question losses: finished-pane acquisition, hidden title/recap states, local/relay/relay-done conversation takeover with prompt/session/child resets, plain-message abandonment, compaction/session replacement and completion resets. Codex startup losses: incoming-owner cached child replacement, old-relay foreign live-session correction, completed foreign-root turn-fact permutations. Transcript losses: real temporary-JSONL partial sibling/final-child completion, unlabelled child attribution, compact cached replay preservation and100/1000completed-child roster retention/release. Compiler-ratchet losses: valid-line uncompiled-list parser grammar examples and injected-existence stale-path filtering; these did not exercise actual filesystem canonicalization or build exclusion. These are real lifecycle, ownership, replay, liveness and retention alarms, including recent#40246 regressions, deliberately lost. Retained conditional record replacement, clockless root/SSH owner isolation, persisted main-thread fork rejection, partial/final question-answer lifetime, cached-roster/missing-ID/live HTTP/durable startup boundaries and restarted-relay refusal/acceptance do not replace those losses. No native/SSH/WSL execution or equivalent coverage is claimed. Audit3128 scoped coverage reduction: Audit3121 removes VoiceDictationLanguageSetting.test.tsx (Spanish-to-es callback and unsupported-model Korean option presence) and voice-speech-model-rows.test.ts (provider/language-order/retired-on-disk list policy); these real narrow alarms are deliberately retired without replacement. VoiceSpeechModelSection per-model concurrent deletion remains unchanged. Audit3122 removes the direct absolute/parent-segment sparse-directory exception-type sample and the five-row IPC sparse-preset error-code/non-save table (two authored/six expanded cases). Those real typed-validation and IPC refusal/error-code alarms are deliberately retired. Keep both real symlink/junction floating-directory trust cases and the minimal RPC structured validation-reason serialization case. The RPC case does not replace IPC save/refusal behavior, typed normalization for both path inputs, actual Git sparse checkout or rendered localization. No equivalent replacement or fresh test/runtime/platform/remote/performance validation is claimed. Audit3124 removes ExperimentalPane.test.tsx (ordinary Pet switch callback), WorkspaceDirectorySetting.test.tsx (padded absolute saved-path normalization/no-write blur), and repository-search.perf.test.ts (navigation/selected-pane builder-call policy, fixture cardinality/nonempty entries and renamed project keyword inclusion). These real narrow alarms are retired without replacement; RepositoryPane.search.test.tsx search-to-sparse-editor request remains unchanged. Audit3129: resolver Windows case-insensitive and POSIX case-sensitive configured-env composition plus mocked-base launch-preflight Windows composition are intentionally no longer checked by the two deleted suites. No equivalent coverage claimed. Keep runtime-structured-agent-host-env.test.ts unchanged: configured Windows Claude-home account identity and host-account precedence remain checked. Audit3114 incorporates source3101: retire three structured Claude child-environment wrapper cases covering inherited stamp isolation/default and explicit entrypoint, Windows SDK-key canonicalization/default/duplicate-key order, and configured lookup/final environment/config-dir conjunction. Keep direct auth/session sanitation and Windows-versus-Linux overlay checks, actual executable lookup from supplied inherited PATH, native Windows child environment delivery, and stale option-mutation fencing. These are not equivalent replacements for the retired wrapper alarms. No fresh test/runtime, real login-shell probe, Claude SDK startup, remote/mixed-version, UI or performance result is claimed. Audit3114 incorporates source3105: retire 17 authored/20 expanded daemon launch-note cases, including the entire two-case SessionLaunchNote suite. Deliberately lose split-marker carry across same-token re-arm, stale-token retirement refusal, foreground tri-state and serial settlement, omitted-note/no-incarnation mixed-version policy, sticky retirement, first-incarnation/replacement launch preservation and held-launch precedence. Keep only the unchanged unresolved foreground-read race against a later finished attach. Supplied notes/foreground and runtime calls do not establish actual daemon/main restart, SSH, native Windows observation, mobile UI, equivalent replacement or fresh runtime/performance validation. Audit3114 incorporates source3109: retire six authored/35 expanded pricing cases: 21 accepted model-name examples, 10 unsupported/future-model fail-closed examples, malformed TTL clamp, unknown-model estimate refusal, flat-model long-context disregard and oversized long-context clamp. Keep mixed five-minute/one-hour write allocation and short/all-long/mixed long-context allocation with original fixed oracles. Real parser/refusal/bounds alarms are knowingly lost without equivalent replacement; retained tests do not validate provider rates, actual billing or request threshold classification. Preserve the archived usage-scan-append source-freeze receipt without transferring historical execution/performance credit. No fresh runtime result is claimed. Audit3108 source-only reduction (3094/3095/3100): retire 27 authored/30 expanded cases, including complete markdown view-state, file-preview link-open and CLI agent-server-route suites, without replacement. Deliberate losses include preview visibility/reference lifetime and same-path owners; SSH stat, directory/missing-target, explicit-null owner, nonmarkdown line/column, local URI routing, remote-to-client guard and same-file reuse; document-preview source-owner/folder/reuse routing, stable grant location and outside-workspace POSIX/Windows request projection; and verified remote CLI send/check refusal, suggested --on argv/copy, shell no-probe bypass, unverified-launch admission and older-peer refusal. Retain two markdown source-runtime/qualified-reveal alarms, one stale grant-rejection fence and two remote read/mutation evidence policies, with original callbacks. Final last-wins reveal did not prove transient cancellation; CLI prerequisite did not prove no real send, and envelope tests do not execute server refusal. No fresh runtime, rendered UI, actual file/SSH/paired transport, authorization, mixed-version or performance result is claimed. Audit3096 source-only reduction (3087/3088): retire 69 authored/76 expanded cases, including complete recovery-portals and reconnect-banner suites. Intentionally lose dead/default TUI replay, generated alternate-frame style composition, reset/mode/dimension and legacy missing-mode-boundary alarms, UI notice/action/reveal policies, and isolated recovery lifecycle variants, without equivalent replacement. Retained registrations and callbacks are unchanged; headless cells are not pixels, and no fresh runtime, host, SSH, WSL, rendered-app or performance result is claimed. Audit3086 source-only reduction (3079/3080/3081): intentionally retire 93 authored/100 expanded mock-boundary cases, including the complete spawn-errors and SSH reconnect overlay suites, without replacement. Retired alarms include spawn classification/ownership, reply ceilings and renderer-write failure recovery, disconnect/detach fencing branches, authority facts, and overlay retry/visibility wiring. Retained callbacks are unchanged; no fresh execution, real PTY/SSH, rendered UI, or performance result is claimed. Module layout SSH policy: Retire the multiplexer private-clock saturation registration, the writer saturation transition-count registration and the changed-source dated writer/backpressure receipt. Retained byte delivery, lane order, fairness, settlement and cancellation cases are unvalidated by that historical receipt. No equivalent replacement, new execution, measured performance, live SSH/WSL or cross-platform proof is claimed. The unchanged WSL protocol receipt retains only its original command scope. Historical prior account (preserved verbatim): Audit2432: The broad unit command loses the isolated BranchPicker open-change notification sample. Its unique true/false callback alarm is intentionally retired; reopening/status-refresh behavior was not exercised. No equivalent replacement or fresh validation of the reduced selector is claimed. Audit2425: The broad unit command loses the workspace-copy-status supplied readError forwarding sample. It did not exercise the branch-switch blocking promised by its title. This alarm is intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2417: The broad unit command loses two ordinary clean Git cherry-pick/revert success samples and two terminal startup foreground-read work-budget samples. These unique alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2412: The broad unit command loses the whole six-case fake-React-hook scroll-anchor suite, two generic draft-retention samples, a simple new-agent order sample, a real history-publication batching-count sample, an unmounted handoff abort/timer sample and three basic WSL preview/error samples. These alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2404: The broad unit command loses the standalone share-name lookup 503 propagation suite, initial deletion placement-kind sample, direct changed-mtime stale sample, first-pass rollback existence example and abandoned-preparation directory sample. These exact alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2397 review amendment: The broad unit command loses three standalone suites, two partial-case definitions and two URL table rows across package/download/placement tests. Keep initial wrong-port authorization, modified independent-copy digest refusal and abort-after-begin cancellation dispatch. The remaining alarms are deliberately retired; no equivalent complete replacement or fresh validation of the reduced selector is claimed. Audit2393 current-parent refresh2401: Remove the basic skill-install service alias sample and original public managed-remove receiptless refusal case. Preserve the upstream request ownership suite and transaction interruption coverage. No equivalent complete replacement or fresh validation of the reduced selector is claimed. Audit2389: The broad unit command loses the missing-preview suite, plain-global destination sample and prepublished-receipt recovery example. No equivalent replacement or fresh validation of the reduced selector is claimed. Audit2385: The broad unit command loses four authored walker/staging/protocol examples (six expanded cases); no equivalent replacement or fresh validation is claimed for the reduced suite. Audit2383: The unscoped Vitest command no longer includes the removed Antigravity catalogue suite; its exact provider-root/owner example has no equivalent replacement or fresh validation claim. Audit2377/2381: The unscoped Vitest command includes the reduced bundled-skill and native-discovery suites; the eight removed backup/legacy/catalogue/symlink/SSH-builder examples have no replacement-equivalence or fresh validation claim here. Audit2133 current-parent preparation: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2095 current-parent preparation2126: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2090 (sources2088/2089): Current reduced suites intentionally retire the alarms listed in knownGaps; prior dated execution and replacement claims do not validate changed source bytes or selectors. Historical prior account (preserved verbatim): Audit2086 (sources2082/2083): Current reduced suites intentionally retire the alarms listed in knownGaps; prior dated execution and replacement claims do not validate changed source bytes or selectors. Historical prior account (preserved verbatim): Audit2076 (sources2073/2074): Intentionally retire these low-value alarms without replacement: src/main/runtime/orca-runtime-tests/terminal-handles-part-02.spec.ts: recovers a moved SSH pane through the tab it now sits in, not the one its lease froze; reports a plain expired orphan; does not report a pane whose only recent lease was superseded; does not report a pane whose only recent lease had its relay id recycled; picks the eligible orphan over a superseded predecessor that matches first; collects the same tabs the per-tab reader reports, in one sweep of the leases; reports no candidate when no lease names any of the worktree tabs. src/main/runtime/orca-runtime-tests/runtime-availability.spec.ts: starts unavailable with no authoritative window; reports the configured Windows terminal shell on status; reports floating workspace availability from settings on status; polls floating tabs with targeted PTY liveness and no repo/provider inventory; hydrates persisted tabs when the store cannot report repos; advertises browser screencast only when a renderer window is available; routes mobile Codex reset consumption through the account mutation coordinator; maps a definite pre-provider rejection into an authoritative current snapshot. Existing unrelated evidenceRuns retain their original scope; unchanged dated receipt objects do not validate changed source bytes or reduced selectors. No fresh gate execution or historical import-closure equivalence is claimed. Frozen current literal-import graph reaches these changed test bytes; unresolved local and computed edges remain debt, and current reachability is not historical execution or equivalent replacement evidence. Historical prior account (preserved verbatim): Audit2070 (sources2068/2069): Intentionally retire these low-value alarms without replacement: src/main/runtime/orca-runtime.test.ts: ordinary registration cleanup removes only await import('./orca-runtime-tests/hooks-and-hosted-review.spec'). src/main/ssh/ssh-multiplexer-transport-writer.test.ts: reports saturated epochs and their drain boundary exactly once. src/main/runtime/orca-runtime-tests/worktree-removal-archive-hook-gate.spec.ts: removes and records the waiver when the failure is explicitly overridden; removes without an override record when the hook succeeds; removes when the hook is configured but not requested; removes when no archive hook is configured; holds a desktop removal in the same repo until this one is accepted; joins a desktop removal of the same worktree accepted while this one waited. src/main/runtime/orca-runtime-tests/worktree-ps-agent-row-dismissal.spec.ts: drops the row as soon as the user dismisses it, without waiting for the PTY to exit; tells paired clients to republish on the transition and on the dismissal; rejoins a row through its %s handle after pane ownership clears. src/main/runtime/orca-runtime-tests/hooks-and-hosted-review.spec.ts: reports an error when the SSH filesystem provider is unavailable; reports an SSH orca.yaml as an error without reading any filesystem; reports ok for a local repo hook check; reads SSH issue commands as absent and drops writes without touching any filesystem; allows host integration slug helpers for SSH repos through provider-aware GitHub clients; routes runtime GitHub repo identity helpers through the selected WSL project runtime; routes runtime GitHub issue and work-item actions through the selected WSL project runtime; pins explicit origin preference on runtime open-by-number work item lookups; forwards check-details cancellation without local Git overrides. Existing unrelated evidenceRuns retain their original scope; unchanged dated receipt objects do not validate changed source bytes or reduced selectors. No fresh gate execution or historical import-closure equivalence is claimed. Frozen current literal-import graph reaches these changed test bytes; unresolved local and computed edges remain debt, and current reachability is not historical execution or equivalent replacement evidence. The historical receipt/currentCommand selecting src/main/ssh/ssh-multiplexer-transport-writer.test.ts remains historical and is not a passing result for the reduced current command. Historical prior account (preserved verbatim): Audit1931 (sources1928/1929): Delete the complete tail-wait memo suite: its sole current authored callback checks supplied fromTail/blocked field values. Retire all three broader memoization/equivalence/eviction assertion aliases; they are not backed by retained source callbacks. No scan-work budget, sustained output, physical terminal or resource measurement is assigned to this removed test. Preserve meaningful remaining selectors/assertions and unchanged dated receipts within their original scope. Reduced selectors have no fresh gate execution evidence in this metadata packet. No equivalent replacement, physical watcher/PTY/provider, live SSH/remote/mobile, rendered, cross-platform, soak or measured-budget result is claimed. Historical prior account (preserved verbatim): Audit1674 retires changed-source assertion and execution scope without equivalent replacement coverage. Existing unchanged-selector receipts remain scoped to their original sources. Historical prior-source oracle: Existing exact unchanged-selector receipts remain the only current execution evidence. Changed source selectors have no fresh execution result. Historical prior-source oracle account: The current executable slice injects main-process renderer backlog pressure, then asserts ordinary terminal-wait detection without a joined-tail allocation and with full prompt-family continuity, per-PTY and total pending-output caps, a 1,024-ID projection cap with split-remainder compaction, preserved sequenced-tail metadata, active-pending protection ahead of background trimming, exact provider-generation pause ownership, renderer exit/data ordering, and ACK-gated in-flight bounds. The negotiation seam proves every initial connection and reconnect offers V1, the same-build relay advertises V1 without launch flags, old clients remain token-free, and method-not-found peers fall back without installing source ACK publication. The joined source-intake/multiplex oracle blocks renderer or headless serialization, admits one snapshot-covered span and one trailing span, requires replacement reservation only after the authoritative sequence is known, advances upstream ACK eligibility exactly to the covered boundary after SnapshotEnd, and delivers then ACKs the trailing span through the ordinary live path without cancellation. Source-range ledger and multiplex seams additionally require cumulative byte ACK 40 then 100 for one 100-byte frame to release exact byte credit without early source settlement, admit a contiguous higher-generation recovered token while the prior token remains unsettled, and reject stale stream or source generations without releasing in-flight byte credit. Replacement reservation rolls back every earlier span on a later failure, commit requires the exact frozen transfer states, and an authoritatively reclaimed covered span rejects commit without local trim authority while rollback removes the reservation idempotently. The exit-deadline oracle publishes a source-backed desktop projection, advances a fake clock to cancellation, and requires one projection transfer, proof commit, preparation, and final exit with no provider close, retained obligation, duplicate finalization, or process-lifetime cancellation tombstone; a second controlled proof remains pending across generation close and must never publish final exit, while both paths release the renderer preparation lease exactly once. The model-migration oracle accepts span A, blocks span B's raw emulator completion, begins disconnect migration, and proves no checkpoint or reconnect attach can remain at A; releasing B advances the exact checkpoint to B and projects B once. Its fake-clock arm reaches the 10-second deadline, requires checkpoint-unavailable, one exact model reset, zero retained admission charge and timers, and no effect from late raw settlement. Its two-PTY failure arm rejects one running raw callback under an active exact migration and requires one checkpoint-unavailable result, one model reset, zero provider closes, retained sibling checkpoint and transport liveness, zero charges and timers, and an unaffected other generation; a non-migrating sibling oracle still requires generation close. The intake additionally closes 2,048 sequential provider generations into one exact range, rejects stale events across that range, and preserves an out-of-order live gap until its own close. Direct-SSH contracts additionally prove activation-response settlement before the first source frame, claim-gated projection under same-decoder-turn response/data delivery, exact early-ACK reservation through send settlement or same-token retry, recovery completion visible before lease-held frames transfers those frames only into the private quarantine and admits no output until exact checkpoint-to-recoveryEnd coverage, invalid-checkpoint restore retention through response settlement followed by fresh-token retry and one live source frame, isolated saturated-subscriber eviction with healthy owner liveness, preserved legacy-primary backpressure, one-write ownership across write(false)/drain, control selection ahead of queued ordinary PTY input with FIFO lanes and bounded fairness, liveness rebasing, failed-exit retention through late ACK or exact recovery, response-settlement cancellation authority, token-scoped exit cancellation, exact checkpoint-to-recoveryEnd continuity, stale-owner one-shot retry, no physical PTY teardown on recovery failure, exact provider-generation closure and once-only cleanup when recovery cancellation publication or proof rejects, 16 MiB-plus-1 MiB decoder caps, charged per-PTY/session retention budgets, and eight-wide isolated reattach. The live Electron perf oracle adds hidden-output floods, renderer scheduler queue depth, dropped-output-zero normal scenarios, and active key latency budgets before promotion.", "commands": [ "pnpm exec vitest run --config config/vitest.config.ts", "pnpm exec vitest run --config config/vitest.config.ts src/main/runtime/construction/orca-runtime.test.ts", @@ -9375,7 +9378,8 @@ "Audit3246 retires NewRowsMarker reveal/no-repeat and pane-scoped beforeinput checks; skill-owner option availability/count/dedup/order; six styled Input/Textarea IME forwarding rows; the static Codex/OpenCode smart-key inventory; tab-map AST ratchet diagnostic fixtures; child-roster work-budget and retained-aggregate alarms; malformed persisted floating-cwd fallback/no-crash/empty exact-root checks; the unanswered-host empty-list discriminator; the direct invalidated-cache commit-false assertion; one redundant digit-keyup IME row; cached non-supported Claude title-generator rows; and the duplicate late naming-result singleton. These root broad commands lose those specific alarms without equivalent replacement. Distinct retained owner/state checks have their own bounded claims; the real scheduler still rejects stale response data, while the direct false-return alarm is retired.", "Audit 3256 removes these specific alarms from the broad root unit commands: skill dialog active-share selection, close and pending-share handoff; simple keyed-record deletion; marker live-region insertion, simple landing and nine baseline policy examples; General search/control navigation inventory; orphan-count cache bootstrap; seven Codex code classifications and HTTP 429 warning mapping; two skill unread-root verdict examples; peer-mail payload and conversation-ID rejection; and the GitHub organization TABLE text-field optimistic rollback/failed-envelope example. These include real behaviors; retained tests do not provide equivalent coverage for every removed scenario. Mobile losses are recorded separately and are not coverage of these root commands.", "Audit 3273 removes 14 authored declarations and 19 expanded scenarios across four whole suites and eight partial suites. Retired alarms cover saved-local cancellation/layout ownership, ambiguous-owner warning reset, folder attachment routing, VM false-capability bypass, abandoned reveal warmup cleanup and viewport claim deduplication/rearming, quiet unrelated remote-removal refusal, startup-command one-shot consumption, repository/floating recovery-ledger rows, fake-React pinned-scroll intent, split-ratio state identity/subscriber suppression and fractional change, cross-host project-group join refusal, three PR request-lifetime permutations, upstream-status preservation on error, and unresolved Git-owner refusal. These regression checks are intentionally lost under the test-value audit; retained scenarios are not equivalent replacements. Historical coverage receipts remain historical, including gate35 subscriber claims.", - "Audit 3283 removes 20 authored declarations and 31 expanded scenarios, including two whole suites. Retired alarms cover PR refresh-state pruning, shared runtime subscription cleanup and store isolation, language content-change routing and older completion ownership, ordinary panel retry-timer cleanup and pending loading, four hosted-review lifetime permutations, mocked terminal creation error/order wiring, five sleep-inventory variants with pending-frame-only assertions, palette fallback/composite highlights, Windows/UNC encoded-editor input rows, mixed-repository partial failure counts, title setters and generated-title bypass/replacement, five window-close coordinator delegation/guard/finally branches, and ambiguous-old-record frame reveal. These regression checks are intentionally lost under the test-value audit; retained cases are not equivalent replacements. Prior coverage notes and receipts remain historical." + "Audit 3283 removes 20 authored declarations and 31 expanded scenarios, including two whole suites. Retired alarms cover PR refresh-state pruning, shared runtime subscription cleanup and store isolation, language content-change routing and older completion ownership, ordinary panel retry-timer cleanup and pending loading, four hosted-review lifetime permutations, mocked terminal creation error/order wiring, five sleep-inventory variants with pending-frame-only assertions, palette fallback/composite highlights, Windows/UNC encoded-editor input rows, mixed-repository partial failure counts, title setters and generated-title bypass/replacement, five window-close coordinator delegation/guard/finally branches, and ambiguous-old-record frame reveal. These regression checks are intentionally lost under the test-value audit; retained cases are not equivalent replacements. Prior coverage notes and receipts remain historical.", + "Audit 3292 combines adopted 3285/3287/3289/3293 removals: 40 authored declarations and 47 expanded scenarios, including whole frame-editor-view, ambiguous remote-delete-refusal, unverifiable-host subscription and editor-close cleanup suites. The previously reviewed dock-badge suite was already removed upstream in PR 40895 and receives zero new removal credit. Intentionally retired alarms include background browser selection and last-tab landing; main startup fallback, SSH project cleanup/survivor routing, exact-PR contradiction/saved-push positives, replay/sidecar rollback and wrapped remote error normalization; records/snapshot missing-diff hydration, ambiguous folder-owner delete refusal, focus no-op notifications, nested editor context-only cache check, pending broadcast-first status and ordinary four-confirmation aggregation; preview-source frontmatter pruning, approved local/runtime agent dispatch, non-GitHub legacy PR cache invalidation, stale merged-head transient-error fallback, empty-queue immediate query reply and unverified-to-concrete preflight risk. Additional intentionally retired alarms are injected host subscription/unsubscribe counts, synthetic editor reveal/draft/fallback/scoped close, ambiguous unread refusals and hidden mark/read roundtrip, immediate connect backoff/noError, positive mirrored evidence-clock renewal, supplied VM failure/success projections and git-local/folder-SSH wake permutations. Remaining temporal/ownership cases are narrower; no equivalent replacement or fresh execution is claimed." ], "demotionRule": "Cannot promote without metric artifacts and bounded-byte assertions." }, @@ -11838,14 +11842,14 @@ "providers": ["local", "daemon", "ssh"], "coveredPlatforms": ["macos"], "coveredProviders": ["local"], - "coverageNotes": "Audit3086: retire the immediate-reply ceiling and thrown renderer-write recovery aliases. Narrow FIFO coverage to deferred preconnect validation and teardown coverage to natural-exit stale ordinary/accepted tails; live acknowledged barriers and disconnect/detach branches are intentionally retired. Prior queue cleanup and unchanged Electron receipts remain exact; no replacement or fresh execution is claimed. Audit1878 retires the dated reduced-source unit receipt. Only the unchanged macOS local Electron receipts remain current, scoped to their exact commands; reduced unit selectors and SSH have no current execution receipt. Historical pre-audit coverageNotes: Deterministic renderer and IPC-transport tests prove count and text ceilings, oldest-reply shedding, explicit query-reply source routing, ordinary-input preservation, acknowledged-write FIFO barriers, single-worker drain reentrancy, one-reply-per-write delivery for OSC, DA1, and CPR replies, real xterm OSC reply generation, drain-failure containment, teardown settlement, and clear/reuse generation fencing. Remote-runtime tests preserve separate query-reply writes across pending input, async validation, and viewport-claim buffering. Host-contract tests prove a later DA1/CPR reply cannot overtake a deferred OSC reply, including a coalesced legacy-client payload. Live macOS Electron tests cover local PTY OSC replies and interactive typing; a macOS-hosted Docker OpenSSH test proves an upstream-node-pty Linux relay keeps OSC/DA1 replies out of the next fish child's stdin. No live daemon, paired-runtime, WSL, physical Linux/Windows client, or binary mixed-version run is registered.", + "coverageNotes": "Audit 3292 retires the empty-queue immediate query-reply delivery example from remote-runtime-pty-query-reply-immediate.test.ts. Pending ordinary-input separation and asynchronous paste-validation ordering cases remain byte-identical, matching the existing assertion reference. The no-pending-input delivery alarm is intentionally lost without equivalent replacement. Existing selectors, unchanged local Electron receipts and historical receipts remain exact; no new runtime, PTY deadline, platform or mixed-version result is claimed. Audit3086: retire the immediate-reply ceiling and thrown renderer-write recovery aliases. Narrow FIFO coverage to deferred preconnect validation and teardown coverage to natural-exit stale ordinary/accepted tails; live acknowledged barriers and disconnect/detach branches are intentionally retired. Prior queue cleanup and unchanged Electron receipts remain exact; no replacement or fresh execution is claimed. Audit1878 retires the dated reduced-source unit receipt. Only the unchanged macOS local Electron receipts remain current, scoped to their exact commands; reduced unit selectors and SSH have no current execution receipt. Historical pre-audit coverageNotes: Deterministic renderer and IPC-transport tests prove count and text ceilings, oldest-reply shedding, explicit query-reply source routing, ordinary-input preservation, acknowledged-write FIFO barriers, single-worker drain reentrancy, one-reply-per-write delivery for OSC, DA1, and CPR replies, real xterm OSC reply generation, drain-failure containment, teardown settlement, and clear/reuse generation fencing. Remote-runtime tests preserve separate query-reply writes across pending input, async validation, and viewport-claim buffering. Host-contract tests prove a later DA1/CPR reply cannot overtake a deferred OSC reply, including a coalesced legacy-client payload. Live macOS Electron tests cover local PTY OSC replies and interactive typing; a macOS-hosted Docker OpenSSH test proves an upstream-node-pty Linux relay keeps OSC/DA1 replies out of the next fish child's stdin. No live daemon, paired-runtime, WSL, physical Linux/Windows client, or binary mixed-version run is registered.", "motivatingLinks": [ "https://github.com/stablyai/orca/issues/13137", "https://github.com/stablyai/orca/issues/7329", "https://github.com/stablyai/orca/issues/13892" ], "invariant": "The desktop PTY input queue retains at most 64 explicitly sourced pending terminal query replies and 4096 UTF-16 code units. Every retained reply reaches the provider as one atomic write, and ordinary, acknowledged, and reply input share one invocation-ordered FIFO so no later write overtakes an acknowledged write. Reentrant write callbacks cannot start a second drain worker or strand input admitted after clear/reuse. A reply's own echo is contained on the output side by projecting its known echo shapes; the ESC-initial verbatim shape is matched only when complete, never held as a partial, so a query torn at its own ESC is still answered. Overflow removes only the oldest query replies, never ordinary input except the documented modified-F3/CPR byte collision, and failure or teardown cannot clear a newer queue generation or strand an acknowledged promise.", - "oracle": "Audit3086: retire the immediate-reply ceiling and thrown renderer-write recovery aliases. Narrow FIFO coverage to deferred preconnect validation and teardown coverage to natural-exit stale ordinary/accepted tails; live acknowledged barriers and disconnect/detach branches are intentionally retired. Prior queue cleanup and unchanged Electron receipts remain exact; no replacement or fresh execution is claimed. Audit1878 retires the dated reduced-source unit receipt. Only the unchanged macOS local Electron receipts remain current, scoped to their exact commands; reduced unit selectors and SSH have no current execution receipt. Historical pre-audit oracle: Synchronously enqueue separate 10,000-entry OSC and DA1 reply floods before the scheduled drain and assert that only the initial immediate reply and newest 64 pending replies are written, each as one provider write, before a trailing keystroke. Stall an acknowledged write between earlier and later ordinary/reply input, then require teardown to settle it and same-id reuse to receive no stale tail. Reenter the queue synchronously from an acknowledged write with both enqueue and clear/reuse, requiring one drain and fresh input delivery only after the stale acknowledged write settles false. At the host boundary, defer an OSC reply and assert that separate or legacy-coalesced DA1/CPR replies flush after it in observed query order. At the remote-runtime boundary, preserve separate writes around pending ordinary input, async validation, and viewport-claim buffering. Repeat behind 10,000 ordinary inputs and exercise the text ceiling, real xterm generation, provider-write failure, rejected yield, and clear/reuse generation fencing.", + "oracle": "Audit 3292 retires the empty-queue immediate query-reply delivery example from remote-runtime-pty-query-reply-immediate.test.ts. Pending ordinary-input separation and asynchronous paste-validation ordering cases remain byte-identical, matching the existing assertion reference. The no-pending-input delivery alarm is intentionally lost without equivalent replacement. Existing selectors, unchanged local Electron receipts and historical receipts remain exact; no new runtime, PTY deadline, platform or mixed-version result is claimed. Audit3086: retire the immediate-reply ceiling and thrown renderer-write recovery aliases. Narrow FIFO coverage to deferred preconnect validation and teardown coverage to natural-exit stale ordinary/accepted tails; live acknowledged barriers and disconnect/detach branches are intentionally retired. Prior queue cleanup and unchanged Electron receipts remain exact; no replacement or fresh execution is claimed. Audit1878 retires the dated reduced-source unit receipt. Only the unchanged macOS local Electron receipts remain current, scoped to their exact commands; reduced unit selectors and SSH have no current execution receipt. Historical pre-audit oracle: Synchronously enqueue separate 10,000-entry OSC and DA1 reply floods before the scheduled drain and assert that only the initial immediate reply and newest 64 pending replies are written, each as one provider write, before a trailing keystroke. Stall an acknowledged write between earlier and later ordinary/reply input, then require teardown to settle it and same-id reuse to receive no stale tail. Reenter the queue synchronously from an acknowledged write with both enqueue and clear/reuse, requiring one drain and fresh input delivery only after the stale acknowledged write settles false. At the host boundary, defer an OSC reply and assert that separate or legacy-coalesced DA1/CPR replies flush after it in observed query order. At the remote-runtime boundary, preserve separate writes around pending ordinary input, async validation, and viewport-claim buffering. Repeat behind 10,000 ordinary inputs and exercise the text ceiling, real xterm generation, provider-write failure, rejected yield, and clear/reuse generation fencing.", "commands": [ "pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/components/terminal-pane/pty-transport/input/pty-input-write-queue.test.ts src/renderer/src/components/terminal-pane/pty-transport/ipc/pty-transport-input-write.test.ts src/shared/terminal/protocol/queries/terminal-query-reply.test.ts src/shared/terminal/pty/ingress/pty-startup-ingress-live-query-reply.test.ts src/shared/terminal/pty/ingress/pty-startup-reply-echo-shapes.test.ts", "pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/components/terminal-pane/pty-transport/remote-runtime/output/remote-runtime-pty-batching.test.ts src/renderer/src/components/terminal-pane/pty-transport/remote-runtime/remote-runtime-pty-query-reply-immediate.test.ts src/renderer/src/components/terminal-pane/pty-transport/remote-runtime/remote-runtime-pty-transport-input-coalescing.test.ts", @@ -11976,7 +11980,8 @@ "Reply overload intentionally sheds the oldest synthetic replies; the modified-F3/CPR byte collision shares that budget, and live application behavior under a pathological query flood is not measured.", "Audit1878 retires this complete dated receipt because a source in its selector was reduced. It does not validate the reduced selector. Original receipt verbatim:\n{\n \"date\": \"2026-08-30\",\n \"runner\": \"local\",\n \"platform\": \"macos\",\n \"command\": \"pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/components/terminal-pane/pty-input-write-queue.test.ts src/renderer/src/components/terminal-pane/pty-transport-input-write.test.ts src/shared/terminal-query-reply.test.ts src/shared/pty-startup-ingress-live-query-reply.test.ts src/shared/pty-startup-reply-echo-shapes.test.ts\",\n \"currentCommand\": \"pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/components/terminal-pane/pty-transport/input/pty-input-write-queue.test.ts src/renderer/src/components/terminal-pane/pty-transport/ipc/pty-transport-input-write.test.ts src/shared/terminal/protocol/queries/terminal-query-reply.test.ts src/shared/terminal/pty/ingress/pty-startup-ingress-live-query-reply.test.ts src/shared/terminal/pty/ingress/pty-startup-reply-echo-shapes.test.ts\",\n \"result\": \"passed\",\n \"durationSeconds\": 15,\n \"summary\": \"Five files and 149 tests passed in 15.16 seconds, including explicit IPC reply-source routing, the 10,000-reply count and text ceilings, 10,000-entry ordinary backlog preservation, acknowledged-write FIFO barriers, synchronous reentrancy fencing, prompt teardown settlement, same-id generation fencing, real xterm OSC query floods, single-shot drain-failure recovery, and one-reply-per-write echo containment.\"\n }", "Audit1878 removes standalone reply-classifier inventory, ordinary-keystroke helper/no-write checks and a latency-order title that never executes the host path from pty-startup-ingress-live-query-reply.test.ts. It also removes projection needle/refusal/holdPartial and ConPTY/WSL string/array inventories from pty-startup-reply-echo-shapes.test.ts, including the direct short-needle and ESC-hold guard alarms. Captured echo matching and actual ingress writes/output state remain, without equivalent replacement coverage. Only the two unchanged macOS local Electron receipts remain active; neither proves the reduced five-file unit selector, SSH, a new soak result, or a new measured budget.", - "Audit3086: retire the immediate-reply ceiling and thrown renderer-write recovery aliases. Narrow FIFO coverage to deferred preconnect validation and teardown coverage to natural-exit stale ordinary/accepted tails; live acknowledged barriers and disconnect/detach branches are intentionally retired. Prior queue cleanup and unchanged Electron receipts remain exact; no replacement or fresh execution is claimed." + "Audit3086: retire the immediate-reply ceiling and thrown renderer-write recovery aliases. Narrow FIFO coverage to deferred preconnect validation and teardown coverage to natural-exit stale ordinary/accepted tails; live acknowledged barriers and disconnect/detach branches are intentionally retired. Prior queue cleanup and unchanged Electron receipts remain exact; no replacement or fresh execution is claimed.", + "Audit 3292 retires the empty-queue immediate query-reply delivery example from remote-runtime-pty-query-reply-immediate.test.ts. Pending ordinary-input separation and asynchronous paste-validation ordering cases remain byte-identical, matching the existing assertion reference. The no-pending-input delivery alarm is intentionally lost without equivalent replacement. Existing selectors, unchanged local Electron receipts and historical receipts remain exact; no new runtime, PTY deadline, platform or mixed-version result is claimed." ], "demotionRule": "Keep experimental or revert if ordinary input is evicted, pending replies exceed either ceiling, retained replies are coalesced, a trailing key sits behind more than the bounded reply window, or the gate develops unexplained flakes." }, @@ -12743,14 +12748,14 @@ "providers": ["local", "remote-runtime", "ssh"], "coveredPlatforms": ["macos", "linux"], "coveredProviders": ["local", "remote-runtime", "ssh"], - "coverageNotes": "Audit 3283 removes 20 authored declarations and 31 expanded scenarios, including two whole suites. Retired alarms cover PR refresh-state pruning, shared runtime subscription cleanup and store isolation, language content-change routing and older completion ownership, ordinary panel retry-timer cleanup and pending loading, four hosted-review lifetime permutations, mocked terminal creation error/order wiring, five sleep-inventory variants with pending-frame-only assertions, palette fallback/composite highlights, Windows/UNC encoded-editor input rows, mixed-repository partial failure counts, title setters and generated-title bypass/replacement, five window-close coordinator delegation/guard/finally branches, and ambiguous-old-record frame reveal. These regression checks are intentionally lost under the test-value audit; retained cases are not equivalent replacements. Prior coverage notes and receipts remain historical. Audit 3273 removes 14 authored declarations and 19 expanded scenarios across four whole suites and eight partial suites. Retired alarms cover saved-local cancellation/layout ownership, ambiguous-owner warning reset, folder attachment routing, VM false-capability bypass, abandoned reveal warmup cleanup and viewport claim deduplication/rearming, quiet unrelated remote-removal refusal, startup-command one-shot consumption, repository/floating recovery-ledger rows, fake-React pinned-scroll intent, split-ratio state identity/subscriber suppression and fractional change, cross-host project-group join refusal, three PR request-lifetime permutations, upstream-status preservation on error, and unresolved Git-owner refusal. These regression checks are intentionally lost under the test-value audit; retained scenarios are not equivalent replacements. Historical coverage receipts remain historical, including gate35 subscriber claims. Audit 3256 removes these specific alarms from the broad root unit commands: skill dialog active-share selection, close and pending-share handoff; simple keyed-record deletion; marker live-region insertion, simple landing and nine baseline policy examples; General search/control navigation inventory; orphan-count cache bootstrap; seven Codex code classifications and HTTP 429 warning mapping; two skill unread-root verdict examples; peer-mail payload and conversation-ID rejection; and the GitHub organization TABLE text-field optimistic rollback/failed-envelope example. These include real behaviors; retained tests do not provide equivalent coverage for every removed scenario. Mobile losses are recorded separately and are not coverage of these root commands. Audit3246 retires NewRowsMarker reveal/no-repeat and pane-scoped beforeinput checks; skill-owner option availability/count/dedup/order; six styled Input/Textarea IME forwarding rows; the static Codex/OpenCode smart-key inventory; tab-map AST ratchet diagnostic fixtures; child-roster work-budget and retained-aggregate alarms; malformed persisted floating-cwd fallback/no-crash/empty exact-root checks; the unanswered-host empty-list discriminator; the direct invalidated-cache commit-false assertion; one redundant digit-keyup IME row; cached non-supported Claude title-generator rows; and the duplicate late naming-result singleton. These root broad commands lose those specific alarms without equivalent replacement. Distinct retained owner/state checks have their own bounded claims; the real scheduler still rejects stale response data, while the direct false-return alarm is retired. Audit3231 retires supported-host restore-pane key mapping, closed/open creation-sidebar toggle visibility, unrelated scope-error/null classification and quick-submit reveal/no-create checks. These broad commands lose those real narrow alarms; no replacement coverage is claimed. Audit3219 removes the synthetic Cmd+J extra-source suite; this broad command no longer checks its match/tie placement and selection, announced count, empty-query cap, or workspace hiding with retained recent tabs. No replacement coverage is claimed. Audit3209 composes approved sources3202/3206: deliberately retires seven authored/expanded cases in four whole suites without equivalent replacement. Work-item queries lose real GitHub/GitLab oversized ASCII secret-prefix empty-query and whitespace-before-trim refusal alarms; inputs share the imported size bound and exercise only its fast length branch, with no multibyte or actual provider/exposure guarantee. Skill sharing loses complete/partial managed-bundle and destination-ambiguity association checks plus three negative origin/path/scheme admission examples; these do not establish uploaded contents, arbitrary-URL fetching, authorization or execution. Retain exact originless-project direct-link fallback, cloud-delete confirmation, bundled-target repair/owner isolation and explicit Windows-host preference over stale WSL suites. Rejected3201 runtime-preference removal is excluded. No real cloud/network/host/disk, mobile or mixed-version execution validation is claimed. Audit3200 composes approved source3194: deliberately retires thirteen authored registrations/twenty-seven expanded cases in six whole automation host/list policy suites without equivalent replacement. Real RPC category/retryability and wrapped-timeout recognition, unscoped-failure/scoped-success health evidence precedence, exact-ID create selectors and per-run workspace omission, paired-web local/SSH/absent host catalog routing, incompatible/removed/unhydrated/offline execution health, runtime-before-nested-SSH recovery dispatch, and no-owned-focus/successor/foreign-list focus policy alarms are consciously lost. Retain exact20line orphan allow/refuse/precondition and exact90line cross-host same-ID search suites. No retry-timer/fence lifecycle, actual reconnect/network/write delivery, native focus, mobile/mixed-version runtime or disk persistence coverage is claimed. Audit3191 combines approved source3182/3187/3188: deliberately retires thirteen authored Vitest registrations and fifteen expanded cases, including five whole suites, without equivalent replacement. Attachment intake loses real portal/native-capture terminal interception and unowned-container refusal, immediate child-only committed availability/claim-ref negotiation and delivery, and direct-target over stable focused/background composer routing through disable/re-enable/remount and independent question focus. Exact destination/cache/draft and final-stat owner/workspace/File-release suites remain; they do not replace Surface recipient routing. Automation authoring loses destination runtime catalog membership, local/direct-SSH exclusion of paired-runtime repos, unknown-runtime empty catalog, logical project/host/setup/repo/path context payload, and missing/nonready setup refusal; these were genuine direct helper alarms, while exact schedule transformation, legacy schedule and setup-decision suites remain. Agent picker loses setup-chat/terminal/missing-installer/unsupported-or-unknown-host row projection samples and the ordinary unsearched menu variant; the entire original26-line resume recipe suite remains, including reported bypass versus default/absent permission modes, as does the exact search-result menu callback with its fixtures, model/effort commits and staged Arguments reopen outcome. Rejected predecessor3180 full recipe deletion is excluded. No actual native drag/cursor/focus/IME, upload bytes or disk/restart persistence, full automation save/scheduler/runtime transport, real resume-process flags/environment delivery, or native menu/rendered layout validation is claimed. Audit3178 combines source3169/3170/3175: deliberately retires eight authored units (six Vitest cases and two imperative custom relay scenarios), including two whole suites, without equivalent replacement. Voice Section loses per-model pending-delete isolation across interleaved A/B completion and the two-success refresh-call alarm; exact VoicePane delayed key-clear/newer enabled-toggle merge remains and does not replace row deletion coverage. Speech loses dedicated rating-scale/inclusive-ceiling, unsupported-versus-unmeasured, explicit/system-language precedence/locale alias, accuracy versus fast named/default/best-measured selection, and unmeasured/no-match examples; exact offered-user-pick versus retired-selection case and its fixture remain. Relay loses legacy ping-delivery count/liveness sampled before the silence deadline and grouped malformed Bearer/host-ID 401/429 routing checks; twelve real Worker/DurableObject/shipped-client scenarios remain, not equivalent replacement for those narrow alarms. Six prior speech cases are not all deleted: approved successor3175 keeps the original user-choice case. No actual credential/file persistence, native/GPU/engine/download delivery, production assignment policy or deployed-runtime validation is claimed by this reduction. Audit3165 combines source3160/3162: deliberately retires six authored/expanded cases across three whole suites without equivalent replacement. Launch/status losses: observed React-render pending/resuming coordination across settings and deferred offer read; stale-offer reread suppressing dialog reopen; held-local-chat recovery visibility with new-chat preferences off; disabled-local admission avoiding offer RPC despite an injected but unconsumed paired-tab fixture; and run-only lost-reply uncertainty reachability until direct viewed-run retirement. Launch probe does not prove arbitrary synchronous-store atomicity, the paired fixture is not remote runtime enrollment, and the status case directly marks viewed state rather than rendering the summary. Crew-hook losses: old-host method_not_found cache persists across party changes but is released by independently supplied connection generation/verified pairing status or pairing revision, with actual frame publication and teardown. These are real narrow coordination, admission, uncertainty and mixed-version cache alarms consciously lost. Exact web verified-runtime writer handoff guard remains; it does not replace those alarms or prove live host/native/mobile delivery. Audit3156 combines3147/3150/3152/3153/3154: deliberately retires39authored/40expanded native-chat recovery cases, eight whole suites and two orphan test-support files without equivalent replacement. Lost alarms: lost-reply unconfirmed reconciliation, skipped rows/counts and missed-frame repair, unknown/pending outcome and omitted-failure-list compatibility, uncertain history after dismissal, retry/refusal/dismiss lifecycle, hidden/consumed picker ownership, result-tree keyboard focus/disclosure and all-skipped retirement; unconfirmed-over-conflict guidance and failed-chat changes despite older host timestamps; nearest-listed ancestor/cyclic forest shape, descendant membership, host ordering/missing-host local fallback; skipped/readiness/admission counts, provisional skip/progress monotonicity, early per-chat verdicts with batch pending protection, older-host waiting, start-slot/delivery distinction, retry-over-failure and unknown-after-withdrawal attention; remote snooze/reconnect/reoffer, unseen mixed summary through open/close, watched completion retirement, new success beside old failure, failed-reread mixed-result preservation, filter/collapse completion resets, retry summary replacement and current-offer/history selection; cross-host workspace identity, rendered cyclic reachability, nested tri-state/toggle propagation, project eligibility isolation and collapse preserving selection. Exact fallback-list completion barrier, batched verdict/cleanup retention, stale-read versus dismissal publication race, and requested-but-never-rendered finished-run retirement remain; they do not replace retired alarms. Audit3146 combines source reviews3132/3133/3135/3138/3143: intentionally retire20authored/31expanded cases without equivalent replacement. Provider-session losses: structured-native terminal-resume exclusion, metadata-less completed identity, new-turn completion clearing, Pi provider-only/periodic/manual promotion, changed-transcript launch-config isolation, Pi/omp/prime-agent completed-session remote/manual-shutdown promotion, and quit/done precedence over heartbeat. Side-thread/question losses: finished-pane acquisition, hidden title/recap states, local/relay/relay-done conversation takeover with prompt/session/child resets, plain-message abandonment, compaction/session replacement and completion resets. Codex startup losses: incoming-owner cached child replacement, old-relay foreign live-session correction, completed foreign-root turn-fact permutations. Transcript losses: real temporary-JSONL partial sibling/final-child completion, unlabelled child attribution, compact cached replay preservation and100/1000completed-child roster retention/release. Compiler-ratchet losses: valid-line uncompiled-list parser grammar examples and injected-existence stale-path filtering; these did not exercise actual filesystem canonicalization or build exclusion. These are real lifecycle, ownership, replay, liveness and retention alarms, including recent#40246 regressions, deliberately lost. Retained conditional record replacement, clockless root/SSH owner isolation, persisted main-thread fork rejection, partial/final question-answer lifetime, cached-roster/missing-ID/live HTTP/durable startup boundaries and restarted-relay refusal/acceptance do not replace those losses. No native/SSH/WSL execution or equivalent coverage is claimed. Audit3128 scoped coverage reduction: Audit3121 removes VoiceDictationLanguageSetting.test.tsx (Spanish-to-es callback and unsupported-model Korean option presence) and voice-speech-model-rows.test.ts (provider/language-order/retired-on-disk list policy); these real narrow alarms are deliberately retired without replacement. VoiceSpeechModelSection per-model concurrent deletion remains unchanged. Audit3122 removes the direct absolute/parent-segment sparse-directory exception-type sample and the five-row IPC sparse-preset error-code/non-save table (two authored/six expanded cases). Those real typed-validation and IPC refusal/error-code alarms are deliberately retired. Keep both real symlink/junction floating-directory trust cases and the minimal RPC structured validation-reason serialization case. The RPC case does not replace IPC save/refusal behavior, typed normalization for both path inputs, actual Git sparse checkout or rendered localization. No equivalent replacement or fresh test/runtime/platform/remote/performance validation is claimed. Audit3124 removes ExperimentalPane.test.tsx (ordinary Pet switch callback), WorkspaceDirectorySetting.test.tsx (padded absolute saved-path normalization/no-write blur), and repository-search.perf.test.ts (navigation/selected-pane builder-call policy, fixture cardinality/nonempty entries and renamed project keyword inclusion). These real narrow alarms are retired without replacement; RepositoryPane.search.test.tsx search-to-sparse-editor request remains unchanged. Audit3129: resolver Windows case-insensitive and POSIX case-sensitive configured-env composition plus mocked-base launch-preflight Windows composition are intentionally no longer checked by the two deleted suites. No equivalent coverage claimed. Keep runtime-structured-agent-host-env.test.ts unchanged: configured Windows Claude-home account identity and host-account precedence remain checked. Audit3114 incorporates source3101: retire three structured Claude child-environment wrapper cases covering inherited stamp isolation/default and explicit entrypoint, Windows SDK-key canonicalization/default/duplicate-key order, and configured lookup/final environment/config-dir conjunction. Keep direct auth/session sanitation and Windows-versus-Linux overlay checks, actual executable lookup from supplied inherited PATH, native Windows child environment delivery, and stale option-mutation fencing. These are not equivalent replacements for the retired wrapper alarms. No fresh test/runtime, real login-shell probe, Claude SDK startup, remote/mixed-version, UI or performance result is claimed. Audit3114 incorporates source3105: retire 17 authored/20 expanded daemon launch-note cases, including the entire two-case SessionLaunchNote suite. Deliberately lose split-marker carry across same-token re-arm, stale-token retirement refusal, foreground tri-state and serial settlement, omitted-note/no-incarnation mixed-version policy, sticky retirement, first-incarnation/replacement launch preservation and held-launch precedence. Keep only the unchanged unresolved foreground-read race against a later finished attach. Supplied notes/foreground and runtime calls do not establish actual daemon/main restart, SSH, native Windows observation, mobile UI, equivalent replacement or fresh runtime/performance validation. Audit3114 incorporates source3109: retire six authored/35 expanded pricing cases: 21 accepted model-name examples, 10 unsupported/future-model fail-closed examples, malformed TTL clamp, unknown-model estimate refusal, flat-model long-context disregard and oversized long-context clamp. Keep mixed five-minute/one-hour write allocation and short/all-long/mixed long-context allocation with original fixed oracles. Real parser/refusal/bounds alarms are knowingly lost without equivalent replacement; retained tests do not validate provider rates, actual billing or request threshold classification. Preserve the archived usage-scan-append source-freeze receipt without transferring historical execution/performance credit. No fresh runtime result is claimed. Audit3108 source-only reduction (3094/3095/3100): retire 27 authored/30 expanded cases, including complete markdown view-state, file-preview link-open and CLI agent-server-route suites, without replacement. Deliberate losses include preview visibility/reference lifetime and same-path owners; SSH stat, directory/missing-target, explicit-null owner, nonmarkdown line/column, local URI routing, remote-to-client guard and same-file reuse; document-preview source-owner/folder/reuse routing, stable grant location and outside-workspace POSIX/Windows request projection; and verified remote CLI send/check refusal, suggested --on argv/copy, shell no-probe bypass, unverified-launch admission and older-peer refusal. Retain two markdown source-runtime/qualified-reveal alarms, one stale grant-rejection fence and two remote read/mutation evidence policies, with original callbacks. Final last-wins reveal did not prove transient cancellation; CLI prerequisite did not prove no real send, and envelope tests do not execute server refusal. No fresh runtime, rendered UI, actual file/SSH/paired transport, authorization, mixed-version or performance result is claimed. Audit3096 source-only reduction (3087/3088): retire 69 authored/76 expanded cases, including complete recovery-portals and reconnect-banner suites. Intentionally lose dead/default TUI replay, generated alternate-frame style composition, reset/mode/dimension and legacy missing-mode-boundary alarms, UI notice/action/reveal policies, and isolated recovery lifecycle variants, without equivalent replacement. Retained registrations and callbacks are unchanged; headless cells are not pixels, and no fresh runtime, host, SSH, WSL, rendered-app or performance result is claimed. Audit3086 source-only reduction (3079/3080/3081): intentionally retire 93 authored/100 expanded mock-boundary cases, including the complete spawn-errors and SSH reconnect overlay suites, without replacement. Retired alarms include spawn classification/ownership, reply ceilings and renderer-write failure recovery, disconnect/detach fencing branches, authority facts, and overlay retry/visibility wiring. Retained callbacks are unchanged; no fresh execution, real PTY/SSH, rendered UI, or performance result is claimed. Audit2432: The broad unit command loses the isolated BranchPicker open-change notification sample. Its unique true/false callback alarm is intentionally retired; reopening/status-refresh behavior was not exercised. No equivalent replacement or fresh validation of the reduced selector is claimed. Audit2425: The broad unit command loses the workspace-copy-status supplied readError forwarding sample. It did not exercise the branch-switch blocking promised by its title. This alarm is intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2417: The broad unit command loses two ordinary clean Git cherry-pick/revert success samples and two terminal startup foreground-read work-budget samples. These unique alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2412: The broad unit command loses the whole six-case fake-React-hook scroll-anchor suite, two generic draft-retention samples, a simple new-agent order sample, a real history-publication batching-count sample, an unmounted handoff abort/timer sample and three basic WSL preview/error samples. These alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2404: The broad unit command loses the standalone share-name lookup 503 propagation suite, initial deletion placement-kind sample, direct changed-mtime stale sample, first-pass rollback existence example and abandoned-preparation directory sample. These exact alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2397 review amendment: The broad unit command loses three standalone suites, two partial-case definitions and two URL table rows across package/download/placement tests. Keep initial wrong-port authorization, modified independent-copy digest refusal and abort-after-begin cancellation dispatch. The remaining alarms are deliberately retired; no equivalent complete replacement or fresh validation of the reduced selector is claimed. Audit2393 current-parent refresh2401: Remove the basic skill-install service alias sample and original public managed-remove receiptless refusal case. Preserve the upstream request ownership suite and transaction interruption coverage. No equivalent complete replacement or fresh validation of the reduced selector is claimed. Audit2389: The broad unit command loses the missing-preview suite, plain-global destination sample and prepublished-receipt recovery example. No equivalent replacement or fresh validation of the reduced selector is claimed. Audit2385: The broad unit command loses four authored walker/staging/protocol examples (six expanded cases); no equivalent replacement or fresh validation is claimed for the reduced suite. Audit2383: The unscoped Vitest command no longer includes the removed Antigravity catalogue suite; its exact provider-root/owner example has no equivalent replacement or fresh validation claim. Audit2377/2381: The unscoped Vitest command includes the reduced bundled-skill and native-discovery suites; the eight removed backup/legacy/catalogue/symlink/SSH-builder examples have no replacement-equivalence or fresh validation claim here. Audit2133 current-parent preparation: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2095 current-parent preparation2126: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2090 (sources2088/2089): Current reduced suites intentionally retire the alarms listed in knownGaps; prior dated execution and replacement claims do not validate changed source bytes or selectors. Historical prior account (preserved verbatim): Audit2086 (sources2082/2083): Current reduced suites intentionally retire the alarms listed in knownGaps; prior dated execution and replacement claims do not validate changed source bytes or selectors. Historical prior account (preserved verbatim): Audit2076 (sources2073/2074): Intentionally retire these low-value alarms without replacement: src/main/runtime/orca-runtime-tests/terminal-handles-part-02.spec.ts: recovers a moved SSH pane through the tab it now sits in, not the one its lease froze; reports a plain expired orphan; does not report a pane whose only recent lease was superseded; does not report a pane whose only recent lease had its relay id recycled; picks the eligible orphan over a superseded predecessor that matches first; collects the same tabs the per-tab reader reports, in one sweep of the leases; reports no candidate when no lease names any of the worktree tabs. src/main/runtime/orca-runtime-tests/runtime-availability.spec.ts: starts unavailable with no authoritative window; reports the configured Windows terminal shell on status; reports floating workspace availability from settings on status; polls floating tabs with targeted PTY liveness and no repo/provider inventory; hydrates persisted tabs when the store cannot report repos; advertises browser screencast only when a renderer window is available; routes mobile Codex reset consumption through the account mutation coordinator; maps a definite pre-provider rejection into an authoritative current snapshot. Existing unrelated evidenceRuns retain their original scope; unchanged dated receipt objects do not validate changed source bytes or reduced selectors. No fresh gate execution or historical import-closure equivalence is claimed. Frozen current literal-import graph reaches these changed test bytes; unresolved local and computed edges remain debt, and current reachability is not historical execution or equivalent replacement evidence. Historical prior account (preserved verbatim): Audit2056 (sources2054/2055): Intentionally retire these low-value alarms without replacement: src/renderer/src/runtime/files/watching/runtime-file-client-watch.test.ts: delivers remote file changes to listeners for the same worktree. src/main/runtime/orca-runtime.test.ts: ordinary registration cleanup removes only await import('./orca-runtime-tests/mobile-session-tabs-part-14.spec'). src/main/runtime/orca-runtime-tests/terminal-side-effect-facts-part-03.spec.ts: arms the stale-title timer for a seeded working title; arms the Command Code scrape from the noted spawn command; prefers the tracked title over a stale renderer lastTitle in the hydration seed; writes recent output into the current runtime output map; uses a later title handler replacement with the runtime receiver; calls the current injected listener with the runtime receiver; keeps optional reconciliation lazy after its callback is removed. src/main/runtime/orca-runtime-tests/mobile-session-tabs-part-14.spec.ts: lists them, so a paired client can mirror a migrated editor; closes one by retiring it from the host session; keeps an unsaved draft unless the close is forced; shares aggregate work but leaves a replacement pending promise alone; lets a targeted refresh finish while an aggregate refresh waits; refuses a close when the store lacks %s before the guard; keeps a later missing %s on the original caught failure path. Existing unrelated evidenceRuns retain their original scope; unchanged dated receipt objects do not validate changed source bytes or reduced selectors. No fresh gate execution or historical import-closure equivalence is claimed. Exact retired assertionRefs, preserved as historical objects only: {\n \"file\": \"src/renderer/src/runtime/files/watching/runtime-file-client-watch.test.ts\",\n \"assertions\": [\n \"terminal watcher error and setup failure evict the shared entry before retrying callbacks run\",\n \"an old stream end cannot evict the replacement stream, which still delivers to its listener\",\n \"two same-worktree listeners share a synthetic subscription until the final stop unsubscribes and sends unwatch\"\n ]\n } Historical prior account (preserved verbatim): Audit1973: Delete the standalone mocked watcher cleanup suite and its entire sole-file prospective command. Retire the removed file-command transport-abort alias; preserve the independent cancellation suite and final-overflow/error/end cleanup callback, and13 unrelated receipt objects. Whole original changed dated receipts are retired, never narrowed or transferred. This metadata review claims no fresh execution, equivalent replacement, provider/PTY, live remote/mobile, rendered, cross-platform, soak or measured-budget result. Historical prior account (preserved verbatim): Audit1931 (sources1928/1929): Partial runtime files-watch suite retains controlled Windows close-event waiting, shared-client survival, late physical-exit ownership/deadline cleanup and shutdown joining. Its combined Windows close/deadline/late-exit alias remains backed by unchanged callbacks. Retire native-error-close, pre-publication setup ownership and failed-delete rearm aliases; associated delegation, failure forwarding, removal routing and recovery examples are lost. These tests inject watch/subscription seams and do not observe an actual native watcher or physical process. Preserve meaningful remaining selectors/assertions and unchanged dated receipts within their original scope. Reduced selectors have no fresh gate execution evidence in this metadata packet. No equivalent replacement, physical watcher/PTY/provider, live SSH/remote/mobile, rendered, cross-platform, soak or measured-budget result is claimed. Historical prior account (preserved verbatim): Audit1925 (sources1922/1923): Partial runtime watcher-host suite loses mocked option/event/overflow/resubscription forwarding, supplied teardown-error propagation, aborted-signal/no-call and private ten-thousand-waiter-count inventories. Retire the 10,000-caller bound and failed-recovery-subscriber-ending assertion aliases. Keep same-root owner cancellation, pre-ready replacement, held root-close join, stale-generation recovery delivery and initial failed-root ownership mappings backed by retained real-host callbacks with injected subscription/error/physical-exit promises. No actual native watcher, process termination or resource bound was observed. Preserve meaningful remaining selectors/assertions and unchanged dated receipts within their original scope. Reduced selectors have no fresh gate execution evidence in this metadata packet. No equivalent replacement, physical watcher/PTY/provider, live SSH/remote/mobile, rendered, cross-platform, soak or measured-budget result is claimed. Historical prior account (preserved verbatim): Audit1683 removes low-value test projections, mock wiring, private-state assertions, inventories and duplicate examples without equivalent replacement coverage. Per-source reviews record retained public behavior and refusal boundaries with injected/native/remote limits. Affected historical receipts are retired; gates without active current evidence are downgraded. Historical scope before this audit: Audit1645 removes low-value test projections, mock wiring, private-state assertions, inventories and duplicate examples without equivalent replacement coverage. Per-source reviews record retained public behavior and refusal boundaries with injected/native/remote limits. Affected historical receipts are retired; gates without active current evidence are downgraded. Historical scope before this audit: Audit1640 removes low-value IPC, SSH, workspace and transcript-watcher tests without equivalent replacement coverage. Per-source reviews record retained public refusal, cancellation, execution-host and real-filesystem outcomes with injected/native/remote limits. Affected historical receipts are retired; gates without active current evidence are downgraded. Historical scope before this audit: Audit1634 removes low-value IPC, filesystem and runtime projections, argument inventories and duplicate examples without equivalent replacement coverage. Per-source reviews record retained cancellation, ownership, authorization, filesystem and SQLite boundaries with injected/native/remote limits. Affected historical receipts are retired; gates without active current evidence are downgraded. Historical scope before this audit: Audit1627 removes low-value mocked daemon projections, scalar tables and duplicate terminal examples without equivalent replacement coverage. Per-source reviews record retained terminal content preservation, process ownership refusal and recovery boundaries together with injected/native/remote limits. Affected historical receipts are retired; gates without active current evidence are downgraded. Historical scope before this audit: Audit1623 removes low-value mocked daemon projections, scalar tables and duplicate terminal examples without equivalent replacement coverage. Per-source reviews record retained terminal content preservation, process ownership refusal and recovery boundaries together with injected/native/remote limits. Affected historical receipts are retired; gates without active current evidence are downgraded. Historical scope before this audit: Audit1516 removes package-electron-runtime-contract.test.mjs, a copied release-workflow platform and marker matrix. Its workflow wiring alarm is intentionally retired; no actual packaged watcher delivery was exercised and no equivalent replacement is claimed. Unaffected dated execution receipts retain their original scope; changed optional selectors have no fresh full-gate execution result. This audit removes the paired-web stopped-during-outage and late-ready direct-branch examples. The retained pre-ready cancellation, failed-unwatch retry and replay-continuity cases are not equivalent replacements for those ordering alarms. Current web-runtime-client.test.ts assertions below name only its retained pre-ready callback case; replay cases remain in their separate suite. Historical commands and results remain historical. Deterministic tests cover one shared healthy child per runtime process plus at most four bounded fault-quarantine children, native desktop, paired-runtime, and WSL snapshot processes sharing the same eight-physical-child reservation with typed serialized event-driven capacity recovery, including recursive re-wait when crash recovery reclaims an announced slot, one quarantine attempt per watch lifetime, generation-scoped cancellation, bounded termination with removable deadline waiters, replacement-crawl errors that cannot be blessed by a late readiness ack, pre-ready paired-web cancellation registered before an unbounded capacity wait, already-resolved and late physical-exit retry of a rejected paired-web teardown, physical desktop-install and local/SSH PTY teardown, stale-generation rejection, per-child stat bounds, final-overflow RPC delivery, and renderer eviction before terminal callbacks can retry. Destructive local and SSH removal fences both ID-derived and resolved-cwd terminal roots, including sibling-root/cwd combinations with reverse admission rollback, closes descendant relay watches before parent deletion, enumerates authoritative provider/cwd ownership, falls back to daemon spawn cwd before OSC 7, and keeps daemon/relay immediate shutdown pending until native exit or a bounded fail-closed error; a dead relay PID discovered during attach also settles concurrent shutdown before its stale entry is reaped, while Windows runtime watcher deadlines retain one removable physical-close waiter, treat Node's error-close path as positive physical-exit proof, and clear root ownership on late close. The relay policy test maps a standard repository's base, Git common directory, and worktree roots to one healthy supervisor, then proves a shared-child failure recovers those roots in separate quarantine supervisors with overflow and resumed events. Abortable capacity, quarantine, runtime-root, relay, SSH, and relay pre-install setup waits attach one reaction to each shared promise and explicitly remove 10,000 cancelled caller closures while one anchor remains. Built-entry macOS harnesses kill the desktop/runtime and SSH relay watcher children, then require automatic resubscription and later events while the host process and relay PTY survive. SSH bundles the child boundary beside relay.js, requires both artifacts for install completeness, and preserves registration-owned same-root cancellation. The test-value audit corrects the active renderer watch command/file reference to the existing runtime-file-client-watch.test.ts, whose three cases are retained unchanged. They observe synthetic subscription retry/fanout and unsubscribe/unwatch calls, not actual preload/main bookkeeping or physical watcher-process cleanup. The separate read/preview client suite loses forwarding, supplied-error and negative-only examples, retaining binary detection and Unicode SVG decoding. Historical evidence commands/results are unchanged. Test-value audit1293 removes src/main/providers/local-pty/local-pty-provider-session-inventory.test.ts (2 authored cases). Their isolated assertions no longer run; surviving tests are not claimed as equivalent coverage. Fresh execution against the candidate SHA is required. Audit1312 removes low-value imported specs from aggregate test drivers; old whole-driver execution receipts are archived. Retained registrations are unchanged. No equivalent replacement coverage is claimed. Audit1383: src/main/runtime/orca-runtime-tests/worktree-native-chat-setup.spec.ts reduced. Lose command-list/receipt/default/background activation matrices whose provider spawn returns canned IDs. Retained test proves actual tab allocation separation, not terminal startup. No equivalent replacement coverage is claimed. Existing exact unaffected receipts and their platform/provider/budget claims remain scoped to unchanged selectors. Changed optional selectors have no new execution result. Audit1401: src/main/runtime/orca-runtime-tests/mobile-session-tabs-duplicate-pty-repair.spec.ts removed. Loses listing-on-already-repaired-data alarm; it never established runtime repair invocation. src/main/runtime/orca-runtime-tests/mobile-session-tabs-split-agent-tab.spec.ts removed. Loses actual mobile split sibling shell versus recorded-agent resume command alarms; no equivalent coverage asserted. src/main/runtime/orca-runtime-tests/worktree-native-chat-setup.spec.ts removed. Loses separate setup/startup tab result in that manually assembled path. src/main/runtime/orca-runtime.test.ts reduced. Driver registration/import of a whole-deleted selected spec is removed; directly authored cases remain unchanged. No extra authored removal credit. No equivalent replacement coverage is claimed. Existing exact unaffected receipts remain unchanged and apply only to their unchanged selectors. Changed optional selectors have no new execution result. Audit1412: src/main/workspaces/removal/watcher-removal-gate.test.ts reduced. Loses exact removal-error compatibility with renderer predicate under shared message constants. Kept public refusal outcomes do not establish that renderer classification. No equivalent replacement coverage is claimed. Existing exact unaffected receipts remain unchanged and apply only to their unchanged selectors. Changed optional selectors have no new execution result.", + "coverageNotes": "Audit 3292 combines adopted 3285/3287/3289/3293 removals: 40 authored declarations and 47 expanded scenarios, including whole frame-editor-view, ambiguous remote-delete-refusal, unverifiable-host subscription and editor-close cleanup suites. The previously reviewed dock-badge suite was already removed upstream in PR 40895 and receives zero new removal credit. Intentionally retired alarms include background browser selection and last-tab landing; main startup fallback, SSH project cleanup/survivor routing, exact-PR contradiction/saved-push positives, replay/sidecar rollback and wrapped remote error normalization; records/snapshot missing-diff hydration, ambiguous folder-owner delete refusal, focus no-op notifications, nested editor context-only cache check, pending broadcast-first status and ordinary four-confirmation aggregation; preview-source frontmatter pruning, approved local/runtime agent dispatch, non-GitHub legacy PR cache invalidation, stale merged-head transient-error fallback, empty-queue immediate query reply and unverified-to-concrete preflight risk. Additional intentionally retired alarms are injected host subscription/unsubscribe counts, synthetic editor reveal/draft/fallback/scoped close, ambiguous unread refusals and hidden mark/read roundtrip, immediate connect backoff/noError, positive mirrored evidence-clock renewal, supplied VM failure/success projections and git-local/folder-SSH wake permutations. Remaining temporal/ownership cases are narrower; no equivalent replacement or fresh execution is claimed. Audit 3283 removes 20 authored declarations and 31 expanded scenarios, including two whole suites. Retired alarms cover PR refresh-state pruning, shared runtime subscription cleanup and store isolation, language content-change routing and older completion ownership, ordinary panel retry-timer cleanup and pending loading, four hosted-review lifetime permutations, mocked terminal creation error/order wiring, five sleep-inventory variants with pending-frame-only assertions, palette fallback/composite highlights, Windows/UNC encoded-editor input rows, mixed-repository partial failure counts, title setters and generated-title bypass/replacement, five window-close coordinator delegation/guard/finally branches, and ambiguous-old-record frame reveal. These regression checks are intentionally lost under the test-value audit; retained cases are not equivalent replacements. Prior coverage notes and receipts remain historical. Audit 3273 removes 14 authored declarations and 19 expanded scenarios across four whole suites and eight partial suites. Retired alarms cover saved-local cancellation/layout ownership, ambiguous-owner warning reset, folder attachment routing, VM false-capability bypass, abandoned reveal warmup cleanup and viewport claim deduplication/rearming, quiet unrelated remote-removal refusal, startup-command one-shot consumption, repository/floating recovery-ledger rows, fake-React pinned-scroll intent, split-ratio state identity/subscriber suppression and fractional change, cross-host project-group join refusal, three PR request-lifetime permutations, upstream-status preservation on error, and unresolved Git-owner refusal. These regression checks are intentionally lost under the test-value audit; retained scenarios are not equivalent replacements. Historical coverage receipts remain historical, including gate35 subscriber claims. Audit 3256 removes these specific alarms from the broad root unit commands: skill dialog active-share selection, close and pending-share handoff; simple keyed-record deletion; marker live-region insertion, simple landing and nine baseline policy examples; General search/control navigation inventory; orphan-count cache bootstrap; seven Codex code classifications and HTTP 429 warning mapping; two skill unread-root verdict examples; peer-mail payload and conversation-ID rejection; and the GitHub organization TABLE text-field optimistic rollback/failed-envelope example. These include real behaviors; retained tests do not provide equivalent coverage for every removed scenario. Mobile losses are recorded separately and are not coverage of these root commands. Audit3246 retires NewRowsMarker reveal/no-repeat and pane-scoped beforeinput checks; skill-owner option availability/count/dedup/order; six styled Input/Textarea IME forwarding rows; the static Codex/OpenCode smart-key inventory; tab-map AST ratchet diagnostic fixtures; child-roster work-budget and retained-aggregate alarms; malformed persisted floating-cwd fallback/no-crash/empty exact-root checks; the unanswered-host empty-list discriminator; the direct invalidated-cache commit-false assertion; one redundant digit-keyup IME row; cached non-supported Claude title-generator rows; and the duplicate late naming-result singleton. These root broad commands lose those specific alarms without equivalent replacement. Distinct retained owner/state checks have their own bounded claims; the real scheduler still rejects stale response data, while the direct false-return alarm is retired. Audit3231 retires supported-host restore-pane key mapping, closed/open creation-sidebar toggle visibility, unrelated scope-error/null classification and quick-submit reveal/no-create checks. These broad commands lose those real narrow alarms; no replacement coverage is claimed. Audit3219 removes the synthetic Cmd+J extra-source suite; this broad command no longer checks its match/tie placement and selection, announced count, empty-query cap, or workspace hiding with retained recent tabs. No replacement coverage is claimed. Audit3209 composes approved sources3202/3206: deliberately retires seven authored/expanded cases in four whole suites without equivalent replacement. Work-item queries lose real GitHub/GitLab oversized ASCII secret-prefix empty-query and whitespace-before-trim refusal alarms; inputs share the imported size bound and exercise only its fast length branch, with no multibyte or actual provider/exposure guarantee. Skill sharing loses complete/partial managed-bundle and destination-ambiguity association checks plus three negative origin/path/scheme admission examples; these do not establish uploaded contents, arbitrary-URL fetching, authorization or execution. Retain exact originless-project direct-link fallback, cloud-delete confirmation, bundled-target repair/owner isolation and explicit Windows-host preference over stale WSL suites. Rejected3201 runtime-preference removal is excluded. No real cloud/network/host/disk, mobile or mixed-version execution validation is claimed. Audit3200 composes approved source3194: deliberately retires thirteen authored registrations/twenty-seven expanded cases in six whole automation host/list policy suites without equivalent replacement. Real RPC category/retryability and wrapped-timeout recognition, unscoped-failure/scoped-success health evidence precedence, exact-ID create selectors and per-run workspace omission, paired-web local/SSH/absent host catalog routing, incompatible/removed/unhydrated/offline execution health, runtime-before-nested-SSH recovery dispatch, and no-owned-focus/successor/foreign-list focus policy alarms are consciously lost. Retain exact20line orphan allow/refuse/precondition and exact90line cross-host same-ID search suites. No retry-timer/fence lifecycle, actual reconnect/network/write delivery, native focus, mobile/mixed-version runtime or disk persistence coverage is claimed. Audit3191 combines approved source3182/3187/3188: deliberately retires thirteen authored Vitest registrations and fifteen expanded cases, including five whole suites, without equivalent replacement. Attachment intake loses real portal/native-capture terminal interception and unowned-container refusal, immediate child-only committed availability/claim-ref negotiation and delivery, and direct-target over stable focused/background composer routing through disable/re-enable/remount and independent question focus. Exact destination/cache/draft and final-stat owner/workspace/File-release suites remain; they do not replace Surface recipient routing. Automation authoring loses destination runtime catalog membership, local/direct-SSH exclusion of paired-runtime repos, unknown-runtime empty catalog, logical project/host/setup/repo/path context payload, and missing/nonready setup refusal; these were genuine direct helper alarms, while exact schedule transformation, legacy schedule and setup-decision suites remain. Agent picker loses setup-chat/terminal/missing-installer/unsupported-or-unknown-host row projection samples and the ordinary unsearched menu variant; the entire original26-line resume recipe suite remains, including reported bypass versus default/absent permission modes, as does the exact search-result menu callback with its fixtures, model/effort commits and staged Arguments reopen outcome. Rejected predecessor3180 full recipe deletion is excluded. No actual native drag/cursor/focus/IME, upload bytes or disk/restart persistence, full automation save/scheduler/runtime transport, real resume-process flags/environment delivery, or native menu/rendered layout validation is claimed. Audit3178 combines source3169/3170/3175: deliberately retires eight authored units (six Vitest cases and two imperative custom relay scenarios), including two whole suites, without equivalent replacement. Voice Section loses per-model pending-delete isolation across interleaved A/B completion and the two-success refresh-call alarm; exact VoicePane delayed key-clear/newer enabled-toggle merge remains and does not replace row deletion coverage. Speech loses dedicated rating-scale/inclusive-ceiling, unsupported-versus-unmeasured, explicit/system-language precedence/locale alias, accuracy versus fast named/default/best-measured selection, and unmeasured/no-match examples; exact offered-user-pick versus retired-selection case and its fixture remain. Relay loses legacy ping-delivery count/liveness sampled before the silence deadline and grouped malformed Bearer/host-ID 401/429 routing checks; twelve real Worker/DurableObject/shipped-client scenarios remain, not equivalent replacement for those narrow alarms. Six prior speech cases are not all deleted: approved successor3175 keeps the original user-choice case. No actual credential/file persistence, native/GPU/engine/download delivery, production assignment policy or deployed-runtime validation is claimed by this reduction. Audit3165 combines source3160/3162: deliberately retires six authored/expanded cases across three whole suites without equivalent replacement. Launch/status losses: observed React-render pending/resuming coordination across settings and deferred offer read; stale-offer reread suppressing dialog reopen; held-local-chat recovery visibility with new-chat preferences off; disabled-local admission avoiding offer RPC despite an injected but unconsumed paired-tab fixture; and run-only lost-reply uncertainty reachability until direct viewed-run retirement. Launch probe does not prove arbitrary synchronous-store atomicity, the paired fixture is not remote runtime enrollment, and the status case directly marks viewed state rather than rendering the summary. Crew-hook losses: old-host method_not_found cache persists across party changes but is released by independently supplied connection generation/verified pairing status or pairing revision, with actual frame publication and teardown. These are real narrow coordination, admission, uncertainty and mixed-version cache alarms consciously lost. Exact web verified-runtime writer handoff guard remains; it does not replace those alarms or prove live host/native/mobile delivery. Audit3156 combines3147/3150/3152/3153/3154: deliberately retires39authored/40expanded native-chat recovery cases, eight whole suites and two orphan test-support files without equivalent replacement. Lost alarms: lost-reply unconfirmed reconciliation, skipped rows/counts and missed-frame repair, unknown/pending outcome and omitted-failure-list compatibility, uncertain history after dismissal, retry/refusal/dismiss lifecycle, hidden/consumed picker ownership, result-tree keyboard focus/disclosure and all-skipped retirement; unconfirmed-over-conflict guidance and failed-chat changes despite older host timestamps; nearest-listed ancestor/cyclic forest shape, descendant membership, host ordering/missing-host local fallback; skipped/readiness/admission counts, provisional skip/progress monotonicity, early per-chat verdicts with batch pending protection, older-host waiting, start-slot/delivery distinction, retry-over-failure and unknown-after-withdrawal attention; remote snooze/reconnect/reoffer, unseen mixed summary through open/close, watched completion retirement, new success beside old failure, failed-reread mixed-result preservation, filter/collapse completion resets, retry summary replacement and current-offer/history selection; cross-host workspace identity, rendered cyclic reachability, nested tri-state/toggle propagation, project eligibility isolation and collapse preserving selection. Exact fallback-list completion barrier, batched verdict/cleanup retention, stale-read versus dismissal publication race, and requested-but-never-rendered finished-run retirement remain; they do not replace retired alarms. Audit3146 combines source reviews3132/3133/3135/3138/3143: intentionally retire20authored/31expanded cases without equivalent replacement. Provider-session losses: structured-native terminal-resume exclusion, metadata-less completed identity, new-turn completion clearing, Pi provider-only/periodic/manual promotion, changed-transcript launch-config isolation, Pi/omp/prime-agent completed-session remote/manual-shutdown promotion, and quit/done precedence over heartbeat. Side-thread/question losses: finished-pane acquisition, hidden title/recap states, local/relay/relay-done conversation takeover with prompt/session/child resets, plain-message abandonment, compaction/session replacement and completion resets. Codex startup losses: incoming-owner cached child replacement, old-relay foreign live-session correction, completed foreign-root turn-fact permutations. Transcript losses: real temporary-JSONL partial sibling/final-child completion, unlabelled child attribution, compact cached replay preservation and100/1000completed-child roster retention/release. Compiler-ratchet losses: valid-line uncompiled-list parser grammar examples and injected-existence stale-path filtering; these did not exercise actual filesystem canonicalization or build exclusion. These are real lifecycle, ownership, replay, liveness and retention alarms, including recent#40246 regressions, deliberately lost. Retained conditional record replacement, clockless root/SSH owner isolation, persisted main-thread fork rejection, partial/final question-answer lifetime, cached-roster/missing-ID/live HTTP/durable startup boundaries and restarted-relay refusal/acceptance do not replace those losses. No native/SSH/WSL execution or equivalent coverage is claimed. Audit3128 scoped coverage reduction: Audit3121 removes VoiceDictationLanguageSetting.test.tsx (Spanish-to-es callback and unsupported-model Korean option presence) and voice-speech-model-rows.test.ts (provider/language-order/retired-on-disk list policy); these real narrow alarms are deliberately retired without replacement. VoiceSpeechModelSection per-model concurrent deletion remains unchanged. Audit3122 removes the direct absolute/parent-segment sparse-directory exception-type sample and the five-row IPC sparse-preset error-code/non-save table (two authored/six expanded cases). Those real typed-validation and IPC refusal/error-code alarms are deliberately retired. Keep both real symlink/junction floating-directory trust cases and the minimal RPC structured validation-reason serialization case. The RPC case does not replace IPC save/refusal behavior, typed normalization for both path inputs, actual Git sparse checkout or rendered localization. No equivalent replacement or fresh test/runtime/platform/remote/performance validation is claimed. Audit3124 removes ExperimentalPane.test.tsx (ordinary Pet switch callback), WorkspaceDirectorySetting.test.tsx (padded absolute saved-path normalization/no-write blur), and repository-search.perf.test.ts (navigation/selected-pane builder-call policy, fixture cardinality/nonempty entries and renamed project keyword inclusion). These real narrow alarms are retired without replacement; RepositoryPane.search.test.tsx search-to-sparse-editor request remains unchanged. Audit3129: resolver Windows case-insensitive and POSIX case-sensitive configured-env composition plus mocked-base launch-preflight Windows composition are intentionally no longer checked by the two deleted suites. No equivalent coverage claimed. Keep runtime-structured-agent-host-env.test.ts unchanged: configured Windows Claude-home account identity and host-account precedence remain checked. Audit3114 incorporates source3101: retire three structured Claude child-environment wrapper cases covering inherited stamp isolation/default and explicit entrypoint, Windows SDK-key canonicalization/default/duplicate-key order, and configured lookup/final environment/config-dir conjunction. Keep direct auth/session sanitation and Windows-versus-Linux overlay checks, actual executable lookup from supplied inherited PATH, native Windows child environment delivery, and stale option-mutation fencing. These are not equivalent replacements for the retired wrapper alarms. No fresh test/runtime, real login-shell probe, Claude SDK startup, remote/mixed-version, UI or performance result is claimed. Audit3114 incorporates source3105: retire 17 authored/20 expanded daemon launch-note cases, including the entire two-case SessionLaunchNote suite. Deliberately lose split-marker carry across same-token re-arm, stale-token retirement refusal, foreground tri-state and serial settlement, omitted-note/no-incarnation mixed-version policy, sticky retirement, first-incarnation/replacement launch preservation and held-launch precedence. Keep only the unchanged unresolved foreground-read race against a later finished attach. Supplied notes/foreground and runtime calls do not establish actual daemon/main restart, SSH, native Windows observation, mobile UI, equivalent replacement or fresh runtime/performance validation. Audit3114 incorporates source3109: retire six authored/35 expanded pricing cases: 21 accepted model-name examples, 10 unsupported/future-model fail-closed examples, malformed TTL clamp, unknown-model estimate refusal, flat-model long-context disregard and oversized long-context clamp. Keep mixed five-minute/one-hour write allocation and short/all-long/mixed long-context allocation with original fixed oracles. Real parser/refusal/bounds alarms are knowingly lost without equivalent replacement; retained tests do not validate provider rates, actual billing or request threshold classification. Preserve the archived usage-scan-append source-freeze receipt without transferring historical execution/performance credit. No fresh runtime result is claimed. Audit3108 source-only reduction (3094/3095/3100): retire 27 authored/30 expanded cases, including complete markdown view-state, file-preview link-open and CLI agent-server-route suites, without replacement. Deliberate losses include preview visibility/reference lifetime and same-path owners; SSH stat, directory/missing-target, explicit-null owner, nonmarkdown line/column, local URI routing, remote-to-client guard and same-file reuse; document-preview source-owner/folder/reuse routing, stable grant location and outside-workspace POSIX/Windows request projection; and verified remote CLI send/check refusal, suggested --on argv/copy, shell no-probe bypass, unverified-launch admission and older-peer refusal. Retain two markdown source-runtime/qualified-reveal alarms, one stale grant-rejection fence and two remote read/mutation evidence policies, with original callbacks. Final last-wins reveal did not prove transient cancellation; CLI prerequisite did not prove no real send, and envelope tests do not execute server refusal. No fresh runtime, rendered UI, actual file/SSH/paired transport, authorization, mixed-version or performance result is claimed. Audit3096 source-only reduction (3087/3088): retire 69 authored/76 expanded cases, including complete recovery-portals and reconnect-banner suites. Intentionally lose dead/default TUI replay, generated alternate-frame style composition, reset/mode/dimension and legacy missing-mode-boundary alarms, UI notice/action/reveal policies, and isolated recovery lifecycle variants, without equivalent replacement. Retained registrations and callbacks are unchanged; headless cells are not pixels, and no fresh runtime, host, SSH, WSL, rendered-app or performance result is claimed. Audit3086 source-only reduction (3079/3080/3081): intentionally retire 93 authored/100 expanded mock-boundary cases, including the complete spawn-errors and SSH reconnect overlay suites, without replacement. Retired alarms include spawn classification/ownership, reply ceilings and renderer-write failure recovery, disconnect/detach fencing branches, authority facts, and overlay retry/visibility wiring. Retained callbacks are unchanged; no fresh execution, real PTY/SSH, rendered UI, or performance result is claimed. Audit2432: The broad unit command loses the isolated BranchPicker open-change notification sample. Its unique true/false callback alarm is intentionally retired; reopening/status-refresh behavior was not exercised. No equivalent replacement or fresh validation of the reduced selector is claimed. Audit2425: The broad unit command loses the workspace-copy-status supplied readError forwarding sample. It did not exercise the branch-switch blocking promised by its title. This alarm is intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2417: The broad unit command loses two ordinary clean Git cherry-pick/revert success samples and two terminal startup foreground-read work-budget samples. These unique alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2412: The broad unit command loses the whole six-case fake-React-hook scroll-anchor suite, two generic draft-retention samples, a simple new-agent order sample, a real history-publication batching-count sample, an unmounted handoff abort/timer sample and three basic WSL preview/error samples. These alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2404: The broad unit command loses the standalone share-name lookup 503 propagation suite, initial deletion placement-kind sample, direct changed-mtime stale sample, first-pass rollback existence example and abandoned-preparation directory sample. These exact alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2397 review amendment: The broad unit command loses three standalone suites, two partial-case definitions and two URL table rows across package/download/placement tests. Keep initial wrong-port authorization, modified independent-copy digest refusal and abort-after-begin cancellation dispatch. The remaining alarms are deliberately retired; no equivalent complete replacement or fresh validation of the reduced selector is claimed. Audit2393 current-parent refresh2401: Remove the basic skill-install service alias sample and original public managed-remove receiptless refusal case. Preserve the upstream request ownership suite and transaction interruption coverage. No equivalent complete replacement or fresh validation of the reduced selector is claimed. Audit2389: The broad unit command loses the missing-preview suite, plain-global destination sample and prepublished-receipt recovery example. No equivalent replacement or fresh validation of the reduced selector is claimed. Audit2385: The broad unit command loses four authored walker/staging/protocol examples (six expanded cases); no equivalent replacement or fresh validation is claimed for the reduced suite. Audit2383: The unscoped Vitest command no longer includes the removed Antigravity catalogue suite; its exact provider-root/owner example has no equivalent replacement or fresh validation claim. Audit2377/2381: The unscoped Vitest command includes the reduced bundled-skill and native-discovery suites; the eight removed backup/legacy/catalogue/symlink/SSH-builder examples have no replacement-equivalence or fresh validation claim here. Audit2133 current-parent preparation: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2095 current-parent preparation2126: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2090 (sources2088/2089): Current reduced suites intentionally retire the alarms listed in knownGaps; prior dated execution and replacement claims do not validate changed source bytes or selectors. Historical prior account (preserved verbatim): Audit2086 (sources2082/2083): Current reduced suites intentionally retire the alarms listed in knownGaps; prior dated execution and replacement claims do not validate changed source bytes or selectors. Historical prior account (preserved verbatim): Audit2076 (sources2073/2074): Intentionally retire these low-value alarms without replacement: src/main/runtime/orca-runtime-tests/terminal-handles-part-02.spec.ts: recovers a moved SSH pane through the tab it now sits in, not the one its lease froze; reports a plain expired orphan; does not report a pane whose only recent lease was superseded; does not report a pane whose only recent lease had its relay id recycled; picks the eligible orphan over a superseded predecessor that matches first; collects the same tabs the per-tab reader reports, in one sweep of the leases; reports no candidate when no lease names any of the worktree tabs. src/main/runtime/orca-runtime-tests/runtime-availability.spec.ts: starts unavailable with no authoritative window; reports the configured Windows terminal shell on status; reports floating workspace availability from settings on status; polls floating tabs with targeted PTY liveness and no repo/provider inventory; hydrates persisted tabs when the store cannot report repos; advertises browser screencast only when a renderer window is available; routes mobile Codex reset consumption through the account mutation coordinator; maps a definite pre-provider rejection into an authoritative current snapshot. Existing unrelated evidenceRuns retain their original scope; unchanged dated receipt objects do not validate changed source bytes or reduced selectors. No fresh gate execution or historical import-closure equivalence is claimed. Frozen current literal-import graph reaches these changed test bytes; unresolved local and computed edges remain debt, and current reachability is not historical execution or equivalent replacement evidence. Historical prior account (preserved verbatim): Audit2056 (sources2054/2055): Intentionally retire these low-value alarms without replacement: src/renderer/src/runtime/files/watching/runtime-file-client-watch.test.ts: delivers remote file changes to listeners for the same worktree. src/main/runtime/orca-runtime.test.ts: ordinary registration cleanup removes only await import('./orca-runtime-tests/mobile-session-tabs-part-14.spec'). src/main/runtime/orca-runtime-tests/terminal-side-effect-facts-part-03.spec.ts: arms the stale-title timer for a seeded working title; arms the Command Code scrape from the noted spawn command; prefers the tracked title over a stale renderer lastTitle in the hydration seed; writes recent output into the current runtime output map; uses a later title handler replacement with the runtime receiver; calls the current injected listener with the runtime receiver; keeps optional reconciliation lazy after its callback is removed. src/main/runtime/orca-runtime-tests/mobile-session-tabs-part-14.spec.ts: lists them, so a paired client can mirror a migrated editor; closes one by retiring it from the host session; keeps an unsaved draft unless the close is forced; shares aggregate work but leaves a replacement pending promise alone; lets a targeted refresh finish while an aggregate refresh waits; refuses a close when the store lacks %s before the guard; keeps a later missing %s on the original caught failure path. Existing unrelated evidenceRuns retain their original scope; unchanged dated receipt objects do not validate changed source bytes or reduced selectors. No fresh gate execution or historical import-closure equivalence is claimed. Exact retired assertionRefs, preserved as historical objects only: {\n \"file\": \"src/renderer/src/runtime/files/watching/runtime-file-client-watch.test.ts\",\n \"assertions\": [\n \"terminal watcher error and setup failure evict the shared entry before retrying callbacks run\",\n \"an old stream end cannot evict the replacement stream, which still delivers to its listener\",\n \"two same-worktree listeners share a synthetic subscription until the final stop unsubscribes and sends unwatch\"\n ]\n } Historical prior account (preserved verbatim): Audit1973: Delete the standalone mocked watcher cleanup suite and its entire sole-file prospective command. Retire the removed file-command transport-abort alias; preserve the independent cancellation suite and final-overflow/error/end cleanup callback, and13 unrelated receipt objects. Whole original changed dated receipts are retired, never narrowed or transferred. This metadata review claims no fresh execution, equivalent replacement, provider/PTY, live remote/mobile, rendered, cross-platform, soak or measured-budget result. Historical prior account (preserved verbatim): Audit1931 (sources1928/1929): Partial runtime files-watch suite retains controlled Windows close-event waiting, shared-client survival, late physical-exit ownership/deadline cleanup and shutdown joining. Its combined Windows close/deadline/late-exit alias remains backed by unchanged callbacks. Retire native-error-close, pre-publication setup ownership and failed-delete rearm aliases; associated delegation, failure forwarding, removal routing and recovery examples are lost. These tests inject watch/subscription seams and do not observe an actual native watcher or physical process. Preserve meaningful remaining selectors/assertions and unchanged dated receipts within their original scope. Reduced selectors have no fresh gate execution evidence in this metadata packet. No equivalent replacement, physical watcher/PTY/provider, live SSH/remote/mobile, rendered, cross-platform, soak or measured-budget result is claimed. Historical prior account (preserved verbatim): Audit1925 (sources1922/1923): Partial runtime watcher-host suite loses mocked option/event/overflow/resubscription forwarding, supplied teardown-error propagation, aborted-signal/no-call and private ten-thousand-waiter-count inventories. Retire the 10,000-caller bound and failed-recovery-subscriber-ending assertion aliases. Keep same-root owner cancellation, pre-ready replacement, held root-close join, stale-generation recovery delivery and initial failed-root ownership mappings backed by retained real-host callbacks with injected subscription/error/physical-exit promises. No actual native watcher, process termination or resource bound was observed. Preserve meaningful remaining selectors/assertions and unchanged dated receipts within their original scope. Reduced selectors have no fresh gate execution evidence in this metadata packet. No equivalent replacement, physical watcher/PTY/provider, live SSH/remote/mobile, rendered, cross-platform, soak or measured-budget result is claimed. Historical prior account (preserved verbatim): Audit1683 removes low-value test projections, mock wiring, private-state assertions, inventories and duplicate examples without equivalent replacement coverage. Per-source reviews record retained public behavior and refusal boundaries with injected/native/remote limits. Affected historical receipts are retired; gates without active current evidence are downgraded. Historical scope before this audit: Audit1645 removes low-value test projections, mock wiring, private-state assertions, inventories and duplicate examples without equivalent replacement coverage. Per-source reviews record retained public behavior and refusal boundaries with injected/native/remote limits. Affected historical receipts are retired; gates without active current evidence are downgraded. Historical scope before this audit: Audit1640 removes low-value IPC, SSH, workspace and transcript-watcher tests without equivalent replacement coverage. Per-source reviews record retained public refusal, cancellation, execution-host and real-filesystem outcomes with injected/native/remote limits. Affected historical receipts are retired; gates without active current evidence are downgraded. Historical scope before this audit: Audit1634 removes low-value IPC, filesystem and runtime projections, argument inventories and duplicate examples without equivalent replacement coverage. Per-source reviews record retained cancellation, ownership, authorization, filesystem and SQLite boundaries with injected/native/remote limits. Affected historical receipts are retired; gates without active current evidence are downgraded. Historical scope before this audit: Audit1627 removes low-value mocked daemon projections, scalar tables and duplicate terminal examples without equivalent replacement coverage. Per-source reviews record retained terminal content preservation, process ownership refusal and recovery boundaries together with injected/native/remote limits. Affected historical receipts are retired; gates without active current evidence are downgraded. Historical scope before this audit: Audit1623 removes low-value mocked daemon projections, scalar tables and duplicate terminal examples without equivalent replacement coverage. Per-source reviews record retained terminal content preservation, process ownership refusal and recovery boundaries together with injected/native/remote limits. Affected historical receipts are retired; gates without active current evidence are downgraded. Historical scope before this audit: Audit1516 removes package-electron-runtime-contract.test.mjs, a copied release-workflow platform and marker matrix. Its workflow wiring alarm is intentionally retired; no actual packaged watcher delivery was exercised and no equivalent replacement is claimed. Unaffected dated execution receipts retain their original scope; changed optional selectors have no fresh full-gate execution result. This audit removes the paired-web stopped-during-outage and late-ready direct-branch examples. The retained pre-ready cancellation, failed-unwatch retry and replay-continuity cases are not equivalent replacements for those ordering alarms. Current web-runtime-client.test.ts assertions below name only its retained pre-ready callback case; replay cases remain in their separate suite. Historical commands and results remain historical. Deterministic tests cover one shared healthy child per runtime process plus at most four bounded fault-quarantine children, native desktop, paired-runtime, and WSL snapshot processes sharing the same eight-physical-child reservation with typed serialized event-driven capacity recovery, including recursive re-wait when crash recovery reclaims an announced slot, one quarantine attempt per watch lifetime, generation-scoped cancellation, bounded termination with removable deadline waiters, replacement-crawl errors that cannot be blessed by a late readiness ack, pre-ready paired-web cancellation registered before an unbounded capacity wait, already-resolved and late physical-exit retry of a rejected paired-web teardown, physical desktop-install and local/SSH PTY teardown, stale-generation rejection, per-child stat bounds, final-overflow RPC delivery, and renderer eviction before terminal callbacks can retry. Destructive local and SSH removal fences both ID-derived and resolved-cwd terminal roots, including sibling-root/cwd combinations with reverse admission rollback, closes descendant relay watches before parent deletion, enumerates authoritative provider/cwd ownership, falls back to daemon spawn cwd before OSC 7, and keeps daemon/relay immediate shutdown pending until native exit or a bounded fail-closed error; a dead relay PID discovered during attach also settles concurrent shutdown before its stale entry is reaped, while Windows runtime watcher deadlines retain one removable physical-close waiter, treat Node's error-close path as positive physical-exit proof, and clear root ownership on late close. The relay policy test maps a standard repository's base, Git common directory, and worktree roots to one healthy supervisor, then proves a shared-child failure recovers those roots in separate quarantine supervisors with overflow and resumed events. Abortable capacity, quarantine, runtime-root, relay, SSH, and relay pre-install setup waits attach one reaction to each shared promise and explicitly remove 10,000 cancelled caller closures while one anchor remains. Built-entry macOS harnesses kill the desktop/runtime and SSH relay watcher children, then require automatic resubscription and later events while the host process and relay PTY survive. SSH bundles the child boundary beside relay.js, requires both artifacts for install completeness, and preserves registration-owned same-root cancellation. The test-value audit corrects the active renderer watch command/file reference to the existing runtime-file-client-watch.test.ts, whose three cases are retained unchanged. They observe synthetic subscription retry/fanout and unsubscribe/unwatch calls, not actual preload/main bookkeeping or physical watcher-process cleanup. The separate read/preview client suite loses forwarding, supplied-error and negative-only examples, retaining binary detection and Unicode SVG decoding. Historical evidence commands/results are unchanged. Test-value audit1293 removes src/main/providers/local-pty/local-pty-provider-session-inventory.test.ts (2 authored cases). Their isolated assertions no longer run; surviving tests are not claimed as equivalent coverage. Fresh execution against the candidate SHA is required. Audit1312 removes low-value imported specs from aggregate test drivers; old whole-driver execution receipts are archived. Retained registrations are unchanged. No equivalent replacement coverage is claimed. Audit1383: src/main/runtime/orca-runtime-tests/worktree-native-chat-setup.spec.ts reduced. Lose command-list/receipt/default/background activation matrices whose provider spawn returns canned IDs. Retained test proves actual tab allocation separation, not terminal startup. No equivalent replacement coverage is claimed. Existing exact unaffected receipts and their platform/provider/budget claims remain scoped to unchanged selectors. Changed optional selectors have no new execution result. Audit1401: src/main/runtime/orca-runtime-tests/mobile-session-tabs-duplicate-pty-repair.spec.ts removed. Loses listing-on-already-repaired-data alarm; it never established runtime repair invocation. src/main/runtime/orca-runtime-tests/mobile-session-tabs-split-agent-tab.spec.ts removed. Loses actual mobile split sibling shell versus recorded-agent resume command alarms; no equivalent coverage asserted. src/main/runtime/orca-runtime-tests/worktree-native-chat-setup.spec.ts removed. Loses separate setup/startup tab result in that manually assembled path. src/main/runtime/orca-runtime.test.ts reduced. Driver registration/import of a whole-deleted selected spec is removed; directly authored cases remain unchanged. No extra authored removal credit. No equivalent replacement coverage is claimed. Existing exact unaffected receipts remain unchanged and apply only to their unchanged selectors. Changed optional selectors have no new execution result. Audit1412: src/main/workspaces/removal/watcher-removal-gate.test.ts reduced. Loses exact removal-error compatibility with renderer predicate under shared message constants. Kept public refusal outcomes do not establish that renderer classification. No equivalent replacement coverage is claimed. Existing exact unaffected receipts remain unchanged and apply only to their unchanged selectors. Changed optional selectors have no new execution result.", "motivatingLinks": [ "https://github.com/stablyai/orca/issues/5308", "https://github.com/stablyai/orca/issues/7547", "https://github.com/stablyai/orca/issues/8212" ], "invariant": "Local runtime and SSH relay roots share one watcher child per host process while healthy and use at most four quarantine children after shard failure; native desktop, paired-runtime, and direct WSL snapshot children consume the same process-wide eight-child reservation and retry transient exhaustion without permanently disabling a root. Cancellation remains owned by its child generation and settles only after acknowledgement or bounded physical exit; paired-web retains cleanup ownership and can cancel before readiness even while capacity is exhausted, retries a failed unwatch after already-resolved or late physical exit without duplicating stream termination, replacements never overlap a still-retiring generation, and aborted or timed-out callers detach immediately even while queued behind same-root relay teardown. Destructive local and SSH cleanup holds one containment-aware watcher/terminal removal fence through descendant watcher and PTY physical exit plus parent Git/filesystem deletion; daemon and relay kill requests retain ownership until the actual subprocess exit callback or an equivalent positive dead-PID proof and propagate rejected signals or a bounded failure otherwise. A crash-fused shared shard moves affected roots into the bounded quarantine pool, a second fused quarantine ends those watch lifetimes, interrupted setup emits overflow after recovery, metadata work stays bounded, and the SSH relay, PTYs, Git, and other filesystem operations never load the watcher native addon or share its fault boundary.", - "oracle": "Audit 3283 removes 20 authored declarations and 31 expanded scenarios, including two whole suites. Retired alarms cover PR refresh-state pruning, shared runtime subscription cleanup and store isolation, language content-change routing and older completion ownership, ordinary panel retry-timer cleanup and pending loading, four hosted-review lifetime permutations, mocked terminal creation error/order wiring, five sleep-inventory variants with pending-frame-only assertions, palette fallback/composite highlights, Windows/UNC encoded-editor input rows, mixed-repository partial failure counts, title setters and generated-title bypass/replacement, five window-close coordinator delegation/guard/finally branches, and ambiguous-old-record frame reveal. These regression checks are intentionally lost under the test-value audit; retained cases are not equivalent replacements. Prior coverage notes and receipts remain historical. Audit 3273 removes 14 authored declarations and 19 expanded scenarios across four whole suites and eight partial suites. Retired alarms cover saved-local cancellation/layout ownership, ambiguous-owner warning reset, folder attachment routing, VM false-capability bypass, abandoned reveal warmup cleanup and viewport claim deduplication/rearming, quiet unrelated remote-removal refusal, startup-command one-shot consumption, repository/floating recovery-ledger rows, fake-React pinned-scroll intent, split-ratio state identity/subscriber suppression and fractional change, cross-host project-group join refusal, three PR request-lifetime permutations, upstream-status preservation on error, and unresolved Git-owner refusal. These regression checks are intentionally lost under the test-value audit; retained scenarios are not equivalent replacements. Historical coverage receipts remain historical, including gate35 subscriber claims. Audit 3256 removes these specific alarms from the broad root unit commands: skill dialog active-share selection, close and pending-share handoff; simple keyed-record deletion; marker live-region insertion, simple landing and nine baseline policy examples; General search/control navigation inventory; orphan-count cache bootstrap; seven Codex code classifications and HTTP 429 warning mapping; two skill unread-root verdict examples; peer-mail payload and conversation-ID rejection; and the GitHub organization TABLE text-field optimistic rollback/failed-envelope example. These include real behaviors; retained tests do not provide equivalent coverage for every removed scenario. Mobile losses are recorded separately and are not coverage of these root commands. Audit3246 retires NewRowsMarker reveal/no-repeat and pane-scoped beforeinput checks; skill-owner option availability/count/dedup/order; six styled Input/Textarea IME forwarding rows; the static Codex/OpenCode smart-key inventory; tab-map AST ratchet diagnostic fixtures; child-roster work-budget and retained-aggregate alarms; malformed persisted floating-cwd fallback/no-crash/empty exact-root checks; the unanswered-host empty-list discriminator; the direct invalidated-cache commit-false assertion; one redundant digit-keyup IME row; cached non-supported Claude title-generator rows; and the duplicate late naming-result singleton. These root broad commands lose those specific alarms without equivalent replacement. Distinct retained owner/state checks have their own bounded claims; the real scheduler still rejects stale response data, while the direct false-return alarm is retired. Audit3231 retires supported-host restore-pane key mapping, closed/open creation-sidebar toggle visibility, unrelated scope-error/null classification and quick-submit reveal/no-create checks. These broad commands lose those real narrow alarms; no replacement coverage is claimed. Audit3219 removes the synthetic Cmd+J extra-source suite; this broad command no longer checks its match/tie placement and selection, announced count, empty-query cap, or workspace hiding with retained recent tabs. No replacement coverage is claimed. Audit3209 composes approved sources3202/3206: deliberately retires seven authored/expanded cases in four whole suites without equivalent replacement. Work-item queries lose real GitHub/GitLab oversized ASCII secret-prefix empty-query and whitespace-before-trim refusal alarms; inputs share the imported size bound and exercise only its fast length branch, with no multibyte or actual provider/exposure guarantee. Skill sharing loses complete/partial managed-bundle and destination-ambiguity association checks plus three negative origin/path/scheme admission examples; these do not establish uploaded contents, arbitrary-URL fetching, authorization or execution. Retain exact originless-project direct-link fallback, cloud-delete confirmation, bundled-target repair/owner isolation and explicit Windows-host preference over stale WSL suites. Rejected3201 runtime-preference removal is excluded. No real cloud/network/host/disk, mobile or mixed-version execution validation is claimed. Audit3200 composes approved source3194: deliberately retires thirteen authored registrations/twenty-seven expanded cases in six whole automation host/list policy suites without equivalent replacement. Real RPC category/retryability and wrapped-timeout recognition, unscoped-failure/scoped-success health evidence precedence, exact-ID create selectors and per-run workspace omission, paired-web local/SSH/absent host catalog routing, incompatible/removed/unhydrated/offline execution health, runtime-before-nested-SSH recovery dispatch, and no-owned-focus/successor/foreign-list focus policy alarms are consciously lost. Retain exact20line orphan allow/refuse/precondition and exact90line cross-host same-ID search suites. No retry-timer/fence lifecycle, actual reconnect/network/write delivery, native focus, mobile/mixed-version runtime or disk persistence coverage is claimed. Audit3191 combines approved source3182/3187/3188: deliberately retires thirteen authored Vitest registrations and fifteen expanded cases, including five whole suites, without equivalent replacement. Attachment intake loses real portal/native-capture terminal interception and unowned-container refusal, immediate child-only committed availability/claim-ref negotiation and delivery, and direct-target over stable focused/background composer routing through disable/re-enable/remount and independent question focus. Exact destination/cache/draft and final-stat owner/workspace/File-release suites remain; they do not replace Surface recipient routing. Automation authoring loses destination runtime catalog membership, local/direct-SSH exclusion of paired-runtime repos, unknown-runtime empty catalog, logical project/host/setup/repo/path context payload, and missing/nonready setup refusal; these were genuine direct helper alarms, while exact schedule transformation, legacy schedule and setup-decision suites remain. Agent picker loses setup-chat/terminal/missing-installer/unsupported-or-unknown-host row projection samples and the ordinary unsearched menu variant; the entire original26-line resume recipe suite remains, including reported bypass versus default/absent permission modes, as does the exact search-result menu callback with its fixtures, model/effort commits and staged Arguments reopen outcome. Rejected predecessor3180 full recipe deletion is excluded. No actual native drag/cursor/focus/IME, upload bytes or disk/restart persistence, full automation save/scheduler/runtime transport, real resume-process flags/environment delivery, or native menu/rendered layout validation is claimed. Audit3178 combines source3169/3170/3175: deliberately retires eight authored units (six Vitest cases and two imperative custom relay scenarios), including two whole suites, without equivalent replacement. Voice Section loses per-model pending-delete isolation across interleaved A/B completion and the two-success refresh-call alarm; exact VoicePane delayed key-clear/newer enabled-toggle merge remains and does not replace row deletion coverage. Speech loses dedicated rating-scale/inclusive-ceiling, unsupported-versus-unmeasured, explicit/system-language precedence/locale alias, accuracy versus fast named/default/best-measured selection, and unmeasured/no-match examples; exact offered-user-pick versus retired-selection case and its fixture remain. Relay loses legacy ping-delivery count/liveness sampled before the silence deadline and grouped malformed Bearer/host-ID 401/429 routing checks; twelve real Worker/DurableObject/shipped-client scenarios remain, not equivalent replacement for those narrow alarms. Six prior speech cases are not all deleted: approved successor3175 keeps the original user-choice case. No actual credential/file persistence, native/GPU/engine/download delivery, production assignment policy or deployed-runtime validation is claimed by this reduction. Audit3165 combines source3160/3162: deliberately retires six authored/expanded cases across three whole suites without equivalent replacement. Launch/status losses: observed React-render pending/resuming coordination across settings and deferred offer read; stale-offer reread suppressing dialog reopen; held-local-chat recovery visibility with new-chat preferences off; disabled-local admission avoiding offer RPC despite an injected but unconsumed paired-tab fixture; and run-only lost-reply uncertainty reachability until direct viewed-run retirement. Launch probe does not prove arbitrary synchronous-store atomicity, the paired fixture is not remote runtime enrollment, and the status case directly marks viewed state rather than rendering the summary. Crew-hook losses: old-host method_not_found cache persists across party changes but is released by independently supplied connection generation/verified pairing status or pairing revision, with actual frame publication and teardown. These are real narrow coordination, admission, uncertainty and mixed-version cache alarms consciously lost. Exact web verified-runtime writer handoff guard remains; it does not replace those alarms or prove live host/native/mobile delivery. Audit3156 combines3147/3150/3152/3153/3154: deliberately retires39authored/40expanded native-chat recovery cases, eight whole suites and two orphan test-support files without equivalent replacement. Lost alarms: lost-reply unconfirmed reconciliation, skipped rows/counts and missed-frame repair, unknown/pending outcome and omitted-failure-list compatibility, uncertain history after dismissal, retry/refusal/dismiss lifecycle, hidden/consumed picker ownership, result-tree keyboard focus/disclosure and all-skipped retirement; unconfirmed-over-conflict guidance and failed-chat changes despite older host timestamps; nearest-listed ancestor/cyclic forest shape, descendant membership, host ordering/missing-host local fallback; skipped/readiness/admission counts, provisional skip/progress monotonicity, early per-chat verdicts with batch pending protection, older-host waiting, start-slot/delivery distinction, retry-over-failure and unknown-after-withdrawal attention; remote snooze/reconnect/reoffer, unseen mixed summary through open/close, watched completion retirement, new success beside old failure, failed-reread mixed-result preservation, filter/collapse completion resets, retry summary replacement and current-offer/history selection; cross-host workspace identity, rendered cyclic reachability, nested tri-state/toggle propagation, project eligibility isolation and collapse preserving selection. Exact fallback-list completion barrier, batched verdict/cleanup retention, stale-read versus dismissal publication race, and requested-but-never-rendered finished-run retirement remain; they do not replace retired alarms. Audit3146 combines source reviews3132/3133/3135/3138/3143: intentionally retire20authored/31expanded cases without equivalent replacement. Provider-session losses: structured-native terminal-resume exclusion, metadata-less completed identity, new-turn completion clearing, Pi provider-only/periodic/manual promotion, changed-transcript launch-config isolation, Pi/omp/prime-agent completed-session remote/manual-shutdown promotion, and quit/done precedence over heartbeat. Side-thread/question losses: finished-pane acquisition, hidden title/recap states, local/relay/relay-done conversation takeover with prompt/session/child resets, plain-message abandonment, compaction/session replacement and completion resets. Codex startup losses: incoming-owner cached child replacement, old-relay foreign live-session correction, completed foreign-root turn-fact permutations. Transcript losses: real temporary-JSONL partial sibling/final-child completion, unlabelled child attribution, compact cached replay preservation and100/1000completed-child roster retention/release. Compiler-ratchet losses: valid-line uncompiled-list parser grammar examples and injected-existence stale-path filtering; these did not exercise actual filesystem canonicalization or build exclusion. These are real lifecycle, ownership, replay, liveness and retention alarms, including recent#40246 regressions, deliberately lost. Retained conditional record replacement, clockless root/SSH owner isolation, persisted main-thread fork rejection, partial/final question-answer lifetime, cached-roster/missing-ID/live HTTP/durable startup boundaries and restarted-relay refusal/acceptance do not replace those losses. No native/SSH/WSL execution or equivalent coverage is claimed. Audit3128 scoped coverage reduction: Audit3121 removes VoiceDictationLanguageSetting.test.tsx (Spanish-to-es callback and unsupported-model Korean option presence) and voice-speech-model-rows.test.ts (provider/language-order/retired-on-disk list policy); these real narrow alarms are deliberately retired without replacement. VoiceSpeechModelSection per-model concurrent deletion remains unchanged. Audit3122 removes the direct absolute/parent-segment sparse-directory exception-type sample and the five-row IPC sparse-preset error-code/non-save table (two authored/six expanded cases). Those real typed-validation and IPC refusal/error-code alarms are deliberately retired. Keep both real symlink/junction floating-directory trust cases and the minimal RPC structured validation-reason serialization case. The RPC case does not replace IPC save/refusal behavior, typed normalization for both path inputs, actual Git sparse checkout or rendered localization. No equivalent replacement or fresh test/runtime/platform/remote/performance validation is claimed. Audit3124 removes ExperimentalPane.test.tsx (ordinary Pet switch callback), WorkspaceDirectorySetting.test.tsx (padded absolute saved-path normalization/no-write blur), and repository-search.perf.test.ts (navigation/selected-pane builder-call policy, fixture cardinality/nonempty entries and renamed project keyword inclusion). These real narrow alarms are retired without replacement; RepositoryPane.search.test.tsx search-to-sparse-editor request remains unchanged. Audit3129: resolver Windows case-insensitive and POSIX case-sensitive configured-env composition plus mocked-base launch-preflight Windows composition are intentionally no longer checked by the two deleted suites. No equivalent coverage claimed. Keep runtime-structured-agent-host-env.test.ts unchanged: configured Windows Claude-home account identity and host-account precedence remain checked. Audit3114 incorporates source3101: retire three structured Claude child-environment wrapper cases covering inherited stamp isolation/default and explicit entrypoint, Windows SDK-key canonicalization/default/duplicate-key order, and configured lookup/final environment/config-dir conjunction. Keep direct auth/session sanitation and Windows-versus-Linux overlay checks, actual executable lookup from supplied inherited PATH, native Windows child environment delivery, and stale option-mutation fencing. These are not equivalent replacements for the retired wrapper alarms. No fresh test/runtime, real login-shell probe, Claude SDK startup, remote/mixed-version, UI or performance result is claimed. Audit3114 incorporates source3105: retire 17 authored/20 expanded daemon launch-note cases, including the entire two-case SessionLaunchNote suite. Deliberately lose split-marker carry across same-token re-arm, stale-token retirement refusal, foreground tri-state and serial settlement, omitted-note/no-incarnation mixed-version policy, sticky retirement, first-incarnation/replacement launch preservation and held-launch precedence. Keep only the unchanged unresolved foreground-read race against a later finished attach. Supplied notes/foreground and runtime calls do not establish actual daemon/main restart, SSH, native Windows observation, mobile UI, equivalent replacement or fresh runtime/performance validation. Audit3114 incorporates source3109: retire six authored/35 expanded pricing cases: 21 accepted model-name examples, 10 unsupported/future-model fail-closed examples, malformed TTL clamp, unknown-model estimate refusal, flat-model long-context disregard and oversized long-context clamp. Keep mixed five-minute/one-hour write allocation and short/all-long/mixed long-context allocation with original fixed oracles. Real parser/refusal/bounds alarms are knowingly lost without equivalent replacement; retained tests do not validate provider rates, actual billing or request threshold classification. Preserve the archived usage-scan-append source-freeze receipt without transferring historical execution/performance credit. No fresh runtime result is claimed. Audit3108 source-only reduction (3094/3095/3100): retire 27 authored/30 expanded cases, including complete markdown view-state, file-preview link-open and CLI agent-server-route suites, without replacement. Deliberate losses include preview visibility/reference lifetime and same-path owners; SSH stat, directory/missing-target, explicit-null owner, nonmarkdown line/column, local URI routing, remote-to-client guard and same-file reuse; document-preview source-owner/folder/reuse routing, stable grant location and outside-workspace POSIX/Windows request projection; and verified remote CLI send/check refusal, suggested --on argv/copy, shell no-probe bypass, unverified-launch admission and older-peer refusal. Retain two markdown source-runtime/qualified-reveal alarms, one stale grant-rejection fence and two remote read/mutation evidence policies, with original callbacks. Final last-wins reveal did not prove transient cancellation; CLI prerequisite did not prove no real send, and envelope tests do not execute server refusal. No fresh runtime, rendered UI, actual file/SSH/paired transport, authorization, mixed-version or performance result is claimed. Audit3096 source-only reduction (3087/3088): retire 69 authored/76 expanded cases, including complete recovery-portals and reconnect-banner suites. Intentionally lose dead/default TUI replay, generated alternate-frame style composition, reset/mode/dimension and legacy missing-mode-boundary alarms, UI notice/action/reveal policies, and isolated recovery lifecycle variants, without equivalent replacement. Retained registrations and callbacks are unchanged; headless cells are not pixels, and no fresh runtime, host, SSH, WSL, rendered-app or performance result is claimed. Audit3086 source-only reduction (3079/3080/3081): intentionally retire 93 authored/100 expanded mock-boundary cases, including the complete spawn-errors and SSH reconnect overlay suites, without replacement. Retired alarms include spawn classification/ownership, reply ceilings and renderer-write failure recovery, disconnect/detach fencing branches, authority facts, and overlay retry/visibility wiring. Retained callbacks are unchanged; no fresh execution, real PTY/SSH, rendered UI, or performance result is claimed. Audit2432: The broad unit command loses the isolated BranchPicker open-change notification sample. Its unique true/false callback alarm is intentionally retired; reopening/status-refresh behavior was not exercised. No equivalent replacement or fresh validation of the reduced selector is claimed. Audit2425: The broad unit command loses the workspace-copy-status supplied readError forwarding sample. It did not exercise the branch-switch blocking promised by its title. This alarm is intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2417: The broad unit command loses two ordinary clean Git cherry-pick/revert success samples and two terminal startup foreground-read work-budget samples. These unique alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2412: The broad unit command loses the whole six-case fake-React-hook scroll-anchor suite, two generic draft-retention samples, a simple new-agent order sample, a real history-publication batching-count sample, an unmounted handoff abort/timer sample and three basic WSL preview/error samples. These alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2404: The broad unit command loses the standalone share-name lookup 503 propagation suite, initial deletion placement-kind sample, direct changed-mtime stale sample, first-pass rollback existence example and abandoned-preparation directory sample. These exact alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2397 review amendment: The broad unit command loses three standalone suites, two partial-case definitions and two URL table rows across package/download/placement tests. Keep initial wrong-port authorization, modified independent-copy digest refusal and abort-after-begin cancellation dispatch. The remaining alarms are deliberately retired; no equivalent complete replacement or fresh validation of the reduced selector is claimed. Audit2393 current-parent refresh2401: Remove the basic skill-install service alias sample and original public managed-remove receiptless refusal case. Preserve the upstream request ownership suite and transaction interruption coverage. No equivalent complete replacement or fresh validation of the reduced selector is claimed. Audit2389: The broad unit command loses the missing-preview suite, plain-global destination sample and prepublished-receipt recovery example. No equivalent replacement or fresh validation of the reduced selector is claimed. Audit2385: The broad unit command loses four authored walker/staging/protocol examples (six expanded cases); no equivalent replacement or fresh validation is claimed for the reduced suite. Audit2383: The unscoped Vitest command no longer includes the removed Antigravity catalogue suite; its exact provider-root/owner example has no equivalent replacement or fresh validation claim. Audit2377/2381: The unscoped Vitest command includes the reduced bundled-skill and native-discovery suites; the eight removed backup/legacy/catalogue/symlink/SSH-builder examples have no replacement-equivalence or fresh validation claim here. Audit2133 current-parent preparation: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2095 current-parent preparation2126: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2090 (sources2088/2089): Current reduced suites intentionally retire the alarms listed in knownGaps; prior dated execution and replacement claims do not validate changed source bytes or selectors. Historical prior account (preserved verbatim): Audit2086 (sources2082/2083): Current reduced suites intentionally retire the alarms listed in knownGaps; prior dated execution and replacement claims do not validate changed source bytes or selectors. Historical prior account (preserved verbatim): Audit2076 (sources2073/2074): Intentionally retire these low-value alarms without replacement: src/main/runtime/orca-runtime-tests/terminal-handles-part-02.spec.ts: recovers a moved SSH pane through the tab it now sits in, not the one its lease froze; reports a plain expired orphan; does not report a pane whose only recent lease was superseded; does not report a pane whose only recent lease had its relay id recycled; picks the eligible orphan over a superseded predecessor that matches first; collects the same tabs the per-tab reader reports, in one sweep of the leases; reports no candidate when no lease names any of the worktree tabs. src/main/runtime/orca-runtime-tests/runtime-availability.spec.ts: starts unavailable with no authoritative window; reports the configured Windows terminal shell on status; reports floating workspace availability from settings on status; polls floating tabs with targeted PTY liveness and no repo/provider inventory; hydrates persisted tabs when the store cannot report repos; advertises browser screencast only when a renderer window is available; routes mobile Codex reset consumption through the account mutation coordinator; maps a definite pre-provider rejection into an authoritative current snapshot. Existing unrelated evidenceRuns retain their original scope; unchanged dated receipt objects do not validate changed source bytes or reduced selectors. No fresh gate execution or historical import-closure equivalence is claimed. Frozen current literal-import graph reaches these changed test bytes; unresolved local and computed edges remain debt, and current reachability is not historical execution or equivalent replacement evidence. Historical prior account (preserved verbatim): Audit2056 (sources2054/2055): Intentionally retire these low-value alarms without replacement: src/renderer/src/runtime/files/watching/runtime-file-client-watch.test.ts: delivers remote file changes to listeners for the same worktree. src/main/runtime/orca-runtime.test.ts: ordinary registration cleanup removes only await import('./orca-runtime-tests/mobile-session-tabs-part-14.spec'). src/main/runtime/orca-runtime-tests/terminal-side-effect-facts-part-03.spec.ts: arms the stale-title timer for a seeded working title; arms the Command Code scrape from the noted spawn command; prefers the tracked title over a stale renderer lastTitle in the hydration seed; writes recent output into the current runtime output map; uses a later title handler replacement with the runtime receiver; calls the current injected listener with the runtime receiver; keeps optional reconciliation lazy after its callback is removed. src/main/runtime/orca-runtime-tests/mobile-session-tabs-part-14.spec.ts: lists them, so a paired client can mirror a migrated editor; closes one by retiring it from the host session; keeps an unsaved draft unless the close is forced; shares aggregate work but leaves a replacement pending promise alone; lets a targeted refresh finish while an aggregate refresh waits; refuses a close when the store lacks %s before the guard; keeps a later missing %s on the original caught failure path. Existing unrelated evidenceRuns retain their original scope; unchanged dated receipt objects do not validate changed source bytes or reduced selectors. No fresh gate execution or historical import-closure equivalence is claimed. Exact retired assertionRefs, preserved as historical objects only: {\n \"file\": \"src/renderer/src/runtime/files/watching/runtime-file-client-watch.test.ts\",\n \"assertions\": [\n \"terminal watcher error and setup failure evict the shared entry before retrying callbacks run\",\n \"an old stream end cannot evict the replacement stream, which still delivers to its listener\",\n \"two same-worktree listeners share a synthetic subscription until the final stop unsubscribes and sends unwatch\"\n ]\n } Historical prior account (preserved verbatim): Audit1973: Delete the standalone mocked watcher cleanup suite and its entire sole-file prospective command. Retire the removed file-command transport-abort alias; preserve the independent cancellation suite and final-overflow/error/end cleanup callback, and13 unrelated receipt objects. Whole original changed dated receipts are retired, never narrowed or transferred. This metadata review claims no fresh execution, equivalent replacement, provider/PTY, live remote/mobile, rendered, cross-platform, soak or measured-budget result. Historical prior account (preserved verbatim): Audit1931 (sources1928/1929): Partial runtime files-watch suite retains controlled Windows close-event waiting, shared-client survival, late physical-exit ownership/deadline cleanup and shutdown joining. Its combined Windows close/deadline/late-exit alias remains backed by unchanged callbacks. Retire native-error-close, pre-publication setup ownership and failed-delete rearm aliases; associated delegation, failure forwarding, removal routing and recovery examples are lost. These tests inject watch/subscription seams and do not observe an actual native watcher or physical process. Preserve meaningful remaining selectors/assertions and unchanged dated receipts within their original scope. Reduced selectors have no fresh gate execution evidence in this metadata packet. No equivalent replacement, physical watcher/PTY/provider, live SSH/remote/mobile, rendered, cross-platform, soak or measured-budget result is claimed. Historical prior account (preserved verbatim): Audit1925 (sources1922/1923): Partial runtime watcher-host suite loses mocked option/event/overflow/resubscription forwarding, supplied teardown-error propagation, aborted-signal/no-call and private ten-thousand-waiter-count inventories. Retire the 10,000-caller bound and failed-recovery-subscriber-ending assertion aliases. Keep same-root owner cancellation, pre-ready replacement, held root-close join, stale-generation recovery delivery and initial failed-root ownership mappings backed by retained real-host callbacks with injected subscription/error/physical-exit promises. No actual native watcher, process termination or resource bound was observed. Preserve meaningful remaining selectors/assertions and unchanged dated receipts within their original scope. Reduced selectors have no fresh gate execution evidence in this metadata packet. No equivalent replacement, physical watcher/PTY/provider, live SSH/remote/mobile, rendered, cross-platform, soak or measured-budget result is claimed. Historical prior account (preserved verbatim): Audit1683 retires changed-source assertion and execution scope without equivalent replacement coverage. Existing unchanged-selector receipts remain scoped to their original sources. Historical prior-source oracle: Existing exact unchanged-selector receipts remain the only current execution evidence. Changed source selectors have no fresh execution result. Historical prior-source oracle account: Existing exact unchanged-selector receipts remain the only current execution evidence. Changed source selectors have no fresh execution result. Historical prior-source oracle account: Fill the global watcher-child reservation, require native desktop, paired-runtime, and WSL setup to retain typed transient capacity and retry after one serialized release, then cancel pending desktop and paired-client watches and require no retry. Hold one live anchor while aborting 10,000 callers at the capacity, quarantine-assignment, runtime-root, relay-setup, and SSH-registration layers; require exactly one explicit waiter and one base-promise reaction to remain, then zero after settlement. Hold an old relay unsubscribe, queue one same-root setup leader and one anchor, then abort 10,000 joiners; require every cancellation to settle before teardown releases, exactly one anchor waiter, and only one later physical install. Advance the former paired-web callback deadline while capacity remains full, require cancellation ownership to stay live, publish the server token before ready, and require files.unwatch to abort setup before a later slot release can install a native root. Reject the first ready-watch unwatch with a physical-exit promise, resolve that exit later, and require a fresh physical unwatch attempt, registry release, and exactly one stream end. Fill one healthy shared child with multiple roots, map a standard SSH repository's base, Git common directory, and worktree roots to one relay supervisor, then inject IPC disconnect-before-exit, queued and active cancellation, operations during termination, kill-without-exit, repeated unkillable generations, initial and recovery timeouts, and shard failure. During local and SSH deletion, attempt a late terminal spawn whose worktree identity and cwd name different roots, enumerate a non-prefix remote PTY by authoritative worktree ownership, withhold daemon/relay exit callbacks, make attach positively prove a concurrent-shutdown PID dead, and make the provider unavailable; require every acquired admission to roll back on rejection, dead-PID proof to settle physical exit before reaping, timeout to retain ownership, and Git/filesystem deletion never to start. Require bounded watcher process count, physical-exit settlement, healthy-root recovery, stale-generation rejection, overflow plus later events, and fail-closed destructive cleanup. Verify relay build hashes and remote install probes require both relay.js and relay-watcher.js. Launch the built relay with a real PTY and Parcel watch, kill only the watcher child, and require the same relay PID and PTY to answer before a replacement child delivers overflow and a post-crash event.", + "oracle": "Audit 3292 combines adopted 3285/3287/3289/3293 removals: 40 authored declarations and 47 expanded scenarios, including whole frame-editor-view, ambiguous remote-delete-refusal, unverifiable-host subscription and editor-close cleanup suites. The previously reviewed dock-badge suite was already removed upstream in PR 40895 and receives zero new removal credit. Intentionally retired alarms include background browser selection and last-tab landing; main startup fallback, SSH project cleanup/survivor routing, exact-PR contradiction/saved-push positives, replay/sidecar rollback and wrapped remote error normalization; records/snapshot missing-diff hydration, ambiguous folder-owner delete refusal, focus no-op notifications, nested editor context-only cache check, pending broadcast-first status and ordinary four-confirmation aggregation; preview-source frontmatter pruning, approved local/runtime agent dispatch, non-GitHub legacy PR cache invalidation, stale merged-head transient-error fallback, empty-queue immediate query reply and unverified-to-concrete preflight risk. Additional intentionally retired alarms are injected host subscription/unsubscribe counts, synthetic editor reveal/draft/fallback/scoped close, ambiguous unread refusals and hidden mark/read roundtrip, immediate connect backoff/noError, positive mirrored evidence-clock renewal, supplied VM failure/success projections and git-local/folder-SSH wake permutations. Remaining temporal/ownership cases are narrower; no equivalent replacement or fresh execution is claimed. Audit 3283 removes 20 authored declarations and 31 expanded scenarios, including two whole suites. Retired alarms cover PR refresh-state pruning, shared runtime subscription cleanup and store isolation, language content-change routing and older completion ownership, ordinary panel retry-timer cleanup and pending loading, four hosted-review lifetime permutations, mocked terminal creation error/order wiring, five sleep-inventory variants with pending-frame-only assertions, palette fallback/composite highlights, Windows/UNC encoded-editor input rows, mixed-repository partial failure counts, title setters and generated-title bypass/replacement, five window-close coordinator delegation/guard/finally branches, and ambiguous-old-record frame reveal. These regression checks are intentionally lost under the test-value audit; retained cases are not equivalent replacements. Prior coverage notes and receipts remain historical. Audit 3273 removes 14 authored declarations and 19 expanded scenarios across four whole suites and eight partial suites. Retired alarms cover saved-local cancellation/layout ownership, ambiguous-owner warning reset, folder attachment routing, VM false-capability bypass, abandoned reveal warmup cleanup and viewport claim deduplication/rearming, quiet unrelated remote-removal refusal, startup-command one-shot consumption, repository/floating recovery-ledger rows, fake-React pinned-scroll intent, split-ratio state identity/subscriber suppression and fractional change, cross-host project-group join refusal, three PR request-lifetime permutations, upstream-status preservation on error, and unresolved Git-owner refusal. These regression checks are intentionally lost under the test-value audit; retained scenarios are not equivalent replacements. Historical coverage receipts remain historical, including gate35 subscriber claims. Audit 3256 removes these specific alarms from the broad root unit commands: skill dialog active-share selection, close and pending-share handoff; simple keyed-record deletion; marker live-region insertion, simple landing and nine baseline policy examples; General search/control navigation inventory; orphan-count cache bootstrap; seven Codex code classifications and HTTP 429 warning mapping; two skill unread-root verdict examples; peer-mail payload and conversation-ID rejection; and the GitHub organization TABLE text-field optimistic rollback/failed-envelope example. These include real behaviors; retained tests do not provide equivalent coverage for every removed scenario. Mobile losses are recorded separately and are not coverage of these root commands. Audit3246 retires NewRowsMarker reveal/no-repeat and pane-scoped beforeinput checks; skill-owner option availability/count/dedup/order; six styled Input/Textarea IME forwarding rows; the static Codex/OpenCode smart-key inventory; tab-map AST ratchet diagnostic fixtures; child-roster work-budget and retained-aggregate alarms; malformed persisted floating-cwd fallback/no-crash/empty exact-root checks; the unanswered-host empty-list discriminator; the direct invalidated-cache commit-false assertion; one redundant digit-keyup IME row; cached non-supported Claude title-generator rows; and the duplicate late naming-result singleton. These root broad commands lose those specific alarms without equivalent replacement. Distinct retained owner/state checks have their own bounded claims; the real scheduler still rejects stale response data, while the direct false-return alarm is retired. Audit3231 retires supported-host restore-pane key mapping, closed/open creation-sidebar toggle visibility, unrelated scope-error/null classification and quick-submit reveal/no-create checks. These broad commands lose those real narrow alarms; no replacement coverage is claimed. Audit3219 removes the synthetic Cmd+J extra-source suite; this broad command no longer checks its match/tie placement and selection, announced count, empty-query cap, or workspace hiding with retained recent tabs. No replacement coverage is claimed. Audit3209 composes approved sources3202/3206: deliberately retires seven authored/expanded cases in four whole suites without equivalent replacement. Work-item queries lose real GitHub/GitLab oversized ASCII secret-prefix empty-query and whitespace-before-trim refusal alarms; inputs share the imported size bound and exercise only its fast length branch, with no multibyte or actual provider/exposure guarantee. Skill sharing loses complete/partial managed-bundle and destination-ambiguity association checks plus three negative origin/path/scheme admission examples; these do not establish uploaded contents, arbitrary-URL fetching, authorization or execution. Retain exact originless-project direct-link fallback, cloud-delete confirmation, bundled-target repair/owner isolation and explicit Windows-host preference over stale WSL suites. Rejected3201 runtime-preference removal is excluded. No real cloud/network/host/disk, mobile or mixed-version execution validation is claimed. Audit3200 composes approved source3194: deliberately retires thirteen authored registrations/twenty-seven expanded cases in six whole automation host/list policy suites without equivalent replacement. Real RPC category/retryability and wrapped-timeout recognition, unscoped-failure/scoped-success health evidence precedence, exact-ID create selectors and per-run workspace omission, paired-web local/SSH/absent host catalog routing, incompatible/removed/unhydrated/offline execution health, runtime-before-nested-SSH recovery dispatch, and no-owned-focus/successor/foreign-list focus policy alarms are consciously lost. Retain exact20line orphan allow/refuse/precondition and exact90line cross-host same-ID search suites. No retry-timer/fence lifecycle, actual reconnect/network/write delivery, native focus, mobile/mixed-version runtime or disk persistence coverage is claimed. Audit3191 combines approved source3182/3187/3188: deliberately retires thirteen authored Vitest registrations and fifteen expanded cases, including five whole suites, without equivalent replacement. Attachment intake loses real portal/native-capture terminal interception and unowned-container refusal, immediate child-only committed availability/claim-ref negotiation and delivery, and direct-target over stable focused/background composer routing through disable/re-enable/remount and independent question focus. Exact destination/cache/draft and final-stat owner/workspace/File-release suites remain; they do not replace Surface recipient routing. Automation authoring loses destination runtime catalog membership, local/direct-SSH exclusion of paired-runtime repos, unknown-runtime empty catalog, logical project/host/setup/repo/path context payload, and missing/nonready setup refusal; these were genuine direct helper alarms, while exact schedule transformation, legacy schedule and setup-decision suites remain. Agent picker loses setup-chat/terminal/missing-installer/unsupported-or-unknown-host row projection samples and the ordinary unsearched menu variant; the entire original26-line resume recipe suite remains, including reported bypass versus default/absent permission modes, as does the exact search-result menu callback with its fixtures, model/effort commits and staged Arguments reopen outcome. Rejected predecessor3180 full recipe deletion is excluded. No actual native drag/cursor/focus/IME, upload bytes or disk/restart persistence, full automation save/scheduler/runtime transport, real resume-process flags/environment delivery, or native menu/rendered layout validation is claimed. Audit3178 combines source3169/3170/3175: deliberately retires eight authored units (six Vitest cases and two imperative custom relay scenarios), including two whole suites, without equivalent replacement. Voice Section loses per-model pending-delete isolation across interleaved A/B completion and the two-success refresh-call alarm; exact VoicePane delayed key-clear/newer enabled-toggle merge remains and does not replace row deletion coverage. Speech loses dedicated rating-scale/inclusive-ceiling, unsupported-versus-unmeasured, explicit/system-language precedence/locale alias, accuracy versus fast named/default/best-measured selection, and unmeasured/no-match examples; exact offered-user-pick versus retired-selection case and its fixture remain. Relay loses legacy ping-delivery count/liveness sampled before the silence deadline and grouped malformed Bearer/host-ID 401/429 routing checks; twelve real Worker/DurableObject/shipped-client scenarios remain, not equivalent replacement for those narrow alarms. Six prior speech cases are not all deleted: approved successor3175 keeps the original user-choice case. No actual credential/file persistence, native/GPU/engine/download delivery, production assignment policy or deployed-runtime validation is claimed by this reduction. Audit3165 combines source3160/3162: deliberately retires six authored/expanded cases across three whole suites without equivalent replacement. Launch/status losses: observed React-render pending/resuming coordination across settings and deferred offer read; stale-offer reread suppressing dialog reopen; held-local-chat recovery visibility with new-chat preferences off; disabled-local admission avoiding offer RPC despite an injected but unconsumed paired-tab fixture; and run-only lost-reply uncertainty reachability until direct viewed-run retirement. Launch probe does not prove arbitrary synchronous-store atomicity, the paired fixture is not remote runtime enrollment, and the status case directly marks viewed state rather than rendering the summary. Crew-hook losses: old-host method_not_found cache persists across party changes but is released by independently supplied connection generation/verified pairing status or pairing revision, with actual frame publication and teardown. These are real narrow coordination, admission, uncertainty and mixed-version cache alarms consciously lost. Exact web verified-runtime writer handoff guard remains; it does not replace those alarms or prove live host/native/mobile delivery. Audit3156 combines3147/3150/3152/3153/3154: deliberately retires39authored/40expanded native-chat recovery cases, eight whole suites and two orphan test-support files without equivalent replacement. Lost alarms: lost-reply unconfirmed reconciliation, skipped rows/counts and missed-frame repair, unknown/pending outcome and omitted-failure-list compatibility, uncertain history after dismissal, retry/refusal/dismiss lifecycle, hidden/consumed picker ownership, result-tree keyboard focus/disclosure and all-skipped retirement; unconfirmed-over-conflict guidance and failed-chat changes despite older host timestamps; nearest-listed ancestor/cyclic forest shape, descendant membership, host ordering/missing-host local fallback; skipped/readiness/admission counts, provisional skip/progress monotonicity, early per-chat verdicts with batch pending protection, older-host waiting, start-slot/delivery distinction, retry-over-failure and unknown-after-withdrawal attention; remote snooze/reconnect/reoffer, unseen mixed summary through open/close, watched completion retirement, new success beside old failure, failed-reread mixed-result preservation, filter/collapse completion resets, retry summary replacement and current-offer/history selection; cross-host workspace identity, rendered cyclic reachability, nested tri-state/toggle propagation, project eligibility isolation and collapse preserving selection. Exact fallback-list completion barrier, batched verdict/cleanup retention, stale-read versus dismissal publication race, and requested-but-never-rendered finished-run retirement remain; they do not replace retired alarms. Audit3146 combines source reviews3132/3133/3135/3138/3143: intentionally retire20authored/31expanded cases without equivalent replacement. Provider-session losses: structured-native terminal-resume exclusion, metadata-less completed identity, new-turn completion clearing, Pi provider-only/periodic/manual promotion, changed-transcript launch-config isolation, Pi/omp/prime-agent completed-session remote/manual-shutdown promotion, and quit/done precedence over heartbeat. Side-thread/question losses: finished-pane acquisition, hidden title/recap states, local/relay/relay-done conversation takeover with prompt/session/child resets, plain-message abandonment, compaction/session replacement and completion resets. Codex startup losses: incoming-owner cached child replacement, old-relay foreign live-session correction, completed foreign-root turn-fact permutations. Transcript losses: real temporary-JSONL partial sibling/final-child completion, unlabelled child attribution, compact cached replay preservation and100/1000completed-child roster retention/release. Compiler-ratchet losses: valid-line uncompiled-list parser grammar examples and injected-existence stale-path filtering; these did not exercise actual filesystem canonicalization or build exclusion. These are real lifecycle, ownership, replay, liveness and retention alarms, including recent#40246 regressions, deliberately lost. Retained conditional record replacement, clockless root/SSH owner isolation, persisted main-thread fork rejection, partial/final question-answer lifetime, cached-roster/missing-ID/live HTTP/durable startup boundaries and restarted-relay refusal/acceptance do not replace those losses. No native/SSH/WSL execution or equivalent coverage is claimed. Audit3128 scoped coverage reduction: Audit3121 removes VoiceDictationLanguageSetting.test.tsx (Spanish-to-es callback and unsupported-model Korean option presence) and voice-speech-model-rows.test.ts (provider/language-order/retired-on-disk list policy); these real narrow alarms are deliberately retired without replacement. VoiceSpeechModelSection per-model concurrent deletion remains unchanged. Audit3122 removes the direct absolute/parent-segment sparse-directory exception-type sample and the five-row IPC sparse-preset error-code/non-save table (two authored/six expanded cases). Those real typed-validation and IPC refusal/error-code alarms are deliberately retired. Keep both real symlink/junction floating-directory trust cases and the minimal RPC structured validation-reason serialization case. The RPC case does not replace IPC save/refusal behavior, typed normalization for both path inputs, actual Git sparse checkout or rendered localization. No equivalent replacement or fresh test/runtime/platform/remote/performance validation is claimed. Audit3124 removes ExperimentalPane.test.tsx (ordinary Pet switch callback), WorkspaceDirectorySetting.test.tsx (padded absolute saved-path normalization/no-write blur), and repository-search.perf.test.ts (navigation/selected-pane builder-call policy, fixture cardinality/nonempty entries and renamed project keyword inclusion). These real narrow alarms are retired without replacement; RepositoryPane.search.test.tsx search-to-sparse-editor request remains unchanged. Audit3129: resolver Windows case-insensitive and POSIX case-sensitive configured-env composition plus mocked-base launch-preflight Windows composition are intentionally no longer checked by the two deleted suites. No equivalent coverage claimed. Keep runtime-structured-agent-host-env.test.ts unchanged: configured Windows Claude-home account identity and host-account precedence remain checked. Audit3114 incorporates source3101: retire three structured Claude child-environment wrapper cases covering inherited stamp isolation/default and explicit entrypoint, Windows SDK-key canonicalization/default/duplicate-key order, and configured lookup/final environment/config-dir conjunction. Keep direct auth/session sanitation and Windows-versus-Linux overlay checks, actual executable lookup from supplied inherited PATH, native Windows child environment delivery, and stale option-mutation fencing. These are not equivalent replacements for the retired wrapper alarms. No fresh test/runtime, real login-shell probe, Claude SDK startup, remote/mixed-version, UI or performance result is claimed. Audit3114 incorporates source3105: retire 17 authored/20 expanded daemon launch-note cases, including the entire two-case SessionLaunchNote suite. Deliberately lose split-marker carry across same-token re-arm, stale-token retirement refusal, foreground tri-state and serial settlement, omitted-note/no-incarnation mixed-version policy, sticky retirement, first-incarnation/replacement launch preservation and held-launch precedence. Keep only the unchanged unresolved foreground-read race against a later finished attach. Supplied notes/foreground and runtime calls do not establish actual daemon/main restart, SSH, native Windows observation, mobile UI, equivalent replacement or fresh runtime/performance validation. Audit3114 incorporates source3109: retire six authored/35 expanded pricing cases: 21 accepted model-name examples, 10 unsupported/future-model fail-closed examples, malformed TTL clamp, unknown-model estimate refusal, flat-model long-context disregard and oversized long-context clamp. Keep mixed five-minute/one-hour write allocation and short/all-long/mixed long-context allocation with original fixed oracles. Real parser/refusal/bounds alarms are knowingly lost without equivalent replacement; retained tests do not validate provider rates, actual billing or request threshold classification. Preserve the archived usage-scan-append source-freeze receipt without transferring historical execution/performance credit. No fresh runtime result is claimed. Audit3108 source-only reduction (3094/3095/3100): retire 27 authored/30 expanded cases, including complete markdown view-state, file-preview link-open and CLI agent-server-route suites, without replacement. Deliberate losses include preview visibility/reference lifetime and same-path owners; SSH stat, directory/missing-target, explicit-null owner, nonmarkdown line/column, local URI routing, remote-to-client guard and same-file reuse; document-preview source-owner/folder/reuse routing, stable grant location and outside-workspace POSIX/Windows request projection; and verified remote CLI send/check refusal, suggested --on argv/copy, shell no-probe bypass, unverified-launch admission and older-peer refusal. Retain two markdown source-runtime/qualified-reveal alarms, one stale grant-rejection fence and two remote read/mutation evidence policies, with original callbacks. Final last-wins reveal did not prove transient cancellation; CLI prerequisite did not prove no real send, and envelope tests do not execute server refusal. No fresh runtime, rendered UI, actual file/SSH/paired transport, authorization, mixed-version or performance result is claimed. Audit3096 source-only reduction (3087/3088): retire 69 authored/76 expanded cases, including complete recovery-portals and reconnect-banner suites. Intentionally lose dead/default TUI replay, generated alternate-frame style composition, reset/mode/dimension and legacy missing-mode-boundary alarms, UI notice/action/reveal policies, and isolated recovery lifecycle variants, without equivalent replacement. Retained registrations and callbacks are unchanged; headless cells are not pixels, and no fresh runtime, host, SSH, WSL, rendered-app or performance result is claimed. Audit3086 source-only reduction (3079/3080/3081): intentionally retire 93 authored/100 expanded mock-boundary cases, including the complete spawn-errors and SSH reconnect overlay suites, without replacement. Retired alarms include spawn classification/ownership, reply ceilings and renderer-write failure recovery, disconnect/detach fencing branches, authority facts, and overlay retry/visibility wiring. Retained callbacks are unchanged; no fresh execution, real PTY/SSH, rendered UI, or performance result is claimed. Audit2432: The broad unit command loses the isolated BranchPicker open-change notification sample. Its unique true/false callback alarm is intentionally retired; reopening/status-refresh behavior was not exercised. No equivalent replacement or fresh validation of the reduced selector is claimed. Audit2425: The broad unit command loses the workspace-copy-status supplied readError forwarding sample. It did not exercise the branch-switch blocking promised by its title. This alarm is intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2417: The broad unit command loses two ordinary clean Git cherry-pick/revert success samples and two terminal startup foreground-read work-budget samples. These unique alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2412: The broad unit command loses the whole six-case fake-React-hook scroll-anchor suite, two generic draft-retention samples, a simple new-agent order sample, a real history-publication batching-count sample, an unmounted handoff abort/timer sample and three basic WSL preview/error samples. These alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2404: The broad unit command loses the standalone share-name lookup 503 propagation suite, initial deletion placement-kind sample, direct changed-mtime stale sample, first-pass rollback existence example and abandoned-preparation directory sample. These exact alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2397 review amendment: The broad unit command loses three standalone suites, two partial-case definitions and two URL table rows across package/download/placement tests. Keep initial wrong-port authorization, modified independent-copy digest refusal and abort-after-begin cancellation dispatch. The remaining alarms are deliberately retired; no equivalent complete replacement or fresh validation of the reduced selector is claimed. Audit2393 current-parent refresh2401: Remove the basic skill-install service alias sample and original public managed-remove receiptless refusal case. Preserve the upstream request ownership suite and transaction interruption coverage. No equivalent complete replacement or fresh validation of the reduced selector is claimed. Audit2389: The broad unit command loses the missing-preview suite, plain-global destination sample and prepublished-receipt recovery example. No equivalent replacement or fresh validation of the reduced selector is claimed. Audit2385: The broad unit command loses four authored walker/staging/protocol examples (six expanded cases); no equivalent replacement or fresh validation is claimed for the reduced suite. Audit2383: The unscoped Vitest command no longer includes the removed Antigravity catalogue suite; its exact provider-root/owner example has no equivalent replacement or fresh validation claim. Audit2377/2381: The unscoped Vitest command includes the reduced bundled-skill and native-discovery suites; the eight removed backup/legacy/catalogue/symlink/SSH-builder examples have no replacement-equivalence or fresh validation claim here. Audit2133 current-parent preparation: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2095 current-parent preparation2126: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2090 (sources2088/2089): Current reduced suites intentionally retire the alarms listed in knownGaps; prior dated execution and replacement claims do not validate changed source bytes or selectors. Historical prior account (preserved verbatim): Audit2086 (sources2082/2083): Current reduced suites intentionally retire the alarms listed in knownGaps; prior dated execution and replacement claims do not validate changed source bytes or selectors. Historical prior account (preserved verbatim): Audit2076 (sources2073/2074): Intentionally retire these low-value alarms without replacement: src/main/runtime/orca-runtime-tests/terminal-handles-part-02.spec.ts: recovers a moved SSH pane through the tab it now sits in, not the one its lease froze; reports a plain expired orphan; does not report a pane whose only recent lease was superseded; does not report a pane whose only recent lease had its relay id recycled; picks the eligible orphan over a superseded predecessor that matches first; collects the same tabs the per-tab reader reports, in one sweep of the leases; reports no candidate when no lease names any of the worktree tabs. src/main/runtime/orca-runtime-tests/runtime-availability.spec.ts: starts unavailable with no authoritative window; reports the configured Windows terminal shell on status; reports floating workspace availability from settings on status; polls floating tabs with targeted PTY liveness and no repo/provider inventory; hydrates persisted tabs when the store cannot report repos; advertises browser screencast only when a renderer window is available; routes mobile Codex reset consumption through the account mutation coordinator; maps a definite pre-provider rejection into an authoritative current snapshot. Existing unrelated evidenceRuns retain their original scope; unchanged dated receipt objects do not validate changed source bytes or reduced selectors. No fresh gate execution or historical import-closure equivalence is claimed. Frozen current literal-import graph reaches these changed test bytes; unresolved local and computed edges remain debt, and current reachability is not historical execution or equivalent replacement evidence. Historical prior account (preserved verbatim): Audit2056 (sources2054/2055): Intentionally retire these low-value alarms without replacement: src/renderer/src/runtime/files/watching/runtime-file-client-watch.test.ts: delivers remote file changes to listeners for the same worktree. src/main/runtime/orca-runtime.test.ts: ordinary registration cleanup removes only await import('./orca-runtime-tests/mobile-session-tabs-part-14.spec'). src/main/runtime/orca-runtime-tests/terminal-side-effect-facts-part-03.spec.ts: arms the stale-title timer for a seeded working title; arms the Command Code scrape from the noted spawn command; prefers the tracked title over a stale renderer lastTitle in the hydration seed; writes recent output into the current runtime output map; uses a later title handler replacement with the runtime receiver; calls the current injected listener with the runtime receiver; keeps optional reconciliation lazy after its callback is removed. src/main/runtime/orca-runtime-tests/mobile-session-tabs-part-14.spec.ts: lists them, so a paired client can mirror a migrated editor; closes one by retiring it from the host session; keeps an unsaved draft unless the close is forced; shares aggregate work but leaves a replacement pending promise alone; lets a targeted refresh finish while an aggregate refresh waits; refuses a close when the store lacks %s before the guard; keeps a later missing %s on the original caught failure path. Existing unrelated evidenceRuns retain their original scope; unchanged dated receipt objects do not validate changed source bytes or reduced selectors. No fresh gate execution or historical import-closure equivalence is claimed. Exact retired assertionRefs, preserved as historical objects only: {\n \"file\": \"src/renderer/src/runtime/files/watching/runtime-file-client-watch.test.ts\",\n \"assertions\": [\n \"terminal watcher error and setup failure evict the shared entry before retrying callbacks run\",\n \"an old stream end cannot evict the replacement stream, which still delivers to its listener\",\n \"two same-worktree listeners share a synthetic subscription until the final stop unsubscribes and sends unwatch\"\n ]\n } Historical prior account (preserved verbatim): Audit1973: Delete the standalone mocked watcher cleanup suite and its entire sole-file prospective command. Retire the removed file-command transport-abort alias; preserve the independent cancellation suite and final-overflow/error/end cleanup callback, and13 unrelated receipt objects. Whole original changed dated receipts are retired, never narrowed or transferred. This metadata review claims no fresh execution, equivalent replacement, provider/PTY, live remote/mobile, rendered, cross-platform, soak or measured-budget result. Historical prior account (preserved verbatim): Audit1931 (sources1928/1929): Partial runtime files-watch suite retains controlled Windows close-event waiting, shared-client survival, late physical-exit ownership/deadline cleanup and shutdown joining. Its combined Windows close/deadline/late-exit alias remains backed by unchanged callbacks. Retire native-error-close, pre-publication setup ownership and failed-delete rearm aliases; associated delegation, failure forwarding, removal routing and recovery examples are lost. These tests inject watch/subscription seams and do not observe an actual native watcher or physical process. Preserve meaningful remaining selectors/assertions and unchanged dated receipts within their original scope. Reduced selectors have no fresh gate execution evidence in this metadata packet. No equivalent replacement, physical watcher/PTY/provider, live SSH/remote/mobile, rendered, cross-platform, soak or measured-budget result is claimed. Historical prior account (preserved verbatim): Audit1925 (sources1922/1923): Partial runtime watcher-host suite loses mocked option/event/overflow/resubscription forwarding, supplied teardown-error propagation, aborted-signal/no-call and private ten-thousand-waiter-count inventories. Retire the 10,000-caller bound and failed-recovery-subscriber-ending assertion aliases. Keep same-root owner cancellation, pre-ready replacement, held root-close join, stale-generation recovery delivery and initial failed-root ownership mappings backed by retained real-host callbacks with injected subscription/error/physical-exit promises. No actual native watcher, process termination or resource bound was observed. Preserve meaningful remaining selectors/assertions and unchanged dated receipts within their original scope. Reduced selectors have no fresh gate execution evidence in this metadata packet. No equivalent replacement, physical watcher/PTY/provider, live SSH/remote/mobile, rendered, cross-platform, soak or measured-budget result is claimed. Historical prior account (preserved verbatim): Audit1683 retires changed-source assertion and execution scope without equivalent replacement coverage. Existing unchanged-selector receipts remain scoped to their original sources. Historical prior-source oracle: Existing exact unchanged-selector receipts remain the only current execution evidence. Changed source selectors have no fresh execution result. Historical prior-source oracle account: Existing exact unchanged-selector receipts remain the only current execution evidence. Changed source selectors have no fresh execution result. Historical prior-source oracle account: Fill the global watcher-child reservation, require native desktop, paired-runtime, and WSL setup to retain typed transient capacity and retry after one serialized release, then cancel pending desktop and paired-client watches and require no retry. Hold one live anchor while aborting 10,000 callers at the capacity, quarantine-assignment, runtime-root, relay-setup, and SSH-registration layers; require exactly one explicit waiter and one base-promise reaction to remain, then zero after settlement. Hold an old relay unsubscribe, queue one same-root setup leader and one anchor, then abort 10,000 joiners; require every cancellation to settle before teardown releases, exactly one anchor waiter, and only one later physical install. Advance the former paired-web callback deadline while capacity remains full, require cancellation ownership to stay live, publish the server token before ready, and require files.unwatch to abort setup before a later slot release can install a native root. Reject the first ready-watch unwatch with a physical-exit promise, resolve that exit later, and require a fresh physical unwatch attempt, registry release, and exactly one stream end. Fill one healthy shared child with multiple roots, map a standard SSH repository's base, Git common directory, and worktree roots to one relay supervisor, then inject IPC disconnect-before-exit, queued and active cancellation, operations during termination, kill-without-exit, repeated unkillable generations, initial and recovery timeouts, and shard failure. During local and SSH deletion, attempt a late terminal spawn whose worktree identity and cwd name different roots, enumerate a non-prefix remote PTY by authoritative worktree ownership, withhold daemon/relay exit callbacks, make attach positively prove a concurrent-shutdown PID dead, and make the provider unavailable; require every acquired admission to roll back on rejection, dead-PID proof to settle physical exit before reaping, timeout to retain ownership, and Git/filesystem deletion never to start. Require bounded watcher process count, physical-exit settlement, healthy-root recovery, stale-generation rejection, overflow plus later events, and fail-closed destructive cleanup. Verify relay build hashes and remote install probes require both relay.js and relay-watcher.js. Launch the built relay with a real PTY and Parcel watch, kill only the watcher child, and require the same relay PID and PTY to answer before a replacement child delivers overflow and a post-crash event.", "commands": [ "pnpm exec vitest run --config config/vitest.config.ts src/main/ipc/filesystem/watcher-process/parcel-watcher-unsubscribe-timeout.test.ts --reporter=dot", "pnpm exec vitest run --config config/vitest.config.ts src/main/ipc/filesystem/watchers/filesystem-watcher.test.ts src/main/ipc/filesystem/watchers/filesystem-watcher-native-capacity.test.ts src/main/ipc/filesystem/watcher-process/parcel-watcher-child-registry.test.ts src/main/ipc/filesystem/watcher-process/parcel-watcher-child-launch.test.ts src/main/ipc/filesystem/watcher-process/parcel-watcher-process.test.ts src/main/ipc/filesystem/watcher-process/parcel-watcher-supervisor-capacity.test.ts src/main/ipc/filesystem/watcher-process/parcel-watcher-disconnect-termination.test.ts src/main/ipc/filesystem/watcher-process/runtime-watcher-pending-assignment.test.ts src/main/ipc/filesystem/watcher-process/parcel-watcher-event-delivery.test.ts src/main/ipc/filesystem/watchers/filesystem-watcher-local-unsubscribe.test.ts src/main/ipc/filesystem/watchers/filesystem-watcher-wsl.test.ts src/main/ipc/worktrees-delete-pty-teardown.test.ts src/main/ipc/worktrees-orphan-directory-cleanup.test.ts src/main/ipc/worktrees-remove-preflight.test.ts src/main/workspaces/removal/watcher-removal-gate.test.ts src/main/runtime/files/watch/orca-runtime-files-watch.test.ts src/main/runtime/workspaces/removal/worktree-teardown.test.ts src/main/runtime/construction/orca-runtime.test.ts src/main/runtime/rpc/methods/files/files.test.ts src/main/runtime/rpc/methods/files/files-watch-cancellation.test.ts src/renderer/src/web/web-runtime-client.test.ts src/shared/cross-platform-path.test.ts src/shared/physical-exit-tracker.test.ts src/shared/promise-settlement-waiters.test.ts src/main/ipc/pty/pty-spawn-cwd-fallback.test.ts src/main/providers/local-pty/local-pty-provider-shutdown.test.ts src/main/daemon/providers/adapter/testing/daemon-pty-adapter.test.ts src/main/daemon/pty-subprocess/testing/pty-subprocess.test.ts src/main/daemon/sessions/testing/session.test.ts src/main/daemon/terminal-host/testing/terminal-host.test.ts src/main/daemon/terminal-host/testing/terminal-host-session-reaping-leak.test.ts --reporter=dot", @@ -13187,7 +13192,8 @@ "Audit3246 retires NewRowsMarker reveal/no-repeat and pane-scoped beforeinput checks; skill-owner option availability/count/dedup/order; six styled Input/Textarea IME forwarding rows; the static Codex/OpenCode smart-key inventory; tab-map AST ratchet diagnostic fixtures; child-roster work-budget and retained-aggregate alarms; malformed persisted floating-cwd fallback/no-crash/empty exact-root checks; the unanswered-host empty-list discriminator; the direct invalidated-cache commit-false assertion; one redundant digit-keyup IME row; cached non-supported Claude title-generator rows; and the duplicate late naming-result singleton. These root broad commands lose those specific alarms without equivalent replacement. Distinct retained owner/state checks have their own bounded claims; the real scheduler still rejects stale response data, while the direct false-return alarm is retired.", "Audit 3256 removes these specific alarms from the broad root unit commands: skill dialog active-share selection, close and pending-share handoff; simple keyed-record deletion; marker live-region insertion, simple landing and nine baseline policy examples; General search/control navigation inventory; orphan-count cache bootstrap; seven Codex code classifications and HTTP 429 warning mapping; two skill unread-root verdict examples; peer-mail payload and conversation-ID rejection; and the GitHub organization TABLE text-field optimistic rollback/failed-envelope example. These include real behaviors; retained tests do not provide equivalent coverage for every removed scenario. Mobile losses are recorded separately and are not coverage of these root commands.", "Audit 3273 removes 14 authored declarations and 19 expanded scenarios across four whole suites and eight partial suites. Retired alarms cover saved-local cancellation/layout ownership, ambiguous-owner warning reset, folder attachment routing, VM false-capability bypass, abandoned reveal warmup cleanup and viewport claim deduplication/rearming, quiet unrelated remote-removal refusal, startup-command one-shot consumption, repository/floating recovery-ledger rows, fake-React pinned-scroll intent, split-ratio state identity/subscriber suppression and fractional change, cross-host project-group join refusal, three PR request-lifetime permutations, upstream-status preservation on error, and unresolved Git-owner refusal. These regression checks are intentionally lost under the test-value audit; retained scenarios are not equivalent replacements. Historical coverage receipts remain historical, including gate35 subscriber claims.", - "Audit 3283 removes 20 authored declarations and 31 expanded scenarios, including two whole suites. Retired alarms cover PR refresh-state pruning, shared runtime subscription cleanup and store isolation, language content-change routing and older completion ownership, ordinary panel retry-timer cleanup and pending loading, four hosted-review lifetime permutations, mocked terminal creation error/order wiring, five sleep-inventory variants with pending-frame-only assertions, palette fallback/composite highlights, Windows/UNC encoded-editor input rows, mixed-repository partial failure counts, title setters and generated-title bypass/replacement, five window-close coordinator delegation/guard/finally branches, and ambiguous-old-record frame reveal. These regression checks are intentionally lost under the test-value audit; retained cases are not equivalent replacements. Prior coverage notes and receipts remain historical." + "Audit 3283 removes 20 authored declarations and 31 expanded scenarios, including two whole suites. Retired alarms cover PR refresh-state pruning, shared runtime subscription cleanup and store isolation, language content-change routing and older completion ownership, ordinary panel retry-timer cleanup and pending loading, four hosted-review lifetime permutations, mocked terminal creation error/order wiring, five sleep-inventory variants with pending-frame-only assertions, palette fallback/composite highlights, Windows/UNC encoded-editor input rows, mixed-repository partial failure counts, title setters and generated-title bypass/replacement, five window-close coordinator delegation/guard/finally branches, and ambiguous-old-record frame reveal. These regression checks are intentionally lost under the test-value audit; retained cases are not equivalent replacements. Prior coverage notes and receipts remain historical.", + "Audit 3292 combines adopted 3285/3287/3289/3293 removals: 40 authored declarations and 47 expanded scenarios, including whole frame-editor-view, ambiguous remote-delete-refusal, unverifiable-host subscription and editor-close cleanup suites. The previously reviewed dock-badge suite was already removed upstream in PR 40895 and receives zero new removal credit. Intentionally retired alarms include background browser selection and last-tab landing; main startup fallback, SSH project cleanup/survivor routing, exact-PR contradiction/saved-push positives, replay/sidecar rollback and wrapped remote error normalization; records/snapshot missing-diff hydration, ambiguous folder-owner delete refusal, focus no-op notifications, nested editor context-only cache check, pending broadcast-first status and ordinary four-confirmation aggregation; preview-source frontmatter pruning, approved local/runtime agent dispatch, non-GitHub legacy PR cache invalidation, stale merged-head transient-error fallback, empty-queue immediate query reply and unverified-to-concrete preflight risk. Additional intentionally retired alarms are injected host subscription/unsubscribe counts, synthetic editor reveal/draft/fallback/scoped close, ambiguous unread refusals and hidden mark/read roundtrip, immediate connect backoff/noError, positive mirrored evidence-clock renewal, supplied VM failure/success projections and git-local/folder-SSH wake permutations. Remaining temporal/ownership cases are narrower; no equivalent replacement or fresh execution is claimed." ], "demotionRule": "Demote or quarantine if the fault harness flakes without a product or harness bug, if healthy operation exceeds one runtime watcher child, if total physical operation exceeds eight children including retiring generations, if quarantine children outlive their roots or repeat after fusing, if event delivery becomes unbounded, or if metadata/stat work returns to the serve process." }, @@ -14432,10 +14438,10 @@ "providers": ["paired-runtime"], "coveredPlatforms": ["linux"], "coveredProviders": ["paired-runtime"], - "coverageNotes": "Audit 3283 removes 20 authored declarations and 31 expanded scenarios, including two whole suites. Retired alarms cover PR refresh-state pruning, shared runtime subscription cleanup and store isolation, language content-change routing and older completion ownership, ordinary panel retry-timer cleanup and pending loading, four hosted-review lifetime permutations, mocked terminal creation error/order wiring, five sleep-inventory variants with pending-frame-only assertions, palette fallback/composite highlights, Windows/UNC encoded-editor input rows, mixed-repository partial failure counts, title setters and generated-title bypass/replacement, five window-close coordinator delegation/guard/finally branches, and ambiguous-old-record frame reveal. These regression checks are intentionally lost under the test-value audit; retained cases are not equivalent replacements. Prior coverage notes and receipts remain historical. Audit 3273 removes 14 authored declarations and 19 expanded scenarios across four whole suites and eight partial suites. Retired alarms cover saved-local cancellation/layout ownership, ambiguous-owner warning reset, folder attachment routing, VM false-capability bypass, abandoned reveal warmup cleanup and viewport claim deduplication/rearming, quiet unrelated remote-removal refusal, startup-command one-shot consumption, repository/floating recovery-ledger rows, fake-React pinned-scroll intent, split-ratio state identity/subscriber suppression and fractional change, cross-host project-group join refusal, three PR request-lifetime permutations, upstream-status preservation on error, and unresolved Git-owner refusal. These regression checks are intentionally lost under the test-value audit; retained scenarios are not equivalent replacements. Historical coverage receipts remain historical, including gate35 subscriber claims. Audit 3256 removes these specific alarms from the broad root unit commands: skill dialog active-share selection, close and pending-share handoff; simple keyed-record deletion; marker live-region insertion, simple landing and nine baseline policy examples; General search/control navigation inventory; orphan-count cache bootstrap; seven Codex code classifications and HTTP 429 warning mapping; two skill unread-root verdict examples; peer-mail payload and conversation-ID rejection; and the GitHub organization TABLE text-field optimistic rollback/failed-envelope example. These include real behaviors; retained tests do not provide equivalent coverage for every removed scenario. Mobile losses are recorded separately and are not coverage of these root commands. Audit3246 retires NewRowsMarker reveal/no-repeat and pane-scoped beforeinput checks; skill-owner option availability/count/dedup/order; six styled Input/Textarea IME forwarding rows; the static Codex/OpenCode smart-key inventory; tab-map AST ratchet diagnostic fixtures; child-roster work-budget and retained-aggregate alarms; malformed persisted floating-cwd fallback/no-crash/empty exact-root checks; the unanswered-host empty-list discriminator; the direct invalidated-cache commit-false assertion; one redundant digit-keyup IME row; cached non-supported Claude title-generator rows; and the duplicate late naming-result singleton. These root broad commands lose those specific alarms without equivalent replacement. Distinct retained owner/state checks have their own bounded claims; the real scheduler still rejects stale response data, while the direct false-return alarm is retired. Audit3231 retires supported-host restore-pane key mapping, closed/open creation-sidebar toggle visibility, unrelated scope-error/null classification and quick-submit reveal/no-create checks. These broad commands lose those real narrow alarms; no replacement coverage is claimed. Audit3219 removes the synthetic Cmd+J extra-source suite; this broad command no longer checks its match/tie placement and selection, announced count, empty-query cap, or workspace hiding with retained recent tabs. No replacement coverage is claimed. Audit3209 composes approved sources3202/3206: deliberately retires seven authored/expanded cases in four whole suites without equivalent replacement. Work-item queries lose real GitHub/GitLab oversized ASCII secret-prefix empty-query and whitespace-before-trim refusal alarms; inputs share the imported size bound and exercise only its fast length branch, with no multibyte or actual provider/exposure guarantee. Skill sharing loses complete/partial managed-bundle and destination-ambiguity association checks plus three negative origin/path/scheme admission examples; these do not establish uploaded contents, arbitrary-URL fetching, authorization or execution. Retain exact originless-project direct-link fallback, cloud-delete confirmation, bundled-target repair/owner isolation and explicit Windows-host preference over stale WSL suites. Rejected3201 runtime-preference removal is excluded. No real cloud/network/host/disk, mobile or mixed-version execution validation is claimed. Audit3200 composes approved source3194: deliberately retires thirteen authored registrations/twenty-seven expanded cases in six whole automation host/list policy suites without equivalent replacement. Real RPC category/retryability and wrapped-timeout recognition, unscoped-failure/scoped-success health evidence precedence, exact-ID create selectors and per-run workspace omission, paired-web local/SSH/absent host catalog routing, incompatible/removed/unhydrated/offline execution health, runtime-before-nested-SSH recovery dispatch, and no-owned-focus/successor/foreign-list focus policy alarms are consciously lost. Retain exact20line orphan allow/refuse/precondition and exact90line cross-host same-ID search suites. No retry-timer/fence lifecycle, actual reconnect/network/write delivery, native focus, mobile/mixed-version runtime or disk persistence coverage is claimed. Audit3191 combines approved source3182/3187/3188: deliberately retires thirteen authored Vitest registrations and fifteen expanded cases, including five whole suites, without equivalent replacement. Attachment intake loses real portal/native-capture terminal interception and unowned-container refusal, immediate child-only committed availability/claim-ref negotiation and delivery, and direct-target over stable focused/background composer routing through disable/re-enable/remount and independent question focus. Exact destination/cache/draft and final-stat owner/workspace/File-release suites remain; they do not replace Surface recipient routing. Automation authoring loses destination runtime catalog membership, local/direct-SSH exclusion of paired-runtime repos, unknown-runtime empty catalog, logical project/host/setup/repo/path context payload, and missing/nonready setup refusal; these were genuine direct helper alarms, while exact schedule transformation, legacy schedule and setup-decision suites remain. Agent picker loses setup-chat/terminal/missing-installer/unsupported-or-unknown-host row projection samples and the ordinary unsearched menu variant; the entire original26-line resume recipe suite remains, including reported bypass versus default/absent permission modes, as does the exact search-result menu callback with its fixtures, model/effort commits and staged Arguments reopen outcome. Rejected predecessor3180 full recipe deletion is excluded. No actual native drag/cursor/focus/IME, upload bytes or disk/restart persistence, full automation save/scheduler/runtime transport, real resume-process flags/environment delivery, or native menu/rendered layout validation is claimed. Audit3178 combines source3169/3170/3175: deliberately retires eight authored units (six Vitest cases and two imperative custom relay scenarios), including two whole suites, without equivalent replacement. Voice Section loses per-model pending-delete isolation across interleaved A/B completion and the two-success refresh-call alarm; exact VoicePane delayed key-clear/newer enabled-toggle merge remains and does not replace row deletion coverage. Speech loses dedicated rating-scale/inclusive-ceiling, unsupported-versus-unmeasured, explicit/system-language precedence/locale alias, accuracy versus fast named/default/best-measured selection, and unmeasured/no-match examples; exact offered-user-pick versus retired-selection case and its fixture remain. Relay loses legacy ping-delivery count/liveness sampled before the silence deadline and grouped malformed Bearer/host-ID 401/429 routing checks; twelve real Worker/DurableObject/shipped-client scenarios remain, not equivalent replacement for those narrow alarms. Six prior speech cases are not all deleted: approved successor3175 keeps the original user-choice case. No actual credential/file persistence, native/GPU/engine/download delivery, production assignment policy or deployed-runtime validation is claimed by this reduction. Audit3165 combines source3160/3162: deliberately retires six authored/expanded cases across three whole suites without equivalent replacement. Launch/status losses: observed React-render pending/resuming coordination across settings and deferred offer read; stale-offer reread suppressing dialog reopen; held-local-chat recovery visibility with new-chat preferences off; disabled-local admission avoiding offer RPC despite an injected but unconsumed paired-tab fixture; and run-only lost-reply uncertainty reachability until direct viewed-run retirement. Launch probe does not prove arbitrary synchronous-store atomicity, the paired fixture is not remote runtime enrollment, and the status case directly marks viewed state rather than rendering the summary. Crew-hook losses: old-host method_not_found cache persists across party changes but is released by independently supplied connection generation/verified pairing status or pairing revision, with actual frame publication and teardown. These are real narrow coordination, admission, uncertainty and mixed-version cache alarms consciously lost. Exact web verified-runtime writer handoff guard remains; it does not replace those alarms or prove live host/native/mobile delivery. Audit3156 combines3147/3150/3152/3153/3154: deliberately retires39authored/40expanded native-chat recovery cases, eight whole suites and two orphan test-support files without equivalent replacement. Lost alarms: lost-reply unconfirmed reconciliation, skipped rows/counts and missed-frame repair, unknown/pending outcome and omitted-failure-list compatibility, uncertain history after dismissal, retry/refusal/dismiss lifecycle, hidden/consumed picker ownership, result-tree keyboard focus/disclosure and all-skipped retirement; unconfirmed-over-conflict guidance and failed-chat changes despite older host timestamps; nearest-listed ancestor/cyclic forest shape, descendant membership, host ordering/missing-host local fallback; skipped/readiness/admission counts, provisional skip/progress monotonicity, early per-chat verdicts with batch pending protection, older-host waiting, start-slot/delivery distinction, retry-over-failure and unknown-after-withdrawal attention; remote snooze/reconnect/reoffer, unseen mixed summary through open/close, watched completion retirement, new success beside old failure, failed-reread mixed-result preservation, filter/collapse completion resets, retry summary replacement and current-offer/history selection; cross-host workspace identity, rendered cyclic reachability, nested tri-state/toggle propagation, project eligibility isolation and collapse preserving selection. Exact fallback-list completion barrier, batched verdict/cleanup retention, stale-read versus dismissal publication race, and requested-but-never-rendered finished-run retirement remain; they do not replace retired alarms. Audit3146 combines source reviews3132/3133/3135/3138/3143: intentionally retire20authored/31expanded cases without equivalent replacement. Provider-session losses: structured-native terminal-resume exclusion, metadata-less completed identity, new-turn completion clearing, Pi provider-only/periodic/manual promotion, changed-transcript launch-config isolation, Pi/omp/prime-agent completed-session remote/manual-shutdown promotion, and quit/done precedence over heartbeat. Side-thread/question losses: finished-pane acquisition, hidden title/recap states, local/relay/relay-done conversation takeover with prompt/session/child resets, plain-message abandonment, compaction/session replacement and completion resets. Codex startup losses: incoming-owner cached child replacement, old-relay foreign live-session correction, completed foreign-root turn-fact permutations. Transcript losses: real temporary-JSONL partial sibling/final-child completion, unlabelled child attribution, compact cached replay preservation and100/1000completed-child roster retention/release. Compiler-ratchet losses: valid-line uncompiled-list parser grammar examples and injected-existence stale-path filtering; these did not exercise actual filesystem canonicalization or build exclusion. These are real lifecycle, ownership, replay, liveness and retention alarms, including recent#40246 regressions, deliberately lost. Retained conditional record replacement, clockless root/SSH owner isolation, persisted main-thread fork rejection, partial/final question-answer lifetime, cached-roster/missing-ID/live HTTP/durable startup boundaries and restarted-relay refusal/acceptance do not replace those losses. No native/SSH/WSL execution or equivalent coverage is claimed. Audit3128 scoped coverage reduction: Audit3121 removes VoiceDictationLanguageSetting.test.tsx (Spanish-to-es callback and unsupported-model Korean option presence) and voice-speech-model-rows.test.ts (provider/language-order/retired-on-disk list policy); these real narrow alarms are deliberately retired without replacement. VoiceSpeechModelSection per-model concurrent deletion remains unchanged. Audit3122 removes the direct absolute/parent-segment sparse-directory exception-type sample and the five-row IPC sparse-preset error-code/non-save table (two authored/six expanded cases). Those real typed-validation and IPC refusal/error-code alarms are deliberately retired. Keep both real symlink/junction floating-directory trust cases and the minimal RPC structured validation-reason serialization case. The RPC case does not replace IPC save/refusal behavior, typed normalization for both path inputs, actual Git sparse checkout or rendered localization. No equivalent replacement or fresh test/runtime/platform/remote/performance validation is claimed. Audit3124 removes ExperimentalPane.test.tsx (ordinary Pet switch callback), WorkspaceDirectorySetting.test.tsx (padded absolute saved-path normalization/no-write blur), and repository-search.perf.test.ts (navigation/selected-pane builder-call policy, fixture cardinality/nonempty entries and renamed project keyword inclusion). These real narrow alarms are retired without replacement; RepositoryPane.search.test.tsx search-to-sparse-editor request remains unchanged. Audit3129: resolver Windows case-insensitive and POSIX case-sensitive configured-env composition plus mocked-base launch-preflight Windows composition are intentionally no longer checked by the two deleted suites. No equivalent coverage claimed. Keep runtime-structured-agent-host-env.test.ts unchanged: configured Windows Claude-home account identity and host-account precedence remain checked. Audit3114 incorporates source3101: retire three structured Claude child-environment wrapper cases covering inherited stamp isolation/default and explicit entrypoint, Windows SDK-key canonicalization/default/duplicate-key order, and configured lookup/final environment/config-dir conjunction. Keep direct auth/session sanitation and Windows-versus-Linux overlay checks, actual executable lookup from supplied inherited PATH, native Windows child environment delivery, and stale option-mutation fencing. These are not equivalent replacements for the retired wrapper alarms. No fresh test/runtime, real login-shell probe, Claude SDK startup, remote/mixed-version, UI or performance result is claimed. Audit3114 incorporates source3105: retire 17 authored/20 expanded daemon launch-note cases, including the entire two-case SessionLaunchNote suite. Deliberately lose split-marker carry across same-token re-arm, stale-token retirement refusal, foreground tri-state and serial settlement, omitted-note/no-incarnation mixed-version policy, sticky retirement, first-incarnation/replacement launch preservation and held-launch precedence. Keep only the unchanged unresolved foreground-read race against a later finished attach. Supplied notes/foreground and runtime calls do not establish actual daemon/main restart, SSH, native Windows observation, mobile UI, equivalent replacement or fresh runtime/performance validation. Audit3114 incorporates source3109: retire six authored/35 expanded pricing cases: 21 accepted model-name examples, 10 unsupported/future-model fail-closed examples, malformed TTL clamp, unknown-model estimate refusal, flat-model long-context disregard and oversized long-context clamp. Keep mixed five-minute/one-hour write allocation and short/all-long/mixed long-context allocation with original fixed oracles. Real parser/refusal/bounds alarms are knowingly lost without equivalent replacement; retained tests do not validate provider rates, actual billing or request threshold classification. Preserve the archived usage-scan-append source-freeze receipt without transferring historical execution/performance credit. No fresh runtime result is claimed. Audit3108 source-only reduction (3094/3095/3100): retire 27 authored/30 expanded cases, including complete markdown view-state, file-preview link-open and CLI agent-server-route suites, without replacement. Deliberate losses include preview visibility/reference lifetime and same-path owners; SSH stat, directory/missing-target, explicit-null owner, nonmarkdown line/column, local URI routing, remote-to-client guard and same-file reuse; document-preview source-owner/folder/reuse routing, stable grant location and outside-workspace POSIX/Windows request projection; and verified remote CLI send/check refusal, suggested --on argv/copy, shell no-probe bypass, unverified-launch admission and older-peer refusal. Retain two markdown source-runtime/qualified-reveal alarms, one stale grant-rejection fence and two remote read/mutation evidence policies, with original callbacks. Final last-wins reveal did not prove transient cancellation; CLI prerequisite did not prove no real send, and envelope tests do not execute server refusal. No fresh runtime, rendered UI, actual file/SSH/paired transport, authorization, mixed-version or performance result is claimed. Audit3096 source-only reduction (3087/3088): retire 69 authored/76 expanded cases, including complete recovery-portals and reconnect-banner suites. Intentionally lose dead/default TUI replay, generated alternate-frame style composition, reset/mode/dimension and legacy missing-mode-boundary alarms, UI notice/action/reveal policies, and isolated recovery lifecycle variants, without equivalent replacement. Retained registrations and callbacks are unchanged; headless cells are not pixels, and no fresh runtime, host, SSH, WSL, rendered-app or performance result is claimed. Audit3086 source-only reduction (3079/3080/3081): intentionally retire 93 authored/100 expanded mock-boundary cases, including the complete spawn-errors and SSH reconnect overlay suites, without replacement. Retired alarms include spawn classification/ownership, reply ceilings and renderer-write failure recovery, disconnect/detach fencing branches, authority facts, and overlay retry/visibility wiring. Retained callbacks are unchanged; no fresh execution, real PTY/SSH, rendered UI, or performance result is claimed. Audit2432: The broad unit command loses the isolated BranchPicker open-change notification sample. Its unique true/false callback alarm is intentionally retired; reopening/status-refresh behavior was not exercised. No equivalent replacement or fresh validation of the reduced selector is claimed. Audit2425: The broad unit command loses the workspace-copy-status supplied readError forwarding sample. It did not exercise the branch-switch blocking promised by its title. This alarm is intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2417: The broad unit command loses two ordinary clean Git cherry-pick/revert success samples and two terminal startup foreground-read work-budget samples. These unique alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2412: The broad unit command loses the whole six-case fake-React-hook scroll-anchor suite, two generic draft-retention samples, a simple new-agent order sample, a real history-publication batching-count sample, an unmounted handoff abort/timer sample and three basic WSL preview/error samples. These alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2404: The broad unit command loses the standalone share-name lookup 503 propagation suite, initial deletion placement-kind sample, direct changed-mtime stale sample, first-pass rollback existence example and abandoned-preparation directory sample. These exact alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2397 review amendment: The broad unit command loses three standalone suites, two partial-case definitions and two URL table rows across package/download/placement tests. Keep initial wrong-port authorization, modified independent-copy digest refusal and abort-after-begin cancellation dispatch. The remaining alarms are deliberately retired; no equivalent complete replacement or fresh validation of the reduced selector is claimed. Audit2393 current-parent refresh2401: Remove the basic skill-install service alias sample and original public managed-remove receiptless refusal case. Preserve the upstream request ownership suite and transaction interruption coverage. No equivalent complete replacement or fresh validation of the reduced selector is claimed. Audit2389: The broad unit command loses the missing-preview suite, plain-global destination sample and prepublished-receipt recovery example. No equivalent replacement or fresh validation of the reduced selector is claimed. Audit2385: The broad unit command loses four authored walker/staging/protocol examples (six expanded cases); no equivalent replacement or fresh validation is claimed for the reduced suite. Audit2383: The unscoped Vitest command no longer includes the removed Antigravity catalogue suite; its exact provider-root/owner example has no equivalent replacement or fresh validation claim. Audit2377/2381: The unscoped Vitest command includes the reduced bundled-skill and native-discovery suites; the eight removed backup/legacy/catalogue/symlink/SSH-builder examples have no replacement-equivalence or fresh validation claim here. Audit2133 current-parent preparation: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2095 current-parent preparation2126: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit1579 removes workflow/manifest/regex/private binary-header and diagnostic metric inventories, fixture selectors, injected forwarding/platform/signature/process examples, unproven overlap and internal churn counters without equivalent replacement coverage. Retains actual Git trust/diffs; filesystem hash/ELF-region/native discovery; child CLI module repair; compiler/lock/publication/rollback and synthetic Electron install/cache ownership; executable shell quoting/exit; controlled notary/timer cleanup; local patched extractor file/AST freshness; real Chromium/WebKit CSP/sandbox/HTTPS image/referrer/link/preservation controls under parsed Android headers. Five unchanged setup-pnpm/VM request-cleanup definitions reviewed and not rerun. GitHub, installer/archive, OS metric, client, native delegate, compressor, builder and Apple boundaries injected or absent where recorded. No actual native PTY, shipped full/native app, real Actions/cache/npm signature authority, downloaded Electron archive, real objdump/linker/native CLI/AppImage, signing/NSIS/notary/upload/updater or live freeze proof. Historical scope before this audit: Published Linux 1.4.188 desktop against current source in both directions; scheduled weekly and manually runnable. No required PR check.", + "coverageNotes": "Audit 3292 combines adopted 3285/3287/3289/3293 removals: 40 authored declarations and 47 expanded scenarios, including whole frame-editor-view, ambiguous remote-delete-refusal, unverifiable-host subscription and editor-close cleanup suites. The previously reviewed dock-badge suite was already removed upstream in PR 40895 and receives zero new removal credit. Intentionally retired alarms include background browser selection and last-tab landing; main startup fallback, SSH project cleanup/survivor routing, exact-PR contradiction/saved-push positives, replay/sidecar rollback and wrapped remote error normalization; records/snapshot missing-diff hydration, ambiguous folder-owner delete refusal, focus no-op notifications, nested editor context-only cache check, pending broadcast-first status and ordinary four-confirmation aggregation; preview-source frontmatter pruning, approved local/runtime agent dispatch, non-GitHub legacy PR cache invalidation, stale merged-head transient-error fallback, empty-queue immediate query reply and unverified-to-concrete preflight risk. Additional intentionally retired alarms are injected host subscription/unsubscribe counts, synthetic editor reveal/draft/fallback/scoped close, ambiguous unread refusals and hidden mark/read roundtrip, immediate connect backoff/noError, positive mirrored evidence-clock renewal, supplied VM failure/success projections and git-local/folder-SSH wake permutations. Remaining temporal/ownership cases are narrower; no equivalent replacement or fresh execution is claimed. Audit 3283 removes 20 authored declarations and 31 expanded scenarios, including two whole suites. Retired alarms cover PR refresh-state pruning, shared runtime subscription cleanup and store isolation, language content-change routing and older completion ownership, ordinary panel retry-timer cleanup and pending loading, four hosted-review lifetime permutations, mocked terminal creation error/order wiring, five sleep-inventory variants with pending-frame-only assertions, palette fallback/composite highlights, Windows/UNC encoded-editor input rows, mixed-repository partial failure counts, title setters and generated-title bypass/replacement, five window-close coordinator delegation/guard/finally branches, and ambiguous-old-record frame reveal. These regression checks are intentionally lost under the test-value audit; retained cases are not equivalent replacements. Prior coverage notes and receipts remain historical. Audit 3273 removes 14 authored declarations and 19 expanded scenarios across four whole suites and eight partial suites. Retired alarms cover saved-local cancellation/layout ownership, ambiguous-owner warning reset, folder attachment routing, VM false-capability bypass, abandoned reveal warmup cleanup and viewport claim deduplication/rearming, quiet unrelated remote-removal refusal, startup-command one-shot consumption, repository/floating recovery-ledger rows, fake-React pinned-scroll intent, split-ratio state identity/subscriber suppression and fractional change, cross-host project-group join refusal, three PR request-lifetime permutations, upstream-status preservation on error, and unresolved Git-owner refusal. These regression checks are intentionally lost under the test-value audit; retained scenarios are not equivalent replacements. Historical coverage receipts remain historical, including gate35 subscriber claims. Audit 3256 removes these specific alarms from the broad root unit commands: skill dialog active-share selection, close and pending-share handoff; simple keyed-record deletion; marker live-region insertion, simple landing and nine baseline policy examples; General search/control navigation inventory; orphan-count cache bootstrap; seven Codex code classifications and HTTP 429 warning mapping; two skill unread-root verdict examples; peer-mail payload and conversation-ID rejection; and the GitHub organization TABLE text-field optimistic rollback/failed-envelope example. These include real behaviors; retained tests do not provide equivalent coverage for every removed scenario. Mobile losses are recorded separately and are not coverage of these root commands. Audit3246 retires NewRowsMarker reveal/no-repeat and pane-scoped beforeinput checks; skill-owner option availability/count/dedup/order; six styled Input/Textarea IME forwarding rows; the static Codex/OpenCode smart-key inventory; tab-map AST ratchet diagnostic fixtures; child-roster work-budget and retained-aggregate alarms; malformed persisted floating-cwd fallback/no-crash/empty exact-root checks; the unanswered-host empty-list discriminator; the direct invalidated-cache commit-false assertion; one redundant digit-keyup IME row; cached non-supported Claude title-generator rows; and the duplicate late naming-result singleton. These root broad commands lose those specific alarms without equivalent replacement. Distinct retained owner/state checks have their own bounded claims; the real scheduler still rejects stale response data, while the direct false-return alarm is retired. Audit3231 retires supported-host restore-pane key mapping, closed/open creation-sidebar toggle visibility, unrelated scope-error/null classification and quick-submit reveal/no-create checks. These broad commands lose those real narrow alarms; no replacement coverage is claimed. Audit3219 removes the synthetic Cmd+J extra-source suite; this broad command no longer checks its match/tie placement and selection, announced count, empty-query cap, or workspace hiding with retained recent tabs. No replacement coverage is claimed. Audit3209 composes approved sources3202/3206: deliberately retires seven authored/expanded cases in four whole suites without equivalent replacement. Work-item queries lose real GitHub/GitLab oversized ASCII secret-prefix empty-query and whitespace-before-trim refusal alarms; inputs share the imported size bound and exercise only its fast length branch, with no multibyte or actual provider/exposure guarantee. Skill sharing loses complete/partial managed-bundle and destination-ambiguity association checks plus three negative origin/path/scheme admission examples; these do not establish uploaded contents, arbitrary-URL fetching, authorization or execution. Retain exact originless-project direct-link fallback, cloud-delete confirmation, bundled-target repair/owner isolation and explicit Windows-host preference over stale WSL suites. Rejected3201 runtime-preference removal is excluded. No real cloud/network/host/disk, mobile or mixed-version execution validation is claimed. Audit3200 composes approved source3194: deliberately retires thirteen authored registrations/twenty-seven expanded cases in six whole automation host/list policy suites without equivalent replacement. Real RPC category/retryability and wrapped-timeout recognition, unscoped-failure/scoped-success health evidence precedence, exact-ID create selectors and per-run workspace omission, paired-web local/SSH/absent host catalog routing, incompatible/removed/unhydrated/offline execution health, runtime-before-nested-SSH recovery dispatch, and no-owned-focus/successor/foreign-list focus policy alarms are consciously lost. Retain exact20line orphan allow/refuse/precondition and exact90line cross-host same-ID search suites. No retry-timer/fence lifecycle, actual reconnect/network/write delivery, native focus, mobile/mixed-version runtime or disk persistence coverage is claimed. Audit3191 combines approved source3182/3187/3188: deliberately retires thirteen authored Vitest registrations and fifteen expanded cases, including five whole suites, without equivalent replacement. Attachment intake loses real portal/native-capture terminal interception and unowned-container refusal, immediate child-only committed availability/claim-ref negotiation and delivery, and direct-target over stable focused/background composer routing through disable/re-enable/remount and independent question focus. Exact destination/cache/draft and final-stat owner/workspace/File-release suites remain; they do not replace Surface recipient routing. Automation authoring loses destination runtime catalog membership, local/direct-SSH exclusion of paired-runtime repos, unknown-runtime empty catalog, logical project/host/setup/repo/path context payload, and missing/nonready setup refusal; these were genuine direct helper alarms, while exact schedule transformation, legacy schedule and setup-decision suites remain. Agent picker loses setup-chat/terminal/missing-installer/unsupported-or-unknown-host row projection samples and the ordinary unsearched menu variant; the entire original26-line resume recipe suite remains, including reported bypass versus default/absent permission modes, as does the exact search-result menu callback with its fixtures, model/effort commits and staged Arguments reopen outcome. Rejected predecessor3180 full recipe deletion is excluded. No actual native drag/cursor/focus/IME, upload bytes or disk/restart persistence, full automation save/scheduler/runtime transport, real resume-process flags/environment delivery, or native menu/rendered layout validation is claimed. Audit3178 combines source3169/3170/3175: deliberately retires eight authored units (six Vitest cases and two imperative custom relay scenarios), including two whole suites, without equivalent replacement. Voice Section loses per-model pending-delete isolation across interleaved A/B completion and the two-success refresh-call alarm; exact VoicePane delayed key-clear/newer enabled-toggle merge remains and does not replace row deletion coverage. Speech loses dedicated rating-scale/inclusive-ceiling, unsupported-versus-unmeasured, explicit/system-language precedence/locale alias, accuracy versus fast named/default/best-measured selection, and unmeasured/no-match examples; exact offered-user-pick versus retired-selection case and its fixture remain. Relay loses legacy ping-delivery count/liveness sampled before the silence deadline and grouped malformed Bearer/host-ID 401/429 routing checks; twelve real Worker/DurableObject/shipped-client scenarios remain, not equivalent replacement for those narrow alarms. Six prior speech cases are not all deleted: approved successor3175 keeps the original user-choice case. No actual credential/file persistence, native/GPU/engine/download delivery, production assignment policy or deployed-runtime validation is claimed by this reduction. Audit3165 combines source3160/3162: deliberately retires six authored/expanded cases across three whole suites without equivalent replacement. Launch/status losses: observed React-render pending/resuming coordination across settings and deferred offer read; stale-offer reread suppressing dialog reopen; held-local-chat recovery visibility with new-chat preferences off; disabled-local admission avoiding offer RPC despite an injected but unconsumed paired-tab fixture; and run-only lost-reply uncertainty reachability until direct viewed-run retirement. Launch probe does not prove arbitrary synchronous-store atomicity, the paired fixture is not remote runtime enrollment, and the status case directly marks viewed state rather than rendering the summary. Crew-hook losses: old-host method_not_found cache persists across party changes but is released by independently supplied connection generation/verified pairing status or pairing revision, with actual frame publication and teardown. These are real narrow coordination, admission, uncertainty and mixed-version cache alarms consciously lost. Exact web verified-runtime writer handoff guard remains; it does not replace those alarms or prove live host/native/mobile delivery. Audit3156 combines3147/3150/3152/3153/3154: deliberately retires39authored/40expanded native-chat recovery cases, eight whole suites and two orphan test-support files without equivalent replacement. Lost alarms: lost-reply unconfirmed reconciliation, skipped rows/counts and missed-frame repair, unknown/pending outcome and omitted-failure-list compatibility, uncertain history after dismissal, retry/refusal/dismiss lifecycle, hidden/consumed picker ownership, result-tree keyboard focus/disclosure and all-skipped retirement; unconfirmed-over-conflict guidance and failed-chat changes despite older host timestamps; nearest-listed ancestor/cyclic forest shape, descendant membership, host ordering/missing-host local fallback; skipped/readiness/admission counts, provisional skip/progress monotonicity, early per-chat verdicts with batch pending protection, older-host waiting, start-slot/delivery distinction, retry-over-failure and unknown-after-withdrawal attention; remote snooze/reconnect/reoffer, unseen mixed summary through open/close, watched completion retirement, new success beside old failure, failed-reread mixed-result preservation, filter/collapse completion resets, retry summary replacement and current-offer/history selection; cross-host workspace identity, rendered cyclic reachability, nested tri-state/toggle propagation, project eligibility isolation and collapse preserving selection. Exact fallback-list completion barrier, batched verdict/cleanup retention, stale-read versus dismissal publication race, and requested-but-never-rendered finished-run retirement remain; they do not replace retired alarms. Audit3146 combines source reviews3132/3133/3135/3138/3143: intentionally retire20authored/31expanded cases without equivalent replacement. Provider-session losses: structured-native terminal-resume exclusion, metadata-less completed identity, new-turn completion clearing, Pi provider-only/periodic/manual promotion, changed-transcript launch-config isolation, Pi/omp/prime-agent completed-session remote/manual-shutdown promotion, and quit/done precedence over heartbeat. Side-thread/question losses: finished-pane acquisition, hidden title/recap states, local/relay/relay-done conversation takeover with prompt/session/child resets, plain-message abandonment, compaction/session replacement and completion resets. Codex startup losses: incoming-owner cached child replacement, old-relay foreign live-session correction, completed foreign-root turn-fact permutations. Transcript losses: real temporary-JSONL partial sibling/final-child completion, unlabelled child attribution, compact cached replay preservation and100/1000completed-child roster retention/release. Compiler-ratchet losses: valid-line uncompiled-list parser grammar examples and injected-existence stale-path filtering; these did not exercise actual filesystem canonicalization or build exclusion. These are real lifecycle, ownership, replay, liveness and retention alarms, including recent#40246 regressions, deliberately lost. Retained conditional record replacement, clockless root/SSH owner isolation, persisted main-thread fork rejection, partial/final question-answer lifetime, cached-roster/missing-ID/live HTTP/durable startup boundaries and restarted-relay refusal/acceptance do not replace those losses. No native/SSH/WSL execution or equivalent coverage is claimed. Audit3128 scoped coverage reduction: Audit3121 removes VoiceDictationLanguageSetting.test.tsx (Spanish-to-es callback and unsupported-model Korean option presence) and voice-speech-model-rows.test.ts (provider/language-order/retired-on-disk list policy); these real narrow alarms are deliberately retired without replacement. VoiceSpeechModelSection per-model concurrent deletion remains unchanged. Audit3122 removes the direct absolute/parent-segment sparse-directory exception-type sample and the five-row IPC sparse-preset error-code/non-save table (two authored/six expanded cases). Those real typed-validation and IPC refusal/error-code alarms are deliberately retired. Keep both real symlink/junction floating-directory trust cases and the minimal RPC structured validation-reason serialization case. The RPC case does not replace IPC save/refusal behavior, typed normalization for both path inputs, actual Git sparse checkout or rendered localization. No equivalent replacement or fresh test/runtime/platform/remote/performance validation is claimed. Audit3124 removes ExperimentalPane.test.tsx (ordinary Pet switch callback), WorkspaceDirectorySetting.test.tsx (padded absolute saved-path normalization/no-write blur), and repository-search.perf.test.ts (navigation/selected-pane builder-call policy, fixture cardinality/nonempty entries and renamed project keyword inclusion). These real narrow alarms are retired without replacement; RepositoryPane.search.test.tsx search-to-sparse-editor request remains unchanged. Audit3129: resolver Windows case-insensitive and POSIX case-sensitive configured-env composition plus mocked-base launch-preflight Windows composition are intentionally no longer checked by the two deleted suites. No equivalent coverage claimed. Keep runtime-structured-agent-host-env.test.ts unchanged: configured Windows Claude-home account identity and host-account precedence remain checked. Audit3114 incorporates source3101: retire three structured Claude child-environment wrapper cases covering inherited stamp isolation/default and explicit entrypoint, Windows SDK-key canonicalization/default/duplicate-key order, and configured lookup/final environment/config-dir conjunction. Keep direct auth/session sanitation and Windows-versus-Linux overlay checks, actual executable lookup from supplied inherited PATH, native Windows child environment delivery, and stale option-mutation fencing. These are not equivalent replacements for the retired wrapper alarms. No fresh test/runtime, real login-shell probe, Claude SDK startup, remote/mixed-version, UI or performance result is claimed. Audit3114 incorporates source3105: retire 17 authored/20 expanded daemon launch-note cases, including the entire two-case SessionLaunchNote suite. Deliberately lose split-marker carry across same-token re-arm, stale-token retirement refusal, foreground tri-state and serial settlement, omitted-note/no-incarnation mixed-version policy, sticky retirement, first-incarnation/replacement launch preservation and held-launch precedence. Keep only the unchanged unresolved foreground-read race against a later finished attach. Supplied notes/foreground and runtime calls do not establish actual daemon/main restart, SSH, native Windows observation, mobile UI, equivalent replacement or fresh runtime/performance validation. Audit3114 incorporates source3109: retire six authored/35 expanded pricing cases: 21 accepted model-name examples, 10 unsupported/future-model fail-closed examples, malformed TTL clamp, unknown-model estimate refusal, flat-model long-context disregard and oversized long-context clamp. Keep mixed five-minute/one-hour write allocation and short/all-long/mixed long-context allocation with original fixed oracles. Real parser/refusal/bounds alarms are knowingly lost without equivalent replacement; retained tests do not validate provider rates, actual billing or request threshold classification. Preserve the archived usage-scan-append source-freeze receipt without transferring historical execution/performance credit. No fresh runtime result is claimed. Audit3108 source-only reduction (3094/3095/3100): retire 27 authored/30 expanded cases, including complete markdown view-state, file-preview link-open and CLI agent-server-route suites, without replacement. Deliberate losses include preview visibility/reference lifetime and same-path owners; SSH stat, directory/missing-target, explicit-null owner, nonmarkdown line/column, local URI routing, remote-to-client guard and same-file reuse; document-preview source-owner/folder/reuse routing, stable grant location and outside-workspace POSIX/Windows request projection; and verified remote CLI send/check refusal, suggested --on argv/copy, shell no-probe bypass, unverified-launch admission and older-peer refusal. Retain two markdown source-runtime/qualified-reveal alarms, one stale grant-rejection fence and two remote read/mutation evidence policies, with original callbacks. Final last-wins reveal did not prove transient cancellation; CLI prerequisite did not prove no real send, and envelope tests do not execute server refusal. No fresh runtime, rendered UI, actual file/SSH/paired transport, authorization, mixed-version or performance result is claimed. Audit3096 source-only reduction (3087/3088): retire 69 authored/76 expanded cases, including complete recovery-portals and reconnect-banner suites. Intentionally lose dead/default TUI replay, generated alternate-frame style composition, reset/mode/dimension and legacy missing-mode-boundary alarms, UI notice/action/reveal policies, and isolated recovery lifecycle variants, without equivalent replacement. Retained registrations and callbacks are unchanged; headless cells are not pixels, and no fresh runtime, host, SSH, WSL, rendered-app or performance result is claimed. Audit3086 source-only reduction (3079/3080/3081): intentionally retire 93 authored/100 expanded mock-boundary cases, including the complete spawn-errors and SSH reconnect overlay suites, without replacement. Retired alarms include spawn classification/ownership, reply ceilings and renderer-write failure recovery, disconnect/detach fencing branches, authority facts, and overlay retry/visibility wiring. Retained callbacks are unchanged; no fresh execution, real PTY/SSH, rendered UI, or performance result is claimed. Audit2432: The broad unit command loses the isolated BranchPicker open-change notification sample. Its unique true/false callback alarm is intentionally retired; reopening/status-refresh behavior was not exercised. No equivalent replacement or fresh validation of the reduced selector is claimed. Audit2425: The broad unit command loses the workspace-copy-status supplied readError forwarding sample. It did not exercise the branch-switch blocking promised by its title. This alarm is intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2417: The broad unit command loses two ordinary clean Git cherry-pick/revert success samples and two terminal startup foreground-read work-budget samples. These unique alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2412: The broad unit command loses the whole six-case fake-React-hook scroll-anchor suite, two generic draft-retention samples, a simple new-agent order sample, a real history-publication batching-count sample, an unmounted handoff abort/timer sample and three basic WSL preview/error samples. These alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2404: The broad unit command loses the standalone share-name lookup 503 propagation suite, initial deletion placement-kind sample, direct changed-mtime stale sample, first-pass rollback existence example and abandoned-preparation directory sample. These exact alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2397 review amendment: The broad unit command loses three standalone suites, two partial-case definitions and two URL table rows across package/download/placement tests. Keep initial wrong-port authorization, modified independent-copy digest refusal and abort-after-begin cancellation dispatch. The remaining alarms are deliberately retired; no equivalent complete replacement or fresh validation of the reduced selector is claimed. Audit2393 current-parent refresh2401: Remove the basic skill-install service alias sample and original public managed-remove receiptless refusal case. Preserve the upstream request ownership suite and transaction interruption coverage. No equivalent complete replacement or fresh validation of the reduced selector is claimed. Audit2389: The broad unit command loses the missing-preview suite, plain-global destination sample and prepublished-receipt recovery example. No equivalent replacement or fresh validation of the reduced selector is claimed. Audit2385: The broad unit command loses four authored walker/staging/protocol examples (six expanded cases); no equivalent replacement or fresh validation is claimed for the reduced suite. Audit2383: The unscoped Vitest command no longer includes the removed Antigravity catalogue suite; its exact provider-root/owner example has no equivalent replacement or fresh validation claim. Audit2377/2381: The unscoped Vitest command includes the reduced bundled-skill and native-discovery suites; the eight removed backup/legacy/catalogue/symlink/SSH-builder examples have no replacement-equivalence or fresh validation claim here. Audit2133 current-parent preparation: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2095 current-parent preparation2126: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit1579 removes workflow/manifest/regex/private binary-header and diagnostic metric inventories, fixture selectors, injected forwarding/platform/signature/process examples, unproven overlap and internal churn counters without equivalent replacement coverage. Retains actual Git trust/diffs; filesystem hash/ELF-region/native discovery; child CLI module repair; compiler/lock/publication/rollback and synthetic Electron install/cache ownership; executable shell quoting/exit; controlled notary/timer cleanup; local patched extractor file/AST freshness; real Chromium/WebKit CSP/sandbox/HTTPS image/referrer/link/preservation controls under parsed Android headers. Five unchanged setup-pnpm/VM request-cleanup definitions reviewed and not rerun. GitHub, installer/archive, OS metric, client, native delegate, compressor, builder and Apple boundaries injected or absent where recorded. No actual native PTY, shipped full/native app, real Actions/cache/npm signature authority, downloaded Electron archive, real objdump/linker/native CLI/AppImage, signing/NSIS/notary/upload/updater or live freeze proof. Historical scope before this audit: Published Linux 1.4.188 desktop against current source in both directions; scheduled weekly and manually runnable. No required PR check.", "motivatingLinks": ["https://github.com/stablyai/orca/actions/runs/34069063016"], "invariant": "A paired client and host without client-hosted browser capabilities retain server-hosted browser placement across supported version skew.", - "oracle": "Audit 3283 removes 20 authored declarations and 31 expanded scenarios, including two whole suites. Retired alarms cover PR refresh-state pruning, shared runtime subscription cleanup and store isolation, language content-change routing and older completion ownership, ordinary panel retry-timer cleanup and pending loading, four hosted-review lifetime permutations, mocked terminal creation error/order wiring, five sleep-inventory variants with pending-frame-only assertions, palette fallback/composite highlights, Windows/UNC encoded-editor input rows, mixed-repository partial failure counts, title setters and generated-title bypass/replacement, five window-close coordinator delegation/guard/finally branches, and ambiguous-old-record frame reveal. These regression checks are intentionally lost under the test-value audit; retained cases are not equivalent replacements. Prior coverage notes and receipts remain historical. Audit 3273 removes 14 authored declarations and 19 expanded scenarios across four whole suites and eight partial suites. Retired alarms cover saved-local cancellation/layout ownership, ambiguous-owner warning reset, folder attachment routing, VM false-capability bypass, abandoned reveal warmup cleanup and viewport claim deduplication/rearming, quiet unrelated remote-removal refusal, startup-command one-shot consumption, repository/floating recovery-ledger rows, fake-React pinned-scroll intent, split-ratio state identity/subscriber suppression and fractional change, cross-host project-group join refusal, three PR request-lifetime permutations, upstream-status preservation on error, and unresolved Git-owner refusal. These regression checks are intentionally lost under the test-value audit; retained scenarios are not equivalent replacements. Historical coverage receipts remain historical, including gate35 subscriber claims. Audit 3256 removes these specific alarms from the broad root unit commands: skill dialog active-share selection, close and pending-share handoff; simple keyed-record deletion; marker live-region insertion, simple landing and nine baseline policy examples; General search/control navigation inventory; orphan-count cache bootstrap; seven Codex code classifications and HTTP 429 warning mapping; two skill unread-root verdict examples; peer-mail payload and conversation-ID rejection; and the GitHub organization TABLE text-field optimistic rollback/failed-envelope example. These include real behaviors; retained tests do not provide equivalent coverage for every removed scenario. Mobile losses are recorded separately and are not coverage of these root commands. Audit3246 retires NewRowsMarker reveal/no-repeat and pane-scoped beforeinput checks; skill-owner option availability/count/dedup/order; six styled Input/Textarea IME forwarding rows; the static Codex/OpenCode smart-key inventory; tab-map AST ratchet diagnostic fixtures; child-roster work-budget and retained-aggregate alarms; malformed persisted floating-cwd fallback/no-crash/empty exact-root checks; the unanswered-host empty-list discriminator; the direct invalidated-cache commit-false assertion; one redundant digit-keyup IME row; cached non-supported Claude title-generator rows; and the duplicate late naming-result singleton. These root broad commands lose those specific alarms without equivalent replacement. Distinct retained owner/state checks have their own bounded claims; the real scheduler still rejects stale response data, while the direct false-return alarm is retired. Audit3231 retires supported-host restore-pane key mapping, closed/open creation-sidebar toggle visibility, unrelated scope-error/null classification and quick-submit reveal/no-create checks. These broad commands lose those real narrow alarms; no replacement coverage is claimed. Audit3219 removes the synthetic Cmd+J extra-source suite; this broad command no longer checks its match/tie placement and selection, announced count, empty-query cap, or workspace hiding with retained recent tabs. No replacement coverage is claimed. Audit3209 composes approved sources3202/3206: deliberately retires seven authored/expanded cases in four whole suites without equivalent replacement. Work-item queries lose real GitHub/GitLab oversized ASCII secret-prefix empty-query and whitespace-before-trim refusal alarms; inputs share the imported size bound and exercise only its fast length branch, with no multibyte or actual provider/exposure guarantee. Skill sharing loses complete/partial managed-bundle and destination-ambiguity association checks plus three negative origin/path/scheme admission examples; these do not establish uploaded contents, arbitrary-URL fetching, authorization or execution. Retain exact originless-project direct-link fallback, cloud-delete confirmation, bundled-target repair/owner isolation and explicit Windows-host preference over stale WSL suites. Rejected3201 runtime-preference removal is excluded. No real cloud/network/host/disk, mobile or mixed-version execution validation is claimed. Audit3200 composes approved source3194: deliberately retires thirteen authored registrations/twenty-seven expanded cases in six whole automation host/list policy suites without equivalent replacement. Real RPC category/retryability and wrapped-timeout recognition, unscoped-failure/scoped-success health evidence precedence, exact-ID create selectors and per-run workspace omission, paired-web local/SSH/absent host catalog routing, incompatible/removed/unhydrated/offline execution health, runtime-before-nested-SSH recovery dispatch, and no-owned-focus/successor/foreign-list focus policy alarms are consciously lost. Retain exact20line orphan allow/refuse/precondition and exact90line cross-host same-ID search suites. No retry-timer/fence lifecycle, actual reconnect/network/write delivery, native focus, mobile/mixed-version runtime or disk persistence coverage is claimed. Audit3191 combines approved source3182/3187/3188: deliberately retires thirteen authored Vitest registrations and fifteen expanded cases, including five whole suites, without equivalent replacement. Attachment intake loses real portal/native-capture terminal interception and unowned-container refusal, immediate child-only committed availability/claim-ref negotiation and delivery, and direct-target over stable focused/background composer routing through disable/re-enable/remount and independent question focus. Exact destination/cache/draft and final-stat owner/workspace/File-release suites remain; they do not replace Surface recipient routing. Automation authoring loses destination runtime catalog membership, local/direct-SSH exclusion of paired-runtime repos, unknown-runtime empty catalog, logical project/host/setup/repo/path context payload, and missing/nonready setup refusal; these were genuine direct helper alarms, while exact schedule transformation, legacy schedule and setup-decision suites remain. Agent picker loses setup-chat/terminal/missing-installer/unsupported-or-unknown-host row projection samples and the ordinary unsearched menu variant; the entire original26-line resume recipe suite remains, including reported bypass versus default/absent permission modes, as does the exact search-result menu callback with its fixtures, model/effort commits and staged Arguments reopen outcome. Rejected predecessor3180 full recipe deletion is excluded. No actual native drag/cursor/focus/IME, upload bytes or disk/restart persistence, full automation save/scheduler/runtime transport, real resume-process flags/environment delivery, or native menu/rendered layout validation is claimed. Audit3178 combines source3169/3170/3175: deliberately retires eight authored units (six Vitest cases and two imperative custom relay scenarios), including two whole suites, without equivalent replacement. Voice Section loses per-model pending-delete isolation across interleaved A/B completion and the two-success refresh-call alarm; exact VoicePane delayed key-clear/newer enabled-toggle merge remains and does not replace row deletion coverage. Speech loses dedicated rating-scale/inclusive-ceiling, unsupported-versus-unmeasured, explicit/system-language precedence/locale alias, accuracy versus fast named/default/best-measured selection, and unmeasured/no-match examples; exact offered-user-pick versus retired-selection case and its fixture remain. Relay loses legacy ping-delivery count/liveness sampled before the silence deadline and grouped malformed Bearer/host-ID 401/429 routing checks; twelve real Worker/DurableObject/shipped-client scenarios remain, not equivalent replacement for those narrow alarms. Six prior speech cases are not all deleted: approved successor3175 keeps the original user-choice case. No actual credential/file persistence, native/GPU/engine/download delivery, production assignment policy or deployed-runtime validation is claimed by this reduction. Audit3165 combines source3160/3162: deliberately retires six authored/expanded cases across three whole suites without equivalent replacement. Launch/status losses: observed React-render pending/resuming coordination across settings and deferred offer read; stale-offer reread suppressing dialog reopen; held-local-chat recovery visibility with new-chat preferences off; disabled-local admission avoiding offer RPC despite an injected but unconsumed paired-tab fixture; and run-only lost-reply uncertainty reachability until direct viewed-run retirement. Launch probe does not prove arbitrary synchronous-store atomicity, the paired fixture is not remote runtime enrollment, and the status case directly marks viewed state rather than rendering the summary. Crew-hook losses: old-host method_not_found cache persists across party changes but is released by independently supplied connection generation/verified pairing status or pairing revision, with actual frame publication and teardown. These are real narrow coordination, admission, uncertainty and mixed-version cache alarms consciously lost. Exact web verified-runtime writer handoff guard remains; it does not replace those alarms or prove live host/native/mobile delivery. Audit3156 combines3147/3150/3152/3153/3154: deliberately retires39authored/40expanded native-chat recovery cases, eight whole suites and two orphan test-support files without equivalent replacement. Lost alarms: lost-reply unconfirmed reconciliation, skipped rows/counts and missed-frame repair, unknown/pending outcome and omitted-failure-list compatibility, uncertain history after dismissal, retry/refusal/dismiss lifecycle, hidden/consumed picker ownership, result-tree keyboard focus/disclosure and all-skipped retirement; unconfirmed-over-conflict guidance and failed-chat changes despite older host timestamps; nearest-listed ancestor/cyclic forest shape, descendant membership, host ordering/missing-host local fallback; skipped/readiness/admission counts, provisional skip/progress monotonicity, early per-chat verdicts with batch pending protection, older-host waiting, start-slot/delivery distinction, retry-over-failure and unknown-after-withdrawal attention; remote snooze/reconnect/reoffer, unseen mixed summary through open/close, watched completion retirement, new success beside old failure, failed-reread mixed-result preservation, filter/collapse completion resets, retry summary replacement and current-offer/history selection; cross-host workspace identity, rendered cyclic reachability, nested tri-state/toggle propagation, project eligibility isolation and collapse preserving selection. Exact fallback-list completion barrier, batched verdict/cleanup retention, stale-read versus dismissal publication race, and requested-but-never-rendered finished-run retirement remain; they do not replace retired alarms. Audit3146 combines source reviews3132/3133/3135/3138/3143: intentionally retire20authored/31expanded cases without equivalent replacement. Provider-session losses: structured-native terminal-resume exclusion, metadata-less completed identity, new-turn completion clearing, Pi provider-only/periodic/manual promotion, changed-transcript launch-config isolation, Pi/omp/prime-agent completed-session remote/manual-shutdown promotion, and quit/done precedence over heartbeat. Side-thread/question losses: finished-pane acquisition, hidden title/recap states, local/relay/relay-done conversation takeover with prompt/session/child resets, plain-message abandonment, compaction/session replacement and completion resets. Codex startup losses: incoming-owner cached child replacement, old-relay foreign live-session correction, completed foreign-root turn-fact permutations. Transcript losses: real temporary-JSONL partial sibling/final-child completion, unlabelled child attribution, compact cached replay preservation and100/1000completed-child roster retention/release. Compiler-ratchet losses: valid-line uncompiled-list parser grammar examples and injected-existence stale-path filtering; these did not exercise actual filesystem canonicalization or build exclusion. These are real lifecycle, ownership, replay, liveness and retention alarms, including recent#40246 regressions, deliberately lost. Retained conditional record replacement, clockless root/SSH owner isolation, persisted main-thread fork rejection, partial/final question-answer lifetime, cached-roster/missing-ID/live HTTP/durable startup boundaries and restarted-relay refusal/acceptance do not replace those losses. No native/SSH/WSL execution or equivalent coverage is claimed. Audit3128 scoped coverage reduction: Audit3121 removes VoiceDictationLanguageSetting.test.tsx (Spanish-to-es callback and unsupported-model Korean option presence) and voice-speech-model-rows.test.ts (provider/language-order/retired-on-disk list policy); these real narrow alarms are deliberately retired without replacement. VoiceSpeechModelSection per-model concurrent deletion remains unchanged. Audit3122 removes the direct absolute/parent-segment sparse-directory exception-type sample and the five-row IPC sparse-preset error-code/non-save table (two authored/six expanded cases). Those real typed-validation and IPC refusal/error-code alarms are deliberately retired. Keep both real symlink/junction floating-directory trust cases and the minimal RPC structured validation-reason serialization case. The RPC case does not replace IPC save/refusal behavior, typed normalization for both path inputs, actual Git sparse checkout or rendered localization. No equivalent replacement or fresh test/runtime/platform/remote/performance validation is claimed. Audit3124 removes ExperimentalPane.test.tsx (ordinary Pet switch callback), WorkspaceDirectorySetting.test.tsx (padded absolute saved-path normalization/no-write blur), and repository-search.perf.test.ts (navigation/selected-pane builder-call policy, fixture cardinality/nonempty entries and renamed project keyword inclusion). These real narrow alarms are retired without replacement; RepositoryPane.search.test.tsx search-to-sparse-editor request remains unchanged. Audit3129: resolver Windows case-insensitive and POSIX case-sensitive configured-env composition plus mocked-base launch-preflight Windows composition are intentionally no longer checked by the two deleted suites. No equivalent coverage claimed. Keep runtime-structured-agent-host-env.test.ts unchanged: configured Windows Claude-home account identity and host-account precedence remain checked. Audit3114 incorporates source3101: retire three structured Claude child-environment wrapper cases covering inherited stamp isolation/default and explicit entrypoint, Windows SDK-key canonicalization/default/duplicate-key order, and configured lookup/final environment/config-dir conjunction. Keep direct auth/session sanitation and Windows-versus-Linux overlay checks, actual executable lookup from supplied inherited PATH, native Windows child environment delivery, and stale option-mutation fencing. These are not equivalent replacements for the retired wrapper alarms. No fresh test/runtime, real login-shell probe, Claude SDK startup, remote/mixed-version, UI or performance result is claimed. Audit3114 incorporates source3105: retire 17 authored/20 expanded daemon launch-note cases, including the entire two-case SessionLaunchNote suite. Deliberately lose split-marker carry across same-token re-arm, stale-token retirement refusal, foreground tri-state and serial settlement, omitted-note/no-incarnation mixed-version policy, sticky retirement, first-incarnation/replacement launch preservation and held-launch precedence. Keep only the unchanged unresolved foreground-read race against a later finished attach. Supplied notes/foreground and runtime calls do not establish actual daemon/main restart, SSH, native Windows observation, mobile UI, equivalent replacement or fresh runtime/performance validation. Audit3114 incorporates source3109: retire six authored/35 expanded pricing cases: 21 accepted model-name examples, 10 unsupported/future-model fail-closed examples, malformed TTL clamp, unknown-model estimate refusal, flat-model long-context disregard and oversized long-context clamp. Keep mixed five-minute/one-hour write allocation and short/all-long/mixed long-context allocation with original fixed oracles. Real parser/refusal/bounds alarms are knowingly lost without equivalent replacement; retained tests do not validate provider rates, actual billing or request threshold classification. Preserve the archived usage-scan-append source-freeze receipt without transferring historical execution/performance credit. No fresh runtime result is claimed. Audit3108 source-only reduction (3094/3095/3100): retire 27 authored/30 expanded cases, including complete markdown view-state, file-preview link-open and CLI agent-server-route suites, without replacement. Deliberate losses include preview visibility/reference lifetime and same-path owners; SSH stat, directory/missing-target, explicit-null owner, nonmarkdown line/column, local URI routing, remote-to-client guard and same-file reuse; document-preview source-owner/folder/reuse routing, stable grant location and outside-workspace POSIX/Windows request projection; and verified remote CLI send/check refusal, suggested --on argv/copy, shell no-probe bypass, unverified-launch admission and older-peer refusal. Retain two markdown source-runtime/qualified-reveal alarms, one stale grant-rejection fence and two remote read/mutation evidence policies, with original callbacks. Final last-wins reveal did not prove transient cancellation; CLI prerequisite did not prove no real send, and envelope tests do not execute server refusal. No fresh runtime, rendered UI, actual file/SSH/paired transport, authorization, mixed-version or performance result is claimed. Audit3096 source-only reduction (3087/3088): retire 69 authored/76 expanded cases, including complete recovery-portals and reconnect-banner suites. Intentionally lose dead/default TUI replay, generated alternate-frame style composition, reset/mode/dimension and legacy missing-mode-boundary alarms, UI notice/action/reveal policies, and isolated recovery lifecycle variants, without equivalent replacement. Retained registrations and callbacks are unchanged; headless cells are not pixels, and no fresh runtime, host, SSH, WSL, rendered-app or performance result is claimed. Audit3086 source-only reduction (3079/3080/3081): intentionally retire 93 authored/100 expanded mock-boundary cases, including the complete spawn-errors and SSH reconnect overlay suites, without replacement. Retired alarms include spawn classification/ownership, reply ceilings and renderer-write failure recovery, disconnect/detach fencing branches, authority facts, and overlay retry/visibility wiring. Retained callbacks are unchanged; no fresh execution, real PTY/SSH, rendered UI, or performance result is claimed. Audit2432: The broad unit command loses the isolated BranchPicker open-change notification sample. Its unique true/false callback alarm is intentionally retired; reopening/status-refresh behavior was not exercised. No equivalent replacement or fresh validation of the reduced selector is claimed. Audit2425: The broad unit command loses the workspace-copy-status supplied readError forwarding sample. It did not exercise the branch-switch blocking promised by its title. This alarm is intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2417: The broad unit command loses two ordinary clean Git cherry-pick/revert success samples and two terminal startup foreground-read work-budget samples. These unique alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2412: The broad unit command loses the whole six-case fake-React-hook scroll-anchor suite, two generic draft-retention samples, a simple new-agent order sample, a real history-publication batching-count sample, an unmounted handoff abort/timer sample and three basic WSL preview/error samples. These alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2404: The broad unit command loses the standalone share-name lookup 503 propagation suite, initial deletion placement-kind sample, direct changed-mtime stale sample, first-pass rollback existence example and abandoned-preparation directory sample. These exact alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2397 review amendment: The broad unit command loses three standalone suites, two partial-case definitions and two URL table rows across package/download/placement tests. Keep initial wrong-port authorization, modified independent-copy digest refusal and abort-after-begin cancellation dispatch. The remaining alarms are deliberately retired; no equivalent complete replacement or fresh validation of the reduced selector is claimed. Audit2393 current-parent refresh2401: Remove the basic skill-install service alias sample and original public managed-remove receiptless refusal case. Preserve the upstream request ownership suite and transaction interruption coverage. No equivalent complete replacement or fresh validation of the reduced selector is claimed. Audit2389: The broad unit command loses the missing-preview suite, plain-global destination sample and prepublished-receipt recovery example. No equivalent replacement or fresh validation of the reduced selector is claimed. Audit2385: The broad unit command loses four authored walker/staging/protocol examples (six expanded cases); no equivalent replacement or fresh validation is claimed for the reduced suite. Audit2383: The unscoped Vitest command no longer includes the removed Antigravity catalogue suite; its exact provider-root/owner example has no equivalent replacement or fresh validation claim. Audit2377/2381: The unscoped Vitest command includes the reduced bundled-skill and native-discovery suites; the eight removed backup/legacy/catalogue/symlink/SSH-builder examples have no replacement-equivalence or fresh validation claim here. Audit2133 current-parent preparation: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2095 current-parent preparation2126: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Require both existing named browser placement scenarios to pass three times with one attempt, zero skips, zero failures, and no report errors.", + "oracle": "Audit 3292 combines adopted 3285/3287/3289/3293 removals: 40 authored declarations and 47 expanded scenarios, including whole frame-editor-view, ambiguous remote-delete-refusal, unverifiable-host subscription and editor-close cleanup suites. The previously reviewed dock-badge suite was already removed upstream in PR 40895 and receives zero new removal credit. Intentionally retired alarms include background browser selection and last-tab landing; main startup fallback, SSH project cleanup/survivor routing, exact-PR contradiction/saved-push positives, replay/sidecar rollback and wrapped remote error normalization; records/snapshot missing-diff hydration, ambiguous folder-owner delete refusal, focus no-op notifications, nested editor context-only cache check, pending broadcast-first status and ordinary four-confirmation aggregation; preview-source frontmatter pruning, approved local/runtime agent dispatch, non-GitHub legacy PR cache invalidation, stale merged-head transient-error fallback, empty-queue immediate query reply and unverified-to-concrete preflight risk. Additional intentionally retired alarms are injected host subscription/unsubscribe counts, synthetic editor reveal/draft/fallback/scoped close, ambiguous unread refusals and hidden mark/read roundtrip, immediate connect backoff/noError, positive mirrored evidence-clock renewal, supplied VM failure/success projections and git-local/folder-SSH wake permutations. Remaining temporal/ownership cases are narrower; no equivalent replacement or fresh execution is claimed. Audit 3283 removes 20 authored declarations and 31 expanded scenarios, including two whole suites. Retired alarms cover PR refresh-state pruning, shared runtime subscription cleanup and store isolation, language content-change routing and older completion ownership, ordinary panel retry-timer cleanup and pending loading, four hosted-review lifetime permutations, mocked terminal creation error/order wiring, five sleep-inventory variants with pending-frame-only assertions, palette fallback/composite highlights, Windows/UNC encoded-editor input rows, mixed-repository partial failure counts, title setters and generated-title bypass/replacement, five window-close coordinator delegation/guard/finally branches, and ambiguous-old-record frame reveal. These regression checks are intentionally lost under the test-value audit; retained cases are not equivalent replacements. Prior coverage notes and receipts remain historical. Audit 3273 removes 14 authored declarations and 19 expanded scenarios across four whole suites and eight partial suites. Retired alarms cover saved-local cancellation/layout ownership, ambiguous-owner warning reset, folder attachment routing, VM false-capability bypass, abandoned reveal warmup cleanup and viewport claim deduplication/rearming, quiet unrelated remote-removal refusal, startup-command one-shot consumption, repository/floating recovery-ledger rows, fake-React pinned-scroll intent, split-ratio state identity/subscriber suppression and fractional change, cross-host project-group join refusal, three PR request-lifetime permutations, upstream-status preservation on error, and unresolved Git-owner refusal. These regression checks are intentionally lost under the test-value audit; retained scenarios are not equivalent replacements. Historical coverage receipts remain historical, including gate35 subscriber claims. Audit 3256 removes these specific alarms from the broad root unit commands: skill dialog active-share selection, close and pending-share handoff; simple keyed-record deletion; marker live-region insertion, simple landing and nine baseline policy examples; General search/control navigation inventory; orphan-count cache bootstrap; seven Codex code classifications and HTTP 429 warning mapping; two skill unread-root verdict examples; peer-mail payload and conversation-ID rejection; and the GitHub organization TABLE text-field optimistic rollback/failed-envelope example. These include real behaviors; retained tests do not provide equivalent coverage for every removed scenario. Mobile losses are recorded separately and are not coverage of these root commands. Audit3246 retires NewRowsMarker reveal/no-repeat and pane-scoped beforeinput checks; skill-owner option availability/count/dedup/order; six styled Input/Textarea IME forwarding rows; the static Codex/OpenCode smart-key inventory; tab-map AST ratchet diagnostic fixtures; child-roster work-budget and retained-aggregate alarms; malformed persisted floating-cwd fallback/no-crash/empty exact-root checks; the unanswered-host empty-list discriminator; the direct invalidated-cache commit-false assertion; one redundant digit-keyup IME row; cached non-supported Claude title-generator rows; and the duplicate late naming-result singleton. These root broad commands lose those specific alarms without equivalent replacement. Distinct retained owner/state checks have their own bounded claims; the real scheduler still rejects stale response data, while the direct false-return alarm is retired. Audit3231 retires supported-host restore-pane key mapping, closed/open creation-sidebar toggle visibility, unrelated scope-error/null classification and quick-submit reveal/no-create checks. These broad commands lose those real narrow alarms; no replacement coverage is claimed. Audit3219 removes the synthetic Cmd+J extra-source suite; this broad command no longer checks its match/tie placement and selection, announced count, empty-query cap, or workspace hiding with retained recent tabs. No replacement coverage is claimed. Audit3209 composes approved sources3202/3206: deliberately retires seven authored/expanded cases in four whole suites without equivalent replacement. Work-item queries lose real GitHub/GitLab oversized ASCII secret-prefix empty-query and whitespace-before-trim refusal alarms; inputs share the imported size bound and exercise only its fast length branch, with no multibyte or actual provider/exposure guarantee. Skill sharing loses complete/partial managed-bundle and destination-ambiguity association checks plus three negative origin/path/scheme admission examples; these do not establish uploaded contents, arbitrary-URL fetching, authorization or execution. Retain exact originless-project direct-link fallback, cloud-delete confirmation, bundled-target repair/owner isolation and explicit Windows-host preference over stale WSL suites. Rejected3201 runtime-preference removal is excluded. No real cloud/network/host/disk, mobile or mixed-version execution validation is claimed. Audit3200 composes approved source3194: deliberately retires thirteen authored registrations/twenty-seven expanded cases in six whole automation host/list policy suites without equivalent replacement. Real RPC category/retryability and wrapped-timeout recognition, unscoped-failure/scoped-success health evidence precedence, exact-ID create selectors and per-run workspace omission, paired-web local/SSH/absent host catalog routing, incompatible/removed/unhydrated/offline execution health, runtime-before-nested-SSH recovery dispatch, and no-owned-focus/successor/foreign-list focus policy alarms are consciously lost. Retain exact20line orphan allow/refuse/precondition and exact90line cross-host same-ID search suites. No retry-timer/fence lifecycle, actual reconnect/network/write delivery, native focus, mobile/mixed-version runtime or disk persistence coverage is claimed. Audit3191 combines approved source3182/3187/3188: deliberately retires thirteen authored Vitest registrations and fifteen expanded cases, including five whole suites, without equivalent replacement. Attachment intake loses real portal/native-capture terminal interception and unowned-container refusal, immediate child-only committed availability/claim-ref negotiation and delivery, and direct-target over stable focused/background composer routing through disable/re-enable/remount and independent question focus. Exact destination/cache/draft and final-stat owner/workspace/File-release suites remain; they do not replace Surface recipient routing. Automation authoring loses destination runtime catalog membership, local/direct-SSH exclusion of paired-runtime repos, unknown-runtime empty catalog, logical project/host/setup/repo/path context payload, and missing/nonready setup refusal; these were genuine direct helper alarms, while exact schedule transformation, legacy schedule and setup-decision suites remain. Agent picker loses setup-chat/terminal/missing-installer/unsupported-or-unknown-host row projection samples and the ordinary unsearched menu variant; the entire original26-line resume recipe suite remains, including reported bypass versus default/absent permission modes, as does the exact search-result menu callback with its fixtures, model/effort commits and staged Arguments reopen outcome. Rejected predecessor3180 full recipe deletion is excluded. No actual native drag/cursor/focus/IME, upload bytes or disk/restart persistence, full automation save/scheduler/runtime transport, real resume-process flags/environment delivery, or native menu/rendered layout validation is claimed. Audit3178 combines source3169/3170/3175: deliberately retires eight authored units (six Vitest cases and two imperative custom relay scenarios), including two whole suites, without equivalent replacement. Voice Section loses per-model pending-delete isolation across interleaved A/B completion and the two-success refresh-call alarm; exact VoicePane delayed key-clear/newer enabled-toggle merge remains and does not replace row deletion coverage. Speech loses dedicated rating-scale/inclusive-ceiling, unsupported-versus-unmeasured, explicit/system-language precedence/locale alias, accuracy versus fast named/default/best-measured selection, and unmeasured/no-match examples; exact offered-user-pick versus retired-selection case and its fixture remain. Relay loses legacy ping-delivery count/liveness sampled before the silence deadline and grouped malformed Bearer/host-ID 401/429 routing checks; twelve real Worker/DurableObject/shipped-client scenarios remain, not equivalent replacement for those narrow alarms. Six prior speech cases are not all deleted: approved successor3175 keeps the original user-choice case. No actual credential/file persistence, native/GPU/engine/download delivery, production assignment policy or deployed-runtime validation is claimed by this reduction. Audit3165 combines source3160/3162: deliberately retires six authored/expanded cases across three whole suites without equivalent replacement. Launch/status losses: observed React-render pending/resuming coordination across settings and deferred offer read; stale-offer reread suppressing dialog reopen; held-local-chat recovery visibility with new-chat preferences off; disabled-local admission avoiding offer RPC despite an injected but unconsumed paired-tab fixture; and run-only lost-reply uncertainty reachability until direct viewed-run retirement. Launch probe does not prove arbitrary synchronous-store atomicity, the paired fixture is not remote runtime enrollment, and the status case directly marks viewed state rather than rendering the summary. Crew-hook losses: old-host method_not_found cache persists across party changes but is released by independently supplied connection generation/verified pairing status or pairing revision, with actual frame publication and teardown. These are real narrow coordination, admission, uncertainty and mixed-version cache alarms consciously lost. Exact web verified-runtime writer handoff guard remains; it does not replace those alarms or prove live host/native/mobile delivery. Audit3156 combines3147/3150/3152/3153/3154: deliberately retires39authored/40expanded native-chat recovery cases, eight whole suites and two orphan test-support files without equivalent replacement. Lost alarms: lost-reply unconfirmed reconciliation, skipped rows/counts and missed-frame repair, unknown/pending outcome and omitted-failure-list compatibility, uncertain history after dismissal, retry/refusal/dismiss lifecycle, hidden/consumed picker ownership, result-tree keyboard focus/disclosure and all-skipped retirement; unconfirmed-over-conflict guidance and failed-chat changes despite older host timestamps; nearest-listed ancestor/cyclic forest shape, descendant membership, host ordering/missing-host local fallback; skipped/readiness/admission counts, provisional skip/progress monotonicity, early per-chat verdicts with batch pending protection, older-host waiting, start-slot/delivery distinction, retry-over-failure and unknown-after-withdrawal attention; remote snooze/reconnect/reoffer, unseen mixed summary through open/close, watched completion retirement, new success beside old failure, failed-reread mixed-result preservation, filter/collapse completion resets, retry summary replacement and current-offer/history selection; cross-host workspace identity, rendered cyclic reachability, nested tri-state/toggle propagation, project eligibility isolation and collapse preserving selection. Exact fallback-list completion barrier, batched verdict/cleanup retention, stale-read versus dismissal publication race, and requested-but-never-rendered finished-run retirement remain; they do not replace retired alarms. Audit3146 combines source reviews3132/3133/3135/3138/3143: intentionally retire20authored/31expanded cases without equivalent replacement. Provider-session losses: structured-native terminal-resume exclusion, metadata-less completed identity, new-turn completion clearing, Pi provider-only/periodic/manual promotion, changed-transcript launch-config isolation, Pi/omp/prime-agent completed-session remote/manual-shutdown promotion, and quit/done precedence over heartbeat. Side-thread/question losses: finished-pane acquisition, hidden title/recap states, local/relay/relay-done conversation takeover with prompt/session/child resets, plain-message abandonment, compaction/session replacement and completion resets. Codex startup losses: incoming-owner cached child replacement, old-relay foreign live-session correction, completed foreign-root turn-fact permutations. Transcript losses: real temporary-JSONL partial sibling/final-child completion, unlabelled child attribution, compact cached replay preservation and100/1000completed-child roster retention/release. Compiler-ratchet losses: valid-line uncompiled-list parser grammar examples and injected-existence stale-path filtering; these did not exercise actual filesystem canonicalization or build exclusion. These are real lifecycle, ownership, replay, liveness and retention alarms, including recent#40246 regressions, deliberately lost. Retained conditional record replacement, clockless root/SSH owner isolation, persisted main-thread fork rejection, partial/final question-answer lifetime, cached-roster/missing-ID/live HTTP/durable startup boundaries and restarted-relay refusal/acceptance do not replace those losses. No native/SSH/WSL execution or equivalent coverage is claimed. Audit3128 scoped coverage reduction: Audit3121 removes VoiceDictationLanguageSetting.test.tsx (Spanish-to-es callback and unsupported-model Korean option presence) and voice-speech-model-rows.test.ts (provider/language-order/retired-on-disk list policy); these real narrow alarms are deliberately retired without replacement. VoiceSpeechModelSection per-model concurrent deletion remains unchanged. Audit3122 removes the direct absolute/parent-segment sparse-directory exception-type sample and the five-row IPC sparse-preset error-code/non-save table (two authored/six expanded cases). Those real typed-validation and IPC refusal/error-code alarms are deliberately retired. Keep both real symlink/junction floating-directory trust cases and the minimal RPC structured validation-reason serialization case. The RPC case does not replace IPC save/refusal behavior, typed normalization for both path inputs, actual Git sparse checkout or rendered localization. No equivalent replacement or fresh test/runtime/platform/remote/performance validation is claimed. Audit3124 removes ExperimentalPane.test.tsx (ordinary Pet switch callback), WorkspaceDirectorySetting.test.tsx (padded absolute saved-path normalization/no-write blur), and repository-search.perf.test.ts (navigation/selected-pane builder-call policy, fixture cardinality/nonempty entries and renamed project keyword inclusion). These real narrow alarms are retired without replacement; RepositoryPane.search.test.tsx search-to-sparse-editor request remains unchanged. Audit3129: resolver Windows case-insensitive and POSIX case-sensitive configured-env composition plus mocked-base launch-preflight Windows composition are intentionally no longer checked by the two deleted suites. No equivalent coverage claimed. Keep runtime-structured-agent-host-env.test.ts unchanged: configured Windows Claude-home account identity and host-account precedence remain checked. Audit3114 incorporates source3101: retire three structured Claude child-environment wrapper cases covering inherited stamp isolation/default and explicit entrypoint, Windows SDK-key canonicalization/default/duplicate-key order, and configured lookup/final environment/config-dir conjunction. Keep direct auth/session sanitation and Windows-versus-Linux overlay checks, actual executable lookup from supplied inherited PATH, native Windows child environment delivery, and stale option-mutation fencing. These are not equivalent replacements for the retired wrapper alarms. No fresh test/runtime, real login-shell probe, Claude SDK startup, remote/mixed-version, UI or performance result is claimed. Audit3114 incorporates source3105: retire 17 authored/20 expanded daemon launch-note cases, including the entire two-case SessionLaunchNote suite. Deliberately lose split-marker carry across same-token re-arm, stale-token retirement refusal, foreground tri-state and serial settlement, omitted-note/no-incarnation mixed-version policy, sticky retirement, first-incarnation/replacement launch preservation and held-launch precedence. Keep only the unchanged unresolved foreground-read race against a later finished attach. Supplied notes/foreground and runtime calls do not establish actual daemon/main restart, SSH, native Windows observation, mobile UI, equivalent replacement or fresh runtime/performance validation. Audit3114 incorporates source3109: retire six authored/35 expanded pricing cases: 21 accepted model-name examples, 10 unsupported/future-model fail-closed examples, malformed TTL clamp, unknown-model estimate refusal, flat-model long-context disregard and oversized long-context clamp. Keep mixed five-minute/one-hour write allocation and short/all-long/mixed long-context allocation with original fixed oracles. Real parser/refusal/bounds alarms are knowingly lost without equivalent replacement; retained tests do not validate provider rates, actual billing or request threshold classification. Preserve the archived usage-scan-append source-freeze receipt without transferring historical execution/performance credit. No fresh runtime result is claimed. Audit3108 source-only reduction (3094/3095/3100): retire 27 authored/30 expanded cases, including complete markdown view-state, file-preview link-open and CLI agent-server-route suites, without replacement. Deliberate losses include preview visibility/reference lifetime and same-path owners; SSH stat, directory/missing-target, explicit-null owner, nonmarkdown line/column, local URI routing, remote-to-client guard and same-file reuse; document-preview source-owner/folder/reuse routing, stable grant location and outside-workspace POSIX/Windows request projection; and verified remote CLI send/check refusal, suggested --on argv/copy, shell no-probe bypass, unverified-launch admission and older-peer refusal. Retain two markdown source-runtime/qualified-reveal alarms, one stale grant-rejection fence and two remote read/mutation evidence policies, with original callbacks. Final last-wins reveal did not prove transient cancellation; CLI prerequisite did not prove no real send, and envelope tests do not execute server refusal. No fresh runtime, rendered UI, actual file/SSH/paired transport, authorization, mixed-version or performance result is claimed. Audit3096 source-only reduction (3087/3088): retire 69 authored/76 expanded cases, including complete recovery-portals and reconnect-banner suites. Intentionally lose dead/default TUI replay, generated alternate-frame style composition, reset/mode/dimension and legacy missing-mode-boundary alarms, UI notice/action/reveal policies, and isolated recovery lifecycle variants, without equivalent replacement. Retained registrations and callbacks are unchanged; headless cells are not pixels, and no fresh runtime, host, SSH, WSL, rendered-app or performance result is claimed. Audit3086 source-only reduction (3079/3080/3081): intentionally retire 93 authored/100 expanded mock-boundary cases, including the complete spawn-errors and SSH reconnect overlay suites, without replacement. Retired alarms include spawn classification/ownership, reply ceilings and renderer-write failure recovery, disconnect/detach fencing branches, authority facts, and overlay retry/visibility wiring. Retained callbacks are unchanged; no fresh execution, real PTY/SSH, rendered UI, or performance result is claimed. Audit2432: The broad unit command loses the isolated BranchPicker open-change notification sample. Its unique true/false callback alarm is intentionally retired; reopening/status-refresh behavior was not exercised. No equivalent replacement or fresh validation of the reduced selector is claimed. Audit2425: The broad unit command loses the workspace-copy-status supplied readError forwarding sample. It did not exercise the branch-switch blocking promised by its title. This alarm is intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2417: The broad unit command loses two ordinary clean Git cherry-pick/revert success samples and two terminal startup foreground-read work-budget samples. These unique alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2412: The broad unit command loses the whole six-case fake-React-hook scroll-anchor suite, two generic draft-retention samples, a simple new-agent order sample, a real history-publication batching-count sample, an unmounted handoff abort/timer sample and three basic WSL preview/error samples. These alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2404: The broad unit command loses the standalone share-name lookup 503 propagation suite, initial deletion placement-kind sample, direct changed-mtime stale sample, first-pass rollback existence example and abandoned-preparation directory sample. These exact alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2397 review amendment: The broad unit command loses three standalone suites, two partial-case definitions and two URL table rows across package/download/placement tests. Keep initial wrong-port authorization, modified independent-copy digest refusal and abort-after-begin cancellation dispatch. The remaining alarms are deliberately retired; no equivalent complete replacement or fresh validation of the reduced selector is claimed. Audit2393 current-parent refresh2401: Remove the basic skill-install service alias sample and original public managed-remove receiptless refusal case. Preserve the upstream request ownership suite and transaction interruption coverage. No equivalent complete replacement or fresh validation of the reduced selector is claimed. Audit2389: The broad unit command loses the missing-preview suite, plain-global destination sample and prepublished-receipt recovery example. No equivalent replacement or fresh validation of the reduced selector is claimed. Audit2385: The broad unit command loses four authored walker/staging/protocol examples (six expanded cases); no equivalent replacement or fresh validation is claimed for the reduced suite. Audit2383: The unscoped Vitest command no longer includes the removed Antigravity catalogue suite; its exact provider-root/owner example has no equivalent replacement or fresh validation claim. Audit2377/2381: The unscoped Vitest command includes the reduced bundled-skill and native-discovery suites; the eight removed backup/legacy/catalogue/symlink/SSH-builder examples have no replacement-equivalence or fresh validation claim here. Audit2133 current-parent preparation: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2095 current-parent preparation2126: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Require both existing named browser placement scenarios to pass three times with one attempt, zero skips, zero failures, and no report errors.", "commands": [ "gh workflow run packaged-browser-e2e.yml", "pnpm exec playwright test tests/e2e/packaged-mixed-version-browser-placement.spec.ts --config tests/playwright.config.ts --project=electron-headless --workers=1 --repeat-each=3 --retries=0", @@ -14520,7 +14526,8 @@ "Audit3246 retires NewRowsMarker reveal/no-repeat and pane-scoped beforeinput checks; skill-owner option availability/count/dedup/order; six styled Input/Textarea IME forwarding rows; the static Codex/OpenCode smart-key inventory; tab-map AST ratchet diagnostic fixtures; child-roster work-budget and retained-aggregate alarms; malformed persisted floating-cwd fallback/no-crash/empty exact-root checks; the unanswered-host empty-list discriminator; the direct invalidated-cache commit-false assertion; one redundant digit-keyup IME row; cached non-supported Claude title-generator rows; and the duplicate late naming-result singleton. These root broad commands lose those specific alarms without equivalent replacement. Distinct retained owner/state checks have their own bounded claims; the real scheduler still rejects stale response data, while the direct false-return alarm is retired.", "Audit 3256 removes these specific alarms from the broad root unit commands: skill dialog active-share selection, close and pending-share handoff; simple keyed-record deletion; marker live-region insertion, simple landing and nine baseline policy examples; General search/control navigation inventory; orphan-count cache bootstrap; seven Codex code classifications and HTTP 429 warning mapping; two skill unread-root verdict examples; peer-mail payload and conversation-ID rejection; and the GitHub organization TABLE text-field optimistic rollback/failed-envelope example. These include real behaviors; retained tests do not provide equivalent coverage for every removed scenario. Mobile losses are recorded separately and are not coverage of these root commands.", "Audit 3273 removes 14 authored declarations and 19 expanded scenarios across four whole suites and eight partial suites. Retired alarms cover saved-local cancellation/layout ownership, ambiguous-owner warning reset, folder attachment routing, VM false-capability bypass, abandoned reveal warmup cleanup and viewport claim deduplication/rearming, quiet unrelated remote-removal refusal, startup-command one-shot consumption, repository/floating recovery-ledger rows, fake-React pinned-scroll intent, split-ratio state identity/subscriber suppression and fractional change, cross-host project-group join refusal, three PR request-lifetime permutations, upstream-status preservation on error, and unresolved Git-owner refusal. These regression checks are intentionally lost under the test-value audit; retained scenarios are not equivalent replacements. Historical coverage receipts remain historical, including gate35 subscriber claims.", - "Audit 3283 removes 20 authored declarations and 31 expanded scenarios, including two whole suites. Retired alarms cover PR refresh-state pruning, shared runtime subscription cleanup and store isolation, language content-change routing and older completion ownership, ordinary panel retry-timer cleanup and pending loading, four hosted-review lifetime permutations, mocked terminal creation error/order wiring, five sleep-inventory variants with pending-frame-only assertions, palette fallback/composite highlights, Windows/UNC encoded-editor input rows, mixed-repository partial failure counts, title setters and generated-title bypass/replacement, five window-close coordinator delegation/guard/finally branches, and ambiguous-old-record frame reveal. These regression checks are intentionally lost under the test-value audit; retained cases are not equivalent replacements. Prior coverage notes and receipts remain historical." + "Audit 3283 removes 20 authored declarations and 31 expanded scenarios, including two whole suites. Retired alarms cover PR refresh-state pruning, shared runtime subscription cleanup and store isolation, language content-change routing and older completion ownership, ordinary panel retry-timer cleanup and pending loading, four hosted-review lifetime permutations, mocked terminal creation error/order wiring, five sleep-inventory variants with pending-frame-only assertions, palette fallback/composite highlights, Windows/UNC encoded-editor input rows, mixed-repository partial failure counts, title setters and generated-title bypass/replacement, five window-close coordinator delegation/guard/finally branches, and ambiguous-old-record frame reveal. These regression checks are intentionally lost under the test-value audit; retained cases are not equivalent replacements. Prior coverage notes and receipts remain historical.", + "Audit 3292 combines adopted 3285/3287/3289/3293 removals: 40 authored declarations and 47 expanded scenarios, including whole frame-editor-view, ambiguous remote-delete-refusal, unverifiable-host subscription and editor-close cleanup suites. The previously reviewed dock-badge suite was already removed upstream in PR 40895 and receives zero new removal credit. Intentionally retired alarms include background browser selection and last-tab landing; main startup fallback, SSH project cleanup/survivor routing, exact-PR contradiction/saved-push positives, replay/sidecar rollback and wrapped remote error normalization; records/snapshot missing-diff hydration, ambiguous folder-owner delete refusal, focus no-op notifications, nested editor context-only cache check, pending broadcast-first status and ordinary four-confirmation aggregation; preview-source frontmatter pruning, approved local/runtime agent dispatch, non-GitHub legacy PR cache invalidation, stale merged-head transient-error fallback, empty-queue immediate query reply and unverified-to-concrete preflight risk. Additional intentionally retired alarms are injected host subscription/unsubscribe counts, synthetic editor reveal/draft/fallback/scoped close, ambiguous unread refusals and hidden mark/read roundtrip, immediate connect backoff/noError, positive mirrored evidence-clock renewal, supplied VM failure/success projections and git-local/folder-SSH wake permutations. Remaining temporal/ownership cases are narrower; no equivalent replacement or fresh execution is claimed." ], "demotionRule": "Keep experimental if any direction skips or fails; do not extend timeouts or retry to green." }, diff --git a/config/scripts/ci/sharding/ci-shard-timings.json b/config/scripts/ci/sharding/ci-shard-timings.json index 99fe1df6f8c..64ed22ade00 100644 --- a/config/scripts/ci/sharding/ci-shard-timings.json +++ b/config/scripts/ci/sharding/ci-shard-timings.json @@ -6483,7 +6483,6 @@ "src/renderer/src/runtime/web-session-tabs-sync/closing/paired-terminal-tab-close-reload.test.ts": 1943, "src/renderer/src/runtime/workspace-layout/frames/pane-titles-drawn-from-frames.test.ts": 1988, "src/renderer/src/runtime/web-session-tabs-sync/agent-status/remote-agent-row-last-assistant-message.test.ts": 1776, - "src/renderer/src/runtime/files/mutations/remote-host-file-delete-repro.test.ts": 1890, "src/renderer/src/runtime/web-session-tabs-sync/inventory/remote-runtime-session-tabs-inflight.test.ts": 55, "src/renderer/src/runtime/hosted-terminals/snapshots/remote-runtime-snapshot-outcome.test.ts": 233, "src/renderer/src/runtime/hosted-terminals/streams/remote-runtime-terminal-frame-drop-resync.test.ts": 266, @@ -6552,7 +6551,6 @@ "src/renderer/src/runtime/web-session-tabs-sync/agent-status/web-session-tabs-sync-remote-status-title-flap.test.ts": 1715, "src/renderer/src/runtime/web-session-tabs-sync/agent-status/web-session-tabs-sync-stale-spinner.test.ts": 921, "src/renderer/src/runtime/web-session-tabs-sync/tracking/web-session-tabs-sync-tracking-teardown.test.ts": 940, - "src/renderer/src/runtime/web-session-tabs-sync/subscriptions/web-session-tabs-sync-unverifiable-host.test.tsx": 2424, "src/renderer/src/runtime/web-session-tabs-sync/subscriptions/web-session-tabs-sync-visibility-collision.test.tsx": 2699, "src/renderer/src/runtime/web-session-tabs-sync/subscriptions/web-session-tabs-sync-window-visibility.test.tsx": 2589, "src/renderer/src/runtime/web-session-tabs-sync/subscriptions/web-session-tabs-sync-worktree-switch.test.tsx": 2625, @@ -6569,7 +6567,6 @@ "src/renderer/src/runtime/hosted-terminals/recovery/evidence/web-session-terminal-retirement-proof-ledger.test.ts": 685, "src/renderer/src/runtime/rpc/subscriptions/window-visibility-subscription-parking-stream-end.test.ts": 225, "src/renderer/src/runtime/workspace-layout/frames/workspace-layout-frame-binding.test.ts": 2155, - "src/renderer/src/runtime/workspace-layout/frames/workspace-layout-frame-editor-views.test.ts": 2098, "src/renderer/src/runtime/workspace-layout/frames/workspace-layout-frame-held-tabs.test.ts": 2519, "src/renderer/src/runtime/workspace-layout/frames/workspace-layout-frame-sync.test.ts": 2282, "src/renderer/src/runtime/workspace-layout/frames/workspace-layout-frame-tab-props.test.ts": 2852, @@ -6646,7 +6643,6 @@ "src/renderer/src/store/slices/editor/checks/editor-check-details-tabs.test.ts": 1814, "src/renderer/src/store/slices/editor/closing/editor-close-background-file.test.ts": 893, "src/renderer/src/store/slices/editor/closing/editor-close-document-siblings.test.ts": 1317, - "src/renderer/src/store/slices/editor/closing/editor-close-file-cleanup.test.ts": 2000, "src/renderer/src/store/slices/editor/closing/editor-close-file-stale-active.test.ts": 1806, "src/renderer/src/store/slices/editor/closing/editor-close-pinned-sibling.test.ts": 924, "src/renderer/src/store/slices/editor/closing/editor-close-workspace-selection.test.ts": 1850, diff --git a/src/main/rate-limits/providers/minimax/minimax-request-context.test.ts b/src/main/rate-limits/providers/minimax/minimax-request-context.test.ts index c4addf7a72c..68fc9ef7b35 100644 --- a/src/main/rate-limits/providers/minimax/minimax-request-context.test.ts +++ b/src/main/rate-limits/providers/minimax/minimax-request-context.test.ts @@ -1,27 +1,6 @@ -import { describe, expect, it, vi } from 'vitest' -import type { Session } from 'electron' -import { setMainHttpClient } from '../../../network/http-client' - -const { fetchMock, sessionFromPartitionMock } = vi.hoisted(() => { - const fetchMock = vi.fn() - const cookiesSetMock = vi.fn(() => Promise.resolve()) - const clearStorageDataMock = vi.fn(() => Promise.resolve()) - const sessionFromPartitionMock = vi.fn(() => ({ - clearStorageData: clearStorageDataMock, - cookies: { set: cookiesSetMock }, - fetch: fetchMock - })) - return { clearStorageDataMock, cookiesSetMock, fetchMock, sessionFromPartitionMock } -}) +import { describe, expect, it } from 'vitest' import { redactMiniMaxSecret } from './minimax-request-context' -setMainHttpClient({ - fetch: fetchMock, - proxySession: () => null, - // oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: the code under test only calls clearStorageData, cookies.set and fetch, which the fake provides. - partitionSession: sessionFromPartitionMock as unknown as (partition: string) => Session -}) - describe('redactMiniMaxSecret', () => { it('redacts _token values in header and quoted syntax', () => { const redacted = redactMiniMaxSecret('cookie _token=eyJhABCDEF and _token:"x.y"') diff --git a/src/renderer/src/components/terminal-pane/pty-transport/remote-runtime/remote-runtime-connect-failure-recovery.test.ts b/src/renderer/src/components/terminal-pane/pty-transport/remote-runtime/remote-runtime-connect-failure-recovery.test.ts index 07a60965f79..84063b9a310 100644 --- a/src/renderer/src/components/terminal-pane/pty-transport/remote-runtime/remote-runtime-connect-failure-recovery.test.ts +++ b/src/renderer/src/components/terminal-pane/pty-transport/remote-runtime/remote-runtime-connect-failure-recovery.test.ts @@ -69,38 +69,6 @@ describe('recoverable connect failures on a remote runtime pane', () => { resetRemoteRuntimeTransport() }) - it('keeps retrying a recoverable connect failure instead of latching immediately', async () => { - vi.useFakeTimers() - try { - installUnreachableRuntime() - const { createRemoteRuntimePtyTransport } = await import('./remote-runtime-pty-transport') - const onError = vi.fn() - const transport = createRemoteRuntimePtyTransport('env-1', { - worktreeId: 'wt-1', - tabId: 'tab-1', - leafId: 'pane:1' - }) - - await transport.connect({ - url: '', - sessionId: 'remote:env-1@@', - callbacks: { onError } - }) - - // Loss of contact is unverifiable, not a dead terminal: automatic recovery must still be running. - expect(resolvePaneCalls).toBe(1) - expect(transport.getRecoveryState?.().phase).toBe('backoff') - expect(onError).not.toHaveBeenCalled() - - await vi.advanceTimersByTimeAsync(1_000) - expect(resolvePaneCalls).toBeGreaterThan(1) - - transport.destroy?.() - } finally { - vi.useRealTimers() - } - }) - it('leaves both revival paths armed once the recovery window is spent', async () => { vi.useFakeTimers() try { diff --git a/src/renderer/src/components/terminal-pane/pty-transport/remote-runtime/remote-runtime-pty-query-reply-immediate.test.ts b/src/renderer/src/components/terminal-pane/pty-transport/remote-runtime/remote-runtime-pty-query-reply-immediate.test.ts index 82ff1dbe380..27f34775fcf 100644 --- a/src/renderer/src/components/terminal-pane/pty-transport/remote-runtime/remote-runtime-pty-query-reply-immediate.test.ts +++ b/src/renderer/src/components/terminal-pane/pty-transport/remote-runtime/remote-runtime-pty-query-reply-immediate.test.ts @@ -97,34 +97,6 @@ describe('remote transport sendInputImmediate (#7329)', () => { } }) - it('sends an immediate reply even with no pending typed input', async () => { - vi.useFakeTimers() - try { - const { createRemoteRuntimePtyTransport } = await import('./remote-runtime-pty-transport') - const transport = createRemoteRuntimePtyTransport('env-1', { - worktreeId: 'wt-1', - tabId: 'tab-1', - leafId: 'pane:1' - }) - transport.attach({ - existingPtyId: 'remote:env-1@@terminal-1', - cols: 80, - rows: 24, - callbacks: {} - }) - await vi.waitFor(() => expect(runtimeSubscribe).toHaveBeenCalled()) - - expect(transport.sendInputImmediate('\x1b[3;1R')).toBe(true) - await Promise.resolve() - - const sends = terminalSendCalls() as { params: { text: string } }[] - expect(sends).toHaveLength(1) - expect(sends[0]?.params.text).toBe('\x1b[3;1R') - } finally { - vi.useRealTimers() - } - }) - it('does not reorder a query reply ahead of a large paste still in async validation', async () => { // Large pastes may still be in async validation, outside pending; replies cannot overtake that hidden prefix (#7736). const { createRemoteRuntimePtyTransport } = await import('./remote-runtime-pty-transport') diff --git a/src/renderer/src/components/terminal-pane/pty-transport/shutdown/pty-shutdown-data-suspension.test.ts b/src/renderer/src/components/terminal-pane/pty-transport/shutdown/pty-shutdown-data-suspension.test.ts index b4d36e8e769..2f1b3e95c3d 100644 --- a/src/renderer/src/components/terminal-pane/pty-transport/shutdown/pty-shutdown-data-suspension.test.ts +++ b/src/renderer/src/components/terminal-pane/pty-transport/shutdown/pty-shutdown-data-suspension.test.ts @@ -34,27 +34,6 @@ it('does not remove handlers installed by a remount while sleep is pending', () ptyReplayHandlers.delete(ptyId) }) -it('replays rollback output in its original replay and live arrival order', () => { - const ptyId = 'pty-shutdown-output-order' - const delivered: string[] = [] - const meta = { seq: 9, rawLength: 3, transformed: true } - const sidecar = vi.fn((data: string) => delivered.push(`sidecar:${data}`)) - ptyDataHandlers.set(ptyId, (data) => delivered.push(`data:${data}`)) - ptyReplayHandlers.set(ptyId, (data) => delivered.push(`replay:${data}`)) - ptyDataSidecars.set(ptyId, new Set([sidecar])) - - const [snapshot] = unregisterPtyDataHandlers([ptyId]) - bufferPtyShutdownReplayData(ptyId, 'old') - bufferPtyShutdownData(ptyId, 'new', meta) - snapshot.rollback() - - expect(delivered).toEqual(['replay:old', 'data:new', 'sidecar:new']) - expect(sidecar).toHaveBeenCalledOnce() - ptyDataHandlers.delete(ptyId) - ptyDataSidecars.delete(ptyId) - ptyReplayHandlers.delete(ptyId) -}) - it('drains pre-handler data before ordered shutdown output', () => { const ptyId = 'pty-shutdown-pre-handler-order' const delivered: string[] = [] diff --git a/src/renderer/src/lib/workspace/activation/worktree-activation-web-runtime.test.ts b/src/renderer/src/lib/workspace/activation/worktree-activation-web-runtime.test.ts index b3a3f546979..f2793f95f15 100644 --- a/src/renderer/src/lib/workspace/activation/worktree-activation-web-runtime.test.ts +++ b/src/renderer/src/lib/workspace/activation/worktree-activation-web-runtime.test.ts @@ -76,38 +76,6 @@ describe('ensureWorktreeHasInitialTerminal', () => { command: 'gh issue view 42' }) }) - - it('does not create a fallback while a backend startup terminal awaits mirroring', () => { - useAppStore.setState({ - getKnownWorktreeById: ((id: string) => - id === 'wt-1' - ? { id: 'wt-1' } - : undefined) as unknown as AppStoreState['getKnownWorktreeById'] - } as Partial) - const store = createMockStore() - - const result = ensureWorktreeHasInitialTerminal( - store, - 'wt-1', - undefined, - undefined, - { command: 'gh issue view 42' }, - undefined, - { backendStartupTerminalSpawned: true } - ) - - expect(result).toBeNull() - expect(store.createTab).not.toHaveBeenCalled() - expect(store.setActiveTab).not.toHaveBeenCalled() - - useAppStore.setState({ - tabsByWorktree: { 'wt-1': [{ id: 'mirror-tab-1' }] } - } as unknown as Partial) - - expect(useAppStore.getState().pendingIssueCommandSplitByTabId['mirror-tab-1']).toEqual({ - command: 'gh issue view 42' - }) - }) }) it('accepts live paired startup through after-wake when initial seeding returns no primary tab', async () => { diff --git a/src/renderer/src/runtime/files/mutations/remote-host-file-delete-repro.test.ts b/src/renderer/src/runtime/files/mutations/remote-host-file-delete-repro.test.ts deleted file mode 100644 index 6c3d4741864..00000000000 --- a/src/renderer/src/runtime/files/mutations/remote-host-file-delete-repro.test.ts +++ /dev/null @@ -1,182 +0,0 @@ -// @vitest-environment happy-dom - -import { act, renderHook } from '@testing-library/react' -import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' -import type { FolderWorkspace } from '../../../../../shared/folder-workspaces/folder-workspace-types' -import type { ProjectGroup } from '../../../../../shared/project-group-types' -import type { Repo } from '../../../../../shared/repo-types' -import { useAppStore } from '@/store/index' -import { folderWorkspaceKey } from '../../../../../shared/workspace-scope' -import { useFileDeletion } from '@/components/right-sidebar/file-explorer/mutations/useFileDeletion' -import { getFileExplorerOperationOwner } from '@/components/right-sidebar/file-explorer/navigation/file-explorer-operation-owner' -import type { TreeNode } from '@/components/right-sidebar/file-explorer/tree/file-explorer-types' -import { createCompatibleRuntimeStatusResponseIfNeeded } from '@/runtime/rpc/testing/runtime-compatibility-test-fixture' - -const { confirm, toastError } = vi.hoisted(() => ({ - confirm: vi.fn(), - toastError: vi.fn() -})) -const fsReadFile = vi.fn() -const fsDeletePath = vi.fn() -const runtimeEnvironmentCall = vi.fn() - -vi.mock('@/components/confirmation-dialog-context', () => ({ - useConfirmationDialog: () => confirm -})) -vi.mock('@/hooks/useShortcutLabel', () => ({ useShortcutLabel: () => 'Delete' })) -vi.mock('@/components/editor/autosave/editor-autosave', () => ({ - requestEditorFileSave: vi.fn().mockResolvedValue(undefined), - requestEditorSaveQuiesce: vi.fn().mockResolvedValue(undefined) -})) -vi.mock('@/components/right-sidebar/file-explorer/mutations/fileExplorerUndoRedo', () => ({ - commitFileExplorerOp: vi.fn() -})) -vi.mock('@/i18n/i18n', () => ({ translate: (_key: string, fallback: string) => fallback })) -vi.mock('sonner', () => ({ toast: { error: toastError } })) - -const initialState = useAppStore.getInitialState() -const SSH_CONNECTION_ID = 'ssh-target-1' -const REMOTE_PATH = '/home/user/project/src/index.ts' -const FOLDER_WORKSPACE_ID = 'folder-workspace-1' - -function makeFolderWorkspace(overrides: Partial = {}): FolderWorkspace { - return { - id: FOLDER_WORKSPACE_ID, - projectGroupId: 'group-1', - name: 'Remote workspace', - folderPath: '/home/user/project', - connectionId: null, - linkedTask: null, - comment: '', - isArchived: false, - isUnread: false, - isPinned: false, - sortOrder: 1, - lastActivityAt: 0, - createdAt: 1, - updatedAt: 1, - ...overrides - } -} - -function makeProjectGroup(overrides: Partial = {}): ProjectGroup { - return { - id: 'group-1', - name: 'Remote workspace', - parentPath: '/home/user/project', - connectionId: null, - parentGroupId: null, - createdFrom: 'folder-scan', - tabOrder: 0, - isCollapsed: false, - color: null, - createdAt: 1, - updatedAt: 1, - ...overrides - } -} - -function makeRepo(overrides: Partial & { id: string; path: string }): Repo { - return { - displayName: overrides.id, - badgeColor: '#000', - addedAt: 0, - ...overrides - } -} - -const remoteFile: TreeNode = { - name: 'index.ts', - path: REMOTE_PATH, - relativePath: 'src/index.ts', - isDirectory: false, - depth: 0, - operationOwner: { kind: 'ssh', connectionId: SSH_CONNECTION_ID } -} - -function renderDelete(activeWorktreeId: string) { - return renderHook(() => - useFileDeletion({ - activeWorktreeId, - openFiles: [], - closeFile: vi.fn(), - refreshDir: vi.fn().mockResolvedValue(undefined), - setSelectedPaths: vi.fn(), - isWindows: false - }) - ) -} - -beforeEach(() => { - confirm.mockReset().mockResolvedValue(true) - fsReadFile.mockReset().mockResolvedValue({ content: 'remote', isBinary: false }) - fsDeletePath.mockReset().mockResolvedValue(undefined) - runtimeEnvironmentCall.mockReset() - runtimeEnvironmentCall.mockImplementation((args: { method: string; selector?: string }) => { - const runtimeId = args.selector ?? 'env-1' - return ( - createCompatibleRuntimeStatusResponseIfNeeded(args, runtimeId) ?? { - id: 'rpc-1', - ok: true, - result: null, - _meta: { runtimeId } - } - ) - }) - toastError.mockReset() - vi.stubGlobal('window', { - ...window, - api: { - fs: { readFile: fsReadFile, deletePath: fsDeletePath }, - runtime: { call: vi.fn() }, - runtimeEnvironments: { call: runtimeEnvironmentCall, subscribe: vi.fn() } - } - }) -}) - -afterEach(() => { - useAppStore.setState(initialState, true) - vi.unstubAllGlobals() -}) - -describe('issue #8135: deleting a remote SSH folder file', () => { - it('fails closed for an ambiguous folder even when a runtime is focused', async () => { - useAppStore.setState({ - settings: { activeRuntimeEnvironmentId: 'focused-env' } as never, - folderWorkspaces: [makeFolderWorkspace()], - projectGroups: [makeProjectGroup()], - repos: [ - makeRepo({ - id: 'repo-local', - path: '/home/user/project/local', - projectGroupId: 'group-1' - }), - makeRepo({ - id: 'repo-ssh', - path: '/home/user/project', - connectionId: SSH_CONNECTION_ID, - projectGroupId: 'group-1' - }) - ], - worktreesByRepo: {} - }) - const operationOwner = getFileExplorerOperationOwner(folderWorkspaceKey(FOLDER_WORKSPACE_ID)) - expect(operationOwner).toEqual({ kind: 'unresolved' }) - - const { result } = renderDelete(folderWorkspaceKey(FOLDER_WORKSPACE_ID)) - - await act(async () => { - result.current.requestDelete({ ...remoteFile, operationOwner }) - }) - - await vi.waitFor(() => { - expect(toastError).toHaveBeenCalledWith( - "Couldn't determine which host owns this file. Check the workspace connection and try again." - ) - }) - expect(fsReadFile).not.toHaveBeenCalled() - expect(fsDeletePath).not.toHaveBeenCalled() - expect(runtimeEnvironmentCall).not.toHaveBeenCalled() - expect(confirm).not.toHaveBeenCalled() - }) -}) diff --git a/src/renderer/src/runtime/web-session-tabs-sync/agent-status/mirrored-agent-status-clock-skew.test.ts b/src/renderer/src/runtime/web-session-tabs-sync/agent-status/mirrored-agent-status-clock-skew.test.ts index 0b7aca42250..ee03e5a4a95 100644 --- a/src/renderer/src/runtime/web-session-tabs-sync/agent-status/mirrored-agent-status-clock-skew.test.ts +++ b/src/renderer/src/runtime/web-session-tabs-sync/agent-status/mirrored-agent-status-clock-skew.test.ts @@ -151,16 +151,4 @@ describe('a mirrored remote row decays on the replica clock, not the host clock' expect(mirroredRowIsFreshAt(store, T0 + AGENT_STATUS_STALE_AFTER_MS + 1)).toBe(false) }) - - it('restarts the window when the host reports genuinely new evidence', () => { - const store = seedPairedClientStore() - applyChangedHostSnapshot(store, T0 + HOST_SKEW_MS, T0, 1) - const laterClientNow = T0 + AGENT_STATUS_STALE_AFTER_MS - 1_000 - applyChangedHostSnapshot(store, T0 + HOST_SKEW_MS + 60_000, laterClientNow, 2) - - expect(mirroredRowIsFreshAt(store, laterClientNow + AGENT_STATUS_STALE_AFTER_MS - 1)).toBe(true) - expect(mirroredRowIsFreshAt(store, laterClientNow + AGENT_STATUS_STALE_AFTER_MS + 1)).toBe( - false - ) - }) }) diff --git a/src/renderer/src/runtime/web-session-tabs-sync/subscriptions/web-session-tabs-sync-unverifiable-host.test.tsx b/src/renderer/src/runtime/web-session-tabs-sync/subscriptions/web-session-tabs-sync-unverifiable-host.test.tsx deleted file mode 100644 index 9b96f5e9ab4..00000000000 --- a/src/renderer/src/runtime/web-session-tabs-sync/subscriptions/web-session-tabs-sync-unverifiable-host.test.tsx +++ /dev/null @@ -1,189 +0,0 @@ -// @vitest-environment happy-dom - -import { act, cleanup, renderHook } from '@testing-library/react' -import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' -import type { - RuntimeHostStatusSnapshot, - RuntimeEnvironmentStatus -} from '../../../../../shared/remote-runtime/host-status/runtime-host-status' -import type { RuntimeStatus } from '../../../../../shared/runtime-session-contracts' - -const mocks = vi.hoisted(() => ({ - ownerEnvironmentIdForWorkspace: vi.fn(), - runtimeSessionMirrorEnvironmentKey: vi.fn() -})) - -vi.mock('./use-runtime-session-mirror-environment-key', () => ({ - useRuntimeSessionMirrorEnvironmentKeys: () => ({ - environmentKey: mocks.runtimeSessionMirrorEnvironmentKey(), - resubscribeSignal: '' - }) -})) - -vi.mock('../mirrored-workspace-owner', () => ({ - mirroredRuntimeEnvironmentIdForWorkspace: (state: unknown, workspaceId: string | null) => - workspaceId ? (mocks.ownerEnvironmentIdForWorkspace(state, workspaceId) ?? null) : null -})) - -import { useAppStore } from '@/store/index' - -import { replaceRuntimeEnvironmentRevisions } from '../../rpc/environment-revisions/runtime-environment-revision' -import { clearHostLiveTerminalProbesForTests } from '../../hosted-terminals/inventory/host-live-terminal-probe' -import { resetWebSessionTabsSnapshotFreshnessForTests } from '../tracking-lifecycle' -import { useWebSessionTabsSync } from '../use-web-session-tabs-sync' -import { clearRuntimeEnvironmentConnectionGenerations as clearRuntimeEnvironmentConnectionGenerationsForTests } from '@/store/slices/runtime-status/runtime-status-connection-generation' -import { publicRuntimeEnvironment } from '../../rpc/testing/paired-runtime-environment-test-fixture' - -const ENV_A = 'env-a' -const WORKTREE = 'repo-a::worktree-a' -const REVISION_A = 101 -const MIRROR_KEY = `${ENV_A}runtime-a0${REVISION_A}` -const initialState = useAppStore.getInitialState() - -type RuntimeSubscribe = typeof window.api.runtimeEnvironments.subscribe -type RuntimeSubscription = { - request: Parameters[0] - unsubscribe: ReturnType -} - -const subscriptions: RuntimeSubscription[] = [] -const runtimeCall = vi.fn(async (_args: { method: string }) => ({ - id: 'list-all', - ok: true as const, - result: { snapshots: [] }, - _meta: { runtimeId: 'runtime-a' } -})) -const runtimeSubscribe = vi.fn(async (request) => { - const unsubscribe = vi.fn() - subscriptions.push({ request, unsubscribe }) - return { unsubscribe, sendBinary: vi.fn() } -}) - -async function settle(): Promise { - await Promise.resolve() - await Promise.resolve() - await Promise.resolve() -} - -function makeStatus(runtimeId: string): RuntimeStatus { - return { - runtimeId, - rendererGraphEpoch: 0, - graphStatus: 'ready', - authoritativeWindowId: null, - liveTabCount: 0, - liveLeafCount: 0 - } -} - -function verifiedSnapshot(): RuntimeHostStatusSnapshot { - return { - environmentId: ENV_A, - pairingRevision: REVISION_A, - sequence: 1, - checkedAt: 1, - status: makeStatus('runtime-a'), - verification: 'verified', - transport: 'ready' - } -} - -function setRuntimeStatusEntry(entry: RuntimeEnvironmentStatus): void { - useAppStore.setState({ runtimeStatusByEnvironmentId: new Map([[ENV_A, entry]]) }) -} - -function activeTabsSubscriptions(): RuntimeSubscription[] { - return subscriptions.filter(({ request }) => request.method === 'session.tabs.subscribe') -} - -describe('useWebSessionTabsSync under an unverifiable host probe', () => { - beforeEach(() => { - subscriptions.length = 0 - runtimeCall.mockClear() - runtimeSubscribe.mockClear() - mocks.ownerEnvironmentIdForWorkspace.mockReset().mockReturnValue(ENV_A) - mocks.runtimeSessionMirrorEnvironmentKey.mockReset().mockReturnValue(MIRROR_KEY) - Object.defineProperty(window, 'api', { - configurable: true, - value: { runtimeEnvironments: { call: runtimeCall, subscribe: runtimeSubscribe } } - }) - resetWebSessionTabsSnapshotFreshnessForTests() - clearHostLiveTerminalProbesForTests() - const runtimeEnvironments = [ - publicRuntimeEnvironment({ id: ENV_A, createdAt: 100, pairingRevision: REVISION_A }) - ] - replaceRuntimeEnvironmentRevisions(runtimeEnvironments) - useAppStore.setState( - { - ...initialState, - activeWorktreeId: WORKTREE, - workspaceSessionReady: true, - runtimeEnvironments, - runtimeStatusByEnvironmentId: new Map([ - [ - ENV_A, - { - status: makeStatus('runtime-a'), - snapshot: verifiedSnapshot(), - checkedAt: 1, - connectionGeneration: 1 - } - ] - ]) - }, - true - ) - }) - - afterEach(() => { - cleanup() - useAppStore.setState(initialState, true) - replaceRuntimeEnvironmentRevisions([]) - resetWebSessionTabsSnapshotFreshnessForTests() - clearRuntimeEnvironmentConnectionGenerationsForTests() - }) - - it('holds the active session-tabs subscription when the probe goes unverifiable', async () => { - renderHook(() => useWebSessionTabsSync()) - await act(settle) - const held = activeTabsSubscriptions() - expect(held).toHaveLength(1) - - // The transport is still ready and the host is still delivering; only the probe failed. - await act(async () => { - setRuntimeStatusEntry({ - status: null, - snapshot: { ...verifiedSnapshot(), sequence: 2, checkedAt: 2, verification: 'unavailable' }, - checkedAt: 2, - connectionGeneration: 1 - }) - await settle() - }) - - expect(held[0]!.unsubscribe).not.toHaveBeenCalled() - expect(activeTabsSubscriptions()).toHaveLength(1) - }) - - it('still restarts the subscription when the host answers with a replacement runtime', async () => { - renderHook(() => useWebSessionTabsSync()) - await act(settle) - expect(activeTabsSubscriptions()).toHaveLength(1) - - await act(async () => { - setRuntimeStatusEntry({ - status: makeStatus('runtime-b'), - snapshot: { - ...verifiedSnapshot(), - sequence: 2, - checkedAt: 2, - status: makeStatus('runtime-b') - }, - checkedAt: 2, - connectionGeneration: 1 - }) - await settle() - }) - - expect(activeTabsSubscriptions()).toHaveLength(2) - }) -}) diff --git a/src/renderer/src/runtime/workspace-layout/frames/workspace-layout-frame-editor-views.test.ts b/src/renderer/src/runtime/workspace-layout/frames/workspace-layout-frame-editor-views.test.ts deleted file mode 100644 index 61abea3ed1a..00000000000 --- a/src/renderer/src/runtime/workspace-layout/frames/workspace-layout-frame-editor-views.test.ts +++ /dev/null @@ -1,138 +0,0 @@ -// Frame views reconstruct main-owned diff tabs after window reload, from both records frames and initial snapshots. - -import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' -import type * as AgentStatusModule from '@/lib/agent-status/aggregation/worktree-agent-status' -import type { LayoutEditorView } from '../../../../../shared/workspace-layout/layout-editor-view' -import { applyLayoutCommand } from '../../../../../shared/workspace-layout/workspace-layout-commands' -import type { CommandOf } from '../../../../../shared/workspace-layout/workspace-layout-command-types' -import { testContext } from '../../../../../shared/workspace-layout/workspace-layout-command.test-fixture' -import type { WorkspaceLayoutModel } from '../../../../../shared/workspace-layout/workspace-layout-model' -import { localDesktopSession } from '../../../../../shared/workspace-layout/workspace-layout-profile.test-fixture' -import type { WorkspaceLayoutChangeFrame } from '../../../../../shared/workspace-layout/workspace-layout-stream-frames' -import { GIT_KEY } from '../../../../../shared/workspace-layout/workspace-layout-session.test-fixture' -import { bootWindowFromPartitions } from '../../../app-shell/startup-window-view.test-fixture' -import { openFileOfLayoutEditorView } from '../../../store/slices/editor/tabs/open-file-layout-view' -import { createStoreSessionMockApi } from '../../../store/testing/app-store-session-api.test-fixture' -import { createTestStore } from '../../../store/testing/app-store-test-fixture' -import { endLayoutFramePositions } from './layout-frame-position' -import { - loadMainLayoutModel, - mainLayoutFrameSender, - publishedLayoutsOf -} from '../testing/main-loaded-layout-frames.test-fixture' -import { installLayoutFrameApplyCheck } from '../testing/workspace-layout-frame-apply-check.test-fixture' -import { openWorkspaceLayoutFrameSync } from './workspace-layout-frame-sync' - -vi.mock('sonner', () => ({ toast: { info: vi.fn(), success: vi.fn(), error: vi.fn() } })) -vi.mock('@/lib/agent-status/aggregation/worktree-agent-status', async (importOriginal) => { - const actual = await importOriginal() - return { ...actual, detectAgentStatusFromTitle: vi.fn().mockReturnValue(null) } -}) - -const stream = vi.hoisted( - (): { onFrame: ((frame: WorkspaceLayoutChangeFrame) => void) | null } => ({ onFrame: null }) -) -vi.mock('./runtime-layout-client', () => ({ - subscribeRuntimeLayout: ( - _target: unknown, - _params: unknown, - onFrame: (frame: WorkspaceLayoutChangeFrame) => void - ) => { - stream.onFrame = onFrame - return { close: () => {} } - } -})) - -createStoreSessionMockApi() - -const settle = () => new Promise((resolve) => setTimeout(resolve, 0)) - -const DIFF_ID = `${GIT_KEY}::diff::unstaged::src/app.ts` -const VIEW: LayoutEditorView = { - view: { mode: 'diff', diffSource: 'unstaged' }, - file: { - filePath: '/Users/dev/orca/src/app.ts', - relativePath: 'src/app.ts', - language: 'typescript' - } -} - -const openDiff = (view?: LayoutEditorView): CommandOf<'openEditorTab'> => ({ - type: 'openEditorTab', - workspace: GIT_KEY, - tabId: DIFF_ID, - fileId: DIFF_ID, - contentType: 'diff', - groupId: 'group-a', - ...(view ? { view } : {}) -}) - -function applied(model: WorkspaceLayoutModel, command: CommandOf<'openEditorTab'>) { - const result = applyLayoutCommand(model, command, testContext()) - if (!result.ok) { - throw new Error(`main refused ${command.type}: ${result.code}`) - } - return result.model -} - -/** A window restored from its own session, shown from main's snapshot of `model`. */ -async function boot(model = loadMainLayoutModel('local', localDesktopSession())) { - const store = createTestStore() - await bootWindowFromPartitions(store, [{ hostId: 'local', session: localDesktopSession() }]) - // Precondition: the window's restore holds no diff, as after a reload. - expect(store.getState().openFiles.some((file) => file.id === DIFF_ID)).toBe(false) - const sync = openWorkspaceLayoutFrameSync(store) - const frames = mainLayoutFrameSender() - let shown = model - stream.onFrame!(frames.snapshot(publishedLayoutsOf(shown))) - sync.start() - await settle() - const apply = async (command: CommandOf<'openEditorTab'>): Promise => { - shown = applied(shown, command) - stream.onFrame!(frames.records(GIT_KEY, publishedLayoutsOf(shown)[GIT_KEY]!)) - await settle() - } - return { store, apply, close: () => sync.close() } -} - -const diffTabs = (store: Awaited>['store']) => - (store.getState().unifiedTabsByWorktree[GIT_KEY] ?? []).filter((tab) => tab.entityId === DIFF_ID) - -const REBUILT = openFileOfLayoutEditorView(VIEW, { entityId: DIFF_ID, worktreeId: GIT_KEY }) - -let check: ReturnType -beforeEach(() => { - check = installLayoutFrameApplyCheck() -}) -afterEach(() => { - endLayoutFramePositions() - check.uninstall() - expect(check.failures).toEqual([]) -}) - -describe('a diff tab main publishes with its view', () => { - it('draws from a records frame and rebuilds the open file the window lacks', async () => { - const { store, apply, close } = await boot() - check.forgetBuilds() - - await apply(openDiff(VIEW)) - - expect(check.fullBuilt).toEqual([]) - expect(check.workspaceBuilt).toEqual([GIT_KEY]) - expect(diffTabs(store)).toHaveLength(1) - expect(store.getState().openFiles.filter((file) => file.id === DIFF_ID)).toEqual([REBUILT]) - close() - }) - - it('shows after a reload, from the snapshot alone', async () => { - const main = applied(loadMainLayoutModel('local', localDesktopSession()), openDiff(VIEW)) - - const { store, close } = await boot(main) - - expect(check.fullBuilt).toContain(GIT_KEY) - expect(diffTabs(store)).toHaveLength(1) - expect(store.getState().groupsByWorktree[GIT_KEY]![0]!.tabOrder).toContain(DIFF_ID) - expect(store.getState().openFiles.filter((file) => file.id === DIFF_ID)).toEqual([REBUILT]) - close() - }) -}) diff --git a/src/renderer/src/store/github/refresh/github-pr-manual-refresh-broadcast.test.ts b/src/renderer/src/store/github/refresh/github-pr-manual-refresh-broadcast.test.ts index 7c1304f3128..61341e58ead 100644 --- a/src/renderer/src/store/github/refresh/github-pr-manual-refresh-broadcast.test.ts +++ b/src/renderer/src/store/github/refresh/github-pr-manual-refresh-broadcast.test.ts @@ -95,12 +95,6 @@ describe('manual PR refresh whose outcome main also broadcasts', () => { expected: 'failure', check: { name: 'build', status: 'completed', conclusion: 'failure', url: null }, order: 'reply-first' - }, - { - raw: 'success', - expected: 'pending', - check: { name: 'build', status: 'in_progress', conclusion: null, url: null }, - order: 'broadcast-first' } ] it.each(checksDeliveryCases)( diff --git a/src/renderer/src/store/repos/project-removal-owner-host.test.ts b/src/renderer/src/store/repos/project-removal-owner-host.test.ts index 3f5768a4942..a2af1b79f5f 100644 --- a/src/renderer/src/store/repos/project-removal-owner-host.test.ts +++ b/src/renderer/src/store/repos/project-removal-owner-host.test.ts @@ -1,7 +1,6 @@ // Require exact host row on removal: unique-candidate/focused fallbacks can destroy the other host’s same-ID project (#13071). import { beforeEach, describe, expect, it, vi } from 'vitest' import { createTestStore } from '../testing/app-store-test-fixture' -import { purgeOrphanedRuntimeSshProjects } from '../slices/worktrees/teardown/orphaned-runtime-ssh-project-purge' import type { ProjectGroup } from '../../../../shared/project-group-types' import type { Repo } from '../../../../shared/repo-types' import { clearRuntimeCompatibilityCache as clearRuntimeCompatibilityCacheForTests } from '../../runtime/rpc/compatibility/runtime-compatibility-cache' @@ -89,20 +88,6 @@ describe('project removal stays on its owner host (#13071)', () => { expect(runtimeCall).not.toHaveBeenCalled() }) - it('purges a destroyed SSH host row without touching the same id on the focused host', async () => { - const store = createTestStore() - store.setState({ repos: [localRow, sshRow] }) - - await purgeOrphanedRuntimeSshProjects(store.getState, ['target-1']) - - expect(store.getState().repos).toEqual([localRow]) - expect(reposRemoveForHost).toHaveBeenCalledWith({ - repoId: 'same-repo', - hostId: 'ssh:target-1' - }) - expect(reposRemove).not.toHaveBeenCalled() - }) - it('removes every row an owned group holds under the id, each on its own host', async () => { const store = createTestStore() store.setState({ diff --git a/src/renderer/src/store/repos/repos-ephemeral-vm-cleanup-retention.test.ts b/src/renderer/src/store/repos/repos-ephemeral-vm-cleanup-retention.test.ts index c0e5c1fb786..0ab540b2479 100644 --- a/src/renderer/src/store/repos/repos-ephemeral-vm-cleanup-retention.test.ts +++ b/src/renderer/src/store/repos/repos-ephemeral-vm-cleanup-retention.test.ts @@ -1,14 +1,10 @@ import { expect, it, vi } from 'vitest' -import { toast } from 'sonner' -import { getRepoExecutionHostId } from '../../../../shared/execution-host' import type { Repo } from '../../../../shared/repo-types' import type { PublicKnownRuntimeEnvironment } from '../../../../shared/remote-runtime/host-catalog/runtime-environments' import { ephemeralVmCleanup, ephemeralVmListRuntimes, installReposRuntimeRoutingHarness, - reposRemoveForHost, - runtimeEnvironmentCall, runtimeEnvironmentsList, sshRepo } from './repo-runtime-routing.test-fixture' @@ -25,36 +21,6 @@ vi.mock('sonner', () => ({ installReposRuntimeRoutingHarness() -it('retains a runtime-owned SSH project when VM cleanup fails', async () => { - const runtimeRepo: Repo = { ...sshRepo, connectionId: 'runtime-ssh-runtime-1' } - ephemeralVmListRuntimes.mockResolvedValue([ - { - id: 'runtime-1', - cleanupStatus: 'not_started', - sshTargetId: runtimeRepo.connectionId - } - ]) - ephemeralVmCleanup.mockResolvedValue({ - status: 'cleanup_failed', - cleanupStatus: 'failed', - sshTargetId: runtimeRepo.connectionId - }) - const store = createTestStore() - store.setState({ repos: [runtimeRepo], activeRepoId: runtimeRepo.id }) - - await store.getState().removeProject(runtimeRepo.id, { - hostId: getRepoExecutionHostId(runtimeRepo), - errorFeedback: 'toast' - }) - - expect(store.getState().repos).toEqual([runtimeRepo]) - expect(reposRemoveForHost).not.toHaveBeenCalled() - expect(toast.error).toHaveBeenCalledWith( - expect.any(String), - expect.objectContaining({ description: expect.stringContaining('Retry cleanup') }) - ) -}) - const vmServerRepo: Repo = { ...sshRepo, id: 'vm-repo', @@ -80,49 +46,6 @@ const vmServer: PublicKnownRuntimeEnvironment = { } } -it('destroys a recipe VM whose managed server holds the project, without asking the gone server', async () => { - ephemeralVmListRuntimes.mockResolvedValue([ - { id: 'runtime-1', cleanupStatus: 'not_started', sshTargetId: 'runtime-ssh-runtime-1' } - ]) - ephemeralVmCleanup.mockResolvedValue({ status: 'cleaned', cleanupStatus: 'succeeded' }) - const store = createTestStore() - store.setState({ - repos: [vmServerRepo], - runtimeEnvironments: [vmServer] - }) - - await store.getState().removeProject(vmServerRepo.id, { - hostId: 'runtime:env-vm', - errorFeedback: 'toast' - }) - - expect(ephemeralVmCleanup).toHaveBeenCalledWith({ runtimeId: 'runtime-1' }) - expect(runtimeEnvironmentCall).not.toHaveBeenCalledWith( - expect.objectContaining({ method: 'repo.rm' }) - ) - expect(store.getState().repos).toEqual([]) -}) - -it("retains a recipe VM's managed-server project when VM cleanup fails", async () => { - ephemeralVmListRuntimes.mockResolvedValue([ - { id: 'runtime-1', cleanupStatus: 'not_started', sshTargetId: 'runtime-ssh-runtime-1' } - ]) - ephemeralVmCleanup.mockResolvedValue({ - status: 'cleanup_failed', - cleanupStatus: 'failed', - sshTargetId: 'runtime-ssh-runtime-1' - }) - const store = createTestStore() - store.setState({ repos: [vmServerRepo], runtimeEnvironments: [vmServer] }) - - await store.getState().removeProject(vmServerRepo.id, { - hostId: 'runtime:env-vm', - errorFeedback: 'toast' - }) - - expect(store.getState().repos).toEqual([vmServerRepo]) -}) - it('never destroys another VM whose server publishes the same workspace id', async () => { const sharedWorkspaceId = `${vmServerRepo.id}::/home/orca/project` ephemeralVmListRuntimes.mockResolvedValue([ diff --git a/src/renderer/src/store/slices/browser/cleanup/browser-cleanup-close.test.ts b/src/renderer/src/store/slices/browser/cleanup/browser-cleanup-close.test.ts index db83c822f7b..2267a07be45 100644 --- a/src/renderer/src/store/slices/browser/cleanup/browser-cleanup-close.test.ts +++ b/src/renderer/src/store/slices/browser/cleanup/browser-cleanup-close.test.ts @@ -85,26 +85,6 @@ async function storeWithOnlyBrowserTab(): Promise<{ return { store, workspaceId: workspace.id, pageId } } -/** Three browser tabs in a known tab-bar order, so neighbor selection is deterministic. */ -async function storeWithThreeBrowserTabs(): Promise<{ - store: ReturnType - ids: string[] -}> { - const store = createTestStore() - seedStore(store, { - worktreesByRepo: { repo1: [makeWorktree({ id: WT, repoId: 'repo1', path: '/path/wt1' })] }, - activeWorktreeId: WT, - activeTabType: 'terminal' - }) - main = await drawTabsFromMain(store) - const ids = [0, 1, 2].map( - (index) => - store.getState().createBrowserTab(WT, `https://example.test/${index}`, { activate: true }).id - ) - await settled() - return { store, ids } -} - describe('closeBrowserTab with reason cleanup', () => { beforeEach(() => { vi.clearAllMocks() @@ -125,27 +105,4 @@ describe('closeBrowserTab with reason cleanup', () => { expect(s.browserTabsByWorktree[WT] ?? []).toEqual([]) expect(s.unifiedTabsByWorktree[WT] ?? []).toEqual([]) }) - - // Require real closes still use Landing; cleanup carve-out must remain narrow. - it('still returns to the landing state when the user closes the only tab', async () => { - const { store, workspaceId } = await storeWithOnlyBrowserTab() - - store.getState().closeBrowserTab(workspaceId) - - await settled() - - expect(store.getState().activeWorktreeId).toBeNull() - }) - - // Background tab close must never move focus, including through pending address-bar bookkeeping. - it('leaves the active browser tab alone when a background tab closes', async () => { - const { store, ids } = await storeWithThreeBrowserTabs() - store.getState().setActiveBrowserTab(ids[0]!) - - store.getState().closeBrowserTab(ids[2]!) - - await settled() - - expect(store.getState().activeBrowserTabIdByWorktree[WT]).toBe(ids[0]!) - }) }) diff --git a/src/renderer/src/store/slices/editor/checks/editor-check-details-reading.test.ts b/src/renderer/src/store/slices/editor/checks/editor-check-details-reading.test.ts index 0359f057d61..e7c00134b84 100644 --- a/src/renderer/src/store/slices/editor/checks/editor-check-details-reading.test.ts +++ b/src/renderer/src/store/slices/editor/checks/editor-check-details-reading.test.ts @@ -140,27 +140,4 @@ describe('accepted details requests and reading cache', () => { expect(final?.error).not.toContain('SENTINEL_SECRET') } ) - - it('discards the superseded post-publication cache transaction under a nested context open', () => { - const store = createEditorTabsStore() - let nested = false - const stop = store.subscribe(() => { - if (nested) { - return - } - nested = true - store.getState().openCheckRunDetails('wt-1', 'new-context', readingCheck, { - details: readingDetails(), - loading: false, - error: null - }) - }) - store.getState().openCheckRunDetails('wt-1', 'old-context', readingCheck, { - details: null, - loading: true, - error: null - }) - expect(store.getState().openFiles[0].checkRunDetails?.contextKey).toBe('new-context') - stop() - }) }) diff --git a/src/renderer/src/store/slices/editor/closing/editor-close-file-cleanup.test.ts b/src/renderer/src/store/slices/editor/closing/editor-close-file-cleanup.test.ts deleted file mode 100644 index 94411345f93..00000000000 --- a/src/renderer/src/store/slices/editor/closing/editor-close-file-cleanup.test.ts +++ /dev/null @@ -1,214 +0,0 @@ -import { describe, expect, it, vi, beforeEach } from 'vitest' -import { createEditorStore, createEditorTabsStore } from '../editor-slice-test-harness' - -import type { Tab } from '../../../../../../shared/tab-types' -import { makeWorktree } from '../../worktrees/worktree.test-fixture' - -const { toastErrorMock } = vi.hoisted(() => ({ - toastErrorMock: vi.fn() -})) - -vi.mock('sonner', () => ({ - toast: { error: toastErrorMock } -})) - -const { notifyHostOfMirroredEditorCloseMock } = vi.hoisted(() => ({ - notifyHostOfMirroredEditorCloseMock: vi.fn() -})) -vi.mock('@/runtime/web-session-tabs-sync/closing/close-mirrored-editor-tab', () => ({ - notifyHostOfMirroredEditorClose: (...args: unknown[]) => - notifyHostOfMirroredEditorCloseMock(...args) -})) - -// Why: tabs are mirrored only from a paired server's workspace, which keeps today's close path. -const pairedServerWorktrees = { - 'repo-1': [ - makeWorktree({ - id: 'wt-1', - repoId: 'repo-1', - path: '/repo', - runtimeOwnerEnvironmentId: 'env-1' - }), - makeWorktree({ - id: 'wt-2', - repoId: 'repo-1', - path: '/other', - runtimeOwnerEnvironmentId: 'env-1' - }) - ] -} - -function mirroredEditorUnifiedTab(id: string, entityId: string, worktreeId: string): Tab { - return { - id, - entityId, - worktreeId, - groupId: `${worktreeId}:group`, - contentType: 'editor', - label: entityId, - customLabel: null, - color: null, - sortOrder: 0, - createdAt: 0 - } -} - -describe('createEditorSlice editor drafts', () => { - it('preserves the foreground reveal when a background preview record was already replaced', () => { - const store = createEditorTabsStore() - store.getState().createUnifiedTab('wt-2', 'diff', { - id: 'old-preview', - entityId: 'removed-content', - isPreview: true, - activate: false, - executionHostId: 'local' - }) - const reveal = { filePath: '/repo/next.ts', line: 7, column: 3, matchLength: 4 } - store.setState({ pendingEditorReveal: reveal }) - - store.getState().createUnifiedTab('wt-2', 'diff', { - id: 'new-preview', - entityId: 'new-content', - isPreview: true, - activate: false, - executionHostId: 'local' - }) - - expect(store.getState().pendingEditorReveal).toBe(reveal) - expect(store.getState().activeWorktreeId).toBe('wt-1') - expect(store.getState().unifiedTabsByWorktree['wt-2']?.map((tab) => tab.id)).toEqual([ - 'new-preview' - ]) - }) - - it('drops replaced preview drafts so hidden preview state cannot linger', () => { - const store = createEditorTabsStore() - - store.getState().openFile( - { - filePath: '/repo/docs/README.md', - relativePath: 'docs/README.md', - worktreeId: 'wt-1', - language: 'markdown', - mode: 'edit' - }, - { preview: true } - ) - store.getState().setEditorDraft('/repo/docs/README.md', 'draft') - - store.getState().openFile( - { - filePath: '/repo/docs/guide.md', - relativePath: 'docs/guide.md', - worktreeId: 'wt-1', - language: 'markdown', - mode: 'edit' - }, - { preview: true } - ) - - expect(store.getState().editorDrafts).toEqual({}) - }) - - it('falls back to a browser tab when closing the last editor in the active worktree', () => { - const store = createEditorStore() - - store.setState({ - browserTabsByWorktree: { - 'wt-1': [ - { - id: 'browser-1', - worktreeId: 'wt-1', - url: 'https://example.com', - title: 'Example', - loading: false, - faviconUrl: null, - canGoBack: false, - canGoForward: false, - loadError: null, - createdAt: 0 - } - ] - }, - activeBrowserTabIdByWorktree: { 'wt-1': 'browser-1' } - }) - - store.getState().openFile({ - filePath: '/repo/src/file.ts', - relativePath: 'src/file.ts', - worktreeId: 'wt-1', - language: 'typescript', - mode: 'edit' - }) - - store.getState().closeFile('/repo/src/file.ts') - - expect(store.getState().activeTabType).toBe('browser') - expect(store.getState().activeBrowserTabId).toBe('browser-1') - }) - - it('returns to the landing state when closing the last editor in a worktree with no other surfaces', () => { - const store = createEditorStore() - - store.getState().openFile({ - filePath: '/repo/notes.md', - relativePath: 'notes.md', - worktreeId: 'wt-1', - language: 'markdown', - mode: 'edit' - }) - - store.getState().closeFile('/repo/notes.md') - - expect(store.getState().activeWorktreeId).toBeNull() - expect(store.getState().activeFileId).toBeNull() - expect(store.getState().activeBrowserTabId).toBeNull() - expect(store.getState().activeTabType).toBe('terminal') - }) -}) - -describe('closeFile host mirroring', () => { - beforeEach(() => { - notifyHostOfMirroredEditorCloseMock.mockReset() - }) - - it('notifies the host for mirrored editors removed by close all in the active worktree', () => { - const store = createEditorTabsStore() - store.setState({ worktreesByRepo: pairedServerWorktrees }) - const a = store.getState().openFile({ - filePath: '/repo/a.ts', - relativePath: 'a.ts', - worktreeId: 'wt-1', - language: 'typescript', - mode: 'edit', - mirroredFromRuntimeSession: true - }) - const b = store.getState().openFile({ - filePath: '/other/b.ts', - relativePath: 'b.ts', - worktreeId: 'wt-2', - language: 'typescript', - mode: 'edit', - mirroredFromRuntimeSession: true - }) - store.setState({ - unifiedTabsByWorktree: { - 'wt-1': [mirroredEditorUnifiedTab('host-tab-a', a, 'wt-1')], - 'wt-2': [mirroredEditorUnifiedTab('host-tab-b', b, 'wt-2')] - }, - tabBarOrderByWorktree: { - 'wt-1': ['host-tab-a'], - 'wt-2': ['host-tab-b'] - } - }) - - store.getState().closeAllFiles() - - // closeAllFiles bypasses closeFile; require host close hooks for every directly removed mirror. - expect(notifyHostOfMirroredEditorCloseMock).toHaveBeenCalledWith(expect.anything(), 'wt-1', a) - expect(store.getState().openFiles).toHaveLength(1) - expect(store.getState().openFiles[0]?.id).toBe(b) - expect(store.getState().tabBarOrderByWorktree['wt-1']).toEqual([]) - expect(store.getState().tabBarOrderByWorktree['wt-2']).toEqual(['host-tab-b']) - }) -}) diff --git a/src/renderer/src/store/slices/hosted-review/hosted-review.test.ts b/src/renderer/src/store/slices/hosted-review/hosted-review.test.ts index 5d74dc3d636..5030cf1ff9a 100644 --- a/src/renderer/src/store/slices/hosted-review/hosted-review.test.ts +++ b/src/renderer/src/store/slices/hosted-review/hosted-review.test.ts @@ -2,7 +2,6 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import { create } from 'zustand' import type { AppState } from '../../types' import { createHostedReviewSlice } from './hosted-review' -import { getHostedReviewCacheKey } from './hosted-review-cache-identity' import type { HostedReviewInfo } from '../../../../../shared/source-control/hosted-review/hosted-review-contracts' @@ -46,17 +45,6 @@ function makeStore(settings: AppState['settings'] = null) { })) } -const review: HostedReviewInfo = { - provider: 'gitlab', - number: 5, - title: 'Shared MR status', - state: 'open', - url: 'https://gitlab.com/g/p/-/merge_requests/5', - status: 'success', - updatedAt: '2026-05-10T00:00:00.000Z', - mergeable: 'MERGEABLE' -} - const githubReview: HostedReviewInfo = { provider: 'github', number: 12, @@ -81,48 +69,6 @@ describe('hosted review slice', () => { vi.useRealTimers() }) - it('clears stale GitHub PR cache when branch review lookup finds a non-GitHub review', async () => { - mockApi.hostedReview.forBranch.mockResolvedValueOnce(review) - const store = makeStore() - store.setState({ - prCache: { - 'repo-1::feature/gitlab': { - data: { - number: 12, - title: 'Old GitHub PR', - state: 'open', - url: 'https://github.com/acme/orca/pull/12', - checksStatus: 'pending', - updatedAt: '2026-03-28T00:00:00Z', - mergeable: 'UNKNOWN', - headSha: 'head-oid' - }, - fetchedAt: 1 - }, - '/repo::feature/gitlab': { - data: { - number: 99, - title: 'Old path-scoped GitHub PR', - state: 'closed', - url: 'https://github.com/acme/orca/pull/99', - checksStatus: 'failure', - updatedAt: '2026-03-28T00:00:00Z', - mergeable: 'UNKNOWN', - headSha: 'old-head-oid' - }, - fetchedAt: 1 - } - } - } as unknown as Partial) - - await expect( - store.getState().fetchHostedReviewForBranch('/repo', 'feature/gitlab') - ).resolves.toEqual(review) - - expect(store.getState().prCache['repo-1::feature/gitlab']).toBeUndefined() - expect(store.getState().prCache['/repo::feature/gitlab']).toBeUndefined() - }) - it('does not reuse an old-head request after the branch advances', async () => { const mergedAtHead: HostedReviewInfo = { ...githubReview, @@ -161,50 +107,4 @@ describe('hosted review slice', () => { }) ).resolves.toBeNull() }) - - it('does not preserve a merged GitHub review after the worktree moves off its head', async () => { - const consoleError = vi.spyOn(console, 'error').mockImplementation(() => {}) - const cacheKey = getHostedReviewCacheKey( - '/repo', - 'feature/merged', - null, - 'repo-1', - null, - null, - true - ) - const store = makeStore() - store.setState({ - hostedReviewCache: { - [cacheKey]: { - data: { - provider: 'github', - number: 7, - title: 'Merged at head', - state: 'merged', - url: 'https://github.com/acme/orca/pull/7', - status: 'success', - updatedAt: '2026-05-10T00:00:00.000Z', - mergeable: 'MERGEABLE', - headSha: 'aaaaaaa' - }, - fetchedAt: 1, - linkedReviewHintKey: '' - } - } - }) - mockApi.hostedReview.forBranch.mockRejectedValueOnce(new Error('transient gh failure')) - - try { - // Failure after head advance must not preserve the prior merged review. - await expect( - store.getState().fetchHostedReviewForBranch('/repo', 'feature/merged', { - force: true, - currentHeadOid: 'bbbbbbb' - }) - ).resolves.toBeNull() - } finally { - consoleError.mockRestore() - } - }) }) diff --git a/src/renderer/src/store/slices/tabs/tabs-unread-and-focus.test.ts b/src/renderer/src/store/slices/tabs/tabs-unread-and-focus.test.ts index 3d99b48c477..6e63f610838 100644 --- a/src/renderer/src/store/slices/tabs/tabs-unread-and-focus.test.ts +++ b/src/renderer/src/store/slices/tabs/tabs-unread-and-focus.test.ts @@ -73,48 +73,6 @@ describe('TabsSlice', () => { // Already-active group clicks skip activateTab; focusGroup must still expose its tab to the attention scan. describe('focusGroup', () => { - it('does not broadcast active-surface writes when the focused group is already current', () => { - const editorFileId = '/tmp/feature/src/main.ts' - const tab = store.getState().createUnifiedTab(WT, 'editor', { - id: 'editor-tab-1', - entityId: editorFileId, - label: 'main.ts' - }) - const groupId = store.getState().groupsByWorktree[WT][0].id - store.setState({ - activeWorktreeId: WT, - openFiles: [makeOpenFile({ id: editorFileId, worktreeId: WT })], - activeGroupIdByWorktree: { [WT]: groupId }, - activeFileId: editorFileId, - activeFileIdByWorktree: { [WT]: editorFileId }, - activeBrowserTabId: null, - activeBrowserTabIdByWorktree: { [WT]: null }, - activeTabId: null, - activeTabIdByWorktree: { [WT]: null }, - activeTabType: 'editor', - activeTabTypeByWorktree: { [WT]: 'editor' }, - groupsByWorktree: { - [WT]: [ - { - ...store.getState().groupsByWorktree[WT][0], - activeTabId: tab.id - } - ] - } - }) - const before = store.getState() - const listener = vi.fn() - const unsubscribe = store.subscribe(listener) - - store.getState().focusGroup(WT, groupId) - unsubscribe() - - expect(listener).not.toHaveBeenCalled() - expect(store.getState().activeGroupIdByWorktree).toBe(before.activeGroupIdByWorktree) - expect(store.getState().activeFileIdByWorktree).toBe(before.activeFileIdByWorktree) - expect(store.getState().activeTabTypeByWorktree).toBe(before.activeTabTypeByWorktree) - }) - // Why: focusGroup fires on every pointerdown in the group chrome; it moves what is on screen and the scan reads it. it("puts the focused group's active tab on screen", () => { const tabA = store.getState().createUnifiedTab(WT, 'terminal') diff --git a/src/renderer/src/store/slices/workspace-attention/worktrees-unread-state.test.ts b/src/renderer/src/store/slices/workspace-attention/worktrees-unread-state.test.ts index 052b7aa0009..68f75f6bf7e 100644 --- a/src/renderer/src/store/slices/workspace-attention/worktrees-unread-state.test.ts +++ b/src/renderer/src/store/slices/workspace-attention/worktrees-unread-state.test.ts @@ -7,8 +7,7 @@ import { createTestStore, mockApi, resetRemoteRuntimeMocks, - resetWorktreeSliceModuleMemory, - runtimeEnvironmentCall + resetWorktreeSliceModuleMemory } from '../worktrees/worktrees-slice-test-harness' const requestWorktreeBaseFallbackNotice = vi.hoisted(() => vi.fn()) @@ -36,120 +35,6 @@ describe('worktree unread (show-until-interact)', () => { resetRemoteRuntimeMocks() }) - it('keeps unread state local instead of throwing for genuinely ambiguous owners (#10634)', () => { - const store = createTestStore() - const worktreeId = 'repo-shared::/same/path' - store.setState({ - settings: { activeRuntimeEnvironmentId: 'hub-c' } as never, - worktreesByRepo: { - 'repo-shared': [ - makeWorktree({ - id: worktreeId, - repoId: 'repo-shared', - hostId: 'ssh:ssh-a', - runtimeOwnerEnvironmentId: 'hub-a' - }), - makeWorktree({ - id: worktreeId, - repoId: 'repo-shared', - hostId: 'ssh:ssh-b', - runtimeOwnerEnvironmentId: 'hub-b' - }) - ] - } - } as Partial) - - expect(() => - store.getState().markAgentAttentionUnread({ - workspaceId: worktreeId, - subjectKey: null, - groupId: null, - reason: 'agent-completion' - }) - ).not.toThrow() - - expect(store.getState().worktreesByRepo['repo-shared'][0].isUnread).toBe(true) - expect(mockApi.worktrees.updateMeta).not.toHaveBeenCalled() - expect(runtimeEnvironmentCall).not.toHaveBeenCalled() - }) - - it('never throws from any passive path for a genuinely ambiguous owner (#10634)', () => { - // Exercise every passive notification path; any unresolved-host throw recreates the uncaught renderer error. - const worktreeId = 'repo-shared::/same/path' - const ambiguousState = (): Partial => - ({ - settings: { activeRuntimeEnvironmentId: 'hub-c' } as never, - worktreesByRepo: { - 'repo-shared': [ - makeWorktree({ - id: worktreeId, - repoId: 'repo-shared', - hostId: 'ssh:ssh-a', - runtimeOwnerEnvironmentId: 'hub-a', - isUnread: true - }), - makeWorktree({ - id: worktreeId, - repoId: 'repo-shared', - hostId: 'ssh:ssh-b', - runtimeOwnerEnvironmentId: 'hub-b', - isUnread: true - }) - ] - } - }) as Partial - - for (const [label, run] of [ - [ - 'readOnScreenAttention', - (s: AppState) => - s.readOnScreenAttention( - { workspaceIds: [worktreeId], targets: [{ worktreeId: worktreeId, tabId: 'no-tab' }] }, - { screenArrived: true } - ) - ], - ['bumpWorktreeActivity', (s: AppState) => s.bumpWorktreeActivity(worktreeId)] - ] as const) { - const store = createTestStore() - store.setState(ambiguousState()) - mockApi.worktrees.updateMeta.mockClear() - - expect(() => run(store.getState()), `${label} threw for an ambiguous owner`).not.toThrow() - expect( - mockApi.worktrees.updateMeta, - `${label} persisted to a guessed host` - ).not.toHaveBeenCalled() - } - }) - - it('updates unread state for hidden detected worktrees', () => { - const store = createTestStore() - const hidden = makeWorktree({ - id: 'repo1::/path/hidden', - repoId: 'repo1', - path: '/path/hidden' - }) - const detected = makeDetectedResult('repo1', [hidden]) - detected.worktrees[0] = { ...detected.worktrees[0], ownership: 'external', visible: false } - store.setState({ - worktreesByRepo: { repo1: [] }, - detectedWorktreesByRepo: { repo1: detected } - } as Partial) - - store.getState().markAgentAttentionUnread({ - workspaceId: hidden.id, - subjectKey: null, - groupId: null, - reason: 'agent-completion' - }) - expect(store.getState().detectedWorktreesByRepo.repo1.worktrees[0].isUnread).toBe(true) - - store - .getState() - .readOnScreenAttention({ workspaceIds: [hidden.id], targets: [] }, { screenArrived: true }) - expect(store.getState().detectedWorktreesByRepo.repo1.worktrees[0].isUnread).toBe(false) - }) - it('reads a hidden detected worktree once it is activated and on screen', () => { const store = createTestStore() const hidden = makeWorktree({ diff --git a/src/renderer/src/store/slices/workspace-cleanup/workspace-cleanup-removal-preflight.test.ts b/src/renderer/src/store/slices/workspace-cleanup/workspace-cleanup-removal-preflight.test.ts index 9eac90353bf..5b8c894d680 100644 --- a/src/renderer/src/store/slices/workspace-cleanup/workspace-cleanup-removal-preflight.test.ts +++ b/src/renderer/src/store/slices/workspace-cleanup/workspace-cleanup-removal-preflight.test.ts @@ -133,50 +133,4 @@ describe('workspace cleanup removal and protection', () => { }) expect(removeWorktree).not.toHaveBeenCalled() }) - - it('fails a removal that reveals concrete git risk after an unverified force approval', async () => { - const approvedCandidate = makeCandidate({ - executionHostId: 'local', - tier: 'review', - blockers: ['git-status-error'], - git: { - clean: null, - upstreamAhead: null, - upstreamBehind: null, - checkedAt: null - } - }) - const nowRevealsUnpushed = makeCandidate({ - executionHostId: 'local', - tier: 'review', - blockers: ['unpushed-commits'], - git: { clean: true, upstreamAhead: 3, upstreamBehind: 0, checkedAt: NOW } - }) - const scan = vi.fn().mockResolvedValue({ - scannedAt: NOW, - candidates: [nowRevealsUnpushed], - errors: [] - } satisfies WorkspaceCleanupScanResult) - installWorkspaceCleanupApi(scan) - const removeWorktree = vi.fn().mockResolvedValue({ ok: true }) - const store = createCleanupTestStore(removeWorktree) - - await expect( - store.getState().removeWorkspaceCleanupCandidates([WORKTREE_ID], { - approvedCandidates: [approvedCandidate] - }) - ).resolves.toEqual({ - removedIds: [], - removedIdentities: [], - failures: [ - { - worktreeId: WORKTREE_ID, - executionHostId: 'local', - displayName: 'old-workspace', - message: 'Workspace changed after confirmation. Refresh to review it before removing.' - } - ] - }) - expect(removeWorktree).not.toHaveBeenCalled() - }) }) diff --git a/src/renderer/src/store/slices/worktrees/session/workspace-activation-preparation.test.ts b/src/renderer/src/store/slices/worktrees/session/workspace-activation-preparation.test.ts index 34c0a66bd53..2198d1faa0e 100644 --- a/src/renderer/src/store/slices/worktrees/session/workspace-activation-preparation.test.ts +++ b/src/renderer/src/store/slices/worktrees/session/workspace-activation-preparation.test.ts @@ -69,44 +69,6 @@ it('wakes slept folder on local after publishing restored explorer and terminal expect(store.getState().refreshGitHubForWorktreeIfStale).not.toHaveBeenCalled() }) -it('wakes slept git on local after publishing restored explorer and terminal state', () => { - const { store, workspaceId, activate } = seedWorkspace('git', 'local') - markWorktreeSleepIntent(workspaceId) - const wake = vi.fn(() => { - expect(store.getState().activeWorktreeId).toBe('worktree-activation') - expect(store.getState().tabsByWorktree[workspaceId][0].generation).toBe(4) - expect(store.getState().rightSidebarExplorerView).toBe('files') - }) - onWorktreeSleepIntentCleared(workspaceId, wake) - - activate() - - expect(wake).toHaveBeenCalledOnce() - expect(store.getState().activeWorkspaceExecutionHostId).toBe('local') - expect(store.getState().tabsByWorktree[workspaceId][0].pendingActivationSpawn).toBe(true) - expect(store.getState().activeTabId).toBe('terminal') - expect(store.getState().refreshGitHubForWorktreeIfStale).toHaveBeenCalled() -}) - -it('wakes slept folder on ssh:remote after publishing restored explorer and terminal state', () => { - const { store, workspaceId, activate } = seedWorkspace('folder', 'ssh:remote') - markWorktreeSleepIntent(workspaceId) - const wake = vi.fn(() => { - expect(store.getState().activeWorktreeId).toBe('folder:folder-activation') - expect(store.getState().tabsByWorktree[workspaceId][0].generation).toBe(4) - expect(store.getState().rightSidebarExplorerView).toBe('files') - }) - onWorktreeSleepIntentCleared(workspaceId, wake) - - activate() - - expect(wake).toHaveBeenCalledOnce() - expect(store.getState().activeWorkspaceExecutionHostId).toBe('ssh:remote') - expect(store.getState().tabsByWorktree[workspaceId][0].pendingActivationSpawn).toBe(true) - expect(store.getState().activeTabId).toBe('terminal') - expect(store.getState().refreshGitHubForWorktreeIfStale).not.toHaveBeenCalled() -}) - it('wakes slept git on ssh:remote after publishing restored explorer and terminal state', () => { const { store, workspaceId, activate } = seedWorkspace('git', 'ssh:remote') markWorktreeSleepIntent(workspaceId) diff --git a/src/renderer/src/store/slices/worktrees/session/worktrees-terminal-pr-exact-observation.test.ts b/src/renderer/src/store/slices/worktrees/session/worktrees-terminal-pr-exact-observation.test.ts index da9c22c0ab2..74e0d5066fb 100644 --- a/src/renderer/src/store/slices/worktrees/session/worktrees-terminal-pr-exact-observation.test.ts +++ b/src/renderer/src/store/slices/worktrees/session/worktrees-terminal-pr-exact-observation.test.ts @@ -86,43 +86,6 @@ it('confirms a second PR by exact source and head when branch discovery would re ) }) -it.each([ - { type: 'issue' as const }, - { number: 99 }, - { url: 'https://github.com/foreign/repo/pull/42' }, - { branchName: 'unrelated' }, - { headSha: 'other-head' } -])( - 'rejects contradictory exact evidence without using an implicit fallback: %j', - async (change) => { - const { store, workspace, branchLookup } = setup() - exactLookup.mockResolvedValue({ ...secondary, ...change }) - store.getState().observeTerminalGitHubPullRequestLink(workspace.id, link) - await flush() - expect(getWorkspaceAttachments(store.getState().worktreesByRepo.repo[0])).toEqual([]) - expect(branchLookup).not.toHaveBeenCalled() - } -) - -it('confirms a review against its saved push branch', async () => { - const { store, workspace, branchLookup } = setup() - const pending = Promise.withResolvers() - exactLookup.mockReturnValue(pending.promise) - const saved = { - ...workspace, - branch: 'refs/heads/local-copy', - pushTarget: { remoteName: 'origin', branchName: 'feature' } - } - store.setState({ worktreesByRepo: { repo: [saved] } }) - store.getState().observeTerminalGitHubPullRequestLink(workspace.id, link) - pending.resolve(secondary) - await flush() - expect( - getWorkspaceAttachments(store.getState().worktreesByRepo.repo[0]).map((item) => item.number) - ).toEqual([42]) - expect(branchLookup).not.toHaveBeenCalled() -}) - it('rejects delayed review after its saved push branch changes', async () => { const { store, workspace, branchLookup } = setup() const pending = Promise.withResolvers() diff --git a/src/renderer/src/store/slices/worktrees/session/worktrees-terminal-reference-admission.test.ts b/src/renderer/src/store/slices/worktrees/session/worktrees-terminal-reference-admission.test.ts index ed6c9b859fa..7d2898677db 100644 --- a/src/renderer/src/store/slices/worktrees/session/worktrees-terminal-reference-admission.test.ts +++ b/src/renderer/src/store/slices/worktrees/session/worktrees-terminal-reference-admission.test.ts @@ -110,28 +110,6 @@ beforeEach(() => { resetWorktreeSliceModuleMemory() }) -it('preserves distinct live confirmations on one branch without replacing the manual primary', async () => { - const { store, pending, observeBurst, branchLookup } = setup() - observeBurst() - await flush() - let completed = 0 - while (completed < 4) { - const batch = [...pending] - pending.clear() - for (const [number, deferred] of batch) { - deferred.resolve(review(number)) - } - completed += batch.length - await flush() - } - expect(branchLookup).not.toHaveBeenCalled() - const items = getWorkspaceAttachments(store.getState().worktreesByRepo.repo[0]) - expect(items.map((item) => item.number).sort((a, b) => (a ?? 0) - (b ?? 0))).toEqual([ - 7, 100, 101, 102, 103 - ]) - expect(store.getState().worktreesByRepo.repo[0].linkedPR).toBe(7) -}) - it('drops stale queued starts and fallback reads after the pane closes', async () => { const { store, pending, observeBurst, closePane, branchLookup } = setup() observeBurst() diff --git a/src/renderer/src/store/slices/worktrees/teardown/store-worktree-removal-cascade.test.ts b/src/renderer/src/store/slices/worktrees/teardown/store-worktree-removal-cascade.test.ts index 6a461cb9e45..d2173923934 100644 --- a/src/renderer/src/store/slices/worktrees/teardown/store-worktree-removal-cascade.test.ts +++ b/src/renderer/src/store/slices/worktrees/teardown/store-worktree-removal-cascade.test.ts @@ -1,6 +1,5 @@ import { describe, it, expect, vi, beforeEach } from 'vitest' import type * as AgentStatusModule from '@/lib/agent-status/aggregation/worktree-agent-status' -import { getDefaultSettings } from '../../../../../../shared/constants' import { createCompatibleRuntimeStatusResponseIfNeeded } from '../../../../runtime/rpc/testing/runtime-compatibility-test-fixture' import { clearRuntimeCompatibilityCache as clearRuntimeCompatibilityCacheForTests } from '../../../../runtime/rpc/compatibility/runtime-compatibility-cache' import 'sonner' @@ -89,57 +88,4 @@ describe('removeWorktree cascade', () => { expect(mockApi.pty.kill).not.toHaveBeenCalled() expect(s.activeWorktreeId).toBe(worktreeId) }) - - it.each([ - 'Could not connect to the remote Orca runtime.', - 'Remote Orca runtime closed the connection.', - 'Timed out waiting for the remote Orca runtime to respond.' - ])( - 'does not offer force delete for wrapped remote runtime failure: %s', - async (runtimeFailure) => { - const store = createTestStore() - const worktreeId = 'repo1::/path/wt1' - const error = `Error invoking remote method 'runtime-environments:call': Error: ${runtimeFailure}` - const displayed = runtimeFailure - - mockApi.runtimeEnvironments.call.mockImplementation((args: { method: string }) => { - const compatibility = createCompatibleRuntimeStatusResponseIfNeeded(args) - if (compatibility) { - return Promise.resolve(compatibility) - } - if (args.method === 'repo.hooksCheck') { - return Promise.resolve({ - id: 'rpc-hooks', - ok: true, - result: { hasHooks: false, hooks: null, mayNeedUpdate: false }, - _meta: { runtimeId: 'remote-runtime' } - }) - } - return Promise.reject(new Error(error)) - }) - - seedStore(store, { - settings: { ...getDefaultSettings('/tmp'), activeRuntimeEnvironmentId: 'env-1' }, - worktreesByRepo: { - repo1: [makeWorktree({ id: worktreeId, repoId: 'repo1', hostId: 'runtime:env-1' })] - }, - tabsByWorktree: {}, - ptyIdsByTabId: {}, - terminalLayoutsByTabId: {} - }) - - const result = await store - .getState() - .removeWorktree({ id: worktreeId, executionHostId: null }) - - expect(result).toEqual({ ok: false, error: displayed }) - expect(store.getState().deleteStateByWorktreeId[worktreeId]).toEqual({ - isDeleting: false, - error: displayed, - canForceDelete: false, - forceDeleteReason: null - }) - expect(mockApi.worktrees.remove).not.toHaveBeenCalled() - } - ) }) diff --git a/src/renderer/src/store/slices/worktrees/teardown/worktrees-always-force-delete.test.ts b/src/renderer/src/store/slices/worktrees/teardown/worktrees-always-force-delete.test.ts index 76fe19790d0..de4b39001d7 100644 --- a/src/renderer/src/store/slices/worktrees/teardown/worktrees-always-force-delete.test.ts +++ b/src/renderer/src/store/slices/worktrees/teardown/worktrees-always-force-delete.test.ts @@ -60,31 +60,6 @@ it('refuses newly appeared unapproved live agent on local after preparation', as expect(mockApi.worktrees.remove).not.toHaveBeenCalled() }) -it('allows already-approved live agent on local after preparation', async () => { - const store = createTestStore() - const candidate = makeCandidate({ executionHostId: 'local' }) - candidate.blockers = ['live-agent'] - const wt = makeWorktree({ id: candidate.worktreeId, repoId: candidate.repoId, hostId: 'local' }) - store.setState({ worktreesByRepo: { [wt.repoId]: [wt] } }) - const gate = deferred() - const preparation = mockApi.hooks.check - preparation.mockReturnValueOnce(gate.promise) - const removal = store.getState().removeWorktree({ id: wt.id, executionHostId: 'local' }, false, { - assertBeforeDispatch: () => - assertWorkspaceCleanupAgentStopApproved(store.getState(), candidate, candidate) - }) - await vi.waitFor(() => expect(preparation).toHaveBeenCalled()) - const entry = makeAgentEntry('chat', 'working', Date.now(), { - worktreeId: wt.id, - connectionId: null, - terminalHandle: undefined - }) - store.setState({ agentStatusByPaneKey: { [entry.paneKey]: entry } }) - gate.resolve({ hasHooks: false }) - expect((await removal).ok).toBe(true) - expect(mockApi.worktrees.remove).toHaveBeenCalled() -}) - it('refuses newly appeared unapproved live agent on runtime:env-1 after preparation', async () => { const store = createTestStore() const candidate = makeCandidate({ executionHostId: 'runtime:env-1' }) @@ -116,35 +91,3 @@ it('refuses newly appeared unapproved live agent on runtime:env-1 after preparat expect((await removal).ok).toBe(false) expect(runtimeEnvironmentCall).not.toHaveBeenCalled() }) - -it('allows already-approved live agent on runtime:env-1 after preparation', async () => { - const store = createTestStore() - const candidate = makeCandidate({ executionHostId: 'runtime:env-1' }) - candidate.blockers = ['live-agent'] - const wt = makeWorktree({ - id: candidate.worktreeId, - repoId: candidate.repoId, - hostId: 'runtime:env-1' - }) - store.setState({ worktreesByRepo: { [wt.repoId]: [wt] } }) - const gate = deferred() - store.setState({ trustedOrcaHooks: { repo1: { all: { approvedAt: 1 } } } }) - const preparation = runtimeEnvironmentTransportCall - preparation.mockReturnValueOnce(gate.promise) - const removal = store - .getState() - .removeWorktree({ id: wt.id, executionHostId: 'runtime:env-1' }, false, { - assertBeforeDispatch: () => - assertWorkspaceCleanupAgentStopApproved(store.getState(), candidate, candidate) - }) - await vi.waitFor(() => expect(preparation).toHaveBeenCalled()) - const entry = makeAgentEntry('chat', 'working', Date.now(), { - worktreeId: wt.id, - connectionId: null, - terminalHandle: 'remote:env-1@@pty' - }) - store.setState({ agentStatusByPaneKey: { [entry.paneKey]: entry } }) - gate.resolve(createCompatibleRuntimeStatusResponse()) - expect((await removal).ok).toBe(true) - expect(runtimeEnvironmentCall).toHaveBeenCalled() -}) diff --git a/src/renderer/src/store/slices/worktrees/teardown/worktrees-removal-state-cleanup.test.ts b/src/renderer/src/store/slices/worktrees/teardown/worktrees-removal-state-cleanup.test.ts index 698e413a1e8..7df43ed7040 100644 --- a/src/renderer/src/store/slices/worktrees/teardown/worktrees-removal-state-cleanup.test.ts +++ b/src/renderer/src/store/slices/worktrees/teardown/worktrees-removal-state-cleanup.test.ts @@ -10,7 +10,6 @@ import '../create-worktree-slice' import { makeWorktree } from '../worktree.test-fixture' import { createTestStore, - mockApi, resetRemoteRuntimeMocks, resetWorktreeSliceModuleMemory } from '../worktrees-slice-test-harness' @@ -61,86 +60,6 @@ describe('removeWorktree state cleanup', () => { expect(hasDismissedHugeRepoWarning(replacementProbe)).toBe(false) }) - it('purges the orphaned project that pointed at a destroyed runtime-owned SSH target', async () => { - const store = createTestStore() - const wt = makeWorktree({ id: 'repo1::/path/wt1', repoId: 'repo1', path: '/path/wt1' }) - const orphanedSetup: AppState['projectHostSetups'][number] = { - id: 'setup-runtime-ssh', - hostId: 'ssh:runtime-ssh-orca-1', - projectId: 'project-runtime-ssh', - repoId: 'repo-runtime-ssh', - path: '/runtime/repo', - displayName: 'Runtime repo', - setupState: 'ready', - setupMethod: 'legacy-repo', - createdAt: 1, - updatedAt: 1 - } - const userSshSetup: AppState['projectHostSetups'][number] = { - id: 'setup-user-ssh', - hostId: 'ssh:my-server', - projectId: 'project-user-ssh', - repoId: 'repo-user-ssh', - path: '/user/repo', - displayName: 'User repo', - setupState: 'ready', - setupMethod: 'legacy-repo', - createdAt: 1, - updatedAt: 1 - } - const deleteProjectHostSetup = vi.fn().mockResolvedValue(null) - store.setState({ - worktreesByRepo: { repo1: [wt] }, - projectHostSetups: [orphanedSetup, userSshSetup], - deleteProjectHostSetup - }) - mockApi.ephemeralVm.listRuntimes.mockResolvedValueOnce([ - { - id: 'runtime-1', - workspaceId: 'repo1::/path/wt1', - cleanupStatus: 'not_started', - sshTargetId: 'runtime-ssh-orca-1' - } - ]) - - await store.getState().removeWorktree({ id: 'repo1::/path/wt1', executionHostId: null }) - - // Only the orphaned runtime-owned project setup is purged; the user's SSH project is untouched. - expect(deleteProjectHostSetup).toHaveBeenCalledWith({ - setupId: 'setup-runtime-ssh', - hostId: 'ssh:runtime-ssh-orca-1' - }) - }) - - it('cleans up markdownFrontmatterVisible for preview-only source files in the removed worktree', async () => { - const store = createTestStore() - const wt = makeWorktree({ id: 'repo1::/path/wt1', repoId: 'repo1', path: '/path/wt1' }) - - store.setState({ - worktreesByRepo: { repo1: [wt] }, - openFiles: [ - { - id: 'markdown-preview::file-1', - worktreeId: 'repo1::/path/wt1', - filePath: '/path/wt1/readme.md', - relativePath: 'readme.md', - language: 'markdown', - isDirty: false, - markdownPreviewSourceFileId: 'file-1', - mode: 'markdown-preview' as const - } - ], - markdownFrontmatterVisible: { - 'file-1': true, - 'file-2': true - } - } as unknown as Partial) - - await store.getState().removeWorktree({ id: 'repo1::/path/wt1', executionHostId: null }) - - expect(store.getState().markdownFrontmatterVisible).toEqual({ 'file-2': true }) - }) - it('records the sidebar scroll anchor in the same tick it removes the worktree', async () => { const store = createTestStore() const wt = makeWorktree({ id: 'repo1::/path/wt1', repoId: 'repo1', path: '/path/wt1' }) diff --git a/src/renderer/src/store/terminals/store-create-tab-start-in-main.test.ts b/src/renderer/src/store/terminals/store-create-tab-start-in-main.test.ts index 46c66ee78c7..7f5a0fb0258 100644 --- a/src/renderer/src/store/terminals/store-create-tab-start-in-main.test.ts +++ b/src/renderer/src/store/terminals/store-create-tab-start-in-main.test.ts @@ -130,22 +130,6 @@ describe("a new tab's first terminal, started by main in a layout-owner build", expect(store.getState().terminalPaneStartsByPaneKey[PANE_KEY]).toBeUndefined() }) - it('starts its own terminal, with its startup, when main does not hold the tab', async () => { - const store = storeWithWorktree() - store.getState().createTab(WORKTREE, undefined, undefined, { - id: TAB, - initialLeafId: LEAF, - pendingStartup: { command: 'make dev' } - }) - await settle() - - mocks.create!.reject(new Error('host_not_owned')) - await settle() - - expect(store.getState().terminalPaneStartsByPaneKey[PANE_KEY]).toBeUndefined() - expect(store.getState().pendingStartupByTabId[TAB]).toMatchObject({ command: 'make dev' }) - }) - it('gives no startup back to a tab the user closed before main answered', async () => { const store = storeWithWorktree() store.getState().createTab(WORKTREE, undefined, undefined, { From 8b02c184bb423308b4a10bbdd0b7e1ef0434f6d0 Mon Sep 17 00:00:00 2001 From: Neil <4138956+nwparker@users.noreply.github.com> Date: Tue, 10 Nov 2026 15:39:39 -0800 Subject: [PATCH 08/11] fix(claude): only offer theme sync when Claude Code CLI runs in a terminal (#40916) Native chat (agent-session) tabs project Claude status entries into agentStatusByPaneKey, which made the terminal-agent presence check fire the Claude Code theme-sync offer without the CLI ever being launched. Status entries now count only when their pane belongs to a terminal tab. --- .../agent-terminal-presence.test.ts | 40 +++++++++++++++++++ .../agent-presence/agent-terminal-presence.ts | 15 ++++++- 2 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 src/renderer/src/components/terminal-pane/provider-notices/agent-presence/agent-terminal-presence.test.ts diff --git a/src/renderer/src/components/terminal-pane/provider-notices/agent-presence/agent-terminal-presence.test.ts b/src/renderer/src/components/terminal-pane/provider-notices/agent-presence/agent-terminal-presence.test.ts new file mode 100644 index 00000000000..62b44a4afba --- /dev/null +++ b/src/renderer/src/components/terminal-pane/provider-notices/agent-presence/agent-terminal-presence.test.ts @@ -0,0 +1,40 @@ +import { afterEach, describe, expect, it, vi } from 'vitest' +import { useAppStore } from '@/store/index' +import { makeTerminalTab } from '@/store/terminals/terminal-row.test-fixture' +import { status } from '@/components/native-chat/messages/agent-senders/native-chat-agent-sender.test-fixture' +import { whenAgentTerminalAppears } from './agent-terminal-presence' + +const initial = useAppStore.getState() + +afterEach(() => { + useAppStore.setState(initial, true) +}) + +describe('whenAgentTerminalAppears', () => { + it('ignores a Claude status entry from a native chat tab', () => { + const onAppear = vi.fn() + useAppStore.setState({ + tabsByWorktree: {}, + agentStatusByPaneKey: {}, + paneForegroundAgentByPaneKey: {} + }) + const unsubscribe = whenAgentTerminalAppears('claude', onAppear) + const entry = status(1) + useAppStore.setState({ agentStatusByPaneKey: { [entry.paneKey]: entry } }) + expect(onAppear).not.toHaveBeenCalled() + unsubscribe() + }) + + it('fires for a Claude status entry from a terminal tab', () => { + const onAppear = vi.fn() + useAppStore.setState({ + tabsByWorktree: { workspace: [makeTerminalTab({ id: 'tab-1', worktreeId: 'workspace' })] }, + agentStatusByPaneKey: {}, + paneForegroundAgentByPaneKey: {} + }) + whenAgentTerminalAppears('claude', onAppear) + const entry = status(1) + useAppStore.setState({ agentStatusByPaneKey: { [entry.paneKey]: entry } }) + expect(onAppear).toHaveBeenCalledTimes(1) + }) +}) diff --git a/src/renderer/src/components/terminal-pane/provider-notices/agent-presence/agent-terminal-presence.ts b/src/renderer/src/components/terminal-pane/provider-notices/agent-presence/agent-terminal-presence.ts index 4376f73a59f..6fe380b5ec5 100644 --- a/src/renderer/src/components/terminal-pane/provider-notices/agent-presence/agent-terminal-presence.ts +++ b/src/renderer/src/components/terminal-pane/provider-notices/agent-presence/agent-terminal-presence.ts @@ -3,13 +3,26 @@ import type { AppState } from '@/store/types' type NoticeAgent = 'codex' | 'claude' +function paneKeyTabId(paneKey: string): string { + const separator = paneKey.indexOf(':') + return separator === -1 ? paneKey : paneKey.slice(0, separator) +} + +function isTerminalTab(state: AppState, tabId: string): boolean { + return Object.values(state.tabsByWorktree).some((tabs) => tabs.some((tab) => tab.id === tabId)) +} + // Why three sources: Orca-launched tabs, hook-reported agents (SSH too), and an agent typed in a local pane. function hasAgentTerminal(state: AppState, agent: NoticeAgent): boolean { return ( Object.values(state.tabsByWorktree).some((tabs) => tabs.some((tab) => tab.launchAgent === agent) ) || - Object.values(state.agentStatusByPaneKey).some((entry) => entry.agentType === agent) || + // Why the terminal-tab check: native chat (agent-session) tabs project status entries too, + // but they run no CLI in a terminal, so they must not trigger terminal-only notices. + Object.entries(state.agentStatusByPaneKey).some( + ([paneKey, entry]) => entry.agentType === agent && isTerminalTab(state, paneKeyTabId(paneKey)) + ) || Object.values(state.paneForegroundAgentByPaneKey).some((entry) => entry.agent === agent) ) } From c3662026f59b62c332678512063975fd3bb4c552 Mon Sep 17 00:00:00 2001 From: Brennan Benson <79079362+brennanb2025@users.noreply.github.com> Date: Tue, 10 Nov 2026 15:51:05 -0800 Subject: [PATCH 09/11] Fix workspace delete shortcut targeting (#40913) * Fix workspace delete shortcut targeting Resolve the keyboard action from the current workspace and execution host, keep clicked menu actions bound to their rows, and advertise the shortcut only for the committed workspace copy. Preserve confirmation preferences. Co-authored-by: Luca Critelli Co-authored-by: Anton Kuligin * Document isolated deletion test fixture boundaries * Type the shortcut command test input --------- Co-authored-by: Luca Critelli Co-authored-by: Anton Kuligin --- .../src/app-shell/app-command-handlers.ts | 10 +- .../WorktreeContextMenuDeleteItems.test.tsx | 78 +++++ .../WorktreeContextMenuDeleteItems.tsx | 14 +- .../deletion/active-workspace-delete.test.ts | 283 ++++++++++++++++++ ...e-delete.ts => active-workspace-delete.ts} | 117 ++++---- .../child-workspaces-toggle-target.ts | 3 +- .../identity/hovered-workspace-identity.ts | 11 + .../workspace-shortcut-ipc-bridge.ts | 4 +- tests/e2e/worktree-delete-shortcut.spec.ts | 19 +- 9 files changed, 469 insertions(+), 70 deletions(-) create mode 100644 src/renderer/src/components/sidebar/workspace-actions/context-menu/WorktreeContextMenuDeleteItems.test.tsx create mode 100644 src/renderer/src/components/sidebar/workspace-actions/deletion/active-workspace-delete.test.ts rename src/renderer/src/components/sidebar/workspace-actions/deletion/{hovered-workspace-delete.ts => active-workspace-delete.ts} (51%) create mode 100644 src/renderer/src/components/sidebar/workspace-card/identity/hovered-workspace-identity.ts diff --git a/src/renderer/src/app-shell/app-command-handlers.ts b/src/renderer/src/app-shell/app-command-handlers.ts index 1c5e25071ea..5761fd34574 100644 --- a/src/renderer/src/app-shell/app-command-handlers.ts +++ b/src/renderer/src/app-shell/app-command-handlers.ts @@ -13,9 +13,9 @@ import { } from '../components/sidebar/workspace-card/identity/child-workspaces-toggle-target' import { requestTerminalTabRename } from '../components/tab-bar/terminal-tab-rename-request' import { - deleteHoveredWorkspaceImmediately, - resolveHoveredWorkspaceDeleteTarget -} from '../components/sidebar/workspace-actions/deletion/hovered-workspace-delete' + deleteActiveWorkspaceFromShortcut, + resolveActiveWorkspaceDeleteTarget +} from '../components/sidebar/workspace-actions/deletion/active-workspace-delete' import { useAppStore } from '../store/index' import type { usePluginCommands } from '@/store/plugins/catalog/plugin-contribution-catalog' import { isGitRepoKind } from '../../../shared/repo-kind' @@ -230,12 +230,12 @@ export function createAppCommandHandlers( return false } const store = useAppStore.getState() - const target = resolveHoveredWorkspaceDeleteTarget(store) + const target = resolveActiveWorkspaceDeleteTarget(store) if (!target) { return false } return claim('workspace.delete', () => { - deleteHoveredWorkspaceImmediately(store, target) + deleteActiveWorkspaceFromShortcut(store, target) }) } ], diff --git a/src/renderer/src/components/sidebar/workspace-actions/context-menu/WorktreeContextMenuDeleteItems.test.tsx b/src/renderer/src/components/sidebar/workspace-actions/context-menu/WorktreeContextMenuDeleteItems.test.tsx new file mode 100644 index 00000000000..90cbcff2ec2 --- /dev/null +++ b/src/renderer/src/components/sidebar/workspace-actions/context-menu/WorktreeContextMenuDeleteItems.test.tsx @@ -0,0 +1,78 @@ +// @vitest-environment happy-dom +import { act, type ReactNode } from 'react' +import { createRoot } from 'react-dom/client' +import { expect, it, vi } from 'vitest' +import type { AppState } from '@/store/types' +import { makeWorktree } from '@/store/slices/worktrees/worktree.test-fixture' +import type { WorktreeContextMenuModel } from './use-worktree-context-menu-model' + +// oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: replaced before rendering with every store field read by the production selector. +const mocks = vi.hoisted(() => ({ state: {} as AppState })) +vi.mock('@/store', () => ({ + useAppStore: (select: (s: AppState) => unknown) => select(mocks.state) +})) +vi.mock('@/hooks/useShortcutLabel', () => ({ useOptionalShortcutLabel: () => '⌘⇧⌫' })) +vi.mock('@/i18n/use-translate', () => ({ + useTranslate: () => (_key: string, fallback: string) => fallback +})) +vi.mock('@/components/ui/dropdown-menu', () => ({ + DropdownMenuItem: ({ children }: { children: ReactNode }) =>
{children}
, + DropdownMenuShortcut: ({ children }: { children: ReactNode }) => {children} +})) +import { WorktreeContextMenuDeleteItems } from './WorktreeContextMenuDeleteItems' + +it('advertises the shortcut only on the committed paired copy when physical host and instance match', () => { + const inactive = makeWorktree({ + id: 'repo::/checkout', + repoId: 'repo', + hostId: 'ssh:builder', + runtimeOwnerEnvironmentId: 'server-b' + }) + const active = { ...inactive, runtimeOwnerEnvironmentId: 'server-a' } + // oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: the isolated store mock supplies every field read by the production selector. + mocks.state = { + activeView: 'terminal', + activeWorktreeId: active.id, + activeWorkspaceExecutionHostId: 'runtime:server-a', + activePendingCreationId: null, + pendingWorktreeCreations: {}, + worktreesByRepo: { repo: [inactive, active] }, + repos: [], + folderWorkspaces: [], + projectGroups: [], + deleteStateByWorktreeId: {} + } as unknown as AppState + const container = document.createElement('div') + document.body.append(container) + const root = createRoot(container) + const model = (worktree: typeof inactive) => + // oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: this fixture supplies every model field read by DeleteItems; other menu sections never render. + ({ + worktree, + batchDeleteWorktrees: [], + contextDeletePending: false, + handleDelete: vi.fn(), + isMultiContext: false, + lineageDescendantCount: 0, + removesProject: false + }) as unknown as WorktreeContextMenuModel + try { + act(() => + root.render( + <> +
+ +
+
+ +
+ + ) + ) + expect(container.querySelector('[data-copy="inactive"] kbd')).toBeNull() + expect(container.querySelector('[data-copy="active"] kbd')).not.toBeNull() + } finally { + act(() => root.unmount()) + container.remove() + } +}) diff --git a/src/renderer/src/components/sidebar/workspace-actions/context-menu/WorktreeContextMenuDeleteItems.tsx b/src/renderer/src/components/sidebar/workspace-actions/context-menu/WorktreeContextMenuDeleteItems.tsx index 0ac834fc6c4..be706601875 100644 --- a/src/renderer/src/components/sidebar/workspace-actions/context-menu/WorktreeContextMenuDeleteItems.tsx +++ b/src/renderer/src/components/sidebar/workspace-actions/context-menu/WorktreeContextMenuDeleteItems.tsx @@ -1,4 +1,7 @@ import { useId } from 'react' +import { useAppStore } from '@/store' +import { selectActiveWorkspaceDeleteTarget } from '../deletion/active-workspace-delete' +import { worktreeCopyOwnerKey } from '@/store/slices/worktrees/metadata/worktree-copy-review-clear' import { Trash2 } from 'lucide-react' import { DropdownMenuItem, DropdownMenuShortcut } from '@/components/ui/dropdown-menu' import { useOptionalShortcutLabel } from '@/hooks/useShortcutLabel' @@ -20,6 +23,15 @@ export function WorktreeContextMenuDeleteItems({ model }: { model: WorktreeConte removesProject, worktree } = model + const isActiveDeleteTarget = useAppStore((state) => { + const target = selectActiveWorkspaceDeleteTarget(state) + return target?.kind === 'folder' + ? target.workspaceKey === worktree.id && target.executionHostId === worktree.hostId + : target?.kind === 'worktree' && + target.worktree.id === worktree.id && + worktreeCopyOwnerKey(target.worktree) === worktreeCopyOwnerKey(worktree) && + target.worktree.instanceId === worktree.instanceId + }) const projectMissing = !isMultiContext && worktree.isMainWorktree && !removesProject const label = contextDeletePending ? t('auto.components.sidebar.WorktreeContextMenu.b42391d8bf', 'Deleting…') @@ -78,7 +90,7 @@ export function WorktreeContextMenuDeleteItems({ model }: { model: WorktreeConte > {label} - {!isMultiContext && !removesProject && deleteShortcut ? ( + {!isMultiContext && !removesProject && isActiveDeleteTarget && deleteShortcut ? ( {deleteShortcut} ) : null} diff --git a/src/renderer/src/components/sidebar/workspace-actions/deletion/active-workspace-delete.test.ts b/src/renderer/src/components/sidebar/workspace-actions/deletion/active-workspace-delete.test.ts new file mode 100644 index 00000000000..92643804fad --- /dev/null +++ b/src/renderer/src/components/sidebar/workspace-actions/deletion/active-workspace-delete.test.ts @@ -0,0 +1,283 @@ +// @vitest-environment happy-dom + +import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' +import type { AppState } from '@/store/types' +import { makeWorktree } from '@/store/slices/worktrees/worktree.test-fixture' +import { makeFolderWorkspace } from '@/store/folder-workspaces/folder-workspace.test-fixture' +import { TEST_REPO } from '@/store/repos/repo.test-fixture' + +const mocks = vi.hoisted(() => ({ + // oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: replaced before each test with every store field read by these shortcut callers. + state: {} as AppState, + deleteWorktree: vi.fn(), + folder: vi.fn() +})) +vi.mock('@/store', () => ({ useAppStore: { getState: () => mocks.state } })) +vi.mock('./delete-worktree-flow', () => ({ runWorktreeDelete: mocks.deleteWorktree })) +vi.mock('./folder-workspace-delete', () => ({ deleteFolderWorkspaceUnlessUnsaved: mocks.folder })) +vi.mock('@/components/floating-terminal/floating-workspace-terminal-actions', () => ({ + isFloatingWorkspacePanelFocused: () => false +})) +import { createAppCommandHandlers, type AppShortcutState } from '@/app-shell/app-command-handlers' +import { registerWorkspaceShortcutIpcBridge } from '@/hooks/ipc-events/workspace-shortcut-ipc-bridge' +import { + createWorktreeContextMenuDeleteIntent, + runWorktreeContextMenuDeleteIntent +} from '../context-menu/worktree-context-menu-delete-intent' + +const active = makeWorktree({ id: 'active', repoId: 'repo1', hostId: 'local', instanceId: 'a' }) +const other = makeWorktree({ id: 'other', repoId: 'repo1', hostId: 'local', instanceId: 'b' }) +let ipcDelete: () => void + +function runRenderer(): void { + const state: AppShortcutState = { + activeView: 'terminal', + activeWorktreeId: 'active', + actions: { + toggleSidebar: vi.fn(), + toggleRightSidebar: vi.fn(), + setRightSidebarOpen: vi.fn(), + setRightSidebarTab: vi.fn(), + showRightSidebarFiles: vi.fn(), + showRightSidebarSearch: vi.fn(), + openDiffNotesSendMenuForActiveWorktree: vi.fn() + }, + creationLayoutActive: false, + floatingTerminalEnabled: false, + floatingTerminalOpen: false, + floatingVisibleTabCount: 0, + keybindings: {}, + openFloatingWorkspaceMaximized: vi.fn(), + pluginCommands: [], + setFloatingTerminalOpen: vi.fn(), + terminalShortcutPolicy: 'orca-first', + workspaceChromeActive: true + } + createAppCommandHandlers(state, undefined, 'app', true).get('workspace.delete')?.() +} + +beforeEach(() => { + vi.clearAllMocks() + mocks.folder.mockReturnValue(null) + // oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: this isolated store mock supplies every field read by the tested production paths. + mocks.state = { + activeView: 'terminal', + activeModal: 'none', + activeWorktreeId: 'active', + activeWorkspaceExecutionHostId: 'local', + activePendingCreationId: null, + pendingWorktreeCreations: {}, + repos: [TEST_REPO], + worktreesByRepo: { repo1: [active, other] }, + folderWorkspaces: [], + projectGroups: [], + deleteStateByWorktreeId: {} + } as unknown as AppState + const noop = () => () => {} + Object.defineProperty(window, 'api', { + configurable: true, + value: { + ui: { + onOpenQuickOpen: noop, + onToggleQuickCommandsMenu: noop, + onOpenNewWorkspace: noop, + onDeleteCurrentWorkspace: (callback: () => void) => { + ipcDelete = callback + return () => {} + }, + onOpenTasks: noop, + onJumpToWorktreeIndex: noop, + onJumpToTabIndex: noop, + onWorktreeHistoryNavigate: noop, + onToggleStatusBar: noop + } + } + }) + registerWorkspaceShortcutIpcBridge([]) + const query = document.querySelectorAll.bind(document) + vi.spyOn(document, 'querySelectorAll').mockImplementation((selector) => + query(selector.replace(':hover', '[data-hovered]')) + ) + document.body.innerHTML = + '
' +}) +afterEach(() => { + document.body.innerHTML = '' + vi.restoreAllMocks() +}) + +describe.each([ + ['renderer', runRenderer], + ['main IPC', () => ipcDelete()] +] as const)('%s delete shortcut', (_name, run) => { + it('targets the active instance while a different row is hovered, but menu clicks keep their row', () => { + run() + expect(mocks.deleteWorktree).toHaveBeenCalledExactlyOnceWith('active', { + expectedHostId: 'local', + expectedInstanceId: 'a' + }) + runWorktreeContextMenuDeleteIntent( + createWorktreeContextMenuDeleteIntent({ + worktree: other, + batchDeleteWorktrees: [], + isMultiContext: false + }) + ) + expect(mocks.deleteWorktree).toHaveBeenLastCalledWith('other', { + expectedHostId: 'local', + expectedInstanceId: 'b' + }) + }) + + it('works with no sidebar or hovered row', () => { + document.body.innerHTML = '' + run() + expect(mocks.deleteWorktree).toHaveBeenCalledExactlyOnceWith('active', { + expectedHostId: 'local', + expectedInstanceId: 'a' + }) + }) + + it('pins the active host when another host publishes the same ID', () => { + mocks.state.worktreesByRepo = { + repo1: [active, { ...active, hostId: 'ssh:builder', instanceId: 'remote' }] + } + mocks.state.activeWorkspaceExecutionHostId = 'ssh:builder' + run() + expect(mocks.deleteWorktree).toHaveBeenCalledExactlyOnceWith('active', { + expectedHostId: 'ssh:builder', + expectedInstanceId: 'remote' + }) + }) + + it('resolves legacy local ownership without inventing a stamped host', () => { + mocks.state.worktreesByRepo = { repo1: [{ ...active, hostId: undefined }] } + run() + expect(mocks.deleteWorktree).toHaveBeenCalledExactlyOnceWith('active', { + expectedInstanceId: 'a' + }) + }) + + it('keeps a paired logical host bound to its physical row', () => { + mocks.state.worktreesByRepo = { + repo1: [{ ...active, hostId: 'ssh:builder', runtimeOwnerEnvironmentId: 'build' }] + } + mocks.state.activeWorkspaceExecutionHostId = 'runtime:build' + run() + expect(mocks.deleteWorktree).toHaveBeenCalledExactlyOnceWith('active', { + expectedHostId: 'ssh:builder', + expectedInstanceId: 'a' + }) + }) + + it('refuses an ambiguous unqualified active ID', () => { + mocks.state.activeWorkspaceExecutionHostId = null + mocks.state.worktreesByRepo = { repo1: [active, { ...active, hostId: 'ssh:builder' }] } + run() + expect(mocks.deleteWorktree).not.toHaveBeenCalled() + }) + + it('routes the active folder to its qualified owner', () => { + mocks.state.activeWorktreeId = 'folder:folder-1' + mocks.state.activeWorkspaceExecutionHostId = 'ssh:builder' + mocks.state.folderWorkspaces = [ + makeFolderWorkspace({ executionHostId: 'local' }), + makeFolderWorkspace({ executionHostId: 'ssh:builder' }) + ] + run() + expect(mocks.folder).toHaveBeenCalledExactlyOnceWith( + expect.any(Function), + 'folder-1', + 'ssh:builder' + ) + expect(mocks.deleteWorktree).not.toHaveBeenCalled() + }) + + it.each(['settings', 'activity', 'space', 'tasks'] as const)( + 'refuses behind the %s view', + (activeView) => { + mocks.state.activeView = activeView + run() + expect(mocks.deleteWorktree).not.toHaveBeenCalled() + } + ) + + it('refuses while a creation surface owns the workspace', () => { + mocks.state.activePendingCreationId = 'pending' + mocks.state.pendingWorktreeCreations = { + // oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: creation eligibility reads only status and loaderVisible. + pending: { + status: 'error', + loaderVisible: true + } as AppState['pendingWorktreeCreations'][string] + } + run() + expect(mocks.deleteWorktree).not.toHaveBeenCalled() + }) + + it('refuses a local dialog with button focus even when activeModal is none', () => { + const dialog = document.createElement('div') + dialog.role = 'dialog' + dialog.innerHTML = '' + document.body.append(dialog) + // oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: overlay visibility reads only the returned rectangle count. + vi.spyOn(dialog, 'getClientRects').mockReturnValue([ + new DOMRect(0, 0, 300, 200) + ] as unknown as DOMRectList) + dialog.querySelector('button')?.focus() + run() + expect(mocks.deleteWorktree).not.toHaveBeenCalled() + }) + + it('allows an ordinary context menu without changing the active target', () => { + document.body.insertAdjacentHTML( + 'beforeend', + '
' + ) + const menu = document.querySelector('[role="menu"]') + if (!menu) { + throw new Error('Missing menu') + } + // oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: overlay visibility reads only the returned rectangle count. + vi.spyOn(menu, 'getClientRects').mockReturnValue([ + new DOMRect(0, 0, 300, 200) + ] as unknown as DOMRectList) + document.querySelector('button')?.focus() + run() + expect(mocks.deleteWorktree).toHaveBeenCalledExactlyOnceWith('active', { + expectedHostId: 'local', + expectedInstanceId: 'a' + }) + }) + + it.each(['missing', 'primary', 'deleting', 'modal', 'editable'] as const)( + 'refuses %s targets or focus', + (guard) => { + if (guard === 'missing') { + mocks.state.activeWorktreeId = 'missing' + } + if (guard === 'primary') { + mocks.state.worktreesByRepo = { repo1: [{ ...active, isMainWorktree: true }] } + } + if (guard === 'deleting') { + mocks.state.deleteStateByWorktreeId = { + 'local|active': { + isDeleting: true, + error: null, + canForceDelete: false, + forceDeleteReason: null + } + } + } + if (guard === 'modal') { + mocks.state.activeModal = 'delete-worktree' + } + if (guard === 'editable') { + document.body.insertAdjacentHTML('beforeend', '') + document.querySelector('input')?.focus() + } + run() + expect(mocks.deleteWorktree).not.toHaveBeenCalled() + } + ) +}) diff --git a/src/renderer/src/components/sidebar/workspace-actions/deletion/hovered-workspace-delete.ts b/src/renderer/src/components/sidebar/workspace-actions/deletion/active-workspace-delete.ts similarity index 51% rename from src/renderer/src/components/sidebar/workspace-actions/deletion/hovered-workspace-delete.ts rename to src/renderer/src/components/sidebar/workspace-actions/deletion/active-workspace-delete.ts index d8a7f58f26d..19a91803eef 100644 --- a/src/renderer/src/components/sidebar/workspace-actions/deletion/hovered-workspace-delete.ts +++ b/src/renderer/src/components/sidebar/workspace-actions/deletion/active-workspace-delete.ts @@ -1,13 +1,12 @@ import { selectWorktreesByRepo } from '@/store/workspaces/catalog/workspace-record-fields' import { useAppStore } from '@/store' -import { getIndexedAllWorktrees } from '@/store/slices/worktrees/listing/worktree-catalog-index' +import { resolveQualifiedWorktreeExecutionOwner } from '@/lib/workspace/ownership/qualified-worktree-execution-owner' +import { resolveQualifiedIndexedFolderWorkspace } from '@/store/folder-workspaces/folder-workspace-record-index' +import { selectWorktreeCreationSurfaceShown } from '@/lib/workspace/creation/worktree-creation-surface' +import { hasVisibleOverlay } from '@/lib/visible-overlay' import type { AppState } from '@/store/types' import { isEditableTarget, isNativeChatPromptTarget } from '@/lib/text-input/focus/editable-target' -import { - composeWorktreeHostIdentity, - getExecutionHostIdFromWorktreeHostIdentity, - getWorktreeHostIdentity -} from '../../../../../../shared/worktree/host-qualified-identity' +import { composeWorktreeHostIdentity } from '../../../../../../shared/worktree/host-qualified-identity' import type { Worktree } from '../../../../../../shared/worktree/types' import { parseWorkspaceKey } from '../../../../../../shared/workspace-scope' import type { ExecutionHostId } from '../../../../../../shared/execution-host' @@ -18,21 +17,27 @@ import { getDeleteStateForWorktreeHost } from './worktree-delete-state-host-matc const pendingFolderDeletes = new Set() type DeleteWorktree = typeof runWorktreeDelete -type HoveredWorkspaceDeleteState = Pick< +type ActiveWorkspaceDeleteState = Pick< AppState, | 'activeModal' | 'activeWorktreeId' - | 'deleteFolderWorkspace' + | 'activeWorkspaceExecutionHostId' + | 'activeView' + | 'activePendingCreationId' + | 'pendingWorktreeCreations' + | 'folderWorkspaces' + | 'projectGroups' + | 'repos' | 'deleteStateByWorktreeId' | 'worktreesByRepo' > -type HoveredWorkspaceDeleteDependencies = { +type ActiveWorkspaceDeleteDependencies = { deleteWorktree: DeleteWorktree getCurrentState: () => AppState } -type HoveredWorkspaceDocument = Pick +type ActiveWorkspaceDocument = Pick -export type HoveredWorkspaceDeleteTarget = +export type ActiveWorkspaceDeleteTarget = | { kind: 'folder' executionHostId: ExecutionHostId @@ -41,52 +46,38 @@ export type HoveredWorkspaceDeleteTarget = } | { kind: 'worktree'; worktree: Worktree } -export function getHoveredWorkspaceIdentity( - doc: HoveredWorkspaceDocument = document -): { hostIdentity: string; workspaceId: string } | null { - const hoveredRows = doc.querySelectorAll( - '[data-worktree-sidebar] [role="option"][data-worktree-id]:hover' - ) - const row = hoveredRows.item(hoveredRows.length - 1) - const workspaceId = row?.dataset.worktreeId - const hostIdentity = row?.dataset.worktreeHostIdentity - return workspaceId && hostIdentity ? { workspaceId, hostIdentity } : null -} - -export function resolveHoveredWorkspaceDeleteTarget( - state: HoveredWorkspaceDeleteState, - doc: HoveredWorkspaceDocument = document -): HoveredWorkspaceDeleteTarget | null { +export function selectActiveWorkspaceDeleteTarget( + state: ActiveWorkspaceDeleteState +): ActiveWorkspaceDeleteTarget | null { if ( - state.activeModal !== 'none' || - (doc.activeElement && - isEditableTarget(doc.activeElement) && - !isNativeChatPromptTarget(doc.activeElement)) + state.activeView !== 'terminal' || + !state.activeWorktreeId || + selectWorktreeCreationSurfaceShown(state) ) { return null } - const hovered = getHoveredWorkspaceIdentity(doc) - if (!hovered) { - return null - } - const workspaceScope = parseWorkspaceKey(hovered.workspaceId) + const workspaceScope = parseWorkspaceKey(state.activeWorktreeId) if (workspaceScope?.type === 'folder') { - const executionHostId = getExecutionHostIdFromWorktreeHostIdentity(hovered.hostIdentity) - if (!executionHostId) { - return null - } - return { - kind: 'folder', - executionHostId, - folderWorkspaceId: workspaceScope.folderWorkspaceId, - workspaceKey: hovered.workspaceId - } + const owner = resolveQualifiedIndexedFolderWorkspace( + state, + workspaceScope.folderWorkspaceId, + state.activeWorkspaceExecutionHostId ?? undefined + ) + return owner.kind === 'selected' + ? { + kind: 'folder', + executionHostId: owner.value.hostId, + folderWorkspaceId: workspaceScope.folderWorkspaceId, + workspaceKey: state.activeWorktreeId + } + : null } - const worktree = getIndexedAllWorktrees(selectWorktreesByRepo(state)).find( - (candidate) => - candidate.id === hovered.workspaceId && - getWorktreeHostIdentity(candidate) === hovered.hostIdentity - ) + const worktree = resolveQualifiedWorktreeExecutionOwner( + selectWorktreesByRepo(state), + state.repos, + state.activeWorktreeId, + state.activeWorkspaceExecutionHostId + )?.worktree return worktree && !worktree.isMainWorktree && !getDeleteStateForWorktreeHost(worktree, state.deleteStateByWorktreeId)?.isDeleting @@ -94,10 +85,26 @@ export function resolveHoveredWorkspaceDeleteTarget( : null } -export function deleteHoveredWorkspaceImmediately( - state: HoveredWorkspaceDeleteState, - target: HoveredWorkspaceDeleteTarget | null = resolveHoveredWorkspaceDeleteTarget(state), - dependencies: HoveredWorkspaceDeleteDependencies = { +export function resolveActiveWorkspaceDeleteTarget( + state: ActiveWorkspaceDeleteState, + doc: ActiveWorkspaceDocument = document +): ActiveWorkspaceDeleteTarget | null { + if ( + state.activeModal !== 'none' || + hasVisibleOverlay({ ignoreMatches: '[role="listbox"], [role="menu"]' }) || + (doc.activeElement && + isEditableTarget(doc.activeElement) && + !isNativeChatPromptTarget(doc.activeElement)) + ) { + return null + } + return selectActiveWorkspaceDeleteTarget(state) +} + +export function deleteActiveWorkspaceFromShortcut( + state: ActiveWorkspaceDeleteState, + target: ActiveWorkspaceDeleteTarget | null = resolveActiveWorkspaceDeleteTarget(state), + dependencies: ActiveWorkspaceDeleteDependencies = { deleteWorktree: runWorktreeDelete, getCurrentState: useAppStore.getState } diff --git a/src/renderer/src/components/sidebar/workspace-card/identity/child-workspaces-toggle-target.ts b/src/renderer/src/components/sidebar/workspace-card/identity/child-workspaces-toggle-target.ts index 4d5458f02f2..894e9dfb46b 100644 --- a/src/renderer/src/components/sidebar/workspace-card/identity/child-workspaces-toggle-target.ts +++ b/src/renderer/src/components/sidebar/workspace-card/identity/child-workspaces-toggle-target.ts @@ -4,7 +4,7 @@ import { getWorktreeOnHostFromState } from '@/store/workspaces/selection/worktre import type { AppState } from '@/store/types' import { getWorktreeHostIdentity } from '../../../../../../shared/worktree/host-qualified-identity' import type { Worktree } from '../../../../../../shared/worktree/types' -import { getHoveredWorkspaceIdentity } from '../../workspace-actions/deletion/hovered-workspace-delete' +import { getHoveredWorkspaceIdentity } from './hovered-workspace-identity' import { computeRenderedSidebarRows } from '../../worktree-list/listing/rendered-sidebar-worktree-order' import { getPublishedVisibleWorktreeShortcutTargets } from '../../worktree-list/listing/visible-worktrees' import { computeVisibleWorktrees } from '../../worktree-list/listing/compute-visible-worktrees' @@ -28,7 +28,6 @@ function resolveTargetWorktree( ): Worktree | undefined { const hovered = getHoveredWorkspaceIdentity(doc) if (hovered) { - // Hovered cards outrank active ones, matching workspace deletion shortcuts. return getIndexedAllWorktrees(selectWorktreesByRepo(state)).find( (worktree) => worktree.id === hovered.workspaceId && diff --git a/src/renderer/src/components/sidebar/workspace-card/identity/hovered-workspace-identity.ts b/src/renderer/src/components/sidebar/workspace-card/identity/hovered-workspace-identity.ts new file mode 100644 index 00000000000..5f1ac7fcd78 --- /dev/null +++ b/src/renderer/src/components/sidebar/workspace-card/identity/hovered-workspace-identity.ts @@ -0,0 +1,11 @@ +export function getHoveredWorkspaceIdentity( + doc: Pick = document +): { hostIdentity: string; workspaceId: string } | null { + const hoveredRows = doc.querySelectorAll( + '[data-worktree-sidebar] [role="option"][data-worktree-id]:hover' + ) + const row = hoveredRows.item(hoveredRows.length - 1) + const workspaceId = row?.dataset.worktreeId + const hostIdentity = row?.dataset.worktreeHostIdentity + return workspaceId && hostIdentity ? { workspaceId, hostIdentity } : null +} diff --git a/src/renderer/src/hooks/ipc-events/workspace-shortcut-ipc-bridge.ts b/src/renderer/src/hooks/ipc-events/workspace-shortcut-ipc-bridge.ts index 4112b38b387..c91a98fced9 100644 --- a/src/renderer/src/hooks/ipc-events/workspace-shortcut-ipc-bridge.ts +++ b/src/renderer/src/hooks/ipc-events/workspace-shortcut-ipc-bridge.ts @@ -4,7 +4,7 @@ import { activateTabNumberShortcut } from '@/lib/keyboard/tab-number-shortcuts' import { emitCmdJRowIndexJump } from '@/lib/workspace/search/palette/cmd-j-row-index-jump' import { getVisibleWorktreeShortcutTargets } from '@/components/sidebar/worktree-list/listing/visible-worktrees' import { activateAndRevealWorkspace } from '@/lib/workspace/activation/worktree-activation' -import { deleteHoveredWorkspaceImmediately } from '@/components/sidebar/workspace-actions/deletion/hovered-workspace-delete' +import { deleteActiveWorkspaceFromShortcut } from '@/components/sidebar/workspace-actions/deletion/active-workspace-delete' import { isFloatingWorkspacePanelFocused } from '@/components/floating-terminal/floating-workspace-terminal-actions' import { isGitRepoKind } from '../../../../shared/repo-kind' import { runBuiltInOrReplacement } from '@/lib/plugins/commands/plugin-command-replacements' @@ -41,7 +41,7 @@ export function registerWorkspaceShortcutIpcBridge(unsubs: (() => void)[]): void if (isFloatingWorkspacePanelFocused()) { return } - deleteHoveredWorkspaceImmediately(useAppStore.getState()) + deleteActiveWorkspaceFromShortcut(useAppStore.getState()) }) ) } diff --git a/tests/e2e/worktree-delete-shortcut.spec.ts b/tests/e2e/worktree-delete-shortcut.spec.ts index 29d4e1291c7..2a3deb884d7 100644 --- a/tests/e2e/worktree-delete-shortcut.spec.ts +++ b/tests/e2e/worktree-delete-shortcut.spec.ts @@ -50,15 +50,23 @@ test.describe('Worktree Delete Shortcut', () => { .catch(() => undefined) }) - test('deletes the hovered worktree after Mod+Shift+Backspace confirmation', async ({ - orcaPage - }) => { + test('deletes the active worktree while another row is hovered', async ({ orcaPage }) => { createdWorktreeId = await createIsolatedWorktree(orcaPage) const worktreeId = createdWorktreeId const row = worktreeRow(orcaPage, worktreeId) await expect(row).toBeVisible() - await row.hover() + const previousActiveId = await orcaPage.evaluate( + () => window.__store?.getState().activeWorktreeId + ) + await row.click() + await expect + .poll(() => orcaPage.evaluate(() => window.__store?.getState().activeWorktreeId)) + .toBe(worktreeId) + if (!previousActiveId || previousActiveId === worktreeId) { + throw new Error('Expected a different workspace to hover') + } + await worktreeRow(orcaPage, previousActiveId).hover() await pressShortcut(orcaPage, 'Backspace', { shift: true }) const dialog = orcaPage.getByRole('dialog') @@ -68,9 +76,10 @@ test.describe('Worktree Delete Shortcut', () => { await expect .poll(async () => getAllWorktreeIds(orcaPage), { timeout: 15_000, - message: 'hovered worktree was not removed by the delete shortcut' + message: 'active worktree was not removed by the delete shortcut' }) .not.toContain(worktreeId) + expect(await getAllWorktreeIds(orcaPage)).toContain(previousActiveId) createdWorktreeId = null }) }) From 6192c9b8d52630c969b5e327d5fa2b51d21d8540 Mon Sep 17 00:00:00 2001 From: OrcaWin Date: Tue, 10 Nov 2026 15:55:48 -0800 Subject: [PATCH 10/11] test: remove six low-value suites and narrow redundant cases (#40922) Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com> --- config/reliability-gates.jsonc | 87 +++---- .../scripts/ci/sharding/ci-shard-timings.json | 6 - ...y-transport-empty-initial-snapshot.test.ts | 184 -------------- ...y-transport-mirror-resolve-overlap.test.ts | 57 +---- ...web-session-tabs-sync-focus-intent.test.ts | 34 --- .../github-pr-branch-fallback-results.test.ts | 232 ------------------ .../repos/all-host-catalog-settlement.test.ts | 13 - .../store-session-browser-hydration.test.ts | 174 ------------- .../runtime-status-snapshot.test.ts | 40 --- .../tabs/tabs-open-close-lifecycle.test.ts | 70 ------ .../store-active-worktree-selection.test.ts | 199 --------------- ...-worktree-purge-terminal-maps-leak.test.ts | 178 -------------- .../native-chat-launch-draft-teardown.test.ts | 79 +----- .../worktrees-background-removal.test.ts | 16 -- .../store-sleep-twin-host-owner.test.ts | 166 ------------- .../web/web-preload-api-runtime-calls.test.ts | 37 --- 16 files changed, 51 insertions(+), 1521 deletions(-) delete mode 100644 src/renderer/src/components/terminal-pane/pty-transport/remote-runtime/remote-runtime-pty-transport-empty-initial-snapshot.test.ts delete mode 100644 src/renderer/src/store/github/pull-requests/github-pr-branch-fallback-results.test.ts delete mode 100644 src/renderer/src/store/slices/browser/hydration/store-session-browser-hydration.test.ts delete mode 100644 src/renderer/src/store/slices/worktrees/session/store-active-worktree-selection.test.ts delete mode 100644 src/renderer/src/store/slices/worktrees/teardown/bulk-worktree-purge-terminal-maps-leak.test.ts delete mode 100644 src/renderer/src/store/terminals/store-sleep-twin-host-owner.test.ts diff --git a/config/reliability-gates.jsonc b/config/reliability-gates.jsonc index 3a31a26d5fb..c51880345b9 100644 --- a/config/reliability-gates.jsonc +++ b/config/reliability-gates.jsonc @@ -1223,12 +1223,12 @@ ], "platforms": ["macos", "linux", "windows"], "providers": ["remote-runtime"], - "coveredPlatforms": ["macos", "linux"], + "coveredPlatforms": ["macos"], "coveredProviders": [], - "coverageNotes": "Audit1348 changes referenced sources. Retained unchanged-source receipts apply only to their unchanged commands; the reduced selectors have no new execution result. Historical coverage account (not a current claim for changed sources): Real authenticated sockets plus isolated desktop and headless hosts with desktop and browser viewers; deterministic lifecycle tests cover stale results and reader deadlines. The test-value audit removes the standalone runtime-status-snapshot.test.ts example that immediately applied the same supplied snapshots to two isolated slice stores. Its direct sequence-2 then older unavailable sequence-1 acceptance/rejection alarm is intentionally lost; it did not exercise a pending read, subscription delivery or a shared viewer connection. The suite retains failed-verification/recovery, disconnect/pairing retirement and catalog-refresh replay examples, which are not equivalent replacements. Historical executed commands, counts and results remain unchanged; no new live host, process restart or platform evidence is claimed. Audit1348: src/main/ipc/runtime-environments/runtime-environment-status-recovery.test.ts removed. Startup retry/broadcast counts and passive-before-active bootstrap request count. No equivalent replacement coverage is claimed. Audit1352: focused Linux unit selections validated on source head b638e07d395b76af3ba6b03761a1a0fe7e5e026e. Historical statements above retain their original scope. Intentional test losses are recorded in knownGaps; these runs claim no physical-provider, p95, rendered E2E or cross-platform validation. The current assertion index names unchanged owner lifecycle tests from the successful focused run. They do not replace the deleted startup retry/broadcast count alarms. Audit1360: focused Linux unit selections validated on source head 415c9cffc2d10024131ec4b6721767a22195de6d. Historical statements above retain their original scope. Intentional test losses are recorded in knownGaps; these runs claim no physical-provider, p95, rendered E2E or cross-platform validation. Audit1748 removes7 of13 authored host-status-owner definitions: request/polling counts, reconnect/no-request variants, deadline copy and blocked-reason projections. Lost alarms are intentional; no equivalent replacement coverage is claimed. Existing dated evidenceRuns are historical and unchanged, and do not validate this reduced source or current aggregate selectors. Focused candidate execution, if successful, validates only the retained local fake-request/clock tests, not authenticated sockets, rendered clients or platform parity.", + "coverageNotes": "Audit 3301 removes the failed-verification/recovery/restart generation and host-contact-epoch, hosting and no-toast example from runtime-status-snapshot.test.ts. Earlier prose describing that example as retained is historical. Disconnect/pairing retirement and delayed catalog replay remain unchanged without equivalent replacement. Archive both complete historical 22-case unit receipts because their selector includes the reduced source; preserve the unrelated rendered receipt, current selectors and other-owner assertion references. No fresh aggregate or live host validation is claimed. Linux coverage from those two unit runs is historical; current covered-platform scope is limited to the preserved macOS rendered receipt. Audit1348 changes referenced sources. Retained unchanged-source receipts apply only to their unchanged commands; the reduced selectors have no new execution result. Historical coverage account (not a current claim for changed sources): Real authenticated sockets plus isolated desktop and headless hosts with desktop and browser viewers; deterministic lifecycle tests cover stale results and reader deadlines. The test-value audit removes the standalone runtime-status-snapshot.test.ts example that immediately applied the same supplied snapshots to two isolated slice stores. Its direct sequence-2 then older unavailable sequence-1 acceptance/rejection alarm is intentionally lost; it did not exercise a pending read, subscription delivery or a shared viewer connection. The suite retains failed-verification/recovery, disconnect/pairing retirement and catalog-refresh replay examples, which are not equivalent replacements. Historical executed commands, counts and results remain unchanged; no new live host, process restart or platform evidence is claimed. Audit1348: src/main/ipc/runtime-environments/runtime-environment-status-recovery.test.ts removed. Startup retry/broadcast counts and passive-before-active bootstrap request count. No equivalent replacement coverage is claimed. Audit1352: focused Linux unit selections validated on source head b638e07d395b76af3ba6b03761a1a0fe7e5e026e. Historical statements above retain their original scope. Intentional test losses are recorded in knownGaps; these runs claim no physical-provider, p95, rendered E2E or cross-platform validation. The current assertion index names unchanged owner lifecycle tests from the successful focused run. They do not replace the deleted startup retry/broadcast count alarms. Audit1360: focused Linux unit selections validated on source head 415c9cffc2d10024131ec4b6721767a22195de6d. Historical statements above retain their original scope. Intentional test losses are recorded in knownGaps; these runs claim no physical-provider, p95, rendered E2E or cross-platform validation. Audit1748 removes7 of13 authored host-status-owner definitions: request/polling counts, reconnect/no-request variants, deadline copy and blocked-reason projections. Lost alarms are intentional; no equivalent replacement coverage is claimed. Existing dated evidenceRuns are historical and unchanged, and do not validate this reduced source or current aggregate selectors. Focused candidate execution, if successful, validates only the retained local fake-request/clock tests, not authenticated sockets, rendered clients or platform parity.", "motivatingLinks": ["https://github.com/stablyai/orca/pull/19163"], "invariant": "Failed bootstrap and authenticated reconnect converge without UI triggers; one connection owner publishes verified status, with no independent healthy status polling.", - "oracle": "Retained local cases check independent waiter deadlines/cancellation, failed-operation recovery, stale deferred results, disposal and explicit reconnect after authentication refusal. Historical aggregate receipts predate audit1748 and are not fresh validation of reduced sources.", + "oracle": "Audit 3301 removes the failed-verification/recovery/restart generation and host-contact-epoch, hosting and no-toast example from runtime-status-snapshot.test.ts. Earlier prose describing that example as retained is historical. Disconnect/pairing retirement and delayed catalog replay remain unchanged without equivalent replacement. Archive both complete historical 22-case unit receipts because their selector includes the reduced source; preserve the unrelated rendered receipt, current selectors and other-owner assertion references. No fresh aggregate or live host validation is claimed. Linux coverage from those two unit runs is historical; current covered-platform scope is limited to the preserved macOS rendered receipt. Retained local cases check independent waiter deadlines/cancellation, failed-operation recovery, stale deferred results, disposal and explicit reconnect after authentication refusal. Historical aggregate receipts predate audit1748 and are not fresh validation of reduced sources.", "commands": [ "ORCA_BACKGROUND_LAUNCH=1 pnpm test src/shared/remote-runtime/host-status/runtime-host-status-owner.test.ts src/main/ipc/runtime-environments/runtime-environment-status-connection.test.ts src/renderer/src/store/slices/runtime-status/runtime-status-snapshot.test.ts src/renderer/src/web/web-runtime-status-owner.test.ts", "ORCA_BACKGROUND_LAUNCH=1 ORCA_E2E_WEB_CLIENT=1 pnpm exec playwright test tests/e2e/runtime-host-status-recovery.spec.ts --config tests/playwright.config.ts --project electron-headless --workers=1" @@ -1258,26 +1258,6 @@ "result": "passed", "summary": "Desktop-host and headless-host journeys passed with desktop and browser viewers.", "durationSeconds": 31.3 - }, - { - "date": "2026-11-04", - "runner": "local", - "platform": "linux", - "result": "passed", - "command": "ORCA_BACKGROUND_LAUNCH=1 pnpm --config.verifyDepsBeforeRun=false test src/main/ipc/runtime-environments/runtime-environment-status-connection.test.ts src/renderer/src/store/slices/runtime-status-snapshot.test.ts src/renderer/src/web/web-runtime-status-owner.test.ts src/shared/remote-runtime/host-status/runtime-host-status-owner.test.ts --maxWorkers=2", - "currentCommand": "ORCA_BACKGROUND_LAUNCH=1 pnpm test src/shared/remote-runtime/host-status/runtime-host-status-owner.test.ts src/main/ipc/runtime-environments/runtime-environment-status-connection.test.ts src/renderer/src/store/slices/runtime-status/runtime-status-snapshot.test.ts src/renderer/src/web/web-runtime-status-owner.test.ts", - "durationSeconds": 4.37, - "summary": "Test Files 4 passed (4); Tests 22 passed (22). Focused Linux unit execution; no physical-provider, p95 or cross-platform claim. Source head b638e07d395b76af3ba6b03761a1a0fe7e5e026e." - }, - { - "date": "2026-11-04", - "runner": "local", - "platform": "linux", - "result": "passed", - "command": "ORCA_BACKGROUND_LAUNCH=1 pnpm --config.verifyDepsBeforeRun=false test src/main/ipc/runtime-environments/runtime-environment-status-connection.test.ts src/renderer/src/store/slices/runtime-status-snapshot.test.ts src/renderer/src/web/web-runtime-status-owner.test.ts src/shared/remote-runtime/host-status/runtime-host-status-owner.test.ts --maxWorkers=2", - "currentCommand": "ORCA_BACKGROUND_LAUNCH=1 pnpm test src/shared/remote-runtime/host-status/runtime-host-status-owner.test.ts src/main/ipc/runtime-environments/runtime-environment-status-connection.test.ts src/renderer/src/store/slices/runtime-status/runtime-status-snapshot.test.ts src/renderer/src/web/web-runtime-status-owner.test.ts", - "durationSeconds": 4.52, - "summary": "Test Files 4 passed (4); Tests 22 passed (22). Focused Linux unit execution; no physical-provider, p95 or cross-platform claim. Source head 415c9cffc2d10024131ec4b6721767a22195de6d." } ], "runtimeBudget": { @@ -1305,7 +1285,10 @@ "The test-value audit removes the standalone runtime-status-snapshot.test.ts example that immediately applied the same supplied snapshots to two isolated slice stores. Its direct sequence-2 then older unavailable sequence-1 acceptance/rejection alarm is intentionally lost; it did not exercise a pending read, subscription delivery or a shared viewer connection. The suite retains failed-verification/recovery, disconnect/pairing retirement and catalog-refresh replay examples, which are not equivalent replacements. Historical executed commands, counts and results remain unchanged; no new live host, process restart or platform evidence is claimed.", "Audit1348: src/main/ipc/runtime-environments/runtime-environment-status-recovery.test.ts removed. Startup retry/broadcast counts and passive-before-active bootstrap request count. No equivalent replacement coverage is claimed.", "Audit1348 historical platform/provider scope before source changes: {\"coveredPlatforms\":[\"macos\"],\"coveredProviders\":[\"remote-runtime\"]}. Remaining provider scope applies only to unchanged-source receipts.", - "Audit1348 historical assertion inventory for deleted/reduced sources; not current validated assertions:\n[\n {\n \"file\": \"src/main/ipc/runtime-environments/runtime-environment-status-recovery.test.ts\",\n \"assertions\": [\n \"recovers a saved host after its first status check fails, without another UI request\"\n ]\n }\n]" + "Audit1348 historical assertion inventory for deleted/reduced sources; not current validated assertions:\n[\n {\n \"file\": \"src/main/ipc/runtime-environments/runtime-environment-status-recovery.test.ts\",\n \"assertions\": [\n \"recovers a saved host after its first status check fails, without another UI request\"\n ]\n }\n]", + "Audit 3301 removes the failed-verification/recovery/restart generation and host-contact-epoch, hosting and no-toast example from runtime-status-snapshot.test.ts. Earlier prose describing that example as retained is historical. Disconnect/pairing retirement and delayed catalog replay remain unchanged without equivalent replacement. Archive both complete historical 22-case unit receipts because their selector includes the reduced source; preserve the unrelated rendered receipt, current selectors and other-owner assertion references. No fresh aggregate or live host validation is claimed. Linux coverage from those two unit runs is historical; current covered-platform scope is limited to the preserved macOS rendered receipt.", + "Audit 3301 retires this complete dated unit receipt because runtime-status-snapshot.test.ts was reduced. Its original command, result and counts remain historical and do not validate the reduced selector. Original receipt verbatim:\n{\n \"date\": \"2026-11-04\",\n \"runner\": \"local\",\n \"platform\": \"linux\",\n \"result\": \"passed\",\n \"command\": \"ORCA_BACKGROUND_LAUNCH=1 pnpm --config.verifyDepsBeforeRun=false test src/main/ipc/runtime-environments/runtime-environment-status-connection.test.ts src/renderer/src/store/slices/runtime-status-snapshot.test.ts src/renderer/src/web/web-runtime-status-owner.test.ts src/shared/remote-runtime/host-status/runtime-host-status-owner.test.ts --maxWorkers=2\",\n \"currentCommand\": \"ORCA_BACKGROUND_LAUNCH=1 pnpm test src/shared/remote-runtime/host-status/runtime-host-status-owner.test.ts src/main/ipc/runtime-environments/runtime-environment-status-connection.test.ts src/renderer/src/store/slices/runtime-status/runtime-status-snapshot.test.ts src/renderer/src/web/web-runtime-status-owner.test.ts\",\n \"durationSeconds\": 4.37,\n \"summary\": \"Test Files 4 passed (4); Tests 22 passed (22). Focused Linux unit execution; no physical-provider, p95 or cross-platform claim. Source head b638e07d395b76af3ba6b03761a1a0fe7e5e026e.\"\n }", + "Audit 3301 retires this complete dated unit receipt because runtime-status-snapshot.test.ts was reduced. Its original command, result and counts remain historical and do not validate the reduced selector. Original receipt verbatim:\n{\n \"date\": \"2026-11-04\",\n \"runner\": \"local\",\n \"platform\": \"linux\",\n \"result\": \"passed\",\n \"command\": \"ORCA_BACKGROUND_LAUNCH=1 pnpm --config.verifyDepsBeforeRun=false test src/main/ipc/runtime-environments/runtime-environment-status-connection.test.ts src/renderer/src/store/slices/runtime-status-snapshot.test.ts src/renderer/src/web/web-runtime-status-owner.test.ts src/shared/remote-runtime/host-status/runtime-host-status-owner.test.ts --maxWorkers=2\",\n \"currentCommand\": \"ORCA_BACKGROUND_LAUNCH=1 pnpm test src/shared/remote-runtime/host-status/runtime-host-status-owner.test.ts src/main/ipc/runtime-environments/runtime-environment-status-connection.test.ts src/renderer/src/store/slices/runtime-status/runtime-status-snapshot.test.ts src/renderer/src/web/web-runtime-status-owner.test.ts\",\n \"durationSeconds\": 4.52,\n \"summary\": \"Test Files 4 passed (4); Tests 22 passed (22). Focused Linux unit execution; no physical-provider, p95 or cross-platform claim. Source head 415c9cffc2d10024131ec4b6721767a22195de6d.\"\n }" ], "demotionRule": "Keep experimental until repeated runs establish reliability; preserve request-count and lifecycle assertions." }, @@ -2349,13 +2332,13 @@ "providers": ["local", "ssh", "remote-runtime"], "coveredPlatforms": ["macos"], "coveredProviders": [], - "coverageNotes": "Audit 3273 removes 14 authored declarations and 19 expanded scenarios across four whole suites and eight partial suites. Retired alarms cover saved-local cancellation/layout ownership, ambiguous-owner warning reset, folder attachment routing, VM false-capability bypass, abandoned reveal warmup cleanup and viewport claim deduplication/rearming, quiet unrelated remote-removal refusal, startup-command one-shot consumption, repository/floating recovery-ledger rows, fake-React pinned-scroll intent, split-ratio state identity/subscriber suppression and fractional change, cross-host project-group join refusal, three PR request-lifetime permutations, upstream-status preservation on error, and unresolved Git-owner refusal. These regression checks are intentionally lost under the test-value audit; retained scenarios are not equivalent replacements. Historical coverage receipts remain historical, including gate35 subscriber claims. Audit2729 reduces browser-page-palette-activation.test.ts: separate SSH/paired-runtime alias forwarding, distinct multigroup views accepted, and remote-folder activation forwarding alarms are removed. Collision refusal, preactivation address-bar focus capture, owning-group activation state and missing-tab refusal remain byte-identical. No equivalent replacement, fresh gate execution or actual host/browser delivery evidence is claimed. Prior coverage account: Audit2697 browser source review (metadata followup2702): Reduce src/renderer/src/lib/browser/palette/browser-palette-page-entries.test.ts by four authored/expanded cases without replacement. The remaining three cases preserve only their existing same-ID execution-host separation, absent stamped-owner refusal and ambiguous legacy-bucket refusal scope. Intentionally lose duplicate backing-tab-ID suppression, multiple unified-browser claims of one workspace, foreign-worktree unified-tab rejection, and the 1000-workspace output/internal getter-read budget alarm. These are real removed alarms; the retained host cases are not equivalent replacements. Current test-value policy rejects internal getter/read budgets; no replacement performance or measured-cost claim is made. Keep existing nonempty selectors and the retained same-ID browser assertionRef. No fresh gate execution or reduced-source validation is supplied; dated receipts, results, commands and historical coverage accounts remain within their original source scope. No live browser activation, physical provider, mixed-version execution, mobile, native UI, platform hardware, soak or timing result is added. Prior coverage account (preserved verbatim): Audit2266 reduces cmd-j-host-qualified-candidate-ownership.test.ts to the scoped open-tab hidden same-ID legacy ambiguity refusal. Separate browser/simulator paired-runtime alias and current-row projections, generic workspace host projection and hostless explicit-owner refusal examples are removed without equivalent replacement. No fresh gate execution, browser activation, physical host, simulator or remote delivery evidence is claimed. Historical dated receipts and budgets remain raw-byte exact. Prior coverage account: Audit1899 replays sealed Audit1895: workspace-session-schema.test.ts keeps only cross-workspace truncated-tab salvage and legacy browser-history cap normalization. Four current commands and testFiles retain that reduced source; no current assertionRef or active receipt selects it. SSH file-owner, isolated browser partition, launch/title/quick-command fields, recency, structured-chat/view-mode and remote browser identity hydration alarms are intentionally lost. Existing retired receipt strings and unrelated active receipts remain verbatim. No equivalent replacement, new Cmd-J gate execution, native simulator or remote/browser restore proof is claimed. Historical coverage account before Audit1899: Audit1494 removes use-open-tab-search.test.ts. Supplied host/worktree/title/ranking projections, simple subscription updates and result-array identity alarms are retired. No actual activation or navigation occurred in that suite. No equivalent replacement coverage or fresh Cmd-J gate validation is claimed. Historical receipts remain scoped to their original selectors. Audit1433 narrows worktree-checks-review-index.test.ts to same-ID local/SSH object-key review isolation. Local provider/cache lookup, GitLab preference, suppression/legacy fallback, explicit-PR authority, physical-versus-runtime review isolation, and branchless-workspace alarms are intentionally removed. No equivalent replacement coverage is claimed. Historical receipts and commands remain unchanged and do not certify the reduced source. Historical coverage account: Audit1396 changes referenced sources. Retained unchanged-source receipts apply only to their unchanged commands; the reduced selectors have no new execution result. Historical coverage account (not a current claim for changed sources): Audit1308 changes referenced sources. Retained unchanged-source receipts apply only to their unchanged commands; the reduced selectors have no new execution result. Historical coverage account (not a current claim for changed sources): Deterministic candidate-builder contracts inject local and paired-runtime worktrees with the same bare id into the real aggregated tab buckets, including folder workspaces and a paired runtime transporting an SSH-owned worktree. A mirror contract preserves distinct same-id runtime tabs. A paired Electron journey verifies both visible browser rows and both visible simulator rows, then requires each selection to render its owning active tab and update backing host-qualified state. The test-value audit narrowed simulator-palette-search.test.ts to the recency tie, same-id host isolation, ambiguous legacy host rejection and oversized-input getter tripwire. Supplied timestamp, empty-query context ordering, host projection, alias/range, metadata matching, active-tab score, over-token/whitespace and malformed display-name fallback examples were removed. Their separate alarms are lost; retained candidate and activation contracts do not establish equivalent coverage. Historical run commands and results remain historical. The audit also removed the standalone workspace-tab-palette-search suite: supplied row, title, metadata, alias, range, ranking and ownership examples no longer provide their separate alarms. Other retained contracts are not replacement coverage. The mirror-identity fixture now retains same-id sibling-runtime isolation and the repeated-frame subscriber tripwire only. Supplied field, owner, alias and mapping examples are removed; their separate alarms are lost. The retained sibling-runtime case is not equivalent coverage for them. The test-value audit removed tabs-open-close-lifecycle host-stamping examples and ordinary tab/group operations from tabs-pane-layout-operations. Local-null, explicit-runtime and SSH-without-active-host stamp assertions are lost; retained mobile/MRU and subscriber/atomic split cases do not replace them. Candidate and live Cmd-J evidence retains its own scope. Historical commands, outcomes and narratives remain historical. Audit1308: src/renderer/src/lib/browser-palette-search.test.ts removed. Browser-palette token and pasted-query size-guard work alarms disappear. No equivalent replacement coverage is claimed. Audit1386: src/renderer/src/lib/open-mobile-emulator-tab.test.ts reduced. Duplicate attach count and null-tab creation retry/guard reset standalone alarms removed; no simulator device used. No equivalent replacement coverage is claimed. Existing exact unaffected receipts and their platform/provider/budget claims remain scoped to unchanged selectors. Changed optional selectors have no new execution result. Audit1396: src/renderer/src/lib/simulator-palette-search.test.ts reduced. Lose simulator-specific lastFocusedAt tie-order alarm; identity/routing and pre-scan size fence remain. No native simulator or real remote launch claim. No equivalent replacement coverage is claimed. Audit1402: src/renderer/src/runtime/web-session-tabs-sync-mirror-identity.test.ts reduced. Loses repeated no-op frame store-notification budget; independent cross-runtime resource preservation remains. No equivalent replacement coverage is claimed. Existing exact unaffected receipts remain unchanged and apply only to their unchanged selectors. Changed optional selectors have no new execution result.", + "coverageNotes": "Audit 3301 removes the orphaned mobile file-close fallback and ordinary cross-content MRU examples from tabs-open-close-lifecycle.test.ts. Earlier descriptions of retained MRU coverage are historical. The integrated mobile markdown close/frame-settlement case remains unchanged and is narrower. Preserve the existing administrative failed receipt and all complete retired receipts verbatim, along with selectors and unrelated assertions; no equivalent replacement or fresh Cmd-J, native or remote result is claimed. Audit 3273 removes 14 authored declarations and 19 expanded scenarios across four whole suites and eight partial suites. Retired alarms cover saved-local cancellation/layout ownership, ambiguous-owner warning reset, folder attachment routing, VM false-capability bypass, abandoned reveal warmup cleanup and viewport claim deduplication/rearming, quiet unrelated remote-removal refusal, startup-command one-shot consumption, repository/floating recovery-ledger rows, fake-React pinned-scroll intent, split-ratio state identity/subscriber suppression and fractional change, cross-host project-group join refusal, three PR request-lifetime permutations, upstream-status preservation on error, and unresolved Git-owner refusal. These regression checks are intentionally lost under the test-value audit; retained scenarios are not equivalent replacements. Historical coverage receipts remain historical, including gate35 subscriber claims. Audit2729 reduces browser-page-palette-activation.test.ts: separate SSH/paired-runtime alias forwarding, distinct multigroup views accepted, and remote-folder activation forwarding alarms are removed. Collision refusal, preactivation address-bar focus capture, owning-group activation state and missing-tab refusal remain byte-identical. No equivalent replacement, fresh gate execution or actual host/browser delivery evidence is claimed. Prior coverage account: Audit2697 browser source review (metadata followup2702): Reduce src/renderer/src/lib/browser/palette/browser-palette-page-entries.test.ts by four authored/expanded cases without replacement. The remaining three cases preserve only their existing same-ID execution-host separation, absent stamped-owner refusal and ambiguous legacy-bucket refusal scope. Intentionally lose duplicate backing-tab-ID suppression, multiple unified-browser claims of one workspace, foreign-worktree unified-tab rejection, and the 1000-workspace output/internal getter-read budget alarm. These are real removed alarms; the retained host cases are not equivalent replacements. Current test-value policy rejects internal getter/read budgets; no replacement performance or measured-cost claim is made. Keep existing nonempty selectors and the retained same-ID browser assertionRef. No fresh gate execution or reduced-source validation is supplied; dated receipts, results, commands and historical coverage accounts remain within their original source scope. No live browser activation, physical provider, mixed-version execution, mobile, native UI, platform hardware, soak or timing result is added. Prior coverage account (preserved verbatim): Audit2266 reduces cmd-j-host-qualified-candidate-ownership.test.ts to the scoped open-tab hidden same-ID legacy ambiguity refusal. Separate browser/simulator paired-runtime alias and current-row projections, generic workspace host projection and hostless explicit-owner refusal examples are removed without equivalent replacement. No fresh gate execution, browser activation, physical host, simulator or remote delivery evidence is claimed. Historical dated receipts and budgets remain raw-byte exact. Prior coverage account: Audit1899 replays sealed Audit1895: workspace-session-schema.test.ts keeps only cross-workspace truncated-tab salvage and legacy browser-history cap normalization. Four current commands and testFiles retain that reduced source; no current assertionRef or active receipt selects it. SSH file-owner, isolated browser partition, launch/title/quick-command fields, recency, structured-chat/view-mode and remote browser identity hydration alarms are intentionally lost. Existing retired receipt strings and unrelated active receipts remain verbatim. No equivalent replacement, new Cmd-J gate execution, native simulator or remote/browser restore proof is claimed. Historical coverage account before Audit1899: Audit1494 removes use-open-tab-search.test.ts. Supplied host/worktree/title/ranking projections, simple subscription updates and result-array identity alarms are retired. No actual activation or navigation occurred in that suite. No equivalent replacement coverage or fresh Cmd-J gate validation is claimed. Historical receipts remain scoped to their original selectors. Audit1433 narrows worktree-checks-review-index.test.ts to same-ID local/SSH object-key review isolation. Local provider/cache lookup, GitLab preference, suppression/legacy fallback, explicit-PR authority, physical-versus-runtime review isolation, and branchless-workspace alarms are intentionally removed. No equivalent replacement coverage is claimed. Historical receipts and commands remain unchanged and do not certify the reduced source. Historical coverage account: Audit1396 changes referenced sources. Retained unchanged-source receipts apply only to their unchanged commands; the reduced selectors have no new execution result. Historical coverage account (not a current claim for changed sources): Audit1308 changes referenced sources. Retained unchanged-source receipts apply only to their unchanged commands; the reduced selectors have no new execution result. Historical coverage account (not a current claim for changed sources): Deterministic candidate-builder contracts inject local and paired-runtime worktrees with the same bare id into the real aggregated tab buckets, including folder workspaces and a paired runtime transporting an SSH-owned worktree. A mirror contract preserves distinct same-id runtime tabs. A paired Electron journey verifies both visible browser rows and both visible simulator rows, then requires each selection to render its owning active tab and update backing host-qualified state. The test-value audit narrowed simulator-palette-search.test.ts to the recency tie, same-id host isolation, ambiguous legacy host rejection and oversized-input getter tripwire. Supplied timestamp, empty-query context ordering, host projection, alias/range, metadata matching, active-tab score, over-token/whitespace and malformed display-name fallback examples were removed. Their separate alarms are lost; retained candidate and activation contracts do not establish equivalent coverage. Historical run commands and results remain historical. The audit also removed the standalone workspace-tab-palette-search suite: supplied row, title, metadata, alias, range, ranking and ownership examples no longer provide their separate alarms. Other retained contracts are not replacement coverage. The mirror-identity fixture now retains same-id sibling-runtime isolation and the repeated-frame subscriber tripwire only. Supplied field, owner, alias and mapping examples are removed; their separate alarms are lost. The retained sibling-runtime case is not equivalent coverage for them. The test-value audit removed tabs-open-close-lifecycle host-stamping examples and ordinary tab/group operations from tabs-pane-layout-operations. Local-null, explicit-runtime and SSH-without-active-host stamp assertions are lost; retained mobile/MRU and subscriber/atomic split cases do not replace them. Candidate and live Cmd-J evidence retains its own scope. Historical commands, outcomes and narratives remain historical. Audit1308: src/renderer/src/lib/browser-palette-search.test.ts removed. Browser-palette token and pasted-query size-guard work alarms disappear. No equivalent replacement coverage is claimed. Audit1386: src/renderer/src/lib/open-mobile-emulator-tab.test.ts reduced. Duplicate attach count and null-tab creation retry/guard reset standalone alarms removed; no simulator device used. No equivalent replacement coverage is claimed. Existing exact unaffected receipts and their platform/provider/budget claims remain scoped to unchanged selectors. Changed optional selectors have no new execution result. Audit1396: src/renderer/src/lib/simulator-palette-search.test.ts reduced. Lose simulator-specific lastFocusedAt tie-order alarm; identity/routing and pre-scan size fence remain. No native simulator or real remote launch claim. No equivalent replacement coverage is claimed. Audit1402: src/renderer/src/runtime/web-session-tabs-sync-mirror-identity.test.ts reduced. Loses repeated no-op frame store-notification budget; independent cross-runtime resource preservation remains. No equivalent replacement coverage is claimed. Existing exact unaffected receipts remain unchanged and apply only to their unchanged selectors. Changed optional selectors have no new execution result.", "motivatingLinks": [ "https://linear.app/stably/issue/STA-4965", "https://github.com/stablyai/orca/pull/15371" ], "invariant": "Candidate identity is the tuple of execution-host identity and worktree identity: same-id sibling hosts retain separate correct browser, simulator, and workspace tabs, each tab appears exactly once, and selection activates its owning host.", - "oracle": "Audit 3273 removes 14 authored declarations and 19 expanded scenarios across four whole suites and eight partial suites. Retired alarms cover saved-local cancellation/layout ownership, ambiguous-owner warning reset, folder attachment routing, VM false-capability bypass, abandoned reveal warmup cleanup and viewport claim deduplication/rearming, quiet unrelated remote-removal refusal, startup-command one-shot consumption, repository/floating recovery-ledger rows, fake-React pinned-scroll intent, split-ratio state identity/subscriber suppression and fractional change, cross-host project-group join refusal, three PR request-lifetime permutations, upstream-status preservation on error, and unresolved Git-owner refusal. These regression checks are intentionally lost under the test-value audit; retained scenarios are not equivalent replacements. Historical coverage receipts remain historical, including gate35 subscriber claims. Audit2697 browser source review (metadata followup2702): Reduce src/renderer/src/lib/browser/palette/browser-palette-page-entries.test.ts by four authored/expanded cases without replacement. The remaining three cases preserve only their existing same-ID execution-host separation, absent stamped-owner refusal and ambiguous legacy-bucket refusal scope. Intentionally lose duplicate backing-tab-ID suppression, multiple unified-browser claims of one workspace, foreign-worktree unified-tab rejection, and the 1000-workspace output/internal getter-read budget alarm. These are real removed alarms; the retained host cases are not equivalent replacements. Current test-value policy rejects internal getter/read budgets; no replacement performance or measured-cost claim is made. Keep existing nonempty selectors and the retained same-ID browser assertionRef. No fresh gate execution or reduced-source validation is supplied; dated receipts, results, commands and historical coverage accounts remain within their original source scope. No live browser activation, physical provider, mixed-version execution, mobile, native UI, platform hardware, soak or timing result is added. Prior coverage account (preserved verbatim): Audit2266 current retained source checks only that scoped open-tab search rejects hostless legacy browser, simulator and workspace tabs when a hidden same-ID sibling host remains in the ownership catalog. Reduced selectors require fresh validation; existing historical receipts do not validate the changed source. Prior oracle account: Existing exact unchanged-selector receipts remain the only current execution evidence. Changed source selectors have no fresh execution result. Historical prior-source oracle account: The retained unchanged-source receipts are the only current execution evidence; reduced-source assertions await validation. Historical oracle account (not a current claim for changed sources): Existing exact unchanged-selector receipts remain the only current execution evidence. Changed source selectors have no fresh execution result. Historical prior-source oracle account: The retained unchanged-source receipts are the only current execution evidence; reduced-source assertions await validation. Historical oracle account (not a current claim for changed sources): Aggregate two hosts' tabs under one intentionally colliding worktree id, stamp each unified tab with its execution host, and require exactly one candidate per owner. Repeat with an SSH physical owner transported by a paired-runtime alias. Independently require each browser and simulator Cmd-J selection to update activeWorkspaceExecutionHostId plus its owning workspace/group and render the selected tab active. Ambiguous legacy tabs without ownership fail closed.", + "oracle": "Audit 3301 removes the orphaned mobile file-close fallback and ordinary cross-content MRU examples from tabs-open-close-lifecycle.test.ts. Earlier descriptions of retained MRU coverage are historical. The integrated mobile markdown close/frame-settlement case remains unchanged and is narrower. Preserve the existing administrative failed receipt and all complete retired receipts verbatim, along with selectors and unrelated assertions; no equivalent replacement or fresh Cmd-J, native or remote result is claimed. Audit 3273 removes 14 authored declarations and 19 expanded scenarios across four whole suites and eight partial suites. Retired alarms cover saved-local cancellation/layout ownership, ambiguous-owner warning reset, folder attachment routing, VM false-capability bypass, abandoned reveal warmup cleanup and viewport claim deduplication/rearming, quiet unrelated remote-removal refusal, startup-command one-shot consumption, repository/floating recovery-ledger rows, fake-React pinned-scroll intent, split-ratio state identity/subscriber suppression and fractional change, cross-host project-group join refusal, three PR request-lifetime permutations, upstream-status preservation on error, and unresolved Git-owner refusal. These regression checks are intentionally lost under the test-value audit; retained scenarios are not equivalent replacements. Historical coverage receipts remain historical, including gate35 subscriber claims. Audit2697 browser source review (metadata followup2702): Reduce src/renderer/src/lib/browser/palette/browser-palette-page-entries.test.ts by four authored/expanded cases without replacement. The remaining three cases preserve only their existing same-ID execution-host separation, absent stamped-owner refusal and ambiguous legacy-bucket refusal scope. Intentionally lose duplicate backing-tab-ID suppression, multiple unified-browser claims of one workspace, foreign-worktree unified-tab rejection, and the 1000-workspace output/internal getter-read budget alarm. These are real removed alarms; the retained host cases are not equivalent replacements. Current test-value policy rejects internal getter/read budgets; no replacement performance or measured-cost claim is made. Keep existing nonempty selectors and the retained same-ID browser assertionRef. No fresh gate execution or reduced-source validation is supplied; dated receipts, results, commands and historical coverage accounts remain within their original source scope. No live browser activation, physical provider, mixed-version execution, mobile, native UI, platform hardware, soak or timing result is added. Prior coverage account (preserved verbatim): Audit2266 current retained source checks only that scoped open-tab search rejects hostless legacy browser, simulator and workspace tabs when a hidden same-ID sibling host remains in the ownership catalog. Reduced selectors require fresh validation; existing historical receipts do not validate the changed source. Prior oracle account: Existing exact unchanged-selector receipts remain the only current execution evidence. Changed source selectors have no fresh execution result. Historical prior-source oracle account: The retained unchanged-source receipts are the only current execution evidence; reduced-source assertions await validation. Historical oracle account (not a current claim for changed sources): Existing exact unchanged-selector receipts remain the only current execution evidence. Changed source selectors have no fresh execution result. Historical prior-source oracle account: The retained unchanged-source receipts are the only current execution evidence; reduced-source assertions await validation. Historical oracle account (not a current claim for changed sources): Aggregate two hosts' tabs under one intentionally colliding worktree id, stamp each unified tab with its execution host, and require exactly one candidate per owner. Repeat with an SSH physical owner transported by a paired-runtime alias. Independently require each browser and simulator Cmd-J selection to update activeWorkspaceExecutionHostId plus its owning workspace/group and render the selected tab active. Ambiguous legacy tabs without ownership fail closed.", "commands": [ "pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/components/cmd-j/worktree-checks-review-index.test.ts", "pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/components/worktree-jump/WorktreeJumpPalette.test.tsx", @@ -2565,7 +2548,8 @@ "Audit1494 removes use-open-tab-search.test.ts. Supplied host/worktree/title/ranking projections, simple subscription updates and result-array identity alarms are retired. No actual activation or navigation occurred in that suite. No equivalent replacement coverage or fresh Cmd-J gate validation is claimed. Historical receipts remain scoped to their original selectors.", "Audit1899 replays sealed Audit1895: workspace-session-schema.test.ts keeps only cross-workspace truncated-tab salvage and legacy browser-history cap normalization. Four current commands and testFiles retain that reduced source; no current assertionRef or active receipt selects it. SSH file-owner, isolated browser partition, launch/title/quick-command fields, recency, structured-chat/view-mode and remote browser identity hydration alarms are intentionally lost. Existing retired receipt strings and unrelated active receipts remain verbatim. No equivalent replacement, new Cmd-J gate execution, native simulator or remote/browser restore proof is claimed.", "Audit2192 retires the removed physical-SSH repository badge assertion from WorktreeJumpPalette.test.tsx and its exact historical failed oracle receipt. Current reduced test selectors and unrelated unit/E2E receipts remain; none was rerun by this source audit and equivalent coverage is not claimed. Original obsolete assertion object verbatim:\n{\n \"file\": \"src/renderer/src/components/worktree-jump/WorktreeJumpPalette.test.tsx\",\n \"assertions\": [\n \"a runtime-owned worktree row never renders repository metadata borrowed from its physical SSH host\"\n ]\n }\nOriginal dated failed receipt object verbatim:\n{\n \"date\": \"2026-08-20\",\n \"runner\": \"local\",\n \"platform\": \"macos\",\n \"command\": \"pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/components/WorktreeJumpPalette.test.tsx\",\n \"currentCommand\": \"pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/components/worktree-jump/WorktreeJumpPalette.test.tsx\",\n \"result\": \"failed\",\n \"durationSeconds\": 5.1,\n \"summary\": \"With the component's physical-host prelookup restored, the rendered palette oracle failed 1/12: the runtime-owned row displayed the physical SSH repository badge.\"\n }", - "Audit 3273 removes 14 authored declarations and 19 expanded scenarios across four whole suites and eight partial suites. Retired alarms cover saved-local cancellation/layout ownership, ambiguous-owner warning reset, folder attachment routing, VM false-capability bypass, abandoned reveal warmup cleanup and viewport claim deduplication/rearming, quiet unrelated remote-removal refusal, startup-command one-shot consumption, repository/floating recovery-ledger rows, fake-React pinned-scroll intent, split-ratio state identity/subscriber suppression and fractional change, cross-host project-group join refusal, three PR request-lifetime permutations, upstream-status preservation on error, and unresolved Git-owner refusal. These regression checks are intentionally lost under the test-value audit; retained scenarios are not equivalent replacements. Historical coverage receipts remain historical, including gate35 subscriber claims." + "Audit 3273 removes 14 authored declarations and 19 expanded scenarios across four whole suites and eight partial suites. Retired alarms cover saved-local cancellation/layout ownership, ambiguous-owner warning reset, folder attachment routing, VM false-capability bypass, abandoned reveal warmup cleanup and viewport claim deduplication/rearming, quiet unrelated remote-removal refusal, startup-command one-shot consumption, repository/floating recovery-ledger rows, fake-React pinned-scroll intent, split-ratio state identity/subscriber suppression and fractional change, cross-host project-group join refusal, three PR request-lifetime permutations, upstream-status preservation on error, and unresolved Git-owner refusal. These regression checks are intentionally lost under the test-value audit; retained scenarios are not equivalent replacements. Historical coverage receipts remain historical, including gate35 subscriber claims.", + "Audit 3301 removes the orphaned mobile file-close fallback and ordinary cross-content MRU examples from tabs-open-close-lifecycle.test.ts. Earlier descriptions of retained MRU coverage are historical. The integrated mobile markdown close/frame-settlement case remains unchanged and is narrower. Preserve the existing administrative failed receipt and all complete retired receipts verbatim, along with selectors and unrelated assertions; no equivalent replacement or fresh Cmd-J, native or remote result is claimed." ], "demotionRule": "Cannot promote if a same-id sibling tab duplicates, disappears, activates another host, or if ambiguous unstamped ownership is guessed." }, @@ -4202,10 +4186,10 @@ "providers": ["remote-runtime"], "coveredPlatforms": ["macos"], "coveredProviders": ["remote-runtime"], - "coverageNotes": "Audit 3292 combines adopted 3285/3287/3289/3293 removals: 40 authored declarations and 47 expanded scenarios, including whole frame-editor-view, ambiguous remote-delete-refusal, unverifiable-host subscription and editor-close cleanup suites. The previously reviewed dock-badge suite was already removed upstream in PR 40895 and receives zero new removal credit. Intentionally retired alarms include background browser selection and last-tab landing; main startup fallback, SSH project cleanup/survivor routing, exact-PR contradiction/saved-push positives, replay/sidecar rollback and wrapped remote error normalization; records/snapshot missing-diff hydration, ambiguous folder-owner delete refusal, focus no-op notifications, nested editor context-only cache check, pending broadcast-first status and ordinary four-confirmation aggregation; preview-source frontmatter pruning, approved local/runtime agent dispatch, non-GitHub legacy PR cache invalidation, stale merged-head transient-error fallback, empty-queue immediate query reply and unverified-to-concrete preflight risk. Additional intentionally retired alarms are injected host subscription/unsubscribe counts, synthetic editor reveal/draft/fallback/scoped close, ambiguous unread refusals and hidden mark/read roundtrip, immediate connect backoff/noError, positive mirrored evidence-clock renewal, supplied VM failure/success projections and git-local/folder-SSH wake permutations. Remaining temporal/ownership cases are narrower; no equivalent replacement or fresh execution is claimed. Audit 3283 removes 20 authored declarations and 31 expanded scenarios, including two whole suites. Retired alarms cover PR refresh-state pruning, shared runtime subscription cleanup and store isolation, language content-change routing and older completion ownership, ordinary panel retry-timer cleanup and pending loading, four hosted-review lifetime permutations, mocked terminal creation error/order wiring, five sleep-inventory variants with pending-frame-only assertions, palette fallback/composite highlights, Windows/UNC encoded-editor input rows, mixed-repository partial failure counts, title setters and generated-title bypass/replacement, five window-close coordinator delegation/guard/finally branches, and ambiguous-old-record frame reveal. These regression checks are intentionally lost under the test-value audit; retained cases are not equivalent replacements. Prior coverage notes and receipts remain historical. Audit 3273 removes 14 authored declarations and 19 expanded scenarios across four whole suites and eight partial suites. Retired alarms cover saved-local cancellation/layout ownership, ambiguous-owner warning reset, folder attachment routing, VM false-capability bypass, abandoned reveal warmup cleanup and viewport claim deduplication/rearming, quiet unrelated remote-removal refusal, startup-command one-shot consumption, repository/floating recovery-ledger rows, fake-React pinned-scroll intent, split-ratio state identity/subscriber suppression and fractional change, cross-host project-group join refusal, three PR request-lifetime permutations, upstream-status preservation on error, and unresolved Git-owner refusal. These regression checks are intentionally lost under the test-value audit; retained scenarios are not equivalent replacements. Historical coverage receipts remain historical, including gate35 subscriber claims. Audit 3256 removes these specific alarms from the broad root unit commands: skill dialog active-share selection, close and pending-share handoff; simple keyed-record deletion; marker live-region insertion, simple landing and nine baseline policy examples; General search/control navigation inventory; orphan-count cache bootstrap; seven Codex code classifications and HTTP 429 warning mapping; two skill unread-root verdict examples; peer-mail payload and conversation-ID rejection; and the GitHub organization TABLE text-field optimistic rollback/failed-envelope example. These include real behaviors; retained tests do not provide equivalent coverage for every removed scenario. Mobile losses are recorded separately and are not coverage of these root commands. Audit3246 retires NewRowsMarker reveal/no-repeat and pane-scoped beforeinput checks; skill-owner option availability/count/dedup/order; six styled Input/Textarea IME forwarding rows; the static Codex/OpenCode smart-key inventory; tab-map AST ratchet diagnostic fixtures; child-roster work-budget and retained-aggregate alarms; malformed persisted floating-cwd fallback/no-crash/empty exact-root checks; the unanswered-host empty-list discriminator; the direct invalidated-cache commit-false assertion; one redundant digit-keyup IME row; cached non-supported Claude title-generator rows; and the duplicate late naming-result singleton. These root broad commands lose those specific alarms without equivalent replacement. Distinct retained owner/state checks have their own bounded claims; the real scheduler still rejects stale response data, while the direct false-return alarm is retired. Audit3231 retires supported-host restore-pane key mapping, closed/open creation-sidebar toggle visibility, unrelated scope-error/null classification and quick-submit reveal/no-create checks. These broad commands lose those real narrow alarms; no replacement coverage is claimed. Audit3219 removes the synthetic Cmd+J extra-source suite; this broad command no longer checks its match/tie placement and selection, announced count, empty-query cap, or workspace hiding with retained recent tabs. No replacement coverage is claimed. Audit3209 composes approved sources3202/3206: deliberately retires seven authored/expanded cases in four whole suites without equivalent replacement. Work-item queries lose real GitHub/GitLab oversized ASCII secret-prefix empty-query and whitespace-before-trim refusal alarms; inputs share the imported size bound and exercise only its fast length branch, with no multibyte or actual provider/exposure guarantee. Skill sharing loses complete/partial managed-bundle and destination-ambiguity association checks plus three negative origin/path/scheme admission examples; these do not establish uploaded contents, arbitrary-URL fetching, authorization or execution. Retain exact originless-project direct-link fallback, cloud-delete confirmation, bundled-target repair/owner isolation and explicit Windows-host preference over stale WSL suites. Rejected3201 runtime-preference removal is excluded. No real cloud/network/host/disk, mobile or mixed-version execution validation is claimed. Audit3200 composes approved source3194: deliberately retires thirteen authored registrations/twenty-seven expanded cases in six whole automation host/list policy suites without equivalent replacement. Real RPC category/retryability and wrapped-timeout recognition, unscoped-failure/scoped-success health evidence precedence, exact-ID create selectors and per-run workspace omission, paired-web local/SSH/absent host catalog routing, incompatible/removed/unhydrated/offline execution health, runtime-before-nested-SSH recovery dispatch, and no-owned-focus/successor/foreign-list focus policy alarms are consciously lost. Retain exact20line orphan allow/refuse/precondition and exact90line cross-host same-ID search suites. No retry-timer/fence lifecycle, actual reconnect/network/write delivery, native focus, mobile/mixed-version runtime or disk persistence coverage is claimed. Audit3191 combines approved source3182/3187/3188: deliberately retires thirteen authored Vitest registrations and fifteen expanded cases, including five whole suites, without equivalent replacement. Attachment intake loses real portal/native-capture terminal interception and unowned-container refusal, immediate child-only committed availability/claim-ref negotiation and delivery, and direct-target over stable focused/background composer routing through disable/re-enable/remount and independent question focus. Exact destination/cache/draft and final-stat owner/workspace/File-release suites remain; they do not replace Surface recipient routing. Automation authoring loses destination runtime catalog membership, local/direct-SSH exclusion of paired-runtime repos, unknown-runtime empty catalog, logical project/host/setup/repo/path context payload, and missing/nonready setup refusal; these were genuine direct helper alarms, while exact schedule transformation, legacy schedule and setup-decision suites remain. Agent picker loses setup-chat/terminal/missing-installer/unsupported-or-unknown-host row projection samples and the ordinary unsearched menu variant; the entire original26-line resume recipe suite remains, including reported bypass versus default/absent permission modes, as does the exact search-result menu callback with its fixtures, model/effort commits and staged Arguments reopen outcome. Rejected predecessor3180 full recipe deletion is excluded. No actual native drag/cursor/focus/IME, upload bytes or disk/restart persistence, full automation save/scheduler/runtime transport, real resume-process flags/environment delivery, or native menu/rendered layout validation is claimed. Audit3178 combines source3169/3170/3175: deliberately retires eight authored units (six Vitest cases and two imperative custom relay scenarios), including two whole suites, without equivalent replacement. Voice Section loses per-model pending-delete isolation across interleaved A/B completion and the two-success refresh-call alarm; exact VoicePane delayed key-clear/newer enabled-toggle merge remains and does not replace row deletion coverage. Speech loses dedicated rating-scale/inclusive-ceiling, unsupported-versus-unmeasured, explicit/system-language precedence/locale alias, accuracy versus fast named/default/best-measured selection, and unmeasured/no-match examples; exact offered-user-pick versus retired-selection case and its fixture remain. Relay loses legacy ping-delivery count/liveness sampled before the silence deadline and grouped malformed Bearer/host-ID 401/429 routing checks; twelve real Worker/DurableObject/shipped-client scenarios remain, not equivalent replacement for those narrow alarms. Six prior speech cases are not all deleted: approved successor3175 keeps the original user-choice case. No actual credential/file persistence, native/GPU/engine/download delivery, production assignment policy or deployed-runtime validation is claimed by this reduction. Audit3165 combines source3160/3162: deliberately retires six authored/expanded cases across three whole suites without equivalent replacement. Launch/status losses: observed React-render pending/resuming coordination across settings and deferred offer read; stale-offer reread suppressing dialog reopen; held-local-chat recovery visibility with new-chat preferences off; disabled-local admission avoiding offer RPC despite an injected but unconsumed paired-tab fixture; and run-only lost-reply uncertainty reachability until direct viewed-run retirement. Launch probe does not prove arbitrary synchronous-store atomicity, the paired fixture is not remote runtime enrollment, and the status case directly marks viewed state rather than rendering the summary. Crew-hook losses: old-host method_not_found cache persists across party changes but is released by independently supplied connection generation/verified pairing status or pairing revision, with actual frame publication and teardown. These are real narrow coordination, admission, uncertainty and mixed-version cache alarms consciously lost. Exact web verified-runtime writer handoff guard remains; it does not replace those alarms or prove live host/native/mobile delivery. Audit3156 combines3147/3150/3152/3153/3154: deliberately retires39authored/40expanded native-chat recovery cases, eight whole suites and two orphan test-support files without equivalent replacement. Lost alarms: lost-reply unconfirmed reconciliation, skipped rows/counts and missed-frame repair, unknown/pending outcome and omitted-failure-list compatibility, uncertain history after dismissal, retry/refusal/dismiss lifecycle, hidden/consumed picker ownership, result-tree keyboard focus/disclosure and all-skipped retirement; unconfirmed-over-conflict guidance and failed-chat changes despite older host timestamps; nearest-listed ancestor/cyclic forest shape, descendant membership, host ordering/missing-host local fallback; skipped/readiness/admission counts, provisional skip/progress monotonicity, early per-chat verdicts with batch pending protection, older-host waiting, start-slot/delivery distinction, retry-over-failure and unknown-after-withdrawal attention; remote snooze/reconnect/reoffer, unseen mixed summary through open/close, watched completion retirement, new success beside old failure, failed-reread mixed-result preservation, filter/collapse completion resets, retry summary replacement and current-offer/history selection; cross-host workspace identity, rendered cyclic reachability, nested tri-state/toggle propagation, project eligibility isolation and collapse preserving selection. Exact fallback-list completion barrier, batched verdict/cleanup retention, stale-read versus dismissal publication race, and requested-but-never-rendered finished-run retirement remain; they do not replace retired alarms. Audit3146 combines source reviews3132/3133/3135/3138/3143: intentionally retire20authored/31expanded cases without equivalent replacement. Provider-session losses: structured-native terminal-resume exclusion, metadata-less completed identity, new-turn completion clearing, Pi provider-only/periodic/manual promotion, changed-transcript launch-config isolation, Pi/omp/prime-agent completed-session remote/manual-shutdown promotion, and quit/done precedence over heartbeat. Side-thread/question losses: finished-pane acquisition, hidden title/recap states, local/relay/relay-done conversation takeover with prompt/session/child resets, plain-message abandonment, compaction/session replacement and completion resets. Codex startup losses: incoming-owner cached child replacement, old-relay foreign live-session correction, completed foreign-root turn-fact permutations. Transcript losses: real temporary-JSONL partial sibling/final-child completion, unlabelled child attribution, compact cached replay preservation and100/1000completed-child roster retention/release. Compiler-ratchet losses: valid-line uncompiled-list parser grammar examples and injected-existence stale-path filtering; these did not exercise actual filesystem canonicalization or build exclusion. These are real lifecycle, ownership, replay, liveness and retention alarms, including recent#40246 regressions, deliberately lost. Retained conditional record replacement, clockless root/SSH owner isolation, persisted main-thread fork rejection, partial/final question-answer lifetime, cached-roster/missing-ID/live HTTP/durable startup boundaries and restarted-relay refusal/acceptance do not replace those losses. No native/SSH/WSL execution or equivalent coverage is claimed. Audit3128 scoped coverage reduction: Audit3121 removes VoiceDictationLanguageSetting.test.tsx (Spanish-to-es callback and unsupported-model Korean option presence) and voice-speech-model-rows.test.ts (provider/language-order/retired-on-disk list policy); these real narrow alarms are deliberately retired without replacement. VoiceSpeechModelSection per-model concurrent deletion remains unchanged. Audit3122 removes the direct absolute/parent-segment sparse-directory exception-type sample and the five-row IPC sparse-preset error-code/non-save table (two authored/six expanded cases). Those real typed-validation and IPC refusal/error-code alarms are deliberately retired. Keep both real symlink/junction floating-directory trust cases and the minimal RPC structured validation-reason serialization case. The RPC case does not replace IPC save/refusal behavior, typed normalization for both path inputs, actual Git sparse checkout or rendered localization. No equivalent replacement or fresh test/runtime/platform/remote/performance validation is claimed. Audit3124 removes ExperimentalPane.test.tsx (ordinary Pet switch callback), WorkspaceDirectorySetting.test.tsx (padded absolute saved-path normalization/no-write blur), and repository-search.perf.test.ts (navigation/selected-pane builder-call policy, fixture cardinality/nonempty entries and renamed project keyword inclusion). These real narrow alarms are retired without replacement; RepositoryPane.search.test.tsx search-to-sparse-editor request remains unchanged. Audit3129: resolver Windows case-insensitive and POSIX case-sensitive configured-env composition plus mocked-base launch-preflight Windows composition are intentionally no longer checked by the two deleted suites. No equivalent coverage claimed. Keep runtime-structured-agent-host-env.test.ts unchanged: configured Windows Claude-home account identity and host-account precedence remain checked. Audit3114 incorporates source3101: retire three structured Claude child-environment wrapper cases covering inherited stamp isolation/default and explicit entrypoint, Windows SDK-key canonicalization/default/duplicate-key order, and configured lookup/final environment/config-dir conjunction. Keep direct auth/session sanitation and Windows-versus-Linux overlay checks, actual executable lookup from supplied inherited PATH, native Windows child environment delivery, and stale option-mutation fencing. These are not equivalent replacements for the retired wrapper alarms. No fresh test/runtime, real login-shell probe, Claude SDK startup, remote/mixed-version, UI or performance result is claimed. Audit3114 incorporates source3105: retire 17 authored/20 expanded daemon launch-note cases, including the entire two-case SessionLaunchNote suite. Deliberately lose split-marker carry across same-token re-arm, stale-token retirement refusal, foreground tri-state and serial settlement, omitted-note/no-incarnation mixed-version policy, sticky retirement, first-incarnation/replacement launch preservation and held-launch precedence. Keep only the unchanged unresolved foreground-read race against a later finished attach. Supplied notes/foreground and runtime calls do not establish actual daemon/main restart, SSH, native Windows observation, mobile UI, equivalent replacement or fresh runtime/performance validation. Audit3114 incorporates source3109: retire six authored/35 expanded pricing cases: 21 accepted model-name examples, 10 unsupported/future-model fail-closed examples, malformed TTL clamp, unknown-model estimate refusal, flat-model long-context disregard and oversized long-context clamp. Keep mixed five-minute/one-hour write allocation and short/all-long/mixed long-context allocation with original fixed oracles. Real parser/refusal/bounds alarms are knowingly lost without equivalent replacement; retained tests do not validate provider rates, actual billing or request threshold classification. Preserve the archived usage-scan-append source-freeze receipt without transferring historical execution/performance credit. No fresh runtime result is claimed. Audit3108 source-only reduction (3094/3095/3100): retire 27 authored/30 expanded cases, including complete markdown view-state, file-preview link-open and CLI agent-server-route suites, without replacement. Deliberate losses include preview visibility/reference lifetime and same-path owners; SSH stat, directory/missing-target, explicit-null owner, nonmarkdown line/column, local URI routing, remote-to-client guard and same-file reuse; document-preview source-owner/folder/reuse routing, stable grant location and outside-workspace POSIX/Windows request projection; and verified remote CLI send/check refusal, suggested --on argv/copy, shell no-probe bypass, unverified-launch admission and older-peer refusal. Retain two markdown source-runtime/qualified-reveal alarms, one stale grant-rejection fence and two remote read/mutation evidence policies, with original callbacks. Final last-wins reveal did not prove transient cancellation; CLI prerequisite did not prove no real send, and envelope tests do not execute server refusal. No fresh runtime, rendered UI, actual file/SSH/paired transport, authorization, mixed-version or performance result is claimed. Audit3096 source-only reduction (3087/3088): retire 69 authored/76 expanded cases, including complete recovery-portals and reconnect-banner suites. Intentionally lose dead/default TUI replay, generated alternate-frame style composition, reset/mode/dimension and legacy missing-mode-boundary alarms, UI notice/action/reveal policies, and isolated recovery lifecycle variants, without equivalent replacement. Retained registrations and callbacks are unchanged; headless cells are not pixels, and no fresh runtime, host, SSH, WSL, rendered-app or performance result is claimed. Audit3086 source-only reduction (3079/3080/3081): intentionally retire 93 authored/100 expanded mock-boundary cases, including the complete spawn-errors and SSH reconnect overlay suites, without replacement. Retired alarms include spawn classification/ownership, reply ceilings and renderer-write failure recovery, disconnect/detach fencing branches, authority facts, and overlay retry/visibility wiring. Retained callbacks are unchanged; no fresh execution, real PTY/SSH, rendered UI, or performance result is claimed. Audit2432: The broad unit command loses the isolated BranchPicker open-change notification sample. Its unique true/false callback alarm is intentionally retired; reopening/status-refresh behavior was not exercised. No equivalent replacement or fresh validation of the reduced selector is claimed. Audit2425: The broad unit command loses the workspace-copy-status supplied readError forwarding sample. It did not exercise the branch-switch blocking promised by its title. This alarm is intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2417: The broad unit command loses two ordinary clean Git cherry-pick/revert success samples and two terminal startup foreground-read work-budget samples. These unique alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2412: The broad unit command loses the whole six-case fake-React-hook scroll-anchor suite, two generic draft-retention samples, a simple new-agent order sample, a real history-publication batching-count sample, an unmounted handoff abort/timer sample and three basic WSL preview/error samples. These alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2404: The broad unit command loses the standalone share-name lookup 503 propagation suite, initial deletion placement-kind sample, direct changed-mtime stale sample, first-pass rollback existence example and abandoned-preparation directory sample. These exact alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2397 review amendment: The broad unit command loses three standalone suites, two partial-case definitions and two URL table rows across package/download/placement tests. Keep initial wrong-port authorization, modified independent-copy digest refusal and abort-after-begin cancellation dispatch. The remaining alarms are deliberately retired; no equivalent complete replacement or fresh validation of the reduced selector is claimed. Audit2393 current-parent refresh2401: Remove the basic skill-install service alias sample and original public managed-remove receiptless refusal case. Preserve the upstream request ownership suite and transaction interruption coverage. No equivalent complete replacement or fresh validation of the reduced selector is claimed. Audit2389: The broad unit command loses the missing-preview suite, plain-global destination sample and prepublished-receipt recovery example. No equivalent replacement or fresh validation of the reduced selector is claimed. Audit2385: The broad unit command loses four authored walker/staging/protocol examples (six expanded cases); no equivalent replacement or fresh validation is claimed for the reduced suite. Audit2383: The unscoped Vitest command no longer includes the removed Antigravity catalogue suite; its exact provider-root/owner example has no equivalent replacement or fresh validation claim. Audit2377/2381: The unscoped Vitest command includes the reduced bundled-skill and native-discovery suites; the eight removed backup/legacy/catalogue/symlink/SSH-builder examples have no replacement-equivalence or fresh validation claim here. Audit2133 current-parent preparation: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2095 current-parent preparation2126: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit1640 removes low-value IPC, SSH, workspace and transcript-watcher tests without equivalent replacement coverage. Per-source reviews record retained public refusal, cancellation, execution-host and real-filesystem outcomes with injected/native/remote limits. Affected historical receipts are retired; gates without active current evidence are downgraded. Historical scope before this audit: Deterministic main-IPC contract tests cover disconnect-driven close delivery, exactly-once close, per-subscription teardown isolation against a failing socket close and a throwing liveness probe, containment of a throwing renderer send on the unguarded host-close path, and continued suppression of stale payloads from a retired transport. A headed paired-server journey (real Orca host plus a separate paired Orca desktop client) covers hidden-but-mounted reveal, cold-parked reveal, and cold-parked reveal across a disconnect/reconnect. Live Linux and Windows paired-server evidence and real sleep/wake transport loss remain uncollected.", + "coverageNotes": "Audit 3301 combines adopted source batches 3296 and 3299: retire 27 authored declarations and 36 expanded scenarios, including six whole suites. Intentionally lost alarms cover failed-verification/recovery/restart counters and mocked hosting/toast; early overlapping pane-read scheduling/count; unreadable removal listing draft guard; bulk-purge remote-qualified and raw-local guard maps; initial-snapshot blank/mode/oversize/printable/fresh-spawn callback and replay examples; fallback mobile file close and ordinary MRU; default queue overload/drain; seeded browser-page reuse and supplied missing-page URL recreation; ambiguous sleep/hibernation owner refusal and untouched bindings/origins; ordinary selection/activity/fallback priority; skip-remote success and retained hints; supplied structured-chat unsent retention and scoped removal draft eviction; caller-chat focus precedence; open/draft PR cache eviction and merged-head fallback result inventories. Retained adverse-ordering and ownership cases are narrower and do not establish equivalent replacements. No fresh runtime, native, physical provider, cross-platform, mobile or mixed-version evidence is claimed. Audit 3292 combines adopted 3285/3287/3289/3293 removals: 40 authored declarations and 47 expanded scenarios, including whole frame-editor-view, ambiguous remote-delete-refusal, unverifiable-host subscription and editor-close cleanup suites. The previously reviewed dock-badge suite was already removed upstream in PR 40895 and receives zero new removal credit. Intentionally retired alarms include background browser selection and last-tab landing; main startup fallback, SSH project cleanup/survivor routing, exact-PR contradiction/saved-push positives, replay/sidecar rollback and wrapped remote error normalization; records/snapshot missing-diff hydration, ambiguous folder-owner delete refusal, focus no-op notifications, nested editor context-only cache check, pending broadcast-first status and ordinary four-confirmation aggregation; preview-source frontmatter pruning, approved local/runtime agent dispatch, non-GitHub legacy PR cache invalidation, stale merged-head transient-error fallback, empty-queue immediate query reply and unverified-to-concrete preflight risk. Additional intentionally retired alarms are injected host subscription/unsubscribe counts, synthetic editor reveal/draft/fallback/scoped close, ambiguous unread refusals and hidden mark/read roundtrip, immediate connect backoff/noError, positive mirrored evidence-clock renewal, supplied VM failure/success projections and git-local/folder-SSH wake permutations. Remaining temporal/ownership cases are narrower; no equivalent replacement or fresh execution is claimed. Audit 3283 removes 20 authored declarations and 31 expanded scenarios, including two whole suites. Retired alarms cover PR refresh-state pruning, shared runtime subscription cleanup and store isolation, language content-change routing and older completion ownership, ordinary panel retry-timer cleanup and pending loading, four hosted-review lifetime permutations, mocked terminal creation error/order wiring, five sleep-inventory variants with pending-frame-only assertions, palette fallback/composite highlights, Windows/UNC encoded-editor input rows, mixed-repository partial failure counts, title setters and generated-title bypass/replacement, five window-close coordinator delegation/guard/finally branches, and ambiguous-old-record frame reveal. These regression checks are intentionally lost under the test-value audit; retained cases are not equivalent replacements. Prior coverage notes and receipts remain historical. Audit 3273 removes 14 authored declarations and 19 expanded scenarios across four whole suites and eight partial suites. Retired alarms cover saved-local cancellation/layout ownership, ambiguous-owner warning reset, folder attachment routing, VM false-capability bypass, abandoned reveal warmup cleanup and viewport claim deduplication/rearming, quiet unrelated remote-removal refusal, startup-command one-shot consumption, repository/floating recovery-ledger rows, fake-React pinned-scroll intent, split-ratio state identity/subscriber suppression and fractional change, cross-host project-group join refusal, three PR request-lifetime permutations, upstream-status preservation on error, and unresolved Git-owner refusal. These regression checks are intentionally lost under the test-value audit; retained scenarios are not equivalent replacements. Historical coverage receipts remain historical, including gate35 subscriber claims. Audit 3256 removes these specific alarms from the broad root unit commands: skill dialog active-share selection, close and pending-share handoff; simple keyed-record deletion; marker live-region insertion, simple landing and nine baseline policy examples; General search/control navigation inventory; orphan-count cache bootstrap; seven Codex code classifications and HTTP 429 warning mapping; two skill unread-root verdict examples; peer-mail payload and conversation-ID rejection; and the GitHub organization TABLE text-field optimistic rollback/failed-envelope example. These include real behaviors; retained tests do not provide equivalent coverage for every removed scenario. Mobile losses are recorded separately and are not coverage of these root commands. Audit3246 retires NewRowsMarker reveal/no-repeat and pane-scoped beforeinput checks; skill-owner option availability/count/dedup/order; six styled Input/Textarea IME forwarding rows; the static Codex/OpenCode smart-key inventory; tab-map AST ratchet diagnostic fixtures; child-roster work-budget and retained-aggregate alarms; malformed persisted floating-cwd fallback/no-crash/empty exact-root checks; the unanswered-host empty-list discriminator; the direct invalidated-cache commit-false assertion; one redundant digit-keyup IME row; cached non-supported Claude title-generator rows; and the duplicate late naming-result singleton. These root broad commands lose those specific alarms without equivalent replacement. Distinct retained owner/state checks have their own bounded claims; the real scheduler still rejects stale response data, while the direct false-return alarm is retired. Audit3231 retires supported-host restore-pane key mapping, closed/open creation-sidebar toggle visibility, unrelated scope-error/null classification and quick-submit reveal/no-create checks. These broad commands lose those real narrow alarms; no replacement coverage is claimed. Audit3219 removes the synthetic Cmd+J extra-source suite; this broad command no longer checks its match/tie placement and selection, announced count, empty-query cap, or workspace hiding with retained recent tabs. No replacement coverage is claimed. Audit3209 composes approved sources3202/3206: deliberately retires seven authored/expanded cases in four whole suites without equivalent replacement. Work-item queries lose real GitHub/GitLab oversized ASCII secret-prefix empty-query and whitespace-before-trim refusal alarms; inputs share the imported size bound and exercise only its fast length branch, with no multibyte or actual provider/exposure guarantee. Skill sharing loses complete/partial managed-bundle and destination-ambiguity association checks plus three negative origin/path/scheme admission examples; these do not establish uploaded contents, arbitrary-URL fetching, authorization or execution. Retain exact originless-project direct-link fallback, cloud-delete confirmation, bundled-target repair/owner isolation and explicit Windows-host preference over stale WSL suites. Rejected3201 runtime-preference removal is excluded. No real cloud/network/host/disk, mobile or mixed-version execution validation is claimed. Audit3200 composes approved source3194: deliberately retires thirteen authored registrations/twenty-seven expanded cases in six whole automation host/list policy suites without equivalent replacement. Real RPC category/retryability and wrapped-timeout recognition, unscoped-failure/scoped-success health evidence precedence, exact-ID create selectors and per-run workspace omission, paired-web local/SSH/absent host catalog routing, incompatible/removed/unhydrated/offline execution health, runtime-before-nested-SSH recovery dispatch, and no-owned-focus/successor/foreign-list focus policy alarms are consciously lost. Retain exact20line orphan allow/refuse/precondition and exact90line cross-host same-ID search suites. No retry-timer/fence lifecycle, actual reconnect/network/write delivery, native focus, mobile/mixed-version runtime or disk persistence coverage is claimed. Audit3191 combines approved source3182/3187/3188: deliberately retires thirteen authored Vitest registrations and fifteen expanded cases, including five whole suites, without equivalent replacement. Attachment intake loses real portal/native-capture terminal interception and unowned-container refusal, immediate child-only committed availability/claim-ref negotiation and delivery, and direct-target over stable focused/background composer routing through disable/re-enable/remount and independent question focus. Exact destination/cache/draft and final-stat owner/workspace/File-release suites remain; they do not replace Surface recipient routing. Automation authoring loses destination runtime catalog membership, local/direct-SSH exclusion of paired-runtime repos, unknown-runtime empty catalog, logical project/host/setup/repo/path context payload, and missing/nonready setup refusal; these were genuine direct helper alarms, while exact schedule transformation, legacy schedule and setup-decision suites remain. Agent picker loses setup-chat/terminal/missing-installer/unsupported-or-unknown-host row projection samples and the ordinary unsearched menu variant; the entire original26-line resume recipe suite remains, including reported bypass versus default/absent permission modes, as does the exact search-result menu callback with its fixtures, model/effort commits and staged Arguments reopen outcome. Rejected predecessor3180 full recipe deletion is excluded. No actual native drag/cursor/focus/IME, upload bytes or disk/restart persistence, full automation save/scheduler/runtime transport, real resume-process flags/environment delivery, or native menu/rendered layout validation is claimed. Audit3178 combines source3169/3170/3175: deliberately retires eight authored units (six Vitest cases and two imperative custom relay scenarios), including two whole suites, without equivalent replacement. Voice Section loses per-model pending-delete isolation across interleaved A/B completion and the two-success refresh-call alarm; exact VoicePane delayed key-clear/newer enabled-toggle merge remains and does not replace row deletion coverage. Speech loses dedicated rating-scale/inclusive-ceiling, unsupported-versus-unmeasured, explicit/system-language precedence/locale alias, accuracy versus fast named/default/best-measured selection, and unmeasured/no-match examples; exact offered-user-pick versus retired-selection case and its fixture remain. Relay loses legacy ping-delivery count/liveness sampled before the silence deadline and grouped malformed Bearer/host-ID 401/429 routing checks; twelve real Worker/DurableObject/shipped-client scenarios remain, not equivalent replacement for those narrow alarms. Six prior speech cases are not all deleted: approved successor3175 keeps the original user-choice case. No actual credential/file persistence, native/GPU/engine/download delivery, production assignment policy or deployed-runtime validation is claimed by this reduction. Audit3165 combines source3160/3162: deliberately retires six authored/expanded cases across three whole suites without equivalent replacement. Launch/status losses: observed React-render pending/resuming coordination across settings and deferred offer read; stale-offer reread suppressing dialog reopen; held-local-chat recovery visibility with new-chat preferences off; disabled-local admission avoiding offer RPC despite an injected but unconsumed paired-tab fixture; and run-only lost-reply uncertainty reachability until direct viewed-run retirement. Launch probe does not prove arbitrary synchronous-store atomicity, the paired fixture is not remote runtime enrollment, and the status case directly marks viewed state rather than rendering the summary. Crew-hook losses: old-host method_not_found cache persists across party changes but is released by independently supplied connection generation/verified pairing status or pairing revision, with actual frame publication and teardown. These are real narrow coordination, admission, uncertainty and mixed-version cache alarms consciously lost. Exact web verified-runtime writer handoff guard remains; it does not replace those alarms or prove live host/native/mobile delivery. Audit3156 combines3147/3150/3152/3153/3154: deliberately retires39authored/40expanded native-chat recovery cases, eight whole suites and two orphan test-support files without equivalent replacement. Lost alarms: lost-reply unconfirmed reconciliation, skipped rows/counts and missed-frame repair, unknown/pending outcome and omitted-failure-list compatibility, uncertain history after dismissal, retry/refusal/dismiss lifecycle, hidden/consumed picker ownership, result-tree keyboard focus/disclosure and all-skipped retirement; unconfirmed-over-conflict guidance and failed-chat changes despite older host timestamps; nearest-listed ancestor/cyclic forest shape, descendant membership, host ordering/missing-host local fallback; skipped/readiness/admission counts, provisional skip/progress monotonicity, early per-chat verdicts with batch pending protection, older-host waiting, start-slot/delivery distinction, retry-over-failure and unknown-after-withdrawal attention; remote snooze/reconnect/reoffer, unseen mixed summary through open/close, watched completion retirement, new success beside old failure, failed-reread mixed-result preservation, filter/collapse completion resets, retry summary replacement and current-offer/history selection; cross-host workspace identity, rendered cyclic reachability, nested tri-state/toggle propagation, project eligibility isolation and collapse preserving selection. Exact fallback-list completion barrier, batched verdict/cleanup retention, stale-read versus dismissal publication race, and requested-but-never-rendered finished-run retirement remain; they do not replace retired alarms. Audit3146 combines source reviews3132/3133/3135/3138/3143: intentionally retire20authored/31expanded cases without equivalent replacement. Provider-session losses: structured-native terminal-resume exclusion, metadata-less completed identity, new-turn completion clearing, Pi provider-only/periodic/manual promotion, changed-transcript launch-config isolation, Pi/omp/prime-agent completed-session remote/manual-shutdown promotion, and quit/done precedence over heartbeat. Side-thread/question losses: finished-pane acquisition, hidden title/recap states, local/relay/relay-done conversation takeover with prompt/session/child resets, plain-message abandonment, compaction/session replacement and completion resets. Codex startup losses: incoming-owner cached child replacement, old-relay foreign live-session correction, completed foreign-root turn-fact permutations. Transcript losses: real temporary-JSONL partial sibling/final-child completion, unlabelled child attribution, compact cached replay preservation and100/1000completed-child roster retention/release. Compiler-ratchet losses: valid-line uncompiled-list parser grammar examples and injected-existence stale-path filtering; these did not exercise actual filesystem canonicalization or build exclusion. These are real lifecycle, ownership, replay, liveness and retention alarms, including recent#40246 regressions, deliberately lost. Retained conditional record replacement, clockless root/SSH owner isolation, persisted main-thread fork rejection, partial/final question-answer lifetime, cached-roster/missing-ID/live HTTP/durable startup boundaries and restarted-relay refusal/acceptance do not replace those losses. No native/SSH/WSL execution or equivalent coverage is claimed. Audit3128 scoped coverage reduction: Audit3121 removes VoiceDictationLanguageSetting.test.tsx (Spanish-to-es callback and unsupported-model Korean option presence) and voice-speech-model-rows.test.ts (provider/language-order/retired-on-disk list policy); these real narrow alarms are deliberately retired without replacement. VoiceSpeechModelSection per-model concurrent deletion remains unchanged. Audit3122 removes the direct absolute/parent-segment sparse-directory exception-type sample and the five-row IPC sparse-preset error-code/non-save table (two authored/six expanded cases). Those real typed-validation and IPC refusal/error-code alarms are deliberately retired. Keep both real symlink/junction floating-directory trust cases and the minimal RPC structured validation-reason serialization case. The RPC case does not replace IPC save/refusal behavior, typed normalization for both path inputs, actual Git sparse checkout or rendered localization. No equivalent replacement or fresh test/runtime/platform/remote/performance validation is claimed. Audit3124 removes ExperimentalPane.test.tsx (ordinary Pet switch callback), WorkspaceDirectorySetting.test.tsx (padded absolute saved-path normalization/no-write blur), and repository-search.perf.test.ts (navigation/selected-pane builder-call policy, fixture cardinality/nonempty entries and renamed project keyword inclusion). These real narrow alarms are retired without replacement; RepositoryPane.search.test.tsx search-to-sparse-editor request remains unchanged. Audit3129: resolver Windows case-insensitive and POSIX case-sensitive configured-env composition plus mocked-base launch-preflight Windows composition are intentionally no longer checked by the two deleted suites. No equivalent coverage claimed. Keep runtime-structured-agent-host-env.test.ts unchanged: configured Windows Claude-home account identity and host-account precedence remain checked. Audit3114 incorporates source3101: retire three structured Claude child-environment wrapper cases covering inherited stamp isolation/default and explicit entrypoint, Windows SDK-key canonicalization/default/duplicate-key order, and configured lookup/final environment/config-dir conjunction. Keep direct auth/session sanitation and Windows-versus-Linux overlay checks, actual executable lookup from supplied inherited PATH, native Windows child environment delivery, and stale option-mutation fencing. These are not equivalent replacements for the retired wrapper alarms. No fresh test/runtime, real login-shell probe, Claude SDK startup, remote/mixed-version, UI or performance result is claimed. Audit3114 incorporates source3105: retire 17 authored/20 expanded daemon launch-note cases, including the entire two-case SessionLaunchNote suite. Deliberately lose split-marker carry across same-token re-arm, stale-token retirement refusal, foreground tri-state and serial settlement, omitted-note/no-incarnation mixed-version policy, sticky retirement, first-incarnation/replacement launch preservation and held-launch precedence. Keep only the unchanged unresolved foreground-read race against a later finished attach. Supplied notes/foreground and runtime calls do not establish actual daemon/main restart, SSH, native Windows observation, mobile UI, equivalent replacement or fresh runtime/performance validation. Audit3114 incorporates source3109: retire six authored/35 expanded pricing cases: 21 accepted model-name examples, 10 unsupported/future-model fail-closed examples, malformed TTL clamp, unknown-model estimate refusal, flat-model long-context disregard and oversized long-context clamp. Keep mixed five-minute/one-hour write allocation and short/all-long/mixed long-context allocation with original fixed oracles. Real parser/refusal/bounds alarms are knowingly lost without equivalent replacement; retained tests do not validate provider rates, actual billing or request threshold classification. Preserve the archived usage-scan-append source-freeze receipt without transferring historical execution/performance credit. No fresh runtime result is claimed. Audit3108 source-only reduction (3094/3095/3100): retire 27 authored/30 expanded cases, including complete markdown view-state, file-preview link-open and CLI agent-server-route suites, without replacement. Deliberate losses include preview visibility/reference lifetime and same-path owners; SSH stat, directory/missing-target, explicit-null owner, nonmarkdown line/column, local URI routing, remote-to-client guard and same-file reuse; document-preview source-owner/folder/reuse routing, stable grant location and outside-workspace POSIX/Windows request projection; and verified remote CLI send/check refusal, suggested --on argv/copy, shell no-probe bypass, unverified-launch admission and older-peer refusal. Retain two markdown source-runtime/qualified-reveal alarms, one stale grant-rejection fence and two remote read/mutation evidence policies, with original callbacks. Final last-wins reveal did not prove transient cancellation; CLI prerequisite did not prove no real send, and envelope tests do not execute server refusal. No fresh runtime, rendered UI, actual file/SSH/paired transport, authorization, mixed-version or performance result is claimed. Audit3096 source-only reduction (3087/3088): retire 69 authored/76 expanded cases, including complete recovery-portals and reconnect-banner suites. Intentionally lose dead/default TUI replay, generated alternate-frame style composition, reset/mode/dimension and legacy missing-mode-boundary alarms, UI notice/action/reveal policies, and isolated recovery lifecycle variants, without equivalent replacement. Retained registrations and callbacks are unchanged; headless cells are not pixels, and no fresh runtime, host, SSH, WSL, rendered-app or performance result is claimed. Audit3086 source-only reduction (3079/3080/3081): intentionally retire 93 authored/100 expanded mock-boundary cases, including the complete spawn-errors and SSH reconnect overlay suites, without replacement. Retired alarms include spawn classification/ownership, reply ceilings and renderer-write failure recovery, disconnect/detach fencing branches, authority facts, and overlay retry/visibility wiring. Retained callbacks are unchanged; no fresh execution, real PTY/SSH, rendered UI, or performance result is claimed. Audit2432: The broad unit command loses the isolated BranchPicker open-change notification sample. Its unique true/false callback alarm is intentionally retired; reopening/status-refresh behavior was not exercised. No equivalent replacement or fresh validation of the reduced selector is claimed. Audit2425: The broad unit command loses the workspace-copy-status supplied readError forwarding sample. It did not exercise the branch-switch blocking promised by its title. This alarm is intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2417: The broad unit command loses two ordinary clean Git cherry-pick/revert success samples and two terminal startup foreground-read work-budget samples. These unique alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2412: The broad unit command loses the whole six-case fake-React-hook scroll-anchor suite, two generic draft-retention samples, a simple new-agent order sample, a real history-publication batching-count sample, an unmounted handoff abort/timer sample and three basic WSL preview/error samples. These alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2404: The broad unit command loses the standalone share-name lookup 503 propagation suite, initial deletion placement-kind sample, direct changed-mtime stale sample, first-pass rollback existence example and abandoned-preparation directory sample. These exact alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2397 review amendment: The broad unit command loses three standalone suites, two partial-case definitions and two URL table rows across package/download/placement tests. Keep initial wrong-port authorization, modified independent-copy digest refusal and abort-after-begin cancellation dispatch. The remaining alarms are deliberately retired; no equivalent complete replacement or fresh validation of the reduced selector is claimed. Audit2393 current-parent refresh2401: Remove the basic skill-install service alias sample and original public managed-remove receiptless refusal case. Preserve the upstream request ownership suite and transaction interruption coverage. No equivalent complete replacement or fresh validation of the reduced selector is claimed. Audit2389: The broad unit command loses the missing-preview suite, plain-global destination sample and prepublished-receipt recovery example. No equivalent replacement or fresh validation of the reduced selector is claimed. Audit2385: The broad unit command loses four authored walker/staging/protocol examples (six expanded cases); no equivalent replacement or fresh validation is claimed for the reduced suite. Audit2383: The unscoped Vitest command no longer includes the removed Antigravity catalogue suite; its exact provider-root/owner example has no equivalent replacement or fresh validation claim. Audit2377/2381: The unscoped Vitest command includes the reduced bundled-skill and native-discovery suites; the eight removed backup/legacy/catalogue/symlink/SSH-builder examples have no replacement-equivalence or fresh validation claim here. Audit2133 current-parent preparation: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2095 current-parent preparation2126: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit1640 removes low-value IPC, SSH, workspace and transcript-watcher tests without equivalent replacement coverage. Per-source reviews record retained public refusal, cancellation, execution-host and real-filesystem outcomes with injected/native/remote limits. Affected historical receipts are retired; gates without active current evidence are downgraded. Historical scope before this audit: Deterministic main-IPC contract tests cover disconnect-driven close delivery, exactly-once close, per-subscription teardown isolation against a failing socket close and a throwing liveness probe, containment of a throwing renderer send on the unguarded host-close path, and continued suppression of stale payloads from a retired transport. A headed paired-server journey (real Orca host plus a separate paired Orca desktop client) covers hidden-but-mounted reveal, cold-parked reveal, and cold-parked reveal across a disconnect/reconnect. Live Linux and Windows paired-server evidence and real sleep/wake transport loss remain uncollected.", "motivatingLinks": ["tests/e2e/paired-remote-terminal-parked-reveal-interactivity.spec.ts"], "invariant": "Every renderer-held runtime subscription receives exactly one terminal close event when its transport is retired, including when the retirement advanced the transport generation first, and a single failing teardown never abandons that environment's remaining subscriptions nor escapes into the transport that reported the close. Payload frames from a retired transport stay suppressed. A revealed remote terminal therefore reattaches over a live multiplex connection: its buffer restores, typed input reaches the host PTY, the echo paints without a tab flip, and the PTY converges on the revealed pane grid.", - "oracle": "Audit 3292 combines adopted 3285/3287/3289/3293 removals: 40 authored declarations and 47 expanded scenarios, including whole frame-editor-view, ambiguous remote-delete-refusal, unverifiable-host subscription and editor-close cleanup suites. The previously reviewed dock-badge suite was already removed upstream in PR 40895 and receives zero new removal credit. Intentionally retired alarms include background browser selection and last-tab landing; main startup fallback, SSH project cleanup/survivor routing, exact-PR contradiction/saved-push positives, replay/sidecar rollback and wrapped remote error normalization; records/snapshot missing-diff hydration, ambiguous folder-owner delete refusal, focus no-op notifications, nested editor context-only cache check, pending broadcast-first status and ordinary four-confirmation aggregation; preview-source frontmatter pruning, approved local/runtime agent dispatch, non-GitHub legacy PR cache invalidation, stale merged-head transient-error fallback, empty-queue immediate query reply and unverified-to-concrete preflight risk. Additional intentionally retired alarms are injected host subscription/unsubscribe counts, synthetic editor reveal/draft/fallback/scoped close, ambiguous unread refusals and hidden mark/read roundtrip, immediate connect backoff/noError, positive mirrored evidence-clock renewal, supplied VM failure/success projections and git-local/folder-SSH wake permutations. Remaining temporal/ownership cases are narrower; no equivalent replacement or fresh execution is claimed. Audit 3283 removes 20 authored declarations and 31 expanded scenarios, including two whole suites. Retired alarms cover PR refresh-state pruning, shared runtime subscription cleanup and store isolation, language content-change routing and older completion ownership, ordinary panel retry-timer cleanup and pending loading, four hosted-review lifetime permutations, mocked terminal creation error/order wiring, five sleep-inventory variants with pending-frame-only assertions, palette fallback/composite highlights, Windows/UNC encoded-editor input rows, mixed-repository partial failure counts, title setters and generated-title bypass/replacement, five window-close coordinator delegation/guard/finally branches, and ambiguous-old-record frame reveal. These regression checks are intentionally lost under the test-value audit; retained cases are not equivalent replacements. Prior coverage notes and receipts remain historical. Audit 3273 removes 14 authored declarations and 19 expanded scenarios across four whole suites and eight partial suites. Retired alarms cover saved-local cancellation/layout ownership, ambiguous-owner warning reset, folder attachment routing, VM false-capability bypass, abandoned reveal warmup cleanup and viewport claim deduplication/rearming, quiet unrelated remote-removal refusal, startup-command one-shot consumption, repository/floating recovery-ledger rows, fake-React pinned-scroll intent, split-ratio state identity/subscriber suppression and fractional change, cross-host project-group join refusal, three PR request-lifetime permutations, upstream-status preservation on error, and unresolved Git-owner refusal. These regression checks are intentionally lost under the test-value audit; retained scenarios are not equivalent replacements. Historical coverage receipts remain historical, including gate35 subscriber claims. Audit 3256 removes these specific alarms from the broad root unit commands: skill dialog active-share selection, close and pending-share handoff; simple keyed-record deletion; marker live-region insertion, simple landing and nine baseline policy examples; General search/control navigation inventory; orphan-count cache bootstrap; seven Codex code classifications and HTTP 429 warning mapping; two skill unread-root verdict examples; peer-mail payload and conversation-ID rejection; and the GitHub organization TABLE text-field optimistic rollback/failed-envelope example. These include real behaviors; retained tests do not provide equivalent coverage for every removed scenario. Mobile losses are recorded separately and are not coverage of these root commands. Audit3246 retires NewRowsMarker reveal/no-repeat and pane-scoped beforeinput checks; skill-owner option availability/count/dedup/order; six styled Input/Textarea IME forwarding rows; the static Codex/OpenCode smart-key inventory; tab-map AST ratchet diagnostic fixtures; child-roster work-budget and retained-aggregate alarms; malformed persisted floating-cwd fallback/no-crash/empty exact-root checks; the unanswered-host empty-list discriminator; the direct invalidated-cache commit-false assertion; one redundant digit-keyup IME row; cached non-supported Claude title-generator rows; and the duplicate late naming-result singleton. These root broad commands lose those specific alarms without equivalent replacement. Distinct retained owner/state checks have their own bounded claims; the real scheduler still rejects stale response data, while the direct false-return alarm is retired. Audit3231 retires supported-host restore-pane key mapping, closed/open creation-sidebar toggle visibility, unrelated scope-error/null classification and quick-submit reveal/no-create checks. These broad commands lose those real narrow alarms; no replacement coverage is claimed. Audit3219 removes the synthetic Cmd+J extra-source suite; this broad command no longer checks its match/tie placement and selection, announced count, empty-query cap, or workspace hiding with retained recent tabs. No replacement coverage is claimed. Audit3209 composes approved sources3202/3206: deliberately retires seven authored/expanded cases in four whole suites without equivalent replacement. Work-item queries lose real GitHub/GitLab oversized ASCII secret-prefix empty-query and whitespace-before-trim refusal alarms; inputs share the imported size bound and exercise only its fast length branch, with no multibyte or actual provider/exposure guarantee. Skill sharing loses complete/partial managed-bundle and destination-ambiguity association checks plus three negative origin/path/scheme admission examples; these do not establish uploaded contents, arbitrary-URL fetching, authorization or execution. Retain exact originless-project direct-link fallback, cloud-delete confirmation, bundled-target repair/owner isolation and explicit Windows-host preference over stale WSL suites. Rejected3201 runtime-preference removal is excluded. No real cloud/network/host/disk, mobile or mixed-version execution validation is claimed. Audit3200 composes approved source3194: deliberately retires thirteen authored registrations/twenty-seven expanded cases in six whole automation host/list policy suites without equivalent replacement. Real RPC category/retryability and wrapped-timeout recognition, unscoped-failure/scoped-success health evidence precedence, exact-ID create selectors and per-run workspace omission, paired-web local/SSH/absent host catalog routing, incompatible/removed/unhydrated/offline execution health, runtime-before-nested-SSH recovery dispatch, and no-owned-focus/successor/foreign-list focus policy alarms are consciously lost. Retain exact20line orphan allow/refuse/precondition and exact90line cross-host same-ID search suites. No retry-timer/fence lifecycle, actual reconnect/network/write delivery, native focus, mobile/mixed-version runtime or disk persistence coverage is claimed. Audit3191 combines approved source3182/3187/3188: deliberately retires thirteen authored Vitest registrations and fifteen expanded cases, including five whole suites, without equivalent replacement. Attachment intake loses real portal/native-capture terminal interception and unowned-container refusal, immediate child-only committed availability/claim-ref negotiation and delivery, and direct-target over stable focused/background composer routing through disable/re-enable/remount and independent question focus. Exact destination/cache/draft and final-stat owner/workspace/File-release suites remain; they do not replace Surface recipient routing. Automation authoring loses destination runtime catalog membership, local/direct-SSH exclusion of paired-runtime repos, unknown-runtime empty catalog, logical project/host/setup/repo/path context payload, and missing/nonready setup refusal; these were genuine direct helper alarms, while exact schedule transformation, legacy schedule and setup-decision suites remain. Agent picker loses setup-chat/terminal/missing-installer/unsupported-or-unknown-host row projection samples and the ordinary unsearched menu variant; the entire original26-line resume recipe suite remains, including reported bypass versus default/absent permission modes, as does the exact search-result menu callback with its fixtures, model/effort commits and staged Arguments reopen outcome. Rejected predecessor3180 full recipe deletion is excluded. No actual native drag/cursor/focus/IME, upload bytes or disk/restart persistence, full automation save/scheduler/runtime transport, real resume-process flags/environment delivery, or native menu/rendered layout validation is claimed. Audit3178 combines source3169/3170/3175: deliberately retires eight authored units (six Vitest cases and two imperative custom relay scenarios), including two whole suites, without equivalent replacement. Voice Section loses per-model pending-delete isolation across interleaved A/B completion and the two-success refresh-call alarm; exact VoicePane delayed key-clear/newer enabled-toggle merge remains and does not replace row deletion coverage. Speech loses dedicated rating-scale/inclusive-ceiling, unsupported-versus-unmeasured, explicit/system-language precedence/locale alias, accuracy versus fast named/default/best-measured selection, and unmeasured/no-match examples; exact offered-user-pick versus retired-selection case and its fixture remain. Relay loses legacy ping-delivery count/liveness sampled before the silence deadline and grouped malformed Bearer/host-ID 401/429 routing checks; twelve real Worker/DurableObject/shipped-client scenarios remain, not equivalent replacement for those narrow alarms. Six prior speech cases are not all deleted: approved successor3175 keeps the original user-choice case. No actual credential/file persistence, native/GPU/engine/download delivery, production assignment policy or deployed-runtime validation is claimed by this reduction. Audit3165 combines source3160/3162: deliberately retires six authored/expanded cases across three whole suites without equivalent replacement. Launch/status losses: observed React-render pending/resuming coordination across settings and deferred offer read; stale-offer reread suppressing dialog reopen; held-local-chat recovery visibility with new-chat preferences off; disabled-local admission avoiding offer RPC despite an injected but unconsumed paired-tab fixture; and run-only lost-reply uncertainty reachability until direct viewed-run retirement. Launch probe does not prove arbitrary synchronous-store atomicity, the paired fixture is not remote runtime enrollment, and the status case directly marks viewed state rather than rendering the summary. Crew-hook losses: old-host method_not_found cache persists across party changes but is released by independently supplied connection generation/verified pairing status or pairing revision, with actual frame publication and teardown. These are real narrow coordination, admission, uncertainty and mixed-version cache alarms consciously lost. Exact web verified-runtime writer handoff guard remains; it does not replace those alarms or prove live host/native/mobile delivery. Audit3156 combines3147/3150/3152/3153/3154: deliberately retires39authored/40expanded native-chat recovery cases, eight whole suites and two orphan test-support files without equivalent replacement. Lost alarms: lost-reply unconfirmed reconciliation, skipped rows/counts and missed-frame repair, unknown/pending outcome and omitted-failure-list compatibility, uncertain history after dismissal, retry/refusal/dismiss lifecycle, hidden/consumed picker ownership, result-tree keyboard focus/disclosure and all-skipped retirement; unconfirmed-over-conflict guidance and failed-chat changes despite older host timestamps; nearest-listed ancestor/cyclic forest shape, descendant membership, host ordering/missing-host local fallback; skipped/readiness/admission counts, provisional skip/progress monotonicity, early per-chat verdicts with batch pending protection, older-host waiting, start-slot/delivery distinction, retry-over-failure and unknown-after-withdrawal attention; remote snooze/reconnect/reoffer, unseen mixed summary through open/close, watched completion retirement, new success beside old failure, failed-reread mixed-result preservation, filter/collapse completion resets, retry summary replacement and current-offer/history selection; cross-host workspace identity, rendered cyclic reachability, nested tri-state/toggle propagation, project eligibility isolation and collapse preserving selection. Exact fallback-list completion barrier, batched verdict/cleanup retention, stale-read versus dismissal publication race, and requested-but-never-rendered finished-run retirement remain; they do not replace retired alarms. Audit3146 combines source reviews3132/3133/3135/3138/3143: intentionally retire20authored/31expanded cases without equivalent replacement. Provider-session losses: structured-native terminal-resume exclusion, metadata-less completed identity, new-turn completion clearing, Pi provider-only/periodic/manual promotion, changed-transcript launch-config isolation, Pi/omp/prime-agent completed-session remote/manual-shutdown promotion, and quit/done precedence over heartbeat. Side-thread/question losses: finished-pane acquisition, hidden title/recap states, local/relay/relay-done conversation takeover with prompt/session/child resets, plain-message abandonment, compaction/session replacement and completion resets. Codex startup losses: incoming-owner cached child replacement, old-relay foreign live-session correction, completed foreign-root turn-fact permutations. Transcript losses: real temporary-JSONL partial sibling/final-child completion, unlabelled child attribution, compact cached replay preservation and100/1000completed-child roster retention/release. Compiler-ratchet losses: valid-line uncompiled-list parser grammar examples and injected-existence stale-path filtering; these did not exercise actual filesystem canonicalization or build exclusion. These are real lifecycle, ownership, replay, liveness and retention alarms, including recent#40246 regressions, deliberately lost. Retained conditional record replacement, clockless root/SSH owner isolation, persisted main-thread fork rejection, partial/final question-answer lifetime, cached-roster/missing-ID/live HTTP/durable startup boundaries and restarted-relay refusal/acceptance do not replace those losses. No native/SSH/WSL execution or equivalent coverage is claimed. Audit3128 scoped coverage reduction: Audit3121 removes VoiceDictationLanguageSetting.test.tsx (Spanish-to-es callback and unsupported-model Korean option presence) and voice-speech-model-rows.test.ts (provider/language-order/retired-on-disk list policy); these real narrow alarms are deliberately retired without replacement. VoiceSpeechModelSection per-model concurrent deletion remains unchanged. Audit3122 removes the direct absolute/parent-segment sparse-directory exception-type sample and the five-row IPC sparse-preset error-code/non-save table (two authored/six expanded cases). Those real typed-validation and IPC refusal/error-code alarms are deliberately retired. Keep both real symlink/junction floating-directory trust cases and the minimal RPC structured validation-reason serialization case. The RPC case does not replace IPC save/refusal behavior, typed normalization for both path inputs, actual Git sparse checkout or rendered localization. No equivalent replacement or fresh test/runtime/platform/remote/performance validation is claimed. Audit3124 removes ExperimentalPane.test.tsx (ordinary Pet switch callback), WorkspaceDirectorySetting.test.tsx (padded absolute saved-path normalization/no-write blur), and repository-search.perf.test.ts (navigation/selected-pane builder-call policy, fixture cardinality/nonempty entries and renamed project keyword inclusion). These real narrow alarms are retired without replacement; RepositoryPane.search.test.tsx search-to-sparse-editor request remains unchanged. Audit3129: resolver Windows case-insensitive and POSIX case-sensitive configured-env composition plus mocked-base launch-preflight Windows composition are intentionally no longer checked by the two deleted suites. No equivalent coverage claimed. Keep runtime-structured-agent-host-env.test.ts unchanged: configured Windows Claude-home account identity and host-account precedence remain checked. Audit3114 incorporates source3101: retire three structured Claude child-environment wrapper cases covering inherited stamp isolation/default and explicit entrypoint, Windows SDK-key canonicalization/default/duplicate-key order, and configured lookup/final environment/config-dir conjunction. Keep direct auth/session sanitation and Windows-versus-Linux overlay checks, actual executable lookup from supplied inherited PATH, native Windows child environment delivery, and stale option-mutation fencing. These are not equivalent replacements for the retired wrapper alarms. No fresh test/runtime, real login-shell probe, Claude SDK startup, remote/mixed-version, UI or performance result is claimed. Audit3114 incorporates source3105: retire 17 authored/20 expanded daemon launch-note cases, including the entire two-case SessionLaunchNote suite. Deliberately lose split-marker carry across same-token re-arm, stale-token retirement refusal, foreground tri-state and serial settlement, omitted-note/no-incarnation mixed-version policy, sticky retirement, first-incarnation/replacement launch preservation and held-launch precedence. Keep only the unchanged unresolved foreground-read race against a later finished attach. Supplied notes/foreground and runtime calls do not establish actual daemon/main restart, SSH, native Windows observation, mobile UI, equivalent replacement or fresh runtime/performance validation. Audit3114 incorporates source3109: retire six authored/35 expanded pricing cases: 21 accepted model-name examples, 10 unsupported/future-model fail-closed examples, malformed TTL clamp, unknown-model estimate refusal, flat-model long-context disregard and oversized long-context clamp. Keep mixed five-minute/one-hour write allocation and short/all-long/mixed long-context allocation with original fixed oracles. Real parser/refusal/bounds alarms are knowingly lost without equivalent replacement; retained tests do not validate provider rates, actual billing or request threshold classification. Preserve the archived usage-scan-append source-freeze receipt without transferring historical execution/performance credit. No fresh runtime result is claimed. Audit3108 source-only reduction (3094/3095/3100): retire 27 authored/30 expanded cases, including complete markdown view-state, file-preview link-open and CLI agent-server-route suites, without replacement. Deliberate losses include preview visibility/reference lifetime and same-path owners; SSH stat, directory/missing-target, explicit-null owner, nonmarkdown line/column, local URI routing, remote-to-client guard and same-file reuse; document-preview source-owner/folder/reuse routing, stable grant location and outside-workspace POSIX/Windows request projection; and verified remote CLI send/check refusal, suggested --on argv/copy, shell no-probe bypass, unverified-launch admission and older-peer refusal. Retain two markdown source-runtime/qualified-reveal alarms, one stale grant-rejection fence and two remote read/mutation evidence policies, with original callbacks. Final last-wins reveal did not prove transient cancellation; CLI prerequisite did not prove no real send, and envelope tests do not execute server refusal. No fresh runtime, rendered UI, actual file/SSH/paired transport, authorization, mixed-version or performance result is claimed. Audit3096 source-only reduction (3087/3088): retire 69 authored/76 expanded cases, including complete recovery-portals and reconnect-banner suites. Intentionally lose dead/default TUI replay, generated alternate-frame style composition, reset/mode/dimension and legacy missing-mode-boundary alarms, UI notice/action/reveal policies, and isolated recovery lifecycle variants, without equivalent replacement. Retained registrations and callbacks are unchanged; headless cells are not pixels, and no fresh runtime, host, SSH, WSL, rendered-app or performance result is claimed. Audit3086 source-only reduction (3079/3080/3081): intentionally retire 93 authored/100 expanded mock-boundary cases, including the complete spawn-errors and SSH reconnect overlay suites, without replacement. Retired alarms include spawn classification/ownership, reply ceilings and renderer-write failure recovery, disconnect/detach fencing branches, authority facts, and overlay retry/visibility wiring. Retained callbacks are unchanged; no fresh execution, real PTY/SSH, rendered UI, or performance result is claimed. Audit2432: The broad unit command loses the isolated BranchPicker open-change notification sample. Its unique true/false callback alarm is intentionally retired; reopening/status-refresh behavior was not exercised. No equivalent replacement or fresh validation of the reduced selector is claimed. Audit2425: The broad unit command loses the workspace-copy-status supplied readError forwarding sample. It did not exercise the branch-switch blocking promised by its title. This alarm is intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2417: The broad unit command loses two ordinary clean Git cherry-pick/revert success samples and two terminal startup foreground-read work-budget samples. These unique alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2412: The broad unit command loses the whole six-case fake-React-hook scroll-anchor suite, two generic draft-retention samples, a simple new-agent order sample, a real history-publication batching-count sample, an unmounted handoff abort/timer sample and three basic WSL preview/error samples. These alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2404: The broad unit command loses the standalone share-name lookup 503 propagation suite, initial deletion placement-kind sample, direct changed-mtime stale sample, first-pass rollback existence example and abandoned-preparation directory sample. These exact alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2397 review amendment: The broad unit command loses three standalone suites, two partial-case definitions and two URL table rows across package/download/placement tests. Keep initial wrong-port authorization, modified independent-copy digest refusal and abort-after-begin cancellation dispatch. The remaining alarms are deliberately retired; no equivalent complete replacement or fresh validation of the reduced selector is claimed. Audit2393 current-parent refresh2401: Remove the basic skill-install service alias sample and original public managed-remove receiptless refusal case. Preserve the upstream request ownership suite and transaction interruption coverage. No equivalent complete replacement or fresh validation of the reduced selector is claimed. Audit2389: The broad unit command loses the missing-preview suite, plain-global destination sample and prepublished-receipt recovery example. No equivalent replacement or fresh validation of the reduced selector is claimed. Audit2385: The broad unit command loses four authored walker/staging/protocol examples (six expanded cases); no equivalent replacement or fresh validation is claimed for the reduced suite. Audit2383: The unscoped Vitest command no longer includes the removed Antigravity catalogue suite; its exact provider-root/owner example has no equivalent replacement or fresh validation claim. Audit2377/2381: The unscoped Vitest command includes the reduced bundled-skill and native-discovery suites; the eight removed backup/legacy/catalogue/symlink/SSH-builder examples have no replacement-equivalence or fresh validation claim here. Audit2133 current-parent preparation: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2095 current-parent preparation2126: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): The main IPC contract test subscribes terminal.multiplex through the real handler, disconnects the environment, and asserts the renderer received exactly one {type: close} subscription event. Two isolation tests subscribe a second stream to the same environment and make the first one fail -- in its socket close, and in the liveness probe inside notifyClosed -- then assert the disconnect does not throw, both transports closed, and every close the renderer could still receive was delivered. A third drives a host-initiated close through the transport callback, which is the one notifyClosed call site with no surrounding guard, with a renderer send that throws, and asserts it cannot escape into the WebSocket close handler. A fourth test asserts that after retirement a late response frame is not forwarded and a late transport close does not re-send. The paired-server journey runs three reveal scenarios against one real host and one real paired desktop client, and for each records buffer restore, host-side receipt of the typed marker through an out-of-band host sink file, live paint without a tab flip, and PTY-versus-pane grid convergence.", + "oracle": "Audit 3301 combines adopted source batches 3296 and 3299: retire 27 authored declarations and 36 expanded scenarios, including six whole suites. Intentionally lost alarms cover failed-verification/recovery/restart counters and mocked hosting/toast; early overlapping pane-read scheduling/count; unreadable removal listing draft guard; bulk-purge remote-qualified and raw-local guard maps; initial-snapshot blank/mode/oversize/printable/fresh-spawn callback and replay examples; fallback mobile file close and ordinary MRU; default queue overload/drain; seeded browser-page reuse and supplied missing-page URL recreation; ambiguous sleep/hibernation owner refusal and untouched bindings/origins; ordinary selection/activity/fallback priority; skip-remote success and retained hints; supplied structured-chat unsent retention and scoped removal draft eviction; caller-chat focus precedence; open/draft PR cache eviction and merged-head fallback result inventories. Retained adverse-ordering and ownership cases are narrower and do not establish equivalent replacements. No fresh runtime, native, physical provider, cross-platform, mobile or mixed-version evidence is claimed. Audit 3292 combines adopted 3285/3287/3289/3293 removals: 40 authored declarations and 47 expanded scenarios, including whole frame-editor-view, ambiguous remote-delete-refusal, unverifiable-host subscription and editor-close cleanup suites. The previously reviewed dock-badge suite was already removed upstream in PR 40895 and receives zero new removal credit. Intentionally retired alarms include background browser selection and last-tab landing; main startup fallback, SSH project cleanup/survivor routing, exact-PR contradiction/saved-push positives, replay/sidecar rollback and wrapped remote error normalization; records/snapshot missing-diff hydration, ambiguous folder-owner delete refusal, focus no-op notifications, nested editor context-only cache check, pending broadcast-first status and ordinary four-confirmation aggregation; preview-source frontmatter pruning, approved local/runtime agent dispatch, non-GitHub legacy PR cache invalidation, stale merged-head transient-error fallback, empty-queue immediate query reply and unverified-to-concrete preflight risk. Additional intentionally retired alarms are injected host subscription/unsubscribe counts, synthetic editor reveal/draft/fallback/scoped close, ambiguous unread refusals and hidden mark/read roundtrip, immediate connect backoff/noError, positive mirrored evidence-clock renewal, supplied VM failure/success projections and git-local/folder-SSH wake permutations. Remaining temporal/ownership cases are narrower; no equivalent replacement or fresh execution is claimed. Audit 3283 removes 20 authored declarations and 31 expanded scenarios, including two whole suites. Retired alarms cover PR refresh-state pruning, shared runtime subscription cleanup and store isolation, language content-change routing and older completion ownership, ordinary panel retry-timer cleanup and pending loading, four hosted-review lifetime permutations, mocked terminal creation error/order wiring, five sleep-inventory variants with pending-frame-only assertions, palette fallback/composite highlights, Windows/UNC encoded-editor input rows, mixed-repository partial failure counts, title setters and generated-title bypass/replacement, five window-close coordinator delegation/guard/finally branches, and ambiguous-old-record frame reveal. These regression checks are intentionally lost under the test-value audit; retained cases are not equivalent replacements. Prior coverage notes and receipts remain historical. Audit 3273 removes 14 authored declarations and 19 expanded scenarios across four whole suites and eight partial suites. Retired alarms cover saved-local cancellation/layout ownership, ambiguous-owner warning reset, folder attachment routing, VM false-capability bypass, abandoned reveal warmup cleanup and viewport claim deduplication/rearming, quiet unrelated remote-removal refusal, startup-command one-shot consumption, repository/floating recovery-ledger rows, fake-React pinned-scroll intent, split-ratio state identity/subscriber suppression and fractional change, cross-host project-group join refusal, three PR request-lifetime permutations, upstream-status preservation on error, and unresolved Git-owner refusal. These regression checks are intentionally lost under the test-value audit; retained scenarios are not equivalent replacements. Historical coverage receipts remain historical, including gate35 subscriber claims. Audit 3256 removes these specific alarms from the broad root unit commands: skill dialog active-share selection, close and pending-share handoff; simple keyed-record deletion; marker live-region insertion, simple landing and nine baseline policy examples; General search/control navigation inventory; orphan-count cache bootstrap; seven Codex code classifications and HTTP 429 warning mapping; two skill unread-root verdict examples; peer-mail payload and conversation-ID rejection; and the GitHub organization TABLE text-field optimistic rollback/failed-envelope example. These include real behaviors; retained tests do not provide equivalent coverage for every removed scenario. Mobile losses are recorded separately and are not coverage of these root commands. Audit3246 retires NewRowsMarker reveal/no-repeat and pane-scoped beforeinput checks; skill-owner option availability/count/dedup/order; six styled Input/Textarea IME forwarding rows; the static Codex/OpenCode smart-key inventory; tab-map AST ratchet diagnostic fixtures; child-roster work-budget and retained-aggregate alarms; malformed persisted floating-cwd fallback/no-crash/empty exact-root checks; the unanswered-host empty-list discriminator; the direct invalidated-cache commit-false assertion; one redundant digit-keyup IME row; cached non-supported Claude title-generator rows; and the duplicate late naming-result singleton. These root broad commands lose those specific alarms without equivalent replacement. Distinct retained owner/state checks have their own bounded claims; the real scheduler still rejects stale response data, while the direct false-return alarm is retired. Audit3231 retires supported-host restore-pane key mapping, closed/open creation-sidebar toggle visibility, unrelated scope-error/null classification and quick-submit reveal/no-create checks. These broad commands lose those real narrow alarms; no replacement coverage is claimed. Audit3219 removes the synthetic Cmd+J extra-source suite; this broad command no longer checks its match/tie placement and selection, announced count, empty-query cap, or workspace hiding with retained recent tabs. No replacement coverage is claimed. Audit3209 composes approved sources3202/3206: deliberately retires seven authored/expanded cases in four whole suites without equivalent replacement. Work-item queries lose real GitHub/GitLab oversized ASCII secret-prefix empty-query and whitespace-before-trim refusal alarms; inputs share the imported size bound and exercise only its fast length branch, with no multibyte or actual provider/exposure guarantee. Skill sharing loses complete/partial managed-bundle and destination-ambiguity association checks plus three negative origin/path/scheme admission examples; these do not establish uploaded contents, arbitrary-URL fetching, authorization or execution. Retain exact originless-project direct-link fallback, cloud-delete confirmation, bundled-target repair/owner isolation and explicit Windows-host preference over stale WSL suites. Rejected3201 runtime-preference removal is excluded. No real cloud/network/host/disk, mobile or mixed-version execution validation is claimed. Audit3200 composes approved source3194: deliberately retires thirteen authored registrations/twenty-seven expanded cases in six whole automation host/list policy suites without equivalent replacement. Real RPC category/retryability and wrapped-timeout recognition, unscoped-failure/scoped-success health evidence precedence, exact-ID create selectors and per-run workspace omission, paired-web local/SSH/absent host catalog routing, incompatible/removed/unhydrated/offline execution health, runtime-before-nested-SSH recovery dispatch, and no-owned-focus/successor/foreign-list focus policy alarms are consciously lost. Retain exact20line orphan allow/refuse/precondition and exact90line cross-host same-ID search suites. No retry-timer/fence lifecycle, actual reconnect/network/write delivery, native focus, mobile/mixed-version runtime or disk persistence coverage is claimed. Audit3191 combines approved source3182/3187/3188: deliberately retires thirteen authored Vitest registrations and fifteen expanded cases, including five whole suites, without equivalent replacement. Attachment intake loses real portal/native-capture terminal interception and unowned-container refusal, immediate child-only committed availability/claim-ref negotiation and delivery, and direct-target over stable focused/background composer routing through disable/re-enable/remount and independent question focus. Exact destination/cache/draft and final-stat owner/workspace/File-release suites remain; they do not replace Surface recipient routing. Automation authoring loses destination runtime catalog membership, local/direct-SSH exclusion of paired-runtime repos, unknown-runtime empty catalog, logical project/host/setup/repo/path context payload, and missing/nonready setup refusal; these were genuine direct helper alarms, while exact schedule transformation, legacy schedule and setup-decision suites remain. Agent picker loses setup-chat/terminal/missing-installer/unsupported-or-unknown-host row projection samples and the ordinary unsearched menu variant; the entire original26-line resume recipe suite remains, including reported bypass versus default/absent permission modes, as does the exact search-result menu callback with its fixtures, model/effort commits and staged Arguments reopen outcome. Rejected predecessor3180 full recipe deletion is excluded. No actual native drag/cursor/focus/IME, upload bytes or disk/restart persistence, full automation save/scheduler/runtime transport, real resume-process flags/environment delivery, or native menu/rendered layout validation is claimed. Audit3178 combines source3169/3170/3175: deliberately retires eight authored units (six Vitest cases and two imperative custom relay scenarios), including two whole suites, without equivalent replacement. Voice Section loses per-model pending-delete isolation across interleaved A/B completion and the two-success refresh-call alarm; exact VoicePane delayed key-clear/newer enabled-toggle merge remains and does not replace row deletion coverage. Speech loses dedicated rating-scale/inclusive-ceiling, unsupported-versus-unmeasured, explicit/system-language precedence/locale alias, accuracy versus fast named/default/best-measured selection, and unmeasured/no-match examples; exact offered-user-pick versus retired-selection case and its fixture remain. Relay loses legacy ping-delivery count/liveness sampled before the silence deadline and grouped malformed Bearer/host-ID 401/429 routing checks; twelve real Worker/DurableObject/shipped-client scenarios remain, not equivalent replacement for those narrow alarms. Six prior speech cases are not all deleted: approved successor3175 keeps the original user-choice case. No actual credential/file persistence, native/GPU/engine/download delivery, production assignment policy or deployed-runtime validation is claimed by this reduction. Audit3165 combines source3160/3162: deliberately retires six authored/expanded cases across three whole suites without equivalent replacement. Launch/status losses: observed React-render pending/resuming coordination across settings and deferred offer read; stale-offer reread suppressing dialog reopen; held-local-chat recovery visibility with new-chat preferences off; disabled-local admission avoiding offer RPC despite an injected but unconsumed paired-tab fixture; and run-only lost-reply uncertainty reachability until direct viewed-run retirement. Launch probe does not prove arbitrary synchronous-store atomicity, the paired fixture is not remote runtime enrollment, and the status case directly marks viewed state rather than rendering the summary. Crew-hook losses: old-host method_not_found cache persists across party changes but is released by independently supplied connection generation/verified pairing status or pairing revision, with actual frame publication and teardown. These are real narrow coordination, admission, uncertainty and mixed-version cache alarms consciously lost. Exact web verified-runtime writer handoff guard remains; it does not replace those alarms or prove live host/native/mobile delivery. Audit3156 combines3147/3150/3152/3153/3154: deliberately retires39authored/40expanded native-chat recovery cases, eight whole suites and two orphan test-support files without equivalent replacement. Lost alarms: lost-reply unconfirmed reconciliation, skipped rows/counts and missed-frame repair, unknown/pending outcome and omitted-failure-list compatibility, uncertain history after dismissal, retry/refusal/dismiss lifecycle, hidden/consumed picker ownership, result-tree keyboard focus/disclosure and all-skipped retirement; unconfirmed-over-conflict guidance and failed-chat changes despite older host timestamps; nearest-listed ancestor/cyclic forest shape, descendant membership, host ordering/missing-host local fallback; skipped/readiness/admission counts, provisional skip/progress monotonicity, early per-chat verdicts with batch pending protection, older-host waiting, start-slot/delivery distinction, retry-over-failure and unknown-after-withdrawal attention; remote snooze/reconnect/reoffer, unseen mixed summary through open/close, watched completion retirement, new success beside old failure, failed-reread mixed-result preservation, filter/collapse completion resets, retry summary replacement and current-offer/history selection; cross-host workspace identity, rendered cyclic reachability, nested tri-state/toggle propagation, project eligibility isolation and collapse preserving selection. Exact fallback-list completion barrier, batched verdict/cleanup retention, stale-read versus dismissal publication race, and requested-but-never-rendered finished-run retirement remain; they do not replace retired alarms. Audit3146 combines source reviews3132/3133/3135/3138/3143: intentionally retire20authored/31expanded cases without equivalent replacement. Provider-session losses: structured-native terminal-resume exclusion, metadata-less completed identity, new-turn completion clearing, Pi provider-only/periodic/manual promotion, changed-transcript launch-config isolation, Pi/omp/prime-agent completed-session remote/manual-shutdown promotion, and quit/done precedence over heartbeat. Side-thread/question losses: finished-pane acquisition, hidden title/recap states, local/relay/relay-done conversation takeover with prompt/session/child resets, plain-message abandonment, compaction/session replacement and completion resets. Codex startup losses: incoming-owner cached child replacement, old-relay foreign live-session correction, completed foreign-root turn-fact permutations. Transcript losses: real temporary-JSONL partial sibling/final-child completion, unlabelled child attribution, compact cached replay preservation and100/1000completed-child roster retention/release. Compiler-ratchet losses: valid-line uncompiled-list parser grammar examples and injected-existence stale-path filtering; these did not exercise actual filesystem canonicalization or build exclusion. These are real lifecycle, ownership, replay, liveness and retention alarms, including recent#40246 regressions, deliberately lost. Retained conditional record replacement, clockless root/SSH owner isolation, persisted main-thread fork rejection, partial/final question-answer lifetime, cached-roster/missing-ID/live HTTP/durable startup boundaries and restarted-relay refusal/acceptance do not replace those losses. No native/SSH/WSL execution or equivalent coverage is claimed. Audit3128 scoped coverage reduction: Audit3121 removes VoiceDictationLanguageSetting.test.tsx (Spanish-to-es callback and unsupported-model Korean option presence) and voice-speech-model-rows.test.ts (provider/language-order/retired-on-disk list policy); these real narrow alarms are deliberately retired without replacement. VoiceSpeechModelSection per-model concurrent deletion remains unchanged. Audit3122 removes the direct absolute/parent-segment sparse-directory exception-type sample and the five-row IPC sparse-preset error-code/non-save table (two authored/six expanded cases). Those real typed-validation and IPC refusal/error-code alarms are deliberately retired. Keep both real symlink/junction floating-directory trust cases and the minimal RPC structured validation-reason serialization case. The RPC case does not replace IPC save/refusal behavior, typed normalization for both path inputs, actual Git sparse checkout or rendered localization. No equivalent replacement or fresh test/runtime/platform/remote/performance validation is claimed. Audit3124 removes ExperimentalPane.test.tsx (ordinary Pet switch callback), WorkspaceDirectorySetting.test.tsx (padded absolute saved-path normalization/no-write blur), and repository-search.perf.test.ts (navigation/selected-pane builder-call policy, fixture cardinality/nonempty entries and renamed project keyword inclusion). These real narrow alarms are retired without replacement; RepositoryPane.search.test.tsx search-to-sparse-editor request remains unchanged. Audit3129: resolver Windows case-insensitive and POSIX case-sensitive configured-env composition plus mocked-base launch-preflight Windows composition are intentionally no longer checked by the two deleted suites. No equivalent coverage claimed. Keep runtime-structured-agent-host-env.test.ts unchanged: configured Windows Claude-home account identity and host-account precedence remain checked. Audit3114 incorporates source3101: retire three structured Claude child-environment wrapper cases covering inherited stamp isolation/default and explicit entrypoint, Windows SDK-key canonicalization/default/duplicate-key order, and configured lookup/final environment/config-dir conjunction. Keep direct auth/session sanitation and Windows-versus-Linux overlay checks, actual executable lookup from supplied inherited PATH, native Windows child environment delivery, and stale option-mutation fencing. These are not equivalent replacements for the retired wrapper alarms. No fresh test/runtime, real login-shell probe, Claude SDK startup, remote/mixed-version, UI or performance result is claimed. Audit3114 incorporates source3105: retire 17 authored/20 expanded daemon launch-note cases, including the entire two-case SessionLaunchNote suite. Deliberately lose split-marker carry across same-token re-arm, stale-token retirement refusal, foreground tri-state and serial settlement, omitted-note/no-incarnation mixed-version policy, sticky retirement, first-incarnation/replacement launch preservation and held-launch precedence. Keep only the unchanged unresolved foreground-read race against a later finished attach. Supplied notes/foreground and runtime calls do not establish actual daemon/main restart, SSH, native Windows observation, mobile UI, equivalent replacement or fresh runtime/performance validation. Audit3114 incorporates source3109: retire six authored/35 expanded pricing cases: 21 accepted model-name examples, 10 unsupported/future-model fail-closed examples, malformed TTL clamp, unknown-model estimate refusal, flat-model long-context disregard and oversized long-context clamp. Keep mixed five-minute/one-hour write allocation and short/all-long/mixed long-context allocation with original fixed oracles. Real parser/refusal/bounds alarms are knowingly lost without equivalent replacement; retained tests do not validate provider rates, actual billing or request threshold classification. Preserve the archived usage-scan-append source-freeze receipt without transferring historical execution/performance credit. No fresh runtime result is claimed. Audit3108 source-only reduction (3094/3095/3100): retire 27 authored/30 expanded cases, including complete markdown view-state, file-preview link-open and CLI agent-server-route suites, without replacement. Deliberate losses include preview visibility/reference lifetime and same-path owners; SSH stat, directory/missing-target, explicit-null owner, nonmarkdown line/column, local URI routing, remote-to-client guard and same-file reuse; document-preview source-owner/folder/reuse routing, stable grant location and outside-workspace POSIX/Windows request projection; and verified remote CLI send/check refusal, suggested --on argv/copy, shell no-probe bypass, unverified-launch admission and older-peer refusal. Retain two markdown source-runtime/qualified-reveal alarms, one stale grant-rejection fence and two remote read/mutation evidence policies, with original callbacks. Final last-wins reveal did not prove transient cancellation; CLI prerequisite did not prove no real send, and envelope tests do not execute server refusal. No fresh runtime, rendered UI, actual file/SSH/paired transport, authorization, mixed-version or performance result is claimed. Audit3096 source-only reduction (3087/3088): retire 69 authored/76 expanded cases, including complete recovery-portals and reconnect-banner suites. Intentionally lose dead/default TUI replay, generated alternate-frame style composition, reset/mode/dimension and legacy missing-mode-boundary alarms, UI notice/action/reveal policies, and isolated recovery lifecycle variants, without equivalent replacement. Retained registrations and callbacks are unchanged; headless cells are not pixels, and no fresh runtime, host, SSH, WSL, rendered-app or performance result is claimed. Audit3086 source-only reduction (3079/3080/3081): intentionally retire 93 authored/100 expanded mock-boundary cases, including the complete spawn-errors and SSH reconnect overlay suites, without replacement. Retired alarms include spawn classification/ownership, reply ceilings and renderer-write failure recovery, disconnect/detach fencing branches, authority facts, and overlay retry/visibility wiring. Retained callbacks are unchanged; no fresh execution, real PTY/SSH, rendered UI, or performance result is claimed. Audit2432: The broad unit command loses the isolated BranchPicker open-change notification sample. Its unique true/false callback alarm is intentionally retired; reopening/status-refresh behavior was not exercised. No equivalent replacement or fresh validation of the reduced selector is claimed. Audit2425: The broad unit command loses the workspace-copy-status supplied readError forwarding sample. It did not exercise the branch-switch blocking promised by its title. This alarm is intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2417: The broad unit command loses two ordinary clean Git cherry-pick/revert success samples and two terminal startup foreground-read work-budget samples. These unique alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2412: The broad unit command loses the whole six-case fake-React-hook scroll-anchor suite, two generic draft-retention samples, a simple new-agent order sample, a real history-publication batching-count sample, an unmounted handoff abort/timer sample and three basic WSL preview/error samples. These alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2404: The broad unit command loses the standalone share-name lookup 503 propagation suite, initial deletion placement-kind sample, direct changed-mtime stale sample, first-pass rollback existence example and abandoned-preparation directory sample. These exact alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2397 review amendment: The broad unit command loses three standalone suites, two partial-case definitions and two URL table rows across package/download/placement tests. Keep initial wrong-port authorization, modified independent-copy digest refusal and abort-after-begin cancellation dispatch. The remaining alarms are deliberately retired; no equivalent complete replacement or fresh validation of the reduced selector is claimed. Audit2393 current-parent refresh2401: Remove the basic skill-install service alias sample and original public managed-remove receiptless refusal case. Preserve the upstream request ownership suite and transaction interruption coverage. No equivalent complete replacement or fresh validation of the reduced selector is claimed. Audit2389: The broad unit command loses the missing-preview suite, plain-global destination sample and prepublished-receipt recovery example. No equivalent replacement or fresh validation of the reduced selector is claimed. Audit2385: The broad unit command loses four authored walker/staging/protocol examples (six expanded cases); no equivalent replacement or fresh validation is claimed for the reduced suite. Audit2383: The unscoped Vitest command no longer includes the removed Antigravity catalogue suite; its exact provider-root/owner example has no equivalent replacement or fresh validation claim. Audit2377/2381: The unscoped Vitest command includes the reduced bundled-skill and native-discovery suites; the eight removed backup/legacy/catalogue/symlink/SSH-builder examples have no replacement-equivalence or fresh validation claim here. Audit2133 current-parent preparation: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2095 current-parent preparation2126: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): The main IPC contract test subscribes terminal.multiplex through the real handler, disconnects the environment, and asserts the renderer received exactly one {type: close} subscription event. Two isolation tests subscribe a second stream to the same environment and make the first one fail -- in its socket close, and in the liveness probe inside notifyClosed -- then assert the disconnect does not throw, both transports closed, and every close the renderer could still receive was delivered. A third drives a host-initiated close through the transport callback, which is the one notifyClosed call site with no surrounding guard, with a renderer send that throws, and asserts it cannot escape into the WebSocket close handler. A fourth test asserts that after retirement a late response frame is not forwarded and a late transport close does not re-send. The paired-server journey runs three reveal scenarios against one real host and one real paired desktop client, and for each records buffer restore, host-side receipt of the typed marker through an out-of-band host sink file, live paint without a tab flip, and PTY-versus-pane grid convergence.", "commands": [ "pnpm exec vitest run --config config/vitest.config.ts", "pnpm exec playwright test tests/e2e/paired-remote-terminal-parked-reveal-interactivity.spec.ts --config tests/playwright.config.ts --project electron-headless --workers=1" @@ -4310,7 +4294,8 @@ "Audit 3256 removes these specific alarms from the broad root unit commands: skill dialog active-share selection, close and pending-share handoff; simple keyed-record deletion; marker live-region insertion, simple landing and nine baseline policy examples; General search/control navigation inventory; orphan-count cache bootstrap; seven Codex code classifications and HTTP 429 warning mapping; two skill unread-root verdict examples; peer-mail payload and conversation-ID rejection; and the GitHub organization TABLE text-field optimistic rollback/failed-envelope example. These include real behaviors; retained tests do not provide equivalent coverage for every removed scenario. Mobile losses are recorded separately and are not coverage of these root commands.", "Audit 3273 removes 14 authored declarations and 19 expanded scenarios across four whole suites and eight partial suites. Retired alarms cover saved-local cancellation/layout ownership, ambiguous-owner warning reset, folder attachment routing, VM false-capability bypass, abandoned reveal warmup cleanup and viewport claim deduplication/rearming, quiet unrelated remote-removal refusal, startup-command one-shot consumption, repository/floating recovery-ledger rows, fake-React pinned-scroll intent, split-ratio state identity/subscriber suppression and fractional change, cross-host project-group join refusal, three PR request-lifetime permutations, upstream-status preservation on error, and unresolved Git-owner refusal. These regression checks are intentionally lost under the test-value audit; retained scenarios are not equivalent replacements. Historical coverage receipts remain historical, including gate35 subscriber claims.", "Audit 3283 removes 20 authored declarations and 31 expanded scenarios, including two whole suites. Retired alarms cover PR refresh-state pruning, shared runtime subscription cleanup and store isolation, language content-change routing and older completion ownership, ordinary panel retry-timer cleanup and pending loading, four hosted-review lifetime permutations, mocked terminal creation error/order wiring, five sleep-inventory variants with pending-frame-only assertions, palette fallback/composite highlights, Windows/UNC encoded-editor input rows, mixed-repository partial failure counts, title setters and generated-title bypass/replacement, five window-close coordinator delegation/guard/finally branches, and ambiguous-old-record frame reveal. These regression checks are intentionally lost under the test-value audit; retained cases are not equivalent replacements. Prior coverage notes and receipts remain historical.", - "Audit 3292 combines adopted 3285/3287/3289/3293 removals: 40 authored declarations and 47 expanded scenarios, including whole frame-editor-view, ambiguous remote-delete-refusal, unverifiable-host subscription and editor-close cleanup suites. The previously reviewed dock-badge suite was already removed upstream in PR 40895 and receives zero new removal credit. Intentionally retired alarms include background browser selection and last-tab landing; main startup fallback, SSH project cleanup/survivor routing, exact-PR contradiction/saved-push positives, replay/sidecar rollback and wrapped remote error normalization; records/snapshot missing-diff hydration, ambiguous folder-owner delete refusal, focus no-op notifications, nested editor context-only cache check, pending broadcast-first status and ordinary four-confirmation aggregation; preview-source frontmatter pruning, approved local/runtime agent dispatch, non-GitHub legacy PR cache invalidation, stale merged-head transient-error fallback, empty-queue immediate query reply and unverified-to-concrete preflight risk. Additional intentionally retired alarms are injected host subscription/unsubscribe counts, synthetic editor reveal/draft/fallback/scoped close, ambiguous unread refusals and hidden mark/read roundtrip, immediate connect backoff/noError, positive mirrored evidence-clock renewal, supplied VM failure/success projections and git-local/folder-SSH wake permutations. Remaining temporal/ownership cases are narrower; no equivalent replacement or fresh execution is claimed." + "Audit 3292 combines adopted 3285/3287/3289/3293 removals: 40 authored declarations and 47 expanded scenarios, including whole frame-editor-view, ambiguous remote-delete-refusal, unverifiable-host subscription and editor-close cleanup suites. The previously reviewed dock-badge suite was already removed upstream in PR 40895 and receives zero new removal credit. Intentionally retired alarms include background browser selection and last-tab landing; main startup fallback, SSH project cleanup/survivor routing, exact-PR contradiction/saved-push positives, replay/sidecar rollback and wrapped remote error normalization; records/snapshot missing-diff hydration, ambiguous folder-owner delete refusal, focus no-op notifications, nested editor context-only cache check, pending broadcast-first status and ordinary four-confirmation aggregation; preview-source frontmatter pruning, approved local/runtime agent dispatch, non-GitHub legacy PR cache invalidation, stale merged-head transient-error fallback, empty-queue immediate query reply and unverified-to-concrete preflight risk. Additional intentionally retired alarms are injected host subscription/unsubscribe counts, synthetic editor reveal/draft/fallback/scoped close, ambiguous unread refusals and hidden mark/read roundtrip, immediate connect backoff/noError, positive mirrored evidence-clock renewal, supplied VM failure/success projections and git-local/folder-SSH wake permutations. Remaining temporal/ownership cases are narrower; no equivalent replacement or fresh execution is claimed.", + "Audit 3301 combines adopted source batches 3296 and 3299: retire 27 authored declarations and 36 expanded scenarios, including six whole suites. Intentionally lost alarms cover failed-verification/recovery/restart counters and mocked hosting/toast; early overlapping pane-read scheduling/count; unreadable removal listing draft guard; bulk-purge remote-qualified and raw-local guard maps; initial-snapshot blank/mode/oversize/printable/fresh-spawn callback and replay examples; fallback mobile file close and ordinary MRU; default queue overload/drain; seeded browser-page reuse and supplied missing-page URL recreation; ambiguous sleep/hibernation owner refusal and untouched bindings/origins; ordinary selection/activity/fallback priority; skip-remote success and retained hints; supplied structured-chat unsent retention and scoped removal draft eviction; caller-chat focus precedence; open/draft PR cache eviction and merged-head fallback result inventories. Retained adverse-ordering and ownership cases are narrower and do not establish equivalent replacements. No fresh runtime, native, physical provider, cross-platform, mobile or mixed-version evidence is claimed." ], "demotionRule": "Demote if a retired runtime transport can leave a renderer subscription without a close event, if a close is delivered more than once, if one failing teardown strands its sibling subscriptions, if payload frames from a retired transport reach the renderer, or if a revealed remote terminal can stay blank or reject input after a reconnect." }, @@ -4428,7 +4413,7 @@ "providers": ["remote-runtime"], "coveredPlatforms": ["macos"], "coveredProviders": [], - "coverageNotes": "Audit3108: doc-preview-grants.test.ts now retains only the stale grant-rejection race: a late rejected grant request must not evict a newer grant registry entry, witnessed by later revocation of grant-2. Retire stable minted-location and outside-workspace POSIX/Windows request-projection alarms without replacement. The direct nonempty grant selector remains unchanged; no real grant-server/file authorization, SSH/HTML delivery or native-focus result is claimed. Audit2133 current-parent preparation: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2095 current-parent preparation2126: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2090 (sources2088/2089): Current reduced suites intentionally retire the alarms listed in knownGaps; prior dated execution and replacement claims do not validate changed source bytes or selectors. Historical prior account (preserved verbatim): Audit2086 (sources2082/2083): Current reduced suites intentionally retire the alarms listed in knownGaps; prior dated execution and replacement claims do not validate changed source bytes or selectors. Historical prior account (preserved verbatim): Audit2076 (sources2073/2074): Intentionally retire these low-value alarms without replacement: src/main/runtime/orca-runtime-tests/terminal-handles-part-02.spec.ts: recovers a moved SSH pane through the tab it now sits in, not the one its lease froze; reports a plain expired orphan; does not report a pane whose only recent lease was superseded; does not report a pane whose only recent lease had its relay id recycled; picks the eligible orphan over a superseded predecessor that matches first; collects the same tabs the per-tab reader reports, in one sweep of the leases; reports no candidate when no lease names any of the worktree tabs. src/main/runtime/orca-runtime-tests/runtime-availability.spec.ts: starts unavailable with no authoritative window; reports the configured Windows terminal shell on status; reports floating workspace availability from settings on status; polls floating tabs with targeted PTY liveness and no repo/provider inventory; hydrates persisted tabs when the store cannot report repos; advertises browser screencast only when a renderer window is available; routes mobile Codex reset consumption through the account mutation coordinator; maps a definite pre-provider rejection into an authoritative current snapshot. Existing unrelated evidenceRuns retain their original scope; unchanged dated receipt objects do not validate changed source bytes or reduced selectors. No fresh gate execution or historical import-closure equivalence is claimed. Frozen current literal-import graph reaches these changed test bytes; unresolved local and computed edges remain debt, and current reachability is not historical execution or equivalent replacement evidence. Historical prior account (preserved verbatim): Audit2043: Remove the registration-wait, webview-security, preview-authorization, guest-lifecycle and grant-IPC unit suites and the sibling-directory assertion reference. Runtime and browser capability consumers also lose removed imported examples. Remaining document-policy, file-reader and grant-registry assertions do not replace those alarms. Preserve the 27 independent dated receipts at their original unchanged selectors; reduced prospective unit selectors have no fresh result or equivalent replacement claim. Historical prior account (preserved verbatim): Audit1973: Delete the browser RPC forwarding/schema/scalar suite and its prospective selector. Preserve all27 unrelated dated receipts; no actual browser operation alarm is replaced. Whole original changed dated receipts are retired, never narrowed or transferred. This metadata review claims no fresh execution, equivalent replacement, provider/PTY, live remote/mobile, rendered, cross-platform, soak or measured-budget result. Historical prior account (preserved verbatim): Audit1925 (sources1922/1923): The complete terminal-file-link-actions suite is removed. Lose supplied local/remote menu-row inventories, browser label/order/download/reveal callback forwarding, platform-copy and source-group pinning examples. No OS reveal/download, real remote preview or browser navigation was exercised; the other real document-preview sources are not equivalent replacements. Preserve meaningful remaining selectors/assertions and unchanged dated receipts within their original scope. Reduced selectors have no fresh gate execution evidence in this metadata packet. No equivalent replacement, physical watcher/PTY/provider, live SSH/remote/mobile, rendered, cross-platform, soak or measured-budget result is claimed. Historical prior account (preserved verbatim): Audit1899 replays sealed Audit1895: workspace-doc-history.test.ts is entirely removed from its current command and testFiles. Supplied recency/dedupe/cap/title/identity examples and the10000-row getter-read budget alarm are intentionally lost. No current assertionRef or active receipt selects that file. Unrelated active receipts and all prior gap literals remain verbatim; no replacement history/index-work coverage or new browser/paired-preview gate execution is claimed. Historical coverage account before Audit1899: Audit1853 reduces LinkActionPopover.test.tsx and archives its complete 2026-09-06 mixed-selector receipt. The lost copy/open-state and Settings callback-order/omission alarms are accepted without equivalent replacement coverage. No fresh execution of this gate is credited. Audit1709 removes low-value test definitions and retires affected assertion or execution-receipt claims without equivalent replacement coverage. Per-source reviews bound retained behavior and injected/native/remote limits. Unchanged assertions and receipts keep their original scope; gates lacking current active evidence are downgraded. Historical scope before this audit: Audit1687 removes low-value test projections, mock wiring, private-state assertions, inventories and duplicate examples without equivalent replacement coverage. Per-source reviews record retained public behavior and refusal boundaries with injected/native/remote limits. Affected historical receipts are retired; gates without active current evidence are downgraded. Historical scope before this audit: Audit1630 removes low-value Git, GitHub/GitLab and IPC projections, argument inventories and duplicate examples without equivalent replacement coverage. Per-source reviews record retained cancellation, ownership, authorization, filesystem and SQLite boundaries with injected/native/remote limits. Affected historical receipts are retired; gates without active current evidence are downgraded. Historical scope before this audit: Audit1571 removes mock forwarding, capability/schema inventories, private predicates, supplied error/result replays, and filesystem-mocked persistence checks without equivalent replacement claims. Retained changed tests also exercise real local permission-file reread, registry proxy rollback/credential retirement, site display recovery, and pending sender/credential/document admission with injected Electron/UI producers. Retained network tests exercise owned stream credit/cleanup, generation and retirement fences, real loopback proxy/SOCKS bytes and file-backed binding state. SSH/WSL/paired runtime, native sessions, authority producers and storage clears remain injected; simulated relaunch uses filesystem mocks. The unchanged profile-retirement suite was statically reviewed and not rerun. No actual SSH/WSL runtime, native Chromium jar deletion, durable process restart, remote DNS or external site proof. Receipts selecting changed tests are retired and unaffected receipts remain unchanged. Historical scope before this audit: Audit1568 removes API inventories, supplied mock-value/forwarding assertions, implementation-shape tables and negative/setup cases that do not reach their intended boundary, without equivalent replacement claims. Retained changed definitions exercise owned manager lifetime/queue/refcount/clamp and real synthetic process/files/staging boundaries. Seventeen unchanged native Electron definitions across this combined audit are statically reviewed and not rerun. Changed native suites exercise local popup wire/cookie/session and clean/native process-identity behavior; known popup-admission flaws remain unfixed. Unit native/event/session/registry inputs remain injected. No actual OS focus, registry/host execution, CRX verification or durable restart proof. Receipts selecting changed tests are retired and unaffected receipts remain unchanged. Historical scope before this audit: Audit1564 retires copied cookie key recipes, mock bridge/preview forwarding and flag tables, source-spelling/script inventories and setup-only alarms without equivalent replacement coverage. Retained changed cases exercise actual scoped SQLite merge/rollback/schema refusal, owned cancellation and grant authority/canonical containment, ranged response consistency, replacement guest ownership and executed guest-script promise/DOM cleanup behavior. Session, host response, geometry/observer and transport producers remain injected where documented. One unchanged native extension definition is not rerun locally; no actual remote filesystem, native layout/focus or authentication claim. Receipts selecting modified tests are retired; unaffected exact-selector receipts remain unchanged. Historical scope before this audit: Audit1412 changes referenced sources. Retained unchanged-source receipts apply only to their unchanged commands; the reduced selectors have no new execution result. Historical coverage account (not a current claim for changed sources): Audit1386 changes referenced sources; no new execution result validates reduced selectors. Retained unchanged receipts apply only to unchanged commands. Historical coverage: Audit1308 changes referenced sources. Retained unchanged-source receipts apply only to their unchanged commands; the reduced selectors have no new execution result. Historical coverage account (not a current claim for changed sources): A macOS desktop host and a separate paired Electron client exercise the Explorer preview action end to end: the document renders inside the client-local orca-preview guest, the client gains exactly one browser workspace and it is the document one, the host's own page registry and tab snapshot gain nothing, the split does not take focus from the source editor, an explicit click activates the preview, and closing it with its X leaves the editor and terminal intact. Both host oracles are read in a run where an ordinary URL browser tab from the same client does arrive in them, because a host that cannot project browser pages at all would otherwise answer the absence question the same way. A second journey quits that client with a document tab open and relaunches it on the same profile, which is the restore the user's original report turned on: the same workspace row comes back blank and named by the document, renders again, and does so over a grant URL that differs from the one that was quit. The same journey pins the guest URL to the orca-preview scheme, so a regression back to file:// or to a host browser page is visible. The rewritten journey caught a live gap the old one could not see: since previews became browser pages they had no chrome to hand focus to their guest, so main refused every reported link click as coming from an unfocused guest and the one route out of a preview was dead. Main's own log answered it — registered true, grant live, focused false — after the embedder reported the anchor really taking six real presses. The pane now hands focus over when it is the reader's surface, and the journey routes. The preview's own components moved out of the editor folder into browser-pane/workspace-doc/ with this change, since a preview is a browser pane and no longer an editor one; their i18n keys keep the historical auto.components.editor.HtmlDocPreview prefix rather than dropping thirty translated strings across four locales for a tidier key path. Seven gate commands named those files by their old paths and were re-issued at the new ones, and the nine dated runs behind them were retired rather than left naming files that are no longer there, on the same principle this gate already applied twice: vitest treats a missing named file as a filter and exits 0, so such a command reports green while silently running only the half that still exists. Each retired record's finding is carried into the replacement run recorded below it, including the red half of the entry/subresource pair, which was re-measured by re-applying its mutant at the new path rather than being dropped. The fence over the page-management channels was decided channel by channel before it was built, and that decision record is: of the 23 channels that can name a page, 6 are allowed for a workspace-document page — the tool channels the reader drives, which reach it through the one authority that reads both halves of the registry — 9 refuse (download accept and cancel, devtools, certificate proceed, client page metadata publish, viewport override, WebAuthn account response, registration probe, registration repair), 3 cannot name a page at all because they take a profile or a worktree instead, and the rest are the registration and activation doors, refused on membership. What shipped is not the per-channel guard that classification implies: eleven call sites read the browsing map directly, so a guard per channel is exactly the caller-flag seam that has to be remembered at every future call site. The registry was split in two instead, which makes the classification structural — a document guest is absent from the browsing map, so every refusing channel refuses by absence rather than by a guard, and a channel added later inherits the refusal without being classified at all. Unit contracts cover grant scoping and path containment, per-owner read routing, refusal of a truncated or over-cap read, the old-server binary degradation, scheme admission on will-attach-webview, the guest navigation policy, the plan layer's local/SSH/paired/out-of-worktree routing, and the distinct sentence the reader sees for each failure reason. The paired browser-creation surfaces this gate still owns — capability rejection cleanup, canonical page identity, reconciliation rollback, close convergence — keep their existing headed and headless journeys. Linux and Windows live journeys remain gaps. A refused subresource is a notice on a rendered document rather than a failure panel, since only the entry document's failure leaves the reader with nothing; the entry document is served as text by every owner and cannot be refused for its format at all. Grants die with the renderer document that minted them, at window creation and on every reload, because the renderer holds the only record of which preview owns which grant. The mint and revoke channels answer only the trusted renderer, and a preview tab is never republished to mobile clients, which have no grant to read it with. External URLs leave the preview only via a trusted user click on an anchor while the preview is focused; script-driven navigation and popups reach nothing. The guest's navigation sinks are deny-only and route no URL at all, and the guest carries a preview-only preload, pinned by will-attach-webview and denied to every other attach path, whose capture-phase click handler reports an anchor's URL to main; main answers only a report from a preview guest with a live bound grant that is the focused contents, and only for http(s). Two earlier reader-facing records from 2026-08-26, which measured a shape where a subresource failure was filtered out and the panel still carried an unsupported-asset sentence, were retired with that shape rather than left contradicting the 10/10 runs of the command they share. Two more were retired on the same principle when the external-link design changed: a record showing that removing a recent-input gate let the unattended document open two browser tabs, and a record showing that dropping the webview's allowpopups attribute left a target=_blank press with nothing to route. Both measured machinery that no longer exists — the input gate could not tell a script's navigation from the click it followed, which is the case now recorded below, and the preload intercepts the press before Chromium considers a popup at all, so allowpopups was removed. WebRTC is fenced by the guest's IP-handling policy alone: this Chromium answers a webrtc content-security-policy directive as unrecognized and gathers candidates anyway, so the directive is deliberately absent from the served policy and a unit assertion keeps it out. A standalone Electron probe on the same version gathered 7 candidates including a STUN reflexive one without the policy and 0 with it. Two command paths this gate used to carry no longer exist, and their structured evidence was retired with them rather than left naming files that are no longer there: vitest treats a missing named file as a filter and exits 0, so such a command reports green while silently running only the half that still exists. The first is src/renderer/src/lib/file-preview-capability-cleanup.test.ts, deleted in STA-5557 when HTML previews stopped creating paired browser tabs: on 2026-08-12 its five-assertion STA-4063 oracle ran red 5/5 on scan e4c278eb52 and on main bc2e30000b, partially green 2/5 on pre-fix PR #14100, and green 5/5 on candidate 14b5877a75; the surviving half of that oracle is web-runtime-browser-capability-cleanup.test.ts, still commanded above. The second is tests/e2e/paired-remote-html-browser-focus.spec.ts, renamed in STA-5557 to paired-remote-html-preview-local-render.spec.ts because the journey no longer proves anything about browser focus: its 2026-08-12 runs established the owning-runtime routing and no-focus-steal behavior of the then-current browser-tab preview (red on main 346e59c879 and a90a18d43d, green on candidates d05217c40d and b7de9c0961, red again with only the side-preview focus or routing seam disabled), and its 2026-08-26 runs are recorded below under the current path. An adversarial pass after the journey landed found four coverage gaps rather than shipping defects, and all four are pinned here. The page url had a third door: the navigation commit wrote whatever url was reported, unfenced, and while nothing reaches it for a document page today it sat one report away from giving a document page a URL that persistence, the publish boundary and the address bar all read. The group projection was the load-bearing half of the mobile publish boundary that no test had: removing it alone left the whole suite green, because no test in it had tab groups, while the phone payload gained a group whose order and active tab named a document tab it was never sent. The focus handoff was covered only in the narrowing direction, so widening it — dropping the page-activity check, or either half of the reader-surface check — survived both suites. And the handoff itself was offered once and never again, so another app taking the front left the preview's one route out shut until the pane remounted, which is a desktop gap rather than a test-only one. The standalone capability-cleanup and browser-placement ledger suites were removed, including their mixed-version rejection, cleanup transfer, capacity and partition alarms. web-runtime-session.test.ts no longer supplies browser creation, rollback or recovery assertions. The grouped workspace-document exclusion remains; the separate no-group publication example was removed. Existing live/browser-store evidence does not establish equivalent replacement alarms. Earlier descriptions of the removed fixtures and their run results are historical. The client-owned-placement and layout-groups suites are removed. The broad mirror fixture no longer supplies preview placement/reservation/move assertions. Browser rows retain pre-response replay and real local-workspace reuse; focus intent retains response ordering and exact-leaf sibling ordering. Supplied browser-layout and placement/focus projection alarms are lost; retained evidence is narrower and not equivalent. The test-value audit retires renderer grant-release mock ledgers, direct creation/title/session-field copies, notification/onboarding calls and several placement/per-page projections. Canonical-ID rejection, document reopen/restore and preview URL fences remain; they do not prove close-to-registry revocation or replace every lost alarm. Historical execution evidence is unchanged. The test-value audit removed the direct legacy editor-preview hydration example from tabs-hydration.test.ts. Dropping legacy preview chrome while preserving the same-document ordinary editor no longer has that alarm. The surviving corrupt-id deduplication case does not cover that migration, and retained preview journeys are not equivalent replacement coverage. Historical run counts and migration mutation findings describe the earlier suite. Audit1308: src/renderer/src/components/editor/EditorPanelShell.header.test.tsx removed. Header visibility and mocked editor-surface inventory alarms disappear. No equivalent replacement coverage is claimed. Audit1312 removes low-value imported specs from aggregate test drivers; old whole-driver execution receipts are archived. Retained registrations are unchanged. No equivalent replacement coverage is claimed. Audit1383: src/main/runtime/orca-runtime-tests/worktree-native-chat-setup.spec.ts reduced. Lose command-list/receipt/default/background activation matrices whose provider spawn returns canned IDs. Retained test proves actual tab allocation separation, not terminal startup. No equivalent replacement coverage is claimed. Existing exact unaffected receipts and their platform/provider/budget claims remain scoped to unchanged selectors. Changed optional selectors have no new execution result. Audit1386: src/renderer/src/lib/doc-preview-grants.test.ts reduced. Repeated-mount mint count, ordinary release/remint and failed-mint cache retry standalone alarms removed; no actual grant server/access test. No equivalent replacement coverage is claimed. Audit1401: src/main/runtime/orca-runtime-tests/mobile-session-tabs-duplicate-pty-repair.spec.ts removed. Loses listing-on-already-repaired-data alarm; it never established runtime repair invocation. src/main/runtime/orca-runtime-tests/mobile-session-tabs-split-agent-tab.spec.ts removed. Loses actual mobile split sibling shell versus recorded-agent resume command alarms; no equivalent coverage asserted. src/main/runtime/orca-runtime-tests/worktree-native-chat-setup.spec.ts removed. Loses separate setup/startup tab result in that manually assembled path. src/main/runtime/orca-runtime.test.ts reduced. Driver registration/import of a whole-deleted selected spec is removed; directly authored cases remain unchanged. No extra authored removal credit. No equivalent replacement coverage is claimed. The existing primary-selector receipt and its claims remain scoped to their unchanged sources; the broad optional command has no new execution result. Audit1412: src/main/browser/guest-lifecycle/manager/browser-manager-guest-policy-profile.test.ts removed. Loses workspace-document in-grant navigation/popup refusal, cleanup/re-attach, cross-registry guest authorization and browsing-map separation alarms. No equivalent browser policy coverage is claimed. No equivalent replacement coverage is claimed. Audit1421 removes browser-address-bar-suggestions.test.ts. Document suggestion title/path matching, recency merging and path-prefix ranking alarms are lost. No equivalent replacement coverage is claimed. Historical receipts remain scoped to unchanged selectors; the reduced command has no new execution result. Audit2452 removes the whole fake-effect browser-close routing suite. Active selectors and assertion references no longer select it. Its requested-worktree default close, sibling-page close and explicit missing-page typed reply alarms are intentionally retired without equivalent replacement. Prior dated receipts remain unchanged and scoped to their original sources; no fresh execution of the reduced gate, rendered browser, live remote, mobile or cross-platform validation is claimed.", + "coverageNotes": "Audit 3301 removes the caller-chat-target precedence over host selection example from web-session-tabs-sync-focus-intent.test.ts. The snapshot-before-RPC replay and split-sibling-first exact-leaf focus cases remain unchanged and match the existing assertion reference. Preserve current selectors, assertion references, unrelated active receipts and complete archived history. These mocked state-composition survivors provide no equivalent replacement, rendered, native, network or fresh execution proof. Audit3108: doc-preview-grants.test.ts now retains only the stale grant-rejection race: a late rejected grant request must not evict a newer grant registry entry, witnessed by later revocation of grant-2. Retire stable minted-location and outside-workspace POSIX/Windows request-projection alarms without replacement. The direct nonempty grant selector remains unchanged; no real grant-server/file authorization, SSH/HTML delivery or native-focus result is claimed. Audit2133 current-parent preparation: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2095 current-parent preparation2126: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2090 (sources2088/2089): Current reduced suites intentionally retire the alarms listed in knownGaps; prior dated execution and replacement claims do not validate changed source bytes or selectors. Historical prior account (preserved verbatim): Audit2086 (sources2082/2083): Current reduced suites intentionally retire the alarms listed in knownGaps; prior dated execution and replacement claims do not validate changed source bytes or selectors. Historical prior account (preserved verbatim): Audit2076 (sources2073/2074): Intentionally retire these low-value alarms without replacement: src/main/runtime/orca-runtime-tests/terminal-handles-part-02.spec.ts: recovers a moved SSH pane through the tab it now sits in, not the one its lease froze; reports a plain expired orphan; does not report a pane whose only recent lease was superseded; does not report a pane whose only recent lease had its relay id recycled; picks the eligible orphan over a superseded predecessor that matches first; collects the same tabs the per-tab reader reports, in one sweep of the leases; reports no candidate when no lease names any of the worktree tabs. src/main/runtime/orca-runtime-tests/runtime-availability.spec.ts: starts unavailable with no authoritative window; reports the configured Windows terminal shell on status; reports floating workspace availability from settings on status; polls floating tabs with targeted PTY liveness and no repo/provider inventory; hydrates persisted tabs when the store cannot report repos; advertises browser screencast only when a renderer window is available; routes mobile Codex reset consumption through the account mutation coordinator; maps a definite pre-provider rejection into an authoritative current snapshot. Existing unrelated evidenceRuns retain their original scope; unchanged dated receipt objects do not validate changed source bytes or reduced selectors. No fresh gate execution or historical import-closure equivalence is claimed. Frozen current literal-import graph reaches these changed test bytes; unresolved local and computed edges remain debt, and current reachability is not historical execution or equivalent replacement evidence. Historical prior account (preserved verbatim): Audit2043: Remove the registration-wait, webview-security, preview-authorization, guest-lifecycle and grant-IPC unit suites and the sibling-directory assertion reference. Runtime and browser capability consumers also lose removed imported examples. Remaining document-policy, file-reader and grant-registry assertions do not replace those alarms. Preserve the 27 independent dated receipts at their original unchanged selectors; reduced prospective unit selectors have no fresh result or equivalent replacement claim. Historical prior account (preserved verbatim): Audit1973: Delete the browser RPC forwarding/schema/scalar suite and its prospective selector. Preserve all27 unrelated dated receipts; no actual browser operation alarm is replaced. Whole original changed dated receipts are retired, never narrowed or transferred. This metadata review claims no fresh execution, equivalent replacement, provider/PTY, live remote/mobile, rendered, cross-platform, soak or measured-budget result. Historical prior account (preserved verbatim): Audit1925 (sources1922/1923): The complete terminal-file-link-actions suite is removed. Lose supplied local/remote menu-row inventories, browser label/order/download/reveal callback forwarding, platform-copy and source-group pinning examples. No OS reveal/download, real remote preview or browser navigation was exercised; the other real document-preview sources are not equivalent replacements. Preserve meaningful remaining selectors/assertions and unchanged dated receipts within their original scope. Reduced selectors have no fresh gate execution evidence in this metadata packet. No equivalent replacement, physical watcher/PTY/provider, live SSH/remote/mobile, rendered, cross-platform, soak or measured-budget result is claimed. Historical prior account (preserved verbatim): Audit1899 replays sealed Audit1895: workspace-doc-history.test.ts is entirely removed from its current command and testFiles. Supplied recency/dedupe/cap/title/identity examples and the10000-row getter-read budget alarm are intentionally lost. No current assertionRef or active receipt selects that file. Unrelated active receipts and all prior gap literals remain verbatim; no replacement history/index-work coverage or new browser/paired-preview gate execution is claimed. Historical coverage account before Audit1899: Audit1853 reduces LinkActionPopover.test.tsx and archives its complete 2026-09-06 mixed-selector receipt. The lost copy/open-state and Settings callback-order/omission alarms are accepted without equivalent replacement coverage. No fresh execution of this gate is credited. Audit1709 removes low-value test definitions and retires affected assertion or execution-receipt claims without equivalent replacement coverage. Per-source reviews bound retained behavior and injected/native/remote limits. Unchanged assertions and receipts keep their original scope; gates lacking current active evidence are downgraded. Historical scope before this audit: Audit1687 removes low-value test projections, mock wiring, private-state assertions, inventories and duplicate examples without equivalent replacement coverage. Per-source reviews record retained public behavior and refusal boundaries with injected/native/remote limits. Affected historical receipts are retired; gates without active current evidence are downgraded. Historical scope before this audit: Audit1630 removes low-value Git, GitHub/GitLab and IPC projections, argument inventories and duplicate examples without equivalent replacement coverage. Per-source reviews record retained cancellation, ownership, authorization, filesystem and SQLite boundaries with injected/native/remote limits. Affected historical receipts are retired; gates without active current evidence are downgraded. Historical scope before this audit: Audit1571 removes mock forwarding, capability/schema inventories, private predicates, supplied error/result replays, and filesystem-mocked persistence checks without equivalent replacement claims. Retained changed tests also exercise real local permission-file reread, registry proxy rollback/credential retirement, site display recovery, and pending sender/credential/document admission with injected Electron/UI producers. Retained network tests exercise owned stream credit/cleanup, generation and retirement fences, real loopback proxy/SOCKS bytes and file-backed binding state. SSH/WSL/paired runtime, native sessions, authority producers and storage clears remain injected; simulated relaunch uses filesystem mocks. The unchanged profile-retirement suite was statically reviewed and not rerun. No actual SSH/WSL runtime, native Chromium jar deletion, durable process restart, remote DNS or external site proof. Receipts selecting changed tests are retired and unaffected receipts remain unchanged. Historical scope before this audit: Audit1568 removes API inventories, supplied mock-value/forwarding assertions, implementation-shape tables and negative/setup cases that do not reach their intended boundary, without equivalent replacement claims. Retained changed definitions exercise owned manager lifetime/queue/refcount/clamp and real synthetic process/files/staging boundaries. Seventeen unchanged native Electron definitions across this combined audit are statically reviewed and not rerun. Changed native suites exercise local popup wire/cookie/session and clean/native process-identity behavior; known popup-admission flaws remain unfixed. Unit native/event/session/registry inputs remain injected. No actual OS focus, registry/host execution, CRX verification or durable restart proof. Receipts selecting changed tests are retired and unaffected receipts remain unchanged. Historical scope before this audit: Audit1564 retires copied cookie key recipes, mock bridge/preview forwarding and flag tables, source-spelling/script inventories and setup-only alarms without equivalent replacement coverage. Retained changed cases exercise actual scoped SQLite merge/rollback/schema refusal, owned cancellation and grant authority/canonical containment, ranged response consistency, replacement guest ownership and executed guest-script promise/DOM cleanup behavior. Session, host response, geometry/observer and transport producers remain injected where documented. One unchanged native extension definition is not rerun locally; no actual remote filesystem, native layout/focus or authentication claim. Receipts selecting modified tests are retired; unaffected exact-selector receipts remain unchanged. Historical scope before this audit: Audit1412 changes referenced sources. Retained unchanged-source receipts apply only to their unchanged commands; the reduced selectors have no new execution result. Historical coverage account (not a current claim for changed sources): Audit1386 changes referenced sources; no new execution result validates reduced selectors. Retained unchanged receipts apply only to unchanged commands. Historical coverage: Audit1308 changes referenced sources. Retained unchanged-source receipts apply only to their unchanged commands; the reduced selectors have no new execution result. Historical coverage account (not a current claim for changed sources): A macOS desktop host and a separate paired Electron client exercise the Explorer preview action end to end: the document renders inside the client-local orca-preview guest, the client gains exactly one browser workspace and it is the document one, the host's own page registry and tab snapshot gain nothing, the split does not take focus from the source editor, an explicit click activates the preview, and closing it with its X leaves the editor and terminal intact. Both host oracles are read in a run where an ordinary URL browser tab from the same client does arrive in them, because a host that cannot project browser pages at all would otherwise answer the absence question the same way. A second journey quits that client with a document tab open and relaunches it on the same profile, which is the restore the user's original report turned on: the same workspace row comes back blank and named by the document, renders again, and does so over a grant URL that differs from the one that was quit. The same journey pins the guest URL to the orca-preview scheme, so a regression back to file:// or to a host browser page is visible. The rewritten journey caught a live gap the old one could not see: since previews became browser pages they had no chrome to hand focus to their guest, so main refused every reported link click as coming from an unfocused guest and the one route out of a preview was dead. Main's own log answered it — registered true, grant live, focused false — after the embedder reported the anchor really taking six real presses. The pane now hands focus over when it is the reader's surface, and the journey routes. The preview's own components moved out of the editor folder into browser-pane/workspace-doc/ with this change, since a preview is a browser pane and no longer an editor one; their i18n keys keep the historical auto.components.editor.HtmlDocPreview prefix rather than dropping thirty translated strings across four locales for a tidier key path. Seven gate commands named those files by their old paths and were re-issued at the new ones, and the nine dated runs behind them were retired rather than left naming files that are no longer there, on the same principle this gate already applied twice: vitest treats a missing named file as a filter and exits 0, so such a command reports green while silently running only the half that still exists. Each retired record's finding is carried into the replacement run recorded below it, including the red half of the entry/subresource pair, which was re-measured by re-applying its mutant at the new path rather than being dropped. The fence over the page-management channels was decided channel by channel before it was built, and that decision record is: of the 23 channels that can name a page, 6 are allowed for a workspace-document page — the tool channels the reader drives, which reach it through the one authority that reads both halves of the registry — 9 refuse (download accept and cancel, devtools, certificate proceed, client page metadata publish, viewport override, WebAuthn account response, registration probe, registration repair), 3 cannot name a page at all because they take a profile or a worktree instead, and the rest are the registration and activation doors, refused on membership. What shipped is not the per-channel guard that classification implies: eleven call sites read the browsing map directly, so a guard per channel is exactly the caller-flag seam that has to be remembered at every future call site. The registry was split in two instead, which makes the classification structural — a document guest is absent from the browsing map, so every refusing channel refuses by absence rather than by a guard, and a channel added later inherits the refusal without being classified at all. Unit contracts cover grant scoping and path containment, per-owner read routing, refusal of a truncated or over-cap read, the old-server binary degradation, scheme admission on will-attach-webview, the guest navigation policy, the plan layer's local/SSH/paired/out-of-worktree routing, and the distinct sentence the reader sees for each failure reason. The paired browser-creation surfaces this gate still owns — capability rejection cleanup, canonical page identity, reconciliation rollback, close convergence — keep their existing headed and headless journeys. Linux and Windows live journeys remain gaps. A refused subresource is a notice on a rendered document rather than a failure panel, since only the entry document's failure leaves the reader with nothing; the entry document is served as text by every owner and cannot be refused for its format at all. Grants die with the renderer document that minted them, at window creation and on every reload, because the renderer holds the only record of which preview owns which grant. The mint and revoke channels answer only the trusted renderer, and a preview tab is never republished to mobile clients, which have no grant to read it with. External URLs leave the preview only via a trusted user click on an anchor while the preview is focused; script-driven navigation and popups reach nothing. The guest's navigation sinks are deny-only and route no URL at all, and the guest carries a preview-only preload, pinned by will-attach-webview and denied to every other attach path, whose capture-phase click handler reports an anchor's URL to main; main answers only a report from a preview guest with a live bound grant that is the focused contents, and only for http(s). Two earlier reader-facing records from 2026-08-26, which measured a shape where a subresource failure was filtered out and the panel still carried an unsupported-asset sentence, were retired with that shape rather than left contradicting the 10/10 runs of the command they share. Two more were retired on the same principle when the external-link design changed: a record showing that removing a recent-input gate let the unattended document open two browser tabs, and a record showing that dropping the webview's allowpopups attribute left a target=_blank press with nothing to route. Both measured machinery that no longer exists — the input gate could not tell a script's navigation from the click it followed, which is the case now recorded below, and the preload intercepts the press before Chromium considers a popup at all, so allowpopups was removed. WebRTC is fenced by the guest's IP-handling policy alone: this Chromium answers a webrtc content-security-policy directive as unrecognized and gathers candidates anyway, so the directive is deliberately absent from the served policy and a unit assertion keeps it out. A standalone Electron probe on the same version gathered 7 candidates including a STUN reflexive one without the policy and 0 with it. Two command paths this gate used to carry no longer exist, and their structured evidence was retired with them rather than left naming files that are no longer there: vitest treats a missing named file as a filter and exits 0, so such a command reports green while silently running only the half that still exists. The first is src/renderer/src/lib/file-preview-capability-cleanup.test.ts, deleted in STA-5557 when HTML previews stopped creating paired browser tabs: on 2026-08-12 its five-assertion STA-4063 oracle ran red 5/5 on scan e4c278eb52 and on main bc2e30000b, partially green 2/5 on pre-fix PR #14100, and green 5/5 on candidate 14b5877a75; the surviving half of that oracle is web-runtime-browser-capability-cleanup.test.ts, still commanded above. The second is tests/e2e/paired-remote-html-browser-focus.spec.ts, renamed in STA-5557 to paired-remote-html-preview-local-render.spec.ts because the journey no longer proves anything about browser focus: its 2026-08-12 runs established the owning-runtime routing and no-focus-steal behavior of the then-current browser-tab preview (red on main 346e59c879 and a90a18d43d, green on candidates d05217c40d and b7de9c0961, red again with only the side-preview focus or routing seam disabled), and its 2026-08-26 runs are recorded below under the current path. An adversarial pass after the journey landed found four coverage gaps rather than shipping defects, and all four are pinned here. The page url had a third door: the navigation commit wrote whatever url was reported, unfenced, and while nothing reaches it for a document page today it sat one report away from giving a document page a URL that persistence, the publish boundary and the address bar all read. The group projection was the load-bearing half of the mobile publish boundary that no test had: removing it alone left the whole suite green, because no test in it had tab groups, while the phone payload gained a group whose order and active tab named a document tab it was never sent. The focus handoff was covered only in the narrowing direction, so widening it — dropping the page-activity check, or either half of the reader-surface check — survived both suites. And the handoff itself was offered once and never again, so another app taking the front left the preview's one route out shut until the pane remounted, which is a desktop gap rather than a test-only one. The standalone capability-cleanup and browser-placement ledger suites were removed, including their mixed-version rejection, cleanup transfer, capacity and partition alarms. web-runtime-session.test.ts no longer supplies browser creation, rollback or recovery assertions. The grouped workspace-document exclusion remains; the separate no-group publication example was removed. Existing live/browser-store evidence does not establish equivalent replacement alarms. Earlier descriptions of the removed fixtures and their run results are historical. The client-owned-placement and layout-groups suites are removed. The broad mirror fixture no longer supplies preview placement/reservation/move assertions. Browser rows retain pre-response replay and real local-workspace reuse; focus intent retains response ordering and exact-leaf sibling ordering. Supplied browser-layout and placement/focus projection alarms are lost; retained evidence is narrower and not equivalent. The test-value audit retires renderer grant-release mock ledgers, direct creation/title/session-field copies, notification/onboarding calls and several placement/per-page projections. Canonical-ID rejection, document reopen/restore and preview URL fences remain; they do not prove close-to-registry revocation or replace every lost alarm. Historical execution evidence is unchanged. The test-value audit removed the direct legacy editor-preview hydration example from tabs-hydration.test.ts. Dropping legacy preview chrome while preserving the same-document ordinary editor no longer has that alarm. The surviving corrupt-id deduplication case does not cover that migration, and retained preview journeys are not equivalent replacement coverage. Historical run counts and migration mutation findings describe the earlier suite. Audit1308: src/renderer/src/components/editor/EditorPanelShell.header.test.tsx removed. Header visibility and mocked editor-surface inventory alarms disappear. No equivalent replacement coverage is claimed. Audit1312 removes low-value imported specs from aggregate test drivers; old whole-driver execution receipts are archived. Retained registrations are unchanged. No equivalent replacement coverage is claimed. Audit1383: src/main/runtime/orca-runtime-tests/worktree-native-chat-setup.spec.ts reduced. Lose command-list/receipt/default/background activation matrices whose provider spawn returns canned IDs. Retained test proves actual tab allocation separation, not terminal startup. No equivalent replacement coverage is claimed. Existing exact unaffected receipts and their platform/provider/budget claims remain scoped to unchanged selectors. Changed optional selectors have no new execution result. Audit1386: src/renderer/src/lib/doc-preview-grants.test.ts reduced. Repeated-mount mint count, ordinary release/remint and failed-mint cache retry standalone alarms removed; no actual grant server/access test. No equivalent replacement coverage is claimed. Audit1401: src/main/runtime/orca-runtime-tests/mobile-session-tabs-duplicate-pty-repair.spec.ts removed. Loses listing-on-already-repaired-data alarm; it never established runtime repair invocation. src/main/runtime/orca-runtime-tests/mobile-session-tabs-split-agent-tab.spec.ts removed. Loses actual mobile split sibling shell versus recorded-agent resume command alarms; no equivalent coverage asserted. src/main/runtime/orca-runtime-tests/worktree-native-chat-setup.spec.ts removed. Loses separate setup/startup tab result in that manually assembled path. src/main/runtime/orca-runtime.test.ts reduced. Driver registration/import of a whole-deleted selected spec is removed; directly authored cases remain unchanged. No extra authored removal credit. No equivalent replacement coverage is claimed. The existing primary-selector receipt and its claims remain scoped to their unchanged sources; the broad optional command has no new execution result. Audit1412: src/main/browser/guest-lifecycle/manager/browser-manager-guest-policy-profile.test.ts removed. Loses workspace-document in-grant navigation/popup refusal, cleanup/re-attach, cross-registry guest authorization and browsing-map separation alarms. No equivalent browser policy coverage is claimed. No equivalent replacement coverage is claimed. Audit1421 removes browser-address-bar-suggestions.test.ts. Document suggestion title/path matching, recency merging and path-prefix ranking alarms are lost. No equivalent replacement coverage is claimed. Historical receipts remain scoped to unchanged selectors; the reduced command has no new execution result. Audit2452 removes the whole fake-effect browser-close routing suite. Active selectors and assertion references no longer select it. Its requested-worktree default close, sibling-page close and explicit missing-page typed reply alarms are intentionally retired without equivalent replacement. Prior dated receipts remain unchanged and scoped to their original sources; no fresh execution of the reduced gate, rendered browser, live remote, mobile or cross-platform validation is claimed.", "motivatingLinks": [ "https://linear.app/stably/issue/STA-5557/remote-html-preview-render-workspace-files-locally-over-the-file", "https://linear.app/stably/issue/STA-3872/unable-to-open-html-files-in-remote-server", @@ -4439,7 +4424,7 @@ "https://github.com/stablyai/orca/pull/13876" ], "invariant": "Opening one HTML preview from a paired client renders the workspace document in exactly one client-local browser tab, located by that document and served over the orca-preview scheme. The client gains exactly that one browser workspace and it is the document one — blank where a URL page carries a URL, named by the document, with the chip naming the file — while the host gains no browser page at all, neither in its own page registry nor in the tab snapshot its clients publish into. The preview occupies its own split without taking focus from the source editor; an explicit click activates it, and closing it removes only the preview. Following a document from a file link is the other half of that switch and does move the reader to it, tab group included, whether the preview is new or already open, because opening a file is a request to look at it. A document tab quit with the client comes back as the same row on a grant the relaunched client mints afresh. A preview is named by the browser page it is open in, not by a namespace of its own, and the page registry has two halves: a workspace-document guest is registered in its own map and is absent from the browsing one entirely. That absence is the fence. Page, session and profile management, agent tab enumeration and command targeting, download routing and certificate attribution all read the browsing map directly, in more places than a per-channel guard could be remembered in, so none of them can name a document page and none of them carries a guard. Browser tools the reader drives (element grab, hover describe, selection capture, the annotation viewport bridge) are the one operation that legitimately spans the halves, and they go through the single authority that reads both, keyed by the page and its hosting renderer. The halves are disjoint in both directions: browsing registration refuses a page the document half already holds, and minting a grant refuses a page the browsing half already holds, so one id can never name a surface in both. The headless backend acts on that refusal by destroying the window it had already opened rather than leaving a policy-less page behind an id nothing can drive, keeping nothing under that id for its own shutdown to hand back. Registration refuses on the same terms when the guest it was asked about is already gone. The exit door is guarded in both its halves: a preview withdraws by revoking its grant and never through the unregister channel, so a page the document half holds arriving there is refused before either the registration teardown or the grab-state disposal beside it, which would otherwise drop the intent an in-flight preview grab compares by identity and leave that grab answering ok without ever arming its guest. A bridge request whose guest does not resolve is refused without tearing down the page it named, so a misaddressed request cannot cancel a healthy page's in-flight downloads and grabs. The annotation viewport bridge resolves its guest when its serialized op actually runs rather than when the request arrived, so a cross-process navigation while it waited cannot leave the bridge installed in a retired guest while the reader looks at a new one. State main keys by a preview's page is disposed when that page's grant is revoked, which is the only signal a preview's surface is gone. A tool asking for a page whose guest has not attached yet waits for that registration and arms when it arrives, rather than answering not-ready at the reader; that wait resolves only the request already naming this page, never the worktree-wide or any-tab waits the CLI and agents use to ask for a browser tab to drive. Handing the previewed document to the reader's own machine routes on the owners its grant was minted against — the file's own connection owner and the worktree's own runtime owner, neither read from the tab's stored fields. Only a document proven to live on this machine reaches the client OS; one with a resolved remote owner is downloaded first; and one whose owner cannot be resolved at all, workspace root included, is refused with a message naming that, because the download route would otherwise read the same absolute path on the client and hand back a same-named local file under the remote document's name. A runtime-owned path that falls outside its worktree root is refused by that route itself and surfaces as a failure toast rather than a download. Nothing the document does writes a file to this machine either: the preview partition denies downloads outright instead of routing them through the browser download flow, which has no page to attribute a preview's bytes to and would otherwise reserve a name in this desktop's Downloads folder and write them there unprompted. That refusal is visible to the reader and invisible to the document: the preview's shell carries a fixed sentence saying downloads are off, published at most once per preview per interval so a document asking in a loop cannot fill Orca's chrome, while the page itself gets back exactly what it got before, which is nothing. The sentence names no file, because the document chooses the name it offers; and a refusal never takes the document away the way an entry document's own failure does, whatever it names. A preview is a browser tab, not an editor tab in a preview mode: it is named the way a browser tab is named — by the document it shows when that document declares a title, and by the file it shows when it does not — while the chip goes on naming the file and the host whatever the document calls itself. A title is refused on the same terms the url is: a document that declares none has Chromium report the grant URL as its title, and that title is stored, mirrored onto the tab and written to disk, so anything carrying the scheme falls back to the file instead. It is created by the preview action as a page located by its document, it carries the workspace-relative path copy the editor's path header owned, and closing it revokes the grant that made the document readable while a URL tab closing beside it revokes nothing. Chrome persisted by builds that made previews editor tabs is dropped on restore rather than coming back naming a surface no restore can produce, and the ordinary editor tab for the same document is left alone. A document tab is held back at the mobile publish boundary — no client holds its grant, and the wire has no tab kind for it — while an ordinary browser tab beside it still publishes. It is held back from the group projection that publishes tab order, recency and group activity as well as from the tab list itself, so no published group names a tab the phone is never sent. A browser page can be located by a workspace document instead of a URL, and the document is the whole of its stored identity. The grant and the orca-preview URL that document is served over are minted when the page mounts and replaced by a hard reload, so neither is ever written to the page's url, mirrored onto its tab, persisted or published: such a page's url is the blank URL from creation through restore, including when a session written elsewhere carries a grant URL in, and what the session carries is the worktree and path a restored page mints afresh against today's owners. Every door onto a page's url holds that line — creation, the title update, and the navigation commit alike — so a report about a document page cannot give it a URL it never had, and the title fallback and the loading affordance follow the url each door actually wrote. The mirror carries the document too, so a tab entry cannot go on naming a document its active page has left. Every guest in the app is policy-attached through one door: a workspace document takes a restricted profile there rather than a separate installer beside it, so the attachment bookkeeping that door owns — what registration refuses, and what teardown frees — covers a preview on the same terms as a browsing page, and a preview takes none of the browsing machinery that door installs. That authority answers from the moment the embedder hands the guest over rather than only after a later navigation: the guest binds to the grant it is already showing, so the tools reach the document the reader opened and not just one they navigated to. A read the host reports as truncated or over-cap is refused rather than served partially, and a document outside the paired worktree is refused with a message naming that boundary instead of a bare read failure. The rendered document reaches nothing off-machine on its own: every served response carries a self-only content security policy, the preview session cancels any request that is not in-document, subframes cannot navigate outside the grant, a guest no document has yet bound to a grant may not navigate at all, the guest gathers no ICE candidates, and an SSH path that canonicalizes outside the grant root is refused before it is read. The one route out is a link the reader presses: a trusted click on an anchor, reported by the preview's own preload from a guest still bound to a live grant, leaves through the configured browser destination and captured source route — and only after the reader confirms the exact destination URL, so a document cannot spend a single stray press exfiltrating what it can read into a link it authored. The preview hands its guest that focus itself whenever it is the surface the reader is in — a browsing page gets it from the chrome around it, and a preview has no chrome to get it from — and it does so only then, so a preview mounted behind a terminal or an editor never takes the keyboard from what the reader is actually in. It offers again when the window itself takes focus back and nothing in the embedder has claimed that focus, because another app coming to the front lands focus on the embedder rather than the guest and the route out would otherwise stay shut until something remounted the pane — while the same window focus also arrives when the reader presses a tab, that being the guest's own blur returning, and taking focus back from there would fight the reader for their own click. Nothing else does. A navigation or popup the document starts by itself is swallowed whatever else is happening, including immediately after a genuine press elsewhere in the document, so a page that can read its grant cannot hand it to a browser tab; a middle click opens nothing; and a fragment link is answered inside the document. A preview attach carries the preview preload and no renderer-supplied one, and no other attach path can acquire it. A subresource the workspace will not send degrades the document to a notice naming that file, never to a failure panel over a page that rendered. A grant outlives neither the tab that owns it nor the renderer document that minted it, and only the trusted renderer can mint or revoke one. For the browser creations this gate still owns, owner-pinned creation returns the canonical host page identity before navigation readiness; delayed navigation cannot turn a created page into an unidentifiable failure or a duplicate retry. Capability rejection before host mutation must preserve the original error, issue no RPC, surface a failure toast, and remove only a caller-declared newly-created empty split. Post-create reconciliation failure requires exact rollback; ambiguous rollback rejects without local fallback.", - "oracle": "Audit3108: doc-preview-grants.test.ts now retains only the stale grant-rejection race: a late rejected grant request must not evict a newer grant registry entry, witnessed by later revocation of grant-2. Retire stable minted-location and outside-workspace POSIX/Windows request-projection alarms without replacement. The direct nonempty grant selector remains unchanged; no real grant-server/file authorization, SSH/HTML delivery or native-focus result is claimed. Audit2133 current-parent preparation: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2095 current-parent preparation2126: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2090 (sources2088/2089): Current reduced suites intentionally retire the alarms listed in knownGaps; prior dated execution and replacement claims do not validate changed source bytes or selectors. Historical prior account (preserved verbatim): Audit2086 (sources2082/2083): Current reduced suites intentionally retire the alarms listed in knownGaps; prior dated execution and replacement claims do not validate changed source bytes or selectors. Historical prior account (preserved verbatim): Audit2076 (sources2073/2074): Intentionally retire these low-value alarms without replacement: src/main/runtime/orca-runtime-tests/terminal-handles-part-02.spec.ts: recovers a moved SSH pane through the tab it now sits in, not the one its lease froze; reports a plain expired orphan; does not report a pane whose only recent lease was superseded; does not report a pane whose only recent lease had its relay id recycled; picks the eligible orphan over a superseded predecessor that matches first; collects the same tabs the per-tab reader reports, in one sweep of the leases; reports no candidate when no lease names any of the worktree tabs. src/main/runtime/orca-runtime-tests/runtime-availability.spec.ts: starts unavailable with no authoritative window; reports the configured Windows terminal shell on status; reports floating workspace availability from settings on status; polls floating tabs with targeted PTY liveness and no repo/provider inventory; hydrates persisted tabs when the store cannot report repos; advertises browser screencast only when a renderer window is available; routes mobile Codex reset consumption through the account mutation coordinator; maps a definite pre-provider rejection into an authoritative current snapshot. Existing unrelated evidenceRuns retain their original scope; unchanged dated receipt objects do not validate changed source bytes or reduced selectors. No fresh gate execution or historical import-closure equivalence is claimed. Frozen current literal-import graph reaches these changed test bytes; unresolved local and computed edges remain debt, and current reachability is not historical execution or equivalent replacement evidence. Historical prior account (preserved verbatim): Audit2043: Remove the registration-wait, webview-security, preview-authorization, guest-lifecycle and grant-IPC unit suites and the sibling-directory assertion reference. Runtime and browser capability consumers also lose removed imported examples. Remaining document-policy, file-reader and grant-registry assertions do not replace those alarms. Preserve the 27 independent dated receipts at their original unchanged selectors; reduced prospective unit selectors have no fresh result or equivalent replacement claim. Historical prior account (preserved verbatim): Audit1973: Delete the browser RPC forwarding/schema/scalar suite and its prospective selector. Preserve all27 unrelated dated receipts; no actual browser operation alarm is replaced. Whole original changed dated receipts are retired, never narrowed or transferred. This metadata review claims no fresh execution, equivalent replacement, provider/PTY, live remote/mobile, rendered, cross-platform, soak or measured-budget result. Historical prior account (preserved verbatim): Audit1925 (sources1922/1923): The complete terminal-file-link-actions suite is removed. Lose supplied local/remote menu-row inventories, browser label/order/download/reveal callback forwarding, platform-copy and source-group pinning examples. No OS reveal/download, real remote preview or browser navigation was exercised; the other real document-preview sources are not equivalent replacements. Preserve meaningful remaining selectors/assertions and unchanged dated receipts within their original scope. Reduced selectors have no fresh gate execution evidence in this metadata packet. No equivalent replacement, physical watcher/PTY/provider, live SSH/remote/mobile, rendered, cross-platform, soak or measured-budget result is claimed. Historical prior account (preserved verbatim): Audit1709 retires changed-source assertion and execution scope without equivalent replacement coverage. Existing unchanged-selector receipts remain scoped to their original sources. Historical prior-source oracle: Audit1687 retires changed-source assertion and execution scope without equivalent replacement coverage. Existing unchanged-selector receipts remain scoped to their original sources. Historical prior-source oracle: Audit1421 narrows renderer unit coverage as recorded in coverageNotes. Prior oracle descriptions are historical for the changed suite. The retained unchanged-source receipts are the only current execution evidence; reduced-source assertions await validation. Historical oracle account (not a current claim for changed sources): Retained unchanged-selector receipts are the only current execution evidence. Reduced-source assertions await validation. Historical prior oracle: The retained unchanged-source receipts are the only current execution evidence; reduced-source assertions await validation. Historical oracle account (not a current claim for changed sources): In paired Electron, write an HTML fixture that declares its own title on the host, invoke the Explorer preview action on the client, and require the document text to be readable out of the orca-preview guest before judging any absence. With that presence established, require the client to hold exactly one browser workspace more than its baseline and that workspace to be the document one: page and tab url blank, the document path mirrored onto both, the tab named by the document's title, the chip naming the file, no editor row of the retired preview species anywhere, and the guest URL carrying the orca-preview scheme. Ask the host through its own page registry as well as through the tab snapshot, and in the same run open an ordinary URL browser tab from the same client and require that one to arrive in both — the presence precondition without which “the host gained nothing” is satisfied just as well by an oracle that cannot see browser pages at all. Require the preview to sit in a group other than the source editor's while the active group and tab remain the source editor's. Then click away to the terminal, click the preview tab, require it to reactivate and still render, close it with its own X, and require the document tab to be gone while the host still holds only the URL tab and the source group, source editor and terminal survive. Quit the client with a document tab open and relaunch it on the same profile: require the same workspace row to come back, blank and named by the document, rendering the document again over a grant URL that differs from the one that was quit, with no preview-scheme or document-named page anywhere in what the host holds. Prove the halves are live by flipping one product property at a time and requiring the run to fail: publish document workspaces to the host like ordinary ones, and stop mirroring the document onto the workspace row. Have the fixture document attempt its own egress on every load — an unattended window.open and location.href to an off-machine URL, plus an inline ICE gathering probe — and require the same baseline counts and a candidate count of zero, so the document's own attempts are measured rather than assumed. Then, as a separate phase after the close oracle has already run, bring the client window to the front, press the document's heading with a real mouse event, and require the document to report that the same press drove it to attempt a second window.open and location.href while both browser counts stay at that phase's baseline and nothing routes — the case a recent-input gate cannot distinguish from the press's own effect. Only then press the target=_blank link with a real mouse event and require both a recorded routing call that returned success and a browser count above that baseline, with the preview tab still open. Drive the preload's click policy as a unit oracle over a real document: a dispatched click, a trusted press on an external anchor, an anchor reached through what it wraps, an SVG animated href, a sibling preview link, fragment and percent-encoded fragment targets, a bare hash, and a middle click. Create a browser page located by a workspace document, handing creation a live grant URL, and require its stored url, its mirrored tab url and the written session payload all to be blank with no orca-preview string anywhere in what was written, while an ordinary page created the same way keeps the URL it was given and asks for the address bar the document page never does. Parse the written page and tab through the session schema and require the document to survive both halves. Hydrate them back and require the document page to return blank and still named — including when its page row was salvaged away and only the tab's own copy remains, and when a foreign session carried a grant URL into both rows. Drive the mirror across a page switch out of the document and back, and across a repair in which the document is the only mirrored field that differs. Name a document page from its document and require the tab to take that name, name it with an empty title and require the file, name it with a live grant URL and require the file again with no preview scheme anywhere in the written session, and require an ordinary blank browser tab beside it to still be called New Tab. Dispatch a title update out of a rendered preview's own guest and require it to reach the page state while the identity chip still reads the document's workspace-relative path. Attach a browsing guest and a workspace-document guest through the same method in one run and require the browsing one to take clicked-link routing, popup handling and auth-identity detach tracking while the document guest takes none of them, stays inside the grant it is showing, denies every window it asks for, and is dropped from the page-keyed document registry by the same teardown that frees its id for a later attach. Register a browsing guest and attach a workspace-document guest in one run against the real manager, require the one door to answer each page with the guest of its own half, and require the document page to be absent from the browsing map and from its enumeration. Drive both browsing registration entry points with a page the document half already holds and require them to register nothing, and drive the mint channel with a page the browsing half already holds and require it to refuse; and drive the offscreen one with a guest that is missing and with one already destroyed, requiring the same refusal. Arm a grab on a live preview target, drive the unregister channel at that same target in the window before the queued operation runs, and require the grab to reach the guest anyway — then drive the same sequence for an ordinary browser page and require its grab state to be disposed after all. Hold one viewport-bridge op open, queue a second behind it, swap the page's guest while that second op waits, and require the injection to land in the guest the page has then. Revoke a grant after a tool has run against its page and require that page's grab state to be cancelled and disposed. Ask a tool for a document page whose guest has not attached, require the request to park in the registration wait, attach the guest, and require the same request to arm on it; require a page nothing ever renders to answer not-ready once that wait elapses. With a document open, ask a tool for a browsing page id and require it to be answered by the browsing half or not at all, with the same channel reaching the document guest under the page it really renders. Drive open-externally for a document whose per-file owner is remote while the workspace-scoped owner is unresolved, for a runtime-owned worktree whose preview tab carries no runtime id of its own, and for a worktree that resolves no runtime owner while the tab still carries one, requiring the download route in each; and for an owner that cannot be resolved at all, and for an unknown workspace root while nothing names another host, requiring a refusal that neither opens nor downloads. Drive the headless backend with a page the document half already holds and require it to reject, destroy the window, and unregister nothing — then shut the backend down and require it still to have unregistered nothing. Navigate a bound preview guest at a second grant through both latch events and require it to stay on the grant it bound to. Mount a preview while a renderer drag is already in flight and require its guest to be click-through at the moment it is appended, not a turn later. Render the editor panel shell in each remaining tab mode and require the path header exactly where the surface does not already name itself. Drive the preview action and require a browser tab located by the document rather than an editor tab, require a second open of the same document to activate the tab it is already in, and require closing that tab to revoke its grant while a URL tab closed beside it revokes none. Publish a worktree holding a document tab and a URL tab and require only the URL tab to reach the mobile snapshot. Install the shared partition policies for a preview partition and for an ordinary browsing partition in the same run, fire each one's own will-download listener, and require the preview's to cancel while the browsing one still reaches the download router — then require the preview protocol installer to be what asks for that deny. In the same run, require the cancelled download to raise a reader-facing notice and the routed one to raise none. require the guest registry to name the bound grant for a live preview guest and nothing for a contents that is not one, has committed no document, or is gone. Drive the shell with a refusal and require one fixed sentence, still one row after three more refusals, standing beside an asset failure rather than being counted with it, gone behind the failure panel, and ignored when it names another preview's grant. Drive the main-side report gate directly for a sender that is no preview guest, a guest with no bound or a revoked grant, a genuine press Electron's webview focus flag misreports as unfocused, and non-web URLs; drive the reader-facing confirmation for accept, cancel, and a confirmed tab the browser refuses; and drive will-attach-webview in both preload directions. Run the per-owner reader, grant-containment, scheme-admission, guest-policy, and plan-routing contracts as unit oracles, including a host-reported truncation, an over-cap binary, and an out-of-worktree paired path. Drive the reader-facing component with the payloads the reader can actually produce — the entry document fails only as truncated or unreadable, a subresource additionally as a refused format — and require the asset case to leave the guest mounted. Drive the closed-tab cleanup hook, the window installer, and the grant IPC handlers directly, requiring the grant to be released when the preview tab closes, cleared at window creation and on a cross-document main-frame navigation, and refused to any sender that is not the trusted renderer. For the browser creations this gate still owns, run the unchanged contract oracle for direct create and side-preview callers with absent status, unknown capabilities, and a mixed-version host, requiring the original unsupported error or visible toast, zero RPCs, and no retained new split; hold a real navigation response beyond the 15-second client deadline after host creation and require the first RPC to return the exact host inventory page ID, one host page, and no retry; repeat reconciliation faults against headless serve and retain the separate exact-page reconciliation rollback oracle. Audit2452 removes the whole fake-effect browser-close routing suite. Active selectors and assertion references no longer select it. Its requested-worktree default close, sibling-page close and explicit missing-page typed reply alarms are intentionally retired without equivalent replacement. Prior dated receipts remain unchanged and scoped to their original sources; no fresh execution of the reduced gate, rendered browser, live remote, mobile or cross-platform validation is claimed.", + "oracle": "Audit 3301 removes the caller-chat-target precedence over host selection example from web-session-tabs-sync-focus-intent.test.ts. The snapshot-before-RPC replay and split-sibling-first exact-leaf focus cases remain unchanged and match the existing assertion reference. Preserve current selectors, assertion references, unrelated active receipts and complete archived history. These mocked state-composition survivors provide no equivalent replacement, rendered, native, network or fresh execution proof. Audit3108: doc-preview-grants.test.ts now retains only the stale grant-rejection race: a late rejected grant request must not evict a newer grant registry entry, witnessed by later revocation of grant-2. Retire stable minted-location and outside-workspace POSIX/Windows request-projection alarms without replacement. The direct nonempty grant selector remains unchanged; no real grant-server/file authorization, SSH/HTML delivery or native-focus result is claimed. Audit2133 current-parent preparation: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2095 current-parent preparation2126: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2090 (sources2088/2089): Current reduced suites intentionally retire the alarms listed in knownGaps; prior dated execution and replacement claims do not validate changed source bytes or selectors. Historical prior account (preserved verbatim): Audit2086 (sources2082/2083): Current reduced suites intentionally retire the alarms listed in knownGaps; prior dated execution and replacement claims do not validate changed source bytes or selectors. Historical prior account (preserved verbatim): Audit2076 (sources2073/2074): Intentionally retire these low-value alarms without replacement: src/main/runtime/orca-runtime-tests/terminal-handles-part-02.spec.ts: recovers a moved SSH pane through the tab it now sits in, not the one its lease froze; reports a plain expired orphan; does not report a pane whose only recent lease was superseded; does not report a pane whose only recent lease had its relay id recycled; picks the eligible orphan over a superseded predecessor that matches first; collects the same tabs the per-tab reader reports, in one sweep of the leases; reports no candidate when no lease names any of the worktree tabs. src/main/runtime/orca-runtime-tests/runtime-availability.spec.ts: starts unavailable with no authoritative window; reports the configured Windows terminal shell on status; reports floating workspace availability from settings on status; polls floating tabs with targeted PTY liveness and no repo/provider inventory; hydrates persisted tabs when the store cannot report repos; advertises browser screencast only when a renderer window is available; routes mobile Codex reset consumption through the account mutation coordinator; maps a definite pre-provider rejection into an authoritative current snapshot. Existing unrelated evidenceRuns retain their original scope; unchanged dated receipt objects do not validate changed source bytes or reduced selectors. No fresh gate execution or historical import-closure equivalence is claimed. Frozen current literal-import graph reaches these changed test bytes; unresolved local and computed edges remain debt, and current reachability is not historical execution or equivalent replacement evidence. Historical prior account (preserved verbatim): Audit2043: Remove the registration-wait, webview-security, preview-authorization, guest-lifecycle and grant-IPC unit suites and the sibling-directory assertion reference. Runtime and browser capability consumers also lose removed imported examples. Remaining document-policy, file-reader and grant-registry assertions do not replace those alarms. Preserve the 27 independent dated receipts at their original unchanged selectors; reduced prospective unit selectors have no fresh result or equivalent replacement claim. Historical prior account (preserved verbatim): Audit1973: Delete the browser RPC forwarding/schema/scalar suite and its prospective selector. Preserve all27 unrelated dated receipts; no actual browser operation alarm is replaced. Whole original changed dated receipts are retired, never narrowed or transferred. This metadata review claims no fresh execution, equivalent replacement, provider/PTY, live remote/mobile, rendered, cross-platform, soak or measured-budget result. Historical prior account (preserved verbatim): Audit1925 (sources1922/1923): The complete terminal-file-link-actions suite is removed. Lose supplied local/remote menu-row inventories, browser label/order/download/reveal callback forwarding, platform-copy and source-group pinning examples. No OS reveal/download, real remote preview or browser navigation was exercised; the other real document-preview sources are not equivalent replacements. Preserve meaningful remaining selectors/assertions and unchanged dated receipts within their original scope. Reduced selectors have no fresh gate execution evidence in this metadata packet. No equivalent replacement, physical watcher/PTY/provider, live SSH/remote/mobile, rendered, cross-platform, soak or measured-budget result is claimed. Historical prior account (preserved verbatim): Audit1709 retires changed-source assertion and execution scope without equivalent replacement coverage. Existing unchanged-selector receipts remain scoped to their original sources. Historical prior-source oracle: Audit1687 retires changed-source assertion and execution scope without equivalent replacement coverage. Existing unchanged-selector receipts remain scoped to their original sources. Historical prior-source oracle: Audit1421 narrows renderer unit coverage as recorded in coverageNotes. Prior oracle descriptions are historical for the changed suite. The retained unchanged-source receipts are the only current execution evidence; reduced-source assertions await validation. Historical oracle account (not a current claim for changed sources): Retained unchanged-selector receipts are the only current execution evidence. Reduced-source assertions await validation. Historical prior oracle: The retained unchanged-source receipts are the only current execution evidence; reduced-source assertions await validation. Historical oracle account (not a current claim for changed sources): In paired Electron, write an HTML fixture that declares its own title on the host, invoke the Explorer preview action on the client, and require the document text to be readable out of the orca-preview guest before judging any absence. With that presence established, require the client to hold exactly one browser workspace more than its baseline and that workspace to be the document one: page and tab url blank, the document path mirrored onto both, the tab named by the document's title, the chip naming the file, no editor row of the retired preview species anywhere, and the guest URL carrying the orca-preview scheme. Ask the host through its own page registry as well as through the tab snapshot, and in the same run open an ordinary URL browser tab from the same client and require that one to arrive in both — the presence precondition without which “the host gained nothing” is satisfied just as well by an oracle that cannot see browser pages at all. Require the preview to sit in a group other than the source editor's while the active group and tab remain the source editor's. Then click away to the terminal, click the preview tab, require it to reactivate and still render, close it with its own X, and require the document tab to be gone while the host still holds only the URL tab and the source group, source editor and terminal survive. Quit the client with a document tab open and relaunch it on the same profile: require the same workspace row to come back, blank and named by the document, rendering the document again over a grant URL that differs from the one that was quit, with no preview-scheme or document-named page anywhere in what the host holds. Prove the halves are live by flipping one product property at a time and requiring the run to fail: publish document workspaces to the host like ordinary ones, and stop mirroring the document onto the workspace row. Have the fixture document attempt its own egress on every load — an unattended window.open and location.href to an off-machine URL, plus an inline ICE gathering probe — and require the same baseline counts and a candidate count of zero, so the document's own attempts are measured rather than assumed. Then, as a separate phase after the close oracle has already run, bring the client window to the front, press the document's heading with a real mouse event, and require the document to report that the same press drove it to attempt a second window.open and location.href while both browser counts stay at that phase's baseline and nothing routes — the case a recent-input gate cannot distinguish from the press's own effect. Only then press the target=_blank link with a real mouse event and require both a recorded routing call that returned success and a browser count above that baseline, with the preview tab still open. Drive the preload's click policy as a unit oracle over a real document: a dispatched click, a trusted press on an external anchor, an anchor reached through what it wraps, an SVG animated href, a sibling preview link, fragment and percent-encoded fragment targets, a bare hash, and a middle click. Create a browser page located by a workspace document, handing creation a live grant URL, and require its stored url, its mirrored tab url and the written session payload all to be blank with no orca-preview string anywhere in what was written, while an ordinary page created the same way keeps the URL it was given and asks for the address bar the document page never does. Parse the written page and tab through the session schema and require the document to survive both halves. Hydrate them back and require the document page to return blank and still named — including when its page row was salvaged away and only the tab's own copy remains, and when a foreign session carried a grant URL into both rows. Drive the mirror across a page switch out of the document and back, and across a repair in which the document is the only mirrored field that differs. Name a document page from its document and require the tab to take that name, name it with an empty title and require the file, name it with a live grant URL and require the file again with no preview scheme anywhere in the written session, and require an ordinary blank browser tab beside it to still be called New Tab. Dispatch a title update out of a rendered preview's own guest and require it to reach the page state while the identity chip still reads the document's workspace-relative path. Attach a browsing guest and a workspace-document guest through the same method in one run and require the browsing one to take clicked-link routing, popup handling and auth-identity detach tracking while the document guest takes none of them, stays inside the grant it is showing, denies every window it asks for, and is dropped from the page-keyed document registry by the same teardown that frees its id for a later attach. Register a browsing guest and attach a workspace-document guest in one run against the real manager, require the one door to answer each page with the guest of its own half, and require the document page to be absent from the browsing map and from its enumeration. Drive both browsing registration entry points with a page the document half already holds and require them to register nothing, and drive the mint channel with a page the browsing half already holds and require it to refuse; and drive the offscreen one with a guest that is missing and with one already destroyed, requiring the same refusal. Arm a grab on a live preview target, drive the unregister channel at that same target in the window before the queued operation runs, and require the grab to reach the guest anyway — then drive the same sequence for an ordinary browser page and require its grab state to be disposed after all. Hold one viewport-bridge op open, queue a second behind it, swap the page's guest while that second op waits, and require the injection to land in the guest the page has then. Revoke a grant after a tool has run against its page and require that page's grab state to be cancelled and disposed. Ask a tool for a document page whose guest has not attached, require the request to park in the registration wait, attach the guest, and require the same request to arm on it; require a page nothing ever renders to answer not-ready once that wait elapses. With a document open, ask a tool for a browsing page id and require it to be answered by the browsing half or not at all, with the same channel reaching the document guest under the page it really renders. Drive open-externally for a document whose per-file owner is remote while the workspace-scoped owner is unresolved, for a runtime-owned worktree whose preview tab carries no runtime id of its own, and for a worktree that resolves no runtime owner while the tab still carries one, requiring the download route in each; and for an owner that cannot be resolved at all, and for an unknown workspace root while nothing names another host, requiring a refusal that neither opens nor downloads. Drive the headless backend with a page the document half already holds and require it to reject, destroy the window, and unregister nothing — then shut the backend down and require it still to have unregistered nothing. Navigate a bound preview guest at a second grant through both latch events and require it to stay on the grant it bound to. Mount a preview while a renderer drag is already in flight and require its guest to be click-through at the moment it is appended, not a turn later. Render the editor panel shell in each remaining tab mode and require the path header exactly where the surface does not already name itself. Drive the preview action and require a browser tab located by the document rather than an editor tab, require a second open of the same document to activate the tab it is already in, and require closing that tab to revoke its grant while a URL tab closed beside it revokes none. Publish a worktree holding a document tab and a URL tab and require only the URL tab to reach the mobile snapshot. Install the shared partition policies for a preview partition and for an ordinary browsing partition in the same run, fire each one's own will-download listener, and require the preview's to cancel while the browsing one still reaches the download router — then require the preview protocol installer to be what asks for that deny. In the same run, require the cancelled download to raise a reader-facing notice and the routed one to raise none. require the guest registry to name the bound grant for a live preview guest and nothing for a contents that is not one, has committed no document, or is gone. Drive the shell with a refusal and require one fixed sentence, still one row after three more refusals, standing beside an asset failure rather than being counted with it, gone behind the failure panel, and ignored when it names another preview's grant. Drive the main-side report gate directly for a sender that is no preview guest, a guest with no bound or a revoked grant, a genuine press Electron's webview focus flag misreports as unfocused, and non-web URLs; drive the reader-facing confirmation for accept, cancel, and a confirmed tab the browser refuses; and drive will-attach-webview in both preload directions. Run the per-owner reader, grant-containment, scheme-admission, guest-policy, and plan-routing contracts as unit oracles, including a host-reported truncation, an over-cap binary, and an out-of-worktree paired path. Drive the reader-facing component with the payloads the reader can actually produce — the entry document fails only as truncated or unreadable, a subresource additionally as a refused format — and require the asset case to leave the guest mounted. Drive the closed-tab cleanup hook, the window installer, and the grant IPC handlers directly, requiring the grant to be released when the preview tab closes, cleared at window creation and on a cross-document main-frame navigation, and refused to any sender that is not the trusted renderer. For the browser creations this gate still owns, run the unchanged contract oracle for direct create and side-preview callers with absent status, unknown capabilities, and a mixed-version host, requiring the original unsupported error or visible toast, zero RPCs, and no retained new split; hold a real navigation response beyond the 15-second client deadline after host creation and require the first RPC to return the exact host inventory page ID, one host page, and no retry; repeat reconciliation faults against headless serve and retain the separate exact-page reconciliation rollback oracle. Audit2452 removes the whole fake-effect browser-close routing suite. Active selectors and assertion references no longer select it. Its requested-worktree default close, sibling-page close and explicit missing-page typed reply alarms are intentionally retired without equivalent replacement. Prior dated receipts remain unchanged and scoped to their original sources; no fresh execution of the reduced gate, rendered browser, live remote, mobile or cross-platform validation is claimed.", "commands": [ "pnpm exec vitest run --config config/vitest.config.ts src/main/runtime/browser/client-pages/orca-runtime-browser.test.ts src/renderer/src/runtime/web-session-tabs-sync/navigation/web-session-tabs-sync-focus-intent.test.ts src/renderer/src/runtime/web-session-tabs-sync/placement/web-session-tabs-sync-browser-tabs.test.ts", "pnpm exec vitest run --config config/vitest.config.ts src/main/browser/document-preview/doc-preview-grant-registry.test.ts src/main/browser/document-preview/doc-preview-file-reader.test.ts src/main/browser/document-preview/doc-preview-guest-policy.test.ts src/main/browser/document-preview/doc-preview-failure-notice.test.ts src/shared/document-preview/doc-preview-scheme.test.ts src/renderer/src/lib/browser/documents/doc-preview-grants.test.ts src/renderer/src/components/browser-pane/workspace-doc/doc-preview-external-link-confirmation.test.ts", @@ -4941,7 +4926,8 @@ "Audit2452 removes the whole fake-effect browser-close routing suite. Active selectors and assertion references no longer select it. Its requested-worktree default close, sibling-page close and explicit missing-page typed reply alarms are intentionally retired without equivalent replacement. Prior dated receipts remain unchanged and scoped to their original sources; no fresh execution of the reduced gate, rendered browser, live remote, mobile or cross-platform validation is claimed. Retired assertion reference: {\"file\":\"src/renderer/src/hooks/useIpcEvents-close-routing-browser-pages.test.ts\",\"assertions\":[\"closing an absent renderer page returns browser_tab_not_found instead of an untyped failure\"]}", "Audit3108: doc-preview-grants.test.ts now retains only the stale grant-rejection race: a late rejected grant request must not evict a newer grant registry entry, witnessed by later revocation of grant-2. Retire stable minted-location and outside-workspace POSIX/Windows request-projection alarms without replacement. The direct nonempty grant selector remains unchanged; no real grant-server/file authorization, SSH/HTML delivery or native-focus result is claimed.", "File/document owner layout retires the complete workspace-doc-address-input unit suite because its sole mixed case asserts internal catalog-enumeration work. The current-workspace HTML-resolution alarm is lost; no equivalent replacement coverage or pass for the reduced unit selector is claimed. Historical receipts and all remaining selectors/assertions retain their original scope.", - "Module-layout wave2 intentionally retires complete prohibited owning registrations in src/renderer/src/components/browser-pane/workspace-doc/doc-preview-document-actions.test.ts. Lost alarms: A resolved remote file owner taking precedence over an unresolved workspace owner would lose its routing alarm. A project published on two hosts refusing to open an ambiguous local copy would lose its refusal alarm. An unresolved document refusing both local open and remote download, and including its path in the refusal, would lose the existing alarm. An unknown workspace root preventing an accidental local document open would lose its guard alarm. A restored document using its recorded runtime owner when the worktree resolves none would lose its existing fallback alarm. A restored tab without a recorded owner consulting the resolved worktree owner would lose its existing fallback alarm. No equivalent replacement coverage or reduced-selector pass is claimed." + "Module-layout wave2 intentionally retires complete prohibited owning registrations in src/renderer/src/components/browser-pane/workspace-doc/doc-preview-document-actions.test.ts. Lost alarms: A resolved remote file owner taking precedence over an unresolved workspace owner would lose its routing alarm. A project published on two hosts refusing to open an ambiguous local copy would lose its refusal alarm. An unresolved document refusing both local open and remote download, and including its path in the refusal, would lose the existing alarm. An unknown workspace root preventing an accidental local document open would lose its guard alarm. A restored document using its recorded runtime owner when the worktree resolves none would lose its existing fallback alarm. A restored tab without a recorded owner consulting the resolved worktree owner would lose its existing fallback alarm. No equivalent replacement coverage or reduced-selector pass is claimed.", + "Audit 3301 removes the caller-chat-target precedence over host selection example from web-session-tabs-sync-focus-intent.test.ts. The snapshot-before-RPC replay and split-sibling-first exact-leaf focus cases remain unchanged and match the existing assertion reference. Preserve current selectors, assertion references, unrelated active receipts and complete archived history. These mocked state-composition survivors provide no equivalent replacement, rendered, native, network or fresh execution proof." ], "demotionRule": "Demote if a paired HTML preview creates a browser workspace on either side, renders from anything other than the orca-preview scheme, serves a read the host reported as truncated or over-cap, serves a document without the self-only content security policy, lets the preview session carry an off-machine request, reads an SSH path that canonicalizes outside its grant root, steals focus from the source editor when it opens, removes unrelated editor or terminal state on close, hides a document that rendered because one subresource was refused, leaves a grant readable after the tab or renderer that owns it is gone, mints one for a sender that is not the trusted renderer, opens a browser tab for a navigation the document started with no one at the keyboard, or lets the guest gather an ICE candidate; or if a paired browser creation this gate still owns produces duplicate client or host identities or loses its requested split." }, @@ -7326,7 +7312,7 @@ "providers": ["local", "daemon", "ssh", "wsl", "remote-runtime"], "coveredPlatforms": ["macos"], "coveredProviders": ["local", "daemon", "ssh", "wsl", "remote-runtime"], - "coverageNotes": "Audit2694 source-only review: Remove14 authored/14 expanded cases in the renderer completion wrapper family, including the complete bell/query-reply/stale-input factory, without replacement. Retain29 authored/34 expanded cases with unchanged callback bodies. Three removals are the existing pending2203 overlap and must be adopted/count-reconciled once; eleven are fresh removals. No current-source runtime or gate execution is supplied by this packet; dated evidence retains its original source scope and does not validate the reduced factory bytes. No equivalent replacement, physical provider, mixed-version, mobile, rendered UI, cross-platform, soak or measured-performance result is claimed. The existing command and testFiles selector retain tests/pty-connection-completion-and-notification.test.ts; no wrapper-specific assertionRef is removed. Historical selector results do not validate its changed reachable factories. Historical prior account (preserved verbatim): Audit2709 removes src/renderer/src/runtime/web-session-tabs-sync/inventory/remote-runtime-session-tabs-inflight.test.ts: intentionally retire waiting out an older inventory and sharing a fresh post-operation request among concurrent callers. No equivalent replacement or fresh execution is claimed. Dated receipts remain historical evidence for their unchanged selectors only; they do not validate the reduced commands or full current gate. Historical prior account (preserved verbatim): Audit2133 current-parent preparation: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2095 current-parent preparation2126: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2090 (sources2088/2089): Current reduced suites intentionally retire the alarms listed in knownGaps; prior dated execution and replacement claims do not validate changed source bytes or selectors. Historical prior account (preserved verbatim): Audit2086 (sources2082/2083): Current reduced suites intentionally retire the alarms listed in knownGaps; prior dated execution and replacement claims do not validate changed source bytes or selectors. Historical prior account (preserved verbatim): Audit2076 (sources2073/2074): Intentionally retire these low-value alarms without replacement: src/main/runtime/orca-runtime-tests/terminal-handles-part-02.spec.ts: recovers a moved SSH pane through the tab it now sits in, not the one its lease froze; reports a plain expired orphan; does not report a pane whose only recent lease was superseded; does not report a pane whose only recent lease had its relay id recycled; picks the eligible orphan over a superseded predecessor that matches first; collects the same tabs the per-tab reader reports, in one sweep of the leases; reports no candidate when no lease names any of the worktree tabs. src/main/runtime/orca-runtime-tests/runtime-availability.spec.ts: starts unavailable with no authoritative window; reports the configured Windows terminal shell on status; reports floating workspace availability from settings on status; polls floating tabs with targeted PTY liveness and no repo/provider inventory; hydrates persisted tabs when the store cannot report repos; advertises browser screencast only when a renderer window is available; routes mobile Codex reset consumption through the account mutation coordinator; maps a definite pre-provider rejection into an authoritative current snapshot. Existing unrelated evidenceRuns retain their original scope; unchanged dated receipt objects do not validate changed source bytes or reduced selectors. No fresh gate execution or historical import-closure equivalence is claimed. Frozen current literal-import graph reaches these changed test bytes; unresolved local and computed edges remain debt, and current reachability is not historical execution or equivalent replacement evidence. Historical prior account (preserved verbatim): Audit2003: Delete the complete pure orphan-topology suite and its file membership; preserve the other selectors from its combined command after archiving the original command string. Lost alarms are synthetic current-layout preservation, one-anchor grafting and ambiguous-anchor appending examples. Do not transfer their ownership/topology scope to sibling suites. Preserve all5 independent historical receipts exactly. Changed-source prior results do not validate reduced-source bytes. No fresh execution, equivalent replacement, red/green, measured budget, soak, physical provider/PTY, rendered, live remote/mobile or cross-platform result is claimed. Historical prior account (preserved verbatim): Audit1983: Delete the mocked agent-session suite and its prospective selector and aliases. Retire all3 whole dated changed-selector receipts, preserving their original raw objects in historical gaps without transferring counts or durations. Preserve5 unrelated receipts. Changed-source prior results do not validate reduced-source bytes. No fresh execution, equivalent replacement, red/green, measured budget, soak, provider/PTY, rendered, live remote/mobile or cross-platform result is claimed. Historical prior account (preserved verbatim): Audit1931 (sources1928/1929): Partial agent-operation service suite retains only concurrent retry joining with changed-fingerprint conflict. Retire its complete three-title assertion object: old-owner legacy fallback before side effects, nested SSH Pi transcript refusal and completed/ambiguous physical-commit replay fences are no longer backed. Other probe/launch option/ledger/failure/remote-inventory examples disappear as detailed below. No actual provider spawn, live SSH or physical commit proof is retained by this source. Preserve meaningful remaining selectors/assertions and unchanged dated receipts within their original scope. Reduced selectors have no fresh gate execution evidence in this metadata packet. No equivalent replacement, physical watcher/PTY/provider, live SSH/remote/mobile, rendered, cross-platform, soak or measured-budget result is claimed. Historical prior account (preserved verbatim): Audit1911: The complete provider PTY-inspection mock suite is removed: missing-provider rejection, stale-PTY renderer unverifiable mapping, preserved supplied renderer failures, and supplied transport-loss mapping alarms are intentionally lost. No actual terminal teardown, daemon error or remote transport was exercised. Only the deleted explicit source tokens, testFile and whole assertionRef are removed. Meaningful remaining source selectors/assertions and unaffected dated receipts retain their original scope. No equivalent replacement, fresh reduced-gate, native/platform/provider, soak or measured-budget result is claimed. Historical prior account (preserved verbatim): Audit1627 removes low-value mocked daemon projections, scalar tables and duplicate terminal examples without equivalent replacement coverage. Per-source reviews record retained terminal content preservation, process ownership refusal and recovery boundaries together with injected/native/remote limits. Affected historical receipts are retired; gates without active current evidence are downgraded. Historical scope before this audit: Audit1623 removes low-value mocked daemon projections, scalar tables and duplicate terminal examples without equivalent replacement coverage. Per-source reviews record retained terminal content preservation, process ownership refusal and recovery boundaries together with injected/native/remote limits. Affected historical receipts are retired; gates without active current evidence are downgraded. Historical scope before this audit: Audit1495 intentionally deletes the orphan-owner suite: explicit owner/host predicate examples are retired; no equivalent replacement coverage or fresh result is claimed. Retained exact unchanged-source receipts remain the only current execution evidence. Reduced selectors have no fresh execution result. Audit1417 intentionally deletes src/renderer/src/components/terminal-pane/agent-completion-coordinator-pending-title-inspection.test.ts: Loses obsolete pending title process races, inspection failure suppression, explicit completion precedence and delayed remote inspection alarms. No equivalent replacement coverage or fresh result is claimed. Historical coverage account: Audit1342 changes referenced sources. Retained unchanged-source receipts apply only to their unchanged commands; the reduced selectors have no new execution result. Historical coverage account (not a current claim for changed sources): Audits1301 and1308 changes referenced sources. Retained unchanged-source receipts apply only to their unchanged commands; the reduced selectors have no new execution result. Historical coverage account (not a current claim for changed sources): Deterministic macOS tests cover controller claims, daemon and SSH/relay operation replay, mixed-version selection, runtime ownership, exact provisional handoff, durable terminal retirement, two independent viewer mirrors, guarded adoption of legacy live PTYs, and completion classification when either the outer remote transport or authoritative host/provider process inspection becomes unreachable. The adoption harness models v1.4.150 agent/setup/shell tabs, current-generation restart and reconnect, exact handle/incarnation/worktree/host checks, topology CAS, competing clients, split-pane/group restoration, WSL ownership, and SSH owner rejection. The secondary parity repro runs independent clients against one headless remote Orca runtime over encrypted pairing and a real daemon-backed PTY, with tokened fixture-process identity separated from unrelated Codex app-server startup probes. The automated primary topology runs an isolated headed macOS Orca desktop server plus a separate paired web client and proves viewer-local fresh/resume focus, exact legacy placement, writable PTYs, unrelated-terminal survival, and host/client cleanup. SSH coverage is provider/relay contract and fault-injection coverage only; it does not substitute for paired-server coverage. Live Windows, Linux, WSL, SSH, and physical paired-Linux hosts remain gaps. The isolated intent-owner ledger suite was removed. web-runtime-session.test.ts retains exact post-create handoff confirmation only; its previous fresh/resume presentation and publication-replay assertions are no longer current references. Those direct owner-partition, cap and RPC/focus alarms are lost; other agent-session evidence does not establish equivalence. Structured handoff and adopted-leaf focus references now point to their dedicated surviving fixtures. Mixed-version recovery retains actual old-host recovery followed by a new CLI tab; its unsupported/missing-evidence tables are removed. Orphan recovery retains in-flight adoption-conflict serialization only; previous topology/pruning and absence/adoption examples are removed. These removed projection, capability and adoption-shape alarms are lost; retained cases do not replace them. Audit1301: src/renderer/src/runtime/remote-runtime-session-tabs-inflight.test.ts reduced. Direct dedupe eviction/count and equal receipt-position sample loses authored alarm. No equivalent replacement coverage is claimed. Audit1308: src/renderer/src/runtime/web-session-tabs-sync-agent-handoff.test.ts removed. Exact provisional replacement and post-create exit confirmation handoff pipeline alarms disappear. No equivalent replacement coverage is claimed. Audit1313: src/main/runtime/terminal-orphan-topology.test.ts: Retain actual topology merge algorithms preserving disjoint subtrees and grafted/ambiguous shared anchors with independent expected trees. Remove duplicate leaf validator and empty/no-change passthrough examples. Lose basic validation and no-group/noop characterization; no renderer layout proof. Reduced selectors require fresh validation; prior full-suite receipts do not validate removed or changed coverage. No equivalent replacement or physical-provider claim. Audit1342: src/renderer/src/components/terminal-pane/pty-connection-completion-and-notification.test.ts reduced. Driver registration/import of a whole-deleted selected spec is removed; directly authored cases remain unchanged. No extra authored removal credit. No equivalent replacement coverage is claimed. Audit1383: src/main/runtime/orca-runtime-tests/worktree-native-chat-setup.spec.ts reduced. Lose command-list/receipt/default/background activation matrices whose provider spawn returns canned IDs. Retained test proves actual tab allocation separation, not terminal startup. No equivalent replacement coverage is claimed. Existing exact unaffected receipts and their platform/provider/budget claims remain scoped to unchanged selectors. Changed optional selectors have no new execution result. Audit1401: src/main/runtime/orca-runtime-tests/mobile-session-tabs-duplicate-pty-repair.spec.ts removed. Loses listing-on-already-repaired-data alarm; it never established runtime repair invocation. src/main/runtime/orca-runtime-tests/mobile-session-tabs-split-agent-tab.spec.ts removed. Loses actual mobile split sibling shell versus recorded-agent resume command alarms; no equivalent coverage asserted. src/main/runtime/orca-runtime-tests/worktree-native-chat-setup.spec.ts removed. Loses separate setup/startup tab result in that manually assembled path. src/main/runtime/orca-runtime.test.ts reduced. Driver registration/import of a whole-deleted selected spec is removed; directly authored cases remain unchanged. No extra authored removal credit. No equivalent replacement coverage is claimed. Existing exact unaffected receipts remain unchanged and apply only to their unchanged selectors. Changed optional selectors have no new execution result.", + "coverageNotes": "Audit 3301 removes the caller-chat-target precedence over host selection example from web-session-tabs-sync-focus-intent.test.ts. The snapshot-before-RPC replay and split-sibling-first exact-leaf focus cases remain unchanged and match the existing assertion reference. Preserve current selectors, assertion references, unrelated active receipts and complete archived history. These mocked state-composition survivors provide no equivalent replacement, rendered, native, network or fresh execution proof. Audit2694 source-only review: Remove14 authored/14 expanded cases in the renderer completion wrapper family, including the complete bell/query-reply/stale-input factory, without replacement. Retain29 authored/34 expanded cases with unchanged callback bodies. Three removals are the existing pending2203 overlap and must be adopted/count-reconciled once; eleven are fresh removals. No current-source runtime or gate execution is supplied by this packet; dated evidence retains its original source scope and does not validate the reduced factory bytes. No equivalent replacement, physical provider, mixed-version, mobile, rendered UI, cross-platform, soak or measured-performance result is claimed. The existing command and testFiles selector retain tests/pty-connection-completion-and-notification.test.ts; no wrapper-specific assertionRef is removed. Historical selector results do not validate its changed reachable factories. Historical prior account (preserved verbatim): Audit2709 removes src/renderer/src/runtime/web-session-tabs-sync/inventory/remote-runtime-session-tabs-inflight.test.ts: intentionally retire waiting out an older inventory and sharing a fresh post-operation request among concurrent callers. No equivalent replacement or fresh execution is claimed. Dated receipts remain historical evidence for their unchanged selectors only; they do not validate the reduced commands or full current gate. Historical prior account (preserved verbatim): Audit2133 current-parent preparation: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2095 current-parent preparation2126: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2090 (sources2088/2089): Current reduced suites intentionally retire the alarms listed in knownGaps; prior dated execution and replacement claims do not validate changed source bytes or selectors. Historical prior account (preserved verbatim): Audit2086 (sources2082/2083): Current reduced suites intentionally retire the alarms listed in knownGaps; prior dated execution and replacement claims do not validate changed source bytes or selectors. Historical prior account (preserved verbatim): Audit2076 (sources2073/2074): Intentionally retire these low-value alarms without replacement: src/main/runtime/orca-runtime-tests/terminal-handles-part-02.spec.ts: recovers a moved SSH pane through the tab it now sits in, not the one its lease froze; reports a plain expired orphan; does not report a pane whose only recent lease was superseded; does not report a pane whose only recent lease had its relay id recycled; picks the eligible orphan over a superseded predecessor that matches first; collects the same tabs the per-tab reader reports, in one sweep of the leases; reports no candidate when no lease names any of the worktree tabs. src/main/runtime/orca-runtime-tests/runtime-availability.spec.ts: starts unavailable with no authoritative window; reports the configured Windows terminal shell on status; reports floating workspace availability from settings on status; polls floating tabs with targeted PTY liveness and no repo/provider inventory; hydrates persisted tabs when the store cannot report repos; advertises browser screencast only when a renderer window is available; routes mobile Codex reset consumption through the account mutation coordinator; maps a definite pre-provider rejection into an authoritative current snapshot. Existing unrelated evidenceRuns retain their original scope; unchanged dated receipt objects do not validate changed source bytes or reduced selectors. No fresh gate execution or historical import-closure equivalence is claimed. Frozen current literal-import graph reaches these changed test bytes; unresolved local and computed edges remain debt, and current reachability is not historical execution or equivalent replacement evidence. Historical prior account (preserved verbatim): Audit2003: Delete the complete pure orphan-topology suite and its file membership; preserve the other selectors from its combined command after archiving the original command string. Lost alarms are synthetic current-layout preservation, one-anchor grafting and ambiguous-anchor appending examples. Do not transfer their ownership/topology scope to sibling suites. Preserve all5 independent historical receipts exactly. Changed-source prior results do not validate reduced-source bytes. No fresh execution, equivalent replacement, red/green, measured budget, soak, physical provider/PTY, rendered, live remote/mobile or cross-platform result is claimed. Historical prior account (preserved verbatim): Audit1983: Delete the mocked agent-session suite and its prospective selector and aliases. Retire all3 whole dated changed-selector receipts, preserving their original raw objects in historical gaps without transferring counts or durations. Preserve5 unrelated receipts. Changed-source prior results do not validate reduced-source bytes. No fresh execution, equivalent replacement, red/green, measured budget, soak, provider/PTY, rendered, live remote/mobile or cross-platform result is claimed. Historical prior account (preserved verbatim): Audit1931 (sources1928/1929): Partial agent-operation service suite retains only concurrent retry joining with changed-fingerprint conflict. Retire its complete three-title assertion object: old-owner legacy fallback before side effects, nested SSH Pi transcript refusal and completed/ambiguous physical-commit replay fences are no longer backed. Other probe/launch option/ledger/failure/remote-inventory examples disappear as detailed below. No actual provider spawn, live SSH or physical commit proof is retained by this source. Preserve meaningful remaining selectors/assertions and unchanged dated receipts within their original scope. Reduced selectors have no fresh gate execution evidence in this metadata packet. No equivalent replacement, physical watcher/PTY/provider, live SSH/remote/mobile, rendered, cross-platform, soak or measured-budget result is claimed. Historical prior account (preserved verbatim): Audit1911: The complete provider PTY-inspection mock suite is removed: missing-provider rejection, stale-PTY renderer unverifiable mapping, preserved supplied renderer failures, and supplied transport-loss mapping alarms are intentionally lost. No actual terminal teardown, daemon error or remote transport was exercised. Only the deleted explicit source tokens, testFile and whole assertionRef are removed. Meaningful remaining source selectors/assertions and unaffected dated receipts retain their original scope. No equivalent replacement, fresh reduced-gate, native/platform/provider, soak or measured-budget result is claimed. Historical prior account (preserved verbatim): Audit1627 removes low-value mocked daemon projections, scalar tables and duplicate terminal examples without equivalent replacement coverage. Per-source reviews record retained terminal content preservation, process ownership refusal and recovery boundaries together with injected/native/remote limits. Affected historical receipts are retired; gates without active current evidence are downgraded. Historical scope before this audit: Audit1623 removes low-value mocked daemon projections, scalar tables and duplicate terminal examples without equivalent replacement coverage. Per-source reviews record retained terminal content preservation, process ownership refusal and recovery boundaries together with injected/native/remote limits. Affected historical receipts are retired; gates without active current evidence are downgraded. Historical scope before this audit: Audit1495 intentionally deletes the orphan-owner suite: explicit owner/host predicate examples are retired; no equivalent replacement coverage or fresh result is claimed. Retained exact unchanged-source receipts remain the only current execution evidence. Reduced selectors have no fresh execution result. Audit1417 intentionally deletes src/renderer/src/components/terminal-pane/agent-completion-coordinator-pending-title-inspection.test.ts: Loses obsolete pending title process races, inspection failure suppression, explicit completion precedence and delayed remote inspection alarms. No equivalent replacement coverage or fresh result is claimed. Historical coverage account: Audit1342 changes referenced sources. Retained unchanged-source receipts apply only to their unchanged commands; the reduced selectors have no new execution result. Historical coverage account (not a current claim for changed sources): Audits1301 and1308 changes referenced sources. Retained unchanged-source receipts apply only to their unchanged commands; the reduced selectors have no new execution result. Historical coverage account (not a current claim for changed sources): Deterministic macOS tests cover controller claims, daemon and SSH/relay operation replay, mixed-version selection, runtime ownership, exact provisional handoff, durable terminal retirement, two independent viewer mirrors, guarded adoption of legacy live PTYs, and completion classification when either the outer remote transport or authoritative host/provider process inspection becomes unreachable. The adoption harness models v1.4.150 agent/setup/shell tabs, current-generation restart and reconnect, exact handle/incarnation/worktree/host checks, topology CAS, competing clients, split-pane/group restoration, WSL ownership, and SSH owner rejection. The secondary parity repro runs independent clients against one headless remote Orca runtime over encrypted pairing and a real daemon-backed PTY, with tokened fixture-process identity separated from unrelated Codex app-server startup probes. The automated primary topology runs an isolated headed macOS Orca desktop server plus a separate paired web client and proves viewer-local fresh/resume focus, exact legacy placement, writable PTYs, unrelated-terminal survival, and host/client cleanup. SSH coverage is provider/relay contract and fault-injection coverage only; it does not substitute for paired-server coverage. Live Windows, Linux, WSL, SSH, and physical paired-Linux hosts remain gaps. The isolated intent-owner ledger suite was removed. web-runtime-session.test.ts retains exact post-create handoff confirmation only; its previous fresh/resume presentation and publication-replay assertions are no longer current references. Those direct owner-partition, cap and RPC/focus alarms are lost; other agent-session evidence does not establish equivalence. Structured handoff and adopted-leaf focus references now point to their dedicated surviving fixtures. Mixed-version recovery retains actual old-host recovery followed by a new CLI tab; its unsupported/missing-evidence tables are removed. Orphan recovery retains in-flight adoption-conflict serialization only; previous topology/pruning and absence/adoption examples are removed. These removed projection, capability and adoption-shape alarms are lost; retained cases do not replace them. Audit1301: src/renderer/src/runtime/remote-runtime-session-tabs-inflight.test.ts reduced. Direct dedupe eviction/count and equal receipt-position sample loses authored alarm. No equivalent replacement coverage is claimed. Audit1308: src/renderer/src/runtime/web-session-tabs-sync-agent-handoff.test.ts removed. Exact provisional replacement and post-create exit confirmation handoff pipeline alarms disappear. No equivalent replacement coverage is claimed. Audit1313: src/main/runtime/terminal-orphan-topology.test.ts: Retain actual topology merge algorithms preserving disjoint subtrees and grafted/ambiguous shared anchors with independent expected trees. Remove duplicate leaf validator and empty/no-change passthrough examples. Lose basic validation and no-group/noop characterization; no renderer layout proof. Reduced selectors require fresh validation; prior full-suite receipts do not validate removed or changed coverage. No equivalent replacement or physical-provider claim. Audit1342: src/renderer/src/components/terminal-pane/pty-connection-completion-and-notification.test.ts reduced. Driver registration/import of a whole-deleted selected spec is removed; directly authored cases remain unchanged. No extra authored removal credit. No equivalent replacement coverage is claimed. Audit1383: src/main/runtime/orca-runtime-tests/worktree-native-chat-setup.spec.ts reduced. Lose command-list/receipt/default/background activation matrices whose provider spawn returns canned IDs. Retained test proves actual tab allocation separation, not terminal startup. No equivalent replacement coverage is claimed. Existing exact unaffected receipts and their platform/provider/budget claims remain scoped to unchanged selectors. Changed optional selectors have no new execution result. Audit1401: src/main/runtime/orca-runtime-tests/mobile-session-tabs-duplicate-pty-repair.spec.ts removed. Loses listing-on-already-repaired-data alarm; it never established runtime repair invocation. src/main/runtime/orca-runtime-tests/mobile-session-tabs-split-agent-tab.spec.ts removed. Loses actual mobile split sibling shell versus recorded-agent resume command alarms; no equivalent coverage asserted. src/main/runtime/orca-runtime-tests/worktree-native-chat-setup.spec.ts removed. Loses separate setup/startup tab result in that manually assembled path. src/main/runtime/orca-runtime.test.ts reduced. Driver registration/import of a whole-deleted selected spec is removed; directly authored cases remain unchanged. No extra authored removal credit. No equivalent replacement coverage is claimed. Existing exact unaffected receipts remain unchanged and apply only to their unchanged selectors. Changed optional selectors have no new execution result.", "motivatingLinks": [ "https://github.com/stablyai/orca/issues/8878", "https://github.com/stablyai/orca/issues/9151", @@ -7336,7 +7322,7 @@ "https://github.com/stablyai/orca/pull/10193" ], "invariant": "For every claim-capable execution route, one provider-session identity has at most one live PTY owner and one canonical host surface across concurrent clients, retries, reconnects, and stale publications. For paired structured fresh and resume requests, the authenticated owning runtime creates in background without a renderer window; activate=true focuses the exact requested leaf only on the requesting viewer, while activate=false changes no viewer focus. A live orphan may be adopted only when the controller proves its exact handle and incarnation, its worktree and host owner match, no competing visual owner exists, and a host topology CAS wins. A viewer may classify completion only from successful host/provider inspection or explicit lifecycle evidence; transport, handle, or provider unavailability remains unknown and breaks any consecutive-idle proof. A physical exit retires that exact incarnation durably so stale client state and host restart cannot recreate it. Mixed-version routes select the unchanged legacy request before any authority side effect or execution-owner-local filesystem access.", - "oracle": "Audit2694 source-only review: Remove14 authored/14 expanded cases in the renderer completion wrapper family, including the complete bell/query-reply/stale-input factory, without replacement. Retain29 authored/34 expanded cases with unchanged callback bodies. Three removals are the existing pending2203 overlap and must be adopted/count-reconciled once; eleven are fresh removals. No current-source runtime or gate execution is supplied by this packet; dated evidence retains its original source scope and does not validate the reduced factory bytes. No equivalent replacement, physical provider, mixed-version, mobile, rendered UI, cross-platform, soak or measured-performance result is claimed. The existing command and testFiles selector retain tests/pty-connection-completion-and-notification.test.ts; no wrapper-specific assertionRef is removed. Historical selector results do not validate its changed reachable factories. Historical prior account (preserved verbatim): Audit2133 current-parent preparation: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2095 current-parent preparation2126: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2090 (sources2088/2089): Current reduced suites intentionally retire the alarms listed in knownGaps; prior dated execution and replacement claims do not validate changed source bytes or selectors. Historical prior account (preserved verbatim): Audit2086 (sources2082/2083): Current reduced suites intentionally retire the alarms listed in knownGaps; prior dated execution and replacement claims do not validate changed source bytes or selectors. Historical prior account (preserved verbatim): Audit2076 (sources2073/2074): Intentionally retire these low-value alarms without replacement: src/main/runtime/orca-runtime-tests/terminal-handles-part-02.spec.ts: recovers a moved SSH pane through the tab it now sits in, not the one its lease froze; reports a plain expired orphan; does not report a pane whose only recent lease was superseded; does not report a pane whose only recent lease had its relay id recycled; picks the eligible orphan over a superseded predecessor that matches first; collects the same tabs the per-tab reader reports, in one sweep of the leases; reports no candidate when no lease names any of the worktree tabs. src/main/runtime/orca-runtime-tests/runtime-availability.spec.ts: starts unavailable with no authoritative window; reports the configured Windows terminal shell on status; reports floating workspace availability from settings on status; polls floating tabs with targeted PTY liveness and no repo/provider inventory; hydrates persisted tabs when the store cannot report repos; advertises browser screencast only when a renderer window is available; routes mobile Codex reset consumption through the account mutation coordinator; maps a definite pre-provider rejection into an authoritative current snapshot. Existing unrelated evidenceRuns retain their original scope; unchanged dated receipt objects do not validate changed source bytes or reduced selectors. No fresh gate execution or historical import-closure equivalence is claimed. Frozen current literal-import graph reaches these changed test bytes; unresolved local and computed edges remain debt, and current reachability is not historical execution or equivalent replacement evidence. Historical prior account (preserved verbatim): Audit2003: Delete the complete pure orphan-topology suite and its file membership; preserve the other selectors from its combined command after archiving the original command string. Lost alarms are synthetic current-layout preservation, one-anchor grafting and ambiguous-anchor appending examples. Do not transfer their ownership/topology scope to sibling suites. Preserve all5 independent historical receipts exactly. Changed-source prior results do not validate reduced-source bytes. No fresh execution, equivalent replacement, red/green, measured budget, soak, physical provider/PTY, rendered, live remote/mobile or cross-platform result is claimed. Historical prior account (preserved verbatim): Audit1983: Delete the mocked agent-session suite and its prospective selector and aliases. Retire all3 whole dated changed-selector receipts, preserving their original raw objects in historical gaps without transferring counts or durations. Preserve5 unrelated receipts. Changed-source prior results do not validate reduced-source bytes. No fresh execution, equivalent replacement, red/green, measured budget, soak, provider/PTY, rendered, live remote/mobile or cross-platform result is claimed. Historical prior account (preserved verbatim): Audit1931 (sources1928/1929): Partial agent-operation service suite retains only concurrent retry joining with changed-fingerprint conflict. Retire its complete three-title assertion object: old-owner legacy fallback before side effects, nested SSH Pi transcript refusal and completed/ambiguous physical-commit replay fences are no longer backed. Other probe/launch option/ledger/failure/remote-inventory examples disappear as detailed below. No actual provider spawn, live SSH or physical commit proof is retained by this source. Preserve meaningful remaining selectors/assertions and unchanged dated receipts within their original scope. Reduced selectors have no fresh gate execution evidence in this metadata packet. No equivalent replacement, physical watcher/PTY/provider, live SSH/remote/mobile, rendered, cross-platform, soak or measured-budget result is claimed. Historical prior account (preserved verbatim): Audit1911: The complete provider PTY-inspection mock suite is removed: missing-provider rejection, stale-PTY renderer unverifiable mapping, preserved supplied renderer failures, and supplied transport-loss mapping alarms are intentionally lost. No actual terminal teardown, daemon error or remote transport was exercised. Only the deleted explicit source tokens, testFile and whole assertionRef are removed. Meaningful remaining source selectors/assertions and unaffected dated receipts retain their original scope. No equivalent replacement, fresh reduced-gate, native/platform/provider, soak or measured-budget result is claimed. Historical prior account (preserved verbatim): Retained exact unchanged-source receipts remain the only current execution evidence. Reduced selectors have no fresh execution result. Historical pre-audit oracle account for changed sources: Existing exact unchanged-selector receipts remain the only current execution evidence. Changed source selectors have no fresh execution result. Historical prior-source oracle account: The retained unchanged-source receipts are the only current execution evidence; reduced-source assertions await validation. Historical oracle account (not a current claim for changed sources): The retained unchanged-source receipts are the only current execution evidence; reduced-source assertions await validation. Historical oracle account (not a current claim for changed sources): Race independent clients and repeated operation IDs, then assert one physical spawn and one canonical PTY/surface; inject exit-before-reply, provider disconnect, conflicting claim scope, old daemon/relay capabilities, reused handles, stale incarnations, owner mismatch, and topology revision conflict; assert safe adoption or explicit failure without a second spawn or wrong-process attachment. Run fresh/resume with activate true/false against an isolated headed desktop host and a separate paired client, then against isolated headless serve: assert host presentation stays background, only the requesting viewer focuses the exact leaf, inactive calls preserve client/DOM focus, a same-version publication replay cannot lose focus intent, and sibling-first split publication cannot consume exact-leaf intent. Restore legacy split panes and groups beside a newer host-owned tab, preserving exact predecessor/new/successor order, output, input, resize, titles, tab/leaf identity, active group, and multi-client convergence. For completion, drive a known running agent through outer transport loss, authoritative provider rejection, reconnect, explicit stop, real exit status, and successful hook completion; assert unavailable evidence never dispatches completion and two fresh authoritative idle samples are required after the gap. After exact exit, assert terminal and tab listings omit the surface, a stale publication cannot restore it, restart cannot resurrect it, exact tokened fixture PIDs are dead, and unrelated tabs/processes survive until scoped cleanup.", + "oracle": "Audit 3301 removes the caller-chat-target precedence over host selection example from web-session-tabs-sync-focus-intent.test.ts. The snapshot-before-RPC replay and split-sibling-first exact-leaf focus cases remain unchanged and match the existing assertion reference. Preserve current selectors, assertion references, unrelated active receipts and complete archived history. These mocked state-composition survivors provide no equivalent replacement, rendered, native, network or fresh execution proof. Audit2694 source-only review: Remove14 authored/14 expanded cases in the renderer completion wrapper family, including the complete bell/query-reply/stale-input factory, without replacement. Retain29 authored/34 expanded cases with unchanged callback bodies. Three removals are the existing pending2203 overlap and must be adopted/count-reconciled once; eleven are fresh removals. No current-source runtime or gate execution is supplied by this packet; dated evidence retains its original source scope and does not validate the reduced factory bytes. No equivalent replacement, physical provider, mixed-version, mobile, rendered UI, cross-platform, soak or measured-performance result is claimed. The existing command and testFiles selector retain tests/pty-connection-completion-and-notification.test.ts; no wrapper-specific assertionRef is removed. Historical selector results do not validate its changed reachable factories. Historical prior account (preserved verbatim): Audit2133 current-parent preparation: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2095 current-parent preparation2126: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2090 (sources2088/2089): Current reduced suites intentionally retire the alarms listed in knownGaps; prior dated execution and replacement claims do not validate changed source bytes or selectors. Historical prior account (preserved verbatim): Audit2086 (sources2082/2083): Current reduced suites intentionally retire the alarms listed in knownGaps; prior dated execution and replacement claims do not validate changed source bytes or selectors. Historical prior account (preserved verbatim): Audit2076 (sources2073/2074): Intentionally retire these low-value alarms without replacement: src/main/runtime/orca-runtime-tests/terminal-handles-part-02.spec.ts: recovers a moved SSH pane through the tab it now sits in, not the one its lease froze; reports a plain expired orphan; does not report a pane whose only recent lease was superseded; does not report a pane whose only recent lease had its relay id recycled; picks the eligible orphan over a superseded predecessor that matches first; collects the same tabs the per-tab reader reports, in one sweep of the leases; reports no candidate when no lease names any of the worktree tabs. src/main/runtime/orca-runtime-tests/runtime-availability.spec.ts: starts unavailable with no authoritative window; reports the configured Windows terminal shell on status; reports floating workspace availability from settings on status; polls floating tabs with targeted PTY liveness and no repo/provider inventory; hydrates persisted tabs when the store cannot report repos; advertises browser screencast only when a renderer window is available; routes mobile Codex reset consumption through the account mutation coordinator; maps a definite pre-provider rejection into an authoritative current snapshot. Existing unrelated evidenceRuns retain their original scope; unchanged dated receipt objects do not validate changed source bytes or reduced selectors. No fresh gate execution or historical import-closure equivalence is claimed. Frozen current literal-import graph reaches these changed test bytes; unresolved local and computed edges remain debt, and current reachability is not historical execution or equivalent replacement evidence. Historical prior account (preserved verbatim): Audit2003: Delete the complete pure orphan-topology suite and its file membership; preserve the other selectors from its combined command after archiving the original command string. Lost alarms are synthetic current-layout preservation, one-anchor grafting and ambiguous-anchor appending examples. Do not transfer their ownership/topology scope to sibling suites. Preserve all5 independent historical receipts exactly. Changed-source prior results do not validate reduced-source bytes. No fresh execution, equivalent replacement, red/green, measured budget, soak, physical provider/PTY, rendered, live remote/mobile or cross-platform result is claimed. Historical prior account (preserved verbatim): Audit1983: Delete the mocked agent-session suite and its prospective selector and aliases. Retire all3 whole dated changed-selector receipts, preserving their original raw objects in historical gaps without transferring counts or durations. Preserve5 unrelated receipts. Changed-source prior results do not validate reduced-source bytes. No fresh execution, equivalent replacement, red/green, measured budget, soak, provider/PTY, rendered, live remote/mobile or cross-platform result is claimed. Historical prior account (preserved verbatim): Audit1931 (sources1928/1929): Partial agent-operation service suite retains only concurrent retry joining with changed-fingerprint conflict. Retire its complete three-title assertion object: old-owner legacy fallback before side effects, nested SSH Pi transcript refusal and completed/ambiguous physical-commit replay fences are no longer backed. Other probe/launch option/ledger/failure/remote-inventory examples disappear as detailed below. No actual provider spawn, live SSH or physical commit proof is retained by this source. Preserve meaningful remaining selectors/assertions and unchanged dated receipts within their original scope. Reduced selectors have no fresh gate execution evidence in this metadata packet. No equivalent replacement, physical watcher/PTY/provider, live SSH/remote/mobile, rendered, cross-platform, soak or measured-budget result is claimed. Historical prior account (preserved verbatim): Audit1911: The complete provider PTY-inspection mock suite is removed: missing-provider rejection, stale-PTY renderer unverifiable mapping, preserved supplied renderer failures, and supplied transport-loss mapping alarms are intentionally lost. No actual terminal teardown, daemon error or remote transport was exercised. Only the deleted explicit source tokens, testFile and whole assertionRef are removed. Meaningful remaining source selectors/assertions and unaffected dated receipts retain their original scope. No equivalent replacement, fresh reduced-gate, native/platform/provider, soak or measured-budget result is claimed. Historical prior account (preserved verbatim): Retained exact unchanged-source receipts remain the only current execution evidence. Reduced selectors have no fresh execution result. Historical pre-audit oracle account for changed sources: Existing exact unchanged-selector receipts remain the only current execution evidence. Changed source selectors have no fresh execution result. Historical prior-source oracle account: The retained unchanged-source receipts are the only current execution evidence; reduced-source assertions await validation. Historical oracle account (not a current claim for changed sources): The retained unchanged-source receipts are the only current execution evidence; reduced-source assertions await validation. Historical oracle account (not a current claim for changed sources): Race independent clients and repeated operation IDs, then assert one physical spawn and one canonical PTY/surface; inject exit-before-reply, provider disconnect, conflicting claim scope, old daemon/relay capabilities, reused handles, stale incarnations, owner mismatch, and topology revision conflict; assert safe adoption or explicit failure without a second spawn or wrong-process attachment. Run fresh/resume with activate true/false against an isolated headed desktop host and a separate paired client, then against isolated headless serve: assert host presentation stays background, only the requesting viewer focuses the exact leaf, inactive calls preserve client/DOM focus, a same-version publication replay cannot lose focus intent, and sibling-first split publication cannot consume exact-leaf intent. Restore legacy split panes and groups beside a newer host-owned tab, preserving exact predecessor/new/successor order, output, input, resize, titles, tab/leaf identity, active group, and multi-client convergence. For completion, drive a known running agent through outer transport loss, authoritative provider rejection, reconnect, explicit stop, real exit status, and successful hook completion; assert unavailable evidence never dispatches completion and two fresh authoritative idle samples are required after the gap. After exact exit, assert terminal and tab listings omit the surface, a stale publication cannot restore it, restart cannot resurrect it, exact tokened fixture PIDs are dead, and unrelated tabs/processes survive until scoped cleanup.", "commands": [ "pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/runtime/web-session-tabs-sync/navigation/web-session-tabs-sync-focus-intent.test.ts", "pnpm exec vitest run --config config/vitest.config.ts src/shared/claimed-agent-pty-owner.test.ts src/main/daemon/providers/adapter/testing/daemon-pty-adapter.test.ts src/main/runtime/session-construction/agent-session/orca-runtime-agent-session-operation.test.ts src/main/runtime/session-construction/agent-session/remote-agent-session-host-authority.integration.test.ts src/main/runtime/terminal/surface/orca-runtime-terminal-retirement.test.ts src/renderer/src/components/terminal-pane/pty-transport/remote-runtime/remote-runtime-pty-transport-host-session-launch.test.ts src/renderer/src/components/terminal-pane/pty-transport/remote-runtime/remote-runtime-pty-transport-create-handoff.test.ts", @@ -7595,7 +7581,8 @@ "Module layout policy correction: retire the remaining program-status-osc.spec.ts event-projection case (production/mock-derived pane-key oracle) and sign-in timeout case (real setTimeout wait with Date-only fake clocks). The runtime test registrar no longer imports that file. No replacement coverage or fresh execution is claimed for these losses; historical receipts retain their original source scope.", "Module layout policy correction: retire the two remaining worktree-ps-agent-row-dismissal.spec.ts registrations. The remint/dismissal/exit case computed expected snapshotVersion increments from a production snapshot and used real-clock vi.waitFor; the legacy OSC case derived its expected paneKey from the production layout-owner switch. The runtime registrar no longer imports this file. These public projection scenarios have no replacement coverage or fresh execution claimed; all historical receipts and earlier loss notes retain their original source scope.", "Audit2709 removes src/renderer/src/runtime/web-session-tabs-sync/inventory/remote-runtime-session-tabs-inflight.test.ts: intentionally retire waiting out an older inventory and sharing a fresh post-operation request among concurrent callers. No equivalent replacement or fresh execution is claimed. Dated receipts remain historical evidence for their unchanged selectors only; they do not validate the reduced commands or full current gate. Original prospective command before removal: pnpm exec vitest run --config config/vitest.config.ts src/shared/claimed-agent-pty-owner.test.ts src/main/daemon/providers/adapter/testing/daemon-pty-adapter.test.ts src/main/runtime/session-construction/agent-session/orca-runtime-agent-session-operation.test.ts src/main/runtime/session-construction/agent-session/remote-agent-session-host-authority.integration.test.ts src/main/runtime/terminal/surface/orca-runtime-terminal-retirement.test.ts src/renderer/src/components/terminal-pane/pty-transport/remote-runtime/remote-runtime-pty-transport-host-session-launch.test.ts src/renderer/src/components/terminal-pane/pty-transport/remote-runtime/remote-runtime-pty-transport-create-handoff.test.ts src/renderer/src/runtime/web-session-tabs-sync/inventory/remote-runtime-session-tabs-inflight.test.ts src/renderer/src/runtime/web-session-tabs-sync/inventory/web-runtime-session.test.ts", - "Module-layout wave1 intentionally retires complete prohibited owning registrations in src/renderer/src/runtime/web-session-tabs-sync/inventory/web-runtime-session.test.ts. Lost alarms: confirms only the exact handoff after its post-create list completes. No equivalent replacement coverage or pass for a reduced selector is claimed. All unrelated selectors and historical receipts retain their original scope." + "Module-layout wave1 intentionally retires complete prohibited owning registrations in src/renderer/src/runtime/web-session-tabs-sync/inventory/web-runtime-session.test.ts. Lost alarms: confirms only the exact handoff after its post-create list completes. No equivalent replacement coverage or pass for a reduced selector is claimed. All unrelated selectors and historical receipts retain their original scope.", + "Audit 3301 removes the caller-chat-target precedence over host selection example from web-session-tabs-sync-focus-intent.test.ts. The snapshot-before-RPC replay and split-sibling-first exact-leaf focus cases remain unchanged and match the existing assertion reference. Preserve current selectors, assertion references, unrelated active receipts and complete archived history. These mocked state-composition survivors provide no equivalent replacement, rendered, native, network or fresh execution proof." ], "demotionRule": "Keep experimental or demote if the focused gate flakes without a product or harness bug, if a retry can physically spawn twice, if a stale exit/publication can replace or resurrect a terminal, or if mixed-version fallback occurs after an authority side effect." }, @@ -8533,13 +8520,13 @@ "providers": ["paired-runtime", "ssh"], "coveredPlatforms": ["macos", "linux"], "coveredProviders": [], - "coverageNotes": "Audit 3292 combines adopted 3285/3287/3289/3293 removals: 40 authored declarations and 47 expanded scenarios, including whole frame-editor-view, ambiguous remote-delete-refusal, unverifiable-host subscription and editor-close cleanup suites. The previously reviewed dock-badge suite was already removed upstream in PR 40895 and receives zero new removal credit. Intentionally retired alarms include background browser selection and last-tab landing; main startup fallback, SSH project cleanup/survivor routing, exact-PR contradiction/saved-push positives, replay/sidecar rollback and wrapped remote error normalization; records/snapshot missing-diff hydration, ambiguous folder-owner delete refusal, focus no-op notifications, nested editor context-only cache check, pending broadcast-first status and ordinary four-confirmation aggregation; preview-source frontmatter pruning, approved local/runtime agent dispatch, non-GitHub legacy PR cache invalidation, stale merged-head transient-error fallback, empty-queue immediate query reply and unverified-to-concrete preflight risk. Additional intentionally retired alarms are injected host subscription/unsubscribe counts, synthetic editor reveal/draft/fallback/scoped close, ambiguous unread refusals and hidden mark/read roundtrip, immediate connect backoff/noError, positive mirrored evidence-clock renewal, supplied VM failure/success projections and git-local/folder-SSH wake permutations. Remaining temporal/ownership cases are narrower; no equivalent replacement or fresh execution is claimed. Audit 3283 removes 20 authored declarations and 31 expanded scenarios, including two whole suites. Retired alarms cover PR refresh-state pruning, shared runtime subscription cleanup and store isolation, language content-change routing and older completion ownership, ordinary panel retry-timer cleanup and pending loading, four hosted-review lifetime permutations, mocked terminal creation error/order wiring, five sleep-inventory variants with pending-frame-only assertions, palette fallback/composite highlights, Windows/UNC encoded-editor input rows, mixed-repository partial failure counts, title setters and generated-title bypass/replacement, five window-close coordinator delegation/guard/finally branches, and ambiguous-old-record frame reveal. These regression checks are intentionally lost under the test-value audit; retained cases are not equivalent replacements. Prior coverage notes and receipts remain historical. Audit 3273 removes 14 authored declarations and 19 expanded scenarios across four whole suites and eight partial suites. Retired alarms cover saved-local cancellation/layout ownership, ambiguous-owner warning reset, folder attachment routing, VM false-capability bypass, abandoned reveal warmup cleanup and viewport claim deduplication/rearming, quiet unrelated remote-removal refusal, startup-command one-shot consumption, repository/floating recovery-ledger rows, fake-React pinned-scroll intent, split-ratio state identity/subscriber suppression and fractional change, cross-host project-group join refusal, three PR request-lifetime permutations, upstream-status preservation on error, and unresolved Git-owner refusal. These regression checks are intentionally lost under the test-value audit; retained scenarios are not equivalent replacements. Historical coverage receipts remain historical, including gate35 subscriber claims. Audit 3256 removes these specific alarms from the broad root unit commands: skill dialog active-share selection, close and pending-share handoff; simple keyed-record deletion; marker live-region insertion, simple landing and nine baseline policy examples; General search/control navigation inventory; orphan-count cache bootstrap; seven Codex code classifications and HTTP 429 warning mapping; two skill unread-root verdict examples; peer-mail payload and conversation-ID rejection; and the GitHub organization TABLE text-field optimistic rollback/failed-envelope example. These include real behaviors; retained tests do not provide equivalent coverage for every removed scenario. Mobile losses are recorded separately and are not coverage of these root commands. Audit3246 retires NewRowsMarker reveal/no-repeat and pane-scoped beforeinput checks; skill-owner option availability/count/dedup/order; six styled Input/Textarea IME forwarding rows; the static Codex/OpenCode smart-key inventory; tab-map AST ratchet diagnostic fixtures; child-roster work-budget and retained-aggregate alarms; malformed persisted floating-cwd fallback/no-crash/empty exact-root checks; the unanswered-host empty-list discriminator; the direct invalidated-cache commit-false assertion; one redundant digit-keyup IME row; cached non-supported Claude title-generator rows; and the duplicate late naming-result singleton. These root broad commands lose those specific alarms without equivalent replacement. Distinct retained owner/state checks have their own bounded claims; the real scheduler still rejects stale response data, while the direct false-return alarm is retired. Audit3231 retires supported-host restore-pane key mapping, closed/open creation-sidebar toggle visibility, unrelated scope-error/null classification and quick-submit reveal/no-create checks. These broad commands lose those real narrow alarms; no replacement coverage is claimed. Audit3219 removes the synthetic Cmd+J extra-source suite; this broad command no longer checks its match/tie placement and selection, announced count, empty-query cap, or workspace hiding with retained recent tabs. No replacement coverage is claimed. Audit3209 composes approved sources3202/3206: deliberately retires seven authored/expanded cases in four whole suites without equivalent replacement. Work-item queries lose real GitHub/GitLab oversized ASCII secret-prefix empty-query and whitespace-before-trim refusal alarms; inputs share the imported size bound and exercise only its fast length branch, with no multibyte or actual provider/exposure guarantee. Skill sharing loses complete/partial managed-bundle and destination-ambiguity association checks plus three negative origin/path/scheme admission examples; these do not establish uploaded contents, arbitrary-URL fetching, authorization or execution. Retain exact originless-project direct-link fallback, cloud-delete confirmation, bundled-target repair/owner isolation and explicit Windows-host preference over stale WSL suites. Rejected3201 runtime-preference removal is excluded. No real cloud/network/host/disk, mobile or mixed-version execution validation is claimed. Audit3200 composes approved source3194: deliberately retires thirteen authored registrations/twenty-seven expanded cases in six whole automation host/list policy suites without equivalent replacement. Real RPC category/retryability and wrapped-timeout recognition, unscoped-failure/scoped-success health evidence precedence, exact-ID create selectors and per-run workspace omission, paired-web local/SSH/absent host catalog routing, incompatible/removed/unhydrated/offline execution health, runtime-before-nested-SSH recovery dispatch, and no-owned-focus/successor/foreign-list focus policy alarms are consciously lost. Retain exact20line orphan allow/refuse/precondition and exact90line cross-host same-ID search suites. No retry-timer/fence lifecycle, actual reconnect/network/write delivery, native focus, mobile/mixed-version runtime or disk persistence coverage is claimed. Audit3191 combines approved source3182/3187/3188: deliberately retires thirteen authored Vitest registrations and fifteen expanded cases, including five whole suites, without equivalent replacement. Attachment intake loses real portal/native-capture terminal interception and unowned-container refusal, immediate child-only committed availability/claim-ref negotiation and delivery, and direct-target over stable focused/background composer routing through disable/re-enable/remount and independent question focus. Exact destination/cache/draft and final-stat owner/workspace/File-release suites remain; they do not replace Surface recipient routing. Automation authoring loses destination runtime catalog membership, local/direct-SSH exclusion of paired-runtime repos, unknown-runtime empty catalog, logical project/host/setup/repo/path context payload, and missing/nonready setup refusal; these were genuine direct helper alarms, while exact schedule transformation, legacy schedule and setup-decision suites remain. Agent picker loses setup-chat/terminal/missing-installer/unsupported-or-unknown-host row projection samples and the ordinary unsearched menu variant; the entire original26-line resume recipe suite remains, including reported bypass versus default/absent permission modes, as does the exact search-result menu callback with its fixtures, model/effort commits and staged Arguments reopen outcome. Rejected predecessor3180 full recipe deletion is excluded. No actual native drag/cursor/focus/IME, upload bytes or disk/restart persistence, full automation save/scheduler/runtime transport, real resume-process flags/environment delivery, or native menu/rendered layout validation is claimed. Audit3178 combines source3169/3170/3175: deliberately retires eight authored units (six Vitest cases and two imperative custom relay scenarios), including two whole suites, without equivalent replacement. Voice Section loses per-model pending-delete isolation across interleaved A/B completion and the two-success refresh-call alarm; exact VoicePane delayed key-clear/newer enabled-toggle merge remains and does not replace row deletion coverage. Speech loses dedicated rating-scale/inclusive-ceiling, unsupported-versus-unmeasured, explicit/system-language precedence/locale alias, accuracy versus fast named/default/best-measured selection, and unmeasured/no-match examples; exact offered-user-pick versus retired-selection case and its fixture remain. Relay loses legacy ping-delivery count/liveness sampled before the silence deadline and grouped malformed Bearer/host-ID 401/429 routing checks; twelve real Worker/DurableObject/shipped-client scenarios remain, not equivalent replacement for those narrow alarms. Six prior speech cases are not all deleted: approved successor3175 keeps the original user-choice case. No actual credential/file persistence, native/GPU/engine/download delivery, production assignment policy or deployed-runtime validation is claimed by this reduction. Audit3165 combines source3160/3162: deliberately retires six authored/expanded cases across three whole suites without equivalent replacement. Launch/status losses: observed React-render pending/resuming coordination across settings and deferred offer read; stale-offer reread suppressing dialog reopen; held-local-chat recovery visibility with new-chat preferences off; disabled-local admission avoiding offer RPC despite an injected but unconsumed paired-tab fixture; and run-only lost-reply uncertainty reachability until direct viewed-run retirement. Launch probe does not prove arbitrary synchronous-store atomicity, the paired fixture is not remote runtime enrollment, and the status case directly marks viewed state rather than rendering the summary. Crew-hook losses: old-host method_not_found cache persists across party changes but is released by independently supplied connection generation/verified pairing status or pairing revision, with actual frame publication and teardown. These are real narrow coordination, admission, uncertainty and mixed-version cache alarms consciously lost. Exact web verified-runtime writer handoff guard remains; it does not replace those alarms or prove live host/native/mobile delivery. Audit3156 combines3147/3150/3152/3153/3154: deliberately retires39authored/40expanded native-chat recovery cases, eight whole suites and two orphan test-support files without equivalent replacement. Lost alarms: lost-reply unconfirmed reconciliation, skipped rows/counts and missed-frame repair, unknown/pending outcome and omitted-failure-list compatibility, uncertain history after dismissal, retry/refusal/dismiss lifecycle, hidden/consumed picker ownership, result-tree keyboard focus/disclosure and all-skipped retirement; unconfirmed-over-conflict guidance and failed-chat changes despite older host timestamps; nearest-listed ancestor/cyclic forest shape, descendant membership, host ordering/missing-host local fallback; skipped/readiness/admission counts, provisional skip/progress monotonicity, early per-chat verdicts with batch pending protection, older-host waiting, start-slot/delivery distinction, retry-over-failure and unknown-after-withdrawal attention; remote snooze/reconnect/reoffer, unseen mixed summary through open/close, watched completion retirement, new success beside old failure, failed-reread mixed-result preservation, filter/collapse completion resets, retry summary replacement and current-offer/history selection; cross-host workspace identity, rendered cyclic reachability, nested tri-state/toggle propagation, project eligibility isolation and collapse preserving selection. Exact fallback-list completion barrier, batched verdict/cleanup retention, stale-read versus dismissal publication race, and requested-but-never-rendered finished-run retirement remain; they do not replace retired alarms. Audit3146 combines source reviews3132/3133/3135/3138/3143: intentionally retire20authored/31expanded cases without equivalent replacement. Provider-session losses: structured-native terminal-resume exclusion, metadata-less completed identity, new-turn completion clearing, Pi provider-only/periodic/manual promotion, changed-transcript launch-config isolation, Pi/omp/prime-agent completed-session remote/manual-shutdown promotion, and quit/done precedence over heartbeat. Side-thread/question losses: finished-pane acquisition, hidden title/recap states, local/relay/relay-done conversation takeover with prompt/session/child resets, plain-message abandonment, compaction/session replacement and completion resets. Codex startup losses: incoming-owner cached child replacement, old-relay foreign live-session correction, completed foreign-root turn-fact permutations. Transcript losses: real temporary-JSONL partial sibling/final-child completion, unlabelled child attribution, compact cached replay preservation and100/1000completed-child roster retention/release. Compiler-ratchet losses: valid-line uncompiled-list parser grammar examples and injected-existence stale-path filtering; these did not exercise actual filesystem canonicalization or build exclusion. These are real lifecycle, ownership, replay, liveness and retention alarms, including recent#40246 regressions, deliberately lost. Retained conditional record replacement, clockless root/SSH owner isolation, persisted main-thread fork rejection, partial/final question-answer lifetime, cached-roster/missing-ID/live HTTP/durable startup boundaries and restarted-relay refusal/acceptance do not replace those losses. No native/SSH/WSL execution or equivalent coverage is claimed. Audit3128 scoped coverage reduction: Audit3121 removes VoiceDictationLanguageSetting.test.tsx (Spanish-to-es callback and unsupported-model Korean option presence) and voice-speech-model-rows.test.ts (provider/language-order/retired-on-disk list policy); these real narrow alarms are deliberately retired without replacement. VoiceSpeechModelSection per-model concurrent deletion remains unchanged. Audit3122 removes the direct absolute/parent-segment sparse-directory exception-type sample and the five-row IPC sparse-preset error-code/non-save table (two authored/six expanded cases). Those real typed-validation and IPC refusal/error-code alarms are deliberately retired. Keep both real symlink/junction floating-directory trust cases and the minimal RPC structured validation-reason serialization case. The RPC case does not replace IPC save/refusal behavior, typed normalization for both path inputs, actual Git sparse checkout or rendered localization. No equivalent replacement or fresh test/runtime/platform/remote/performance validation is claimed. Audit3124 removes ExperimentalPane.test.tsx (ordinary Pet switch callback), WorkspaceDirectorySetting.test.tsx (padded absolute saved-path normalization/no-write blur), and repository-search.perf.test.ts (navigation/selected-pane builder-call policy, fixture cardinality/nonempty entries and renamed project keyword inclusion). These real narrow alarms are retired without replacement; RepositoryPane.search.test.tsx search-to-sparse-editor request remains unchanged. Audit3129: resolver Windows case-insensitive and POSIX case-sensitive configured-env composition plus mocked-base launch-preflight Windows composition are intentionally no longer checked by the two deleted suites. No equivalent coverage claimed. Keep runtime-structured-agent-host-env.test.ts unchanged: configured Windows Claude-home account identity and host-account precedence remain checked. Audit3114 incorporates source3101: retire three structured Claude child-environment wrapper cases covering inherited stamp isolation/default and explicit entrypoint, Windows SDK-key canonicalization/default/duplicate-key order, and configured lookup/final environment/config-dir conjunction. Keep direct auth/session sanitation and Windows-versus-Linux overlay checks, actual executable lookup from supplied inherited PATH, native Windows child environment delivery, and stale option-mutation fencing. These are not equivalent replacements for the retired wrapper alarms. No fresh test/runtime, real login-shell probe, Claude SDK startup, remote/mixed-version, UI or performance result is claimed. Audit3114 incorporates source3105: retire 17 authored/20 expanded daemon launch-note cases, including the entire two-case SessionLaunchNote suite. Deliberately lose split-marker carry across same-token re-arm, stale-token retirement refusal, foreground tri-state and serial settlement, omitted-note/no-incarnation mixed-version policy, sticky retirement, first-incarnation/replacement launch preservation and held-launch precedence. Keep only the unchanged unresolved foreground-read race against a later finished attach. Supplied notes/foreground and runtime calls do not establish actual daemon/main restart, SSH, native Windows observation, mobile UI, equivalent replacement or fresh runtime/performance validation. Audit3114 incorporates source3109: retire six authored/35 expanded pricing cases: 21 accepted model-name examples, 10 unsupported/future-model fail-closed examples, malformed TTL clamp, unknown-model estimate refusal, flat-model long-context disregard and oversized long-context clamp. Keep mixed five-minute/one-hour write allocation and short/all-long/mixed long-context allocation with original fixed oracles. Real parser/refusal/bounds alarms are knowingly lost without equivalent replacement; retained tests do not validate provider rates, actual billing or request threshold classification. Preserve the archived usage-scan-append source-freeze receipt without transferring historical execution/performance credit. No fresh runtime result is claimed. Audit3108 source-only reduction (3094/3095/3100): retire 27 authored/30 expanded cases, including complete markdown view-state, file-preview link-open and CLI agent-server-route suites, without replacement. Deliberate losses include preview visibility/reference lifetime and same-path owners; SSH stat, directory/missing-target, explicit-null owner, nonmarkdown line/column, local URI routing, remote-to-client guard and same-file reuse; document-preview source-owner/folder/reuse routing, stable grant location and outside-workspace POSIX/Windows request projection; and verified remote CLI send/check refusal, suggested --on argv/copy, shell no-probe bypass, unverified-launch admission and older-peer refusal. Retain two markdown source-runtime/qualified-reveal alarms, one stale grant-rejection fence and two remote read/mutation evidence policies, with original callbacks. Final last-wins reveal did not prove transient cancellation; CLI prerequisite did not prove no real send, and envelope tests do not execute server refusal. No fresh runtime, rendered UI, actual file/SSH/paired transport, authorization, mixed-version or performance result is claimed. Audit3096 source-only reduction (3087/3088): retire 69 authored/76 expanded cases, including complete recovery-portals and reconnect-banner suites. Intentionally lose dead/default TUI replay, generated alternate-frame style composition, reset/mode/dimension and legacy missing-mode-boundary alarms, UI notice/action/reveal policies, and isolated recovery lifecycle variants, without equivalent replacement. Retained registrations and callbacks are unchanged; headless cells are not pixels, and no fresh runtime, host, SSH, WSL, rendered-app or performance result is claimed. Audit3086 source-only reduction (3079/3080/3081): intentionally retire 93 authored/100 expanded mock-boundary cases, including the complete spawn-errors and SSH reconnect overlay suites, without replacement. Retired alarms include spawn classification/ownership, reply ceilings and renderer-write failure recovery, disconnect/detach fencing branches, authority facts, and overlay retry/visibility wiring. Retained callbacks are unchanged; no fresh execution, real PTY/SSH, rendered UI, or performance result is claimed. The direct side-effect-facts selector retains six cases: replay exclusion, live sequence handling, stale disposer ownership, one handoff drain, drain-before-snapshot, and stale replacement-snapshot refusal. Successful current-entry snapshot application is not witnessed by the retained snapshot case. Audit2432: The broad unit command loses the isolated BranchPicker open-change notification sample. Its unique true/false callback alarm is intentionally retired; reopening/status-refresh behavior was not exercised. No equivalent replacement or fresh validation of the reduced selector is claimed. Audit2425: The broad unit command loses the workspace-copy-status supplied readError forwarding sample. It did not exercise the branch-switch blocking promised by its title. This alarm is intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2417: The broad unit command loses two ordinary clean Git cherry-pick/revert success samples and two terminal startup foreground-read work-budget samples. These unique alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2412: The broad unit command loses the whole six-case fake-React-hook scroll-anchor suite, two generic draft-retention samples, a simple new-agent order sample, a real history-publication batching-count sample, an unmounted handoff abort/timer sample and three basic WSL preview/error samples. These alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2404: The broad unit command loses the standalone share-name lookup 503 propagation suite, initial deletion placement-kind sample, direct changed-mtime stale sample, first-pass rollback existence example and abandoned-preparation directory sample. These exact alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2397 review amendment: The broad unit command loses three standalone suites, two partial-case definitions and two URL table rows across package/download/placement tests. Keep initial wrong-port authorization, modified independent-copy digest refusal and abort-after-begin cancellation dispatch. The remaining alarms are deliberately retired; no equivalent complete replacement or fresh validation of the reduced selector is claimed. Audit2393 current-parent refresh2401: Remove the basic skill-install service alias sample and original public managed-remove receiptless refusal case. Preserve the upstream request ownership suite and transaction interruption coverage. No equivalent complete replacement or fresh validation of the reduced selector is claimed. Audit2389: The broad unit command loses the missing-preview suite, plain-global destination sample and prepublished-receipt recovery example. No equivalent replacement or fresh validation of the reduced selector is claimed. Audit2385: The broad unit command loses four authored walker/staging/protocol examples (six expanded cases); no equivalent replacement or fresh validation is claimed for the reduced suite. Audit2383: The unscoped Vitest command no longer includes the removed Antigravity catalogue suite; its exact provider-root/owner example has no equivalent replacement or fresh validation claim. Audit2377/2381: The unscoped Vitest command includes the reduced bundled-skill and native-discovery suites; the eight removed backup/legacy/catalogue/symlink/SSH-builder examples have no replacement-equivalence or fresh validation claim here. Audit2162: Reduced inventory-authority source intentionally loses the examples recorded in knownGaps; historical execution is not validation of changed bytes. Historical prior account (preserved verbatim): Audit2133 current-parent preparation: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2095 current-parent preparation2126: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2090 (sources2088/2089): Current reduced suites intentionally retire the alarms listed in knownGaps; prior dated execution and replacement claims do not validate changed source bytes or selectors. Historical prior account (preserved verbatim): Audit2086 (sources2082/2083): Current reduced suites intentionally retire the alarms listed in knownGaps; prior dated execution and replacement claims do not validate changed source bytes or selectors. Historical prior account (preserved verbatim): Audit2076 (sources2073/2074): Intentionally retire these low-value alarms without replacement: src/main/runtime/orca-runtime-tests/terminal-handles-part-02.spec.ts: recovers a moved SSH pane through the tab it now sits in, not the one its lease froze; reports a plain expired orphan; does not report a pane whose only recent lease was superseded; does not report a pane whose only recent lease had its relay id recycled; picks the eligible orphan over a superseded predecessor that matches first; collects the same tabs the per-tab reader reports, in one sweep of the leases; reports no candidate when no lease names any of the worktree tabs. src/main/runtime/orca-runtime-tests/runtime-availability.spec.ts: starts unavailable with no authoritative window; reports the configured Windows terminal shell on status; reports floating workspace availability from settings on status; polls floating tabs with targeted PTY liveness and no repo/provider inventory; hydrates persisted tabs when the store cannot report repos; advertises browser screencast only when a renderer window is available; routes mobile Codex reset consumption through the account mutation coordinator; maps a definite pre-provider rejection into an authoritative current snapshot. Existing unrelated evidenceRuns retain their original scope; unchanged dated receipt objects do not validate changed source bytes or reduced selectors. No fresh gate execution or historical import-closure equivalence is claimed. Frozen current literal-import graph reaches these changed test bytes; unresolved local and computed edges remain debt, and current reachability is not historical execution or equivalent replacement evidence. Historical prior account (preserved verbatim): Audit2003: Remove SSH/absent-inventory attach refusal, later-subscriber retry, no-view adoption/takeback, provider-tail/unknown-read projections, failed-keystroke retry and simpler loss reattach examples. Keep the existing-subscriber inventory-ready retry alias only at its retained callback, plus retained held-input cancellation/replacement and overlapping attach/loss fences. The inventory driver also loses the whole empty-worktree-publication registration and folder-host/unverifiable scalar examples. Retire the entire dated10-case attach receipt; retain16 independent receipts only in their original scopes. No retained-memory or real-daemon measurement follows from supplied provider inventories. Changed-source prior results do not validate reduced-source bytes. No fresh execution, equivalent replacement, red/green, measured budget, soak, physical provider/PTY, rendered, live remote/mobile or cross-platform result is claimed. Historical prior account (preserved verbatim): Audit1991: Remove initial-snapshot sequence-domain, limited-tail/truncation and unknown-output-sequence aliases whose callbacks are removed. The source retains partial-chunk replay and requested-snapshot retry/admission at supplied snapshot/data seams, not equivalent replacement or measured retained-memory proof. Preserve the existing stream/pending-wait capacity aliases only to their retained owning multiplex callbacks with supplied PTY resolutions. Removing the sibling-PTY heartbeat dedup work-count sample does not establish a new decorative fanout budget; the unrelated-PTY cancellation fence survives. Preserve17 unrelated dated receipts. Changed-source prior results do not validate reduced-source bytes. No fresh execution, equivalent replacement, red/green, measured budget, soak, physical provider/PTY, rendered, live remote/mobile or cross-platform result is claimed. Historical prior account (preserved verbatim): Audit1983: Remove the reasonless-close selector and narrow census aliases to actual retained runtime and injected-inventory callbacks. The removed synthetic census-dedup and isolated pre-boundary timing cases receive no replacement credit; preserve17 unrelated dated receipts. Changed-source prior results do not validate reduced-source bytes. No fresh execution, equivalent replacement, red/green, measured budget, soak, provider/PTY, rendered, live remote/mobile or cross-platform result is claimed. Historical prior account (preserved verbatim): Audit1939 (sources1934/1935): Delete the synthetic watcher-synchronization and partial-reconciliation suites. Retire all affected host-fact, capability-owner, activation-residue and retention-cap aliases because the remaining callbacks do not establish those full claims. Keep exact local hook/timer, byte-stream side effects, exit/disposal, scroll-intent cleanup and deterministic local rank/TTL progression callbacks within their mocked-host scope. No physical paired-host retention, resource budget or equivalent replacement evidence is assigned. The generic broad test command remains a runnable discovery command, never a dated execution receipt. Preserve meaningful remaining selectors/assertions and unchanged dated receipts within their original scope. Reduced selectors have no fresh gate execution evidence in this metadata packet. No equivalent replacement, physical watcher/PTY/provider, live SSH/remote/mobile, rendered, cross-platform, soak or measured-budget result is claimed. Historical prior account (preserved verbatim): Audit1931 (sources1928/1929): Delete the complete hook-agent-status projection suite and its two behavioral assertion aliases. Supplied stored hook/title/resume/staleness/rename/question/generation/PTY-retirement/snapshot-version projections are intentionally lost. The separate osc-status-scan gate mentions this source only in existing historical notes and receives no mutation. No measured hidden-output retention, CPU/RSS or resource budget result is claimed by the deleted source or this audit. Preserve meaningful remaining selectors/assertions and unchanged dated receipts within their original scope. Reduced selectors have no fresh gate execution evidence in this metadata packet. No equivalent replacement, physical watcher/PTY/provider, live SSH/remote/mobile, rendered, cross-platform, soak or measured-budget result is claimed. Historical prior account (preserved verbatim): Module ownership cleanup retires the modeled cold-park private watcher/render/work-count suites under the current test policy. Their assertions are no longer active evidence. Retained lifecycle tests and headed/headless journeys do not establish equivalent coverage for those removed harness alarms. Audit1640 removes low-value IPC, SSH, workspace and transcript-watcher tests without equivalent replacement coverage. Per-source reviews record retained public refusal, cancellation, execution-host and real-filesystem outcomes with injected/native/remote limits. Affected historical receipts are retired; gates without active current evidence are downgraded. Historical scope before this audit: Audit1634 removes low-value IPC, filesystem and runtime projections, argument inventories and duplicate examples without equivalent replacement coverage. Per-source reviews record retained cancellation, ownership, authorization, filesystem and SQLite boundaries with injected/native/remote limits. Affected historical receipts are retired; gates without active current evidence are downgraded. Historical scope before this audit: Audit1627 removes low-value mocked daemon projections, scalar tables and duplicate terminal examples without equivalent replacement coverage. Per-source reviews record retained terminal content preservation, process ownership refusal and recovery boundaries together with injected/native/remote limits. Affected historical receipts are retired; gates without active current evidence are downgraded. Historical scope before this audit: Retained exact unchanged-source receipts remain the only current execution evidence. Reduced selectors have no fresh execution result. Audit1417 intentionally deletes src/renderer/src/components/terminal-pane/pty-connection-hidden-tui-snapshot-replay.spec.ts: Loses rich hidden snapshot sequence replay/grid resize and forced repaint after hidden snapshot alarms, including live-trigger deduplication. deletes src/renderer/src/components/terminal-pane/terminal-cold-park-verdict-loop.test.tsx: Loses modeled React oscillation alarm; real pane/watchers are not exercised. deletes src/renderer/src/runtime/remote-runtime-terminal-parse-backpressure.test.ts: Loses delayed credit until parsing, malformed frame/unknown stream handling, discarded transformed output recovery and failed ACK rearm alarms. No equivalent replacement coverage or fresh result is claimed. Historical coverage account: Audit1412 changes referenced sources. Retained unchanged-source receipts apply only to their unchanged commands; the reduced selectors have no new execution result. Historical coverage account (not a current claim for changed sources): This audit removes the browser response-after-manual-disconnect example. Its distinct in-flight response fencing alarm is lost; retained queued-call disconnect tests are not an equivalent replacement. Historical commands and results remain historical. Deterministic headed macOS runs launch an isolated Orca desktop server and a separate paired web client. A byte-identical headless run uses an isolated `orca serve` host. Both create six real paired host PTYs with bounded high-output scrollback, prove sustained output while all six client xterms are warm-mounted but hidden causes zero renderer scheduler work, then drive 180 timed real-PTY spinner frames through a second production `session.tabs.subscribeAll` transport and the real Zustand store. Each worktree must publish and apply only its exact initial-working and final-idle titles. Both topologies ordinary-park five xterms without enabling the lossy retention budget, assert bounded cells/heap/timer lag, then restore the bounded authoritative tail exactly once on the original PTY including output produced while parked and continued input/output. The headed oracle additionally keeps every remote target workspace and terminal unmounted in the host renderer before and after client recovery. Production-parity React contracts reproduce and remove the independent cold-park watcher/title feedback loop, including memo-cache discard, StrictMode cleanup replay, detached split-PTY replacement, and the zero-park fast path. A deterministic cross-boundary contract drives 24 real PTY trackers in distinct worktrees through 2,880 decorative spinner and bare-native redraw chunks and counts host publications, serialized bytes, renderer apply calls, and store mutations while preserving exact per-PTY raw chunks and per-worktree semantic transitions. Fake-clock continuation beyond the 30-minute stale boundary requires one deduplicated refresh per worktree every 15 minutes, globally spaced by at least 50 ms, with every mirrored working status still fresh. Exact-identical Pi plus rotating normalized Pi/Grok frames renew coarse working/permission state; rich prompt/tool/question fields retain their original 30-minute lease, and `stateStartedAt`/acknowledgement identity remain stable across title/hook source swaps. A separate headed desktop-client journey relaunches the host main process while retaining the daemon and a daemon-backgrounded PTY, then requires first-observation foreground sync and continued input/output on the same PTY. Unit coverage keeps layout versions out of snapshot output high-waters when a restored snapshot has no output sequence and retries an existing subscriber only after authoritative provider inventory proves the retained PTY exists. Separate headed/headless ACK-starvation tests recover one stalled stream without replacing its PTY. A headed output-drop oracle proves a successful snapshot probe cannot certify a stale live stream when the authoritative PTY sequence advanced beyond the client high-water. Unit coverage requires an unsequenced client to establish a first-probe baseline, remain attached at the same sequence, and recover only after a later probe advances. A capability-disabled run proves legacy hosts retain the prior lossy limit/TTL fallback. Unit tests cover exact-owner capability routing, raw-stream release, singleton side-effect facts with timed handoff cleanup, 64 simultaneous synthetic-title sources with zero decorative client events after convergence, per-client late-subscribe recovery, semantic bell/title transitions, local animation-frame preservation, legacy no-output-pause delivery gating with exact snapshot restore, provider-authoritative snapshots, 128 active streams plus retry after a 129th-stream capacity rejection, capacity-pressure backoff, full split-leaf remint reconciliation, truncation, and manual-disconnect queue fencing. Linux, Windows, live SSH, and production-scale paired hosts remain gaps. The audit removed the E2E parking override/debug-handle suite. Override exposure guards, delay/retention independence, TTL filtering and debug-handle forwarding alarms are lost. Retained real parking journeys do not establish equivalent test-harness configuration coverage. The test-value audit removes separate responsive-stream, intervening-control-frame and capacity-error classification examples. Retained multiplexer checks use fake clocks and captured transport callbacks; their per-stream isolation, deadline and probe-baseline assertions do not prove an actual host restart or equivalent replacement coverage. Historical run commands and results remain historical. The test-value audit removes the standalone retained/live metadata projection and additive-preference negative example from runtime-client-events.test.ts. Its remaining case checks partial-authority event admission through a captured callback; it does not establish full-pair projection, actual peer delivery or equivalent replacement coverage. Historical commands and results remain historical. The isolated accepted-handle-events observer suite is removed. Its runtime/worktree/pane membership, once-only delivery and listener-release ledger alarms are lost. Live hidden-retention evidence does not establish equivalent observer coverage. Audit1292: The entire host-session mirror empty-inventory settle suite is removed. Live-unpublished versus genuinely-empty hydration, same-ID revision response/in-flight fencing and cleared-tracking pending-probe invalidation alarms are lost. The singleton store and inventories were mocked; no real host census or resume delivery or equivalent replacement coverage is claimed. Audit1302: src/main/runtime/session-tabs-inventory-publication.test.ts: Keep actual runtime public inventory authority across renderer epochs/resync, fallback, aborts and invalid graph publishers. Remove copied nonempty publication, private scan counters/collector and known-host replacement, fake refresh that performs the restoration itself, environment capability flag, and private resume-store characterization whose fixture supplies reservation/rollback ordering. Lose isolated refresh/churn/receiver/capability and copied-payload wiring alarms; no equivalent replacement. Reduced selectors require fresh validation; prior full-suite receipts do not validate removed or changed coverage. No equivalent replacement or physical-provider claim. Audit1312 removes low-value imported specs from aggregate test drivers; old whole-driver execution receipts are archived. Retained registrations are unchanged. No equivalent replacement coverage is claimed. Audit1318: src/shared/remote-runtime/control/remote-runtime-shared-control-connection.test.ts: Retain real local encrypted WebSocket regressions for pre-ready socket replacement preserving a request, close-before-ready logical subscription cleanup, unrelated RPC surviving another deadline, and pending setup abort leaving a sibling pending. Host server is synthetic and uses production crypto; kept scenarios also retain internal diagnostics/memory assertions unchanged. Remove happy routing, authority-envelope, unknown-ID/log, cleanup enum, binary, keepalive/liveness and production-budget/private socket inventories; intentionally lose those alarms, no physical host authorization, independent crypto or remote provider claim. Reduced selectors need fresh validation; historical full-suite receipts do not validate the changed coverage. No equivalent replacement or physical-provider claim. Audit1346 removes the entire private-state-injected session-tabs rich-status boundary suite. Its stale task/question, neutral-title preservation, owner-change and provider-generation alarms are intentionally lost. Retained real terminal journeys do not establish equivalent replacement coverage. The prior mixed 42-contract execution receipt is historical and must not validate the reduced current selector; fresh validation remains required. Audit1352: focused Linux unit selections validated on source head b638e07d395b76af3ba6b03761a1a0fe7e5e026e. Historical statements above retain their original scope. Intentional test losses are recorded in knownGaps; these runs claim no physical-provider, p95, rendered E2E or cross-platform validation. Audit1360: focused Linux unit selections validated on source head 415c9cffc2d10024131ec4b6721767a22195de6d. Historical statements above retain their original scope. Intentional test losses are recorded in knownGaps; these runs claim no physical-provider, p95, rendered E2E or cross-platform validation. Audit1383: src/main/runtime/orca-runtime-tests/worktree-native-chat-setup.spec.ts reduced. Lose command-list/receipt/default/background activation matrices whose provider spawn returns canned IDs. Retained test proves actual tab allocation separation, not terminal startup. No equivalent replacement coverage is claimed. Existing exact unaffected receipts and their platform/provider/budget claims remain scoped to unchanged selectors. Changed optional selectors have no new execution result. Audit1391: src/renderer/src/components/terminal-pane/pty-connection-remote-pause-drop-notice.spec.ts reduced. Lose repeated quiet switches avoiding snapshots and legacy host without drop-report capability requesting a snapshot. Retained imported registrar uses fake transport/xterm writes, exercising real gap/restore lifecycle rather than actual terminal rendering. No equivalent replacement coverage is claimed. The existing primary-selector receipt and its claims remain scoped to their unchanged sources; the broad optional command has no new execution result. Audit1396: src/renderer/src/components/terminal-pane/terminal-parked-watcher-reconciliation.test.ts reduced. Retire standalone reconcile set output and positive untouchedFreshSpawn/workspaceOwner copying alarms; no native watcher execution claim. No equivalent replacement coverage is claimed. Existing exact unaffected receipts remain unchanged and apply only to their unchanged selectors. Changed optional selectors have no new execution result. Audit1401: src/main/runtime/orca-runtime-tests/mobile-session-tabs-duplicate-pty-repair.spec.ts removed. Loses listing-on-already-repaired-data alarm; it never established runtime repair invocation. src/main/runtime/orca-runtime-tests/mobile-session-tabs-split-agent-tab.spec.ts removed. Loses actual mobile split sibling shell versus recorded-agent resume command alarms; no equivalent coverage asserted. src/main/runtime/orca-runtime-tests/worktree-native-chat-setup.spec.ts removed. Loses separate setup/startup tab result in that manually assembled path. src/main/runtime/orca-runtime.test.ts reduced. Driver registration/import of a whole-deleted selected spec is removed; directly authored cases remain unchanged. No extra authored removal credit. No equivalent replacement coverage is claimed. Existing exact unaffected receipts remain unchanged and apply only to their unchanged selectors. Changed optional selectors have no new execution result. Audit1402: src/renderer/src/components/terminal-pane/pty-connection-park-reveal-model-snapshot.spec.ts reduced. Loses basic paired serialize/initial replay forwarding check; hidden alt-frame grid/precedence policy remains. No real terminal renderer claim. No equivalent replacement coverage is claimed. The existing primary-selector receipt and its claims remain scoped to their unchanged sources; the broad optional command has no new execution result. Audit1412: src/main/runtime/mobile-session-tabs-agent-status-heartbeat.test.ts reduced. Loses FIFO fairness/spacing, semantic bypass/cancellation, delayed-boundary scheduling and teardown timer-cleanup alarms. Retained fixed emission cases do not replace those outcomes. No equivalent replacement coverage is claimed.", + "coverageNotes": "Audit 3301 combines adopted source batches 3296 and 3299: retire 27 authored declarations and 36 expanded scenarios, including six whole suites. Intentionally lost alarms cover failed-verification/recovery/restart counters and mocked hosting/toast; early overlapping pane-read scheduling/count; unreadable removal listing draft guard; bulk-purge remote-qualified and raw-local guard maps; initial-snapshot blank/mode/oversize/printable/fresh-spawn callback and replay examples; fallback mobile file close and ordinary MRU; default queue overload/drain; seeded browser-page reuse and supplied missing-page URL recreation; ambiguous sleep/hibernation owner refusal and untouched bindings/origins; ordinary selection/activity/fallback priority; skip-remote success and retained hints; supplied structured-chat unsent retention and scoped removal draft eviction; caller-chat focus precedence; open/draft PR cache eviction and merged-head fallback result inventories. Retained adverse-ordering and ownership cases are narrower and do not establish equivalent replacements. No fresh runtime, native, physical provider, cross-platform, mobile or mixed-version evidence is claimed. Audit 3292 combines adopted 3285/3287/3289/3293 removals: 40 authored declarations and 47 expanded scenarios, including whole frame-editor-view, ambiguous remote-delete-refusal, unverifiable-host subscription and editor-close cleanup suites. The previously reviewed dock-badge suite was already removed upstream in PR 40895 and receives zero new removal credit. Intentionally retired alarms include background browser selection and last-tab landing; main startup fallback, SSH project cleanup/survivor routing, exact-PR contradiction/saved-push positives, replay/sidecar rollback and wrapped remote error normalization; records/snapshot missing-diff hydration, ambiguous folder-owner delete refusal, focus no-op notifications, nested editor context-only cache check, pending broadcast-first status and ordinary four-confirmation aggregation; preview-source frontmatter pruning, approved local/runtime agent dispatch, non-GitHub legacy PR cache invalidation, stale merged-head transient-error fallback, empty-queue immediate query reply and unverified-to-concrete preflight risk. Additional intentionally retired alarms are injected host subscription/unsubscribe counts, synthetic editor reveal/draft/fallback/scoped close, ambiguous unread refusals and hidden mark/read roundtrip, immediate connect backoff/noError, positive mirrored evidence-clock renewal, supplied VM failure/success projections and git-local/folder-SSH wake permutations. Remaining temporal/ownership cases are narrower; no equivalent replacement or fresh execution is claimed. Audit 3283 removes 20 authored declarations and 31 expanded scenarios, including two whole suites. Retired alarms cover PR refresh-state pruning, shared runtime subscription cleanup and store isolation, language content-change routing and older completion ownership, ordinary panel retry-timer cleanup and pending loading, four hosted-review lifetime permutations, mocked terminal creation error/order wiring, five sleep-inventory variants with pending-frame-only assertions, palette fallback/composite highlights, Windows/UNC encoded-editor input rows, mixed-repository partial failure counts, title setters and generated-title bypass/replacement, five window-close coordinator delegation/guard/finally branches, and ambiguous-old-record frame reveal. These regression checks are intentionally lost under the test-value audit; retained cases are not equivalent replacements. Prior coverage notes and receipts remain historical. Audit 3273 removes 14 authored declarations and 19 expanded scenarios across four whole suites and eight partial suites. Retired alarms cover saved-local cancellation/layout ownership, ambiguous-owner warning reset, folder attachment routing, VM false-capability bypass, abandoned reveal warmup cleanup and viewport claim deduplication/rearming, quiet unrelated remote-removal refusal, startup-command one-shot consumption, repository/floating recovery-ledger rows, fake-React pinned-scroll intent, split-ratio state identity/subscriber suppression and fractional change, cross-host project-group join refusal, three PR request-lifetime permutations, upstream-status preservation on error, and unresolved Git-owner refusal. These regression checks are intentionally lost under the test-value audit; retained scenarios are not equivalent replacements. Historical coverage receipts remain historical, including gate35 subscriber claims. Audit 3256 removes these specific alarms from the broad root unit commands: skill dialog active-share selection, close and pending-share handoff; simple keyed-record deletion; marker live-region insertion, simple landing and nine baseline policy examples; General search/control navigation inventory; orphan-count cache bootstrap; seven Codex code classifications and HTTP 429 warning mapping; two skill unread-root verdict examples; peer-mail payload and conversation-ID rejection; and the GitHub organization TABLE text-field optimistic rollback/failed-envelope example. These include real behaviors; retained tests do not provide equivalent coverage for every removed scenario. Mobile losses are recorded separately and are not coverage of these root commands. Audit3246 retires NewRowsMarker reveal/no-repeat and pane-scoped beforeinput checks; skill-owner option availability/count/dedup/order; six styled Input/Textarea IME forwarding rows; the static Codex/OpenCode smart-key inventory; tab-map AST ratchet diagnostic fixtures; child-roster work-budget and retained-aggregate alarms; malformed persisted floating-cwd fallback/no-crash/empty exact-root checks; the unanswered-host empty-list discriminator; the direct invalidated-cache commit-false assertion; one redundant digit-keyup IME row; cached non-supported Claude title-generator rows; and the duplicate late naming-result singleton. These root broad commands lose those specific alarms without equivalent replacement. Distinct retained owner/state checks have their own bounded claims; the real scheduler still rejects stale response data, while the direct false-return alarm is retired. Audit3231 retires supported-host restore-pane key mapping, closed/open creation-sidebar toggle visibility, unrelated scope-error/null classification and quick-submit reveal/no-create checks. These broad commands lose those real narrow alarms; no replacement coverage is claimed. Audit3219 removes the synthetic Cmd+J extra-source suite; this broad command no longer checks its match/tie placement and selection, announced count, empty-query cap, or workspace hiding with retained recent tabs. No replacement coverage is claimed. Audit3209 composes approved sources3202/3206: deliberately retires seven authored/expanded cases in four whole suites without equivalent replacement. Work-item queries lose real GitHub/GitLab oversized ASCII secret-prefix empty-query and whitespace-before-trim refusal alarms; inputs share the imported size bound and exercise only its fast length branch, with no multibyte or actual provider/exposure guarantee. Skill sharing loses complete/partial managed-bundle and destination-ambiguity association checks plus three negative origin/path/scheme admission examples; these do not establish uploaded contents, arbitrary-URL fetching, authorization or execution. Retain exact originless-project direct-link fallback, cloud-delete confirmation, bundled-target repair/owner isolation and explicit Windows-host preference over stale WSL suites. Rejected3201 runtime-preference removal is excluded. No real cloud/network/host/disk, mobile or mixed-version execution validation is claimed. Audit3200 composes approved source3194: deliberately retires thirteen authored registrations/twenty-seven expanded cases in six whole automation host/list policy suites without equivalent replacement. Real RPC category/retryability and wrapped-timeout recognition, unscoped-failure/scoped-success health evidence precedence, exact-ID create selectors and per-run workspace omission, paired-web local/SSH/absent host catalog routing, incompatible/removed/unhydrated/offline execution health, runtime-before-nested-SSH recovery dispatch, and no-owned-focus/successor/foreign-list focus policy alarms are consciously lost. Retain exact20line orphan allow/refuse/precondition and exact90line cross-host same-ID search suites. No retry-timer/fence lifecycle, actual reconnect/network/write delivery, native focus, mobile/mixed-version runtime or disk persistence coverage is claimed. Audit3191 combines approved source3182/3187/3188: deliberately retires thirteen authored Vitest registrations and fifteen expanded cases, including five whole suites, without equivalent replacement. Attachment intake loses real portal/native-capture terminal interception and unowned-container refusal, immediate child-only committed availability/claim-ref negotiation and delivery, and direct-target over stable focused/background composer routing through disable/re-enable/remount and independent question focus. Exact destination/cache/draft and final-stat owner/workspace/File-release suites remain; they do not replace Surface recipient routing. Automation authoring loses destination runtime catalog membership, local/direct-SSH exclusion of paired-runtime repos, unknown-runtime empty catalog, logical project/host/setup/repo/path context payload, and missing/nonready setup refusal; these were genuine direct helper alarms, while exact schedule transformation, legacy schedule and setup-decision suites remain. Agent picker loses setup-chat/terminal/missing-installer/unsupported-or-unknown-host row projection samples and the ordinary unsearched menu variant; the entire original26-line resume recipe suite remains, including reported bypass versus default/absent permission modes, as does the exact search-result menu callback with its fixtures, model/effort commits and staged Arguments reopen outcome. Rejected predecessor3180 full recipe deletion is excluded. No actual native drag/cursor/focus/IME, upload bytes or disk/restart persistence, full automation save/scheduler/runtime transport, real resume-process flags/environment delivery, or native menu/rendered layout validation is claimed. Audit3178 combines source3169/3170/3175: deliberately retires eight authored units (six Vitest cases and two imperative custom relay scenarios), including two whole suites, without equivalent replacement. Voice Section loses per-model pending-delete isolation across interleaved A/B completion and the two-success refresh-call alarm; exact VoicePane delayed key-clear/newer enabled-toggle merge remains and does not replace row deletion coverage. Speech loses dedicated rating-scale/inclusive-ceiling, unsupported-versus-unmeasured, explicit/system-language precedence/locale alias, accuracy versus fast named/default/best-measured selection, and unmeasured/no-match examples; exact offered-user-pick versus retired-selection case and its fixture remain. Relay loses legacy ping-delivery count/liveness sampled before the silence deadline and grouped malformed Bearer/host-ID 401/429 routing checks; twelve real Worker/DurableObject/shipped-client scenarios remain, not equivalent replacement for those narrow alarms. Six prior speech cases are not all deleted: approved successor3175 keeps the original user-choice case. No actual credential/file persistence, native/GPU/engine/download delivery, production assignment policy or deployed-runtime validation is claimed by this reduction. Audit3165 combines source3160/3162: deliberately retires six authored/expanded cases across three whole suites without equivalent replacement. Launch/status losses: observed React-render pending/resuming coordination across settings and deferred offer read; stale-offer reread suppressing dialog reopen; held-local-chat recovery visibility with new-chat preferences off; disabled-local admission avoiding offer RPC despite an injected but unconsumed paired-tab fixture; and run-only lost-reply uncertainty reachability until direct viewed-run retirement. Launch probe does not prove arbitrary synchronous-store atomicity, the paired fixture is not remote runtime enrollment, and the status case directly marks viewed state rather than rendering the summary. Crew-hook losses: old-host method_not_found cache persists across party changes but is released by independently supplied connection generation/verified pairing status or pairing revision, with actual frame publication and teardown. These are real narrow coordination, admission, uncertainty and mixed-version cache alarms consciously lost. Exact web verified-runtime writer handoff guard remains; it does not replace those alarms or prove live host/native/mobile delivery. Audit3156 combines3147/3150/3152/3153/3154: deliberately retires39authored/40expanded native-chat recovery cases, eight whole suites and two orphan test-support files without equivalent replacement. Lost alarms: lost-reply unconfirmed reconciliation, skipped rows/counts and missed-frame repair, unknown/pending outcome and omitted-failure-list compatibility, uncertain history after dismissal, retry/refusal/dismiss lifecycle, hidden/consumed picker ownership, result-tree keyboard focus/disclosure and all-skipped retirement; unconfirmed-over-conflict guidance and failed-chat changes despite older host timestamps; nearest-listed ancestor/cyclic forest shape, descendant membership, host ordering/missing-host local fallback; skipped/readiness/admission counts, provisional skip/progress monotonicity, early per-chat verdicts with batch pending protection, older-host waiting, start-slot/delivery distinction, retry-over-failure and unknown-after-withdrawal attention; remote snooze/reconnect/reoffer, unseen mixed summary through open/close, watched completion retirement, new success beside old failure, failed-reread mixed-result preservation, filter/collapse completion resets, retry summary replacement and current-offer/history selection; cross-host workspace identity, rendered cyclic reachability, nested tri-state/toggle propagation, project eligibility isolation and collapse preserving selection. Exact fallback-list completion barrier, batched verdict/cleanup retention, stale-read versus dismissal publication race, and requested-but-never-rendered finished-run retirement remain; they do not replace retired alarms. Audit3146 combines source reviews3132/3133/3135/3138/3143: intentionally retire20authored/31expanded cases without equivalent replacement. Provider-session losses: structured-native terminal-resume exclusion, metadata-less completed identity, new-turn completion clearing, Pi provider-only/periodic/manual promotion, changed-transcript launch-config isolation, Pi/omp/prime-agent completed-session remote/manual-shutdown promotion, and quit/done precedence over heartbeat. Side-thread/question losses: finished-pane acquisition, hidden title/recap states, local/relay/relay-done conversation takeover with prompt/session/child resets, plain-message abandonment, compaction/session replacement and completion resets. Codex startup losses: incoming-owner cached child replacement, old-relay foreign live-session correction, completed foreign-root turn-fact permutations. Transcript losses: real temporary-JSONL partial sibling/final-child completion, unlabelled child attribution, compact cached replay preservation and100/1000completed-child roster retention/release. Compiler-ratchet losses: valid-line uncompiled-list parser grammar examples and injected-existence stale-path filtering; these did not exercise actual filesystem canonicalization or build exclusion. These are real lifecycle, ownership, replay, liveness and retention alarms, including recent#40246 regressions, deliberately lost. Retained conditional record replacement, clockless root/SSH owner isolation, persisted main-thread fork rejection, partial/final question-answer lifetime, cached-roster/missing-ID/live HTTP/durable startup boundaries and restarted-relay refusal/acceptance do not replace those losses. No native/SSH/WSL execution or equivalent coverage is claimed. Audit3128 scoped coverage reduction: Audit3121 removes VoiceDictationLanguageSetting.test.tsx (Spanish-to-es callback and unsupported-model Korean option presence) and voice-speech-model-rows.test.ts (provider/language-order/retired-on-disk list policy); these real narrow alarms are deliberately retired without replacement. VoiceSpeechModelSection per-model concurrent deletion remains unchanged. Audit3122 removes the direct absolute/parent-segment sparse-directory exception-type sample and the five-row IPC sparse-preset error-code/non-save table (two authored/six expanded cases). Those real typed-validation and IPC refusal/error-code alarms are deliberately retired. Keep both real symlink/junction floating-directory trust cases and the minimal RPC structured validation-reason serialization case. The RPC case does not replace IPC save/refusal behavior, typed normalization for both path inputs, actual Git sparse checkout or rendered localization. No equivalent replacement or fresh test/runtime/platform/remote/performance validation is claimed. Audit3124 removes ExperimentalPane.test.tsx (ordinary Pet switch callback), WorkspaceDirectorySetting.test.tsx (padded absolute saved-path normalization/no-write blur), and repository-search.perf.test.ts (navigation/selected-pane builder-call policy, fixture cardinality/nonempty entries and renamed project keyword inclusion). These real narrow alarms are retired without replacement; RepositoryPane.search.test.tsx search-to-sparse-editor request remains unchanged. Audit3129: resolver Windows case-insensitive and POSIX case-sensitive configured-env composition plus mocked-base launch-preflight Windows composition are intentionally no longer checked by the two deleted suites. No equivalent coverage claimed. Keep runtime-structured-agent-host-env.test.ts unchanged: configured Windows Claude-home account identity and host-account precedence remain checked. Audit3114 incorporates source3101: retire three structured Claude child-environment wrapper cases covering inherited stamp isolation/default and explicit entrypoint, Windows SDK-key canonicalization/default/duplicate-key order, and configured lookup/final environment/config-dir conjunction. Keep direct auth/session sanitation and Windows-versus-Linux overlay checks, actual executable lookup from supplied inherited PATH, native Windows child environment delivery, and stale option-mutation fencing. These are not equivalent replacements for the retired wrapper alarms. No fresh test/runtime, real login-shell probe, Claude SDK startup, remote/mixed-version, UI or performance result is claimed. Audit3114 incorporates source3105: retire 17 authored/20 expanded daemon launch-note cases, including the entire two-case SessionLaunchNote suite. Deliberately lose split-marker carry across same-token re-arm, stale-token retirement refusal, foreground tri-state and serial settlement, omitted-note/no-incarnation mixed-version policy, sticky retirement, first-incarnation/replacement launch preservation and held-launch precedence. Keep only the unchanged unresolved foreground-read race against a later finished attach. Supplied notes/foreground and runtime calls do not establish actual daemon/main restart, SSH, native Windows observation, mobile UI, equivalent replacement or fresh runtime/performance validation. Audit3114 incorporates source3109: retire six authored/35 expanded pricing cases: 21 accepted model-name examples, 10 unsupported/future-model fail-closed examples, malformed TTL clamp, unknown-model estimate refusal, flat-model long-context disregard and oversized long-context clamp. Keep mixed five-minute/one-hour write allocation and short/all-long/mixed long-context allocation with original fixed oracles. Real parser/refusal/bounds alarms are knowingly lost without equivalent replacement; retained tests do not validate provider rates, actual billing or request threshold classification. Preserve the archived usage-scan-append source-freeze receipt without transferring historical execution/performance credit. No fresh runtime result is claimed. Audit3108 source-only reduction (3094/3095/3100): retire 27 authored/30 expanded cases, including complete markdown view-state, file-preview link-open and CLI agent-server-route suites, without replacement. Deliberate losses include preview visibility/reference lifetime and same-path owners; SSH stat, directory/missing-target, explicit-null owner, nonmarkdown line/column, local URI routing, remote-to-client guard and same-file reuse; document-preview source-owner/folder/reuse routing, stable grant location and outside-workspace POSIX/Windows request projection; and verified remote CLI send/check refusal, suggested --on argv/copy, shell no-probe bypass, unverified-launch admission and older-peer refusal. Retain two markdown source-runtime/qualified-reveal alarms, one stale grant-rejection fence and two remote read/mutation evidence policies, with original callbacks. Final last-wins reveal did not prove transient cancellation; CLI prerequisite did not prove no real send, and envelope tests do not execute server refusal. No fresh runtime, rendered UI, actual file/SSH/paired transport, authorization, mixed-version or performance result is claimed. Audit3096 source-only reduction (3087/3088): retire 69 authored/76 expanded cases, including complete recovery-portals and reconnect-banner suites. Intentionally lose dead/default TUI replay, generated alternate-frame style composition, reset/mode/dimension and legacy missing-mode-boundary alarms, UI notice/action/reveal policies, and isolated recovery lifecycle variants, without equivalent replacement. Retained registrations and callbacks are unchanged; headless cells are not pixels, and no fresh runtime, host, SSH, WSL, rendered-app or performance result is claimed. Audit3086 source-only reduction (3079/3080/3081): intentionally retire 93 authored/100 expanded mock-boundary cases, including the complete spawn-errors and SSH reconnect overlay suites, without replacement. Retired alarms include spawn classification/ownership, reply ceilings and renderer-write failure recovery, disconnect/detach fencing branches, authority facts, and overlay retry/visibility wiring. Retained callbacks are unchanged; no fresh execution, real PTY/SSH, rendered UI, or performance result is claimed. The direct side-effect-facts selector retains six cases: replay exclusion, live sequence handling, stale disposer ownership, one handoff drain, drain-before-snapshot, and stale replacement-snapshot refusal. Successful current-entry snapshot application is not witnessed by the retained snapshot case. Audit2432: The broad unit command loses the isolated BranchPicker open-change notification sample. Its unique true/false callback alarm is intentionally retired; reopening/status-refresh behavior was not exercised. No equivalent replacement or fresh validation of the reduced selector is claimed. Audit2425: The broad unit command loses the workspace-copy-status supplied readError forwarding sample. It did not exercise the branch-switch blocking promised by its title. This alarm is intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2417: The broad unit command loses two ordinary clean Git cherry-pick/revert success samples and two terminal startup foreground-read work-budget samples. These unique alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2412: The broad unit command loses the whole six-case fake-React-hook scroll-anchor suite, two generic draft-retention samples, a simple new-agent order sample, a real history-publication batching-count sample, an unmounted handoff abort/timer sample and three basic WSL preview/error samples. These alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2404: The broad unit command loses the standalone share-name lookup 503 propagation suite, initial deletion placement-kind sample, direct changed-mtime stale sample, first-pass rollback existence example and abandoned-preparation directory sample. These exact alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2397 review amendment: The broad unit command loses three standalone suites, two partial-case definitions and two URL table rows across package/download/placement tests. Keep initial wrong-port authorization, modified independent-copy digest refusal and abort-after-begin cancellation dispatch. The remaining alarms are deliberately retired; no equivalent complete replacement or fresh validation of the reduced selector is claimed. Audit2393 current-parent refresh2401: Remove the basic skill-install service alias sample and original public managed-remove receiptless refusal case. Preserve the upstream request ownership suite and transaction interruption coverage. No equivalent complete replacement or fresh validation of the reduced selector is claimed. Audit2389: The broad unit command loses the missing-preview suite, plain-global destination sample and prepublished-receipt recovery example. No equivalent replacement or fresh validation of the reduced selector is claimed. Audit2385: The broad unit command loses four authored walker/staging/protocol examples (six expanded cases); no equivalent replacement or fresh validation is claimed for the reduced suite. Audit2383: The unscoped Vitest command no longer includes the removed Antigravity catalogue suite; its exact provider-root/owner example has no equivalent replacement or fresh validation claim. Audit2377/2381: The unscoped Vitest command includes the reduced bundled-skill and native-discovery suites; the eight removed backup/legacy/catalogue/symlink/SSH-builder examples have no replacement-equivalence or fresh validation claim here. Audit2162: Reduced inventory-authority source intentionally loses the examples recorded in knownGaps; historical execution is not validation of changed bytes. Historical prior account (preserved verbatim): Audit2133 current-parent preparation: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2095 current-parent preparation2126: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2090 (sources2088/2089): Current reduced suites intentionally retire the alarms listed in knownGaps; prior dated execution and replacement claims do not validate changed source bytes or selectors. Historical prior account (preserved verbatim): Audit2086 (sources2082/2083): Current reduced suites intentionally retire the alarms listed in knownGaps; prior dated execution and replacement claims do not validate changed source bytes or selectors. Historical prior account (preserved verbatim): Audit2076 (sources2073/2074): Intentionally retire these low-value alarms without replacement: src/main/runtime/orca-runtime-tests/terminal-handles-part-02.spec.ts: recovers a moved SSH pane through the tab it now sits in, not the one its lease froze; reports a plain expired orphan; does not report a pane whose only recent lease was superseded; does not report a pane whose only recent lease had its relay id recycled; picks the eligible orphan over a superseded predecessor that matches first; collects the same tabs the per-tab reader reports, in one sweep of the leases; reports no candidate when no lease names any of the worktree tabs. src/main/runtime/orca-runtime-tests/runtime-availability.spec.ts: starts unavailable with no authoritative window; reports the configured Windows terminal shell on status; reports floating workspace availability from settings on status; polls floating tabs with targeted PTY liveness and no repo/provider inventory; hydrates persisted tabs when the store cannot report repos; advertises browser screencast only when a renderer window is available; routes mobile Codex reset consumption through the account mutation coordinator; maps a definite pre-provider rejection into an authoritative current snapshot. Existing unrelated evidenceRuns retain their original scope; unchanged dated receipt objects do not validate changed source bytes or reduced selectors. No fresh gate execution or historical import-closure equivalence is claimed. Frozen current literal-import graph reaches these changed test bytes; unresolved local and computed edges remain debt, and current reachability is not historical execution or equivalent replacement evidence. Historical prior account (preserved verbatim): Audit2003: Remove SSH/absent-inventory attach refusal, later-subscriber retry, no-view adoption/takeback, provider-tail/unknown-read projections, failed-keystroke retry and simpler loss reattach examples. Keep the existing-subscriber inventory-ready retry alias only at its retained callback, plus retained held-input cancellation/replacement and overlapping attach/loss fences. The inventory driver also loses the whole empty-worktree-publication registration and folder-host/unverifiable scalar examples. Retire the entire dated10-case attach receipt; retain16 independent receipts only in their original scopes. No retained-memory or real-daemon measurement follows from supplied provider inventories. Changed-source prior results do not validate reduced-source bytes. No fresh execution, equivalent replacement, red/green, measured budget, soak, physical provider/PTY, rendered, live remote/mobile or cross-platform result is claimed. Historical prior account (preserved verbatim): Audit1991: Remove initial-snapshot sequence-domain, limited-tail/truncation and unknown-output-sequence aliases whose callbacks are removed. The source retains partial-chunk replay and requested-snapshot retry/admission at supplied snapshot/data seams, not equivalent replacement or measured retained-memory proof. Preserve the existing stream/pending-wait capacity aliases only to their retained owning multiplex callbacks with supplied PTY resolutions. Removing the sibling-PTY heartbeat dedup work-count sample does not establish a new decorative fanout budget; the unrelated-PTY cancellation fence survives. Preserve17 unrelated dated receipts. Changed-source prior results do not validate reduced-source bytes. No fresh execution, equivalent replacement, red/green, measured budget, soak, physical provider/PTY, rendered, live remote/mobile or cross-platform result is claimed. Historical prior account (preserved verbatim): Audit1983: Remove the reasonless-close selector and narrow census aliases to actual retained runtime and injected-inventory callbacks. The removed synthetic census-dedup and isolated pre-boundary timing cases receive no replacement credit; preserve17 unrelated dated receipts. Changed-source prior results do not validate reduced-source bytes. No fresh execution, equivalent replacement, red/green, measured budget, soak, provider/PTY, rendered, live remote/mobile or cross-platform result is claimed. Historical prior account (preserved verbatim): Audit1939 (sources1934/1935): Delete the synthetic watcher-synchronization and partial-reconciliation suites. Retire all affected host-fact, capability-owner, activation-residue and retention-cap aliases because the remaining callbacks do not establish those full claims. Keep exact local hook/timer, byte-stream side effects, exit/disposal, scroll-intent cleanup and deterministic local rank/TTL progression callbacks within their mocked-host scope. No physical paired-host retention, resource budget or equivalent replacement evidence is assigned. The generic broad test command remains a runnable discovery command, never a dated execution receipt. Preserve meaningful remaining selectors/assertions and unchanged dated receipts within their original scope. Reduced selectors have no fresh gate execution evidence in this metadata packet. No equivalent replacement, physical watcher/PTY/provider, live SSH/remote/mobile, rendered, cross-platform, soak or measured-budget result is claimed. Historical prior account (preserved verbatim): Audit1931 (sources1928/1929): Delete the complete hook-agent-status projection suite and its two behavioral assertion aliases. Supplied stored hook/title/resume/staleness/rename/question/generation/PTY-retirement/snapshot-version projections are intentionally lost. The separate osc-status-scan gate mentions this source only in existing historical notes and receives no mutation. No measured hidden-output retention, CPU/RSS or resource budget result is claimed by the deleted source or this audit. Preserve meaningful remaining selectors/assertions and unchanged dated receipts within their original scope. Reduced selectors have no fresh gate execution evidence in this metadata packet. No equivalent replacement, physical watcher/PTY/provider, live SSH/remote/mobile, rendered, cross-platform, soak or measured-budget result is claimed. Historical prior account (preserved verbatim): Module ownership cleanup retires the modeled cold-park private watcher/render/work-count suites under the current test policy. Their assertions are no longer active evidence. Retained lifecycle tests and headed/headless journeys do not establish equivalent coverage for those removed harness alarms. Audit1640 removes low-value IPC, SSH, workspace and transcript-watcher tests without equivalent replacement coverage. Per-source reviews record retained public refusal, cancellation, execution-host and real-filesystem outcomes with injected/native/remote limits. Affected historical receipts are retired; gates without active current evidence are downgraded. Historical scope before this audit: Audit1634 removes low-value IPC, filesystem and runtime projections, argument inventories and duplicate examples without equivalent replacement coverage. Per-source reviews record retained cancellation, ownership, authorization, filesystem and SQLite boundaries with injected/native/remote limits. Affected historical receipts are retired; gates without active current evidence are downgraded. Historical scope before this audit: Audit1627 removes low-value mocked daemon projections, scalar tables and duplicate terminal examples without equivalent replacement coverage. Per-source reviews record retained terminal content preservation, process ownership refusal and recovery boundaries together with injected/native/remote limits. Affected historical receipts are retired; gates without active current evidence are downgraded. Historical scope before this audit: Retained exact unchanged-source receipts remain the only current execution evidence. Reduced selectors have no fresh execution result. Audit1417 intentionally deletes src/renderer/src/components/terminal-pane/pty-connection-hidden-tui-snapshot-replay.spec.ts: Loses rich hidden snapshot sequence replay/grid resize and forced repaint after hidden snapshot alarms, including live-trigger deduplication. deletes src/renderer/src/components/terminal-pane/terminal-cold-park-verdict-loop.test.tsx: Loses modeled React oscillation alarm; real pane/watchers are not exercised. deletes src/renderer/src/runtime/remote-runtime-terminal-parse-backpressure.test.ts: Loses delayed credit until parsing, malformed frame/unknown stream handling, discarded transformed output recovery and failed ACK rearm alarms. No equivalent replacement coverage or fresh result is claimed. Historical coverage account: Audit1412 changes referenced sources. Retained unchanged-source receipts apply only to their unchanged commands; the reduced selectors have no new execution result. Historical coverage account (not a current claim for changed sources): This audit removes the browser response-after-manual-disconnect example. Its distinct in-flight response fencing alarm is lost; retained queued-call disconnect tests are not an equivalent replacement. Historical commands and results remain historical. Deterministic headed macOS runs launch an isolated Orca desktop server and a separate paired web client. A byte-identical headless run uses an isolated `orca serve` host. Both create six real paired host PTYs with bounded high-output scrollback, prove sustained output while all six client xterms are warm-mounted but hidden causes zero renderer scheduler work, then drive 180 timed real-PTY spinner frames through a second production `session.tabs.subscribeAll` transport and the real Zustand store. Each worktree must publish and apply only its exact initial-working and final-idle titles. Both topologies ordinary-park five xterms without enabling the lossy retention budget, assert bounded cells/heap/timer lag, then restore the bounded authoritative tail exactly once on the original PTY including output produced while parked and continued input/output. The headed oracle additionally keeps every remote target workspace and terminal unmounted in the host renderer before and after client recovery. Production-parity React contracts reproduce and remove the independent cold-park watcher/title feedback loop, including memo-cache discard, StrictMode cleanup replay, detached split-PTY replacement, and the zero-park fast path. A deterministic cross-boundary contract drives 24 real PTY trackers in distinct worktrees through 2,880 decorative spinner and bare-native redraw chunks and counts host publications, serialized bytes, renderer apply calls, and store mutations while preserving exact per-PTY raw chunks and per-worktree semantic transitions. Fake-clock continuation beyond the 30-minute stale boundary requires one deduplicated refresh per worktree every 15 minutes, globally spaced by at least 50 ms, with every mirrored working status still fresh. Exact-identical Pi plus rotating normalized Pi/Grok frames renew coarse working/permission state; rich prompt/tool/question fields retain their original 30-minute lease, and `stateStartedAt`/acknowledgement identity remain stable across title/hook source swaps. A separate headed desktop-client journey relaunches the host main process while retaining the daemon and a daemon-backgrounded PTY, then requires first-observation foreground sync and continued input/output on the same PTY. Unit coverage keeps layout versions out of snapshot output high-waters when a restored snapshot has no output sequence and retries an existing subscriber only after authoritative provider inventory proves the retained PTY exists. Separate headed/headless ACK-starvation tests recover one stalled stream without replacing its PTY. A headed output-drop oracle proves a successful snapshot probe cannot certify a stale live stream when the authoritative PTY sequence advanced beyond the client high-water. Unit coverage requires an unsequenced client to establish a first-probe baseline, remain attached at the same sequence, and recover only after a later probe advances. A capability-disabled run proves legacy hosts retain the prior lossy limit/TTL fallback. Unit tests cover exact-owner capability routing, raw-stream release, singleton side-effect facts with timed handoff cleanup, 64 simultaneous synthetic-title sources with zero decorative client events after convergence, per-client late-subscribe recovery, semantic bell/title transitions, local animation-frame preservation, legacy no-output-pause delivery gating with exact snapshot restore, provider-authoritative snapshots, 128 active streams plus retry after a 129th-stream capacity rejection, capacity-pressure backoff, full split-leaf remint reconciliation, truncation, and manual-disconnect queue fencing. Linux, Windows, live SSH, and production-scale paired hosts remain gaps. The audit removed the E2E parking override/debug-handle suite. Override exposure guards, delay/retention independence, TTL filtering and debug-handle forwarding alarms are lost. Retained real parking journeys do not establish equivalent test-harness configuration coverage. The test-value audit removes separate responsive-stream, intervening-control-frame and capacity-error classification examples. Retained multiplexer checks use fake clocks and captured transport callbacks; their per-stream isolation, deadline and probe-baseline assertions do not prove an actual host restart or equivalent replacement coverage. Historical run commands and results remain historical. The test-value audit removes the standalone retained/live metadata projection and additive-preference negative example from runtime-client-events.test.ts. Its remaining case checks partial-authority event admission through a captured callback; it does not establish full-pair projection, actual peer delivery or equivalent replacement coverage. Historical commands and results remain historical. The isolated accepted-handle-events observer suite is removed. Its runtime/worktree/pane membership, once-only delivery and listener-release ledger alarms are lost. Live hidden-retention evidence does not establish equivalent observer coverage. Audit1292: The entire host-session mirror empty-inventory settle suite is removed. Live-unpublished versus genuinely-empty hydration, same-ID revision response/in-flight fencing and cleared-tracking pending-probe invalidation alarms are lost. The singleton store and inventories were mocked; no real host census or resume delivery or equivalent replacement coverage is claimed. Audit1302: src/main/runtime/session-tabs-inventory-publication.test.ts: Keep actual runtime public inventory authority across renderer epochs/resync, fallback, aborts and invalid graph publishers. Remove copied nonempty publication, private scan counters/collector and known-host replacement, fake refresh that performs the restoration itself, environment capability flag, and private resume-store characterization whose fixture supplies reservation/rollback ordering. Lose isolated refresh/churn/receiver/capability and copied-payload wiring alarms; no equivalent replacement. Reduced selectors require fresh validation; prior full-suite receipts do not validate removed or changed coverage. No equivalent replacement or physical-provider claim. Audit1312 removes low-value imported specs from aggregate test drivers; old whole-driver execution receipts are archived. Retained registrations are unchanged. No equivalent replacement coverage is claimed. Audit1318: src/shared/remote-runtime/control/remote-runtime-shared-control-connection.test.ts: Retain real local encrypted WebSocket regressions for pre-ready socket replacement preserving a request, close-before-ready logical subscription cleanup, unrelated RPC surviving another deadline, and pending setup abort leaving a sibling pending. Host server is synthetic and uses production crypto; kept scenarios also retain internal diagnostics/memory assertions unchanged. Remove happy routing, authority-envelope, unknown-ID/log, cleanup enum, binary, keepalive/liveness and production-budget/private socket inventories; intentionally lose those alarms, no physical host authorization, independent crypto or remote provider claim. Reduced selectors need fresh validation; historical full-suite receipts do not validate the changed coverage. No equivalent replacement or physical-provider claim. Audit1346 removes the entire private-state-injected session-tabs rich-status boundary suite. Its stale task/question, neutral-title preservation, owner-change and provider-generation alarms are intentionally lost. Retained real terminal journeys do not establish equivalent replacement coverage. The prior mixed 42-contract execution receipt is historical and must not validate the reduced current selector; fresh validation remains required. Audit1352: focused Linux unit selections validated on source head b638e07d395b76af3ba6b03761a1a0fe7e5e026e. Historical statements above retain their original scope. Intentional test losses are recorded in knownGaps; these runs claim no physical-provider, p95, rendered E2E or cross-platform validation. Audit1360: focused Linux unit selections validated on source head 415c9cffc2d10024131ec4b6721767a22195de6d. Historical statements above retain their original scope. Intentional test losses are recorded in knownGaps; these runs claim no physical-provider, p95, rendered E2E or cross-platform validation. Audit1383: src/main/runtime/orca-runtime-tests/worktree-native-chat-setup.spec.ts reduced. Lose command-list/receipt/default/background activation matrices whose provider spawn returns canned IDs. Retained test proves actual tab allocation separation, not terminal startup. No equivalent replacement coverage is claimed. Existing exact unaffected receipts and their platform/provider/budget claims remain scoped to unchanged selectors. Changed optional selectors have no new execution result. Audit1391: src/renderer/src/components/terminal-pane/pty-connection-remote-pause-drop-notice.spec.ts reduced. Lose repeated quiet switches avoiding snapshots and legacy host without drop-report capability requesting a snapshot. Retained imported registrar uses fake transport/xterm writes, exercising real gap/restore lifecycle rather than actual terminal rendering. No equivalent replacement coverage is claimed. The existing primary-selector receipt and its claims remain scoped to their unchanged sources; the broad optional command has no new execution result. Audit1396: src/renderer/src/components/terminal-pane/terminal-parked-watcher-reconciliation.test.ts reduced. Retire standalone reconcile set output and positive untouchedFreshSpawn/workspaceOwner copying alarms; no native watcher execution claim. No equivalent replacement coverage is claimed. Existing exact unaffected receipts remain unchanged and apply only to their unchanged selectors. Changed optional selectors have no new execution result. Audit1401: src/main/runtime/orca-runtime-tests/mobile-session-tabs-duplicate-pty-repair.spec.ts removed. Loses listing-on-already-repaired-data alarm; it never established runtime repair invocation. src/main/runtime/orca-runtime-tests/mobile-session-tabs-split-agent-tab.spec.ts removed. Loses actual mobile split sibling shell versus recorded-agent resume command alarms; no equivalent coverage asserted. src/main/runtime/orca-runtime-tests/worktree-native-chat-setup.spec.ts removed. Loses separate setup/startup tab result in that manually assembled path. src/main/runtime/orca-runtime.test.ts reduced. Driver registration/import of a whole-deleted selected spec is removed; directly authored cases remain unchanged. No extra authored removal credit. No equivalent replacement coverage is claimed. Existing exact unaffected receipts remain unchanged and apply only to their unchanged selectors. Changed optional selectors have no new execution result. Audit1402: src/renderer/src/components/terminal-pane/pty-connection-park-reveal-model-snapshot.spec.ts reduced. Loses basic paired serialize/initial replay forwarding check; hidden alt-frame grid/precedence policy remains. No real terminal renderer claim. No equivalent replacement coverage is claimed. The existing primary-selector receipt and its claims remain scoped to their unchanged sources; the broad optional command has no new execution result. Audit1412: src/main/runtime/mobile-session-tabs-agent-status-heartbeat.test.ts reduced. Loses FIFO fairness/spacing, semantic bypass/cancellation, delayed-boundary scheduling and teardown timer-cleanup alarms. Retained fixed emission cases do not replace those outcomes. No equivalent replacement coverage is claimed.", "motivatingLinks": [ "https://github.com/stablyai/orca/issues/8652", "https://github.com/stablyai/orca/pull/10625" ], "invariant": "A host advertising terminal.paired-parking.v1 keeps the PTY and bounded authoritative history alive while an ordinary hidden-view park destroys the client xterm and releases its raw per-PTY stream. Reveal must restore up to the requested 5,000 rows, parked-time side effects/output, the same PTY identity, and continued input/output. Parked watcher synchronization compares parking semantics rather than fresh object identity, owns setup and cleanup across StrictMode replay, reconciles real PTY/layout changes, and performs no terminal-state scan when nothing is parked. After a host main-process relaunch, unknown local delivery-sync state must not be treated as proof that a surviving daemon PTY is already foregrounded. An empty headed session-tab inventory is authoritative only after the current renderer graph generation publishes a complete inventory and every execution host answers the PTY census; unpublished, resync-pending, transport-failed, and partially scoped inventories remain unverifiable, while genuinely authoritative empty and non-empty inventories settle and a scope-less legacy empty keeps its pre-authority best-effort settle so outdated hosts retain agent auto-resume. The unpublished-empty regression must keep the resume dispatch parked with exactly one daemon process/writer; restoring unconditional empty hydration must release one dispatch and create two live writers. If subscription precedes provider readiness, authoritative inventory must reconsider that existing subscriber without spawning, resizing, or changing reconnect state. A snapshot without an output high-water must keep it unknown rather than borrowing a layout version that can suppress newer live output. Hosts without the capability must gate hidden raw output before xterm scheduling and repaint from the authoritative snapshot on reveal while retaining the existing limit/TTL force-parking fallback. After the first semantic title state, decorative spinner frequency must add zero paired client-event frames and zero full session-tabs work between status-freshness leases regardless of hidden worktree count. Continuous working or permission evidence may refresh each affected worktree once per 15 minutes through one globally spaced FIFO so current and legacy viewers do not decay before 30 minutes; sibling PTYs share that worktree refresh, while local title animation, raw output, and semantic title, status, bell, completion, and query facts remain intact. A paired terminal stream whose delivery credits stop progressing must replace only that stream; command silence first probes authoritative state and replaces the stream if the probe times out or proves the PTY advanced beyond the client's delivered output sequence. When no comparable delivery high-water exists, the first sequenced probe establishes a baseline and only later advancement proves staleness. A same-sequence snapshot remains valid proof of a responsive silent command. A successful status probe may replace a pre-ready shared-control socket without rejecting or duplicating calls already waiting for that transport. Manual disconnect must retain pairing while preventing queued or passive calls and subscriptions from recreating transport until explicit Connect. A paired pane reconnecting to a relaunched host that has not yet published its window graph (an unpublished frame, bare or client-projected) must stay in recovery rather than retire, and the host's first published snapshot carrying the surface must reattach it; a published frame lacking the surface still retires it. The placeholder is only ever sent before the host's graph first publishes; afterwards a worktree with no tabs gets a real empty answer, pushed once to any client that asked during startup, so a paired client opening a never-opened host worktree still gets its first terminal.", - "oracle": "Audit 3292 combines adopted 3285/3287/3289/3293 removals: 40 authored declarations and 47 expanded scenarios, including whole frame-editor-view, ambiguous remote-delete-refusal, unverifiable-host subscription and editor-close cleanup suites. The previously reviewed dock-badge suite was already removed upstream in PR 40895 and receives zero new removal credit. Intentionally retired alarms include background browser selection and last-tab landing; main startup fallback, SSH project cleanup/survivor routing, exact-PR contradiction/saved-push positives, replay/sidecar rollback and wrapped remote error normalization; records/snapshot missing-diff hydration, ambiguous folder-owner delete refusal, focus no-op notifications, nested editor context-only cache check, pending broadcast-first status and ordinary four-confirmation aggregation; preview-source frontmatter pruning, approved local/runtime agent dispatch, non-GitHub legacy PR cache invalidation, stale merged-head transient-error fallback, empty-queue immediate query reply and unverified-to-concrete preflight risk. Additional intentionally retired alarms are injected host subscription/unsubscribe counts, synthetic editor reveal/draft/fallback/scoped close, ambiguous unread refusals and hidden mark/read roundtrip, immediate connect backoff/noError, positive mirrored evidence-clock renewal, supplied VM failure/success projections and git-local/folder-SSH wake permutations. Remaining temporal/ownership cases are narrower; no equivalent replacement or fresh execution is claimed. Audit 3283 removes 20 authored declarations and 31 expanded scenarios, including two whole suites. Retired alarms cover PR refresh-state pruning, shared runtime subscription cleanup and store isolation, language content-change routing and older completion ownership, ordinary panel retry-timer cleanup and pending loading, four hosted-review lifetime permutations, mocked terminal creation error/order wiring, five sleep-inventory variants with pending-frame-only assertions, palette fallback/composite highlights, Windows/UNC encoded-editor input rows, mixed-repository partial failure counts, title setters and generated-title bypass/replacement, five window-close coordinator delegation/guard/finally branches, and ambiguous-old-record frame reveal. These regression checks are intentionally lost under the test-value audit; retained cases are not equivalent replacements. Prior coverage notes and receipts remain historical. Audit 3273 removes 14 authored declarations and 19 expanded scenarios across four whole suites and eight partial suites. Retired alarms cover saved-local cancellation/layout ownership, ambiguous-owner warning reset, folder attachment routing, VM false-capability bypass, abandoned reveal warmup cleanup and viewport claim deduplication/rearming, quiet unrelated remote-removal refusal, startup-command one-shot consumption, repository/floating recovery-ledger rows, fake-React pinned-scroll intent, split-ratio state identity/subscriber suppression and fractional change, cross-host project-group join refusal, three PR request-lifetime permutations, upstream-status preservation on error, and unresolved Git-owner refusal. These regression checks are intentionally lost under the test-value audit; retained scenarios are not equivalent replacements. Historical coverage receipts remain historical, including gate35 subscriber claims. Audit 3256 removes these specific alarms from the broad root unit commands: skill dialog active-share selection, close and pending-share handoff; simple keyed-record deletion; marker live-region insertion, simple landing and nine baseline policy examples; General search/control navigation inventory; orphan-count cache bootstrap; seven Codex code classifications and HTTP 429 warning mapping; two skill unread-root verdict examples; peer-mail payload and conversation-ID rejection; and the GitHub organization TABLE text-field optimistic rollback/failed-envelope example. These include real behaviors; retained tests do not provide equivalent coverage for every removed scenario. Mobile losses are recorded separately and are not coverage of these root commands. Audit3246 retires NewRowsMarker reveal/no-repeat and pane-scoped beforeinput checks; skill-owner option availability/count/dedup/order; six styled Input/Textarea IME forwarding rows; the static Codex/OpenCode smart-key inventory; tab-map AST ratchet diagnostic fixtures; child-roster work-budget and retained-aggregate alarms; malformed persisted floating-cwd fallback/no-crash/empty exact-root checks; the unanswered-host empty-list discriminator; the direct invalidated-cache commit-false assertion; one redundant digit-keyup IME row; cached non-supported Claude title-generator rows; and the duplicate late naming-result singleton. These root broad commands lose those specific alarms without equivalent replacement. Distinct retained owner/state checks have their own bounded claims; the real scheduler still rejects stale response data, while the direct false-return alarm is retired. Audit3231 retires supported-host restore-pane key mapping, closed/open creation-sidebar toggle visibility, unrelated scope-error/null classification and quick-submit reveal/no-create checks. These broad commands lose those real narrow alarms; no replacement coverage is claimed. Audit3219 removes the synthetic Cmd+J extra-source suite; this broad command no longer checks its match/tie placement and selection, announced count, empty-query cap, or workspace hiding with retained recent tabs. No replacement coverage is claimed. Audit3209 composes approved sources3202/3206: deliberately retires seven authored/expanded cases in four whole suites without equivalent replacement. Work-item queries lose real GitHub/GitLab oversized ASCII secret-prefix empty-query and whitespace-before-trim refusal alarms; inputs share the imported size bound and exercise only its fast length branch, with no multibyte or actual provider/exposure guarantee. Skill sharing loses complete/partial managed-bundle and destination-ambiguity association checks plus three negative origin/path/scheme admission examples; these do not establish uploaded contents, arbitrary-URL fetching, authorization or execution. Retain exact originless-project direct-link fallback, cloud-delete confirmation, bundled-target repair/owner isolation and explicit Windows-host preference over stale WSL suites. Rejected3201 runtime-preference removal is excluded. No real cloud/network/host/disk, mobile or mixed-version execution validation is claimed. Audit3200 composes approved source3194: deliberately retires thirteen authored registrations/twenty-seven expanded cases in six whole automation host/list policy suites without equivalent replacement. Real RPC category/retryability and wrapped-timeout recognition, unscoped-failure/scoped-success health evidence precedence, exact-ID create selectors and per-run workspace omission, paired-web local/SSH/absent host catalog routing, incompatible/removed/unhydrated/offline execution health, runtime-before-nested-SSH recovery dispatch, and no-owned-focus/successor/foreign-list focus policy alarms are consciously lost. Retain exact20line orphan allow/refuse/precondition and exact90line cross-host same-ID search suites. No retry-timer/fence lifecycle, actual reconnect/network/write delivery, native focus, mobile/mixed-version runtime or disk persistence coverage is claimed. Audit3191 combines approved source3182/3187/3188: deliberately retires thirteen authored Vitest registrations and fifteen expanded cases, including five whole suites, without equivalent replacement. Attachment intake loses real portal/native-capture terminal interception and unowned-container refusal, immediate child-only committed availability/claim-ref negotiation and delivery, and direct-target over stable focused/background composer routing through disable/re-enable/remount and independent question focus. Exact destination/cache/draft and final-stat owner/workspace/File-release suites remain; they do not replace Surface recipient routing. Automation authoring loses destination runtime catalog membership, local/direct-SSH exclusion of paired-runtime repos, unknown-runtime empty catalog, logical project/host/setup/repo/path context payload, and missing/nonready setup refusal; these were genuine direct helper alarms, while exact schedule transformation, legacy schedule and setup-decision suites remain. Agent picker loses setup-chat/terminal/missing-installer/unsupported-or-unknown-host row projection samples and the ordinary unsearched menu variant; the entire original26-line resume recipe suite remains, including reported bypass versus default/absent permission modes, as does the exact search-result menu callback with its fixtures, model/effort commits and staged Arguments reopen outcome. Rejected predecessor3180 full recipe deletion is excluded. No actual native drag/cursor/focus/IME, upload bytes or disk/restart persistence, full automation save/scheduler/runtime transport, real resume-process flags/environment delivery, or native menu/rendered layout validation is claimed. Audit3178 combines source3169/3170/3175: deliberately retires eight authored units (six Vitest cases and two imperative custom relay scenarios), including two whole suites, without equivalent replacement. Voice Section loses per-model pending-delete isolation across interleaved A/B completion and the two-success refresh-call alarm; exact VoicePane delayed key-clear/newer enabled-toggle merge remains and does not replace row deletion coverage. Speech loses dedicated rating-scale/inclusive-ceiling, unsupported-versus-unmeasured, explicit/system-language precedence/locale alias, accuracy versus fast named/default/best-measured selection, and unmeasured/no-match examples; exact offered-user-pick versus retired-selection case and its fixture remain. Relay loses legacy ping-delivery count/liveness sampled before the silence deadline and grouped malformed Bearer/host-ID 401/429 routing checks; twelve real Worker/DurableObject/shipped-client scenarios remain, not equivalent replacement for those narrow alarms. Six prior speech cases are not all deleted: approved successor3175 keeps the original user-choice case. No actual credential/file persistence, native/GPU/engine/download delivery, production assignment policy or deployed-runtime validation is claimed by this reduction. Audit3165 combines source3160/3162: deliberately retires six authored/expanded cases across three whole suites without equivalent replacement. Launch/status losses: observed React-render pending/resuming coordination across settings and deferred offer read; stale-offer reread suppressing dialog reopen; held-local-chat recovery visibility with new-chat preferences off; disabled-local admission avoiding offer RPC despite an injected but unconsumed paired-tab fixture; and run-only lost-reply uncertainty reachability until direct viewed-run retirement. Launch probe does not prove arbitrary synchronous-store atomicity, the paired fixture is not remote runtime enrollment, and the status case directly marks viewed state rather than rendering the summary. Crew-hook losses: old-host method_not_found cache persists across party changes but is released by independently supplied connection generation/verified pairing status or pairing revision, with actual frame publication and teardown. These are real narrow coordination, admission, uncertainty and mixed-version cache alarms consciously lost. Exact web verified-runtime writer handoff guard remains; it does not replace those alarms or prove live host/native/mobile delivery. Audit3156 combines3147/3150/3152/3153/3154: deliberately retires39authored/40expanded native-chat recovery cases, eight whole suites and two orphan test-support files without equivalent replacement. Lost alarms: lost-reply unconfirmed reconciliation, skipped rows/counts and missed-frame repair, unknown/pending outcome and omitted-failure-list compatibility, uncertain history after dismissal, retry/refusal/dismiss lifecycle, hidden/consumed picker ownership, result-tree keyboard focus/disclosure and all-skipped retirement; unconfirmed-over-conflict guidance and failed-chat changes despite older host timestamps; nearest-listed ancestor/cyclic forest shape, descendant membership, host ordering/missing-host local fallback; skipped/readiness/admission counts, provisional skip/progress monotonicity, early per-chat verdicts with batch pending protection, older-host waiting, start-slot/delivery distinction, retry-over-failure and unknown-after-withdrawal attention; remote snooze/reconnect/reoffer, unseen mixed summary through open/close, watched completion retirement, new success beside old failure, failed-reread mixed-result preservation, filter/collapse completion resets, retry summary replacement and current-offer/history selection; cross-host workspace identity, rendered cyclic reachability, nested tri-state/toggle propagation, project eligibility isolation and collapse preserving selection. Exact fallback-list completion barrier, batched verdict/cleanup retention, stale-read versus dismissal publication race, and requested-but-never-rendered finished-run retirement remain; they do not replace retired alarms. Audit3146 combines source reviews3132/3133/3135/3138/3143: intentionally retire20authored/31expanded cases without equivalent replacement. Provider-session losses: structured-native terminal-resume exclusion, metadata-less completed identity, new-turn completion clearing, Pi provider-only/periodic/manual promotion, changed-transcript launch-config isolation, Pi/omp/prime-agent completed-session remote/manual-shutdown promotion, and quit/done precedence over heartbeat. Side-thread/question losses: finished-pane acquisition, hidden title/recap states, local/relay/relay-done conversation takeover with prompt/session/child resets, plain-message abandonment, compaction/session replacement and completion resets. Codex startup losses: incoming-owner cached child replacement, old-relay foreign live-session correction, completed foreign-root turn-fact permutations. Transcript losses: real temporary-JSONL partial sibling/final-child completion, unlabelled child attribution, compact cached replay preservation and100/1000completed-child roster retention/release. Compiler-ratchet losses: valid-line uncompiled-list parser grammar examples and injected-existence stale-path filtering; these did not exercise actual filesystem canonicalization or build exclusion. These are real lifecycle, ownership, replay, liveness and retention alarms, including recent#40246 regressions, deliberately lost. Retained conditional record replacement, clockless root/SSH owner isolation, persisted main-thread fork rejection, partial/final question-answer lifetime, cached-roster/missing-ID/live HTTP/durable startup boundaries and restarted-relay refusal/acceptance do not replace those losses. No native/SSH/WSL execution or equivalent coverage is claimed. Audit3128 scoped coverage reduction: Audit3121 removes VoiceDictationLanguageSetting.test.tsx (Spanish-to-es callback and unsupported-model Korean option presence) and voice-speech-model-rows.test.ts (provider/language-order/retired-on-disk list policy); these real narrow alarms are deliberately retired without replacement. VoiceSpeechModelSection per-model concurrent deletion remains unchanged. Audit3122 removes the direct absolute/parent-segment sparse-directory exception-type sample and the five-row IPC sparse-preset error-code/non-save table (two authored/six expanded cases). Those real typed-validation and IPC refusal/error-code alarms are deliberately retired. Keep both real symlink/junction floating-directory trust cases and the minimal RPC structured validation-reason serialization case. The RPC case does not replace IPC save/refusal behavior, typed normalization for both path inputs, actual Git sparse checkout or rendered localization. No equivalent replacement or fresh test/runtime/platform/remote/performance validation is claimed. Audit3124 removes ExperimentalPane.test.tsx (ordinary Pet switch callback), WorkspaceDirectorySetting.test.tsx (padded absolute saved-path normalization/no-write blur), and repository-search.perf.test.ts (navigation/selected-pane builder-call policy, fixture cardinality/nonempty entries and renamed project keyword inclusion). These real narrow alarms are retired without replacement; RepositoryPane.search.test.tsx search-to-sparse-editor request remains unchanged. Audit3129: resolver Windows case-insensitive and POSIX case-sensitive configured-env composition plus mocked-base launch-preflight Windows composition are intentionally no longer checked by the two deleted suites. No equivalent coverage claimed. Keep runtime-structured-agent-host-env.test.ts unchanged: configured Windows Claude-home account identity and host-account precedence remain checked. Audit3114 incorporates source3101: retire three structured Claude child-environment wrapper cases covering inherited stamp isolation/default and explicit entrypoint, Windows SDK-key canonicalization/default/duplicate-key order, and configured lookup/final environment/config-dir conjunction. Keep direct auth/session sanitation and Windows-versus-Linux overlay checks, actual executable lookup from supplied inherited PATH, native Windows child environment delivery, and stale option-mutation fencing. These are not equivalent replacements for the retired wrapper alarms. No fresh test/runtime, real login-shell probe, Claude SDK startup, remote/mixed-version, UI or performance result is claimed. Audit3114 incorporates source3105: retire 17 authored/20 expanded daemon launch-note cases, including the entire two-case SessionLaunchNote suite. Deliberately lose split-marker carry across same-token re-arm, stale-token retirement refusal, foreground tri-state and serial settlement, omitted-note/no-incarnation mixed-version policy, sticky retirement, first-incarnation/replacement launch preservation and held-launch precedence. Keep only the unchanged unresolved foreground-read race against a later finished attach. Supplied notes/foreground and runtime calls do not establish actual daemon/main restart, SSH, native Windows observation, mobile UI, equivalent replacement or fresh runtime/performance validation. Audit3114 incorporates source3109: retire six authored/35 expanded pricing cases: 21 accepted model-name examples, 10 unsupported/future-model fail-closed examples, malformed TTL clamp, unknown-model estimate refusal, flat-model long-context disregard and oversized long-context clamp. Keep mixed five-minute/one-hour write allocation and short/all-long/mixed long-context allocation with original fixed oracles. Real parser/refusal/bounds alarms are knowingly lost without equivalent replacement; retained tests do not validate provider rates, actual billing or request threshold classification. Preserve the archived usage-scan-append source-freeze receipt without transferring historical execution/performance credit. No fresh runtime result is claimed. Audit3108 source-only reduction (3094/3095/3100): retire 27 authored/30 expanded cases, including complete markdown view-state, file-preview link-open and CLI agent-server-route suites, without replacement. Deliberate losses include preview visibility/reference lifetime and same-path owners; SSH stat, directory/missing-target, explicit-null owner, nonmarkdown line/column, local URI routing, remote-to-client guard and same-file reuse; document-preview source-owner/folder/reuse routing, stable grant location and outside-workspace POSIX/Windows request projection; and verified remote CLI send/check refusal, suggested --on argv/copy, shell no-probe bypass, unverified-launch admission and older-peer refusal. Retain two markdown source-runtime/qualified-reveal alarms, one stale grant-rejection fence and two remote read/mutation evidence policies, with original callbacks. Final last-wins reveal did not prove transient cancellation; CLI prerequisite did not prove no real send, and envelope tests do not execute server refusal. No fresh runtime, rendered UI, actual file/SSH/paired transport, authorization, mixed-version or performance result is claimed. Audit3096 source-only reduction (3087/3088): retire 69 authored/76 expanded cases, including complete recovery-portals and reconnect-banner suites. Intentionally lose dead/default TUI replay, generated alternate-frame style composition, reset/mode/dimension and legacy missing-mode-boundary alarms, UI notice/action/reveal policies, and isolated recovery lifecycle variants, without equivalent replacement. Retained registrations and callbacks are unchanged; headless cells are not pixels, and no fresh runtime, host, SSH, WSL, rendered-app or performance result is claimed. Audit3086 source-only reduction (3079/3080/3081): intentionally retire 93 authored/100 expanded mock-boundary cases, including the complete spawn-errors and SSH reconnect overlay suites, without replacement. Retired alarms include spawn classification/ownership, reply ceilings and renderer-write failure recovery, disconnect/detach fencing branches, authority facts, and overlay retry/visibility wiring. Retained callbacks are unchanged; no fresh execution, real PTY/SSH, rendered UI, or performance result is claimed. The direct side-effect-facts selector retains six cases: replay exclusion, live sequence handling, stale disposer ownership, one handoff drain, drain-before-snapshot, and stale replacement-snapshot refusal. Successful current-entry snapshot application is not witnessed by the retained snapshot case. Audit2432: The broad unit command loses the isolated BranchPicker open-change notification sample. Its unique true/false callback alarm is intentionally retired; reopening/status-refresh behavior was not exercised. No equivalent replacement or fresh validation of the reduced selector is claimed. Audit2425: The broad unit command loses the workspace-copy-status supplied readError forwarding sample. It did not exercise the branch-switch blocking promised by its title. This alarm is intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2417: The broad unit command loses two ordinary clean Git cherry-pick/revert success samples and two terminal startup foreground-read work-budget samples. These unique alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2412: The broad unit command loses the whole six-case fake-React-hook scroll-anchor suite, two generic draft-retention samples, a simple new-agent order sample, a real history-publication batching-count sample, an unmounted handoff abort/timer sample and three basic WSL preview/error samples. These alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2404: The broad unit command loses the standalone share-name lookup 503 propagation suite, initial deletion placement-kind sample, direct changed-mtime stale sample, first-pass rollback existence example and abandoned-preparation directory sample. These exact alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2397 review amendment: The broad unit command loses three standalone suites, two partial-case definitions and two URL table rows across package/download/placement tests. Keep initial wrong-port authorization, modified independent-copy digest refusal and abort-after-begin cancellation dispatch. The remaining alarms are deliberately retired; no equivalent complete replacement or fresh validation of the reduced selector is claimed. Audit2393 current-parent refresh2401: Remove the basic skill-install service alias sample and original public managed-remove receiptless refusal case. Preserve the upstream request ownership suite and transaction interruption coverage. No equivalent complete replacement or fresh validation of the reduced selector is claimed. Audit2389: The broad unit command loses the missing-preview suite, plain-global destination sample and prepublished-receipt recovery example. No equivalent replacement or fresh validation of the reduced selector is claimed. Audit2385: The broad unit command loses four authored walker/staging/protocol examples (six expanded cases); no equivalent replacement or fresh validation is claimed for the reduced suite. Audit2383: The unscoped Vitest command no longer includes the removed Antigravity catalogue suite; its exact provider-root/owner example has no equivalent replacement or fresh validation claim. Audit2377/2381: The unscoped Vitest command includes the reduced bundled-skill and native-discovery suites; the eight removed backup/legacy/catalogue/symlink/SSH-builder examples have no replacement-equivalence or fresh validation claim here. Audit2133 current-parent preparation: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2095 current-parent preparation2126: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2090 (sources2088/2089): Current reduced suites intentionally retire the alarms listed in knownGaps; prior dated execution and replacement claims do not validate changed source bytes or selectors. Historical prior account (preserved verbatim): Audit2086 (sources2082/2083): Current reduced suites intentionally retire the alarms listed in knownGaps; prior dated execution and replacement claims do not validate changed source bytes or selectors. Historical prior account (preserved verbatim): Audit2076 (sources2073/2074): Intentionally retire these low-value alarms without replacement: src/main/runtime/orca-runtime-tests/terminal-handles-part-02.spec.ts: recovers a moved SSH pane through the tab it now sits in, not the one its lease froze; reports a plain expired orphan; does not report a pane whose only recent lease was superseded; does not report a pane whose only recent lease had its relay id recycled; picks the eligible orphan over a superseded predecessor that matches first; collects the same tabs the per-tab reader reports, in one sweep of the leases; reports no candidate when no lease names any of the worktree tabs. src/main/runtime/orca-runtime-tests/runtime-availability.spec.ts: starts unavailable with no authoritative window; reports the configured Windows terminal shell on status; reports floating workspace availability from settings on status; polls floating tabs with targeted PTY liveness and no repo/provider inventory; hydrates persisted tabs when the store cannot report repos; advertises browser screencast only when a renderer window is available; routes mobile Codex reset consumption through the account mutation coordinator; maps a definite pre-provider rejection into an authoritative current snapshot. Existing unrelated evidenceRuns retain their original scope; unchanged dated receipt objects do not validate changed source bytes or reduced selectors. No fresh gate execution or historical import-closure equivalence is claimed. Frozen current literal-import graph reaches these changed test bytes; unresolved local and computed edges remain debt, and current reachability is not historical execution or equivalent replacement evidence. Historical prior account (preserved verbatim): Audit2003: Remove SSH/absent-inventory attach refusal, later-subscriber retry, no-view adoption/takeback, provider-tail/unknown-read projections, failed-keystroke retry and simpler loss reattach examples. Keep the existing-subscriber inventory-ready retry alias only at its retained callback, plus retained held-input cancellation/replacement and overlapping attach/loss fences. The inventory driver also loses the whole empty-worktree-publication registration and folder-host/unverifiable scalar examples. Retire the entire dated10-case attach receipt; retain16 independent receipts only in their original scopes. No retained-memory or real-daemon measurement follows from supplied provider inventories. Changed-source prior results do not validate reduced-source bytes. No fresh execution, equivalent replacement, red/green, measured budget, soak, physical provider/PTY, rendered, live remote/mobile or cross-platform result is claimed. Historical prior account (preserved verbatim): Audit1991: Remove initial-snapshot sequence-domain, limited-tail/truncation and unknown-output-sequence aliases whose callbacks are removed. The source retains partial-chunk replay and requested-snapshot retry/admission at supplied snapshot/data seams, not equivalent replacement or measured retained-memory proof. Preserve the existing stream/pending-wait capacity aliases only to their retained owning multiplex callbacks with supplied PTY resolutions. Removing the sibling-PTY heartbeat dedup work-count sample does not establish a new decorative fanout budget; the unrelated-PTY cancellation fence survives. Preserve17 unrelated dated receipts. Changed-source prior results do not validate reduced-source bytes. No fresh execution, equivalent replacement, red/green, measured budget, soak, physical provider/PTY, rendered, live remote/mobile or cross-platform result is claimed. Historical prior account (preserved verbatim): Audit1983: Remove the reasonless-close selector and narrow census aliases to actual retained runtime and injected-inventory callbacks. The removed synthetic census-dedup and isolated pre-boundary timing cases receive no replacement credit; preserve17 unrelated dated receipts. Changed-source prior results do not validate reduced-source bytes. No fresh execution, equivalent replacement, red/green, measured budget, soak, provider/PTY, rendered, live remote/mobile or cross-platform result is claimed. Historical prior account (preserved verbatim): Audit1939 (sources1934/1935): Delete the synthetic watcher-synchronization and partial-reconciliation suites. Retire all affected host-fact, capability-owner, activation-residue and retention-cap aliases because the remaining callbacks do not establish those full claims. Keep exact local hook/timer, byte-stream side effects, exit/disposal, scroll-intent cleanup and deterministic local rank/TTL progression callbacks within their mocked-host scope. No physical paired-host retention, resource budget or equivalent replacement evidence is assigned. The generic broad test command remains a runnable discovery command, never a dated execution receipt. Preserve meaningful remaining selectors/assertions and unchanged dated receipts within their original scope. Reduced selectors have no fresh gate execution evidence in this metadata packet. No equivalent replacement, physical watcher/PTY/provider, live SSH/remote/mobile, rendered, cross-platform, soak or measured-budget result is claimed. Historical prior account (preserved verbatim): Audit1931 (sources1928/1929): Delete the complete hook-agent-status projection suite and its two behavioral assertion aliases. Supplied stored hook/title/resume/staleness/rename/question/generation/PTY-retirement/snapshot-version projections are intentionally lost. The separate osc-status-scan gate mentions this source only in existing historical notes and receives no mutation. No measured hidden-output retention, CPU/RSS or resource budget result is claimed by the deleted source or this audit. Preserve meaningful remaining selectors/assertions and unchanged dated receipts within their original scope. Reduced selectors have no fresh gate execution evidence in this metadata packet. No equivalent replacement, physical watcher/PTY/provider, live SSH/remote/mobile, rendered, cross-platform, soak or measured-budget result is claimed. Historical prior account (preserved verbatim): Retained exact unchanged-source receipts remain the only current execution evidence. Reduced selectors have no fresh execution result. Historical pre-audit oracle account for changed sources: The retained unchanged-source receipts are the only current execution evidence; reduced-source assertions await validation. Historical oracle account (not a current claim for changed sources): Existing exact unchanged-selector receipts remain the only current execution evidence. Changed source selectors have no fresh execution result. Historical prior-source oracle account: Existing exact unchanged-selector receipts remain the only current execution evidence. Changed source selectors have no fresh execution result. Historical prior-source oracle account: Run one byte-identical six-terminal oracle against an isolated headed desktop host and an isolated headless `orca serve` host. Stage at least 1,000,000 xterm cells, hide all six warm managers, emit an initial working title followed by 30 timed real-PTY spinner frames and a final idle title per worktree, and observe a second real session-tabs subscription plus the production renderer store. Require exactly two transport envelopes and two title mutations per worktree, no decorative title crossing either boundary, and positive decoded-envelope bytes. Enable ordinary parking with the lossy retention budget disabled, require exactly one mounted manager and five parked tabs, at most 45% retained cells, no more than 16 MiB heap growth, and under 500 ms timer drift. In headed mode, require the host renderer to remain on its original workspace with zero target terminal managers mounted throughout client park, reveal, and live I/O. While a tab is parked, require authoritative terminal.read to observe new PTY output; reveal it and require the original PTY, a marker within the requested 5,000-row history, the parked marker, and post-reveal input/output. Drive 24 real PTY title trackers in distinct worktrees through 40 decorative spinner frames each, then 40 spinner frames alternating with Cursor's bare native identity redraw, using fake clocks. Require all 2,880 raw chunks exactly and zero host session-tabs publications, serialized bytes, renderer apply calls, and renderer store mutations. Continue decorative evidence beyond 30 minutes, require exactly one refresh per worktree per 15-minute lease through a FIFO spaced by at least 50 ms, and require all 24 viewer statuses to remain working and fresh; then require one exact semantic idle transition and one visible-output chunk per PTY. Require ordinary and interior-Braille title changes to publish. Drive 64 host PTYs through ten 80 ms synthetic title frames, require zero paired client events after the first frame per PTY while all 640 local frames remain observable, attach a late client and require one current frame per PTY, then require semantic bell and idle transitions on both clients. Reconstruct a legacy subscribed stream with no outputPause capability, hide a chatty pane, require no hidden xterm writes, reveal it, and require one authoritative snapshot plus continued live output. Drop and acknowledge output only for one original paired-client stream, prove the fixture process consumed input while the host model advanced and the client stayed stale, then require the command snapshot probe to replace that stream, repaint exact fixture output, preserve authoritative PTY identity and target-tab cardinality, and resume live I/O. For a client without a delivered sequence, require the first numeric probe to establish a baseline without replacement, a same-sequence probe to remain attached, and a later advanced probe to replace only that stream. Withhold the first encrypted shared-control ready frame, start one RPC, trigger a status-probe refresh, and require two connections, one host delivery, successful response, and zero retained request bytes. Admit 128 active streams, reject the 129th as retryable, release one stream, then require the retry to attach and publish a snapshot without multiplying retained subscribers. Disable terminal.paired-parking.v1 and require the same oracle to fail before parking, while the legacy limit-one fallback separately passes. Also preserve truncated first paint, ACK-starved same-PTY recovery, responsive silent-command snapshot probes, dead-stream probe timeout recovery, and queued manual-disconnect fencing.", + "oracle": "Audit 3301 combines adopted source batches 3296 and 3299: retire 27 authored declarations and 36 expanded scenarios, including six whole suites. Intentionally lost alarms cover failed-verification/recovery/restart counters and mocked hosting/toast; early overlapping pane-read scheduling/count; unreadable removal listing draft guard; bulk-purge remote-qualified and raw-local guard maps; initial-snapshot blank/mode/oversize/printable/fresh-spawn callback and replay examples; fallback mobile file close and ordinary MRU; default queue overload/drain; seeded browser-page reuse and supplied missing-page URL recreation; ambiguous sleep/hibernation owner refusal and untouched bindings/origins; ordinary selection/activity/fallback priority; skip-remote success and retained hints; supplied structured-chat unsent retention and scoped removal draft eviction; caller-chat focus precedence; open/draft PR cache eviction and merged-head fallback result inventories. Retained adverse-ordering and ownership cases are narrower and do not establish equivalent replacements. No fresh runtime, native, physical provider, cross-platform, mobile or mixed-version evidence is claimed. Audit 3292 combines adopted 3285/3287/3289/3293 removals: 40 authored declarations and 47 expanded scenarios, including whole frame-editor-view, ambiguous remote-delete-refusal, unverifiable-host subscription and editor-close cleanup suites. The previously reviewed dock-badge suite was already removed upstream in PR 40895 and receives zero new removal credit. Intentionally retired alarms include background browser selection and last-tab landing; main startup fallback, SSH project cleanup/survivor routing, exact-PR contradiction/saved-push positives, replay/sidecar rollback and wrapped remote error normalization; records/snapshot missing-diff hydration, ambiguous folder-owner delete refusal, focus no-op notifications, nested editor context-only cache check, pending broadcast-first status and ordinary four-confirmation aggregation; preview-source frontmatter pruning, approved local/runtime agent dispatch, non-GitHub legacy PR cache invalidation, stale merged-head transient-error fallback, empty-queue immediate query reply and unverified-to-concrete preflight risk. Additional intentionally retired alarms are injected host subscription/unsubscribe counts, synthetic editor reveal/draft/fallback/scoped close, ambiguous unread refusals and hidden mark/read roundtrip, immediate connect backoff/noError, positive mirrored evidence-clock renewal, supplied VM failure/success projections and git-local/folder-SSH wake permutations. Remaining temporal/ownership cases are narrower; no equivalent replacement or fresh execution is claimed. Audit 3283 removes 20 authored declarations and 31 expanded scenarios, including two whole suites. Retired alarms cover PR refresh-state pruning, shared runtime subscription cleanup and store isolation, language content-change routing and older completion ownership, ordinary panel retry-timer cleanup and pending loading, four hosted-review lifetime permutations, mocked terminal creation error/order wiring, five sleep-inventory variants with pending-frame-only assertions, palette fallback/composite highlights, Windows/UNC encoded-editor input rows, mixed-repository partial failure counts, title setters and generated-title bypass/replacement, five window-close coordinator delegation/guard/finally branches, and ambiguous-old-record frame reveal. These regression checks are intentionally lost under the test-value audit; retained cases are not equivalent replacements. Prior coverage notes and receipts remain historical. Audit 3273 removes 14 authored declarations and 19 expanded scenarios across four whole suites and eight partial suites. Retired alarms cover saved-local cancellation/layout ownership, ambiguous-owner warning reset, folder attachment routing, VM false-capability bypass, abandoned reveal warmup cleanup and viewport claim deduplication/rearming, quiet unrelated remote-removal refusal, startup-command one-shot consumption, repository/floating recovery-ledger rows, fake-React pinned-scroll intent, split-ratio state identity/subscriber suppression and fractional change, cross-host project-group join refusal, three PR request-lifetime permutations, upstream-status preservation on error, and unresolved Git-owner refusal. These regression checks are intentionally lost under the test-value audit; retained scenarios are not equivalent replacements. Historical coverage receipts remain historical, including gate35 subscriber claims. Audit 3256 removes these specific alarms from the broad root unit commands: skill dialog active-share selection, close and pending-share handoff; simple keyed-record deletion; marker live-region insertion, simple landing and nine baseline policy examples; General search/control navigation inventory; orphan-count cache bootstrap; seven Codex code classifications and HTTP 429 warning mapping; two skill unread-root verdict examples; peer-mail payload and conversation-ID rejection; and the GitHub organization TABLE text-field optimistic rollback/failed-envelope example. These include real behaviors; retained tests do not provide equivalent coverage for every removed scenario. Mobile losses are recorded separately and are not coverage of these root commands. Audit3246 retires NewRowsMarker reveal/no-repeat and pane-scoped beforeinput checks; skill-owner option availability/count/dedup/order; six styled Input/Textarea IME forwarding rows; the static Codex/OpenCode smart-key inventory; tab-map AST ratchet diagnostic fixtures; child-roster work-budget and retained-aggregate alarms; malformed persisted floating-cwd fallback/no-crash/empty exact-root checks; the unanswered-host empty-list discriminator; the direct invalidated-cache commit-false assertion; one redundant digit-keyup IME row; cached non-supported Claude title-generator rows; and the duplicate late naming-result singleton. These root broad commands lose those specific alarms without equivalent replacement. Distinct retained owner/state checks have their own bounded claims; the real scheduler still rejects stale response data, while the direct false-return alarm is retired. Audit3231 retires supported-host restore-pane key mapping, closed/open creation-sidebar toggle visibility, unrelated scope-error/null classification and quick-submit reveal/no-create checks. These broad commands lose those real narrow alarms; no replacement coverage is claimed. Audit3219 removes the synthetic Cmd+J extra-source suite; this broad command no longer checks its match/tie placement and selection, announced count, empty-query cap, or workspace hiding with retained recent tabs. No replacement coverage is claimed. Audit3209 composes approved sources3202/3206: deliberately retires seven authored/expanded cases in four whole suites without equivalent replacement. Work-item queries lose real GitHub/GitLab oversized ASCII secret-prefix empty-query and whitespace-before-trim refusal alarms; inputs share the imported size bound and exercise only its fast length branch, with no multibyte or actual provider/exposure guarantee. Skill sharing loses complete/partial managed-bundle and destination-ambiguity association checks plus three negative origin/path/scheme admission examples; these do not establish uploaded contents, arbitrary-URL fetching, authorization or execution. Retain exact originless-project direct-link fallback, cloud-delete confirmation, bundled-target repair/owner isolation and explicit Windows-host preference over stale WSL suites. Rejected3201 runtime-preference removal is excluded. No real cloud/network/host/disk, mobile or mixed-version execution validation is claimed. Audit3200 composes approved source3194: deliberately retires thirteen authored registrations/twenty-seven expanded cases in six whole automation host/list policy suites without equivalent replacement. Real RPC category/retryability and wrapped-timeout recognition, unscoped-failure/scoped-success health evidence precedence, exact-ID create selectors and per-run workspace omission, paired-web local/SSH/absent host catalog routing, incompatible/removed/unhydrated/offline execution health, runtime-before-nested-SSH recovery dispatch, and no-owned-focus/successor/foreign-list focus policy alarms are consciously lost. Retain exact20line orphan allow/refuse/precondition and exact90line cross-host same-ID search suites. No retry-timer/fence lifecycle, actual reconnect/network/write delivery, native focus, mobile/mixed-version runtime or disk persistence coverage is claimed. Audit3191 combines approved source3182/3187/3188: deliberately retires thirteen authored Vitest registrations and fifteen expanded cases, including five whole suites, without equivalent replacement. Attachment intake loses real portal/native-capture terminal interception and unowned-container refusal, immediate child-only committed availability/claim-ref negotiation and delivery, and direct-target over stable focused/background composer routing through disable/re-enable/remount and independent question focus. Exact destination/cache/draft and final-stat owner/workspace/File-release suites remain; they do not replace Surface recipient routing. Automation authoring loses destination runtime catalog membership, local/direct-SSH exclusion of paired-runtime repos, unknown-runtime empty catalog, logical project/host/setup/repo/path context payload, and missing/nonready setup refusal; these were genuine direct helper alarms, while exact schedule transformation, legacy schedule and setup-decision suites remain. Agent picker loses setup-chat/terminal/missing-installer/unsupported-or-unknown-host row projection samples and the ordinary unsearched menu variant; the entire original26-line resume recipe suite remains, including reported bypass versus default/absent permission modes, as does the exact search-result menu callback with its fixtures, model/effort commits and staged Arguments reopen outcome. Rejected predecessor3180 full recipe deletion is excluded. No actual native drag/cursor/focus/IME, upload bytes or disk/restart persistence, full automation save/scheduler/runtime transport, real resume-process flags/environment delivery, or native menu/rendered layout validation is claimed. Audit3178 combines source3169/3170/3175: deliberately retires eight authored units (six Vitest cases and two imperative custom relay scenarios), including two whole suites, without equivalent replacement. Voice Section loses per-model pending-delete isolation across interleaved A/B completion and the two-success refresh-call alarm; exact VoicePane delayed key-clear/newer enabled-toggle merge remains and does not replace row deletion coverage. Speech loses dedicated rating-scale/inclusive-ceiling, unsupported-versus-unmeasured, explicit/system-language precedence/locale alias, accuracy versus fast named/default/best-measured selection, and unmeasured/no-match examples; exact offered-user-pick versus retired-selection case and its fixture remain. Relay loses legacy ping-delivery count/liveness sampled before the silence deadline and grouped malformed Bearer/host-ID 401/429 routing checks; twelve real Worker/DurableObject/shipped-client scenarios remain, not equivalent replacement for those narrow alarms. Six prior speech cases are not all deleted: approved successor3175 keeps the original user-choice case. No actual credential/file persistence, native/GPU/engine/download delivery, production assignment policy or deployed-runtime validation is claimed by this reduction. Audit3165 combines source3160/3162: deliberately retires six authored/expanded cases across three whole suites without equivalent replacement. Launch/status losses: observed React-render pending/resuming coordination across settings and deferred offer read; stale-offer reread suppressing dialog reopen; held-local-chat recovery visibility with new-chat preferences off; disabled-local admission avoiding offer RPC despite an injected but unconsumed paired-tab fixture; and run-only lost-reply uncertainty reachability until direct viewed-run retirement. Launch probe does not prove arbitrary synchronous-store atomicity, the paired fixture is not remote runtime enrollment, and the status case directly marks viewed state rather than rendering the summary. Crew-hook losses: old-host method_not_found cache persists across party changes but is released by independently supplied connection generation/verified pairing status or pairing revision, with actual frame publication and teardown. These are real narrow coordination, admission, uncertainty and mixed-version cache alarms consciously lost. Exact web verified-runtime writer handoff guard remains; it does not replace those alarms or prove live host/native/mobile delivery. Audit3156 combines3147/3150/3152/3153/3154: deliberately retires39authored/40expanded native-chat recovery cases, eight whole suites and two orphan test-support files without equivalent replacement. Lost alarms: lost-reply unconfirmed reconciliation, skipped rows/counts and missed-frame repair, unknown/pending outcome and omitted-failure-list compatibility, uncertain history after dismissal, retry/refusal/dismiss lifecycle, hidden/consumed picker ownership, result-tree keyboard focus/disclosure and all-skipped retirement; unconfirmed-over-conflict guidance and failed-chat changes despite older host timestamps; nearest-listed ancestor/cyclic forest shape, descendant membership, host ordering/missing-host local fallback; skipped/readiness/admission counts, provisional skip/progress monotonicity, early per-chat verdicts with batch pending protection, older-host waiting, start-slot/delivery distinction, retry-over-failure and unknown-after-withdrawal attention; remote snooze/reconnect/reoffer, unseen mixed summary through open/close, watched completion retirement, new success beside old failure, failed-reread mixed-result preservation, filter/collapse completion resets, retry summary replacement and current-offer/history selection; cross-host workspace identity, rendered cyclic reachability, nested tri-state/toggle propagation, project eligibility isolation and collapse preserving selection. Exact fallback-list completion barrier, batched verdict/cleanup retention, stale-read versus dismissal publication race, and requested-but-never-rendered finished-run retirement remain; they do not replace retired alarms. Audit3146 combines source reviews3132/3133/3135/3138/3143: intentionally retire20authored/31expanded cases without equivalent replacement. Provider-session losses: structured-native terminal-resume exclusion, metadata-less completed identity, new-turn completion clearing, Pi provider-only/periodic/manual promotion, changed-transcript launch-config isolation, Pi/omp/prime-agent completed-session remote/manual-shutdown promotion, and quit/done precedence over heartbeat. Side-thread/question losses: finished-pane acquisition, hidden title/recap states, local/relay/relay-done conversation takeover with prompt/session/child resets, plain-message abandonment, compaction/session replacement and completion resets. Codex startup losses: incoming-owner cached child replacement, old-relay foreign live-session correction, completed foreign-root turn-fact permutations. Transcript losses: real temporary-JSONL partial sibling/final-child completion, unlabelled child attribution, compact cached replay preservation and100/1000completed-child roster retention/release. Compiler-ratchet losses: valid-line uncompiled-list parser grammar examples and injected-existence stale-path filtering; these did not exercise actual filesystem canonicalization or build exclusion. These are real lifecycle, ownership, replay, liveness and retention alarms, including recent#40246 regressions, deliberately lost. Retained conditional record replacement, clockless root/SSH owner isolation, persisted main-thread fork rejection, partial/final question-answer lifetime, cached-roster/missing-ID/live HTTP/durable startup boundaries and restarted-relay refusal/acceptance do not replace those losses. No native/SSH/WSL execution or equivalent coverage is claimed. Audit3128 scoped coverage reduction: Audit3121 removes VoiceDictationLanguageSetting.test.tsx (Spanish-to-es callback and unsupported-model Korean option presence) and voice-speech-model-rows.test.ts (provider/language-order/retired-on-disk list policy); these real narrow alarms are deliberately retired without replacement. VoiceSpeechModelSection per-model concurrent deletion remains unchanged. Audit3122 removes the direct absolute/parent-segment sparse-directory exception-type sample and the five-row IPC sparse-preset error-code/non-save table (two authored/six expanded cases). Those real typed-validation and IPC refusal/error-code alarms are deliberately retired. Keep both real symlink/junction floating-directory trust cases and the minimal RPC structured validation-reason serialization case. The RPC case does not replace IPC save/refusal behavior, typed normalization for both path inputs, actual Git sparse checkout or rendered localization. No equivalent replacement or fresh test/runtime/platform/remote/performance validation is claimed. Audit3124 removes ExperimentalPane.test.tsx (ordinary Pet switch callback), WorkspaceDirectorySetting.test.tsx (padded absolute saved-path normalization/no-write blur), and repository-search.perf.test.ts (navigation/selected-pane builder-call policy, fixture cardinality/nonempty entries and renamed project keyword inclusion). These real narrow alarms are retired without replacement; RepositoryPane.search.test.tsx search-to-sparse-editor request remains unchanged. Audit3129: resolver Windows case-insensitive and POSIX case-sensitive configured-env composition plus mocked-base launch-preflight Windows composition are intentionally no longer checked by the two deleted suites. No equivalent coverage claimed. Keep runtime-structured-agent-host-env.test.ts unchanged: configured Windows Claude-home account identity and host-account precedence remain checked. Audit3114 incorporates source3101: retire three structured Claude child-environment wrapper cases covering inherited stamp isolation/default and explicit entrypoint, Windows SDK-key canonicalization/default/duplicate-key order, and configured lookup/final environment/config-dir conjunction. Keep direct auth/session sanitation and Windows-versus-Linux overlay checks, actual executable lookup from supplied inherited PATH, native Windows child environment delivery, and stale option-mutation fencing. These are not equivalent replacements for the retired wrapper alarms. No fresh test/runtime, real login-shell probe, Claude SDK startup, remote/mixed-version, UI or performance result is claimed. Audit3114 incorporates source3105: retire 17 authored/20 expanded daemon launch-note cases, including the entire two-case SessionLaunchNote suite. Deliberately lose split-marker carry across same-token re-arm, stale-token retirement refusal, foreground tri-state and serial settlement, omitted-note/no-incarnation mixed-version policy, sticky retirement, first-incarnation/replacement launch preservation and held-launch precedence. Keep only the unchanged unresolved foreground-read race against a later finished attach. Supplied notes/foreground and runtime calls do not establish actual daemon/main restart, SSH, native Windows observation, mobile UI, equivalent replacement or fresh runtime/performance validation. Audit3114 incorporates source3109: retire six authored/35 expanded pricing cases: 21 accepted model-name examples, 10 unsupported/future-model fail-closed examples, malformed TTL clamp, unknown-model estimate refusal, flat-model long-context disregard and oversized long-context clamp. Keep mixed five-minute/one-hour write allocation and short/all-long/mixed long-context allocation with original fixed oracles. Real parser/refusal/bounds alarms are knowingly lost without equivalent replacement; retained tests do not validate provider rates, actual billing or request threshold classification. Preserve the archived usage-scan-append source-freeze receipt without transferring historical execution/performance credit. No fresh runtime result is claimed. Audit3108 source-only reduction (3094/3095/3100): retire 27 authored/30 expanded cases, including complete markdown view-state, file-preview link-open and CLI agent-server-route suites, without replacement. Deliberate losses include preview visibility/reference lifetime and same-path owners; SSH stat, directory/missing-target, explicit-null owner, nonmarkdown line/column, local URI routing, remote-to-client guard and same-file reuse; document-preview source-owner/folder/reuse routing, stable grant location and outside-workspace POSIX/Windows request projection; and verified remote CLI send/check refusal, suggested --on argv/copy, shell no-probe bypass, unverified-launch admission and older-peer refusal. Retain two markdown source-runtime/qualified-reveal alarms, one stale grant-rejection fence and two remote read/mutation evidence policies, with original callbacks. Final last-wins reveal did not prove transient cancellation; CLI prerequisite did not prove no real send, and envelope tests do not execute server refusal. No fresh runtime, rendered UI, actual file/SSH/paired transport, authorization, mixed-version or performance result is claimed. Audit3096 source-only reduction (3087/3088): retire 69 authored/76 expanded cases, including complete recovery-portals and reconnect-banner suites. Intentionally lose dead/default TUI replay, generated alternate-frame style composition, reset/mode/dimension and legacy missing-mode-boundary alarms, UI notice/action/reveal policies, and isolated recovery lifecycle variants, without equivalent replacement. Retained registrations and callbacks are unchanged; headless cells are not pixels, and no fresh runtime, host, SSH, WSL, rendered-app or performance result is claimed. Audit3086 source-only reduction (3079/3080/3081): intentionally retire 93 authored/100 expanded mock-boundary cases, including the complete spawn-errors and SSH reconnect overlay suites, without replacement. Retired alarms include spawn classification/ownership, reply ceilings and renderer-write failure recovery, disconnect/detach fencing branches, authority facts, and overlay retry/visibility wiring. Retained callbacks are unchanged; no fresh execution, real PTY/SSH, rendered UI, or performance result is claimed. The direct side-effect-facts selector retains six cases: replay exclusion, live sequence handling, stale disposer ownership, one handoff drain, drain-before-snapshot, and stale replacement-snapshot refusal. Successful current-entry snapshot application is not witnessed by the retained snapshot case. Audit2432: The broad unit command loses the isolated BranchPicker open-change notification sample. Its unique true/false callback alarm is intentionally retired; reopening/status-refresh behavior was not exercised. No equivalent replacement or fresh validation of the reduced selector is claimed. Audit2425: The broad unit command loses the workspace-copy-status supplied readError forwarding sample. It did not exercise the branch-switch blocking promised by its title. This alarm is intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2417: The broad unit command loses two ordinary clean Git cherry-pick/revert success samples and two terminal startup foreground-read work-budget samples. These unique alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2412: The broad unit command loses the whole six-case fake-React-hook scroll-anchor suite, two generic draft-retention samples, a simple new-agent order sample, a real history-publication batching-count sample, an unmounted handoff abort/timer sample and three basic WSL preview/error samples. These alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2404: The broad unit command loses the standalone share-name lookup 503 propagation suite, initial deletion placement-kind sample, direct changed-mtime stale sample, first-pass rollback existence example and abandoned-preparation directory sample. These exact alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2397 review amendment: The broad unit command loses three standalone suites, two partial-case definitions and two URL table rows across package/download/placement tests. Keep initial wrong-port authorization, modified independent-copy digest refusal and abort-after-begin cancellation dispatch. The remaining alarms are deliberately retired; no equivalent complete replacement or fresh validation of the reduced selector is claimed. Audit2393 current-parent refresh2401: Remove the basic skill-install service alias sample and original public managed-remove receiptless refusal case. Preserve the upstream request ownership suite and transaction interruption coverage. No equivalent complete replacement or fresh validation of the reduced selector is claimed. Audit2389: The broad unit command loses the missing-preview suite, plain-global destination sample and prepublished-receipt recovery example. No equivalent replacement or fresh validation of the reduced selector is claimed. Audit2385: The broad unit command loses four authored walker/staging/protocol examples (six expanded cases); no equivalent replacement or fresh validation is claimed for the reduced suite. Audit2383: The unscoped Vitest command no longer includes the removed Antigravity catalogue suite; its exact provider-root/owner example has no equivalent replacement or fresh validation claim. Audit2377/2381: The unscoped Vitest command includes the reduced bundled-skill and native-discovery suites; the eight removed backup/legacy/catalogue/symlink/SSH-builder examples have no replacement-equivalence or fresh validation claim here. Audit2133 current-parent preparation: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2095 current-parent preparation2126: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2090 (sources2088/2089): Current reduced suites intentionally retire the alarms listed in knownGaps; prior dated execution and replacement claims do not validate changed source bytes or selectors. Historical prior account (preserved verbatim): Audit2086 (sources2082/2083): Current reduced suites intentionally retire the alarms listed in knownGaps; prior dated execution and replacement claims do not validate changed source bytes or selectors. Historical prior account (preserved verbatim): Audit2076 (sources2073/2074): Intentionally retire these low-value alarms without replacement: src/main/runtime/orca-runtime-tests/terminal-handles-part-02.spec.ts: recovers a moved SSH pane through the tab it now sits in, not the one its lease froze; reports a plain expired orphan; does not report a pane whose only recent lease was superseded; does not report a pane whose only recent lease had its relay id recycled; picks the eligible orphan over a superseded predecessor that matches first; collects the same tabs the per-tab reader reports, in one sweep of the leases; reports no candidate when no lease names any of the worktree tabs. src/main/runtime/orca-runtime-tests/runtime-availability.spec.ts: starts unavailable with no authoritative window; reports the configured Windows terminal shell on status; reports floating workspace availability from settings on status; polls floating tabs with targeted PTY liveness and no repo/provider inventory; hydrates persisted tabs when the store cannot report repos; advertises browser screencast only when a renderer window is available; routes mobile Codex reset consumption through the account mutation coordinator; maps a definite pre-provider rejection into an authoritative current snapshot. Existing unrelated evidenceRuns retain their original scope; unchanged dated receipt objects do not validate changed source bytes or reduced selectors. No fresh gate execution or historical import-closure equivalence is claimed. Frozen current literal-import graph reaches these changed test bytes; unresolved local and computed edges remain debt, and current reachability is not historical execution or equivalent replacement evidence. Historical prior account (preserved verbatim): Audit2003: Remove SSH/absent-inventory attach refusal, later-subscriber retry, no-view adoption/takeback, provider-tail/unknown-read projections, failed-keystroke retry and simpler loss reattach examples. Keep the existing-subscriber inventory-ready retry alias only at its retained callback, plus retained held-input cancellation/replacement and overlapping attach/loss fences. The inventory driver also loses the whole empty-worktree-publication registration and folder-host/unverifiable scalar examples. Retire the entire dated10-case attach receipt; retain16 independent receipts only in their original scopes. No retained-memory or real-daemon measurement follows from supplied provider inventories. Changed-source prior results do not validate reduced-source bytes. No fresh execution, equivalent replacement, red/green, measured budget, soak, physical provider/PTY, rendered, live remote/mobile or cross-platform result is claimed. Historical prior account (preserved verbatim): Audit1991: Remove initial-snapshot sequence-domain, limited-tail/truncation and unknown-output-sequence aliases whose callbacks are removed. The source retains partial-chunk replay and requested-snapshot retry/admission at supplied snapshot/data seams, not equivalent replacement or measured retained-memory proof. Preserve the existing stream/pending-wait capacity aliases only to their retained owning multiplex callbacks with supplied PTY resolutions. Removing the sibling-PTY heartbeat dedup work-count sample does not establish a new decorative fanout budget; the unrelated-PTY cancellation fence survives. Preserve17 unrelated dated receipts. Changed-source prior results do not validate reduced-source bytes. No fresh execution, equivalent replacement, red/green, measured budget, soak, physical provider/PTY, rendered, live remote/mobile or cross-platform result is claimed. Historical prior account (preserved verbatim): Audit1983: Remove the reasonless-close selector and narrow census aliases to actual retained runtime and injected-inventory callbacks. The removed synthetic census-dedup and isolated pre-boundary timing cases receive no replacement credit; preserve17 unrelated dated receipts. Changed-source prior results do not validate reduced-source bytes. No fresh execution, equivalent replacement, red/green, measured budget, soak, provider/PTY, rendered, live remote/mobile or cross-platform result is claimed. Historical prior account (preserved verbatim): Audit1939 (sources1934/1935): Delete the synthetic watcher-synchronization and partial-reconciliation suites. Retire all affected host-fact, capability-owner, activation-residue and retention-cap aliases because the remaining callbacks do not establish those full claims. Keep exact local hook/timer, byte-stream side effects, exit/disposal, scroll-intent cleanup and deterministic local rank/TTL progression callbacks within their mocked-host scope. No physical paired-host retention, resource budget or equivalent replacement evidence is assigned. The generic broad test command remains a runnable discovery command, never a dated execution receipt. Preserve meaningful remaining selectors/assertions and unchanged dated receipts within their original scope. Reduced selectors have no fresh gate execution evidence in this metadata packet. No equivalent replacement, physical watcher/PTY/provider, live SSH/remote/mobile, rendered, cross-platform, soak or measured-budget result is claimed. Historical prior account (preserved verbatim): Audit1931 (sources1928/1929): Delete the complete hook-agent-status projection suite and its two behavioral assertion aliases. Supplied stored hook/title/resume/staleness/rename/question/generation/PTY-retirement/snapshot-version projections are intentionally lost. The separate osc-status-scan gate mentions this source only in existing historical notes and receives no mutation. No measured hidden-output retention, CPU/RSS or resource budget result is claimed by the deleted source or this audit. Preserve meaningful remaining selectors/assertions and unchanged dated receipts within their original scope. Reduced selectors have no fresh gate execution evidence in this metadata packet. No equivalent replacement, physical watcher/PTY/provider, live SSH/remote/mobile, rendered, cross-platform, soak or measured-budget result is claimed. Historical prior account (preserved verbatim): Retained exact unchanged-source receipts remain the only current execution evidence. Reduced selectors have no fresh execution result. Historical pre-audit oracle account for changed sources: The retained unchanged-source receipts are the only current execution evidence; reduced-source assertions await validation. Historical oracle account (not a current claim for changed sources): Existing exact unchanged-selector receipts remain the only current execution evidence. Changed source selectors have no fresh execution result. Historical prior-source oracle account: Existing exact unchanged-selector receipts remain the only current execution evidence. Changed source selectors have no fresh execution result. Historical prior-source oracle account: Run one byte-identical six-terminal oracle against an isolated headed desktop host and an isolated headless `orca serve` host. Stage at least 1,000,000 xterm cells, hide all six warm managers, emit an initial working title followed by 30 timed real-PTY spinner frames and a final idle title per worktree, and observe a second real session-tabs subscription plus the production renderer store. Require exactly two transport envelopes and two title mutations per worktree, no decorative title crossing either boundary, and positive decoded-envelope bytes. Enable ordinary parking with the lossy retention budget disabled, require exactly one mounted manager and five parked tabs, at most 45% retained cells, no more than 16 MiB heap growth, and under 500 ms timer drift. In headed mode, require the host renderer to remain on its original workspace with zero target terminal managers mounted throughout client park, reveal, and live I/O. While a tab is parked, require authoritative terminal.read to observe new PTY output; reveal it and require the original PTY, a marker within the requested 5,000-row history, the parked marker, and post-reveal input/output. Drive 24 real PTY title trackers in distinct worktrees through 40 decorative spinner frames each, then 40 spinner frames alternating with Cursor's bare native identity redraw, using fake clocks. Require all 2,880 raw chunks exactly and zero host session-tabs publications, serialized bytes, renderer apply calls, and renderer store mutations. Continue decorative evidence beyond 30 minutes, require exactly one refresh per worktree per 15-minute lease through a FIFO spaced by at least 50 ms, and require all 24 viewer statuses to remain working and fresh; then require one exact semantic idle transition and one visible-output chunk per PTY. Require ordinary and interior-Braille title changes to publish. Drive 64 host PTYs through ten 80 ms synthetic title frames, require zero paired client events after the first frame per PTY while all 640 local frames remain observable, attach a late client and require one current frame per PTY, then require semantic bell and idle transitions on both clients. Reconstruct a legacy subscribed stream with no outputPause capability, hide a chatty pane, require no hidden xterm writes, reveal it, and require one authoritative snapshot plus continued live output. Drop and acknowledge output only for one original paired-client stream, prove the fixture process consumed input while the host model advanced and the client stayed stale, then require the command snapshot probe to replace that stream, repaint exact fixture output, preserve authoritative PTY identity and target-tab cardinality, and resume live I/O. For a client without a delivered sequence, require the first numeric probe to establish a baseline without replacement, a same-sequence probe to remain attached, and a later advanced probe to replace only that stream. Withhold the first encrypted shared-control ready frame, start one RPC, trigger a status-probe refresh, and require two connections, one host delivery, successful response, and zero retained request bytes. Admit 128 active streams, reject the 129th as retryable, release one stream, then require the retry to attach and publish a snapshot without multiplying retained subscribers. Disable terminal.paired-parking.v1 and require the same oracle to fail before parking, while the legacy limit-one fallback separately passes. Also preserve truncated first paint, ACK-starved same-PTY recovery, responsive silent-command snapshot probes, dead-stream probe timeout recovery, and queued manual-disconnect fencing.", "commands": [ "pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/components/terminal-pane/pty-transport/remote-runtime/remote-runtime-pty-transport-unpublished-host-graph.test.ts", "ORCA_BACKGROUND_LAUNCH=1 pnpm exec playwright test tests/e2e/paired-remote-terminal-host-quit-reconnect-input.spec.ts --config tests/playwright.config.ts --project electron-headless --workers=1", @@ -9030,7 +9017,8 @@ "Audit 3256 removes these specific alarms from the broad root unit commands: skill dialog active-share selection, close and pending-share handoff; simple keyed-record deletion; marker live-region insertion, simple landing and nine baseline policy examples; General search/control navigation inventory; orphan-count cache bootstrap; seven Codex code classifications and HTTP 429 warning mapping; two skill unread-root verdict examples; peer-mail payload and conversation-ID rejection; and the GitHub organization TABLE text-field optimistic rollback/failed-envelope example. These include real behaviors; retained tests do not provide equivalent coverage for every removed scenario. Mobile losses are recorded separately and are not coverage of these root commands.", "Audit 3273 removes 14 authored declarations and 19 expanded scenarios across four whole suites and eight partial suites. Retired alarms cover saved-local cancellation/layout ownership, ambiguous-owner warning reset, folder attachment routing, VM false-capability bypass, abandoned reveal warmup cleanup and viewport claim deduplication/rearming, quiet unrelated remote-removal refusal, startup-command one-shot consumption, repository/floating recovery-ledger rows, fake-React pinned-scroll intent, split-ratio state identity/subscriber suppression and fractional change, cross-host project-group join refusal, three PR request-lifetime permutations, upstream-status preservation on error, and unresolved Git-owner refusal. These regression checks are intentionally lost under the test-value audit; retained scenarios are not equivalent replacements. Historical coverage receipts remain historical, including gate35 subscriber claims.", "Audit 3283 removes 20 authored declarations and 31 expanded scenarios, including two whole suites. Retired alarms cover PR refresh-state pruning, shared runtime subscription cleanup and store isolation, language content-change routing and older completion ownership, ordinary panel retry-timer cleanup and pending loading, four hosted-review lifetime permutations, mocked terminal creation error/order wiring, five sleep-inventory variants with pending-frame-only assertions, palette fallback/composite highlights, Windows/UNC encoded-editor input rows, mixed-repository partial failure counts, title setters and generated-title bypass/replacement, five window-close coordinator delegation/guard/finally branches, and ambiguous-old-record frame reveal. These regression checks are intentionally lost under the test-value audit; retained cases are not equivalent replacements. Prior coverage notes and receipts remain historical.", - "Audit 3292 combines adopted 3285/3287/3289/3293 removals: 40 authored declarations and 47 expanded scenarios, including whole frame-editor-view, ambiguous remote-delete-refusal, unverifiable-host subscription and editor-close cleanup suites. The previously reviewed dock-badge suite was already removed upstream in PR 40895 and receives zero new removal credit. Intentionally retired alarms include background browser selection and last-tab landing; main startup fallback, SSH project cleanup/survivor routing, exact-PR contradiction/saved-push positives, replay/sidecar rollback and wrapped remote error normalization; records/snapshot missing-diff hydration, ambiguous folder-owner delete refusal, focus no-op notifications, nested editor context-only cache check, pending broadcast-first status and ordinary four-confirmation aggregation; preview-source frontmatter pruning, approved local/runtime agent dispatch, non-GitHub legacy PR cache invalidation, stale merged-head transient-error fallback, empty-queue immediate query reply and unverified-to-concrete preflight risk. Additional intentionally retired alarms are injected host subscription/unsubscribe counts, synthetic editor reveal/draft/fallback/scoped close, ambiguous unread refusals and hidden mark/read roundtrip, immediate connect backoff/noError, positive mirrored evidence-clock renewal, supplied VM failure/success projections and git-local/folder-SSH wake permutations. Remaining temporal/ownership cases are narrower; no equivalent replacement or fresh execution is claimed." + "Audit 3292 combines adopted 3285/3287/3289/3293 removals: 40 authored declarations and 47 expanded scenarios, including whole frame-editor-view, ambiguous remote-delete-refusal, unverifiable-host subscription and editor-close cleanup suites. The previously reviewed dock-badge suite was already removed upstream in PR 40895 and receives zero new removal credit. Intentionally retired alarms include background browser selection and last-tab landing; main startup fallback, SSH project cleanup/survivor routing, exact-PR contradiction/saved-push positives, replay/sidecar rollback and wrapped remote error normalization; records/snapshot missing-diff hydration, ambiguous folder-owner delete refusal, focus no-op notifications, nested editor context-only cache check, pending broadcast-first status and ordinary four-confirmation aggregation; preview-source frontmatter pruning, approved local/runtime agent dispatch, non-GitHub legacy PR cache invalidation, stale merged-head transient-error fallback, empty-queue immediate query reply and unverified-to-concrete preflight risk. Additional intentionally retired alarms are injected host subscription/unsubscribe counts, synthetic editor reveal/draft/fallback/scoped close, ambiguous unread refusals and hidden mark/read roundtrip, immediate connect backoff/noError, positive mirrored evidence-clock renewal, supplied VM failure/success projections and git-local/folder-SSH wake permutations. Remaining temporal/ownership cases are narrower; no equivalent replacement or fresh execution is claimed.", + "Audit 3301 combines adopted source batches 3296 and 3299: retire 27 authored declarations and 36 expanded scenarios, including six whole suites. Intentionally lost alarms cover failed-verification/recovery/restart counters and mocked hosting/toast; early overlapping pane-read scheduling/count; unreadable removal listing draft guard; bulk-purge remote-qualified and raw-local guard maps; initial-snapshot blank/mode/oversize/printable/fresh-spawn callback and replay examples; fallback mobile file close and ordinary MRU; default queue overload/drain; seeded browser-page reuse and supplied missing-page URL recreation; ambiguous sleep/hibernation owner refusal and untouched bindings/origins; ordinary selection/activity/fallback priority; skip-remote success and retained hints; supplied structured-chat unsent retention and scoped removal draft eviction; caller-chat focus precedence; open/draft PR cache eviction and merged-head fallback result inventories. Retained adverse-ordering and ownership cases are narrower and do not establish equivalent replacements. No fresh runtime, native, physical provider, cross-platform, mobile or mixed-version evidence is claimed." ], "demotionRule": "Keep experimental or demote to protection none if decorative title frequency changes paired client-event or session-tabs publication volume after convergence, a semantic fact is dropped, paired first paint is blank, passive work reconnects after manual disconnect, a capable hidden paired manager survives ordinary parking, a legacy hidden pane schedules raw xterm output or bypasses its fallback, reveal loses requested bounded history or live PTY identity, retained buffer cells do not fall, or either headed/headless scenario flakes." }, @@ -9209,7 +9197,7 @@ "providers": ["local", "daemon", "ssh", "remote-runtime"], "coveredPlatforms": ["macos"], "coveredProviders": [], - "coverageNotes": "Audit 3292 combines adopted 3285/3287/3289/3293 removals: 40 authored declarations and 47 expanded scenarios, including whole frame-editor-view, ambiguous remote-delete-refusal, unverifiable-host subscription and editor-close cleanup suites. The previously reviewed dock-badge suite was already removed upstream in PR 40895 and receives zero new removal credit. Intentionally retired alarms include background browser selection and last-tab landing; main startup fallback, SSH project cleanup/survivor routing, exact-PR contradiction/saved-push positives, replay/sidecar rollback and wrapped remote error normalization; records/snapshot missing-diff hydration, ambiguous folder-owner delete refusal, focus no-op notifications, nested editor context-only cache check, pending broadcast-first status and ordinary four-confirmation aggregation; preview-source frontmatter pruning, approved local/runtime agent dispatch, non-GitHub legacy PR cache invalidation, stale merged-head transient-error fallback, empty-queue immediate query reply and unverified-to-concrete preflight risk. Additional intentionally retired alarms are injected host subscription/unsubscribe counts, synthetic editor reveal/draft/fallback/scoped close, ambiguous unread refusals and hidden mark/read roundtrip, immediate connect backoff/noError, positive mirrored evidence-clock renewal, supplied VM failure/success projections and git-local/folder-SSH wake permutations. Remaining temporal/ownership cases are narrower; no equivalent replacement or fresh execution is claimed. Audit 3283 removes 20 authored declarations and 31 expanded scenarios, including two whole suites. Retired alarms cover PR refresh-state pruning, shared runtime subscription cleanup and store isolation, language content-change routing and older completion ownership, ordinary panel retry-timer cleanup and pending loading, four hosted-review lifetime permutations, mocked terminal creation error/order wiring, five sleep-inventory variants with pending-frame-only assertions, palette fallback/composite highlights, Windows/UNC encoded-editor input rows, mixed-repository partial failure counts, title setters and generated-title bypass/replacement, five window-close coordinator delegation/guard/finally branches, and ambiguous-old-record frame reveal. These regression checks are intentionally lost under the test-value audit; retained cases are not equivalent replacements. Prior coverage notes and receipts remain historical. Audit 3273 removes 14 authored declarations and 19 expanded scenarios across four whole suites and eight partial suites. Retired alarms cover saved-local cancellation/layout ownership, ambiguous-owner warning reset, folder attachment routing, VM false-capability bypass, abandoned reveal warmup cleanup and viewport claim deduplication/rearming, quiet unrelated remote-removal refusal, startup-command one-shot consumption, repository/floating recovery-ledger rows, fake-React pinned-scroll intent, split-ratio state identity/subscriber suppression and fractional change, cross-host project-group join refusal, three PR request-lifetime permutations, upstream-status preservation on error, and unresolved Git-owner refusal. These regression checks are intentionally lost under the test-value audit; retained scenarios are not equivalent replacements. Historical coverage receipts remain historical, including gate35 subscriber claims. Audit 3256 removes these specific alarms from the broad root unit commands: skill dialog active-share selection, close and pending-share handoff; simple keyed-record deletion; marker live-region insertion, simple landing and nine baseline policy examples; General search/control navigation inventory; orphan-count cache bootstrap; seven Codex code classifications and HTTP 429 warning mapping; two skill unread-root verdict examples; peer-mail payload and conversation-ID rejection; and the GitHub organization TABLE text-field optimistic rollback/failed-envelope example. These include real behaviors; retained tests do not provide equivalent coverage for every removed scenario. Mobile losses are recorded separately and are not coverage of these root commands. Audit3246 retires NewRowsMarker reveal/no-repeat and pane-scoped beforeinput checks; skill-owner option availability/count/dedup/order; six styled Input/Textarea IME forwarding rows; the static Codex/OpenCode smart-key inventory; tab-map AST ratchet diagnostic fixtures; child-roster work-budget and retained-aggregate alarms; malformed persisted floating-cwd fallback/no-crash/empty exact-root checks; the unanswered-host empty-list discriminator; the direct invalidated-cache commit-false assertion; one redundant digit-keyup IME row; cached non-supported Claude title-generator rows; and the duplicate late naming-result singleton. These root broad commands lose those specific alarms without equivalent replacement. Distinct retained owner/state checks have their own bounded claims; the real scheduler still rejects stale response data, while the direct false-return alarm is retired. Audit3231 retires supported-host restore-pane key mapping, closed/open creation-sidebar toggle visibility, unrelated scope-error/null classification and quick-submit reveal/no-create checks. These broad commands lose those real narrow alarms; no replacement coverage is claimed. Audit3219 removes the synthetic Cmd+J extra-source suite; this broad command no longer checks its match/tie placement and selection, announced count, empty-query cap, or workspace hiding with retained recent tabs. No replacement coverage is claimed. Audit3209 composes approved sources3202/3206: deliberately retires seven authored/expanded cases in four whole suites without equivalent replacement. Work-item queries lose real GitHub/GitLab oversized ASCII secret-prefix empty-query and whitespace-before-trim refusal alarms; inputs share the imported size bound and exercise only its fast length branch, with no multibyte or actual provider/exposure guarantee. Skill sharing loses complete/partial managed-bundle and destination-ambiguity association checks plus three negative origin/path/scheme admission examples; these do not establish uploaded contents, arbitrary-URL fetching, authorization or execution. Retain exact originless-project direct-link fallback, cloud-delete confirmation, bundled-target repair/owner isolation and explicit Windows-host preference over stale WSL suites. Rejected3201 runtime-preference removal is excluded. No real cloud/network/host/disk, mobile or mixed-version execution validation is claimed. Audit3200 composes approved source3194: deliberately retires thirteen authored registrations/twenty-seven expanded cases in six whole automation host/list policy suites without equivalent replacement. Real RPC category/retryability and wrapped-timeout recognition, unscoped-failure/scoped-success health evidence precedence, exact-ID create selectors and per-run workspace omission, paired-web local/SSH/absent host catalog routing, incompatible/removed/unhydrated/offline execution health, runtime-before-nested-SSH recovery dispatch, and no-owned-focus/successor/foreign-list focus policy alarms are consciously lost. Retain exact20line orphan allow/refuse/precondition and exact90line cross-host same-ID search suites. No retry-timer/fence lifecycle, actual reconnect/network/write delivery, native focus, mobile/mixed-version runtime or disk persistence coverage is claimed. Audit3191 combines approved source3182/3187/3188: deliberately retires thirteen authored Vitest registrations and fifteen expanded cases, including five whole suites, without equivalent replacement. Attachment intake loses real portal/native-capture terminal interception and unowned-container refusal, immediate child-only committed availability/claim-ref negotiation and delivery, and direct-target over stable focused/background composer routing through disable/re-enable/remount and independent question focus. Exact destination/cache/draft and final-stat owner/workspace/File-release suites remain; they do not replace Surface recipient routing. Automation authoring loses destination runtime catalog membership, local/direct-SSH exclusion of paired-runtime repos, unknown-runtime empty catalog, logical project/host/setup/repo/path context payload, and missing/nonready setup refusal; these were genuine direct helper alarms, while exact schedule transformation, legacy schedule and setup-decision suites remain. Agent picker loses setup-chat/terminal/missing-installer/unsupported-or-unknown-host row projection samples and the ordinary unsearched menu variant; the entire original26-line resume recipe suite remains, including reported bypass versus default/absent permission modes, as does the exact search-result menu callback with its fixtures, model/effort commits and staged Arguments reopen outcome. Rejected predecessor3180 full recipe deletion is excluded. No actual native drag/cursor/focus/IME, upload bytes or disk/restart persistence, full automation save/scheduler/runtime transport, real resume-process flags/environment delivery, or native menu/rendered layout validation is claimed. Audit3178 combines source3169/3170/3175: deliberately retires eight authored units (six Vitest cases and two imperative custom relay scenarios), including two whole suites, without equivalent replacement. Voice Section loses per-model pending-delete isolation across interleaved A/B completion and the two-success refresh-call alarm; exact VoicePane delayed key-clear/newer enabled-toggle merge remains and does not replace row deletion coverage. Speech loses dedicated rating-scale/inclusive-ceiling, unsupported-versus-unmeasured, explicit/system-language precedence/locale alias, accuracy versus fast named/default/best-measured selection, and unmeasured/no-match examples; exact offered-user-pick versus retired-selection case and its fixture remain. Relay loses legacy ping-delivery count/liveness sampled before the silence deadline and grouped malformed Bearer/host-ID 401/429 routing checks; twelve real Worker/DurableObject/shipped-client scenarios remain, not equivalent replacement for those narrow alarms. Six prior speech cases are not all deleted: approved successor3175 keeps the original user-choice case. No actual credential/file persistence, native/GPU/engine/download delivery, production assignment policy or deployed-runtime validation is claimed by this reduction. Audit3165 combines source3160/3162: deliberately retires six authored/expanded cases across three whole suites without equivalent replacement. Launch/status losses: observed React-render pending/resuming coordination across settings and deferred offer read; stale-offer reread suppressing dialog reopen; held-local-chat recovery visibility with new-chat preferences off; disabled-local admission avoiding offer RPC despite an injected but unconsumed paired-tab fixture; and run-only lost-reply uncertainty reachability until direct viewed-run retirement. Launch probe does not prove arbitrary synchronous-store atomicity, the paired fixture is not remote runtime enrollment, and the status case directly marks viewed state rather than rendering the summary. Crew-hook losses: old-host method_not_found cache persists across party changes but is released by independently supplied connection generation/verified pairing status or pairing revision, with actual frame publication and teardown. These are real narrow coordination, admission, uncertainty and mixed-version cache alarms consciously lost. Exact web verified-runtime writer handoff guard remains; it does not replace those alarms or prove live host/native/mobile delivery. Audit3156 combines3147/3150/3152/3153/3154: deliberately retires39authored/40expanded native-chat recovery cases, eight whole suites and two orphan test-support files without equivalent replacement. Lost alarms: lost-reply unconfirmed reconciliation, skipped rows/counts and missed-frame repair, unknown/pending outcome and omitted-failure-list compatibility, uncertain history after dismissal, retry/refusal/dismiss lifecycle, hidden/consumed picker ownership, result-tree keyboard focus/disclosure and all-skipped retirement; unconfirmed-over-conflict guidance and failed-chat changes despite older host timestamps; nearest-listed ancestor/cyclic forest shape, descendant membership, host ordering/missing-host local fallback; skipped/readiness/admission counts, provisional skip/progress monotonicity, early per-chat verdicts with batch pending protection, older-host waiting, start-slot/delivery distinction, retry-over-failure and unknown-after-withdrawal attention; remote snooze/reconnect/reoffer, unseen mixed summary through open/close, watched completion retirement, new success beside old failure, failed-reread mixed-result preservation, filter/collapse completion resets, retry summary replacement and current-offer/history selection; cross-host workspace identity, rendered cyclic reachability, nested tri-state/toggle propagation, project eligibility isolation and collapse preserving selection. Exact fallback-list completion barrier, batched verdict/cleanup retention, stale-read versus dismissal publication race, and requested-but-never-rendered finished-run retirement remain; they do not replace retired alarms. Audit3146 combines source reviews3132/3133/3135/3138/3143: intentionally retire20authored/31expanded cases without equivalent replacement. Provider-session losses: structured-native terminal-resume exclusion, metadata-less completed identity, new-turn completion clearing, Pi provider-only/periodic/manual promotion, changed-transcript launch-config isolation, Pi/omp/prime-agent completed-session remote/manual-shutdown promotion, and quit/done precedence over heartbeat. Side-thread/question losses: finished-pane acquisition, hidden title/recap states, local/relay/relay-done conversation takeover with prompt/session/child resets, plain-message abandonment, compaction/session replacement and completion resets. Codex startup losses: incoming-owner cached child replacement, old-relay foreign live-session correction, completed foreign-root turn-fact permutations. Transcript losses: real temporary-JSONL partial sibling/final-child completion, unlabelled child attribution, compact cached replay preservation and100/1000completed-child roster retention/release. Compiler-ratchet losses: valid-line uncompiled-list parser grammar examples and injected-existence stale-path filtering; these did not exercise actual filesystem canonicalization or build exclusion. These are real lifecycle, ownership, replay, liveness and retention alarms, including recent#40246 regressions, deliberately lost. Retained conditional record replacement, clockless root/SSH owner isolation, persisted main-thread fork rejection, partial/final question-answer lifetime, cached-roster/missing-ID/live HTTP/durable startup boundaries and restarted-relay refusal/acceptance do not replace those losses. No native/SSH/WSL execution or equivalent coverage is claimed. Audit3128 scoped coverage reduction: Audit3121 removes VoiceDictationLanguageSetting.test.tsx (Spanish-to-es callback and unsupported-model Korean option presence) and voice-speech-model-rows.test.ts (provider/language-order/retired-on-disk list policy); these real narrow alarms are deliberately retired without replacement. VoiceSpeechModelSection per-model concurrent deletion remains unchanged. Audit3122 removes the direct absolute/parent-segment sparse-directory exception-type sample and the five-row IPC sparse-preset error-code/non-save table (two authored/six expanded cases). Those real typed-validation and IPC refusal/error-code alarms are deliberately retired. Keep both real symlink/junction floating-directory trust cases and the minimal RPC structured validation-reason serialization case. The RPC case does not replace IPC save/refusal behavior, typed normalization for both path inputs, actual Git sparse checkout or rendered localization. No equivalent replacement or fresh test/runtime/platform/remote/performance validation is claimed. Audit3124 removes ExperimentalPane.test.tsx (ordinary Pet switch callback), WorkspaceDirectorySetting.test.tsx (padded absolute saved-path normalization/no-write blur), and repository-search.perf.test.ts (navigation/selected-pane builder-call policy, fixture cardinality/nonempty entries and renamed project keyword inclusion). These real narrow alarms are retired without replacement; RepositoryPane.search.test.tsx search-to-sparse-editor request remains unchanged. Audit3129: resolver Windows case-insensitive and POSIX case-sensitive configured-env composition plus mocked-base launch-preflight Windows composition are intentionally no longer checked by the two deleted suites. No equivalent coverage claimed. Keep runtime-structured-agent-host-env.test.ts unchanged: configured Windows Claude-home account identity and host-account precedence remain checked. Audit3114 incorporates source3101: retire three structured Claude child-environment wrapper cases covering inherited stamp isolation/default and explicit entrypoint, Windows SDK-key canonicalization/default/duplicate-key order, and configured lookup/final environment/config-dir conjunction. Keep direct auth/session sanitation and Windows-versus-Linux overlay checks, actual executable lookup from supplied inherited PATH, native Windows child environment delivery, and stale option-mutation fencing. These are not equivalent replacements for the retired wrapper alarms. No fresh test/runtime, real login-shell probe, Claude SDK startup, remote/mixed-version, UI or performance result is claimed. Audit3114 incorporates source3105: retire 17 authored/20 expanded daemon launch-note cases, including the entire two-case SessionLaunchNote suite. Deliberately lose split-marker carry across same-token re-arm, stale-token retirement refusal, foreground tri-state and serial settlement, omitted-note/no-incarnation mixed-version policy, sticky retirement, first-incarnation/replacement launch preservation and held-launch precedence. Keep only the unchanged unresolved foreground-read race against a later finished attach. Supplied notes/foreground and runtime calls do not establish actual daemon/main restart, SSH, native Windows observation, mobile UI, equivalent replacement or fresh runtime/performance validation. Audit3114 incorporates source3109: retire six authored/35 expanded pricing cases: 21 accepted model-name examples, 10 unsupported/future-model fail-closed examples, malformed TTL clamp, unknown-model estimate refusal, flat-model long-context disregard and oversized long-context clamp. Keep mixed five-minute/one-hour write allocation and short/all-long/mixed long-context allocation with original fixed oracles. Real parser/refusal/bounds alarms are knowingly lost without equivalent replacement; retained tests do not validate provider rates, actual billing or request threshold classification. Preserve the archived usage-scan-append source-freeze receipt without transferring historical execution/performance credit. No fresh runtime result is claimed. Audit3108 source-only reduction (3094/3095/3100): retire 27 authored/30 expanded cases, including complete markdown view-state, file-preview link-open and CLI agent-server-route suites, without replacement. Deliberate losses include preview visibility/reference lifetime and same-path owners; SSH stat, directory/missing-target, explicit-null owner, nonmarkdown line/column, local URI routing, remote-to-client guard and same-file reuse; document-preview source-owner/folder/reuse routing, stable grant location and outside-workspace POSIX/Windows request projection; and verified remote CLI send/check refusal, suggested --on argv/copy, shell no-probe bypass, unverified-launch admission and older-peer refusal. Retain two markdown source-runtime/qualified-reveal alarms, one stale grant-rejection fence and two remote read/mutation evidence policies, with original callbacks. Final last-wins reveal did not prove transient cancellation; CLI prerequisite did not prove no real send, and envelope tests do not execute server refusal. No fresh runtime, rendered UI, actual file/SSH/paired transport, authorization, mixed-version or performance result is claimed. Audit3096 source-only reduction (3087/3088): retire 69 authored/76 expanded cases, including complete recovery-portals and reconnect-banner suites. Intentionally lose dead/default TUI replay, generated alternate-frame style composition, reset/mode/dimension and legacy missing-mode-boundary alarms, UI notice/action/reveal policies, and isolated recovery lifecycle variants, without equivalent replacement. Retained registrations and callbacks are unchanged; headless cells are not pixels, and no fresh runtime, host, SSH, WSL, rendered-app or performance result is claimed. Audit3086 source-only reduction (3079/3080/3081): intentionally retire 93 authored/100 expanded mock-boundary cases, including the complete spawn-errors and SSH reconnect overlay suites, without replacement. Retired alarms include spawn classification/ownership, reply ceilings and renderer-write failure recovery, disconnect/detach fencing branches, authority facts, and overlay retry/visibility wiring. Retained callbacks are unchanged; no fresh execution, real PTY/SSH, rendered UI, or performance result is claimed. Module layout SSH policy: Retire the multiplexer private-clock saturation registration, the writer saturation transition-count registration and the changed-source dated writer/backpressure receipt. Retained byte delivery, lane order, fairness, settlement and cancellation cases are unvalidated by that historical receipt. No equivalent replacement, new execution, measured performance, live SSH/WSL or cross-platform proof is claimed. The unchanged WSL protocol receipt retains only its original command scope. Historical prior account (preserved verbatim): Audit2432: The broad unit command loses the isolated BranchPicker open-change notification sample. Its unique true/false callback alarm is intentionally retired; reopening/status-refresh behavior was not exercised. No equivalent replacement or fresh validation of the reduced selector is claimed. Audit2425: The broad unit command loses the workspace-copy-status supplied readError forwarding sample. It did not exercise the branch-switch blocking promised by its title. This alarm is intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2417: The broad unit command loses two ordinary clean Git cherry-pick/revert success samples and two terminal startup foreground-read work-budget samples. These unique alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2412: The broad unit command loses the whole six-case fake-React-hook scroll-anchor suite, two generic draft-retention samples, a simple new-agent order sample, a real history-publication batching-count sample, an unmounted handoff abort/timer sample and three basic WSL preview/error samples. These alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2404: The broad unit command loses the standalone share-name lookup 503 propagation suite, initial deletion placement-kind sample, direct changed-mtime stale sample, first-pass rollback existence example and abandoned-preparation directory sample. These exact alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2397 review amendment: The broad unit command loses three standalone suites, two partial-case definitions and two URL table rows across package/download/placement tests. Keep initial wrong-port authorization, modified independent-copy digest refusal and abort-after-begin cancellation dispatch. The remaining alarms are deliberately retired; no equivalent complete replacement or fresh validation of the reduced selector is claimed. Audit2393 current-parent refresh2401: Remove the basic skill-install service alias sample and original public managed-remove receiptless refusal case. Preserve the upstream request ownership suite and transaction interruption coverage. No equivalent complete replacement or fresh validation of the reduced selector is claimed. Audit2389: The broad unit command loses the missing-preview suite, plain-global destination sample and prepublished-receipt recovery example. No equivalent replacement or fresh validation of the reduced selector is claimed. Audit2385: The broad unit command loses four authored walker/staging/protocol examples (six expanded cases); no equivalent replacement or fresh validation is claimed for the reduced suite. Audit2383: The unscoped Vitest command no longer includes the removed Antigravity catalogue suite; its exact provider-root/owner example has no equivalent replacement or fresh validation claim. Audit2377/2381: The unscoped Vitest command includes the reduced bundled-skill and native-discovery suites; the eight removed backup/legacy/catalogue/symlink/SSH-builder examples have no replacement-equivalence or fresh validation claim here. Audit2133 current-parent preparation: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2095 current-parent preparation2126: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2090 (sources2088/2089): Current reduced suites intentionally retire the alarms listed in knownGaps; prior dated execution and replacement claims do not validate changed source bytes or selectors. Historical prior account (preserved verbatim): Audit2086 (sources2082/2083): Current reduced suites intentionally retire the alarms listed in knownGaps; prior dated execution and replacement claims do not validate changed source bytes or selectors. Historical prior account (preserved verbatim): Audit2076 (sources2073/2074): Intentionally retire these low-value alarms without replacement: src/main/runtime/orca-runtime-tests/terminal-handles-part-02.spec.ts: recovers a moved SSH pane through the tab it now sits in, not the one its lease froze; reports a plain expired orphan; does not report a pane whose only recent lease was superseded; does not report a pane whose only recent lease had its relay id recycled; picks the eligible orphan over a superseded predecessor that matches first; collects the same tabs the per-tab reader reports, in one sweep of the leases; reports no candidate when no lease names any of the worktree tabs. src/main/runtime/orca-runtime-tests/runtime-availability.spec.ts: starts unavailable with no authoritative window; reports the configured Windows terminal shell on status; reports floating workspace availability from settings on status; polls floating tabs with targeted PTY liveness and no repo/provider inventory; hydrates persisted tabs when the store cannot report repos; advertises browser screencast only when a renderer window is available; routes mobile Codex reset consumption through the account mutation coordinator; maps a definite pre-provider rejection into an authoritative current snapshot. Existing unrelated evidenceRuns retain their original scope; unchanged dated receipt objects do not validate changed source bytes or reduced selectors. No fresh gate execution or historical import-closure equivalence is claimed. Frozen current literal-import graph reaches these changed test bytes; unresolved local and computed edges remain debt, and current reachability is not historical execution or equivalent replacement evidence. Historical prior account (preserved verbatim): Audit2070 (sources2068/2069): Intentionally retire these low-value alarms without replacement: src/main/runtime/orca-runtime.test.ts: ordinary registration cleanup removes only await import('./orca-runtime-tests/hooks-and-hosted-review.spec'). src/main/ssh/ssh-multiplexer-transport-writer.test.ts: reports saturated epochs and their drain boundary exactly once. src/main/runtime/orca-runtime-tests/worktree-removal-archive-hook-gate.spec.ts: removes and records the waiver when the failure is explicitly overridden; removes without an override record when the hook succeeds; removes when the hook is configured but not requested; removes when no archive hook is configured; holds a desktop removal in the same repo until this one is accepted; joins a desktop removal of the same worktree accepted while this one waited. src/main/runtime/orca-runtime-tests/worktree-ps-agent-row-dismissal.spec.ts: drops the row as soon as the user dismisses it, without waiting for the PTY to exit; tells paired clients to republish on the transition and on the dismissal; rejoins a row through its %s handle after pane ownership clears. src/main/runtime/orca-runtime-tests/hooks-and-hosted-review.spec.ts: reports an error when the SSH filesystem provider is unavailable; reports an SSH orca.yaml as an error without reading any filesystem; reports ok for a local repo hook check; reads SSH issue commands as absent and drops writes without touching any filesystem; allows host integration slug helpers for SSH repos through provider-aware GitHub clients; routes runtime GitHub repo identity helpers through the selected WSL project runtime; routes runtime GitHub issue and work-item actions through the selected WSL project runtime; pins explicit origin preference on runtime open-by-number work item lookups; forwards check-details cancellation without local Git overrides. Existing unrelated evidenceRuns retain their original scope; unchanged dated receipt objects do not validate changed source bytes or reduced selectors. No fresh gate execution or historical import-closure equivalence is claimed. Frozen current literal-import graph reaches these changed test bytes; unresolved local and computed edges remain debt, and current reachability is not historical execution or equivalent replacement evidence. The historical receipt/currentCommand selecting src/main/ssh/ssh-multiplexer-transport-writer.test.ts remains historical and is not a passing result for the reduced current command. Historical prior account (preserved verbatim): Audit1931 (sources1928/1929): Delete the complete tail-wait memo suite: its sole current authored callback checks supplied fromTail/blocked field values. Retire all three broader memoization/equivalence/eviction assertion aliases; they are not backed by retained source callbacks. No scan-work budget, sustained output, physical terminal or resource measurement is assigned to this removed test. Preserve meaningful remaining selectors/assertions and unchanged dated receipts within their original scope. Reduced selectors have no fresh gate execution evidence in this metadata packet. No equivalent replacement, physical watcher/PTY/provider, live SSH/remote/mobile, rendered, cross-platform, soak or measured-budget result is claimed. Historical prior account (preserved verbatim): Audit1674 removes low-value test projections, mock wiring, private-state assertions, inventories and duplicate examples without equivalent replacement coverage. Per-source reviews record retained public behavior and refusal boundaries with injected/native/remote limits. Affected historical receipts are retired; gates without active current evidence are downgraded. Historical scope before this audit: Audit1634 removes low-value IPC, filesystem and runtime projections, argument inventories and duplicate examples without equivalent replacement coverage. Per-source reviews record retained cancellation, ownership, authorization, filesystem and SQLite boundaries with injected/native/remote limits. Affected historical receipts are retired; gates without active current evidence are downgraded. Historical scope before this audit: Local macOS evidence covers main-process pending-output and projection-admission caps, saturated-tail wait detection, direct-SSH source retention/accounting, always-on V1 negotiation with legacy peer fallback, exact provider-generation pause ownership, renderer exit/data ordering, decoder input bounds, bounded reconnect scheduling, and WSL stdio transport settlement through deterministic unit contracts. A joined main/runtime oracle exercises renderer-sourced headed semantics and headless-model snapshot semantics without launching a live paired server. Separately, a macOS-hosted Docker OpenSSH run exercises only the deployed Linux relay and direct SSH provider with an exact 256 KiB source-credit plateau, concurrent PTY typing, fixed-size filesystem frames, Git churn, and owner-lease reconnect. Neither deterministic topology labels nor Docker SSH constitute live headed desktop, headless orca serve, or physical WSL evidence; local/daemon, prior-version daemons, Windows named pipes/ConPTY, folder workspaces, and mixed-version clients also remain uncovered. Audit1312 removes low-value imported specs from aggregate test drivers; old whole-driver execution receipts are archived. Retained registrations are unchanged. No equivalent replacement coverage is claimed. Audit1383: src/main/runtime/orca-runtime-tests/worktree-native-chat-setup.spec.ts reduced. Lose command-list/receipt/default/background activation matrices whose provider spawn returns canned IDs. Retained test proves actual tab allocation separation, not terminal startup. No equivalent replacement coverage is claimed. Existing exact unaffected receipts and their platform/provider/budget claims remain scoped to unchanged selectors. Changed optional selectors have no new execution result. Audit1401: src/main/runtime/orca-runtime-tests/mobile-session-tabs-duplicate-pty-repair.spec.ts removed. Loses listing-on-already-repaired-data alarm; it never established runtime repair invocation. src/main/runtime/orca-runtime-tests/mobile-session-tabs-split-agent-tab.spec.ts removed. Loses actual mobile split sibling shell versus recorded-agent resume command alarms; no equivalent coverage asserted. src/main/runtime/orca-runtime-tests/worktree-native-chat-setup.spec.ts removed. Loses separate setup/startup tab result in that manually assembled path. src/main/runtime/orca-runtime.test.ts reduced. Driver registration/import of a whole-deleted selected spec is removed; directly authored cases remain unchanged. No extra authored removal credit. No equivalent replacement coverage is claimed. Existing exact unaffected receipts remain unchanged and apply only to their unchanged selectors. Changed optional selectors have no new execution result.", + "coverageNotes": "Audit 3301 combines adopted source batches 3296 and 3299: retire 27 authored declarations and 36 expanded scenarios, including six whole suites. Intentionally lost alarms cover failed-verification/recovery/restart counters and mocked hosting/toast; early overlapping pane-read scheduling/count; unreadable removal listing draft guard; bulk-purge remote-qualified and raw-local guard maps; initial-snapshot blank/mode/oversize/printable/fresh-spawn callback and replay examples; fallback mobile file close and ordinary MRU; default queue overload/drain; seeded browser-page reuse and supplied missing-page URL recreation; ambiguous sleep/hibernation owner refusal and untouched bindings/origins; ordinary selection/activity/fallback priority; skip-remote success and retained hints; supplied structured-chat unsent retention and scoped removal draft eviction; caller-chat focus precedence; open/draft PR cache eviction and merged-head fallback result inventories. Retained adverse-ordering and ownership cases are narrower and do not establish equivalent replacements. No fresh runtime, native, physical provider, cross-platform, mobile or mixed-version evidence is claimed. Audit 3292 combines adopted 3285/3287/3289/3293 removals: 40 authored declarations and 47 expanded scenarios, including whole frame-editor-view, ambiguous remote-delete-refusal, unverifiable-host subscription and editor-close cleanup suites. The previously reviewed dock-badge suite was already removed upstream in PR 40895 and receives zero new removal credit. Intentionally retired alarms include background browser selection and last-tab landing; main startup fallback, SSH project cleanup/survivor routing, exact-PR contradiction/saved-push positives, replay/sidecar rollback and wrapped remote error normalization; records/snapshot missing-diff hydration, ambiguous folder-owner delete refusal, focus no-op notifications, nested editor context-only cache check, pending broadcast-first status and ordinary four-confirmation aggregation; preview-source frontmatter pruning, approved local/runtime agent dispatch, non-GitHub legacy PR cache invalidation, stale merged-head transient-error fallback, empty-queue immediate query reply and unverified-to-concrete preflight risk. Additional intentionally retired alarms are injected host subscription/unsubscribe counts, synthetic editor reveal/draft/fallback/scoped close, ambiguous unread refusals and hidden mark/read roundtrip, immediate connect backoff/noError, positive mirrored evidence-clock renewal, supplied VM failure/success projections and git-local/folder-SSH wake permutations. Remaining temporal/ownership cases are narrower; no equivalent replacement or fresh execution is claimed. Audit 3283 removes 20 authored declarations and 31 expanded scenarios, including two whole suites. Retired alarms cover PR refresh-state pruning, shared runtime subscription cleanup and store isolation, language content-change routing and older completion ownership, ordinary panel retry-timer cleanup and pending loading, four hosted-review lifetime permutations, mocked terminal creation error/order wiring, five sleep-inventory variants with pending-frame-only assertions, palette fallback/composite highlights, Windows/UNC encoded-editor input rows, mixed-repository partial failure counts, title setters and generated-title bypass/replacement, five window-close coordinator delegation/guard/finally branches, and ambiguous-old-record frame reveal. These regression checks are intentionally lost under the test-value audit; retained cases are not equivalent replacements. Prior coverage notes and receipts remain historical. Audit 3273 removes 14 authored declarations and 19 expanded scenarios across four whole suites and eight partial suites. Retired alarms cover saved-local cancellation/layout ownership, ambiguous-owner warning reset, folder attachment routing, VM false-capability bypass, abandoned reveal warmup cleanup and viewport claim deduplication/rearming, quiet unrelated remote-removal refusal, startup-command one-shot consumption, repository/floating recovery-ledger rows, fake-React pinned-scroll intent, split-ratio state identity/subscriber suppression and fractional change, cross-host project-group join refusal, three PR request-lifetime permutations, upstream-status preservation on error, and unresolved Git-owner refusal. These regression checks are intentionally lost under the test-value audit; retained scenarios are not equivalent replacements. Historical coverage receipts remain historical, including gate35 subscriber claims. Audit 3256 removes these specific alarms from the broad root unit commands: skill dialog active-share selection, close and pending-share handoff; simple keyed-record deletion; marker live-region insertion, simple landing and nine baseline policy examples; General search/control navigation inventory; orphan-count cache bootstrap; seven Codex code classifications and HTTP 429 warning mapping; two skill unread-root verdict examples; peer-mail payload and conversation-ID rejection; and the GitHub organization TABLE text-field optimistic rollback/failed-envelope example. These include real behaviors; retained tests do not provide equivalent coverage for every removed scenario. Mobile losses are recorded separately and are not coverage of these root commands. Audit3246 retires NewRowsMarker reveal/no-repeat and pane-scoped beforeinput checks; skill-owner option availability/count/dedup/order; six styled Input/Textarea IME forwarding rows; the static Codex/OpenCode smart-key inventory; tab-map AST ratchet diagnostic fixtures; child-roster work-budget and retained-aggregate alarms; malformed persisted floating-cwd fallback/no-crash/empty exact-root checks; the unanswered-host empty-list discriminator; the direct invalidated-cache commit-false assertion; one redundant digit-keyup IME row; cached non-supported Claude title-generator rows; and the duplicate late naming-result singleton. These root broad commands lose those specific alarms without equivalent replacement. Distinct retained owner/state checks have their own bounded claims; the real scheduler still rejects stale response data, while the direct false-return alarm is retired. Audit3231 retires supported-host restore-pane key mapping, closed/open creation-sidebar toggle visibility, unrelated scope-error/null classification and quick-submit reveal/no-create checks. These broad commands lose those real narrow alarms; no replacement coverage is claimed. Audit3219 removes the synthetic Cmd+J extra-source suite; this broad command no longer checks its match/tie placement and selection, announced count, empty-query cap, or workspace hiding with retained recent tabs. No replacement coverage is claimed. Audit3209 composes approved sources3202/3206: deliberately retires seven authored/expanded cases in four whole suites without equivalent replacement. Work-item queries lose real GitHub/GitLab oversized ASCII secret-prefix empty-query and whitespace-before-trim refusal alarms; inputs share the imported size bound and exercise only its fast length branch, with no multibyte or actual provider/exposure guarantee. Skill sharing loses complete/partial managed-bundle and destination-ambiguity association checks plus three negative origin/path/scheme admission examples; these do not establish uploaded contents, arbitrary-URL fetching, authorization or execution. Retain exact originless-project direct-link fallback, cloud-delete confirmation, bundled-target repair/owner isolation and explicit Windows-host preference over stale WSL suites. Rejected3201 runtime-preference removal is excluded. No real cloud/network/host/disk, mobile or mixed-version execution validation is claimed. Audit3200 composes approved source3194: deliberately retires thirteen authored registrations/twenty-seven expanded cases in six whole automation host/list policy suites without equivalent replacement. Real RPC category/retryability and wrapped-timeout recognition, unscoped-failure/scoped-success health evidence precedence, exact-ID create selectors and per-run workspace omission, paired-web local/SSH/absent host catalog routing, incompatible/removed/unhydrated/offline execution health, runtime-before-nested-SSH recovery dispatch, and no-owned-focus/successor/foreign-list focus policy alarms are consciously lost. Retain exact20line orphan allow/refuse/precondition and exact90line cross-host same-ID search suites. No retry-timer/fence lifecycle, actual reconnect/network/write delivery, native focus, mobile/mixed-version runtime or disk persistence coverage is claimed. Audit3191 combines approved source3182/3187/3188: deliberately retires thirteen authored Vitest registrations and fifteen expanded cases, including five whole suites, without equivalent replacement. Attachment intake loses real portal/native-capture terminal interception and unowned-container refusal, immediate child-only committed availability/claim-ref negotiation and delivery, and direct-target over stable focused/background composer routing through disable/re-enable/remount and independent question focus. Exact destination/cache/draft and final-stat owner/workspace/File-release suites remain; they do not replace Surface recipient routing. Automation authoring loses destination runtime catalog membership, local/direct-SSH exclusion of paired-runtime repos, unknown-runtime empty catalog, logical project/host/setup/repo/path context payload, and missing/nonready setup refusal; these were genuine direct helper alarms, while exact schedule transformation, legacy schedule and setup-decision suites remain. Agent picker loses setup-chat/terminal/missing-installer/unsupported-or-unknown-host row projection samples and the ordinary unsearched menu variant; the entire original26-line resume recipe suite remains, including reported bypass versus default/absent permission modes, as does the exact search-result menu callback with its fixtures, model/effort commits and staged Arguments reopen outcome. Rejected predecessor3180 full recipe deletion is excluded. No actual native drag/cursor/focus/IME, upload bytes or disk/restart persistence, full automation save/scheduler/runtime transport, real resume-process flags/environment delivery, or native menu/rendered layout validation is claimed. Audit3178 combines source3169/3170/3175: deliberately retires eight authored units (six Vitest cases and two imperative custom relay scenarios), including two whole suites, without equivalent replacement. Voice Section loses per-model pending-delete isolation across interleaved A/B completion and the two-success refresh-call alarm; exact VoicePane delayed key-clear/newer enabled-toggle merge remains and does not replace row deletion coverage. Speech loses dedicated rating-scale/inclusive-ceiling, unsupported-versus-unmeasured, explicit/system-language precedence/locale alias, accuracy versus fast named/default/best-measured selection, and unmeasured/no-match examples; exact offered-user-pick versus retired-selection case and its fixture remain. Relay loses legacy ping-delivery count/liveness sampled before the silence deadline and grouped malformed Bearer/host-ID 401/429 routing checks; twelve real Worker/DurableObject/shipped-client scenarios remain, not equivalent replacement for those narrow alarms. Six prior speech cases are not all deleted: approved successor3175 keeps the original user-choice case. No actual credential/file persistence, native/GPU/engine/download delivery, production assignment policy or deployed-runtime validation is claimed by this reduction. Audit3165 combines source3160/3162: deliberately retires six authored/expanded cases across three whole suites without equivalent replacement. Launch/status losses: observed React-render pending/resuming coordination across settings and deferred offer read; stale-offer reread suppressing dialog reopen; held-local-chat recovery visibility with new-chat preferences off; disabled-local admission avoiding offer RPC despite an injected but unconsumed paired-tab fixture; and run-only lost-reply uncertainty reachability until direct viewed-run retirement. Launch probe does not prove arbitrary synchronous-store atomicity, the paired fixture is not remote runtime enrollment, and the status case directly marks viewed state rather than rendering the summary. Crew-hook losses: old-host method_not_found cache persists across party changes but is released by independently supplied connection generation/verified pairing status or pairing revision, with actual frame publication and teardown. These are real narrow coordination, admission, uncertainty and mixed-version cache alarms consciously lost. Exact web verified-runtime writer handoff guard remains; it does not replace those alarms or prove live host/native/mobile delivery. Audit3156 combines3147/3150/3152/3153/3154: deliberately retires39authored/40expanded native-chat recovery cases, eight whole suites and two orphan test-support files without equivalent replacement. Lost alarms: lost-reply unconfirmed reconciliation, skipped rows/counts and missed-frame repair, unknown/pending outcome and omitted-failure-list compatibility, uncertain history after dismissal, retry/refusal/dismiss lifecycle, hidden/consumed picker ownership, result-tree keyboard focus/disclosure and all-skipped retirement; unconfirmed-over-conflict guidance and failed-chat changes despite older host timestamps; nearest-listed ancestor/cyclic forest shape, descendant membership, host ordering/missing-host local fallback; skipped/readiness/admission counts, provisional skip/progress monotonicity, early per-chat verdicts with batch pending protection, older-host waiting, start-slot/delivery distinction, retry-over-failure and unknown-after-withdrawal attention; remote snooze/reconnect/reoffer, unseen mixed summary through open/close, watched completion retirement, new success beside old failure, failed-reread mixed-result preservation, filter/collapse completion resets, retry summary replacement and current-offer/history selection; cross-host workspace identity, rendered cyclic reachability, nested tri-state/toggle propagation, project eligibility isolation and collapse preserving selection. Exact fallback-list completion barrier, batched verdict/cleanup retention, stale-read versus dismissal publication race, and requested-but-never-rendered finished-run retirement remain; they do not replace retired alarms. Audit3146 combines source reviews3132/3133/3135/3138/3143: intentionally retire20authored/31expanded cases without equivalent replacement. Provider-session losses: structured-native terminal-resume exclusion, metadata-less completed identity, new-turn completion clearing, Pi provider-only/periodic/manual promotion, changed-transcript launch-config isolation, Pi/omp/prime-agent completed-session remote/manual-shutdown promotion, and quit/done precedence over heartbeat. Side-thread/question losses: finished-pane acquisition, hidden title/recap states, local/relay/relay-done conversation takeover with prompt/session/child resets, plain-message abandonment, compaction/session replacement and completion resets. Codex startup losses: incoming-owner cached child replacement, old-relay foreign live-session correction, completed foreign-root turn-fact permutations. Transcript losses: real temporary-JSONL partial sibling/final-child completion, unlabelled child attribution, compact cached replay preservation and100/1000completed-child roster retention/release. Compiler-ratchet losses: valid-line uncompiled-list parser grammar examples and injected-existence stale-path filtering; these did not exercise actual filesystem canonicalization or build exclusion. These are real lifecycle, ownership, replay, liveness and retention alarms, including recent#40246 regressions, deliberately lost. Retained conditional record replacement, clockless root/SSH owner isolation, persisted main-thread fork rejection, partial/final question-answer lifetime, cached-roster/missing-ID/live HTTP/durable startup boundaries and restarted-relay refusal/acceptance do not replace those losses. No native/SSH/WSL execution or equivalent coverage is claimed. Audit3128 scoped coverage reduction: Audit3121 removes VoiceDictationLanguageSetting.test.tsx (Spanish-to-es callback and unsupported-model Korean option presence) and voice-speech-model-rows.test.ts (provider/language-order/retired-on-disk list policy); these real narrow alarms are deliberately retired without replacement. VoiceSpeechModelSection per-model concurrent deletion remains unchanged. Audit3122 removes the direct absolute/parent-segment sparse-directory exception-type sample and the five-row IPC sparse-preset error-code/non-save table (two authored/six expanded cases). Those real typed-validation and IPC refusal/error-code alarms are deliberately retired. Keep both real symlink/junction floating-directory trust cases and the minimal RPC structured validation-reason serialization case. The RPC case does not replace IPC save/refusal behavior, typed normalization for both path inputs, actual Git sparse checkout or rendered localization. No equivalent replacement or fresh test/runtime/platform/remote/performance validation is claimed. Audit3124 removes ExperimentalPane.test.tsx (ordinary Pet switch callback), WorkspaceDirectorySetting.test.tsx (padded absolute saved-path normalization/no-write blur), and repository-search.perf.test.ts (navigation/selected-pane builder-call policy, fixture cardinality/nonempty entries and renamed project keyword inclusion). These real narrow alarms are retired without replacement; RepositoryPane.search.test.tsx search-to-sparse-editor request remains unchanged. Audit3129: resolver Windows case-insensitive and POSIX case-sensitive configured-env composition plus mocked-base launch-preflight Windows composition are intentionally no longer checked by the two deleted suites. No equivalent coverage claimed. Keep runtime-structured-agent-host-env.test.ts unchanged: configured Windows Claude-home account identity and host-account precedence remain checked. Audit3114 incorporates source3101: retire three structured Claude child-environment wrapper cases covering inherited stamp isolation/default and explicit entrypoint, Windows SDK-key canonicalization/default/duplicate-key order, and configured lookup/final environment/config-dir conjunction. Keep direct auth/session sanitation and Windows-versus-Linux overlay checks, actual executable lookup from supplied inherited PATH, native Windows child environment delivery, and stale option-mutation fencing. These are not equivalent replacements for the retired wrapper alarms. No fresh test/runtime, real login-shell probe, Claude SDK startup, remote/mixed-version, UI or performance result is claimed. Audit3114 incorporates source3105: retire 17 authored/20 expanded daemon launch-note cases, including the entire two-case SessionLaunchNote suite. Deliberately lose split-marker carry across same-token re-arm, stale-token retirement refusal, foreground tri-state and serial settlement, omitted-note/no-incarnation mixed-version policy, sticky retirement, first-incarnation/replacement launch preservation and held-launch precedence. Keep only the unchanged unresolved foreground-read race against a later finished attach. Supplied notes/foreground and runtime calls do not establish actual daemon/main restart, SSH, native Windows observation, mobile UI, equivalent replacement or fresh runtime/performance validation. Audit3114 incorporates source3109: retire six authored/35 expanded pricing cases: 21 accepted model-name examples, 10 unsupported/future-model fail-closed examples, malformed TTL clamp, unknown-model estimate refusal, flat-model long-context disregard and oversized long-context clamp. Keep mixed five-minute/one-hour write allocation and short/all-long/mixed long-context allocation with original fixed oracles. Real parser/refusal/bounds alarms are knowingly lost without equivalent replacement; retained tests do not validate provider rates, actual billing or request threshold classification. Preserve the archived usage-scan-append source-freeze receipt without transferring historical execution/performance credit. No fresh runtime result is claimed. Audit3108 source-only reduction (3094/3095/3100): retire 27 authored/30 expanded cases, including complete markdown view-state, file-preview link-open and CLI agent-server-route suites, without replacement. Deliberate losses include preview visibility/reference lifetime and same-path owners; SSH stat, directory/missing-target, explicit-null owner, nonmarkdown line/column, local URI routing, remote-to-client guard and same-file reuse; document-preview source-owner/folder/reuse routing, stable grant location and outside-workspace POSIX/Windows request projection; and verified remote CLI send/check refusal, suggested --on argv/copy, shell no-probe bypass, unverified-launch admission and older-peer refusal. Retain two markdown source-runtime/qualified-reveal alarms, one stale grant-rejection fence and two remote read/mutation evidence policies, with original callbacks. Final last-wins reveal did not prove transient cancellation; CLI prerequisite did not prove no real send, and envelope tests do not execute server refusal. No fresh runtime, rendered UI, actual file/SSH/paired transport, authorization, mixed-version or performance result is claimed. Audit3096 source-only reduction (3087/3088): retire 69 authored/76 expanded cases, including complete recovery-portals and reconnect-banner suites. Intentionally lose dead/default TUI replay, generated alternate-frame style composition, reset/mode/dimension and legacy missing-mode-boundary alarms, UI notice/action/reveal policies, and isolated recovery lifecycle variants, without equivalent replacement. Retained registrations and callbacks are unchanged; headless cells are not pixels, and no fresh runtime, host, SSH, WSL, rendered-app or performance result is claimed. Audit3086 source-only reduction (3079/3080/3081): intentionally retire 93 authored/100 expanded mock-boundary cases, including the complete spawn-errors and SSH reconnect overlay suites, without replacement. Retired alarms include spawn classification/ownership, reply ceilings and renderer-write failure recovery, disconnect/detach fencing branches, authority facts, and overlay retry/visibility wiring. Retained callbacks are unchanged; no fresh execution, real PTY/SSH, rendered UI, or performance result is claimed. Module layout SSH policy: Retire the multiplexer private-clock saturation registration, the writer saturation transition-count registration and the changed-source dated writer/backpressure receipt. Retained byte delivery, lane order, fairness, settlement and cancellation cases are unvalidated by that historical receipt. No equivalent replacement, new execution, measured performance, live SSH/WSL or cross-platform proof is claimed. The unchanged WSL protocol receipt retains only its original command scope. Historical prior account (preserved verbatim): Audit2432: The broad unit command loses the isolated BranchPicker open-change notification sample. Its unique true/false callback alarm is intentionally retired; reopening/status-refresh behavior was not exercised. No equivalent replacement or fresh validation of the reduced selector is claimed. Audit2425: The broad unit command loses the workspace-copy-status supplied readError forwarding sample. It did not exercise the branch-switch blocking promised by its title. This alarm is intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2417: The broad unit command loses two ordinary clean Git cherry-pick/revert success samples and two terminal startup foreground-read work-budget samples. These unique alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2412: The broad unit command loses the whole six-case fake-React-hook scroll-anchor suite, two generic draft-retention samples, a simple new-agent order sample, a real history-publication batching-count sample, an unmounted handoff abort/timer sample and three basic WSL preview/error samples. These alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2404: The broad unit command loses the standalone share-name lookup 503 propagation suite, initial deletion placement-kind sample, direct changed-mtime stale sample, first-pass rollback existence example and abandoned-preparation directory sample. These exact alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2397 review amendment: The broad unit command loses three standalone suites, two partial-case definitions and two URL table rows across package/download/placement tests. Keep initial wrong-port authorization, modified independent-copy digest refusal and abort-after-begin cancellation dispatch. The remaining alarms are deliberately retired; no equivalent complete replacement or fresh validation of the reduced selector is claimed. Audit2393 current-parent refresh2401: Remove the basic skill-install service alias sample and original public managed-remove receiptless refusal case. Preserve the upstream request ownership suite and transaction interruption coverage. No equivalent complete replacement or fresh validation of the reduced selector is claimed. Audit2389: The broad unit command loses the missing-preview suite, plain-global destination sample and prepublished-receipt recovery example. No equivalent replacement or fresh validation of the reduced selector is claimed. Audit2385: The broad unit command loses four authored walker/staging/protocol examples (six expanded cases); no equivalent replacement or fresh validation is claimed for the reduced suite. Audit2383: The unscoped Vitest command no longer includes the removed Antigravity catalogue suite; its exact provider-root/owner example has no equivalent replacement or fresh validation claim. Audit2377/2381: The unscoped Vitest command includes the reduced bundled-skill and native-discovery suites; the eight removed backup/legacy/catalogue/symlink/SSH-builder examples have no replacement-equivalence or fresh validation claim here. Audit2133 current-parent preparation: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2095 current-parent preparation2126: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2090 (sources2088/2089): Current reduced suites intentionally retire the alarms listed in knownGaps; prior dated execution and replacement claims do not validate changed source bytes or selectors. Historical prior account (preserved verbatim): Audit2086 (sources2082/2083): Current reduced suites intentionally retire the alarms listed in knownGaps; prior dated execution and replacement claims do not validate changed source bytes or selectors. Historical prior account (preserved verbatim): Audit2076 (sources2073/2074): Intentionally retire these low-value alarms without replacement: src/main/runtime/orca-runtime-tests/terminal-handles-part-02.spec.ts: recovers a moved SSH pane through the tab it now sits in, not the one its lease froze; reports a plain expired orphan; does not report a pane whose only recent lease was superseded; does not report a pane whose only recent lease had its relay id recycled; picks the eligible orphan over a superseded predecessor that matches first; collects the same tabs the per-tab reader reports, in one sweep of the leases; reports no candidate when no lease names any of the worktree tabs. src/main/runtime/orca-runtime-tests/runtime-availability.spec.ts: starts unavailable with no authoritative window; reports the configured Windows terminal shell on status; reports floating workspace availability from settings on status; polls floating tabs with targeted PTY liveness and no repo/provider inventory; hydrates persisted tabs when the store cannot report repos; advertises browser screencast only when a renderer window is available; routes mobile Codex reset consumption through the account mutation coordinator; maps a definite pre-provider rejection into an authoritative current snapshot. Existing unrelated evidenceRuns retain their original scope; unchanged dated receipt objects do not validate changed source bytes or reduced selectors. No fresh gate execution or historical import-closure equivalence is claimed. Frozen current literal-import graph reaches these changed test bytes; unresolved local and computed edges remain debt, and current reachability is not historical execution or equivalent replacement evidence. Historical prior account (preserved verbatim): Audit2070 (sources2068/2069): Intentionally retire these low-value alarms without replacement: src/main/runtime/orca-runtime.test.ts: ordinary registration cleanup removes only await import('./orca-runtime-tests/hooks-and-hosted-review.spec'). src/main/ssh/ssh-multiplexer-transport-writer.test.ts: reports saturated epochs and their drain boundary exactly once. src/main/runtime/orca-runtime-tests/worktree-removal-archive-hook-gate.spec.ts: removes and records the waiver when the failure is explicitly overridden; removes without an override record when the hook succeeds; removes when the hook is configured but not requested; removes when no archive hook is configured; holds a desktop removal in the same repo until this one is accepted; joins a desktop removal of the same worktree accepted while this one waited. src/main/runtime/orca-runtime-tests/worktree-ps-agent-row-dismissal.spec.ts: drops the row as soon as the user dismisses it, without waiting for the PTY to exit; tells paired clients to republish on the transition and on the dismissal; rejoins a row through its %s handle after pane ownership clears. src/main/runtime/orca-runtime-tests/hooks-and-hosted-review.spec.ts: reports an error when the SSH filesystem provider is unavailable; reports an SSH orca.yaml as an error without reading any filesystem; reports ok for a local repo hook check; reads SSH issue commands as absent and drops writes without touching any filesystem; allows host integration slug helpers for SSH repos through provider-aware GitHub clients; routes runtime GitHub repo identity helpers through the selected WSL project runtime; routes runtime GitHub issue and work-item actions through the selected WSL project runtime; pins explicit origin preference on runtime open-by-number work item lookups; forwards check-details cancellation without local Git overrides. Existing unrelated evidenceRuns retain their original scope; unchanged dated receipt objects do not validate changed source bytes or reduced selectors. No fresh gate execution or historical import-closure equivalence is claimed. Frozen current literal-import graph reaches these changed test bytes; unresolved local and computed edges remain debt, and current reachability is not historical execution or equivalent replacement evidence. The historical receipt/currentCommand selecting src/main/ssh/ssh-multiplexer-transport-writer.test.ts remains historical and is not a passing result for the reduced current command. Historical prior account (preserved verbatim): Audit1931 (sources1928/1929): Delete the complete tail-wait memo suite: its sole current authored callback checks supplied fromTail/blocked field values. Retire all three broader memoization/equivalence/eviction assertion aliases; they are not backed by retained source callbacks. No scan-work budget, sustained output, physical terminal or resource measurement is assigned to this removed test. Preserve meaningful remaining selectors/assertions and unchanged dated receipts within their original scope. Reduced selectors have no fresh gate execution evidence in this metadata packet. No equivalent replacement, physical watcher/PTY/provider, live SSH/remote/mobile, rendered, cross-platform, soak or measured-budget result is claimed. Historical prior account (preserved verbatim): Audit1674 removes low-value test projections, mock wiring, private-state assertions, inventories and duplicate examples without equivalent replacement coverage. Per-source reviews record retained public behavior and refusal boundaries with injected/native/remote limits. Affected historical receipts are retired; gates without active current evidence are downgraded. Historical scope before this audit: Audit1634 removes low-value IPC, filesystem and runtime projections, argument inventories and duplicate examples without equivalent replacement coverage. Per-source reviews record retained cancellation, ownership, authorization, filesystem and SQLite boundaries with injected/native/remote limits. Affected historical receipts are retired; gates without active current evidence are downgraded. Historical scope before this audit: Local macOS evidence covers main-process pending-output and projection-admission caps, saturated-tail wait detection, direct-SSH source retention/accounting, always-on V1 negotiation with legacy peer fallback, exact provider-generation pause ownership, renderer exit/data ordering, decoder input bounds, bounded reconnect scheduling, and WSL stdio transport settlement through deterministic unit contracts. A joined main/runtime oracle exercises renderer-sourced headed semantics and headless-model snapshot semantics without launching a live paired server. Separately, a macOS-hosted Docker OpenSSH run exercises only the deployed Linux relay and direct SSH provider with an exact 256 KiB source-credit plateau, concurrent PTY typing, fixed-size filesystem frames, Git churn, and owner-lease reconnect. Neither deterministic topology labels nor Docker SSH constitute live headed desktop, headless orca serve, or physical WSL evidence; local/daemon, prior-version daemons, Windows named pipes/ConPTY, folder workspaces, and mixed-version clients also remain uncovered. Audit1312 removes low-value imported specs from aggregate test drivers; old whole-driver execution receipts are archived. Retained registrations are unchanged. No equivalent replacement coverage is claimed. Audit1383: src/main/runtime/orca-runtime-tests/worktree-native-chat-setup.spec.ts reduced. Lose command-list/receipt/default/background activation matrices whose provider spawn returns canned IDs. Retained test proves actual tab allocation separation, not terminal startup. No equivalent replacement coverage is claimed. Existing exact unaffected receipts and their platform/provider/budget claims remain scoped to unchanged selectors. Changed optional selectors have no new execution result. Audit1401: src/main/runtime/orca-runtime-tests/mobile-session-tabs-duplicate-pty-repair.spec.ts removed. Loses listing-on-already-repaired-data alarm; it never established runtime repair invocation. src/main/runtime/orca-runtime-tests/mobile-session-tabs-split-agent-tab.spec.ts removed. Loses actual mobile split sibling shell versus recorded-agent resume command alarms; no equivalent coverage asserted. src/main/runtime/orca-runtime-tests/worktree-native-chat-setup.spec.ts removed. Loses separate setup/startup tab result in that manually assembled path. src/main/runtime/orca-runtime.test.ts reduced. Driver registration/import of a whole-deleted selected spec is removed; directly authored cases remain unchanged. No extra authored removal credit. No equivalent replacement coverage is claimed. Existing exact unaffected receipts remain unchanged and apply only to their unchanged selectors. Changed optional selectors have no new execution result.", "motivatingLinks": [ "https://github.com/stablyai/orca/pull/6836", "https://github.com/stablyai/orca/pull/6858", @@ -9217,7 +9205,7 @@ "https://github.com/stablyai/orca/pull/7054" ], "invariant": "High-volume terminal output must stay bounded across daemon socket writes, SSH relay writer/decoder/source retention/reconnect, main model and projection admission, runtime metadata, detectors, and tail checks, main-to-renderer in-flight bytes, renderer scheduler queues, and hidden-output restore without starving focused input. Every new SSH session offers V1 and every same-build relay supports it; legacy delivery is reachable only when capability negotiation proves the peer cannot use V1. Negotiated SSH spans remain exact and contiguous through activation, exit, cancellation, recovery, desktop projection, and required remote replacement; provisional activation data cannot project, reconnect may release it only into the exact attempt's private recovery quarantine after contract validation, and exit seals that quarantine against later same-token frames until ordered admission or exact cancellation proof. Reconnect checkpoint capture freezes exact provider-generation/PTy admission, cancels queued old work, and waits for the running raw completion before exposing its accepted checkpoint; timeout or failure detaches only that PTy's old model, makes the checkpoint unavailable, and releases the bounded fence without closing the shared provider, while the same failure outside an active exact migration remains generation-fatal and overlapping reconnects preserve any earlier outstanding fence. Pending renderer projection IDs are capped and compacted across split remainders, exit preparation owns its renderer fence through finalization, exit-time cancellation transfers published projections before proof commit, generation close fences late proof while draining exact projection waiters, closed-generation identity compacts without weakening stale rejection, canceled source-delivery retirement retains at most one ordered token per PTY, and pause/resume targets only the exact provider generation. Additional subscribers cannot stall the owner, while the required legacy primary retains backpressure.", - "oracle": "Audit 3292 combines adopted 3285/3287/3289/3293 removals: 40 authored declarations and 47 expanded scenarios, including whole frame-editor-view, ambiguous remote-delete-refusal, unverifiable-host subscription and editor-close cleanup suites. The previously reviewed dock-badge suite was already removed upstream in PR 40895 and receives zero new removal credit. Intentionally retired alarms include background browser selection and last-tab landing; main startup fallback, SSH project cleanup/survivor routing, exact-PR contradiction/saved-push positives, replay/sidecar rollback and wrapped remote error normalization; records/snapshot missing-diff hydration, ambiguous folder-owner delete refusal, focus no-op notifications, nested editor context-only cache check, pending broadcast-first status and ordinary four-confirmation aggregation; preview-source frontmatter pruning, approved local/runtime agent dispatch, non-GitHub legacy PR cache invalidation, stale merged-head transient-error fallback, empty-queue immediate query reply and unverified-to-concrete preflight risk. Additional intentionally retired alarms are injected host subscription/unsubscribe counts, synthetic editor reveal/draft/fallback/scoped close, ambiguous unread refusals and hidden mark/read roundtrip, immediate connect backoff/noError, positive mirrored evidence-clock renewal, supplied VM failure/success projections and git-local/folder-SSH wake permutations. Remaining temporal/ownership cases are narrower; no equivalent replacement or fresh execution is claimed. Audit 3283 removes 20 authored declarations and 31 expanded scenarios, including two whole suites. Retired alarms cover PR refresh-state pruning, shared runtime subscription cleanup and store isolation, language content-change routing and older completion ownership, ordinary panel retry-timer cleanup and pending loading, four hosted-review lifetime permutations, mocked terminal creation error/order wiring, five sleep-inventory variants with pending-frame-only assertions, palette fallback/composite highlights, Windows/UNC encoded-editor input rows, mixed-repository partial failure counts, title setters and generated-title bypass/replacement, five window-close coordinator delegation/guard/finally branches, and ambiguous-old-record frame reveal. These regression checks are intentionally lost under the test-value audit; retained cases are not equivalent replacements. Prior coverage notes and receipts remain historical. Audit 3273 removes 14 authored declarations and 19 expanded scenarios across four whole suites and eight partial suites. Retired alarms cover saved-local cancellation/layout ownership, ambiguous-owner warning reset, folder attachment routing, VM false-capability bypass, abandoned reveal warmup cleanup and viewport claim deduplication/rearming, quiet unrelated remote-removal refusal, startup-command one-shot consumption, repository/floating recovery-ledger rows, fake-React pinned-scroll intent, split-ratio state identity/subscriber suppression and fractional change, cross-host project-group join refusal, three PR request-lifetime permutations, upstream-status preservation on error, and unresolved Git-owner refusal. These regression checks are intentionally lost under the test-value audit; retained scenarios are not equivalent replacements. Historical coverage receipts remain historical, including gate35 subscriber claims. Audit 3256 removes these specific alarms from the broad root unit commands: skill dialog active-share selection, close and pending-share handoff; simple keyed-record deletion; marker live-region insertion, simple landing and nine baseline policy examples; General search/control navigation inventory; orphan-count cache bootstrap; seven Codex code classifications and HTTP 429 warning mapping; two skill unread-root verdict examples; peer-mail payload and conversation-ID rejection; and the GitHub organization TABLE text-field optimistic rollback/failed-envelope example. These include real behaviors; retained tests do not provide equivalent coverage for every removed scenario. Mobile losses are recorded separately and are not coverage of these root commands. Audit3246 retires NewRowsMarker reveal/no-repeat and pane-scoped beforeinput checks; skill-owner option availability/count/dedup/order; six styled Input/Textarea IME forwarding rows; the static Codex/OpenCode smart-key inventory; tab-map AST ratchet diagnostic fixtures; child-roster work-budget and retained-aggregate alarms; malformed persisted floating-cwd fallback/no-crash/empty exact-root checks; the unanswered-host empty-list discriminator; the direct invalidated-cache commit-false assertion; one redundant digit-keyup IME row; cached non-supported Claude title-generator rows; and the duplicate late naming-result singleton. These root broad commands lose those specific alarms without equivalent replacement. Distinct retained owner/state checks have their own bounded claims; the real scheduler still rejects stale response data, while the direct false-return alarm is retired. Audit3231 retires supported-host restore-pane key mapping, closed/open creation-sidebar toggle visibility, unrelated scope-error/null classification and quick-submit reveal/no-create checks. These broad commands lose those real narrow alarms; no replacement coverage is claimed. Audit3219 removes the synthetic Cmd+J extra-source suite; this broad command no longer checks its match/tie placement and selection, announced count, empty-query cap, or workspace hiding with retained recent tabs. No replacement coverage is claimed. Audit3209 composes approved sources3202/3206: deliberately retires seven authored/expanded cases in four whole suites without equivalent replacement. Work-item queries lose real GitHub/GitLab oversized ASCII secret-prefix empty-query and whitespace-before-trim refusal alarms; inputs share the imported size bound and exercise only its fast length branch, with no multibyte or actual provider/exposure guarantee. Skill sharing loses complete/partial managed-bundle and destination-ambiguity association checks plus three negative origin/path/scheme admission examples; these do not establish uploaded contents, arbitrary-URL fetching, authorization or execution. Retain exact originless-project direct-link fallback, cloud-delete confirmation, bundled-target repair/owner isolation and explicit Windows-host preference over stale WSL suites. Rejected3201 runtime-preference removal is excluded. No real cloud/network/host/disk, mobile or mixed-version execution validation is claimed. Audit3200 composes approved source3194: deliberately retires thirteen authored registrations/twenty-seven expanded cases in six whole automation host/list policy suites without equivalent replacement. Real RPC category/retryability and wrapped-timeout recognition, unscoped-failure/scoped-success health evidence precedence, exact-ID create selectors and per-run workspace omission, paired-web local/SSH/absent host catalog routing, incompatible/removed/unhydrated/offline execution health, runtime-before-nested-SSH recovery dispatch, and no-owned-focus/successor/foreign-list focus policy alarms are consciously lost. Retain exact20line orphan allow/refuse/precondition and exact90line cross-host same-ID search suites. No retry-timer/fence lifecycle, actual reconnect/network/write delivery, native focus, mobile/mixed-version runtime or disk persistence coverage is claimed. Audit3191 combines approved source3182/3187/3188: deliberately retires thirteen authored Vitest registrations and fifteen expanded cases, including five whole suites, without equivalent replacement. Attachment intake loses real portal/native-capture terminal interception and unowned-container refusal, immediate child-only committed availability/claim-ref negotiation and delivery, and direct-target over stable focused/background composer routing through disable/re-enable/remount and independent question focus. Exact destination/cache/draft and final-stat owner/workspace/File-release suites remain; they do not replace Surface recipient routing. Automation authoring loses destination runtime catalog membership, local/direct-SSH exclusion of paired-runtime repos, unknown-runtime empty catalog, logical project/host/setup/repo/path context payload, and missing/nonready setup refusal; these were genuine direct helper alarms, while exact schedule transformation, legacy schedule and setup-decision suites remain. Agent picker loses setup-chat/terminal/missing-installer/unsupported-or-unknown-host row projection samples and the ordinary unsearched menu variant; the entire original26-line resume recipe suite remains, including reported bypass versus default/absent permission modes, as does the exact search-result menu callback with its fixtures, model/effort commits and staged Arguments reopen outcome. Rejected predecessor3180 full recipe deletion is excluded. No actual native drag/cursor/focus/IME, upload bytes or disk/restart persistence, full automation save/scheduler/runtime transport, real resume-process flags/environment delivery, or native menu/rendered layout validation is claimed. Audit3178 combines source3169/3170/3175: deliberately retires eight authored units (six Vitest cases and two imperative custom relay scenarios), including two whole suites, without equivalent replacement. Voice Section loses per-model pending-delete isolation across interleaved A/B completion and the two-success refresh-call alarm; exact VoicePane delayed key-clear/newer enabled-toggle merge remains and does not replace row deletion coverage. Speech loses dedicated rating-scale/inclusive-ceiling, unsupported-versus-unmeasured, explicit/system-language precedence/locale alias, accuracy versus fast named/default/best-measured selection, and unmeasured/no-match examples; exact offered-user-pick versus retired-selection case and its fixture remain. Relay loses legacy ping-delivery count/liveness sampled before the silence deadline and grouped malformed Bearer/host-ID 401/429 routing checks; twelve real Worker/DurableObject/shipped-client scenarios remain, not equivalent replacement for those narrow alarms. Six prior speech cases are not all deleted: approved successor3175 keeps the original user-choice case. No actual credential/file persistence, native/GPU/engine/download delivery, production assignment policy or deployed-runtime validation is claimed by this reduction. Audit3165 combines source3160/3162: deliberately retires six authored/expanded cases across three whole suites without equivalent replacement. Launch/status losses: observed React-render pending/resuming coordination across settings and deferred offer read; stale-offer reread suppressing dialog reopen; held-local-chat recovery visibility with new-chat preferences off; disabled-local admission avoiding offer RPC despite an injected but unconsumed paired-tab fixture; and run-only lost-reply uncertainty reachability until direct viewed-run retirement. Launch probe does not prove arbitrary synchronous-store atomicity, the paired fixture is not remote runtime enrollment, and the status case directly marks viewed state rather than rendering the summary. Crew-hook losses: old-host method_not_found cache persists across party changes but is released by independently supplied connection generation/verified pairing status or pairing revision, with actual frame publication and teardown. These are real narrow coordination, admission, uncertainty and mixed-version cache alarms consciously lost. Exact web verified-runtime writer handoff guard remains; it does not replace those alarms or prove live host/native/mobile delivery. Audit3156 combines3147/3150/3152/3153/3154: deliberately retires39authored/40expanded native-chat recovery cases, eight whole suites and two orphan test-support files without equivalent replacement. Lost alarms: lost-reply unconfirmed reconciliation, skipped rows/counts and missed-frame repair, unknown/pending outcome and omitted-failure-list compatibility, uncertain history after dismissal, retry/refusal/dismiss lifecycle, hidden/consumed picker ownership, result-tree keyboard focus/disclosure and all-skipped retirement; unconfirmed-over-conflict guidance and failed-chat changes despite older host timestamps; nearest-listed ancestor/cyclic forest shape, descendant membership, host ordering/missing-host local fallback; skipped/readiness/admission counts, provisional skip/progress monotonicity, early per-chat verdicts with batch pending protection, older-host waiting, start-slot/delivery distinction, retry-over-failure and unknown-after-withdrawal attention; remote snooze/reconnect/reoffer, unseen mixed summary through open/close, watched completion retirement, new success beside old failure, failed-reread mixed-result preservation, filter/collapse completion resets, retry summary replacement and current-offer/history selection; cross-host workspace identity, rendered cyclic reachability, nested tri-state/toggle propagation, project eligibility isolation and collapse preserving selection. Exact fallback-list completion barrier, batched verdict/cleanup retention, stale-read versus dismissal publication race, and requested-but-never-rendered finished-run retirement remain; they do not replace retired alarms. Audit3146 combines source reviews3132/3133/3135/3138/3143: intentionally retire20authored/31expanded cases without equivalent replacement. Provider-session losses: structured-native terminal-resume exclusion, metadata-less completed identity, new-turn completion clearing, Pi provider-only/periodic/manual promotion, changed-transcript launch-config isolation, Pi/omp/prime-agent completed-session remote/manual-shutdown promotion, and quit/done precedence over heartbeat. Side-thread/question losses: finished-pane acquisition, hidden title/recap states, local/relay/relay-done conversation takeover with prompt/session/child resets, plain-message abandonment, compaction/session replacement and completion resets. Codex startup losses: incoming-owner cached child replacement, old-relay foreign live-session correction, completed foreign-root turn-fact permutations. Transcript losses: real temporary-JSONL partial sibling/final-child completion, unlabelled child attribution, compact cached replay preservation and100/1000completed-child roster retention/release. Compiler-ratchet losses: valid-line uncompiled-list parser grammar examples and injected-existence stale-path filtering; these did not exercise actual filesystem canonicalization or build exclusion. These are real lifecycle, ownership, replay, liveness and retention alarms, including recent#40246 regressions, deliberately lost. Retained conditional record replacement, clockless root/SSH owner isolation, persisted main-thread fork rejection, partial/final question-answer lifetime, cached-roster/missing-ID/live HTTP/durable startup boundaries and restarted-relay refusal/acceptance do not replace those losses. No native/SSH/WSL execution or equivalent coverage is claimed. Audit3128 scoped coverage reduction: Audit3121 removes VoiceDictationLanguageSetting.test.tsx (Spanish-to-es callback and unsupported-model Korean option presence) and voice-speech-model-rows.test.ts (provider/language-order/retired-on-disk list policy); these real narrow alarms are deliberately retired without replacement. VoiceSpeechModelSection per-model concurrent deletion remains unchanged. Audit3122 removes the direct absolute/parent-segment sparse-directory exception-type sample and the five-row IPC sparse-preset error-code/non-save table (two authored/six expanded cases). Those real typed-validation and IPC refusal/error-code alarms are deliberately retired. Keep both real symlink/junction floating-directory trust cases and the minimal RPC structured validation-reason serialization case. The RPC case does not replace IPC save/refusal behavior, typed normalization for both path inputs, actual Git sparse checkout or rendered localization. No equivalent replacement or fresh test/runtime/platform/remote/performance validation is claimed. Audit3124 removes ExperimentalPane.test.tsx (ordinary Pet switch callback), WorkspaceDirectorySetting.test.tsx (padded absolute saved-path normalization/no-write blur), and repository-search.perf.test.ts (navigation/selected-pane builder-call policy, fixture cardinality/nonempty entries and renamed project keyword inclusion). These real narrow alarms are retired without replacement; RepositoryPane.search.test.tsx search-to-sparse-editor request remains unchanged. Audit3129: resolver Windows case-insensitive and POSIX case-sensitive configured-env composition plus mocked-base launch-preflight Windows composition are intentionally no longer checked by the two deleted suites. No equivalent coverage claimed. Keep runtime-structured-agent-host-env.test.ts unchanged: configured Windows Claude-home account identity and host-account precedence remain checked. Audit3114 incorporates source3101: retire three structured Claude child-environment wrapper cases covering inherited stamp isolation/default and explicit entrypoint, Windows SDK-key canonicalization/default/duplicate-key order, and configured lookup/final environment/config-dir conjunction. Keep direct auth/session sanitation and Windows-versus-Linux overlay checks, actual executable lookup from supplied inherited PATH, native Windows child environment delivery, and stale option-mutation fencing. These are not equivalent replacements for the retired wrapper alarms. No fresh test/runtime, real login-shell probe, Claude SDK startup, remote/mixed-version, UI or performance result is claimed. Audit3114 incorporates source3105: retire 17 authored/20 expanded daemon launch-note cases, including the entire two-case SessionLaunchNote suite. Deliberately lose split-marker carry across same-token re-arm, stale-token retirement refusal, foreground tri-state and serial settlement, omitted-note/no-incarnation mixed-version policy, sticky retirement, first-incarnation/replacement launch preservation and held-launch precedence. Keep only the unchanged unresolved foreground-read race against a later finished attach. Supplied notes/foreground and runtime calls do not establish actual daemon/main restart, SSH, native Windows observation, mobile UI, equivalent replacement or fresh runtime/performance validation. Audit3114 incorporates source3109: retire six authored/35 expanded pricing cases: 21 accepted model-name examples, 10 unsupported/future-model fail-closed examples, malformed TTL clamp, unknown-model estimate refusal, flat-model long-context disregard and oversized long-context clamp. Keep mixed five-minute/one-hour write allocation and short/all-long/mixed long-context allocation with original fixed oracles. Real parser/refusal/bounds alarms are knowingly lost without equivalent replacement; retained tests do not validate provider rates, actual billing or request threshold classification. Preserve the archived usage-scan-append source-freeze receipt without transferring historical execution/performance credit. No fresh runtime result is claimed. Audit3108 source-only reduction (3094/3095/3100): retire 27 authored/30 expanded cases, including complete markdown view-state, file-preview link-open and CLI agent-server-route suites, without replacement. Deliberate losses include preview visibility/reference lifetime and same-path owners; SSH stat, directory/missing-target, explicit-null owner, nonmarkdown line/column, local URI routing, remote-to-client guard and same-file reuse; document-preview source-owner/folder/reuse routing, stable grant location and outside-workspace POSIX/Windows request projection; and verified remote CLI send/check refusal, suggested --on argv/copy, shell no-probe bypass, unverified-launch admission and older-peer refusal. Retain two markdown source-runtime/qualified-reveal alarms, one stale grant-rejection fence and two remote read/mutation evidence policies, with original callbacks. Final last-wins reveal did not prove transient cancellation; CLI prerequisite did not prove no real send, and envelope tests do not execute server refusal. No fresh runtime, rendered UI, actual file/SSH/paired transport, authorization, mixed-version or performance result is claimed. Audit3096 source-only reduction (3087/3088): retire 69 authored/76 expanded cases, including complete recovery-portals and reconnect-banner suites. Intentionally lose dead/default TUI replay, generated alternate-frame style composition, reset/mode/dimension and legacy missing-mode-boundary alarms, UI notice/action/reveal policies, and isolated recovery lifecycle variants, without equivalent replacement. Retained registrations and callbacks are unchanged; headless cells are not pixels, and no fresh runtime, host, SSH, WSL, rendered-app or performance result is claimed. Audit3086 source-only reduction (3079/3080/3081): intentionally retire 93 authored/100 expanded mock-boundary cases, including the complete spawn-errors and SSH reconnect overlay suites, without replacement. Retired alarms include spawn classification/ownership, reply ceilings and renderer-write failure recovery, disconnect/detach fencing branches, authority facts, and overlay retry/visibility wiring. Retained callbacks are unchanged; no fresh execution, real PTY/SSH, rendered UI, or performance result is claimed. Module layout SSH policy: Retire the multiplexer private-clock saturation registration, the writer saturation transition-count registration and the changed-source dated writer/backpressure receipt. Retained byte delivery, lane order, fairness, settlement and cancellation cases are unvalidated by that historical receipt. No equivalent replacement, new execution, measured performance, live SSH/WSL or cross-platform proof is claimed. The unchanged WSL protocol receipt retains only its original command scope. Historical prior account (preserved verbatim): Audit2432: The broad unit command loses the isolated BranchPicker open-change notification sample. Its unique true/false callback alarm is intentionally retired; reopening/status-refresh behavior was not exercised. No equivalent replacement or fresh validation of the reduced selector is claimed. Audit2425: The broad unit command loses the workspace-copy-status supplied readError forwarding sample. It did not exercise the branch-switch blocking promised by its title. This alarm is intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2417: The broad unit command loses two ordinary clean Git cherry-pick/revert success samples and two terminal startup foreground-read work-budget samples. These unique alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2412: The broad unit command loses the whole six-case fake-React-hook scroll-anchor suite, two generic draft-retention samples, a simple new-agent order sample, a real history-publication batching-count sample, an unmounted handoff abort/timer sample and three basic WSL preview/error samples. These alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2404: The broad unit command loses the standalone share-name lookup 503 propagation suite, initial deletion placement-kind sample, direct changed-mtime stale sample, first-pass rollback existence example and abandoned-preparation directory sample. These exact alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2397 review amendment: The broad unit command loses three standalone suites, two partial-case definitions and two URL table rows across package/download/placement tests. Keep initial wrong-port authorization, modified independent-copy digest refusal and abort-after-begin cancellation dispatch. The remaining alarms are deliberately retired; no equivalent complete replacement or fresh validation of the reduced selector is claimed. Audit2393 current-parent refresh2401: Remove the basic skill-install service alias sample and original public managed-remove receiptless refusal case. Preserve the upstream request ownership suite and transaction interruption coverage. No equivalent complete replacement or fresh validation of the reduced selector is claimed. Audit2389: The broad unit command loses the missing-preview suite, plain-global destination sample and prepublished-receipt recovery example. No equivalent replacement or fresh validation of the reduced selector is claimed. Audit2385: The broad unit command loses four authored walker/staging/protocol examples (six expanded cases); no equivalent replacement or fresh validation is claimed for the reduced suite. Audit2383: The unscoped Vitest command no longer includes the removed Antigravity catalogue suite; its exact provider-root/owner example has no equivalent replacement or fresh validation claim. Audit2377/2381: The unscoped Vitest command includes the reduced bundled-skill and native-discovery suites; the eight removed backup/legacy/catalogue/symlink/SSH-builder examples have no replacement-equivalence or fresh validation claim here. Audit2133 current-parent preparation: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2095 current-parent preparation2126: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2090 (sources2088/2089): Current reduced suites intentionally retire the alarms listed in knownGaps; prior dated execution and replacement claims do not validate changed source bytes or selectors. Historical prior account (preserved verbatim): Audit2086 (sources2082/2083): Current reduced suites intentionally retire the alarms listed in knownGaps; prior dated execution and replacement claims do not validate changed source bytes or selectors. Historical prior account (preserved verbatim): Audit2076 (sources2073/2074): Intentionally retire these low-value alarms without replacement: src/main/runtime/orca-runtime-tests/terminal-handles-part-02.spec.ts: recovers a moved SSH pane through the tab it now sits in, not the one its lease froze; reports a plain expired orphan; does not report a pane whose only recent lease was superseded; does not report a pane whose only recent lease had its relay id recycled; picks the eligible orphan over a superseded predecessor that matches first; collects the same tabs the per-tab reader reports, in one sweep of the leases; reports no candidate when no lease names any of the worktree tabs. src/main/runtime/orca-runtime-tests/runtime-availability.spec.ts: starts unavailable with no authoritative window; reports the configured Windows terminal shell on status; reports floating workspace availability from settings on status; polls floating tabs with targeted PTY liveness and no repo/provider inventory; hydrates persisted tabs when the store cannot report repos; advertises browser screencast only when a renderer window is available; routes mobile Codex reset consumption through the account mutation coordinator; maps a definite pre-provider rejection into an authoritative current snapshot. Existing unrelated evidenceRuns retain their original scope; unchanged dated receipt objects do not validate changed source bytes or reduced selectors. No fresh gate execution or historical import-closure equivalence is claimed. Frozen current literal-import graph reaches these changed test bytes; unresolved local and computed edges remain debt, and current reachability is not historical execution or equivalent replacement evidence. Historical prior account (preserved verbatim): Audit2070 (sources2068/2069): Intentionally retire these low-value alarms without replacement: src/main/runtime/orca-runtime.test.ts: ordinary registration cleanup removes only await import('./orca-runtime-tests/hooks-and-hosted-review.spec'). src/main/ssh/ssh-multiplexer-transport-writer.test.ts: reports saturated epochs and their drain boundary exactly once. src/main/runtime/orca-runtime-tests/worktree-removal-archive-hook-gate.spec.ts: removes and records the waiver when the failure is explicitly overridden; removes without an override record when the hook succeeds; removes when the hook is configured but not requested; removes when no archive hook is configured; holds a desktop removal in the same repo until this one is accepted; joins a desktop removal of the same worktree accepted while this one waited. src/main/runtime/orca-runtime-tests/worktree-ps-agent-row-dismissal.spec.ts: drops the row as soon as the user dismisses it, without waiting for the PTY to exit; tells paired clients to republish on the transition and on the dismissal; rejoins a row through its %s handle after pane ownership clears. src/main/runtime/orca-runtime-tests/hooks-and-hosted-review.spec.ts: reports an error when the SSH filesystem provider is unavailable; reports an SSH orca.yaml as an error without reading any filesystem; reports ok for a local repo hook check; reads SSH issue commands as absent and drops writes without touching any filesystem; allows host integration slug helpers for SSH repos through provider-aware GitHub clients; routes runtime GitHub repo identity helpers through the selected WSL project runtime; routes runtime GitHub issue and work-item actions through the selected WSL project runtime; pins explicit origin preference on runtime open-by-number work item lookups; forwards check-details cancellation without local Git overrides. Existing unrelated evidenceRuns retain their original scope; unchanged dated receipt objects do not validate changed source bytes or reduced selectors. No fresh gate execution or historical import-closure equivalence is claimed. Frozen current literal-import graph reaches these changed test bytes; unresolved local and computed edges remain debt, and current reachability is not historical execution or equivalent replacement evidence. The historical receipt/currentCommand selecting src/main/ssh/ssh-multiplexer-transport-writer.test.ts remains historical and is not a passing result for the reduced current command. Historical prior account (preserved verbatim): Audit1931 (sources1928/1929): Delete the complete tail-wait memo suite: its sole current authored callback checks supplied fromTail/blocked field values. Retire all three broader memoization/equivalence/eviction assertion aliases; they are not backed by retained source callbacks. No scan-work budget, sustained output, physical terminal or resource measurement is assigned to this removed test. Preserve meaningful remaining selectors/assertions and unchanged dated receipts within their original scope. Reduced selectors have no fresh gate execution evidence in this metadata packet. No equivalent replacement, physical watcher/PTY/provider, live SSH/remote/mobile, rendered, cross-platform, soak or measured-budget result is claimed. Historical prior account (preserved verbatim): Audit1674 retires changed-source assertion and execution scope without equivalent replacement coverage. Existing unchanged-selector receipts remain scoped to their original sources. Historical prior-source oracle: Existing exact unchanged-selector receipts remain the only current execution evidence. Changed source selectors have no fresh execution result. Historical prior-source oracle account: The current executable slice injects main-process renderer backlog pressure, then asserts ordinary terminal-wait detection without a joined-tail allocation and with full prompt-family continuity, per-PTY and total pending-output caps, a 1,024-ID projection cap with split-remainder compaction, preserved sequenced-tail metadata, active-pending protection ahead of background trimming, exact provider-generation pause ownership, renderer exit/data ordering, and ACK-gated in-flight bounds. The negotiation seam proves every initial connection and reconnect offers V1, the same-build relay advertises V1 without launch flags, old clients remain token-free, and method-not-found peers fall back without installing source ACK publication. The joined source-intake/multiplex oracle blocks renderer or headless serialization, admits one snapshot-covered span and one trailing span, requires replacement reservation only after the authoritative sequence is known, advances upstream ACK eligibility exactly to the covered boundary after SnapshotEnd, and delivers then ACKs the trailing span through the ordinary live path without cancellation. Source-range ledger and multiplex seams additionally require cumulative byte ACK 40 then 100 for one 100-byte frame to release exact byte credit without early source settlement, admit a contiguous higher-generation recovered token while the prior token remains unsettled, and reject stale stream or source generations without releasing in-flight byte credit. Replacement reservation rolls back every earlier span on a later failure, commit requires the exact frozen transfer states, and an authoritatively reclaimed covered span rejects commit without local trim authority while rollback removes the reservation idempotently. The exit-deadline oracle publishes a source-backed desktop projection, advances a fake clock to cancellation, and requires one projection transfer, proof commit, preparation, and final exit with no provider close, retained obligation, duplicate finalization, or process-lifetime cancellation tombstone; a second controlled proof remains pending across generation close and must never publish final exit, while both paths release the renderer preparation lease exactly once. The model-migration oracle accepts span A, blocks span B's raw emulator completion, begins disconnect migration, and proves no checkpoint or reconnect attach can remain at A; releasing B advances the exact checkpoint to B and projects B once. Its fake-clock arm reaches the 10-second deadline, requires checkpoint-unavailable, one exact model reset, zero retained admission charge and timers, and no effect from late raw settlement. Its two-PTY failure arm rejects one running raw callback under an active exact migration and requires one checkpoint-unavailable result, one model reset, zero provider closes, retained sibling checkpoint and transport liveness, zero charges and timers, and an unaffected other generation; a non-migrating sibling oracle still requires generation close. The intake additionally closes 2,048 sequential provider generations into one exact range, rejects stale events across that range, and preserves an out-of-order live gap until its own close. Direct-SSH contracts additionally prove activation-response settlement before the first source frame, claim-gated projection under same-decoder-turn response/data delivery, exact early-ACK reservation through send settlement or same-token retry, recovery completion visible before lease-held frames transfers those frames only into the private quarantine and admits no output until exact checkpoint-to-recoveryEnd coverage, invalid-checkpoint restore retention through response settlement followed by fresh-token retry and one live source frame, isolated saturated-subscriber eviction with healthy owner liveness, preserved legacy-primary backpressure, one-write ownership across write(false)/drain, control selection ahead of queued ordinary PTY input with FIFO lanes and bounded fairness, liveness rebasing, failed-exit retention through late ACK or exact recovery, response-settlement cancellation authority, token-scoped exit cancellation, exact checkpoint-to-recoveryEnd continuity, stale-owner one-shot retry, no physical PTY teardown on recovery failure, exact provider-generation closure and once-only cleanup when recovery cancellation publication or proof rejects, 16 MiB-plus-1 MiB decoder caps, charged per-PTY/session retention budgets, and eight-wide isolated reattach. The live Electron perf oracle adds hidden-output floods, renderer scheduler queue depth, dropped-output-zero normal scenarios, and active key latency budgets before promotion.", + "oracle": "Audit 3301 combines adopted source batches 3296 and 3299: retire 27 authored declarations and 36 expanded scenarios, including six whole suites. Intentionally lost alarms cover failed-verification/recovery/restart counters and mocked hosting/toast; early overlapping pane-read scheduling/count; unreadable removal listing draft guard; bulk-purge remote-qualified and raw-local guard maps; initial-snapshot blank/mode/oversize/printable/fresh-spawn callback and replay examples; fallback mobile file close and ordinary MRU; default queue overload/drain; seeded browser-page reuse and supplied missing-page URL recreation; ambiguous sleep/hibernation owner refusal and untouched bindings/origins; ordinary selection/activity/fallback priority; skip-remote success and retained hints; supplied structured-chat unsent retention and scoped removal draft eviction; caller-chat focus precedence; open/draft PR cache eviction and merged-head fallback result inventories. Retained adverse-ordering and ownership cases are narrower and do not establish equivalent replacements. No fresh runtime, native, physical provider, cross-platform, mobile or mixed-version evidence is claimed. Audit 3292 combines adopted 3285/3287/3289/3293 removals: 40 authored declarations and 47 expanded scenarios, including whole frame-editor-view, ambiguous remote-delete-refusal, unverifiable-host subscription and editor-close cleanup suites. The previously reviewed dock-badge suite was already removed upstream in PR 40895 and receives zero new removal credit. Intentionally retired alarms include background browser selection and last-tab landing; main startup fallback, SSH project cleanup/survivor routing, exact-PR contradiction/saved-push positives, replay/sidecar rollback and wrapped remote error normalization; records/snapshot missing-diff hydration, ambiguous folder-owner delete refusal, focus no-op notifications, nested editor context-only cache check, pending broadcast-first status and ordinary four-confirmation aggregation; preview-source frontmatter pruning, approved local/runtime agent dispatch, non-GitHub legacy PR cache invalidation, stale merged-head transient-error fallback, empty-queue immediate query reply and unverified-to-concrete preflight risk. Additional intentionally retired alarms are injected host subscription/unsubscribe counts, synthetic editor reveal/draft/fallback/scoped close, ambiguous unread refusals and hidden mark/read roundtrip, immediate connect backoff/noError, positive mirrored evidence-clock renewal, supplied VM failure/success projections and git-local/folder-SSH wake permutations. Remaining temporal/ownership cases are narrower; no equivalent replacement or fresh execution is claimed. Audit 3283 removes 20 authored declarations and 31 expanded scenarios, including two whole suites. Retired alarms cover PR refresh-state pruning, shared runtime subscription cleanup and store isolation, language content-change routing and older completion ownership, ordinary panel retry-timer cleanup and pending loading, four hosted-review lifetime permutations, mocked terminal creation error/order wiring, five sleep-inventory variants with pending-frame-only assertions, palette fallback/composite highlights, Windows/UNC encoded-editor input rows, mixed-repository partial failure counts, title setters and generated-title bypass/replacement, five window-close coordinator delegation/guard/finally branches, and ambiguous-old-record frame reveal. These regression checks are intentionally lost under the test-value audit; retained cases are not equivalent replacements. Prior coverage notes and receipts remain historical. Audit 3273 removes 14 authored declarations and 19 expanded scenarios across four whole suites and eight partial suites. Retired alarms cover saved-local cancellation/layout ownership, ambiguous-owner warning reset, folder attachment routing, VM false-capability bypass, abandoned reveal warmup cleanup and viewport claim deduplication/rearming, quiet unrelated remote-removal refusal, startup-command one-shot consumption, repository/floating recovery-ledger rows, fake-React pinned-scroll intent, split-ratio state identity/subscriber suppression and fractional change, cross-host project-group join refusal, three PR request-lifetime permutations, upstream-status preservation on error, and unresolved Git-owner refusal. These regression checks are intentionally lost under the test-value audit; retained scenarios are not equivalent replacements. Historical coverage receipts remain historical, including gate35 subscriber claims. Audit 3256 removes these specific alarms from the broad root unit commands: skill dialog active-share selection, close and pending-share handoff; simple keyed-record deletion; marker live-region insertion, simple landing and nine baseline policy examples; General search/control navigation inventory; orphan-count cache bootstrap; seven Codex code classifications and HTTP 429 warning mapping; two skill unread-root verdict examples; peer-mail payload and conversation-ID rejection; and the GitHub organization TABLE text-field optimistic rollback/failed-envelope example. These include real behaviors; retained tests do not provide equivalent coverage for every removed scenario. Mobile losses are recorded separately and are not coverage of these root commands. Audit3246 retires NewRowsMarker reveal/no-repeat and pane-scoped beforeinput checks; skill-owner option availability/count/dedup/order; six styled Input/Textarea IME forwarding rows; the static Codex/OpenCode smart-key inventory; tab-map AST ratchet diagnostic fixtures; child-roster work-budget and retained-aggregate alarms; malformed persisted floating-cwd fallback/no-crash/empty exact-root checks; the unanswered-host empty-list discriminator; the direct invalidated-cache commit-false assertion; one redundant digit-keyup IME row; cached non-supported Claude title-generator rows; and the duplicate late naming-result singleton. These root broad commands lose those specific alarms without equivalent replacement. Distinct retained owner/state checks have their own bounded claims; the real scheduler still rejects stale response data, while the direct false-return alarm is retired. Audit3231 retires supported-host restore-pane key mapping, closed/open creation-sidebar toggle visibility, unrelated scope-error/null classification and quick-submit reveal/no-create checks. These broad commands lose those real narrow alarms; no replacement coverage is claimed. Audit3219 removes the synthetic Cmd+J extra-source suite; this broad command no longer checks its match/tie placement and selection, announced count, empty-query cap, or workspace hiding with retained recent tabs. No replacement coverage is claimed. Audit3209 composes approved sources3202/3206: deliberately retires seven authored/expanded cases in four whole suites without equivalent replacement. Work-item queries lose real GitHub/GitLab oversized ASCII secret-prefix empty-query and whitespace-before-trim refusal alarms; inputs share the imported size bound and exercise only its fast length branch, with no multibyte or actual provider/exposure guarantee. Skill sharing loses complete/partial managed-bundle and destination-ambiguity association checks plus three negative origin/path/scheme admission examples; these do not establish uploaded contents, arbitrary-URL fetching, authorization or execution. Retain exact originless-project direct-link fallback, cloud-delete confirmation, bundled-target repair/owner isolation and explicit Windows-host preference over stale WSL suites. Rejected3201 runtime-preference removal is excluded. No real cloud/network/host/disk, mobile or mixed-version execution validation is claimed. Audit3200 composes approved source3194: deliberately retires thirteen authored registrations/twenty-seven expanded cases in six whole automation host/list policy suites without equivalent replacement. Real RPC category/retryability and wrapped-timeout recognition, unscoped-failure/scoped-success health evidence precedence, exact-ID create selectors and per-run workspace omission, paired-web local/SSH/absent host catalog routing, incompatible/removed/unhydrated/offline execution health, runtime-before-nested-SSH recovery dispatch, and no-owned-focus/successor/foreign-list focus policy alarms are consciously lost. Retain exact20line orphan allow/refuse/precondition and exact90line cross-host same-ID search suites. No retry-timer/fence lifecycle, actual reconnect/network/write delivery, native focus, mobile/mixed-version runtime or disk persistence coverage is claimed. Audit3191 combines approved source3182/3187/3188: deliberately retires thirteen authored Vitest registrations and fifteen expanded cases, including five whole suites, without equivalent replacement. Attachment intake loses real portal/native-capture terminal interception and unowned-container refusal, immediate child-only committed availability/claim-ref negotiation and delivery, and direct-target over stable focused/background composer routing through disable/re-enable/remount and independent question focus. Exact destination/cache/draft and final-stat owner/workspace/File-release suites remain; they do not replace Surface recipient routing. Automation authoring loses destination runtime catalog membership, local/direct-SSH exclusion of paired-runtime repos, unknown-runtime empty catalog, logical project/host/setup/repo/path context payload, and missing/nonready setup refusal; these were genuine direct helper alarms, while exact schedule transformation, legacy schedule and setup-decision suites remain. Agent picker loses setup-chat/terminal/missing-installer/unsupported-or-unknown-host row projection samples and the ordinary unsearched menu variant; the entire original26-line resume recipe suite remains, including reported bypass versus default/absent permission modes, as does the exact search-result menu callback with its fixtures, model/effort commits and staged Arguments reopen outcome. Rejected predecessor3180 full recipe deletion is excluded. No actual native drag/cursor/focus/IME, upload bytes or disk/restart persistence, full automation save/scheduler/runtime transport, real resume-process flags/environment delivery, or native menu/rendered layout validation is claimed. Audit3178 combines source3169/3170/3175: deliberately retires eight authored units (six Vitest cases and two imperative custom relay scenarios), including two whole suites, without equivalent replacement. Voice Section loses per-model pending-delete isolation across interleaved A/B completion and the two-success refresh-call alarm; exact VoicePane delayed key-clear/newer enabled-toggle merge remains and does not replace row deletion coverage. Speech loses dedicated rating-scale/inclusive-ceiling, unsupported-versus-unmeasured, explicit/system-language precedence/locale alias, accuracy versus fast named/default/best-measured selection, and unmeasured/no-match examples; exact offered-user-pick versus retired-selection case and its fixture remain. Relay loses legacy ping-delivery count/liveness sampled before the silence deadline and grouped malformed Bearer/host-ID 401/429 routing checks; twelve real Worker/DurableObject/shipped-client scenarios remain, not equivalent replacement for those narrow alarms. Six prior speech cases are not all deleted: approved successor3175 keeps the original user-choice case. No actual credential/file persistence, native/GPU/engine/download delivery, production assignment policy or deployed-runtime validation is claimed by this reduction. Audit3165 combines source3160/3162: deliberately retires six authored/expanded cases across three whole suites without equivalent replacement. Launch/status losses: observed React-render pending/resuming coordination across settings and deferred offer read; stale-offer reread suppressing dialog reopen; held-local-chat recovery visibility with new-chat preferences off; disabled-local admission avoiding offer RPC despite an injected but unconsumed paired-tab fixture; and run-only lost-reply uncertainty reachability until direct viewed-run retirement. Launch probe does not prove arbitrary synchronous-store atomicity, the paired fixture is not remote runtime enrollment, and the status case directly marks viewed state rather than rendering the summary. Crew-hook losses: old-host method_not_found cache persists across party changes but is released by independently supplied connection generation/verified pairing status or pairing revision, with actual frame publication and teardown. These are real narrow coordination, admission, uncertainty and mixed-version cache alarms consciously lost. Exact web verified-runtime writer handoff guard remains; it does not replace those alarms or prove live host/native/mobile delivery. Audit3156 combines3147/3150/3152/3153/3154: deliberately retires39authored/40expanded native-chat recovery cases, eight whole suites and two orphan test-support files without equivalent replacement. Lost alarms: lost-reply unconfirmed reconciliation, skipped rows/counts and missed-frame repair, unknown/pending outcome and omitted-failure-list compatibility, uncertain history after dismissal, retry/refusal/dismiss lifecycle, hidden/consumed picker ownership, result-tree keyboard focus/disclosure and all-skipped retirement; unconfirmed-over-conflict guidance and failed-chat changes despite older host timestamps; nearest-listed ancestor/cyclic forest shape, descendant membership, host ordering/missing-host local fallback; skipped/readiness/admission counts, provisional skip/progress monotonicity, early per-chat verdicts with batch pending protection, older-host waiting, start-slot/delivery distinction, retry-over-failure and unknown-after-withdrawal attention; remote snooze/reconnect/reoffer, unseen mixed summary through open/close, watched completion retirement, new success beside old failure, failed-reread mixed-result preservation, filter/collapse completion resets, retry summary replacement and current-offer/history selection; cross-host workspace identity, rendered cyclic reachability, nested tri-state/toggle propagation, project eligibility isolation and collapse preserving selection. Exact fallback-list completion barrier, batched verdict/cleanup retention, stale-read versus dismissal publication race, and requested-but-never-rendered finished-run retirement remain; they do not replace retired alarms. Audit3146 combines source reviews3132/3133/3135/3138/3143: intentionally retire20authored/31expanded cases without equivalent replacement. Provider-session losses: structured-native terminal-resume exclusion, metadata-less completed identity, new-turn completion clearing, Pi provider-only/periodic/manual promotion, changed-transcript launch-config isolation, Pi/omp/prime-agent completed-session remote/manual-shutdown promotion, and quit/done precedence over heartbeat. Side-thread/question losses: finished-pane acquisition, hidden title/recap states, local/relay/relay-done conversation takeover with prompt/session/child resets, plain-message abandonment, compaction/session replacement and completion resets. Codex startup losses: incoming-owner cached child replacement, old-relay foreign live-session correction, completed foreign-root turn-fact permutations. Transcript losses: real temporary-JSONL partial sibling/final-child completion, unlabelled child attribution, compact cached replay preservation and100/1000completed-child roster retention/release. Compiler-ratchet losses: valid-line uncompiled-list parser grammar examples and injected-existence stale-path filtering; these did not exercise actual filesystem canonicalization or build exclusion. These are real lifecycle, ownership, replay, liveness and retention alarms, including recent#40246 regressions, deliberately lost. Retained conditional record replacement, clockless root/SSH owner isolation, persisted main-thread fork rejection, partial/final question-answer lifetime, cached-roster/missing-ID/live HTTP/durable startup boundaries and restarted-relay refusal/acceptance do not replace those losses. No native/SSH/WSL execution or equivalent coverage is claimed. Audit3128 scoped coverage reduction: Audit3121 removes VoiceDictationLanguageSetting.test.tsx (Spanish-to-es callback and unsupported-model Korean option presence) and voice-speech-model-rows.test.ts (provider/language-order/retired-on-disk list policy); these real narrow alarms are deliberately retired without replacement. VoiceSpeechModelSection per-model concurrent deletion remains unchanged. Audit3122 removes the direct absolute/parent-segment sparse-directory exception-type sample and the five-row IPC sparse-preset error-code/non-save table (two authored/six expanded cases). Those real typed-validation and IPC refusal/error-code alarms are deliberately retired. Keep both real symlink/junction floating-directory trust cases and the minimal RPC structured validation-reason serialization case. The RPC case does not replace IPC save/refusal behavior, typed normalization for both path inputs, actual Git sparse checkout or rendered localization. No equivalent replacement or fresh test/runtime/platform/remote/performance validation is claimed. Audit3124 removes ExperimentalPane.test.tsx (ordinary Pet switch callback), WorkspaceDirectorySetting.test.tsx (padded absolute saved-path normalization/no-write blur), and repository-search.perf.test.ts (navigation/selected-pane builder-call policy, fixture cardinality/nonempty entries and renamed project keyword inclusion). These real narrow alarms are retired without replacement; RepositoryPane.search.test.tsx search-to-sparse-editor request remains unchanged. Audit3129: resolver Windows case-insensitive and POSIX case-sensitive configured-env composition plus mocked-base launch-preflight Windows composition are intentionally no longer checked by the two deleted suites. No equivalent coverage claimed. Keep runtime-structured-agent-host-env.test.ts unchanged: configured Windows Claude-home account identity and host-account precedence remain checked. Audit3114 incorporates source3101: retire three structured Claude child-environment wrapper cases covering inherited stamp isolation/default and explicit entrypoint, Windows SDK-key canonicalization/default/duplicate-key order, and configured lookup/final environment/config-dir conjunction. Keep direct auth/session sanitation and Windows-versus-Linux overlay checks, actual executable lookup from supplied inherited PATH, native Windows child environment delivery, and stale option-mutation fencing. These are not equivalent replacements for the retired wrapper alarms. No fresh test/runtime, real login-shell probe, Claude SDK startup, remote/mixed-version, UI or performance result is claimed. Audit3114 incorporates source3105: retire 17 authored/20 expanded daemon launch-note cases, including the entire two-case SessionLaunchNote suite. Deliberately lose split-marker carry across same-token re-arm, stale-token retirement refusal, foreground tri-state and serial settlement, omitted-note/no-incarnation mixed-version policy, sticky retirement, first-incarnation/replacement launch preservation and held-launch precedence. Keep only the unchanged unresolved foreground-read race against a later finished attach. Supplied notes/foreground and runtime calls do not establish actual daemon/main restart, SSH, native Windows observation, mobile UI, equivalent replacement or fresh runtime/performance validation. Audit3114 incorporates source3109: retire six authored/35 expanded pricing cases: 21 accepted model-name examples, 10 unsupported/future-model fail-closed examples, malformed TTL clamp, unknown-model estimate refusal, flat-model long-context disregard and oversized long-context clamp. Keep mixed five-minute/one-hour write allocation and short/all-long/mixed long-context allocation with original fixed oracles. Real parser/refusal/bounds alarms are knowingly lost without equivalent replacement; retained tests do not validate provider rates, actual billing or request threshold classification. Preserve the archived usage-scan-append source-freeze receipt without transferring historical execution/performance credit. No fresh runtime result is claimed. Audit3108 source-only reduction (3094/3095/3100): retire 27 authored/30 expanded cases, including complete markdown view-state, file-preview link-open and CLI agent-server-route suites, without replacement. Deliberate losses include preview visibility/reference lifetime and same-path owners; SSH stat, directory/missing-target, explicit-null owner, nonmarkdown line/column, local URI routing, remote-to-client guard and same-file reuse; document-preview source-owner/folder/reuse routing, stable grant location and outside-workspace POSIX/Windows request projection; and verified remote CLI send/check refusal, suggested --on argv/copy, shell no-probe bypass, unverified-launch admission and older-peer refusal. Retain two markdown source-runtime/qualified-reveal alarms, one stale grant-rejection fence and two remote read/mutation evidence policies, with original callbacks. Final last-wins reveal did not prove transient cancellation; CLI prerequisite did not prove no real send, and envelope tests do not execute server refusal. No fresh runtime, rendered UI, actual file/SSH/paired transport, authorization, mixed-version or performance result is claimed. Audit3096 source-only reduction (3087/3088): retire 69 authored/76 expanded cases, including complete recovery-portals and reconnect-banner suites. Intentionally lose dead/default TUI replay, generated alternate-frame style composition, reset/mode/dimension and legacy missing-mode-boundary alarms, UI notice/action/reveal policies, and isolated recovery lifecycle variants, without equivalent replacement. Retained registrations and callbacks are unchanged; headless cells are not pixels, and no fresh runtime, host, SSH, WSL, rendered-app or performance result is claimed. Audit3086 source-only reduction (3079/3080/3081): intentionally retire 93 authored/100 expanded mock-boundary cases, including the complete spawn-errors and SSH reconnect overlay suites, without replacement. Retired alarms include spawn classification/ownership, reply ceilings and renderer-write failure recovery, disconnect/detach fencing branches, authority facts, and overlay retry/visibility wiring. Retained callbacks are unchanged; no fresh execution, real PTY/SSH, rendered UI, or performance result is claimed. Module layout SSH policy: Retire the multiplexer private-clock saturation registration, the writer saturation transition-count registration and the changed-source dated writer/backpressure receipt. Retained byte delivery, lane order, fairness, settlement and cancellation cases are unvalidated by that historical receipt. No equivalent replacement, new execution, measured performance, live SSH/WSL or cross-platform proof is claimed. The unchanged WSL protocol receipt retains only its original command scope. Historical prior account (preserved verbatim): Audit2432: The broad unit command loses the isolated BranchPicker open-change notification sample. Its unique true/false callback alarm is intentionally retired; reopening/status-refresh behavior was not exercised. No equivalent replacement or fresh validation of the reduced selector is claimed. Audit2425: The broad unit command loses the workspace-copy-status supplied readError forwarding sample. It did not exercise the branch-switch blocking promised by its title. This alarm is intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2417: The broad unit command loses two ordinary clean Git cherry-pick/revert success samples and two terminal startup foreground-read work-budget samples. These unique alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2412: The broad unit command loses the whole six-case fake-React-hook scroll-anchor suite, two generic draft-retention samples, a simple new-agent order sample, a real history-publication batching-count sample, an unmounted handoff abort/timer sample and three basic WSL preview/error samples. These alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2404: The broad unit command loses the standalone share-name lookup 503 propagation suite, initial deletion placement-kind sample, direct changed-mtime stale sample, first-pass rollback existence example and abandoned-preparation directory sample. These exact alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2397 review amendment: The broad unit command loses three standalone suites, two partial-case definitions and two URL table rows across package/download/placement tests. Keep initial wrong-port authorization, modified independent-copy digest refusal and abort-after-begin cancellation dispatch. The remaining alarms are deliberately retired; no equivalent complete replacement or fresh validation of the reduced selector is claimed. Audit2393 current-parent refresh2401: Remove the basic skill-install service alias sample and original public managed-remove receiptless refusal case. Preserve the upstream request ownership suite and transaction interruption coverage. No equivalent complete replacement or fresh validation of the reduced selector is claimed. Audit2389: The broad unit command loses the missing-preview suite, plain-global destination sample and prepublished-receipt recovery example. No equivalent replacement or fresh validation of the reduced selector is claimed. Audit2385: The broad unit command loses four authored walker/staging/protocol examples (six expanded cases); no equivalent replacement or fresh validation is claimed for the reduced suite. Audit2383: The unscoped Vitest command no longer includes the removed Antigravity catalogue suite; its exact provider-root/owner example has no equivalent replacement or fresh validation claim. Audit2377/2381: The unscoped Vitest command includes the reduced bundled-skill and native-discovery suites; the eight removed backup/legacy/catalogue/symlink/SSH-builder examples have no replacement-equivalence or fresh validation claim here. Audit2133 current-parent preparation: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2095 current-parent preparation2126: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2090 (sources2088/2089): Current reduced suites intentionally retire the alarms listed in knownGaps; prior dated execution and replacement claims do not validate changed source bytes or selectors. Historical prior account (preserved verbatim): Audit2086 (sources2082/2083): Current reduced suites intentionally retire the alarms listed in knownGaps; prior dated execution and replacement claims do not validate changed source bytes or selectors. Historical prior account (preserved verbatim): Audit2076 (sources2073/2074): Intentionally retire these low-value alarms without replacement: src/main/runtime/orca-runtime-tests/terminal-handles-part-02.spec.ts: recovers a moved SSH pane through the tab it now sits in, not the one its lease froze; reports a plain expired orphan; does not report a pane whose only recent lease was superseded; does not report a pane whose only recent lease had its relay id recycled; picks the eligible orphan over a superseded predecessor that matches first; collects the same tabs the per-tab reader reports, in one sweep of the leases; reports no candidate when no lease names any of the worktree tabs. src/main/runtime/orca-runtime-tests/runtime-availability.spec.ts: starts unavailable with no authoritative window; reports the configured Windows terminal shell on status; reports floating workspace availability from settings on status; polls floating tabs with targeted PTY liveness and no repo/provider inventory; hydrates persisted tabs when the store cannot report repos; advertises browser screencast only when a renderer window is available; routes mobile Codex reset consumption through the account mutation coordinator; maps a definite pre-provider rejection into an authoritative current snapshot. Existing unrelated evidenceRuns retain their original scope; unchanged dated receipt objects do not validate changed source bytes or reduced selectors. No fresh gate execution or historical import-closure equivalence is claimed. Frozen current literal-import graph reaches these changed test bytes; unresolved local and computed edges remain debt, and current reachability is not historical execution or equivalent replacement evidence. Historical prior account (preserved verbatim): Audit2070 (sources2068/2069): Intentionally retire these low-value alarms without replacement: src/main/runtime/orca-runtime.test.ts: ordinary registration cleanup removes only await import('./orca-runtime-tests/hooks-and-hosted-review.spec'). src/main/ssh/ssh-multiplexer-transport-writer.test.ts: reports saturated epochs and their drain boundary exactly once. src/main/runtime/orca-runtime-tests/worktree-removal-archive-hook-gate.spec.ts: removes and records the waiver when the failure is explicitly overridden; removes without an override record when the hook succeeds; removes when the hook is configured but not requested; removes when no archive hook is configured; holds a desktop removal in the same repo until this one is accepted; joins a desktop removal of the same worktree accepted while this one waited. src/main/runtime/orca-runtime-tests/worktree-ps-agent-row-dismissal.spec.ts: drops the row as soon as the user dismisses it, without waiting for the PTY to exit; tells paired clients to republish on the transition and on the dismissal; rejoins a row through its %s handle after pane ownership clears. src/main/runtime/orca-runtime-tests/hooks-and-hosted-review.spec.ts: reports an error when the SSH filesystem provider is unavailable; reports an SSH orca.yaml as an error without reading any filesystem; reports ok for a local repo hook check; reads SSH issue commands as absent and drops writes without touching any filesystem; allows host integration slug helpers for SSH repos through provider-aware GitHub clients; routes runtime GitHub repo identity helpers through the selected WSL project runtime; routes runtime GitHub issue and work-item actions through the selected WSL project runtime; pins explicit origin preference on runtime open-by-number work item lookups; forwards check-details cancellation without local Git overrides. Existing unrelated evidenceRuns retain their original scope; unchanged dated receipt objects do not validate changed source bytes or reduced selectors. No fresh gate execution or historical import-closure equivalence is claimed. Frozen current literal-import graph reaches these changed test bytes; unresolved local and computed edges remain debt, and current reachability is not historical execution or equivalent replacement evidence. The historical receipt/currentCommand selecting src/main/ssh/ssh-multiplexer-transport-writer.test.ts remains historical and is not a passing result for the reduced current command. Historical prior account (preserved verbatim): Audit1931 (sources1928/1929): Delete the complete tail-wait memo suite: its sole current authored callback checks supplied fromTail/blocked field values. Retire all three broader memoization/equivalence/eviction assertion aliases; they are not backed by retained source callbacks. No scan-work budget, sustained output, physical terminal or resource measurement is assigned to this removed test. Preserve meaningful remaining selectors/assertions and unchanged dated receipts within their original scope. Reduced selectors have no fresh gate execution evidence in this metadata packet. No equivalent replacement, physical watcher/PTY/provider, live SSH/remote/mobile, rendered, cross-platform, soak or measured-budget result is claimed. Historical prior account (preserved verbatim): Audit1674 retires changed-source assertion and execution scope without equivalent replacement coverage. Existing unchanged-selector receipts remain scoped to their original sources. Historical prior-source oracle: Existing exact unchanged-selector receipts remain the only current execution evidence. Changed source selectors have no fresh execution result. Historical prior-source oracle account: The current executable slice injects main-process renderer backlog pressure, then asserts ordinary terminal-wait detection without a joined-tail allocation and with full prompt-family continuity, per-PTY and total pending-output caps, a 1,024-ID projection cap with split-remainder compaction, preserved sequenced-tail metadata, active-pending protection ahead of background trimming, exact provider-generation pause ownership, renderer exit/data ordering, and ACK-gated in-flight bounds. The negotiation seam proves every initial connection and reconnect offers V1, the same-build relay advertises V1 without launch flags, old clients remain token-free, and method-not-found peers fall back without installing source ACK publication. The joined source-intake/multiplex oracle blocks renderer or headless serialization, admits one snapshot-covered span and one trailing span, requires replacement reservation only after the authoritative sequence is known, advances upstream ACK eligibility exactly to the covered boundary after SnapshotEnd, and delivers then ACKs the trailing span through the ordinary live path without cancellation. Source-range ledger and multiplex seams additionally require cumulative byte ACK 40 then 100 for one 100-byte frame to release exact byte credit without early source settlement, admit a contiguous higher-generation recovered token while the prior token remains unsettled, and reject stale stream or source generations without releasing in-flight byte credit. Replacement reservation rolls back every earlier span on a later failure, commit requires the exact frozen transfer states, and an authoritatively reclaimed covered span rejects commit without local trim authority while rollback removes the reservation idempotently. The exit-deadline oracle publishes a source-backed desktop projection, advances a fake clock to cancellation, and requires one projection transfer, proof commit, preparation, and final exit with no provider close, retained obligation, duplicate finalization, or process-lifetime cancellation tombstone; a second controlled proof remains pending across generation close and must never publish final exit, while both paths release the renderer preparation lease exactly once. The model-migration oracle accepts span A, blocks span B's raw emulator completion, begins disconnect migration, and proves no checkpoint or reconnect attach can remain at A; releasing B advances the exact checkpoint to B and projects B once. Its fake-clock arm reaches the 10-second deadline, requires checkpoint-unavailable, one exact model reset, zero retained admission charge and timers, and no effect from late raw settlement. Its two-PTY failure arm rejects one running raw callback under an active exact migration and requires one checkpoint-unavailable result, one model reset, zero provider closes, retained sibling checkpoint and transport liveness, zero charges and timers, and an unaffected other generation; a non-migrating sibling oracle still requires generation close. The intake additionally closes 2,048 sequential provider generations into one exact range, rejects stale events across that range, and preserves an out-of-order live gap until its own close. Direct-SSH contracts additionally prove activation-response settlement before the first source frame, claim-gated projection under same-decoder-turn response/data delivery, exact early-ACK reservation through send settlement or same-token retry, recovery completion visible before lease-held frames transfers those frames only into the private quarantine and admits no output until exact checkpoint-to-recoveryEnd coverage, invalid-checkpoint restore retention through response settlement followed by fresh-token retry and one live source frame, isolated saturated-subscriber eviction with healthy owner liveness, preserved legacy-primary backpressure, one-write ownership across write(false)/drain, control selection ahead of queued ordinary PTY input with FIFO lanes and bounded fairness, liveness rebasing, failed-exit retention through late ACK or exact recovery, response-settlement cancellation authority, token-scoped exit cancellation, exact checkpoint-to-recoveryEnd continuity, stale-owner one-shot retry, no physical PTY teardown on recovery failure, exact provider-generation closure and once-only cleanup when recovery cancellation publication or proof rejects, 16 MiB-plus-1 MiB decoder caps, charged per-PTY/session retention budgets, and eight-wide isolated reattach. The live Electron perf oracle adds hidden-output floods, renderer scheduler queue depth, dropped-output-zero normal scenarios, and active key latency budgets before promotion.", "commands": [ "pnpm exec vitest run --config config/vitest.config.ts", "pnpm exec vitest run --config config/vitest.config.ts src/main/runtime/construction/orca-runtime.test.ts", @@ -9379,7 +9367,8 @@ "Audit 3256 removes these specific alarms from the broad root unit commands: skill dialog active-share selection, close and pending-share handoff; simple keyed-record deletion; marker live-region insertion, simple landing and nine baseline policy examples; General search/control navigation inventory; orphan-count cache bootstrap; seven Codex code classifications and HTTP 429 warning mapping; two skill unread-root verdict examples; peer-mail payload and conversation-ID rejection; and the GitHub organization TABLE text-field optimistic rollback/failed-envelope example. These include real behaviors; retained tests do not provide equivalent coverage for every removed scenario. Mobile losses are recorded separately and are not coverage of these root commands.", "Audit 3273 removes 14 authored declarations and 19 expanded scenarios across four whole suites and eight partial suites. Retired alarms cover saved-local cancellation/layout ownership, ambiguous-owner warning reset, folder attachment routing, VM false-capability bypass, abandoned reveal warmup cleanup and viewport claim deduplication/rearming, quiet unrelated remote-removal refusal, startup-command one-shot consumption, repository/floating recovery-ledger rows, fake-React pinned-scroll intent, split-ratio state identity/subscriber suppression and fractional change, cross-host project-group join refusal, three PR request-lifetime permutations, upstream-status preservation on error, and unresolved Git-owner refusal. These regression checks are intentionally lost under the test-value audit; retained scenarios are not equivalent replacements. Historical coverage receipts remain historical, including gate35 subscriber claims.", "Audit 3283 removes 20 authored declarations and 31 expanded scenarios, including two whole suites. Retired alarms cover PR refresh-state pruning, shared runtime subscription cleanup and store isolation, language content-change routing and older completion ownership, ordinary panel retry-timer cleanup and pending loading, four hosted-review lifetime permutations, mocked terminal creation error/order wiring, five sleep-inventory variants with pending-frame-only assertions, palette fallback/composite highlights, Windows/UNC encoded-editor input rows, mixed-repository partial failure counts, title setters and generated-title bypass/replacement, five window-close coordinator delegation/guard/finally branches, and ambiguous-old-record frame reveal. These regression checks are intentionally lost under the test-value audit; retained cases are not equivalent replacements. Prior coverage notes and receipts remain historical.", - "Audit 3292 combines adopted 3285/3287/3289/3293 removals: 40 authored declarations and 47 expanded scenarios, including whole frame-editor-view, ambiguous remote-delete-refusal, unverifiable-host subscription and editor-close cleanup suites. The previously reviewed dock-badge suite was already removed upstream in PR 40895 and receives zero new removal credit. Intentionally retired alarms include background browser selection and last-tab landing; main startup fallback, SSH project cleanup/survivor routing, exact-PR contradiction/saved-push positives, replay/sidecar rollback and wrapped remote error normalization; records/snapshot missing-diff hydration, ambiguous folder-owner delete refusal, focus no-op notifications, nested editor context-only cache check, pending broadcast-first status and ordinary four-confirmation aggregation; preview-source frontmatter pruning, approved local/runtime agent dispatch, non-GitHub legacy PR cache invalidation, stale merged-head transient-error fallback, empty-queue immediate query reply and unverified-to-concrete preflight risk. Additional intentionally retired alarms are injected host subscription/unsubscribe counts, synthetic editor reveal/draft/fallback/scoped close, ambiguous unread refusals and hidden mark/read roundtrip, immediate connect backoff/noError, positive mirrored evidence-clock renewal, supplied VM failure/success projections and git-local/folder-SSH wake permutations. Remaining temporal/ownership cases are narrower; no equivalent replacement or fresh execution is claimed." + "Audit 3292 combines adopted 3285/3287/3289/3293 removals: 40 authored declarations and 47 expanded scenarios, including whole frame-editor-view, ambiguous remote-delete-refusal, unverifiable-host subscription and editor-close cleanup suites. The previously reviewed dock-badge suite was already removed upstream in PR 40895 and receives zero new removal credit. Intentionally retired alarms include background browser selection and last-tab landing; main startup fallback, SSH project cleanup/survivor routing, exact-PR contradiction/saved-push positives, replay/sidecar rollback and wrapped remote error normalization; records/snapshot missing-diff hydration, ambiguous folder-owner delete refusal, focus no-op notifications, nested editor context-only cache check, pending broadcast-first status and ordinary four-confirmation aggregation; preview-source frontmatter pruning, approved local/runtime agent dispatch, non-GitHub legacy PR cache invalidation, stale merged-head transient-error fallback, empty-queue immediate query reply and unverified-to-concrete preflight risk. Additional intentionally retired alarms are injected host subscription/unsubscribe counts, synthetic editor reveal/draft/fallback/scoped close, ambiguous unread refusals and hidden mark/read roundtrip, immediate connect backoff/noError, positive mirrored evidence-clock renewal, supplied VM failure/success projections and git-local/folder-SSH wake permutations. Remaining temporal/ownership cases are narrower; no equivalent replacement or fresh execution is claimed.", + "Audit 3301 combines adopted source batches 3296 and 3299: retire 27 authored declarations and 36 expanded scenarios, including six whole suites. Intentionally lost alarms cover failed-verification/recovery/restart counters and mocked hosting/toast; early overlapping pane-read scheduling/count; unreadable removal listing draft guard; bulk-purge remote-qualified and raw-local guard maps; initial-snapshot blank/mode/oversize/printable/fresh-spawn callback and replay examples; fallback mobile file close and ordinary MRU; default queue overload/drain; seeded browser-page reuse and supplied missing-page URL recreation; ambiguous sleep/hibernation owner refusal and untouched bindings/origins; ordinary selection/activity/fallback priority; skip-remote success and retained hints; supplied structured-chat unsent retention and scoped removal draft eviction; caller-chat focus precedence; open/draft PR cache eviction and merged-head fallback result inventories. Retained adverse-ordering and ownership cases are narrower and do not establish equivalent replacements. No fresh runtime, native, physical provider, cross-platform, mobile or mixed-version evidence is claimed." ], "demotionRule": "Cannot promote without metric artifacts and bounded-byte assertions." }, @@ -12748,14 +12737,14 @@ "providers": ["local", "remote-runtime", "ssh"], "coveredPlatforms": ["macos", "linux"], "coveredProviders": ["local", "remote-runtime", "ssh"], - "coverageNotes": "Audit 3292 combines adopted 3285/3287/3289/3293 removals: 40 authored declarations and 47 expanded scenarios, including whole frame-editor-view, ambiguous remote-delete-refusal, unverifiable-host subscription and editor-close cleanup suites. The previously reviewed dock-badge suite was already removed upstream in PR 40895 and receives zero new removal credit. Intentionally retired alarms include background browser selection and last-tab landing; main startup fallback, SSH project cleanup/survivor routing, exact-PR contradiction/saved-push positives, replay/sidecar rollback and wrapped remote error normalization; records/snapshot missing-diff hydration, ambiguous folder-owner delete refusal, focus no-op notifications, nested editor context-only cache check, pending broadcast-first status and ordinary four-confirmation aggregation; preview-source frontmatter pruning, approved local/runtime agent dispatch, non-GitHub legacy PR cache invalidation, stale merged-head transient-error fallback, empty-queue immediate query reply and unverified-to-concrete preflight risk. Additional intentionally retired alarms are injected host subscription/unsubscribe counts, synthetic editor reveal/draft/fallback/scoped close, ambiguous unread refusals and hidden mark/read roundtrip, immediate connect backoff/noError, positive mirrored evidence-clock renewal, supplied VM failure/success projections and git-local/folder-SSH wake permutations. Remaining temporal/ownership cases are narrower; no equivalent replacement or fresh execution is claimed. Audit 3283 removes 20 authored declarations and 31 expanded scenarios, including two whole suites. Retired alarms cover PR refresh-state pruning, shared runtime subscription cleanup and store isolation, language content-change routing and older completion ownership, ordinary panel retry-timer cleanup and pending loading, four hosted-review lifetime permutations, mocked terminal creation error/order wiring, five sleep-inventory variants with pending-frame-only assertions, palette fallback/composite highlights, Windows/UNC encoded-editor input rows, mixed-repository partial failure counts, title setters and generated-title bypass/replacement, five window-close coordinator delegation/guard/finally branches, and ambiguous-old-record frame reveal. These regression checks are intentionally lost under the test-value audit; retained cases are not equivalent replacements. Prior coverage notes and receipts remain historical. Audit 3273 removes 14 authored declarations and 19 expanded scenarios across four whole suites and eight partial suites. Retired alarms cover saved-local cancellation/layout ownership, ambiguous-owner warning reset, folder attachment routing, VM false-capability bypass, abandoned reveal warmup cleanup and viewport claim deduplication/rearming, quiet unrelated remote-removal refusal, startup-command one-shot consumption, repository/floating recovery-ledger rows, fake-React pinned-scroll intent, split-ratio state identity/subscriber suppression and fractional change, cross-host project-group join refusal, three PR request-lifetime permutations, upstream-status preservation on error, and unresolved Git-owner refusal. These regression checks are intentionally lost under the test-value audit; retained scenarios are not equivalent replacements. Historical coverage receipts remain historical, including gate35 subscriber claims. Audit 3256 removes these specific alarms from the broad root unit commands: skill dialog active-share selection, close and pending-share handoff; simple keyed-record deletion; marker live-region insertion, simple landing and nine baseline policy examples; General search/control navigation inventory; orphan-count cache bootstrap; seven Codex code classifications and HTTP 429 warning mapping; two skill unread-root verdict examples; peer-mail payload and conversation-ID rejection; and the GitHub organization TABLE text-field optimistic rollback/failed-envelope example. These include real behaviors; retained tests do not provide equivalent coverage for every removed scenario. Mobile losses are recorded separately and are not coverage of these root commands. Audit3246 retires NewRowsMarker reveal/no-repeat and pane-scoped beforeinput checks; skill-owner option availability/count/dedup/order; six styled Input/Textarea IME forwarding rows; the static Codex/OpenCode smart-key inventory; tab-map AST ratchet diagnostic fixtures; child-roster work-budget and retained-aggregate alarms; malformed persisted floating-cwd fallback/no-crash/empty exact-root checks; the unanswered-host empty-list discriminator; the direct invalidated-cache commit-false assertion; one redundant digit-keyup IME row; cached non-supported Claude title-generator rows; and the duplicate late naming-result singleton. These root broad commands lose those specific alarms without equivalent replacement. Distinct retained owner/state checks have their own bounded claims; the real scheduler still rejects stale response data, while the direct false-return alarm is retired. Audit3231 retires supported-host restore-pane key mapping, closed/open creation-sidebar toggle visibility, unrelated scope-error/null classification and quick-submit reveal/no-create checks. These broad commands lose those real narrow alarms; no replacement coverage is claimed. Audit3219 removes the synthetic Cmd+J extra-source suite; this broad command no longer checks its match/tie placement and selection, announced count, empty-query cap, or workspace hiding with retained recent tabs. No replacement coverage is claimed. Audit3209 composes approved sources3202/3206: deliberately retires seven authored/expanded cases in four whole suites without equivalent replacement. Work-item queries lose real GitHub/GitLab oversized ASCII secret-prefix empty-query and whitespace-before-trim refusal alarms; inputs share the imported size bound and exercise only its fast length branch, with no multibyte or actual provider/exposure guarantee. Skill sharing loses complete/partial managed-bundle and destination-ambiguity association checks plus three negative origin/path/scheme admission examples; these do not establish uploaded contents, arbitrary-URL fetching, authorization or execution. Retain exact originless-project direct-link fallback, cloud-delete confirmation, bundled-target repair/owner isolation and explicit Windows-host preference over stale WSL suites. Rejected3201 runtime-preference removal is excluded. No real cloud/network/host/disk, mobile or mixed-version execution validation is claimed. Audit3200 composes approved source3194: deliberately retires thirteen authored registrations/twenty-seven expanded cases in six whole automation host/list policy suites without equivalent replacement. Real RPC category/retryability and wrapped-timeout recognition, unscoped-failure/scoped-success health evidence precedence, exact-ID create selectors and per-run workspace omission, paired-web local/SSH/absent host catalog routing, incompatible/removed/unhydrated/offline execution health, runtime-before-nested-SSH recovery dispatch, and no-owned-focus/successor/foreign-list focus policy alarms are consciously lost. Retain exact20line orphan allow/refuse/precondition and exact90line cross-host same-ID search suites. No retry-timer/fence lifecycle, actual reconnect/network/write delivery, native focus, mobile/mixed-version runtime or disk persistence coverage is claimed. Audit3191 combines approved source3182/3187/3188: deliberately retires thirteen authored Vitest registrations and fifteen expanded cases, including five whole suites, without equivalent replacement. Attachment intake loses real portal/native-capture terminal interception and unowned-container refusal, immediate child-only committed availability/claim-ref negotiation and delivery, and direct-target over stable focused/background composer routing through disable/re-enable/remount and independent question focus. Exact destination/cache/draft and final-stat owner/workspace/File-release suites remain; they do not replace Surface recipient routing. Automation authoring loses destination runtime catalog membership, local/direct-SSH exclusion of paired-runtime repos, unknown-runtime empty catalog, logical project/host/setup/repo/path context payload, and missing/nonready setup refusal; these were genuine direct helper alarms, while exact schedule transformation, legacy schedule and setup-decision suites remain. Agent picker loses setup-chat/terminal/missing-installer/unsupported-or-unknown-host row projection samples and the ordinary unsearched menu variant; the entire original26-line resume recipe suite remains, including reported bypass versus default/absent permission modes, as does the exact search-result menu callback with its fixtures, model/effort commits and staged Arguments reopen outcome. Rejected predecessor3180 full recipe deletion is excluded. No actual native drag/cursor/focus/IME, upload bytes or disk/restart persistence, full automation save/scheduler/runtime transport, real resume-process flags/environment delivery, or native menu/rendered layout validation is claimed. Audit3178 combines source3169/3170/3175: deliberately retires eight authored units (six Vitest cases and two imperative custom relay scenarios), including two whole suites, without equivalent replacement. Voice Section loses per-model pending-delete isolation across interleaved A/B completion and the two-success refresh-call alarm; exact VoicePane delayed key-clear/newer enabled-toggle merge remains and does not replace row deletion coverage. Speech loses dedicated rating-scale/inclusive-ceiling, unsupported-versus-unmeasured, explicit/system-language precedence/locale alias, accuracy versus fast named/default/best-measured selection, and unmeasured/no-match examples; exact offered-user-pick versus retired-selection case and its fixture remain. Relay loses legacy ping-delivery count/liveness sampled before the silence deadline and grouped malformed Bearer/host-ID 401/429 routing checks; twelve real Worker/DurableObject/shipped-client scenarios remain, not equivalent replacement for those narrow alarms. Six prior speech cases are not all deleted: approved successor3175 keeps the original user-choice case. No actual credential/file persistence, native/GPU/engine/download delivery, production assignment policy or deployed-runtime validation is claimed by this reduction. Audit3165 combines source3160/3162: deliberately retires six authored/expanded cases across three whole suites without equivalent replacement. Launch/status losses: observed React-render pending/resuming coordination across settings and deferred offer read; stale-offer reread suppressing dialog reopen; held-local-chat recovery visibility with new-chat preferences off; disabled-local admission avoiding offer RPC despite an injected but unconsumed paired-tab fixture; and run-only lost-reply uncertainty reachability until direct viewed-run retirement. Launch probe does not prove arbitrary synchronous-store atomicity, the paired fixture is not remote runtime enrollment, and the status case directly marks viewed state rather than rendering the summary. Crew-hook losses: old-host method_not_found cache persists across party changes but is released by independently supplied connection generation/verified pairing status or pairing revision, with actual frame publication and teardown. These are real narrow coordination, admission, uncertainty and mixed-version cache alarms consciously lost. Exact web verified-runtime writer handoff guard remains; it does not replace those alarms or prove live host/native/mobile delivery. Audit3156 combines3147/3150/3152/3153/3154: deliberately retires39authored/40expanded native-chat recovery cases, eight whole suites and two orphan test-support files without equivalent replacement. Lost alarms: lost-reply unconfirmed reconciliation, skipped rows/counts and missed-frame repair, unknown/pending outcome and omitted-failure-list compatibility, uncertain history after dismissal, retry/refusal/dismiss lifecycle, hidden/consumed picker ownership, result-tree keyboard focus/disclosure and all-skipped retirement; unconfirmed-over-conflict guidance and failed-chat changes despite older host timestamps; nearest-listed ancestor/cyclic forest shape, descendant membership, host ordering/missing-host local fallback; skipped/readiness/admission counts, provisional skip/progress monotonicity, early per-chat verdicts with batch pending protection, older-host waiting, start-slot/delivery distinction, retry-over-failure and unknown-after-withdrawal attention; remote snooze/reconnect/reoffer, unseen mixed summary through open/close, watched completion retirement, new success beside old failure, failed-reread mixed-result preservation, filter/collapse completion resets, retry summary replacement and current-offer/history selection; cross-host workspace identity, rendered cyclic reachability, nested tri-state/toggle propagation, project eligibility isolation and collapse preserving selection. Exact fallback-list completion barrier, batched verdict/cleanup retention, stale-read versus dismissal publication race, and requested-but-never-rendered finished-run retirement remain; they do not replace retired alarms. Audit3146 combines source reviews3132/3133/3135/3138/3143: intentionally retire20authored/31expanded cases without equivalent replacement. Provider-session losses: structured-native terminal-resume exclusion, metadata-less completed identity, new-turn completion clearing, Pi provider-only/periodic/manual promotion, changed-transcript launch-config isolation, Pi/omp/prime-agent completed-session remote/manual-shutdown promotion, and quit/done precedence over heartbeat. Side-thread/question losses: finished-pane acquisition, hidden title/recap states, local/relay/relay-done conversation takeover with prompt/session/child resets, plain-message abandonment, compaction/session replacement and completion resets. Codex startup losses: incoming-owner cached child replacement, old-relay foreign live-session correction, completed foreign-root turn-fact permutations. Transcript losses: real temporary-JSONL partial sibling/final-child completion, unlabelled child attribution, compact cached replay preservation and100/1000completed-child roster retention/release. Compiler-ratchet losses: valid-line uncompiled-list parser grammar examples and injected-existence stale-path filtering; these did not exercise actual filesystem canonicalization or build exclusion. These are real lifecycle, ownership, replay, liveness and retention alarms, including recent#40246 regressions, deliberately lost. Retained conditional record replacement, clockless root/SSH owner isolation, persisted main-thread fork rejection, partial/final question-answer lifetime, cached-roster/missing-ID/live HTTP/durable startup boundaries and restarted-relay refusal/acceptance do not replace those losses. No native/SSH/WSL execution or equivalent coverage is claimed. Audit3128 scoped coverage reduction: Audit3121 removes VoiceDictationLanguageSetting.test.tsx (Spanish-to-es callback and unsupported-model Korean option presence) and voice-speech-model-rows.test.ts (provider/language-order/retired-on-disk list policy); these real narrow alarms are deliberately retired without replacement. VoiceSpeechModelSection per-model concurrent deletion remains unchanged. Audit3122 removes the direct absolute/parent-segment sparse-directory exception-type sample and the five-row IPC sparse-preset error-code/non-save table (two authored/six expanded cases). Those real typed-validation and IPC refusal/error-code alarms are deliberately retired. Keep both real symlink/junction floating-directory trust cases and the minimal RPC structured validation-reason serialization case. The RPC case does not replace IPC save/refusal behavior, typed normalization for both path inputs, actual Git sparse checkout or rendered localization. No equivalent replacement or fresh test/runtime/platform/remote/performance validation is claimed. Audit3124 removes ExperimentalPane.test.tsx (ordinary Pet switch callback), WorkspaceDirectorySetting.test.tsx (padded absolute saved-path normalization/no-write blur), and repository-search.perf.test.ts (navigation/selected-pane builder-call policy, fixture cardinality/nonempty entries and renamed project keyword inclusion). These real narrow alarms are retired without replacement; RepositoryPane.search.test.tsx search-to-sparse-editor request remains unchanged. Audit3129: resolver Windows case-insensitive and POSIX case-sensitive configured-env composition plus mocked-base launch-preflight Windows composition are intentionally no longer checked by the two deleted suites. No equivalent coverage claimed. Keep runtime-structured-agent-host-env.test.ts unchanged: configured Windows Claude-home account identity and host-account precedence remain checked. Audit3114 incorporates source3101: retire three structured Claude child-environment wrapper cases covering inherited stamp isolation/default and explicit entrypoint, Windows SDK-key canonicalization/default/duplicate-key order, and configured lookup/final environment/config-dir conjunction. Keep direct auth/session sanitation and Windows-versus-Linux overlay checks, actual executable lookup from supplied inherited PATH, native Windows child environment delivery, and stale option-mutation fencing. These are not equivalent replacements for the retired wrapper alarms. No fresh test/runtime, real login-shell probe, Claude SDK startup, remote/mixed-version, UI or performance result is claimed. Audit3114 incorporates source3105: retire 17 authored/20 expanded daemon launch-note cases, including the entire two-case SessionLaunchNote suite. Deliberately lose split-marker carry across same-token re-arm, stale-token retirement refusal, foreground tri-state and serial settlement, omitted-note/no-incarnation mixed-version policy, sticky retirement, first-incarnation/replacement launch preservation and held-launch precedence. Keep only the unchanged unresolved foreground-read race against a later finished attach. Supplied notes/foreground and runtime calls do not establish actual daemon/main restart, SSH, native Windows observation, mobile UI, equivalent replacement or fresh runtime/performance validation. Audit3114 incorporates source3109: retire six authored/35 expanded pricing cases: 21 accepted model-name examples, 10 unsupported/future-model fail-closed examples, malformed TTL clamp, unknown-model estimate refusal, flat-model long-context disregard and oversized long-context clamp. Keep mixed five-minute/one-hour write allocation and short/all-long/mixed long-context allocation with original fixed oracles. Real parser/refusal/bounds alarms are knowingly lost without equivalent replacement; retained tests do not validate provider rates, actual billing or request threshold classification. Preserve the archived usage-scan-append source-freeze receipt without transferring historical execution/performance credit. No fresh runtime result is claimed. Audit3108 source-only reduction (3094/3095/3100): retire 27 authored/30 expanded cases, including complete markdown view-state, file-preview link-open and CLI agent-server-route suites, without replacement. Deliberate losses include preview visibility/reference lifetime and same-path owners; SSH stat, directory/missing-target, explicit-null owner, nonmarkdown line/column, local URI routing, remote-to-client guard and same-file reuse; document-preview source-owner/folder/reuse routing, stable grant location and outside-workspace POSIX/Windows request projection; and verified remote CLI send/check refusal, suggested --on argv/copy, shell no-probe bypass, unverified-launch admission and older-peer refusal. Retain two markdown source-runtime/qualified-reveal alarms, one stale grant-rejection fence and two remote read/mutation evidence policies, with original callbacks. Final last-wins reveal did not prove transient cancellation; CLI prerequisite did not prove no real send, and envelope tests do not execute server refusal. No fresh runtime, rendered UI, actual file/SSH/paired transport, authorization, mixed-version or performance result is claimed. Audit3096 source-only reduction (3087/3088): retire 69 authored/76 expanded cases, including complete recovery-portals and reconnect-banner suites. Intentionally lose dead/default TUI replay, generated alternate-frame style composition, reset/mode/dimension and legacy missing-mode-boundary alarms, UI notice/action/reveal policies, and isolated recovery lifecycle variants, without equivalent replacement. Retained registrations and callbacks are unchanged; headless cells are not pixels, and no fresh runtime, host, SSH, WSL, rendered-app or performance result is claimed. Audit3086 source-only reduction (3079/3080/3081): intentionally retire 93 authored/100 expanded mock-boundary cases, including the complete spawn-errors and SSH reconnect overlay suites, without replacement. Retired alarms include spawn classification/ownership, reply ceilings and renderer-write failure recovery, disconnect/detach fencing branches, authority facts, and overlay retry/visibility wiring. Retained callbacks are unchanged; no fresh execution, real PTY/SSH, rendered UI, or performance result is claimed. Audit2432: The broad unit command loses the isolated BranchPicker open-change notification sample. Its unique true/false callback alarm is intentionally retired; reopening/status-refresh behavior was not exercised. No equivalent replacement or fresh validation of the reduced selector is claimed. Audit2425: The broad unit command loses the workspace-copy-status supplied readError forwarding sample. It did not exercise the branch-switch blocking promised by its title. This alarm is intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2417: The broad unit command loses two ordinary clean Git cherry-pick/revert success samples and two terminal startup foreground-read work-budget samples. These unique alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2412: The broad unit command loses the whole six-case fake-React-hook scroll-anchor suite, two generic draft-retention samples, a simple new-agent order sample, a real history-publication batching-count sample, an unmounted handoff abort/timer sample and three basic WSL preview/error samples. These alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2404: The broad unit command loses the standalone share-name lookup 503 propagation suite, initial deletion placement-kind sample, direct changed-mtime stale sample, first-pass rollback existence example and abandoned-preparation directory sample. These exact alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2397 review amendment: The broad unit command loses three standalone suites, two partial-case definitions and two URL table rows across package/download/placement tests. Keep initial wrong-port authorization, modified independent-copy digest refusal and abort-after-begin cancellation dispatch. The remaining alarms are deliberately retired; no equivalent complete replacement or fresh validation of the reduced selector is claimed. Audit2393 current-parent refresh2401: Remove the basic skill-install service alias sample and original public managed-remove receiptless refusal case. Preserve the upstream request ownership suite and transaction interruption coverage. No equivalent complete replacement or fresh validation of the reduced selector is claimed. Audit2389: The broad unit command loses the missing-preview suite, plain-global destination sample and prepublished-receipt recovery example. No equivalent replacement or fresh validation of the reduced selector is claimed. Audit2385: The broad unit command loses four authored walker/staging/protocol examples (six expanded cases); no equivalent replacement or fresh validation is claimed for the reduced suite. Audit2383: The unscoped Vitest command no longer includes the removed Antigravity catalogue suite; its exact provider-root/owner example has no equivalent replacement or fresh validation claim. Audit2377/2381: The unscoped Vitest command includes the reduced bundled-skill and native-discovery suites; the eight removed backup/legacy/catalogue/symlink/SSH-builder examples have no replacement-equivalence or fresh validation claim here. Audit2133 current-parent preparation: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2095 current-parent preparation2126: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2090 (sources2088/2089): Current reduced suites intentionally retire the alarms listed in knownGaps; prior dated execution and replacement claims do not validate changed source bytes or selectors. Historical prior account (preserved verbatim): Audit2086 (sources2082/2083): Current reduced suites intentionally retire the alarms listed in knownGaps; prior dated execution and replacement claims do not validate changed source bytes or selectors. Historical prior account (preserved verbatim): Audit2076 (sources2073/2074): Intentionally retire these low-value alarms without replacement: src/main/runtime/orca-runtime-tests/terminal-handles-part-02.spec.ts: recovers a moved SSH pane through the tab it now sits in, not the one its lease froze; reports a plain expired orphan; does not report a pane whose only recent lease was superseded; does not report a pane whose only recent lease had its relay id recycled; picks the eligible orphan over a superseded predecessor that matches first; collects the same tabs the per-tab reader reports, in one sweep of the leases; reports no candidate when no lease names any of the worktree tabs. src/main/runtime/orca-runtime-tests/runtime-availability.spec.ts: starts unavailable with no authoritative window; reports the configured Windows terminal shell on status; reports floating workspace availability from settings on status; polls floating tabs with targeted PTY liveness and no repo/provider inventory; hydrates persisted tabs when the store cannot report repos; advertises browser screencast only when a renderer window is available; routes mobile Codex reset consumption through the account mutation coordinator; maps a definite pre-provider rejection into an authoritative current snapshot. Existing unrelated evidenceRuns retain their original scope; unchanged dated receipt objects do not validate changed source bytes or reduced selectors. No fresh gate execution or historical import-closure equivalence is claimed. Frozen current literal-import graph reaches these changed test bytes; unresolved local and computed edges remain debt, and current reachability is not historical execution or equivalent replacement evidence. Historical prior account (preserved verbatim): Audit2056 (sources2054/2055): Intentionally retire these low-value alarms without replacement: src/renderer/src/runtime/files/watching/runtime-file-client-watch.test.ts: delivers remote file changes to listeners for the same worktree. src/main/runtime/orca-runtime.test.ts: ordinary registration cleanup removes only await import('./orca-runtime-tests/mobile-session-tabs-part-14.spec'). src/main/runtime/orca-runtime-tests/terminal-side-effect-facts-part-03.spec.ts: arms the stale-title timer for a seeded working title; arms the Command Code scrape from the noted spawn command; prefers the tracked title over a stale renderer lastTitle in the hydration seed; writes recent output into the current runtime output map; uses a later title handler replacement with the runtime receiver; calls the current injected listener with the runtime receiver; keeps optional reconciliation lazy after its callback is removed. src/main/runtime/orca-runtime-tests/mobile-session-tabs-part-14.spec.ts: lists them, so a paired client can mirror a migrated editor; closes one by retiring it from the host session; keeps an unsaved draft unless the close is forced; shares aggregate work but leaves a replacement pending promise alone; lets a targeted refresh finish while an aggregate refresh waits; refuses a close when the store lacks %s before the guard; keeps a later missing %s on the original caught failure path. Existing unrelated evidenceRuns retain their original scope; unchanged dated receipt objects do not validate changed source bytes or reduced selectors. No fresh gate execution or historical import-closure equivalence is claimed. Exact retired assertionRefs, preserved as historical objects only: {\n \"file\": \"src/renderer/src/runtime/files/watching/runtime-file-client-watch.test.ts\",\n \"assertions\": [\n \"terminal watcher error and setup failure evict the shared entry before retrying callbacks run\",\n \"an old stream end cannot evict the replacement stream, which still delivers to its listener\",\n \"two same-worktree listeners share a synthetic subscription until the final stop unsubscribes and sends unwatch\"\n ]\n } Historical prior account (preserved verbatim): Audit1973: Delete the standalone mocked watcher cleanup suite and its entire sole-file prospective command. Retire the removed file-command transport-abort alias; preserve the independent cancellation suite and final-overflow/error/end cleanup callback, and13 unrelated receipt objects. Whole original changed dated receipts are retired, never narrowed or transferred. This metadata review claims no fresh execution, equivalent replacement, provider/PTY, live remote/mobile, rendered, cross-platform, soak or measured-budget result. Historical prior account (preserved verbatim): Audit1931 (sources1928/1929): Partial runtime files-watch suite retains controlled Windows close-event waiting, shared-client survival, late physical-exit ownership/deadline cleanup and shutdown joining. Its combined Windows close/deadline/late-exit alias remains backed by unchanged callbacks. Retire native-error-close, pre-publication setup ownership and failed-delete rearm aliases; associated delegation, failure forwarding, removal routing and recovery examples are lost. These tests inject watch/subscription seams and do not observe an actual native watcher or physical process. Preserve meaningful remaining selectors/assertions and unchanged dated receipts within their original scope. Reduced selectors have no fresh gate execution evidence in this metadata packet. No equivalent replacement, physical watcher/PTY/provider, live SSH/remote/mobile, rendered, cross-platform, soak or measured-budget result is claimed. Historical prior account (preserved verbatim): Audit1925 (sources1922/1923): Partial runtime watcher-host suite loses mocked option/event/overflow/resubscription forwarding, supplied teardown-error propagation, aborted-signal/no-call and private ten-thousand-waiter-count inventories. Retire the 10,000-caller bound and failed-recovery-subscriber-ending assertion aliases. Keep same-root owner cancellation, pre-ready replacement, held root-close join, stale-generation recovery delivery and initial failed-root ownership mappings backed by retained real-host callbacks with injected subscription/error/physical-exit promises. No actual native watcher, process termination or resource bound was observed. Preserve meaningful remaining selectors/assertions and unchanged dated receipts within their original scope. Reduced selectors have no fresh gate execution evidence in this metadata packet. No equivalent replacement, physical watcher/PTY/provider, live SSH/remote/mobile, rendered, cross-platform, soak or measured-budget result is claimed. Historical prior account (preserved verbatim): Audit1683 removes low-value test projections, mock wiring, private-state assertions, inventories and duplicate examples without equivalent replacement coverage. Per-source reviews record retained public behavior and refusal boundaries with injected/native/remote limits. Affected historical receipts are retired; gates without active current evidence are downgraded. Historical scope before this audit: Audit1645 removes low-value test projections, mock wiring, private-state assertions, inventories and duplicate examples without equivalent replacement coverage. Per-source reviews record retained public behavior and refusal boundaries with injected/native/remote limits. Affected historical receipts are retired; gates without active current evidence are downgraded. Historical scope before this audit: Audit1640 removes low-value IPC, SSH, workspace and transcript-watcher tests without equivalent replacement coverage. Per-source reviews record retained public refusal, cancellation, execution-host and real-filesystem outcomes with injected/native/remote limits. Affected historical receipts are retired; gates without active current evidence are downgraded. Historical scope before this audit: Audit1634 removes low-value IPC, filesystem and runtime projections, argument inventories and duplicate examples without equivalent replacement coverage. Per-source reviews record retained cancellation, ownership, authorization, filesystem and SQLite boundaries with injected/native/remote limits. Affected historical receipts are retired; gates without active current evidence are downgraded. Historical scope before this audit: Audit1627 removes low-value mocked daemon projections, scalar tables and duplicate terminal examples without equivalent replacement coverage. Per-source reviews record retained terminal content preservation, process ownership refusal and recovery boundaries together with injected/native/remote limits. Affected historical receipts are retired; gates without active current evidence are downgraded. Historical scope before this audit: Audit1623 removes low-value mocked daemon projections, scalar tables and duplicate terminal examples without equivalent replacement coverage. Per-source reviews record retained terminal content preservation, process ownership refusal and recovery boundaries together with injected/native/remote limits. Affected historical receipts are retired; gates without active current evidence are downgraded. Historical scope before this audit: Audit1516 removes package-electron-runtime-contract.test.mjs, a copied release-workflow platform and marker matrix. Its workflow wiring alarm is intentionally retired; no actual packaged watcher delivery was exercised and no equivalent replacement is claimed. Unaffected dated execution receipts retain their original scope; changed optional selectors have no fresh full-gate execution result. This audit removes the paired-web stopped-during-outage and late-ready direct-branch examples. The retained pre-ready cancellation, failed-unwatch retry and replay-continuity cases are not equivalent replacements for those ordering alarms. Current web-runtime-client.test.ts assertions below name only its retained pre-ready callback case; replay cases remain in their separate suite. Historical commands and results remain historical. Deterministic tests cover one shared healthy child per runtime process plus at most four bounded fault-quarantine children, native desktop, paired-runtime, and WSL snapshot processes sharing the same eight-physical-child reservation with typed serialized event-driven capacity recovery, including recursive re-wait when crash recovery reclaims an announced slot, one quarantine attempt per watch lifetime, generation-scoped cancellation, bounded termination with removable deadline waiters, replacement-crawl errors that cannot be blessed by a late readiness ack, pre-ready paired-web cancellation registered before an unbounded capacity wait, already-resolved and late physical-exit retry of a rejected paired-web teardown, physical desktop-install and local/SSH PTY teardown, stale-generation rejection, per-child stat bounds, final-overflow RPC delivery, and renderer eviction before terminal callbacks can retry. Destructive local and SSH removal fences both ID-derived and resolved-cwd terminal roots, including sibling-root/cwd combinations with reverse admission rollback, closes descendant relay watches before parent deletion, enumerates authoritative provider/cwd ownership, falls back to daemon spawn cwd before OSC 7, and keeps daemon/relay immediate shutdown pending until native exit or a bounded fail-closed error; a dead relay PID discovered during attach also settles concurrent shutdown before its stale entry is reaped, while Windows runtime watcher deadlines retain one removable physical-close waiter, treat Node's error-close path as positive physical-exit proof, and clear root ownership on late close. The relay policy test maps a standard repository's base, Git common directory, and worktree roots to one healthy supervisor, then proves a shared-child failure recovers those roots in separate quarantine supervisors with overflow and resumed events. Abortable capacity, quarantine, runtime-root, relay, SSH, and relay pre-install setup waits attach one reaction to each shared promise and explicitly remove 10,000 cancelled caller closures while one anchor remains. Built-entry macOS harnesses kill the desktop/runtime and SSH relay watcher children, then require automatic resubscription and later events while the host process and relay PTY survive. SSH bundles the child boundary beside relay.js, requires both artifacts for install completeness, and preserves registration-owned same-root cancellation. The test-value audit corrects the active renderer watch command/file reference to the existing runtime-file-client-watch.test.ts, whose three cases are retained unchanged. They observe synthetic subscription retry/fanout and unsubscribe/unwatch calls, not actual preload/main bookkeeping or physical watcher-process cleanup. The separate read/preview client suite loses forwarding, supplied-error and negative-only examples, retaining binary detection and Unicode SVG decoding. Historical evidence commands/results are unchanged. Test-value audit1293 removes src/main/providers/local-pty/local-pty-provider-session-inventory.test.ts (2 authored cases). Their isolated assertions no longer run; surviving tests are not claimed as equivalent coverage. Fresh execution against the candidate SHA is required. Audit1312 removes low-value imported specs from aggregate test drivers; old whole-driver execution receipts are archived. Retained registrations are unchanged. No equivalent replacement coverage is claimed. Audit1383: src/main/runtime/orca-runtime-tests/worktree-native-chat-setup.spec.ts reduced. Lose command-list/receipt/default/background activation matrices whose provider spawn returns canned IDs. Retained test proves actual tab allocation separation, not terminal startup. No equivalent replacement coverage is claimed. Existing exact unaffected receipts and their platform/provider/budget claims remain scoped to unchanged selectors. Changed optional selectors have no new execution result. Audit1401: src/main/runtime/orca-runtime-tests/mobile-session-tabs-duplicate-pty-repair.spec.ts removed. Loses listing-on-already-repaired-data alarm; it never established runtime repair invocation. src/main/runtime/orca-runtime-tests/mobile-session-tabs-split-agent-tab.spec.ts removed. Loses actual mobile split sibling shell versus recorded-agent resume command alarms; no equivalent coverage asserted. src/main/runtime/orca-runtime-tests/worktree-native-chat-setup.spec.ts removed. Loses separate setup/startup tab result in that manually assembled path. src/main/runtime/orca-runtime.test.ts reduced. Driver registration/import of a whole-deleted selected spec is removed; directly authored cases remain unchanged. No extra authored removal credit. No equivalent replacement coverage is claimed. Existing exact unaffected receipts remain unchanged and apply only to their unchanged selectors. Changed optional selectors have no new execution result. Audit1412: src/main/workspaces/removal/watcher-removal-gate.test.ts reduced. Loses exact removal-error compatibility with renderer predicate under shared message constants. Kept public refusal outcomes do not establish that renderer classification. No equivalent replacement coverage is claimed. Existing exact unaffected receipts remain unchanged and apply only to their unchanged selectors. Changed optional selectors have no new execution result.", + "coverageNotes": "Audit 3301 combines adopted source batches 3296 and 3299: retire 27 authored declarations and 36 expanded scenarios, including six whole suites. Intentionally lost alarms cover failed-verification/recovery/restart counters and mocked hosting/toast; early overlapping pane-read scheduling/count; unreadable removal listing draft guard; bulk-purge remote-qualified and raw-local guard maps; initial-snapshot blank/mode/oversize/printable/fresh-spawn callback and replay examples; fallback mobile file close and ordinary MRU; default queue overload/drain; seeded browser-page reuse and supplied missing-page URL recreation; ambiguous sleep/hibernation owner refusal and untouched bindings/origins; ordinary selection/activity/fallback priority; skip-remote success and retained hints; supplied structured-chat unsent retention and scoped removal draft eviction; caller-chat focus precedence; open/draft PR cache eviction and merged-head fallback result inventories. Retained adverse-ordering and ownership cases are narrower and do not establish equivalent replacements. No fresh runtime, native, physical provider, cross-platform, mobile or mixed-version evidence is claimed. Audit 3292 combines adopted 3285/3287/3289/3293 removals: 40 authored declarations and 47 expanded scenarios, including whole frame-editor-view, ambiguous remote-delete-refusal, unverifiable-host subscription and editor-close cleanup suites. The previously reviewed dock-badge suite was already removed upstream in PR 40895 and receives zero new removal credit. Intentionally retired alarms include background browser selection and last-tab landing; main startup fallback, SSH project cleanup/survivor routing, exact-PR contradiction/saved-push positives, replay/sidecar rollback and wrapped remote error normalization; records/snapshot missing-diff hydration, ambiguous folder-owner delete refusal, focus no-op notifications, nested editor context-only cache check, pending broadcast-first status and ordinary four-confirmation aggregation; preview-source frontmatter pruning, approved local/runtime agent dispatch, non-GitHub legacy PR cache invalidation, stale merged-head transient-error fallback, empty-queue immediate query reply and unverified-to-concrete preflight risk. Additional intentionally retired alarms are injected host subscription/unsubscribe counts, synthetic editor reveal/draft/fallback/scoped close, ambiguous unread refusals and hidden mark/read roundtrip, immediate connect backoff/noError, positive mirrored evidence-clock renewal, supplied VM failure/success projections and git-local/folder-SSH wake permutations. Remaining temporal/ownership cases are narrower; no equivalent replacement or fresh execution is claimed. Audit 3283 removes 20 authored declarations and 31 expanded scenarios, including two whole suites. Retired alarms cover PR refresh-state pruning, shared runtime subscription cleanup and store isolation, language content-change routing and older completion ownership, ordinary panel retry-timer cleanup and pending loading, four hosted-review lifetime permutations, mocked terminal creation error/order wiring, five sleep-inventory variants with pending-frame-only assertions, palette fallback/composite highlights, Windows/UNC encoded-editor input rows, mixed-repository partial failure counts, title setters and generated-title bypass/replacement, five window-close coordinator delegation/guard/finally branches, and ambiguous-old-record frame reveal. These regression checks are intentionally lost under the test-value audit; retained cases are not equivalent replacements. Prior coverage notes and receipts remain historical. Audit 3273 removes 14 authored declarations and 19 expanded scenarios across four whole suites and eight partial suites. Retired alarms cover saved-local cancellation/layout ownership, ambiguous-owner warning reset, folder attachment routing, VM false-capability bypass, abandoned reveal warmup cleanup and viewport claim deduplication/rearming, quiet unrelated remote-removal refusal, startup-command one-shot consumption, repository/floating recovery-ledger rows, fake-React pinned-scroll intent, split-ratio state identity/subscriber suppression and fractional change, cross-host project-group join refusal, three PR request-lifetime permutations, upstream-status preservation on error, and unresolved Git-owner refusal. These regression checks are intentionally lost under the test-value audit; retained scenarios are not equivalent replacements. Historical coverage receipts remain historical, including gate35 subscriber claims. Audit 3256 removes these specific alarms from the broad root unit commands: skill dialog active-share selection, close and pending-share handoff; simple keyed-record deletion; marker live-region insertion, simple landing and nine baseline policy examples; General search/control navigation inventory; orphan-count cache bootstrap; seven Codex code classifications and HTTP 429 warning mapping; two skill unread-root verdict examples; peer-mail payload and conversation-ID rejection; and the GitHub organization TABLE text-field optimistic rollback/failed-envelope example. These include real behaviors; retained tests do not provide equivalent coverage for every removed scenario. Mobile losses are recorded separately and are not coverage of these root commands. Audit3246 retires NewRowsMarker reveal/no-repeat and pane-scoped beforeinput checks; skill-owner option availability/count/dedup/order; six styled Input/Textarea IME forwarding rows; the static Codex/OpenCode smart-key inventory; tab-map AST ratchet diagnostic fixtures; child-roster work-budget and retained-aggregate alarms; malformed persisted floating-cwd fallback/no-crash/empty exact-root checks; the unanswered-host empty-list discriminator; the direct invalidated-cache commit-false assertion; one redundant digit-keyup IME row; cached non-supported Claude title-generator rows; and the duplicate late naming-result singleton. These root broad commands lose those specific alarms without equivalent replacement. Distinct retained owner/state checks have their own bounded claims; the real scheduler still rejects stale response data, while the direct false-return alarm is retired. Audit3231 retires supported-host restore-pane key mapping, closed/open creation-sidebar toggle visibility, unrelated scope-error/null classification and quick-submit reveal/no-create checks. These broad commands lose those real narrow alarms; no replacement coverage is claimed. Audit3219 removes the synthetic Cmd+J extra-source suite; this broad command no longer checks its match/tie placement and selection, announced count, empty-query cap, or workspace hiding with retained recent tabs. No replacement coverage is claimed. Audit3209 composes approved sources3202/3206: deliberately retires seven authored/expanded cases in four whole suites without equivalent replacement. Work-item queries lose real GitHub/GitLab oversized ASCII secret-prefix empty-query and whitespace-before-trim refusal alarms; inputs share the imported size bound and exercise only its fast length branch, with no multibyte or actual provider/exposure guarantee. Skill sharing loses complete/partial managed-bundle and destination-ambiguity association checks plus three negative origin/path/scheme admission examples; these do not establish uploaded contents, arbitrary-URL fetching, authorization or execution. Retain exact originless-project direct-link fallback, cloud-delete confirmation, bundled-target repair/owner isolation and explicit Windows-host preference over stale WSL suites. Rejected3201 runtime-preference removal is excluded. No real cloud/network/host/disk, mobile or mixed-version execution validation is claimed. Audit3200 composes approved source3194: deliberately retires thirteen authored registrations/twenty-seven expanded cases in six whole automation host/list policy suites without equivalent replacement. Real RPC category/retryability and wrapped-timeout recognition, unscoped-failure/scoped-success health evidence precedence, exact-ID create selectors and per-run workspace omission, paired-web local/SSH/absent host catalog routing, incompatible/removed/unhydrated/offline execution health, runtime-before-nested-SSH recovery dispatch, and no-owned-focus/successor/foreign-list focus policy alarms are consciously lost. Retain exact20line orphan allow/refuse/precondition and exact90line cross-host same-ID search suites. No retry-timer/fence lifecycle, actual reconnect/network/write delivery, native focus, mobile/mixed-version runtime or disk persistence coverage is claimed. Audit3191 combines approved source3182/3187/3188: deliberately retires thirteen authored Vitest registrations and fifteen expanded cases, including five whole suites, without equivalent replacement. Attachment intake loses real portal/native-capture terminal interception and unowned-container refusal, immediate child-only committed availability/claim-ref negotiation and delivery, and direct-target over stable focused/background composer routing through disable/re-enable/remount and independent question focus. Exact destination/cache/draft and final-stat owner/workspace/File-release suites remain; they do not replace Surface recipient routing. Automation authoring loses destination runtime catalog membership, local/direct-SSH exclusion of paired-runtime repos, unknown-runtime empty catalog, logical project/host/setup/repo/path context payload, and missing/nonready setup refusal; these were genuine direct helper alarms, while exact schedule transformation, legacy schedule and setup-decision suites remain. Agent picker loses setup-chat/terminal/missing-installer/unsupported-or-unknown-host row projection samples and the ordinary unsearched menu variant; the entire original26-line resume recipe suite remains, including reported bypass versus default/absent permission modes, as does the exact search-result menu callback with its fixtures, model/effort commits and staged Arguments reopen outcome. Rejected predecessor3180 full recipe deletion is excluded. No actual native drag/cursor/focus/IME, upload bytes or disk/restart persistence, full automation save/scheduler/runtime transport, real resume-process flags/environment delivery, or native menu/rendered layout validation is claimed. Audit3178 combines source3169/3170/3175: deliberately retires eight authored units (six Vitest cases and two imperative custom relay scenarios), including two whole suites, without equivalent replacement. Voice Section loses per-model pending-delete isolation across interleaved A/B completion and the two-success refresh-call alarm; exact VoicePane delayed key-clear/newer enabled-toggle merge remains and does not replace row deletion coverage. Speech loses dedicated rating-scale/inclusive-ceiling, unsupported-versus-unmeasured, explicit/system-language precedence/locale alias, accuracy versus fast named/default/best-measured selection, and unmeasured/no-match examples; exact offered-user-pick versus retired-selection case and its fixture remain. Relay loses legacy ping-delivery count/liveness sampled before the silence deadline and grouped malformed Bearer/host-ID 401/429 routing checks; twelve real Worker/DurableObject/shipped-client scenarios remain, not equivalent replacement for those narrow alarms. Six prior speech cases are not all deleted: approved successor3175 keeps the original user-choice case. No actual credential/file persistence, native/GPU/engine/download delivery, production assignment policy or deployed-runtime validation is claimed by this reduction. Audit3165 combines source3160/3162: deliberately retires six authored/expanded cases across three whole suites without equivalent replacement. Launch/status losses: observed React-render pending/resuming coordination across settings and deferred offer read; stale-offer reread suppressing dialog reopen; held-local-chat recovery visibility with new-chat preferences off; disabled-local admission avoiding offer RPC despite an injected but unconsumed paired-tab fixture; and run-only lost-reply uncertainty reachability until direct viewed-run retirement. Launch probe does not prove arbitrary synchronous-store atomicity, the paired fixture is not remote runtime enrollment, and the status case directly marks viewed state rather than rendering the summary. Crew-hook losses: old-host method_not_found cache persists across party changes but is released by independently supplied connection generation/verified pairing status or pairing revision, with actual frame publication and teardown. These are real narrow coordination, admission, uncertainty and mixed-version cache alarms consciously lost. Exact web verified-runtime writer handoff guard remains; it does not replace those alarms or prove live host/native/mobile delivery. Audit3156 combines3147/3150/3152/3153/3154: deliberately retires39authored/40expanded native-chat recovery cases, eight whole suites and two orphan test-support files without equivalent replacement. Lost alarms: lost-reply unconfirmed reconciliation, skipped rows/counts and missed-frame repair, unknown/pending outcome and omitted-failure-list compatibility, uncertain history after dismissal, retry/refusal/dismiss lifecycle, hidden/consumed picker ownership, result-tree keyboard focus/disclosure and all-skipped retirement; unconfirmed-over-conflict guidance and failed-chat changes despite older host timestamps; nearest-listed ancestor/cyclic forest shape, descendant membership, host ordering/missing-host local fallback; skipped/readiness/admission counts, provisional skip/progress monotonicity, early per-chat verdicts with batch pending protection, older-host waiting, start-slot/delivery distinction, retry-over-failure and unknown-after-withdrawal attention; remote snooze/reconnect/reoffer, unseen mixed summary through open/close, watched completion retirement, new success beside old failure, failed-reread mixed-result preservation, filter/collapse completion resets, retry summary replacement and current-offer/history selection; cross-host workspace identity, rendered cyclic reachability, nested tri-state/toggle propagation, project eligibility isolation and collapse preserving selection. Exact fallback-list completion barrier, batched verdict/cleanup retention, stale-read versus dismissal publication race, and requested-but-never-rendered finished-run retirement remain; they do not replace retired alarms. Audit3146 combines source reviews3132/3133/3135/3138/3143: intentionally retire20authored/31expanded cases without equivalent replacement. Provider-session losses: structured-native terminal-resume exclusion, metadata-less completed identity, new-turn completion clearing, Pi provider-only/periodic/manual promotion, changed-transcript launch-config isolation, Pi/omp/prime-agent completed-session remote/manual-shutdown promotion, and quit/done precedence over heartbeat. Side-thread/question losses: finished-pane acquisition, hidden title/recap states, local/relay/relay-done conversation takeover with prompt/session/child resets, plain-message abandonment, compaction/session replacement and completion resets. Codex startup losses: incoming-owner cached child replacement, old-relay foreign live-session correction, completed foreign-root turn-fact permutations. Transcript losses: real temporary-JSONL partial sibling/final-child completion, unlabelled child attribution, compact cached replay preservation and100/1000completed-child roster retention/release. Compiler-ratchet losses: valid-line uncompiled-list parser grammar examples and injected-existence stale-path filtering; these did not exercise actual filesystem canonicalization or build exclusion. These are real lifecycle, ownership, replay, liveness and retention alarms, including recent#40246 regressions, deliberately lost. Retained conditional record replacement, clockless root/SSH owner isolation, persisted main-thread fork rejection, partial/final question-answer lifetime, cached-roster/missing-ID/live HTTP/durable startup boundaries and restarted-relay refusal/acceptance do not replace those losses. No native/SSH/WSL execution or equivalent coverage is claimed. Audit3128 scoped coverage reduction: Audit3121 removes VoiceDictationLanguageSetting.test.tsx (Spanish-to-es callback and unsupported-model Korean option presence) and voice-speech-model-rows.test.ts (provider/language-order/retired-on-disk list policy); these real narrow alarms are deliberately retired without replacement. VoiceSpeechModelSection per-model concurrent deletion remains unchanged. Audit3122 removes the direct absolute/parent-segment sparse-directory exception-type sample and the five-row IPC sparse-preset error-code/non-save table (two authored/six expanded cases). Those real typed-validation and IPC refusal/error-code alarms are deliberately retired. Keep both real symlink/junction floating-directory trust cases and the minimal RPC structured validation-reason serialization case. The RPC case does not replace IPC save/refusal behavior, typed normalization for both path inputs, actual Git sparse checkout or rendered localization. No equivalent replacement or fresh test/runtime/platform/remote/performance validation is claimed. Audit3124 removes ExperimentalPane.test.tsx (ordinary Pet switch callback), WorkspaceDirectorySetting.test.tsx (padded absolute saved-path normalization/no-write blur), and repository-search.perf.test.ts (navigation/selected-pane builder-call policy, fixture cardinality/nonempty entries and renamed project keyword inclusion). These real narrow alarms are retired without replacement; RepositoryPane.search.test.tsx search-to-sparse-editor request remains unchanged. Audit3129: resolver Windows case-insensitive and POSIX case-sensitive configured-env composition plus mocked-base launch-preflight Windows composition are intentionally no longer checked by the two deleted suites. No equivalent coverage claimed. Keep runtime-structured-agent-host-env.test.ts unchanged: configured Windows Claude-home account identity and host-account precedence remain checked. Audit3114 incorporates source3101: retire three structured Claude child-environment wrapper cases covering inherited stamp isolation/default and explicit entrypoint, Windows SDK-key canonicalization/default/duplicate-key order, and configured lookup/final environment/config-dir conjunction. Keep direct auth/session sanitation and Windows-versus-Linux overlay checks, actual executable lookup from supplied inherited PATH, native Windows child environment delivery, and stale option-mutation fencing. These are not equivalent replacements for the retired wrapper alarms. No fresh test/runtime, real login-shell probe, Claude SDK startup, remote/mixed-version, UI or performance result is claimed. Audit3114 incorporates source3105: retire 17 authored/20 expanded daemon launch-note cases, including the entire two-case SessionLaunchNote suite. Deliberately lose split-marker carry across same-token re-arm, stale-token retirement refusal, foreground tri-state and serial settlement, omitted-note/no-incarnation mixed-version policy, sticky retirement, first-incarnation/replacement launch preservation and held-launch precedence. Keep only the unchanged unresolved foreground-read race against a later finished attach. Supplied notes/foreground and runtime calls do not establish actual daemon/main restart, SSH, native Windows observation, mobile UI, equivalent replacement or fresh runtime/performance validation. Audit3114 incorporates source3109: retire six authored/35 expanded pricing cases: 21 accepted model-name examples, 10 unsupported/future-model fail-closed examples, malformed TTL clamp, unknown-model estimate refusal, flat-model long-context disregard and oversized long-context clamp. Keep mixed five-minute/one-hour write allocation and short/all-long/mixed long-context allocation with original fixed oracles. Real parser/refusal/bounds alarms are knowingly lost without equivalent replacement; retained tests do not validate provider rates, actual billing or request threshold classification. Preserve the archived usage-scan-append source-freeze receipt without transferring historical execution/performance credit. No fresh runtime result is claimed. Audit3108 source-only reduction (3094/3095/3100): retire 27 authored/30 expanded cases, including complete markdown view-state, file-preview link-open and CLI agent-server-route suites, without replacement. Deliberate losses include preview visibility/reference lifetime and same-path owners; SSH stat, directory/missing-target, explicit-null owner, nonmarkdown line/column, local URI routing, remote-to-client guard and same-file reuse; document-preview source-owner/folder/reuse routing, stable grant location and outside-workspace POSIX/Windows request projection; and verified remote CLI send/check refusal, suggested --on argv/copy, shell no-probe bypass, unverified-launch admission and older-peer refusal. Retain two markdown source-runtime/qualified-reveal alarms, one stale grant-rejection fence and two remote read/mutation evidence policies, with original callbacks. Final last-wins reveal did not prove transient cancellation; CLI prerequisite did not prove no real send, and envelope tests do not execute server refusal. No fresh runtime, rendered UI, actual file/SSH/paired transport, authorization, mixed-version or performance result is claimed. Audit3096 source-only reduction (3087/3088): retire 69 authored/76 expanded cases, including complete recovery-portals and reconnect-banner suites. Intentionally lose dead/default TUI replay, generated alternate-frame style composition, reset/mode/dimension and legacy missing-mode-boundary alarms, UI notice/action/reveal policies, and isolated recovery lifecycle variants, without equivalent replacement. Retained registrations and callbacks are unchanged; headless cells are not pixels, and no fresh runtime, host, SSH, WSL, rendered-app or performance result is claimed. Audit3086 source-only reduction (3079/3080/3081): intentionally retire 93 authored/100 expanded mock-boundary cases, including the complete spawn-errors and SSH reconnect overlay suites, without replacement. Retired alarms include spawn classification/ownership, reply ceilings and renderer-write failure recovery, disconnect/detach fencing branches, authority facts, and overlay retry/visibility wiring. Retained callbacks are unchanged; no fresh execution, real PTY/SSH, rendered UI, or performance result is claimed. Audit2432: The broad unit command loses the isolated BranchPicker open-change notification sample. Its unique true/false callback alarm is intentionally retired; reopening/status-refresh behavior was not exercised. No equivalent replacement or fresh validation of the reduced selector is claimed. Audit2425: The broad unit command loses the workspace-copy-status supplied readError forwarding sample. It did not exercise the branch-switch blocking promised by its title. This alarm is intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2417: The broad unit command loses two ordinary clean Git cherry-pick/revert success samples and two terminal startup foreground-read work-budget samples. These unique alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2412: The broad unit command loses the whole six-case fake-React-hook scroll-anchor suite, two generic draft-retention samples, a simple new-agent order sample, a real history-publication batching-count sample, an unmounted handoff abort/timer sample and three basic WSL preview/error samples. These alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2404: The broad unit command loses the standalone share-name lookup 503 propagation suite, initial deletion placement-kind sample, direct changed-mtime stale sample, first-pass rollback existence example and abandoned-preparation directory sample. These exact alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2397 review amendment: The broad unit command loses three standalone suites, two partial-case definitions and two URL table rows across package/download/placement tests. Keep initial wrong-port authorization, modified independent-copy digest refusal and abort-after-begin cancellation dispatch. The remaining alarms are deliberately retired; no equivalent complete replacement or fresh validation of the reduced selector is claimed. Audit2393 current-parent refresh2401: Remove the basic skill-install service alias sample and original public managed-remove receiptless refusal case. Preserve the upstream request ownership suite and transaction interruption coverage. No equivalent complete replacement or fresh validation of the reduced selector is claimed. Audit2389: The broad unit command loses the missing-preview suite, plain-global destination sample and prepublished-receipt recovery example. No equivalent replacement or fresh validation of the reduced selector is claimed. Audit2385: The broad unit command loses four authored walker/staging/protocol examples (six expanded cases); no equivalent replacement or fresh validation is claimed for the reduced suite. Audit2383: The unscoped Vitest command no longer includes the removed Antigravity catalogue suite; its exact provider-root/owner example has no equivalent replacement or fresh validation claim. Audit2377/2381: The unscoped Vitest command includes the reduced bundled-skill and native-discovery suites; the eight removed backup/legacy/catalogue/symlink/SSH-builder examples have no replacement-equivalence or fresh validation claim here. Audit2133 current-parent preparation: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2095 current-parent preparation2126: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2090 (sources2088/2089): Current reduced suites intentionally retire the alarms listed in knownGaps; prior dated execution and replacement claims do not validate changed source bytes or selectors. Historical prior account (preserved verbatim): Audit2086 (sources2082/2083): Current reduced suites intentionally retire the alarms listed in knownGaps; prior dated execution and replacement claims do not validate changed source bytes or selectors. Historical prior account (preserved verbatim): Audit2076 (sources2073/2074): Intentionally retire these low-value alarms without replacement: src/main/runtime/orca-runtime-tests/terminal-handles-part-02.spec.ts: recovers a moved SSH pane through the tab it now sits in, not the one its lease froze; reports a plain expired orphan; does not report a pane whose only recent lease was superseded; does not report a pane whose only recent lease had its relay id recycled; picks the eligible orphan over a superseded predecessor that matches first; collects the same tabs the per-tab reader reports, in one sweep of the leases; reports no candidate when no lease names any of the worktree tabs. src/main/runtime/orca-runtime-tests/runtime-availability.spec.ts: starts unavailable with no authoritative window; reports the configured Windows terminal shell on status; reports floating workspace availability from settings on status; polls floating tabs with targeted PTY liveness and no repo/provider inventory; hydrates persisted tabs when the store cannot report repos; advertises browser screencast only when a renderer window is available; routes mobile Codex reset consumption through the account mutation coordinator; maps a definite pre-provider rejection into an authoritative current snapshot. Existing unrelated evidenceRuns retain their original scope; unchanged dated receipt objects do not validate changed source bytes or reduced selectors. No fresh gate execution or historical import-closure equivalence is claimed. Frozen current literal-import graph reaches these changed test bytes; unresolved local and computed edges remain debt, and current reachability is not historical execution or equivalent replacement evidence. Historical prior account (preserved verbatim): Audit2056 (sources2054/2055): Intentionally retire these low-value alarms without replacement: src/renderer/src/runtime/files/watching/runtime-file-client-watch.test.ts: delivers remote file changes to listeners for the same worktree. src/main/runtime/orca-runtime.test.ts: ordinary registration cleanup removes only await import('./orca-runtime-tests/mobile-session-tabs-part-14.spec'). src/main/runtime/orca-runtime-tests/terminal-side-effect-facts-part-03.spec.ts: arms the stale-title timer for a seeded working title; arms the Command Code scrape from the noted spawn command; prefers the tracked title over a stale renderer lastTitle in the hydration seed; writes recent output into the current runtime output map; uses a later title handler replacement with the runtime receiver; calls the current injected listener with the runtime receiver; keeps optional reconciliation lazy after its callback is removed. src/main/runtime/orca-runtime-tests/mobile-session-tabs-part-14.spec.ts: lists them, so a paired client can mirror a migrated editor; closes one by retiring it from the host session; keeps an unsaved draft unless the close is forced; shares aggregate work but leaves a replacement pending promise alone; lets a targeted refresh finish while an aggregate refresh waits; refuses a close when the store lacks %s before the guard; keeps a later missing %s on the original caught failure path. Existing unrelated evidenceRuns retain their original scope; unchanged dated receipt objects do not validate changed source bytes or reduced selectors. No fresh gate execution or historical import-closure equivalence is claimed. Exact retired assertionRefs, preserved as historical objects only: {\n \"file\": \"src/renderer/src/runtime/files/watching/runtime-file-client-watch.test.ts\",\n \"assertions\": [\n \"terminal watcher error and setup failure evict the shared entry before retrying callbacks run\",\n \"an old stream end cannot evict the replacement stream, which still delivers to its listener\",\n \"two same-worktree listeners share a synthetic subscription until the final stop unsubscribes and sends unwatch\"\n ]\n } Historical prior account (preserved verbatim): Audit1973: Delete the standalone mocked watcher cleanup suite and its entire sole-file prospective command. Retire the removed file-command transport-abort alias; preserve the independent cancellation suite and final-overflow/error/end cleanup callback, and13 unrelated receipt objects. Whole original changed dated receipts are retired, never narrowed or transferred. This metadata review claims no fresh execution, equivalent replacement, provider/PTY, live remote/mobile, rendered, cross-platform, soak or measured-budget result. Historical prior account (preserved verbatim): Audit1931 (sources1928/1929): Partial runtime files-watch suite retains controlled Windows close-event waiting, shared-client survival, late physical-exit ownership/deadline cleanup and shutdown joining. Its combined Windows close/deadline/late-exit alias remains backed by unchanged callbacks. Retire native-error-close, pre-publication setup ownership and failed-delete rearm aliases; associated delegation, failure forwarding, removal routing and recovery examples are lost. These tests inject watch/subscription seams and do not observe an actual native watcher or physical process. Preserve meaningful remaining selectors/assertions and unchanged dated receipts within their original scope. Reduced selectors have no fresh gate execution evidence in this metadata packet. No equivalent replacement, physical watcher/PTY/provider, live SSH/remote/mobile, rendered, cross-platform, soak or measured-budget result is claimed. Historical prior account (preserved verbatim): Audit1925 (sources1922/1923): Partial runtime watcher-host suite loses mocked option/event/overflow/resubscription forwarding, supplied teardown-error propagation, aborted-signal/no-call and private ten-thousand-waiter-count inventories. Retire the 10,000-caller bound and failed-recovery-subscriber-ending assertion aliases. Keep same-root owner cancellation, pre-ready replacement, held root-close join, stale-generation recovery delivery and initial failed-root ownership mappings backed by retained real-host callbacks with injected subscription/error/physical-exit promises. No actual native watcher, process termination or resource bound was observed. Preserve meaningful remaining selectors/assertions and unchanged dated receipts within their original scope. Reduced selectors have no fresh gate execution evidence in this metadata packet. No equivalent replacement, physical watcher/PTY/provider, live SSH/remote/mobile, rendered, cross-platform, soak or measured-budget result is claimed. Historical prior account (preserved verbatim): Audit1683 removes low-value test projections, mock wiring, private-state assertions, inventories and duplicate examples without equivalent replacement coverage. Per-source reviews record retained public behavior and refusal boundaries with injected/native/remote limits. Affected historical receipts are retired; gates without active current evidence are downgraded. Historical scope before this audit: Audit1645 removes low-value test projections, mock wiring, private-state assertions, inventories and duplicate examples without equivalent replacement coverage. Per-source reviews record retained public behavior and refusal boundaries with injected/native/remote limits. Affected historical receipts are retired; gates without active current evidence are downgraded. Historical scope before this audit: Audit1640 removes low-value IPC, SSH, workspace and transcript-watcher tests without equivalent replacement coverage. Per-source reviews record retained public refusal, cancellation, execution-host and real-filesystem outcomes with injected/native/remote limits. Affected historical receipts are retired; gates without active current evidence are downgraded. Historical scope before this audit: Audit1634 removes low-value IPC, filesystem and runtime projections, argument inventories and duplicate examples without equivalent replacement coverage. Per-source reviews record retained cancellation, ownership, authorization, filesystem and SQLite boundaries with injected/native/remote limits. Affected historical receipts are retired; gates without active current evidence are downgraded. Historical scope before this audit: Audit1627 removes low-value mocked daemon projections, scalar tables and duplicate terminal examples without equivalent replacement coverage. Per-source reviews record retained terminal content preservation, process ownership refusal and recovery boundaries together with injected/native/remote limits. Affected historical receipts are retired; gates without active current evidence are downgraded. Historical scope before this audit: Audit1623 removes low-value mocked daemon projections, scalar tables and duplicate terminal examples without equivalent replacement coverage. Per-source reviews record retained terminal content preservation, process ownership refusal and recovery boundaries together with injected/native/remote limits. Affected historical receipts are retired; gates without active current evidence are downgraded. Historical scope before this audit: Audit1516 removes package-electron-runtime-contract.test.mjs, a copied release-workflow platform and marker matrix. Its workflow wiring alarm is intentionally retired; no actual packaged watcher delivery was exercised and no equivalent replacement is claimed. Unaffected dated execution receipts retain their original scope; changed optional selectors have no fresh full-gate execution result. This audit removes the paired-web stopped-during-outage and late-ready direct-branch examples. The retained pre-ready cancellation, failed-unwatch retry and replay-continuity cases are not equivalent replacements for those ordering alarms. Current web-runtime-client.test.ts assertions below name only its retained pre-ready callback case; replay cases remain in their separate suite. Historical commands and results remain historical. Deterministic tests cover one shared healthy child per runtime process plus at most four bounded fault-quarantine children, native desktop, paired-runtime, and WSL snapshot processes sharing the same eight-physical-child reservation with typed serialized event-driven capacity recovery, including recursive re-wait when crash recovery reclaims an announced slot, one quarantine attempt per watch lifetime, generation-scoped cancellation, bounded termination with removable deadline waiters, replacement-crawl errors that cannot be blessed by a late readiness ack, pre-ready paired-web cancellation registered before an unbounded capacity wait, already-resolved and late physical-exit retry of a rejected paired-web teardown, physical desktop-install and local/SSH PTY teardown, stale-generation rejection, per-child stat bounds, final-overflow RPC delivery, and renderer eviction before terminal callbacks can retry. Destructive local and SSH removal fences both ID-derived and resolved-cwd terminal roots, including sibling-root/cwd combinations with reverse admission rollback, closes descendant relay watches before parent deletion, enumerates authoritative provider/cwd ownership, falls back to daemon spawn cwd before OSC 7, and keeps daemon/relay immediate shutdown pending until native exit or a bounded fail-closed error; a dead relay PID discovered during attach also settles concurrent shutdown before its stale entry is reaped, while Windows runtime watcher deadlines retain one removable physical-close waiter, treat Node's error-close path as positive physical-exit proof, and clear root ownership on late close. The relay policy test maps a standard repository's base, Git common directory, and worktree roots to one healthy supervisor, then proves a shared-child failure recovers those roots in separate quarantine supervisors with overflow and resumed events. Abortable capacity, quarantine, runtime-root, relay, SSH, and relay pre-install setup waits attach one reaction to each shared promise and explicitly remove 10,000 cancelled caller closures while one anchor remains. Built-entry macOS harnesses kill the desktop/runtime and SSH relay watcher children, then require automatic resubscription and later events while the host process and relay PTY survive. SSH bundles the child boundary beside relay.js, requires both artifacts for install completeness, and preserves registration-owned same-root cancellation. The test-value audit corrects the active renderer watch command/file reference to the existing runtime-file-client-watch.test.ts, whose three cases are retained unchanged. They observe synthetic subscription retry/fanout and unsubscribe/unwatch calls, not actual preload/main bookkeeping or physical watcher-process cleanup. The separate read/preview client suite loses forwarding, supplied-error and negative-only examples, retaining binary detection and Unicode SVG decoding. Historical evidence commands/results are unchanged. Test-value audit1293 removes src/main/providers/local-pty/local-pty-provider-session-inventory.test.ts (2 authored cases). Their isolated assertions no longer run; surviving tests are not claimed as equivalent coverage. Fresh execution against the candidate SHA is required. Audit1312 removes low-value imported specs from aggregate test drivers; old whole-driver execution receipts are archived. Retained registrations are unchanged. No equivalent replacement coverage is claimed. Audit1383: src/main/runtime/orca-runtime-tests/worktree-native-chat-setup.spec.ts reduced. Lose command-list/receipt/default/background activation matrices whose provider spawn returns canned IDs. Retained test proves actual tab allocation separation, not terminal startup. No equivalent replacement coverage is claimed. Existing exact unaffected receipts and their platform/provider/budget claims remain scoped to unchanged selectors. Changed optional selectors have no new execution result. Audit1401: src/main/runtime/orca-runtime-tests/mobile-session-tabs-duplicate-pty-repair.spec.ts removed. Loses listing-on-already-repaired-data alarm; it never established runtime repair invocation. src/main/runtime/orca-runtime-tests/mobile-session-tabs-split-agent-tab.spec.ts removed. Loses actual mobile split sibling shell versus recorded-agent resume command alarms; no equivalent coverage asserted. src/main/runtime/orca-runtime-tests/worktree-native-chat-setup.spec.ts removed. Loses separate setup/startup tab result in that manually assembled path. src/main/runtime/orca-runtime.test.ts reduced. Driver registration/import of a whole-deleted selected spec is removed; directly authored cases remain unchanged. No extra authored removal credit. No equivalent replacement coverage is claimed. Existing exact unaffected receipts remain unchanged and apply only to their unchanged selectors. Changed optional selectors have no new execution result. Audit1412: src/main/workspaces/removal/watcher-removal-gate.test.ts reduced. Loses exact removal-error compatibility with renderer predicate under shared message constants. Kept public refusal outcomes do not establish that renderer classification. No equivalent replacement coverage is claimed. Existing exact unaffected receipts remain unchanged and apply only to their unchanged selectors. Changed optional selectors have no new execution result.", "motivatingLinks": [ "https://github.com/stablyai/orca/issues/5308", "https://github.com/stablyai/orca/issues/7547", "https://github.com/stablyai/orca/issues/8212" ], "invariant": "Local runtime and SSH relay roots share one watcher child per host process while healthy and use at most four quarantine children after shard failure; native desktop, paired-runtime, and direct WSL snapshot children consume the same process-wide eight-child reservation and retry transient exhaustion without permanently disabling a root. Cancellation remains owned by its child generation and settles only after acknowledgement or bounded physical exit; paired-web retains cleanup ownership and can cancel before readiness even while capacity is exhausted, retries a failed unwatch after already-resolved or late physical exit without duplicating stream termination, replacements never overlap a still-retiring generation, and aborted or timed-out callers detach immediately even while queued behind same-root relay teardown. Destructive local and SSH cleanup holds one containment-aware watcher/terminal removal fence through descendant watcher and PTY physical exit plus parent Git/filesystem deletion; daemon and relay kill requests retain ownership until the actual subprocess exit callback or an equivalent positive dead-PID proof and propagate rejected signals or a bounded failure otherwise. A crash-fused shared shard moves affected roots into the bounded quarantine pool, a second fused quarantine ends those watch lifetimes, interrupted setup emits overflow after recovery, metadata work stays bounded, and the SSH relay, PTYs, Git, and other filesystem operations never load the watcher native addon or share its fault boundary.", - "oracle": "Audit 3292 combines adopted 3285/3287/3289/3293 removals: 40 authored declarations and 47 expanded scenarios, including whole frame-editor-view, ambiguous remote-delete-refusal, unverifiable-host subscription and editor-close cleanup suites. The previously reviewed dock-badge suite was already removed upstream in PR 40895 and receives zero new removal credit. Intentionally retired alarms include background browser selection and last-tab landing; main startup fallback, SSH project cleanup/survivor routing, exact-PR contradiction/saved-push positives, replay/sidecar rollback and wrapped remote error normalization; records/snapshot missing-diff hydration, ambiguous folder-owner delete refusal, focus no-op notifications, nested editor context-only cache check, pending broadcast-first status and ordinary four-confirmation aggregation; preview-source frontmatter pruning, approved local/runtime agent dispatch, non-GitHub legacy PR cache invalidation, stale merged-head transient-error fallback, empty-queue immediate query reply and unverified-to-concrete preflight risk. Additional intentionally retired alarms are injected host subscription/unsubscribe counts, synthetic editor reveal/draft/fallback/scoped close, ambiguous unread refusals and hidden mark/read roundtrip, immediate connect backoff/noError, positive mirrored evidence-clock renewal, supplied VM failure/success projections and git-local/folder-SSH wake permutations. Remaining temporal/ownership cases are narrower; no equivalent replacement or fresh execution is claimed. Audit 3283 removes 20 authored declarations and 31 expanded scenarios, including two whole suites. Retired alarms cover PR refresh-state pruning, shared runtime subscription cleanup and store isolation, language content-change routing and older completion ownership, ordinary panel retry-timer cleanup and pending loading, four hosted-review lifetime permutations, mocked terminal creation error/order wiring, five sleep-inventory variants with pending-frame-only assertions, palette fallback/composite highlights, Windows/UNC encoded-editor input rows, mixed-repository partial failure counts, title setters and generated-title bypass/replacement, five window-close coordinator delegation/guard/finally branches, and ambiguous-old-record frame reveal. These regression checks are intentionally lost under the test-value audit; retained cases are not equivalent replacements. Prior coverage notes and receipts remain historical. Audit 3273 removes 14 authored declarations and 19 expanded scenarios across four whole suites and eight partial suites. Retired alarms cover saved-local cancellation/layout ownership, ambiguous-owner warning reset, folder attachment routing, VM false-capability bypass, abandoned reveal warmup cleanup and viewport claim deduplication/rearming, quiet unrelated remote-removal refusal, startup-command one-shot consumption, repository/floating recovery-ledger rows, fake-React pinned-scroll intent, split-ratio state identity/subscriber suppression and fractional change, cross-host project-group join refusal, three PR request-lifetime permutations, upstream-status preservation on error, and unresolved Git-owner refusal. These regression checks are intentionally lost under the test-value audit; retained scenarios are not equivalent replacements. Historical coverage receipts remain historical, including gate35 subscriber claims. Audit 3256 removes these specific alarms from the broad root unit commands: skill dialog active-share selection, close and pending-share handoff; simple keyed-record deletion; marker live-region insertion, simple landing and nine baseline policy examples; General search/control navigation inventory; orphan-count cache bootstrap; seven Codex code classifications and HTTP 429 warning mapping; two skill unread-root verdict examples; peer-mail payload and conversation-ID rejection; and the GitHub organization TABLE text-field optimistic rollback/failed-envelope example. These include real behaviors; retained tests do not provide equivalent coverage for every removed scenario. Mobile losses are recorded separately and are not coverage of these root commands. Audit3246 retires NewRowsMarker reveal/no-repeat and pane-scoped beforeinput checks; skill-owner option availability/count/dedup/order; six styled Input/Textarea IME forwarding rows; the static Codex/OpenCode smart-key inventory; tab-map AST ratchet diagnostic fixtures; child-roster work-budget and retained-aggregate alarms; malformed persisted floating-cwd fallback/no-crash/empty exact-root checks; the unanswered-host empty-list discriminator; the direct invalidated-cache commit-false assertion; one redundant digit-keyup IME row; cached non-supported Claude title-generator rows; and the duplicate late naming-result singleton. These root broad commands lose those specific alarms without equivalent replacement. Distinct retained owner/state checks have their own bounded claims; the real scheduler still rejects stale response data, while the direct false-return alarm is retired. Audit3231 retires supported-host restore-pane key mapping, closed/open creation-sidebar toggle visibility, unrelated scope-error/null classification and quick-submit reveal/no-create checks. These broad commands lose those real narrow alarms; no replacement coverage is claimed. Audit3219 removes the synthetic Cmd+J extra-source suite; this broad command no longer checks its match/tie placement and selection, announced count, empty-query cap, or workspace hiding with retained recent tabs. No replacement coverage is claimed. Audit3209 composes approved sources3202/3206: deliberately retires seven authored/expanded cases in four whole suites without equivalent replacement. Work-item queries lose real GitHub/GitLab oversized ASCII secret-prefix empty-query and whitespace-before-trim refusal alarms; inputs share the imported size bound and exercise only its fast length branch, with no multibyte or actual provider/exposure guarantee. Skill sharing loses complete/partial managed-bundle and destination-ambiguity association checks plus three negative origin/path/scheme admission examples; these do not establish uploaded contents, arbitrary-URL fetching, authorization or execution. Retain exact originless-project direct-link fallback, cloud-delete confirmation, bundled-target repair/owner isolation and explicit Windows-host preference over stale WSL suites. Rejected3201 runtime-preference removal is excluded. No real cloud/network/host/disk, mobile or mixed-version execution validation is claimed. Audit3200 composes approved source3194: deliberately retires thirteen authored registrations/twenty-seven expanded cases in six whole automation host/list policy suites without equivalent replacement. Real RPC category/retryability and wrapped-timeout recognition, unscoped-failure/scoped-success health evidence precedence, exact-ID create selectors and per-run workspace omission, paired-web local/SSH/absent host catalog routing, incompatible/removed/unhydrated/offline execution health, runtime-before-nested-SSH recovery dispatch, and no-owned-focus/successor/foreign-list focus policy alarms are consciously lost. Retain exact20line orphan allow/refuse/precondition and exact90line cross-host same-ID search suites. No retry-timer/fence lifecycle, actual reconnect/network/write delivery, native focus, mobile/mixed-version runtime or disk persistence coverage is claimed. Audit3191 combines approved source3182/3187/3188: deliberately retires thirteen authored Vitest registrations and fifteen expanded cases, including five whole suites, without equivalent replacement. Attachment intake loses real portal/native-capture terminal interception and unowned-container refusal, immediate child-only committed availability/claim-ref negotiation and delivery, and direct-target over stable focused/background composer routing through disable/re-enable/remount and independent question focus. Exact destination/cache/draft and final-stat owner/workspace/File-release suites remain; they do not replace Surface recipient routing. Automation authoring loses destination runtime catalog membership, local/direct-SSH exclusion of paired-runtime repos, unknown-runtime empty catalog, logical project/host/setup/repo/path context payload, and missing/nonready setup refusal; these were genuine direct helper alarms, while exact schedule transformation, legacy schedule and setup-decision suites remain. Agent picker loses setup-chat/terminal/missing-installer/unsupported-or-unknown-host row projection samples and the ordinary unsearched menu variant; the entire original26-line resume recipe suite remains, including reported bypass versus default/absent permission modes, as does the exact search-result menu callback with its fixtures, model/effort commits and staged Arguments reopen outcome. Rejected predecessor3180 full recipe deletion is excluded. No actual native drag/cursor/focus/IME, upload bytes or disk/restart persistence, full automation save/scheduler/runtime transport, real resume-process flags/environment delivery, or native menu/rendered layout validation is claimed. Audit3178 combines source3169/3170/3175: deliberately retires eight authored units (six Vitest cases and two imperative custom relay scenarios), including two whole suites, without equivalent replacement. Voice Section loses per-model pending-delete isolation across interleaved A/B completion and the two-success refresh-call alarm; exact VoicePane delayed key-clear/newer enabled-toggle merge remains and does not replace row deletion coverage. Speech loses dedicated rating-scale/inclusive-ceiling, unsupported-versus-unmeasured, explicit/system-language precedence/locale alias, accuracy versus fast named/default/best-measured selection, and unmeasured/no-match examples; exact offered-user-pick versus retired-selection case and its fixture remain. Relay loses legacy ping-delivery count/liveness sampled before the silence deadline and grouped malformed Bearer/host-ID 401/429 routing checks; twelve real Worker/DurableObject/shipped-client scenarios remain, not equivalent replacement for those narrow alarms. Six prior speech cases are not all deleted: approved successor3175 keeps the original user-choice case. No actual credential/file persistence, native/GPU/engine/download delivery, production assignment policy or deployed-runtime validation is claimed by this reduction. Audit3165 combines source3160/3162: deliberately retires six authored/expanded cases across three whole suites without equivalent replacement. Launch/status losses: observed React-render pending/resuming coordination across settings and deferred offer read; stale-offer reread suppressing dialog reopen; held-local-chat recovery visibility with new-chat preferences off; disabled-local admission avoiding offer RPC despite an injected but unconsumed paired-tab fixture; and run-only lost-reply uncertainty reachability until direct viewed-run retirement. Launch probe does not prove arbitrary synchronous-store atomicity, the paired fixture is not remote runtime enrollment, and the status case directly marks viewed state rather than rendering the summary. Crew-hook losses: old-host method_not_found cache persists across party changes but is released by independently supplied connection generation/verified pairing status or pairing revision, with actual frame publication and teardown. These are real narrow coordination, admission, uncertainty and mixed-version cache alarms consciously lost. Exact web verified-runtime writer handoff guard remains; it does not replace those alarms or prove live host/native/mobile delivery. Audit3156 combines3147/3150/3152/3153/3154: deliberately retires39authored/40expanded native-chat recovery cases, eight whole suites and two orphan test-support files without equivalent replacement. Lost alarms: lost-reply unconfirmed reconciliation, skipped rows/counts and missed-frame repair, unknown/pending outcome and omitted-failure-list compatibility, uncertain history after dismissal, retry/refusal/dismiss lifecycle, hidden/consumed picker ownership, result-tree keyboard focus/disclosure and all-skipped retirement; unconfirmed-over-conflict guidance and failed-chat changes despite older host timestamps; nearest-listed ancestor/cyclic forest shape, descendant membership, host ordering/missing-host local fallback; skipped/readiness/admission counts, provisional skip/progress monotonicity, early per-chat verdicts with batch pending protection, older-host waiting, start-slot/delivery distinction, retry-over-failure and unknown-after-withdrawal attention; remote snooze/reconnect/reoffer, unseen mixed summary through open/close, watched completion retirement, new success beside old failure, failed-reread mixed-result preservation, filter/collapse completion resets, retry summary replacement and current-offer/history selection; cross-host workspace identity, rendered cyclic reachability, nested tri-state/toggle propagation, project eligibility isolation and collapse preserving selection. Exact fallback-list completion barrier, batched verdict/cleanup retention, stale-read versus dismissal publication race, and requested-but-never-rendered finished-run retirement remain; they do not replace retired alarms. Audit3146 combines source reviews3132/3133/3135/3138/3143: intentionally retire20authored/31expanded cases without equivalent replacement. Provider-session losses: structured-native terminal-resume exclusion, metadata-less completed identity, new-turn completion clearing, Pi provider-only/periodic/manual promotion, changed-transcript launch-config isolation, Pi/omp/prime-agent completed-session remote/manual-shutdown promotion, and quit/done precedence over heartbeat. Side-thread/question losses: finished-pane acquisition, hidden title/recap states, local/relay/relay-done conversation takeover with prompt/session/child resets, plain-message abandonment, compaction/session replacement and completion resets. Codex startup losses: incoming-owner cached child replacement, old-relay foreign live-session correction, completed foreign-root turn-fact permutations. Transcript losses: real temporary-JSONL partial sibling/final-child completion, unlabelled child attribution, compact cached replay preservation and100/1000completed-child roster retention/release. Compiler-ratchet losses: valid-line uncompiled-list parser grammar examples and injected-existence stale-path filtering; these did not exercise actual filesystem canonicalization or build exclusion. These are real lifecycle, ownership, replay, liveness and retention alarms, including recent#40246 regressions, deliberately lost. Retained conditional record replacement, clockless root/SSH owner isolation, persisted main-thread fork rejection, partial/final question-answer lifetime, cached-roster/missing-ID/live HTTP/durable startup boundaries and restarted-relay refusal/acceptance do not replace those losses. No native/SSH/WSL execution or equivalent coverage is claimed. Audit3128 scoped coverage reduction: Audit3121 removes VoiceDictationLanguageSetting.test.tsx (Spanish-to-es callback and unsupported-model Korean option presence) and voice-speech-model-rows.test.ts (provider/language-order/retired-on-disk list policy); these real narrow alarms are deliberately retired without replacement. VoiceSpeechModelSection per-model concurrent deletion remains unchanged. Audit3122 removes the direct absolute/parent-segment sparse-directory exception-type sample and the five-row IPC sparse-preset error-code/non-save table (two authored/six expanded cases). Those real typed-validation and IPC refusal/error-code alarms are deliberately retired. Keep both real symlink/junction floating-directory trust cases and the minimal RPC structured validation-reason serialization case. The RPC case does not replace IPC save/refusal behavior, typed normalization for both path inputs, actual Git sparse checkout or rendered localization. No equivalent replacement or fresh test/runtime/platform/remote/performance validation is claimed. Audit3124 removes ExperimentalPane.test.tsx (ordinary Pet switch callback), WorkspaceDirectorySetting.test.tsx (padded absolute saved-path normalization/no-write blur), and repository-search.perf.test.ts (navigation/selected-pane builder-call policy, fixture cardinality/nonempty entries and renamed project keyword inclusion). These real narrow alarms are retired without replacement; RepositoryPane.search.test.tsx search-to-sparse-editor request remains unchanged. Audit3129: resolver Windows case-insensitive and POSIX case-sensitive configured-env composition plus mocked-base launch-preflight Windows composition are intentionally no longer checked by the two deleted suites. No equivalent coverage claimed. Keep runtime-structured-agent-host-env.test.ts unchanged: configured Windows Claude-home account identity and host-account precedence remain checked. Audit3114 incorporates source3101: retire three structured Claude child-environment wrapper cases covering inherited stamp isolation/default and explicit entrypoint, Windows SDK-key canonicalization/default/duplicate-key order, and configured lookup/final environment/config-dir conjunction. Keep direct auth/session sanitation and Windows-versus-Linux overlay checks, actual executable lookup from supplied inherited PATH, native Windows child environment delivery, and stale option-mutation fencing. These are not equivalent replacements for the retired wrapper alarms. No fresh test/runtime, real login-shell probe, Claude SDK startup, remote/mixed-version, UI or performance result is claimed. Audit3114 incorporates source3105: retire 17 authored/20 expanded daemon launch-note cases, including the entire two-case SessionLaunchNote suite. Deliberately lose split-marker carry across same-token re-arm, stale-token retirement refusal, foreground tri-state and serial settlement, omitted-note/no-incarnation mixed-version policy, sticky retirement, first-incarnation/replacement launch preservation and held-launch precedence. Keep only the unchanged unresolved foreground-read race against a later finished attach. Supplied notes/foreground and runtime calls do not establish actual daemon/main restart, SSH, native Windows observation, mobile UI, equivalent replacement or fresh runtime/performance validation. Audit3114 incorporates source3109: retire six authored/35 expanded pricing cases: 21 accepted model-name examples, 10 unsupported/future-model fail-closed examples, malformed TTL clamp, unknown-model estimate refusal, flat-model long-context disregard and oversized long-context clamp. Keep mixed five-minute/one-hour write allocation and short/all-long/mixed long-context allocation with original fixed oracles. Real parser/refusal/bounds alarms are knowingly lost without equivalent replacement; retained tests do not validate provider rates, actual billing or request threshold classification. Preserve the archived usage-scan-append source-freeze receipt without transferring historical execution/performance credit. No fresh runtime result is claimed. Audit3108 source-only reduction (3094/3095/3100): retire 27 authored/30 expanded cases, including complete markdown view-state, file-preview link-open and CLI agent-server-route suites, without replacement. Deliberate losses include preview visibility/reference lifetime and same-path owners; SSH stat, directory/missing-target, explicit-null owner, nonmarkdown line/column, local URI routing, remote-to-client guard and same-file reuse; document-preview source-owner/folder/reuse routing, stable grant location and outside-workspace POSIX/Windows request projection; and verified remote CLI send/check refusal, suggested --on argv/copy, shell no-probe bypass, unverified-launch admission and older-peer refusal. Retain two markdown source-runtime/qualified-reveal alarms, one stale grant-rejection fence and two remote read/mutation evidence policies, with original callbacks. Final last-wins reveal did not prove transient cancellation; CLI prerequisite did not prove no real send, and envelope tests do not execute server refusal. No fresh runtime, rendered UI, actual file/SSH/paired transport, authorization, mixed-version or performance result is claimed. Audit3096 source-only reduction (3087/3088): retire 69 authored/76 expanded cases, including complete recovery-portals and reconnect-banner suites. Intentionally lose dead/default TUI replay, generated alternate-frame style composition, reset/mode/dimension and legacy missing-mode-boundary alarms, UI notice/action/reveal policies, and isolated recovery lifecycle variants, without equivalent replacement. Retained registrations and callbacks are unchanged; headless cells are not pixels, and no fresh runtime, host, SSH, WSL, rendered-app or performance result is claimed. Audit3086 source-only reduction (3079/3080/3081): intentionally retire 93 authored/100 expanded mock-boundary cases, including the complete spawn-errors and SSH reconnect overlay suites, without replacement. Retired alarms include spawn classification/ownership, reply ceilings and renderer-write failure recovery, disconnect/detach fencing branches, authority facts, and overlay retry/visibility wiring. Retained callbacks are unchanged; no fresh execution, real PTY/SSH, rendered UI, or performance result is claimed. Audit2432: The broad unit command loses the isolated BranchPicker open-change notification sample. Its unique true/false callback alarm is intentionally retired; reopening/status-refresh behavior was not exercised. No equivalent replacement or fresh validation of the reduced selector is claimed. Audit2425: The broad unit command loses the workspace-copy-status supplied readError forwarding sample. It did not exercise the branch-switch blocking promised by its title. This alarm is intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2417: The broad unit command loses two ordinary clean Git cherry-pick/revert success samples and two terminal startup foreground-read work-budget samples. These unique alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2412: The broad unit command loses the whole six-case fake-React-hook scroll-anchor suite, two generic draft-retention samples, a simple new-agent order sample, a real history-publication batching-count sample, an unmounted handoff abort/timer sample and three basic WSL preview/error samples. These alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2404: The broad unit command loses the standalone share-name lookup 503 propagation suite, initial deletion placement-kind sample, direct changed-mtime stale sample, first-pass rollback existence example and abandoned-preparation directory sample. These exact alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2397 review amendment: The broad unit command loses three standalone suites, two partial-case definitions and two URL table rows across package/download/placement tests. Keep initial wrong-port authorization, modified independent-copy digest refusal and abort-after-begin cancellation dispatch. The remaining alarms are deliberately retired; no equivalent complete replacement or fresh validation of the reduced selector is claimed. Audit2393 current-parent refresh2401: Remove the basic skill-install service alias sample and original public managed-remove receiptless refusal case. Preserve the upstream request ownership suite and transaction interruption coverage. No equivalent complete replacement or fresh validation of the reduced selector is claimed. Audit2389: The broad unit command loses the missing-preview suite, plain-global destination sample and prepublished-receipt recovery example. No equivalent replacement or fresh validation of the reduced selector is claimed. Audit2385: The broad unit command loses four authored walker/staging/protocol examples (six expanded cases); no equivalent replacement or fresh validation is claimed for the reduced suite. Audit2383: The unscoped Vitest command no longer includes the removed Antigravity catalogue suite; its exact provider-root/owner example has no equivalent replacement or fresh validation claim. Audit2377/2381: The unscoped Vitest command includes the reduced bundled-skill and native-discovery suites; the eight removed backup/legacy/catalogue/symlink/SSH-builder examples have no replacement-equivalence or fresh validation claim here. Audit2133 current-parent preparation: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2095 current-parent preparation2126: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2090 (sources2088/2089): Current reduced suites intentionally retire the alarms listed in knownGaps; prior dated execution and replacement claims do not validate changed source bytes or selectors. Historical prior account (preserved verbatim): Audit2086 (sources2082/2083): Current reduced suites intentionally retire the alarms listed in knownGaps; prior dated execution and replacement claims do not validate changed source bytes or selectors. Historical prior account (preserved verbatim): Audit2076 (sources2073/2074): Intentionally retire these low-value alarms without replacement: src/main/runtime/orca-runtime-tests/terminal-handles-part-02.spec.ts: recovers a moved SSH pane through the tab it now sits in, not the one its lease froze; reports a plain expired orphan; does not report a pane whose only recent lease was superseded; does not report a pane whose only recent lease had its relay id recycled; picks the eligible orphan over a superseded predecessor that matches first; collects the same tabs the per-tab reader reports, in one sweep of the leases; reports no candidate when no lease names any of the worktree tabs. src/main/runtime/orca-runtime-tests/runtime-availability.spec.ts: starts unavailable with no authoritative window; reports the configured Windows terminal shell on status; reports floating workspace availability from settings on status; polls floating tabs with targeted PTY liveness and no repo/provider inventory; hydrates persisted tabs when the store cannot report repos; advertises browser screencast only when a renderer window is available; routes mobile Codex reset consumption through the account mutation coordinator; maps a definite pre-provider rejection into an authoritative current snapshot. Existing unrelated evidenceRuns retain their original scope; unchanged dated receipt objects do not validate changed source bytes or reduced selectors. No fresh gate execution or historical import-closure equivalence is claimed. Frozen current literal-import graph reaches these changed test bytes; unresolved local and computed edges remain debt, and current reachability is not historical execution or equivalent replacement evidence. Historical prior account (preserved verbatim): Audit2056 (sources2054/2055): Intentionally retire these low-value alarms without replacement: src/renderer/src/runtime/files/watching/runtime-file-client-watch.test.ts: delivers remote file changes to listeners for the same worktree. src/main/runtime/orca-runtime.test.ts: ordinary registration cleanup removes only await import('./orca-runtime-tests/mobile-session-tabs-part-14.spec'). src/main/runtime/orca-runtime-tests/terminal-side-effect-facts-part-03.spec.ts: arms the stale-title timer for a seeded working title; arms the Command Code scrape from the noted spawn command; prefers the tracked title over a stale renderer lastTitle in the hydration seed; writes recent output into the current runtime output map; uses a later title handler replacement with the runtime receiver; calls the current injected listener with the runtime receiver; keeps optional reconciliation lazy after its callback is removed. src/main/runtime/orca-runtime-tests/mobile-session-tabs-part-14.spec.ts: lists them, so a paired client can mirror a migrated editor; closes one by retiring it from the host session; keeps an unsaved draft unless the close is forced; shares aggregate work but leaves a replacement pending promise alone; lets a targeted refresh finish while an aggregate refresh waits; refuses a close when the store lacks %s before the guard; keeps a later missing %s on the original caught failure path. Existing unrelated evidenceRuns retain their original scope; unchanged dated receipt objects do not validate changed source bytes or reduced selectors. No fresh gate execution or historical import-closure equivalence is claimed. Exact retired assertionRefs, preserved as historical objects only: {\n \"file\": \"src/renderer/src/runtime/files/watching/runtime-file-client-watch.test.ts\",\n \"assertions\": [\n \"terminal watcher error and setup failure evict the shared entry before retrying callbacks run\",\n \"an old stream end cannot evict the replacement stream, which still delivers to its listener\",\n \"two same-worktree listeners share a synthetic subscription until the final stop unsubscribes and sends unwatch\"\n ]\n } Historical prior account (preserved verbatim): Audit1973: Delete the standalone mocked watcher cleanup suite and its entire sole-file prospective command. Retire the removed file-command transport-abort alias; preserve the independent cancellation suite and final-overflow/error/end cleanup callback, and13 unrelated receipt objects. Whole original changed dated receipts are retired, never narrowed or transferred. This metadata review claims no fresh execution, equivalent replacement, provider/PTY, live remote/mobile, rendered, cross-platform, soak or measured-budget result. Historical prior account (preserved verbatim): Audit1931 (sources1928/1929): Partial runtime files-watch suite retains controlled Windows close-event waiting, shared-client survival, late physical-exit ownership/deadline cleanup and shutdown joining. Its combined Windows close/deadline/late-exit alias remains backed by unchanged callbacks. Retire native-error-close, pre-publication setup ownership and failed-delete rearm aliases; associated delegation, failure forwarding, removal routing and recovery examples are lost. These tests inject watch/subscription seams and do not observe an actual native watcher or physical process. Preserve meaningful remaining selectors/assertions and unchanged dated receipts within their original scope. Reduced selectors have no fresh gate execution evidence in this metadata packet. No equivalent replacement, physical watcher/PTY/provider, live SSH/remote/mobile, rendered, cross-platform, soak or measured-budget result is claimed. Historical prior account (preserved verbatim): Audit1925 (sources1922/1923): Partial runtime watcher-host suite loses mocked option/event/overflow/resubscription forwarding, supplied teardown-error propagation, aborted-signal/no-call and private ten-thousand-waiter-count inventories. Retire the 10,000-caller bound and failed-recovery-subscriber-ending assertion aliases. Keep same-root owner cancellation, pre-ready replacement, held root-close join, stale-generation recovery delivery and initial failed-root ownership mappings backed by retained real-host callbacks with injected subscription/error/physical-exit promises. No actual native watcher, process termination or resource bound was observed. Preserve meaningful remaining selectors/assertions and unchanged dated receipts within their original scope. Reduced selectors have no fresh gate execution evidence in this metadata packet. No equivalent replacement, physical watcher/PTY/provider, live SSH/remote/mobile, rendered, cross-platform, soak or measured-budget result is claimed. Historical prior account (preserved verbatim): Audit1683 retires changed-source assertion and execution scope without equivalent replacement coverage. Existing unchanged-selector receipts remain scoped to their original sources. Historical prior-source oracle: Existing exact unchanged-selector receipts remain the only current execution evidence. Changed source selectors have no fresh execution result. Historical prior-source oracle account: Existing exact unchanged-selector receipts remain the only current execution evidence. Changed source selectors have no fresh execution result. Historical prior-source oracle account: Fill the global watcher-child reservation, require native desktop, paired-runtime, and WSL setup to retain typed transient capacity and retry after one serialized release, then cancel pending desktop and paired-client watches and require no retry. Hold one live anchor while aborting 10,000 callers at the capacity, quarantine-assignment, runtime-root, relay-setup, and SSH-registration layers; require exactly one explicit waiter and one base-promise reaction to remain, then zero after settlement. Hold an old relay unsubscribe, queue one same-root setup leader and one anchor, then abort 10,000 joiners; require every cancellation to settle before teardown releases, exactly one anchor waiter, and only one later physical install. Advance the former paired-web callback deadline while capacity remains full, require cancellation ownership to stay live, publish the server token before ready, and require files.unwatch to abort setup before a later slot release can install a native root. Reject the first ready-watch unwatch with a physical-exit promise, resolve that exit later, and require a fresh physical unwatch attempt, registry release, and exactly one stream end. Fill one healthy shared child with multiple roots, map a standard SSH repository's base, Git common directory, and worktree roots to one relay supervisor, then inject IPC disconnect-before-exit, queued and active cancellation, operations during termination, kill-without-exit, repeated unkillable generations, initial and recovery timeouts, and shard failure. During local and SSH deletion, attempt a late terminal spawn whose worktree identity and cwd name different roots, enumerate a non-prefix remote PTY by authoritative worktree ownership, withhold daemon/relay exit callbacks, make attach positively prove a concurrent-shutdown PID dead, and make the provider unavailable; require every acquired admission to roll back on rejection, dead-PID proof to settle physical exit before reaping, timeout to retain ownership, and Git/filesystem deletion never to start. Require bounded watcher process count, physical-exit settlement, healthy-root recovery, stale-generation rejection, overflow plus later events, and fail-closed destructive cleanup. Verify relay build hashes and remote install probes require both relay.js and relay-watcher.js. Launch the built relay with a real PTY and Parcel watch, kill only the watcher child, and require the same relay PID and PTY to answer before a replacement child delivers overflow and a post-crash event.", + "oracle": "Audit 3301 combines adopted source batches 3296 and 3299: retire 27 authored declarations and 36 expanded scenarios, including six whole suites. Intentionally lost alarms cover failed-verification/recovery/restart counters and mocked hosting/toast; early overlapping pane-read scheduling/count; unreadable removal listing draft guard; bulk-purge remote-qualified and raw-local guard maps; initial-snapshot blank/mode/oversize/printable/fresh-spawn callback and replay examples; fallback mobile file close and ordinary MRU; default queue overload/drain; seeded browser-page reuse and supplied missing-page URL recreation; ambiguous sleep/hibernation owner refusal and untouched bindings/origins; ordinary selection/activity/fallback priority; skip-remote success and retained hints; supplied structured-chat unsent retention and scoped removal draft eviction; caller-chat focus precedence; open/draft PR cache eviction and merged-head fallback result inventories. Retained adverse-ordering and ownership cases are narrower and do not establish equivalent replacements. No fresh runtime, native, physical provider, cross-platform, mobile or mixed-version evidence is claimed. Audit 3292 combines adopted 3285/3287/3289/3293 removals: 40 authored declarations and 47 expanded scenarios, including whole frame-editor-view, ambiguous remote-delete-refusal, unverifiable-host subscription and editor-close cleanup suites. The previously reviewed dock-badge suite was already removed upstream in PR 40895 and receives zero new removal credit. Intentionally retired alarms include background browser selection and last-tab landing; main startup fallback, SSH project cleanup/survivor routing, exact-PR contradiction/saved-push positives, replay/sidecar rollback and wrapped remote error normalization; records/snapshot missing-diff hydration, ambiguous folder-owner delete refusal, focus no-op notifications, nested editor context-only cache check, pending broadcast-first status and ordinary four-confirmation aggregation; preview-source frontmatter pruning, approved local/runtime agent dispatch, non-GitHub legacy PR cache invalidation, stale merged-head transient-error fallback, empty-queue immediate query reply and unverified-to-concrete preflight risk. Additional intentionally retired alarms are injected host subscription/unsubscribe counts, synthetic editor reveal/draft/fallback/scoped close, ambiguous unread refusals and hidden mark/read roundtrip, immediate connect backoff/noError, positive mirrored evidence-clock renewal, supplied VM failure/success projections and git-local/folder-SSH wake permutations. Remaining temporal/ownership cases are narrower; no equivalent replacement or fresh execution is claimed. Audit 3283 removes 20 authored declarations and 31 expanded scenarios, including two whole suites. Retired alarms cover PR refresh-state pruning, shared runtime subscription cleanup and store isolation, language content-change routing and older completion ownership, ordinary panel retry-timer cleanup and pending loading, four hosted-review lifetime permutations, mocked terminal creation error/order wiring, five sleep-inventory variants with pending-frame-only assertions, palette fallback/composite highlights, Windows/UNC encoded-editor input rows, mixed-repository partial failure counts, title setters and generated-title bypass/replacement, five window-close coordinator delegation/guard/finally branches, and ambiguous-old-record frame reveal. These regression checks are intentionally lost under the test-value audit; retained cases are not equivalent replacements. Prior coverage notes and receipts remain historical. Audit 3273 removes 14 authored declarations and 19 expanded scenarios across four whole suites and eight partial suites. Retired alarms cover saved-local cancellation/layout ownership, ambiguous-owner warning reset, folder attachment routing, VM false-capability bypass, abandoned reveal warmup cleanup and viewport claim deduplication/rearming, quiet unrelated remote-removal refusal, startup-command one-shot consumption, repository/floating recovery-ledger rows, fake-React pinned-scroll intent, split-ratio state identity/subscriber suppression and fractional change, cross-host project-group join refusal, three PR request-lifetime permutations, upstream-status preservation on error, and unresolved Git-owner refusal. These regression checks are intentionally lost under the test-value audit; retained scenarios are not equivalent replacements. Historical coverage receipts remain historical, including gate35 subscriber claims. Audit 3256 removes these specific alarms from the broad root unit commands: skill dialog active-share selection, close and pending-share handoff; simple keyed-record deletion; marker live-region insertion, simple landing and nine baseline policy examples; General search/control navigation inventory; orphan-count cache bootstrap; seven Codex code classifications and HTTP 429 warning mapping; two skill unread-root verdict examples; peer-mail payload and conversation-ID rejection; and the GitHub organization TABLE text-field optimistic rollback/failed-envelope example. These include real behaviors; retained tests do not provide equivalent coverage for every removed scenario. Mobile losses are recorded separately and are not coverage of these root commands. Audit3246 retires NewRowsMarker reveal/no-repeat and pane-scoped beforeinput checks; skill-owner option availability/count/dedup/order; six styled Input/Textarea IME forwarding rows; the static Codex/OpenCode smart-key inventory; tab-map AST ratchet diagnostic fixtures; child-roster work-budget and retained-aggregate alarms; malformed persisted floating-cwd fallback/no-crash/empty exact-root checks; the unanswered-host empty-list discriminator; the direct invalidated-cache commit-false assertion; one redundant digit-keyup IME row; cached non-supported Claude title-generator rows; and the duplicate late naming-result singleton. These root broad commands lose those specific alarms without equivalent replacement. Distinct retained owner/state checks have their own bounded claims; the real scheduler still rejects stale response data, while the direct false-return alarm is retired. Audit3231 retires supported-host restore-pane key mapping, closed/open creation-sidebar toggle visibility, unrelated scope-error/null classification and quick-submit reveal/no-create checks. These broad commands lose those real narrow alarms; no replacement coverage is claimed. Audit3219 removes the synthetic Cmd+J extra-source suite; this broad command no longer checks its match/tie placement and selection, announced count, empty-query cap, or workspace hiding with retained recent tabs. No replacement coverage is claimed. Audit3209 composes approved sources3202/3206: deliberately retires seven authored/expanded cases in four whole suites without equivalent replacement. Work-item queries lose real GitHub/GitLab oversized ASCII secret-prefix empty-query and whitespace-before-trim refusal alarms; inputs share the imported size bound and exercise only its fast length branch, with no multibyte or actual provider/exposure guarantee. Skill sharing loses complete/partial managed-bundle and destination-ambiguity association checks plus three negative origin/path/scheme admission examples; these do not establish uploaded contents, arbitrary-URL fetching, authorization or execution. Retain exact originless-project direct-link fallback, cloud-delete confirmation, bundled-target repair/owner isolation and explicit Windows-host preference over stale WSL suites. Rejected3201 runtime-preference removal is excluded. No real cloud/network/host/disk, mobile or mixed-version execution validation is claimed. Audit3200 composes approved source3194: deliberately retires thirteen authored registrations/twenty-seven expanded cases in six whole automation host/list policy suites without equivalent replacement. Real RPC category/retryability and wrapped-timeout recognition, unscoped-failure/scoped-success health evidence precedence, exact-ID create selectors and per-run workspace omission, paired-web local/SSH/absent host catalog routing, incompatible/removed/unhydrated/offline execution health, runtime-before-nested-SSH recovery dispatch, and no-owned-focus/successor/foreign-list focus policy alarms are consciously lost. Retain exact20line orphan allow/refuse/precondition and exact90line cross-host same-ID search suites. No retry-timer/fence lifecycle, actual reconnect/network/write delivery, native focus, mobile/mixed-version runtime or disk persistence coverage is claimed. Audit3191 combines approved source3182/3187/3188: deliberately retires thirteen authored Vitest registrations and fifteen expanded cases, including five whole suites, without equivalent replacement. Attachment intake loses real portal/native-capture terminal interception and unowned-container refusal, immediate child-only committed availability/claim-ref negotiation and delivery, and direct-target over stable focused/background composer routing through disable/re-enable/remount and independent question focus. Exact destination/cache/draft and final-stat owner/workspace/File-release suites remain; they do not replace Surface recipient routing. Automation authoring loses destination runtime catalog membership, local/direct-SSH exclusion of paired-runtime repos, unknown-runtime empty catalog, logical project/host/setup/repo/path context payload, and missing/nonready setup refusal; these were genuine direct helper alarms, while exact schedule transformation, legacy schedule and setup-decision suites remain. Agent picker loses setup-chat/terminal/missing-installer/unsupported-or-unknown-host row projection samples and the ordinary unsearched menu variant; the entire original26-line resume recipe suite remains, including reported bypass versus default/absent permission modes, as does the exact search-result menu callback with its fixtures, model/effort commits and staged Arguments reopen outcome. Rejected predecessor3180 full recipe deletion is excluded. No actual native drag/cursor/focus/IME, upload bytes or disk/restart persistence, full automation save/scheduler/runtime transport, real resume-process flags/environment delivery, or native menu/rendered layout validation is claimed. Audit3178 combines source3169/3170/3175: deliberately retires eight authored units (six Vitest cases and two imperative custom relay scenarios), including two whole suites, without equivalent replacement. Voice Section loses per-model pending-delete isolation across interleaved A/B completion and the two-success refresh-call alarm; exact VoicePane delayed key-clear/newer enabled-toggle merge remains and does not replace row deletion coverage. Speech loses dedicated rating-scale/inclusive-ceiling, unsupported-versus-unmeasured, explicit/system-language precedence/locale alias, accuracy versus fast named/default/best-measured selection, and unmeasured/no-match examples; exact offered-user-pick versus retired-selection case and its fixture remain. Relay loses legacy ping-delivery count/liveness sampled before the silence deadline and grouped malformed Bearer/host-ID 401/429 routing checks; twelve real Worker/DurableObject/shipped-client scenarios remain, not equivalent replacement for those narrow alarms. Six prior speech cases are not all deleted: approved successor3175 keeps the original user-choice case. No actual credential/file persistence, native/GPU/engine/download delivery, production assignment policy or deployed-runtime validation is claimed by this reduction. Audit3165 combines source3160/3162: deliberately retires six authored/expanded cases across three whole suites without equivalent replacement. Launch/status losses: observed React-render pending/resuming coordination across settings and deferred offer read; stale-offer reread suppressing dialog reopen; held-local-chat recovery visibility with new-chat preferences off; disabled-local admission avoiding offer RPC despite an injected but unconsumed paired-tab fixture; and run-only lost-reply uncertainty reachability until direct viewed-run retirement. Launch probe does not prove arbitrary synchronous-store atomicity, the paired fixture is not remote runtime enrollment, and the status case directly marks viewed state rather than rendering the summary. Crew-hook losses: old-host method_not_found cache persists across party changes but is released by independently supplied connection generation/verified pairing status or pairing revision, with actual frame publication and teardown. These are real narrow coordination, admission, uncertainty and mixed-version cache alarms consciously lost. Exact web verified-runtime writer handoff guard remains; it does not replace those alarms or prove live host/native/mobile delivery. Audit3156 combines3147/3150/3152/3153/3154: deliberately retires39authored/40expanded native-chat recovery cases, eight whole suites and two orphan test-support files without equivalent replacement. Lost alarms: lost-reply unconfirmed reconciliation, skipped rows/counts and missed-frame repair, unknown/pending outcome and omitted-failure-list compatibility, uncertain history after dismissal, retry/refusal/dismiss lifecycle, hidden/consumed picker ownership, result-tree keyboard focus/disclosure and all-skipped retirement; unconfirmed-over-conflict guidance and failed-chat changes despite older host timestamps; nearest-listed ancestor/cyclic forest shape, descendant membership, host ordering/missing-host local fallback; skipped/readiness/admission counts, provisional skip/progress monotonicity, early per-chat verdicts with batch pending protection, older-host waiting, start-slot/delivery distinction, retry-over-failure and unknown-after-withdrawal attention; remote snooze/reconnect/reoffer, unseen mixed summary through open/close, watched completion retirement, new success beside old failure, failed-reread mixed-result preservation, filter/collapse completion resets, retry summary replacement and current-offer/history selection; cross-host workspace identity, rendered cyclic reachability, nested tri-state/toggle propagation, project eligibility isolation and collapse preserving selection. Exact fallback-list completion barrier, batched verdict/cleanup retention, stale-read versus dismissal publication race, and requested-but-never-rendered finished-run retirement remain; they do not replace retired alarms. Audit3146 combines source reviews3132/3133/3135/3138/3143: intentionally retire20authored/31expanded cases without equivalent replacement. Provider-session losses: structured-native terminal-resume exclusion, metadata-less completed identity, new-turn completion clearing, Pi provider-only/periodic/manual promotion, changed-transcript launch-config isolation, Pi/omp/prime-agent completed-session remote/manual-shutdown promotion, and quit/done precedence over heartbeat. Side-thread/question losses: finished-pane acquisition, hidden title/recap states, local/relay/relay-done conversation takeover with prompt/session/child resets, plain-message abandonment, compaction/session replacement and completion resets. Codex startup losses: incoming-owner cached child replacement, old-relay foreign live-session correction, completed foreign-root turn-fact permutations. Transcript losses: real temporary-JSONL partial sibling/final-child completion, unlabelled child attribution, compact cached replay preservation and100/1000completed-child roster retention/release. Compiler-ratchet losses: valid-line uncompiled-list parser grammar examples and injected-existence stale-path filtering; these did not exercise actual filesystem canonicalization or build exclusion. These are real lifecycle, ownership, replay, liveness and retention alarms, including recent#40246 regressions, deliberately lost. Retained conditional record replacement, clockless root/SSH owner isolation, persisted main-thread fork rejection, partial/final question-answer lifetime, cached-roster/missing-ID/live HTTP/durable startup boundaries and restarted-relay refusal/acceptance do not replace those losses. No native/SSH/WSL execution or equivalent coverage is claimed. Audit3128 scoped coverage reduction: Audit3121 removes VoiceDictationLanguageSetting.test.tsx (Spanish-to-es callback and unsupported-model Korean option presence) and voice-speech-model-rows.test.ts (provider/language-order/retired-on-disk list policy); these real narrow alarms are deliberately retired without replacement. VoiceSpeechModelSection per-model concurrent deletion remains unchanged. Audit3122 removes the direct absolute/parent-segment sparse-directory exception-type sample and the five-row IPC sparse-preset error-code/non-save table (two authored/six expanded cases). Those real typed-validation and IPC refusal/error-code alarms are deliberately retired. Keep both real symlink/junction floating-directory trust cases and the minimal RPC structured validation-reason serialization case. The RPC case does not replace IPC save/refusal behavior, typed normalization for both path inputs, actual Git sparse checkout or rendered localization. No equivalent replacement or fresh test/runtime/platform/remote/performance validation is claimed. Audit3124 removes ExperimentalPane.test.tsx (ordinary Pet switch callback), WorkspaceDirectorySetting.test.tsx (padded absolute saved-path normalization/no-write blur), and repository-search.perf.test.ts (navigation/selected-pane builder-call policy, fixture cardinality/nonempty entries and renamed project keyword inclusion). These real narrow alarms are retired without replacement; RepositoryPane.search.test.tsx search-to-sparse-editor request remains unchanged. Audit3129: resolver Windows case-insensitive and POSIX case-sensitive configured-env composition plus mocked-base launch-preflight Windows composition are intentionally no longer checked by the two deleted suites. No equivalent coverage claimed. Keep runtime-structured-agent-host-env.test.ts unchanged: configured Windows Claude-home account identity and host-account precedence remain checked. Audit3114 incorporates source3101: retire three structured Claude child-environment wrapper cases covering inherited stamp isolation/default and explicit entrypoint, Windows SDK-key canonicalization/default/duplicate-key order, and configured lookup/final environment/config-dir conjunction. Keep direct auth/session sanitation and Windows-versus-Linux overlay checks, actual executable lookup from supplied inherited PATH, native Windows child environment delivery, and stale option-mutation fencing. These are not equivalent replacements for the retired wrapper alarms. No fresh test/runtime, real login-shell probe, Claude SDK startup, remote/mixed-version, UI or performance result is claimed. Audit3114 incorporates source3105: retire 17 authored/20 expanded daemon launch-note cases, including the entire two-case SessionLaunchNote suite. Deliberately lose split-marker carry across same-token re-arm, stale-token retirement refusal, foreground tri-state and serial settlement, omitted-note/no-incarnation mixed-version policy, sticky retirement, first-incarnation/replacement launch preservation and held-launch precedence. Keep only the unchanged unresolved foreground-read race against a later finished attach. Supplied notes/foreground and runtime calls do not establish actual daemon/main restart, SSH, native Windows observation, mobile UI, equivalent replacement or fresh runtime/performance validation. Audit3114 incorporates source3109: retire six authored/35 expanded pricing cases: 21 accepted model-name examples, 10 unsupported/future-model fail-closed examples, malformed TTL clamp, unknown-model estimate refusal, flat-model long-context disregard and oversized long-context clamp. Keep mixed five-minute/one-hour write allocation and short/all-long/mixed long-context allocation with original fixed oracles. Real parser/refusal/bounds alarms are knowingly lost without equivalent replacement; retained tests do not validate provider rates, actual billing or request threshold classification. Preserve the archived usage-scan-append source-freeze receipt without transferring historical execution/performance credit. No fresh runtime result is claimed. Audit3108 source-only reduction (3094/3095/3100): retire 27 authored/30 expanded cases, including complete markdown view-state, file-preview link-open and CLI agent-server-route suites, without replacement. Deliberate losses include preview visibility/reference lifetime and same-path owners; SSH stat, directory/missing-target, explicit-null owner, nonmarkdown line/column, local URI routing, remote-to-client guard and same-file reuse; document-preview source-owner/folder/reuse routing, stable grant location and outside-workspace POSIX/Windows request projection; and verified remote CLI send/check refusal, suggested --on argv/copy, shell no-probe bypass, unverified-launch admission and older-peer refusal. Retain two markdown source-runtime/qualified-reveal alarms, one stale grant-rejection fence and two remote read/mutation evidence policies, with original callbacks. Final last-wins reveal did not prove transient cancellation; CLI prerequisite did not prove no real send, and envelope tests do not execute server refusal. No fresh runtime, rendered UI, actual file/SSH/paired transport, authorization, mixed-version or performance result is claimed. Audit3096 source-only reduction (3087/3088): retire 69 authored/76 expanded cases, including complete recovery-portals and reconnect-banner suites. Intentionally lose dead/default TUI replay, generated alternate-frame style composition, reset/mode/dimension and legacy missing-mode-boundary alarms, UI notice/action/reveal policies, and isolated recovery lifecycle variants, without equivalent replacement. Retained registrations and callbacks are unchanged; headless cells are not pixels, and no fresh runtime, host, SSH, WSL, rendered-app or performance result is claimed. Audit3086 source-only reduction (3079/3080/3081): intentionally retire 93 authored/100 expanded mock-boundary cases, including the complete spawn-errors and SSH reconnect overlay suites, without replacement. Retired alarms include spawn classification/ownership, reply ceilings and renderer-write failure recovery, disconnect/detach fencing branches, authority facts, and overlay retry/visibility wiring. Retained callbacks are unchanged; no fresh execution, real PTY/SSH, rendered UI, or performance result is claimed. Audit2432: The broad unit command loses the isolated BranchPicker open-change notification sample. Its unique true/false callback alarm is intentionally retired; reopening/status-refresh behavior was not exercised. No equivalent replacement or fresh validation of the reduced selector is claimed. Audit2425: The broad unit command loses the workspace-copy-status supplied readError forwarding sample. It did not exercise the branch-switch blocking promised by its title. This alarm is intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2417: The broad unit command loses two ordinary clean Git cherry-pick/revert success samples and two terminal startup foreground-read work-budget samples. These unique alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2412: The broad unit command loses the whole six-case fake-React-hook scroll-anchor suite, two generic draft-retention samples, a simple new-agent order sample, a real history-publication batching-count sample, an unmounted handoff abort/timer sample and three basic WSL preview/error samples. These alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2404: The broad unit command loses the standalone share-name lookup 503 propagation suite, initial deletion placement-kind sample, direct changed-mtime stale sample, first-pass rollback existence example and abandoned-preparation directory sample. These exact alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2397 review amendment: The broad unit command loses three standalone suites, two partial-case definitions and two URL table rows across package/download/placement tests. Keep initial wrong-port authorization, modified independent-copy digest refusal and abort-after-begin cancellation dispatch. The remaining alarms are deliberately retired; no equivalent complete replacement or fresh validation of the reduced selector is claimed. Audit2393 current-parent refresh2401: Remove the basic skill-install service alias sample and original public managed-remove receiptless refusal case. Preserve the upstream request ownership suite and transaction interruption coverage. No equivalent complete replacement or fresh validation of the reduced selector is claimed. Audit2389: The broad unit command loses the missing-preview suite, plain-global destination sample and prepublished-receipt recovery example. No equivalent replacement or fresh validation of the reduced selector is claimed. Audit2385: The broad unit command loses four authored walker/staging/protocol examples (six expanded cases); no equivalent replacement or fresh validation is claimed for the reduced suite. Audit2383: The unscoped Vitest command no longer includes the removed Antigravity catalogue suite; its exact provider-root/owner example has no equivalent replacement or fresh validation claim. Audit2377/2381: The unscoped Vitest command includes the reduced bundled-skill and native-discovery suites; the eight removed backup/legacy/catalogue/symlink/SSH-builder examples have no replacement-equivalence or fresh validation claim here. Audit2133 current-parent preparation: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2095 current-parent preparation2126: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2090 (sources2088/2089): Current reduced suites intentionally retire the alarms listed in knownGaps; prior dated execution and replacement claims do not validate changed source bytes or selectors. Historical prior account (preserved verbatim): Audit2086 (sources2082/2083): Current reduced suites intentionally retire the alarms listed in knownGaps; prior dated execution and replacement claims do not validate changed source bytes or selectors. Historical prior account (preserved verbatim): Audit2076 (sources2073/2074): Intentionally retire these low-value alarms without replacement: src/main/runtime/orca-runtime-tests/terminal-handles-part-02.spec.ts: recovers a moved SSH pane through the tab it now sits in, not the one its lease froze; reports a plain expired orphan; does not report a pane whose only recent lease was superseded; does not report a pane whose only recent lease had its relay id recycled; picks the eligible orphan over a superseded predecessor that matches first; collects the same tabs the per-tab reader reports, in one sweep of the leases; reports no candidate when no lease names any of the worktree tabs. src/main/runtime/orca-runtime-tests/runtime-availability.spec.ts: starts unavailable with no authoritative window; reports the configured Windows terminal shell on status; reports floating workspace availability from settings on status; polls floating tabs with targeted PTY liveness and no repo/provider inventory; hydrates persisted tabs when the store cannot report repos; advertises browser screencast only when a renderer window is available; routes mobile Codex reset consumption through the account mutation coordinator; maps a definite pre-provider rejection into an authoritative current snapshot. Existing unrelated evidenceRuns retain their original scope; unchanged dated receipt objects do not validate changed source bytes or reduced selectors. No fresh gate execution or historical import-closure equivalence is claimed. Frozen current literal-import graph reaches these changed test bytes; unresolved local and computed edges remain debt, and current reachability is not historical execution or equivalent replacement evidence. Historical prior account (preserved verbatim): Audit2056 (sources2054/2055): Intentionally retire these low-value alarms without replacement: src/renderer/src/runtime/files/watching/runtime-file-client-watch.test.ts: delivers remote file changes to listeners for the same worktree. src/main/runtime/orca-runtime.test.ts: ordinary registration cleanup removes only await import('./orca-runtime-tests/mobile-session-tabs-part-14.spec'). src/main/runtime/orca-runtime-tests/terminal-side-effect-facts-part-03.spec.ts: arms the stale-title timer for a seeded working title; arms the Command Code scrape from the noted spawn command; prefers the tracked title over a stale renderer lastTitle in the hydration seed; writes recent output into the current runtime output map; uses a later title handler replacement with the runtime receiver; calls the current injected listener with the runtime receiver; keeps optional reconciliation lazy after its callback is removed. src/main/runtime/orca-runtime-tests/mobile-session-tabs-part-14.spec.ts: lists them, so a paired client can mirror a migrated editor; closes one by retiring it from the host session; keeps an unsaved draft unless the close is forced; shares aggregate work but leaves a replacement pending promise alone; lets a targeted refresh finish while an aggregate refresh waits; refuses a close when the store lacks %s before the guard; keeps a later missing %s on the original caught failure path. Existing unrelated evidenceRuns retain their original scope; unchanged dated receipt objects do not validate changed source bytes or reduced selectors. No fresh gate execution or historical import-closure equivalence is claimed. Exact retired assertionRefs, preserved as historical objects only: {\n \"file\": \"src/renderer/src/runtime/files/watching/runtime-file-client-watch.test.ts\",\n \"assertions\": [\n \"terminal watcher error and setup failure evict the shared entry before retrying callbacks run\",\n \"an old stream end cannot evict the replacement stream, which still delivers to its listener\",\n \"two same-worktree listeners share a synthetic subscription until the final stop unsubscribes and sends unwatch\"\n ]\n } Historical prior account (preserved verbatim): Audit1973: Delete the standalone mocked watcher cleanup suite and its entire sole-file prospective command. Retire the removed file-command transport-abort alias; preserve the independent cancellation suite and final-overflow/error/end cleanup callback, and13 unrelated receipt objects. Whole original changed dated receipts are retired, never narrowed or transferred. This metadata review claims no fresh execution, equivalent replacement, provider/PTY, live remote/mobile, rendered, cross-platform, soak or measured-budget result. Historical prior account (preserved verbatim): Audit1931 (sources1928/1929): Partial runtime files-watch suite retains controlled Windows close-event waiting, shared-client survival, late physical-exit ownership/deadline cleanup and shutdown joining. Its combined Windows close/deadline/late-exit alias remains backed by unchanged callbacks. Retire native-error-close, pre-publication setup ownership and failed-delete rearm aliases; associated delegation, failure forwarding, removal routing and recovery examples are lost. These tests inject watch/subscription seams and do not observe an actual native watcher or physical process. Preserve meaningful remaining selectors/assertions and unchanged dated receipts within their original scope. Reduced selectors have no fresh gate execution evidence in this metadata packet. No equivalent replacement, physical watcher/PTY/provider, live SSH/remote/mobile, rendered, cross-platform, soak or measured-budget result is claimed. Historical prior account (preserved verbatim): Audit1925 (sources1922/1923): Partial runtime watcher-host suite loses mocked option/event/overflow/resubscription forwarding, supplied teardown-error propagation, aborted-signal/no-call and private ten-thousand-waiter-count inventories. Retire the 10,000-caller bound and failed-recovery-subscriber-ending assertion aliases. Keep same-root owner cancellation, pre-ready replacement, held root-close join, stale-generation recovery delivery and initial failed-root ownership mappings backed by retained real-host callbacks with injected subscription/error/physical-exit promises. No actual native watcher, process termination or resource bound was observed. Preserve meaningful remaining selectors/assertions and unchanged dated receipts within their original scope. Reduced selectors have no fresh gate execution evidence in this metadata packet. No equivalent replacement, physical watcher/PTY/provider, live SSH/remote/mobile, rendered, cross-platform, soak or measured-budget result is claimed. Historical prior account (preserved verbatim): Audit1683 retires changed-source assertion and execution scope without equivalent replacement coverage. Existing unchanged-selector receipts remain scoped to their original sources. Historical prior-source oracle: Existing exact unchanged-selector receipts remain the only current execution evidence. Changed source selectors have no fresh execution result. Historical prior-source oracle account: Existing exact unchanged-selector receipts remain the only current execution evidence. Changed source selectors have no fresh execution result. Historical prior-source oracle account: Fill the global watcher-child reservation, require native desktop, paired-runtime, and WSL setup to retain typed transient capacity and retry after one serialized release, then cancel pending desktop and paired-client watches and require no retry. Hold one live anchor while aborting 10,000 callers at the capacity, quarantine-assignment, runtime-root, relay-setup, and SSH-registration layers; require exactly one explicit waiter and one base-promise reaction to remain, then zero after settlement. Hold an old relay unsubscribe, queue one same-root setup leader and one anchor, then abort 10,000 joiners; require every cancellation to settle before teardown releases, exactly one anchor waiter, and only one later physical install. Advance the former paired-web callback deadline while capacity remains full, require cancellation ownership to stay live, publish the server token before ready, and require files.unwatch to abort setup before a later slot release can install a native root. Reject the first ready-watch unwatch with a physical-exit promise, resolve that exit later, and require a fresh physical unwatch attempt, registry release, and exactly one stream end. Fill one healthy shared child with multiple roots, map a standard SSH repository's base, Git common directory, and worktree roots to one relay supervisor, then inject IPC disconnect-before-exit, queued and active cancellation, operations during termination, kill-without-exit, repeated unkillable generations, initial and recovery timeouts, and shard failure. During local and SSH deletion, attempt a late terminal spawn whose worktree identity and cwd name different roots, enumerate a non-prefix remote PTY by authoritative worktree ownership, withhold daemon/relay exit callbacks, make attach positively prove a concurrent-shutdown PID dead, and make the provider unavailable; require every acquired admission to roll back on rejection, dead-PID proof to settle physical exit before reaping, timeout to retain ownership, and Git/filesystem deletion never to start. Require bounded watcher process count, physical-exit settlement, healthy-root recovery, stale-generation rejection, overflow plus later events, and fail-closed destructive cleanup. Verify relay build hashes and remote install probes require both relay.js and relay-watcher.js. Launch the built relay with a real PTY and Parcel watch, kill only the watcher child, and require the same relay PID and PTY to answer before a replacement child delivers overflow and a post-crash event.", "commands": [ "pnpm exec vitest run --config config/vitest.config.ts src/main/ipc/filesystem/watcher-process/parcel-watcher-unsubscribe-timeout.test.ts --reporter=dot", "pnpm exec vitest run --config config/vitest.config.ts src/main/ipc/filesystem/watchers/filesystem-watcher.test.ts src/main/ipc/filesystem/watchers/filesystem-watcher-native-capacity.test.ts src/main/ipc/filesystem/watcher-process/parcel-watcher-child-registry.test.ts src/main/ipc/filesystem/watcher-process/parcel-watcher-child-launch.test.ts src/main/ipc/filesystem/watcher-process/parcel-watcher-process.test.ts src/main/ipc/filesystem/watcher-process/parcel-watcher-supervisor-capacity.test.ts src/main/ipc/filesystem/watcher-process/parcel-watcher-disconnect-termination.test.ts src/main/ipc/filesystem/watcher-process/runtime-watcher-pending-assignment.test.ts src/main/ipc/filesystem/watcher-process/parcel-watcher-event-delivery.test.ts src/main/ipc/filesystem/watchers/filesystem-watcher-local-unsubscribe.test.ts src/main/ipc/filesystem/watchers/filesystem-watcher-wsl.test.ts src/main/ipc/worktrees-delete-pty-teardown.test.ts src/main/ipc/worktrees-orphan-directory-cleanup.test.ts src/main/ipc/worktrees-remove-preflight.test.ts src/main/workspaces/removal/watcher-removal-gate.test.ts src/main/runtime/files/watch/orca-runtime-files-watch.test.ts src/main/runtime/workspaces/removal/worktree-teardown.test.ts src/main/runtime/construction/orca-runtime.test.ts src/main/runtime/rpc/methods/files/files.test.ts src/main/runtime/rpc/methods/files/files-watch-cancellation.test.ts src/renderer/src/web/web-runtime-client.test.ts src/shared/cross-platform-path.test.ts src/shared/physical-exit-tracker.test.ts src/shared/promise-settlement-waiters.test.ts src/main/ipc/pty/pty-spawn-cwd-fallback.test.ts src/main/providers/local-pty/local-pty-provider-shutdown.test.ts src/main/daemon/providers/adapter/testing/daemon-pty-adapter.test.ts src/main/daemon/pty-subprocess/testing/pty-subprocess.test.ts src/main/daemon/sessions/testing/session.test.ts src/main/daemon/terminal-host/testing/terminal-host.test.ts src/main/daemon/terminal-host/testing/terminal-host-session-reaping-leak.test.ts --reporter=dot", @@ -13193,7 +13182,8 @@ "Audit 3256 removes these specific alarms from the broad root unit commands: skill dialog active-share selection, close and pending-share handoff; simple keyed-record deletion; marker live-region insertion, simple landing and nine baseline policy examples; General search/control navigation inventory; orphan-count cache bootstrap; seven Codex code classifications and HTTP 429 warning mapping; two skill unread-root verdict examples; peer-mail payload and conversation-ID rejection; and the GitHub organization TABLE text-field optimistic rollback/failed-envelope example. These include real behaviors; retained tests do not provide equivalent coverage for every removed scenario. Mobile losses are recorded separately and are not coverage of these root commands.", "Audit 3273 removes 14 authored declarations and 19 expanded scenarios across four whole suites and eight partial suites. Retired alarms cover saved-local cancellation/layout ownership, ambiguous-owner warning reset, folder attachment routing, VM false-capability bypass, abandoned reveal warmup cleanup and viewport claim deduplication/rearming, quiet unrelated remote-removal refusal, startup-command one-shot consumption, repository/floating recovery-ledger rows, fake-React pinned-scroll intent, split-ratio state identity/subscriber suppression and fractional change, cross-host project-group join refusal, three PR request-lifetime permutations, upstream-status preservation on error, and unresolved Git-owner refusal. These regression checks are intentionally lost under the test-value audit; retained scenarios are not equivalent replacements. Historical coverage receipts remain historical, including gate35 subscriber claims.", "Audit 3283 removes 20 authored declarations and 31 expanded scenarios, including two whole suites. Retired alarms cover PR refresh-state pruning, shared runtime subscription cleanup and store isolation, language content-change routing and older completion ownership, ordinary panel retry-timer cleanup and pending loading, four hosted-review lifetime permutations, mocked terminal creation error/order wiring, five sleep-inventory variants with pending-frame-only assertions, palette fallback/composite highlights, Windows/UNC encoded-editor input rows, mixed-repository partial failure counts, title setters and generated-title bypass/replacement, five window-close coordinator delegation/guard/finally branches, and ambiguous-old-record frame reveal. These regression checks are intentionally lost under the test-value audit; retained cases are not equivalent replacements. Prior coverage notes and receipts remain historical.", - "Audit 3292 combines adopted 3285/3287/3289/3293 removals: 40 authored declarations and 47 expanded scenarios, including whole frame-editor-view, ambiguous remote-delete-refusal, unverifiable-host subscription and editor-close cleanup suites. The previously reviewed dock-badge suite was already removed upstream in PR 40895 and receives zero new removal credit. Intentionally retired alarms include background browser selection and last-tab landing; main startup fallback, SSH project cleanup/survivor routing, exact-PR contradiction/saved-push positives, replay/sidecar rollback and wrapped remote error normalization; records/snapshot missing-diff hydration, ambiguous folder-owner delete refusal, focus no-op notifications, nested editor context-only cache check, pending broadcast-first status and ordinary four-confirmation aggregation; preview-source frontmatter pruning, approved local/runtime agent dispatch, non-GitHub legacy PR cache invalidation, stale merged-head transient-error fallback, empty-queue immediate query reply and unverified-to-concrete preflight risk. Additional intentionally retired alarms are injected host subscription/unsubscribe counts, synthetic editor reveal/draft/fallback/scoped close, ambiguous unread refusals and hidden mark/read roundtrip, immediate connect backoff/noError, positive mirrored evidence-clock renewal, supplied VM failure/success projections and git-local/folder-SSH wake permutations. Remaining temporal/ownership cases are narrower; no equivalent replacement or fresh execution is claimed." + "Audit 3292 combines adopted 3285/3287/3289/3293 removals: 40 authored declarations and 47 expanded scenarios, including whole frame-editor-view, ambiguous remote-delete-refusal, unverifiable-host subscription and editor-close cleanup suites. The previously reviewed dock-badge suite was already removed upstream in PR 40895 and receives zero new removal credit. Intentionally retired alarms include background browser selection and last-tab landing; main startup fallback, SSH project cleanup/survivor routing, exact-PR contradiction/saved-push positives, replay/sidecar rollback and wrapped remote error normalization; records/snapshot missing-diff hydration, ambiguous folder-owner delete refusal, focus no-op notifications, nested editor context-only cache check, pending broadcast-first status and ordinary four-confirmation aggregation; preview-source frontmatter pruning, approved local/runtime agent dispatch, non-GitHub legacy PR cache invalidation, stale merged-head transient-error fallback, empty-queue immediate query reply and unverified-to-concrete preflight risk. Additional intentionally retired alarms are injected host subscription/unsubscribe counts, synthetic editor reveal/draft/fallback/scoped close, ambiguous unread refusals and hidden mark/read roundtrip, immediate connect backoff/noError, positive mirrored evidence-clock renewal, supplied VM failure/success projections and git-local/folder-SSH wake permutations. Remaining temporal/ownership cases are narrower; no equivalent replacement or fresh execution is claimed.", + "Audit 3301 combines adopted source batches 3296 and 3299: retire 27 authored declarations and 36 expanded scenarios, including six whole suites. Intentionally lost alarms cover failed-verification/recovery/restart counters and mocked hosting/toast; early overlapping pane-read scheduling/count; unreadable removal listing draft guard; bulk-purge remote-qualified and raw-local guard maps; initial-snapshot blank/mode/oversize/printable/fresh-spawn callback and replay examples; fallback mobile file close and ordinary MRU; default queue overload/drain; seeded browser-page reuse and supplied missing-page URL recreation; ambiguous sleep/hibernation owner refusal and untouched bindings/origins; ordinary selection/activity/fallback priority; skip-remote success and retained hints; supplied structured-chat unsent retention and scoped removal draft eviction; caller-chat focus precedence; open/draft PR cache eviction and merged-head fallback result inventories. Retained adverse-ordering and ownership cases are narrower and do not establish equivalent replacements. No fresh runtime, native, physical provider, cross-platform, mobile or mixed-version evidence is claimed." ], "demotionRule": "Demote or quarantine if the fault harness flakes without a product or harness bug, if healthy operation exceeds one runtime watcher child, if total physical operation exceeds eight children including retiring generations, if quarantine children outlive their roots or repeat after fusing, if event delivery becomes unbounded, or if metadata/stat work returns to the serve process." }, @@ -14438,10 +14428,10 @@ "providers": ["paired-runtime"], "coveredPlatforms": ["linux"], "coveredProviders": ["paired-runtime"], - "coverageNotes": "Audit 3292 combines adopted 3285/3287/3289/3293 removals: 40 authored declarations and 47 expanded scenarios, including whole frame-editor-view, ambiguous remote-delete-refusal, unverifiable-host subscription and editor-close cleanup suites. The previously reviewed dock-badge suite was already removed upstream in PR 40895 and receives zero new removal credit. Intentionally retired alarms include background browser selection and last-tab landing; main startup fallback, SSH project cleanup/survivor routing, exact-PR contradiction/saved-push positives, replay/sidecar rollback and wrapped remote error normalization; records/snapshot missing-diff hydration, ambiguous folder-owner delete refusal, focus no-op notifications, nested editor context-only cache check, pending broadcast-first status and ordinary four-confirmation aggregation; preview-source frontmatter pruning, approved local/runtime agent dispatch, non-GitHub legacy PR cache invalidation, stale merged-head transient-error fallback, empty-queue immediate query reply and unverified-to-concrete preflight risk. Additional intentionally retired alarms are injected host subscription/unsubscribe counts, synthetic editor reveal/draft/fallback/scoped close, ambiguous unread refusals and hidden mark/read roundtrip, immediate connect backoff/noError, positive mirrored evidence-clock renewal, supplied VM failure/success projections and git-local/folder-SSH wake permutations. Remaining temporal/ownership cases are narrower; no equivalent replacement or fresh execution is claimed. Audit 3283 removes 20 authored declarations and 31 expanded scenarios, including two whole suites. Retired alarms cover PR refresh-state pruning, shared runtime subscription cleanup and store isolation, language content-change routing and older completion ownership, ordinary panel retry-timer cleanup and pending loading, four hosted-review lifetime permutations, mocked terminal creation error/order wiring, five sleep-inventory variants with pending-frame-only assertions, palette fallback/composite highlights, Windows/UNC encoded-editor input rows, mixed-repository partial failure counts, title setters and generated-title bypass/replacement, five window-close coordinator delegation/guard/finally branches, and ambiguous-old-record frame reveal. These regression checks are intentionally lost under the test-value audit; retained cases are not equivalent replacements. Prior coverage notes and receipts remain historical. Audit 3273 removes 14 authored declarations and 19 expanded scenarios across four whole suites and eight partial suites. Retired alarms cover saved-local cancellation/layout ownership, ambiguous-owner warning reset, folder attachment routing, VM false-capability bypass, abandoned reveal warmup cleanup and viewport claim deduplication/rearming, quiet unrelated remote-removal refusal, startup-command one-shot consumption, repository/floating recovery-ledger rows, fake-React pinned-scroll intent, split-ratio state identity/subscriber suppression and fractional change, cross-host project-group join refusal, three PR request-lifetime permutations, upstream-status preservation on error, and unresolved Git-owner refusal. These regression checks are intentionally lost under the test-value audit; retained scenarios are not equivalent replacements. Historical coverage receipts remain historical, including gate35 subscriber claims. Audit 3256 removes these specific alarms from the broad root unit commands: skill dialog active-share selection, close and pending-share handoff; simple keyed-record deletion; marker live-region insertion, simple landing and nine baseline policy examples; General search/control navigation inventory; orphan-count cache bootstrap; seven Codex code classifications and HTTP 429 warning mapping; two skill unread-root verdict examples; peer-mail payload and conversation-ID rejection; and the GitHub organization TABLE text-field optimistic rollback/failed-envelope example. These include real behaviors; retained tests do not provide equivalent coverage for every removed scenario. Mobile losses are recorded separately and are not coverage of these root commands. Audit3246 retires NewRowsMarker reveal/no-repeat and pane-scoped beforeinput checks; skill-owner option availability/count/dedup/order; six styled Input/Textarea IME forwarding rows; the static Codex/OpenCode smart-key inventory; tab-map AST ratchet diagnostic fixtures; child-roster work-budget and retained-aggregate alarms; malformed persisted floating-cwd fallback/no-crash/empty exact-root checks; the unanswered-host empty-list discriminator; the direct invalidated-cache commit-false assertion; one redundant digit-keyup IME row; cached non-supported Claude title-generator rows; and the duplicate late naming-result singleton. These root broad commands lose those specific alarms without equivalent replacement. Distinct retained owner/state checks have their own bounded claims; the real scheduler still rejects stale response data, while the direct false-return alarm is retired. Audit3231 retires supported-host restore-pane key mapping, closed/open creation-sidebar toggle visibility, unrelated scope-error/null classification and quick-submit reveal/no-create checks. These broad commands lose those real narrow alarms; no replacement coverage is claimed. Audit3219 removes the synthetic Cmd+J extra-source suite; this broad command no longer checks its match/tie placement and selection, announced count, empty-query cap, or workspace hiding with retained recent tabs. No replacement coverage is claimed. Audit3209 composes approved sources3202/3206: deliberately retires seven authored/expanded cases in four whole suites without equivalent replacement. Work-item queries lose real GitHub/GitLab oversized ASCII secret-prefix empty-query and whitespace-before-trim refusal alarms; inputs share the imported size bound and exercise only its fast length branch, with no multibyte or actual provider/exposure guarantee. Skill sharing loses complete/partial managed-bundle and destination-ambiguity association checks plus three negative origin/path/scheme admission examples; these do not establish uploaded contents, arbitrary-URL fetching, authorization or execution. Retain exact originless-project direct-link fallback, cloud-delete confirmation, bundled-target repair/owner isolation and explicit Windows-host preference over stale WSL suites. Rejected3201 runtime-preference removal is excluded. No real cloud/network/host/disk, mobile or mixed-version execution validation is claimed. Audit3200 composes approved source3194: deliberately retires thirteen authored registrations/twenty-seven expanded cases in six whole automation host/list policy suites without equivalent replacement. Real RPC category/retryability and wrapped-timeout recognition, unscoped-failure/scoped-success health evidence precedence, exact-ID create selectors and per-run workspace omission, paired-web local/SSH/absent host catalog routing, incompatible/removed/unhydrated/offline execution health, runtime-before-nested-SSH recovery dispatch, and no-owned-focus/successor/foreign-list focus policy alarms are consciously lost. Retain exact20line orphan allow/refuse/precondition and exact90line cross-host same-ID search suites. No retry-timer/fence lifecycle, actual reconnect/network/write delivery, native focus, mobile/mixed-version runtime or disk persistence coverage is claimed. Audit3191 combines approved source3182/3187/3188: deliberately retires thirteen authored Vitest registrations and fifteen expanded cases, including five whole suites, without equivalent replacement. Attachment intake loses real portal/native-capture terminal interception and unowned-container refusal, immediate child-only committed availability/claim-ref negotiation and delivery, and direct-target over stable focused/background composer routing through disable/re-enable/remount and independent question focus. Exact destination/cache/draft and final-stat owner/workspace/File-release suites remain; they do not replace Surface recipient routing. Automation authoring loses destination runtime catalog membership, local/direct-SSH exclusion of paired-runtime repos, unknown-runtime empty catalog, logical project/host/setup/repo/path context payload, and missing/nonready setup refusal; these were genuine direct helper alarms, while exact schedule transformation, legacy schedule and setup-decision suites remain. Agent picker loses setup-chat/terminal/missing-installer/unsupported-or-unknown-host row projection samples and the ordinary unsearched menu variant; the entire original26-line resume recipe suite remains, including reported bypass versus default/absent permission modes, as does the exact search-result menu callback with its fixtures, model/effort commits and staged Arguments reopen outcome. Rejected predecessor3180 full recipe deletion is excluded. No actual native drag/cursor/focus/IME, upload bytes or disk/restart persistence, full automation save/scheduler/runtime transport, real resume-process flags/environment delivery, or native menu/rendered layout validation is claimed. Audit3178 combines source3169/3170/3175: deliberately retires eight authored units (six Vitest cases and two imperative custom relay scenarios), including two whole suites, without equivalent replacement. Voice Section loses per-model pending-delete isolation across interleaved A/B completion and the two-success refresh-call alarm; exact VoicePane delayed key-clear/newer enabled-toggle merge remains and does not replace row deletion coverage. Speech loses dedicated rating-scale/inclusive-ceiling, unsupported-versus-unmeasured, explicit/system-language precedence/locale alias, accuracy versus fast named/default/best-measured selection, and unmeasured/no-match examples; exact offered-user-pick versus retired-selection case and its fixture remain. Relay loses legacy ping-delivery count/liveness sampled before the silence deadline and grouped malformed Bearer/host-ID 401/429 routing checks; twelve real Worker/DurableObject/shipped-client scenarios remain, not equivalent replacement for those narrow alarms. Six prior speech cases are not all deleted: approved successor3175 keeps the original user-choice case. No actual credential/file persistence, native/GPU/engine/download delivery, production assignment policy or deployed-runtime validation is claimed by this reduction. Audit3165 combines source3160/3162: deliberately retires six authored/expanded cases across three whole suites without equivalent replacement. Launch/status losses: observed React-render pending/resuming coordination across settings and deferred offer read; stale-offer reread suppressing dialog reopen; held-local-chat recovery visibility with new-chat preferences off; disabled-local admission avoiding offer RPC despite an injected but unconsumed paired-tab fixture; and run-only lost-reply uncertainty reachability until direct viewed-run retirement. Launch probe does not prove arbitrary synchronous-store atomicity, the paired fixture is not remote runtime enrollment, and the status case directly marks viewed state rather than rendering the summary. Crew-hook losses: old-host method_not_found cache persists across party changes but is released by independently supplied connection generation/verified pairing status or pairing revision, with actual frame publication and teardown. These are real narrow coordination, admission, uncertainty and mixed-version cache alarms consciously lost. Exact web verified-runtime writer handoff guard remains; it does not replace those alarms or prove live host/native/mobile delivery. Audit3156 combines3147/3150/3152/3153/3154: deliberately retires39authored/40expanded native-chat recovery cases, eight whole suites and two orphan test-support files without equivalent replacement. Lost alarms: lost-reply unconfirmed reconciliation, skipped rows/counts and missed-frame repair, unknown/pending outcome and omitted-failure-list compatibility, uncertain history after dismissal, retry/refusal/dismiss lifecycle, hidden/consumed picker ownership, result-tree keyboard focus/disclosure and all-skipped retirement; unconfirmed-over-conflict guidance and failed-chat changes despite older host timestamps; nearest-listed ancestor/cyclic forest shape, descendant membership, host ordering/missing-host local fallback; skipped/readiness/admission counts, provisional skip/progress monotonicity, early per-chat verdicts with batch pending protection, older-host waiting, start-slot/delivery distinction, retry-over-failure and unknown-after-withdrawal attention; remote snooze/reconnect/reoffer, unseen mixed summary through open/close, watched completion retirement, new success beside old failure, failed-reread mixed-result preservation, filter/collapse completion resets, retry summary replacement and current-offer/history selection; cross-host workspace identity, rendered cyclic reachability, nested tri-state/toggle propagation, project eligibility isolation and collapse preserving selection. Exact fallback-list completion barrier, batched verdict/cleanup retention, stale-read versus dismissal publication race, and requested-but-never-rendered finished-run retirement remain; they do not replace retired alarms. Audit3146 combines source reviews3132/3133/3135/3138/3143: intentionally retire20authored/31expanded cases without equivalent replacement. Provider-session losses: structured-native terminal-resume exclusion, metadata-less completed identity, new-turn completion clearing, Pi provider-only/periodic/manual promotion, changed-transcript launch-config isolation, Pi/omp/prime-agent completed-session remote/manual-shutdown promotion, and quit/done precedence over heartbeat. Side-thread/question losses: finished-pane acquisition, hidden title/recap states, local/relay/relay-done conversation takeover with prompt/session/child resets, plain-message abandonment, compaction/session replacement and completion resets. Codex startup losses: incoming-owner cached child replacement, old-relay foreign live-session correction, completed foreign-root turn-fact permutations. Transcript losses: real temporary-JSONL partial sibling/final-child completion, unlabelled child attribution, compact cached replay preservation and100/1000completed-child roster retention/release. Compiler-ratchet losses: valid-line uncompiled-list parser grammar examples and injected-existence stale-path filtering; these did not exercise actual filesystem canonicalization or build exclusion. These are real lifecycle, ownership, replay, liveness and retention alarms, including recent#40246 regressions, deliberately lost. Retained conditional record replacement, clockless root/SSH owner isolation, persisted main-thread fork rejection, partial/final question-answer lifetime, cached-roster/missing-ID/live HTTP/durable startup boundaries and restarted-relay refusal/acceptance do not replace those losses. No native/SSH/WSL execution or equivalent coverage is claimed. Audit3128 scoped coverage reduction: Audit3121 removes VoiceDictationLanguageSetting.test.tsx (Spanish-to-es callback and unsupported-model Korean option presence) and voice-speech-model-rows.test.ts (provider/language-order/retired-on-disk list policy); these real narrow alarms are deliberately retired without replacement. VoiceSpeechModelSection per-model concurrent deletion remains unchanged. Audit3122 removes the direct absolute/parent-segment sparse-directory exception-type sample and the five-row IPC sparse-preset error-code/non-save table (two authored/six expanded cases). Those real typed-validation and IPC refusal/error-code alarms are deliberately retired. Keep both real symlink/junction floating-directory trust cases and the minimal RPC structured validation-reason serialization case. The RPC case does not replace IPC save/refusal behavior, typed normalization for both path inputs, actual Git sparse checkout or rendered localization. No equivalent replacement or fresh test/runtime/platform/remote/performance validation is claimed. Audit3124 removes ExperimentalPane.test.tsx (ordinary Pet switch callback), WorkspaceDirectorySetting.test.tsx (padded absolute saved-path normalization/no-write blur), and repository-search.perf.test.ts (navigation/selected-pane builder-call policy, fixture cardinality/nonempty entries and renamed project keyword inclusion). These real narrow alarms are retired without replacement; RepositoryPane.search.test.tsx search-to-sparse-editor request remains unchanged. Audit3129: resolver Windows case-insensitive and POSIX case-sensitive configured-env composition plus mocked-base launch-preflight Windows composition are intentionally no longer checked by the two deleted suites. No equivalent coverage claimed. Keep runtime-structured-agent-host-env.test.ts unchanged: configured Windows Claude-home account identity and host-account precedence remain checked. Audit3114 incorporates source3101: retire three structured Claude child-environment wrapper cases covering inherited stamp isolation/default and explicit entrypoint, Windows SDK-key canonicalization/default/duplicate-key order, and configured lookup/final environment/config-dir conjunction. Keep direct auth/session sanitation and Windows-versus-Linux overlay checks, actual executable lookup from supplied inherited PATH, native Windows child environment delivery, and stale option-mutation fencing. These are not equivalent replacements for the retired wrapper alarms. No fresh test/runtime, real login-shell probe, Claude SDK startup, remote/mixed-version, UI or performance result is claimed. Audit3114 incorporates source3105: retire 17 authored/20 expanded daemon launch-note cases, including the entire two-case SessionLaunchNote suite. Deliberately lose split-marker carry across same-token re-arm, stale-token retirement refusal, foreground tri-state and serial settlement, omitted-note/no-incarnation mixed-version policy, sticky retirement, first-incarnation/replacement launch preservation and held-launch precedence. Keep only the unchanged unresolved foreground-read race against a later finished attach. Supplied notes/foreground and runtime calls do not establish actual daemon/main restart, SSH, native Windows observation, mobile UI, equivalent replacement or fresh runtime/performance validation. Audit3114 incorporates source3109: retire six authored/35 expanded pricing cases: 21 accepted model-name examples, 10 unsupported/future-model fail-closed examples, malformed TTL clamp, unknown-model estimate refusal, flat-model long-context disregard and oversized long-context clamp. Keep mixed five-minute/one-hour write allocation and short/all-long/mixed long-context allocation with original fixed oracles. Real parser/refusal/bounds alarms are knowingly lost without equivalent replacement; retained tests do not validate provider rates, actual billing or request threshold classification. Preserve the archived usage-scan-append source-freeze receipt without transferring historical execution/performance credit. No fresh runtime result is claimed. Audit3108 source-only reduction (3094/3095/3100): retire 27 authored/30 expanded cases, including complete markdown view-state, file-preview link-open and CLI agent-server-route suites, without replacement. Deliberate losses include preview visibility/reference lifetime and same-path owners; SSH stat, directory/missing-target, explicit-null owner, nonmarkdown line/column, local URI routing, remote-to-client guard and same-file reuse; document-preview source-owner/folder/reuse routing, stable grant location and outside-workspace POSIX/Windows request projection; and verified remote CLI send/check refusal, suggested --on argv/copy, shell no-probe bypass, unverified-launch admission and older-peer refusal. Retain two markdown source-runtime/qualified-reveal alarms, one stale grant-rejection fence and two remote read/mutation evidence policies, with original callbacks. Final last-wins reveal did not prove transient cancellation; CLI prerequisite did not prove no real send, and envelope tests do not execute server refusal. No fresh runtime, rendered UI, actual file/SSH/paired transport, authorization, mixed-version or performance result is claimed. Audit3096 source-only reduction (3087/3088): retire 69 authored/76 expanded cases, including complete recovery-portals and reconnect-banner suites. Intentionally lose dead/default TUI replay, generated alternate-frame style composition, reset/mode/dimension and legacy missing-mode-boundary alarms, UI notice/action/reveal policies, and isolated recovery lifecycle variants, without equivalent replacement. Retained registrations and callbacks are unchanged; headless cells are not pixels, and no fresh runtime, host, SSH, WSL, rendered-app or performance result is claimed. Audit3086 source-only reduction (3079/3080/3081): intentionally retire 93 authored/100 expanded mock-boundary cases, including the complete spawn-errors and SSH reconnect overlay suites, without replacement. Retired alarms include spawn classification/ownership, reply ceilings and renderer-write failure recovery, disconnect/detach fencing branches, authority facts, and overlay retry/visibility wiring. Retained callbacks are unchanged; no fresh execution, real PTY/SSH, rendered UI, or performance result is claimed. Audit2432: The broad unit command loses the isolated BranchPicker open-change notification sample. Its unique true/false callback alarm is intentionally retired; reopening/status-refresh behavior was not exercised. No equivalent replacement or fresh validation of the reduced selector is claimed. Audit2425: The broad unit command loses the workspace-copy-status supplied readError forwarding sample. It did not exercise the branch-switch blocking promised by its title. This alarm is intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2417: The broad unit command loses two ordinary clean Git cherry-pick/revert success samples and two terminal startup foreground-read work-budget samples. These unique alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2412: The broad unit command loses the whole six-case fake-React-hook scroll-anchor suite, two generic draft-retention samples, a simple new-agent order sample, a real history-publication batching-count sample, an unmounted handoff abort/timer sample and three basic WSL preview/error samples. These alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2404: The broad unit command loses the standalone share-name lookup 503 propagation suite, initial deletion placement-kind sample, direct changed-mtime stale sample, first-pass rollback existence example and abandoned-preparation directory sample. These exact alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2397 review amendment: The broad unit command loses three standalone suites, two partial-case definitions and two URL table rows across package/download/placement tests. Keep initial wrong-port authorization, modified independent-copy digest refusal and abort-after-begin cancellation dispatch. The remaining alarms are deliberately retired; no equivalent complete replacement or fresh validation of the reduced selector is claimed. Audit2393 current-parent refresh2401: Remove the basic skill-install service alias sample and original public managed-remove receiptless refusal case. Preserve the upstream request ownership suite and transaction interruption coverage. No equivalent complete replacement or fresh validation of the reduced selector is claimed. Audit2389: The broad unit command loses the missing-preview suite, plain-global destination sample and prepublished-receipt recovery example. No equivalent replacement or fresh validation of the reduced selector is claimed. Audit2385: The broad unit command loses four authored walker/staging/protocol examples (six expanded cases); no equivalent replacement or fresh validation is claimed for the reduced suite. Audit2383: The unscoped Vitest command no longer includes the removed Antigravity catalogue suite; its exact provider-root/owner example has no equivalent replacement or fresh validation claim. Audit2377/2381: The unscoped Vitest command includes the reduced bundled-skill and native-discovery suites; the eight removed backup/legacy/catalogue/symlink/SSH-builder examples have no replacement-equivalence or fresh validation claim here. Audit2133 current-parent preparation: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2095 current-parent preparation2126: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit1579 removes workflow/manifest/regex/private binary-header and diagnostic metric inventories, fixture selectors, injected forwarding/platform/signature/process examples, unproven overlap and internal churn counters without equivalent replacement coverage. Retains actual Git trust/diffs; filesystem hash/ELF-region/native discovery; child CLI module repair; compiler/lock/publication/rollback and synthetic Electron install/cache ownership; executable shell quoting/exit; controlled notary/timer cleanup; local patched extractor file/AST freshness; real Chromium/WebKit CSP/sandbox/HTTPS image/referrer/link/preservation controls under parsed Android headers. Five unchanged setup-pnpm/VM request-cleanup definitions reviewed and not rerun. GitHub, installer/archive, OS metric, client, native delegate, compressor, builder and Apple boundaries injected or absent where recorded. No actual native PTY, shipped full/native app, real Actions/cache/npm signature authority, downloaded Electron archive, real objdump/linker/native CLI/AppImage, signing/NSIS/notary/upload/updater or live freeze proof. Historical scope before this audit: Published Linux 1.4.188 desktop against current source in both directions; scheduled weekly and manually runnable. No required PR check.", + "coverageNotes": "Audit 3301 combines adopted source batches 3296 and 3299: retire 27 authored declarations and 36 expanded scenarios, including six whole suites. Intentionally lost alarms cover failed-verification/recovery/restart counters and mocked hosting/toast; early overlapping pane-read scheduling/count; unreadable removal listing draft guard; bulk-purge remote-qualified and raw-local guard maps; initial-snapshot blank/mode/oversize/printable/fresh-spawn callback and replay examples; fallback mobile file close and ordinary MRU; default queue overload/drain; seeded browser-page reuse and supplied missing-page URL recreation; ambiguous sleep/hibernation owner refusal and untouched bindings/origins; ordinary selection/activity/fallback priority; skip-remote success and retained hints; supplied structured-chat unsent retention and scoped removal draft eviction; caller-chat focus precedence; open/draft PR cache eviction and merged-head fallback result inventories. Retained adverse-ordering and ownership cases are narrower and do not establish equivalent replacements. No fresh runtime, native, physical provider, cross-platform, mobile or mixed-version evidence is claimed. Audit 3292 combines adopted 3285/3287/3289/3293 removals: 40 authored declarations and 47 expanded scenarios, including whole frame-editor-view, ambiguous remote-delete-refusal, unverifiable-host subscription and editor-close cleanup suites. The previously reviewed dock-badge suite was already removed upstream in PR 40895 and receives zero new removal credit. Intentionally retired alarms include background browser selection and last-tab landing; main startup fallback, SSH project cleanup/survivor routing, exact-PR contradiction/saved-push positives, replay/sidecar rollback and wrapped remote error normalization; records/snapshot missing-diff hydration, ambiguous folder-owner delete refusal, focus no-op notifications, nested editor context-only cache check, pending broadcast-first status and ordinary four-confirmation aggregation; preview-source frontmatter pruning, approved local/runtime agent dispatch, non-GitHub legacy PR cache invalidation, stale merged-head transient-error fallback, empty-queue immediate query reply and unverified-to-concrete preflight risk. Additional intentionally retired alarms are injected host subscription/unsubscribe counts, synthetic editor reveal/draft/fallback/scoped close, ambiguous unread refusals and hidden mark/read roundtrip, immediate connect backoff/noError, positive mirrored evidence-clock renewal, supplied VM failure/success projections and git-local/folder-SSH wake permutations. Remaining temporal/ownership cases are narrower; no equivalent replacement or fresh execution is claimed. Audit 3283 removes 20 authored declarations and 31 expanded scenarios, including two whole suites. Retired alarms cover PR refresh-state pruning, shared runtime subscription cleanup and store isolation, language content-change routing and older completion ownership, ordinary panel retry-timer cleanup and pending loading, four hosted-review lifetime permutations, mocked terminal creation error/order wiring, five sleep-inventory variants with pending-frame-only assertions, palette fallback/composite highlights, Windows/UNC encoded-editor input rows, mixed-repository partial failure counts, title setters and generated-title bypass/replacement, five window-close coordinator delegation/guard/finally branches, and ambiguous-old-record frame reveal. These regression checks are intentionally lost under the test-value audit; retained cases are not equivalent replacements. Prior coverage notes and receipts remain historical. Audit 3273 removes 14 authored declarations and 19 expanded scenarios across four whole suites and eight partial suites. Retired alarms cover saved-local cancellation/layout ownership, ambiguous-owner warning reset, folder attachment routing, VM false-capability bypass, abandoned reveal warmup cleanup and viewport claim deduplication/rearming, quiet unrelated remote-removal refusal, startup-command one-shot consumption, repository/floating recovery-ledger rows, fake-React pinned-scroll intent, split-ratio state identity/subscriber suppression and fractional change, cross-host project-group join refusal, three PR request-lifetime permutations, upstream-status preservation on error, and unresolved Git-owner refusal. These regression checks are intentionally lost under the test-value audit; retained scenarios are not equivalent replacements. Historical coverage receipts remain historical, including gate35 subscriber claims. Audit 3256 removes these specific alarms from the broad root unit commands: skill dialog active-share selection, close and pending-share handoff; simple keyed-record deletion; marker live-region insertion, simple landing and nine baseline policy examples; General search/control navigation inventory; orphan-count cache bootstrap; seven Codex code classifications and HTTP 429 warning mapping; two skill unread-root verdict examples; peer-mail payload and conversation-ID rejection; and the GitHub organization TABLE text-field optimistic rollback/failed-envelope example. These include real behaviors; retained tests do not provide equivalent coverage for every removed scenario. Mobile losses are recorded separately and are not coverage of these root commands. Audit3246 retires NewRowsMarker reveal/no-repeat and pane-scoped beforeinput checks; skill-owner option availability/count/dedup/order; six styled Input/Textarea IME forwarding rows; the static Codex/OpenCode smart-key inventory; tab-map AST ratchet diagnostic fixtures; child-roster work-budget and retained-aggregate alarms; malformed persisted floating-cwd fallback/no-crash/empty exact-root checks; the unanswered-host empty-list discriminator; the direct invalidated-cache commit-false assertion; one redundant digit-keyup IME row; cached non-supported Claude title-generator rows; and the duplicate late naming-result singleton. These root broad commands lose those specific alarms without equivalent replacement. Distinct retained owner/state checks have their own bounded claims; the real scheduler still rejects stale response data, while the direct false-return alarm is retired. Audit3231 retires supported-host restore-pane key mapping, closed/open creation-sidebar toggle visibility, unrelated scope-error/null classification and quick-submit reveal/no-create checks. These broad commands lose those real narrow alarms; no replacement coverage is claimed. Audit3219 removes the synthetic Cmd+J extra-source suite; this broad command no longer checks its match/tie placement and selection, announced count, empty-query cap, or workspace hiding with retained recent tabs. No replacement coverage is claimed. Audit3209 composes approved sources3202/3206: deliberately retires seven authored/expanded cases in four whole suites without equivalent replacement. Work-item queries lose real GitHub/GitLab oversized ASCII secret-prefix empty-query and whitespace-before-trim refusal alarms; inputs share the imported size bound and exercise only its fast length branch, with no multibyte or actual provider/exposure guarantee. Skill sharing loses complete/partial managed-bundle and destination-ambiguity association checks plus three negative origin/path/scheme admission examples; these do not establish uploaded contents, arbitrary-URL fetching, authorization or execution. Retain exact originless-project direct-link fallback, cloud-delete confirmation, bundled-target repair/owner isolation and explicit Windows-host preference over stale WSL suites. Rejected3201 runtime-preference removal is excluded. No real cloud/network/host/disk, mobile or mixed-version execution validation is claimed. Audit3200 composes approved source3194: deliberately retires thirteen authored registrations/twenty-seven expanded cases in six whole automation host/list policy suites without equivalent replacement. Real RPC category/retryability and wrapped-timeout recognition, unscoped-failure/scoped-success health evidence precedence, exact-ID create selectors and per-run workspace omission, paired-web local/SSH/absent host catalog routing, incompatible/removed/unhydrated/offline execution health, runtime-before-nested-SSH recovery dispatch, and no-owned-focus/successor/foreign-list focus policy alarms are consciously lost. Retain exact20line orphan allow/refuse/precondition and exact90line cross-host same-ID search suites. No retry-timer/fence lifecycle, actual reconnect/network/write delivery, native focus, mobile/mixed-version runtime or disk persistence coverage is claimed. Audit3191 combines approved source3182/3187/3188: deliberately retires thirteen authored Vitest registrations and fifteen expanded cases, including five whole suites, without equivalent replacement. Attachment intake loses real portal/native-capture terminal interception and unowned-container refusal, immediate child-only committed availability/claim-ref negotiation and delivery, and direct-target over stable focused/background composer routing through disable/re-enable/remount and independent question focus. Exact destination/cache/draft and final-stat owner/workspace/File-release suites remain; they do not replace Surface recipient routing. Automation authoring loses destination runtime catalog membership, local/direct-SSH exclusion of paired-runtime repos, unknown-runtime empty catalog, logical project/host/setup/repo/path context payload, and missing/nonready setup refusal; these were genuine direct helper alarms, while exact schedule transformation, legacy schedule and setup-decision suites remain. Agent picker loses setup-chat/terminal/missing-installer/unsupported-or-unknown-host row projection samples and the ordinary unsearched menu variant; the entire original26-line resume recipe suite remains, including reported bypass versus default/absent permission modes, as does the exact search-result menu callback with its fixtures, model/effort commits and staged Arguments reopen outcome. Rejected predecessor3180 full recipe deletion is excluded. No actual native drag/cursor/focus/IME, upload bytes or disk/restart persistence, full automation save/scheduler/runtime transport, real resume-process flags/environment delivery, or native menu/rendered layout validation is claimed. Audit3178 combines source3169/3170/3175: deliberately retires eight authored units (six Vitest cases and two imperative custom relay scenarios), including two whole suites, without equivalent replacement. Voice Section loses per-model pending-delete isolation across interleaved A/B completion and the two-success refresh-call alarm; exact VoicePane delayed key-clear/newer enabled-toggle merge remains and does not replace row deletion coverage. Speech loses dedicated rating-scale/inclusive-ceiling, unsupported-versus-unmeasured, explicit/system-language precedence/locale alias, accuracy versus fast named/default/best-measured selection, and unmeasured/no-match examples; exact offered-user-pick versus retired-selection case and its fixture remain. Relay loses legacy ping-delivery count/liveness sampled before the silence deadline and grouped malformed Bearer/host-ID 401/429 routing checks; twelve real Worker/DurableObject/shipped-client scenarios remain, not equivalent replacement for those narrow alarms. Six prior speech cases are not all deleted: approved successor3175 keeps the original user-choice case. No actual credential/file persistence, native/GPU/engine/download delivery, production assignment policy or deployed-runtime validation is claimed by this reduction. Audit3165 combines source3160/3162: deliberately retires six authored/expanded cases across three whole suites without equivalent replacement. Launch/status losses: observed React-render pending/resuming coordination across settings and deferred offer read; stale-offer reread suppressing dialog reopen; held-local-chat recovery visibility with new-chat preferences off; disabled-local admission avoiding offer RPC despite an injected but unconsumed paired-tab fixture; and run-only lost-reply uncertainty reachability until direct viewed-run retirement. Launch probe does not prove arbitrary synchronous-store atomicity, the paired fixture is not remote runtime enrollment, and the status case directly marks viewed state rather than rendering the summary. Crew-hook losses: old-host method_not_found cache persists across party changes but is released by independently supplied connection generation/verified pairing status or pairing revision, with actual frame publication and teardown. These are real narrow coordination, admission, uncertainty and mixed-version cache alarms consciously lost. Exact web verified-runtime writer handoff guard remains; it does not replace those alarms or prove live host/native/mobile delivery. Audit3156 combines3147/3150/3152/3153/3154: deliberately retires39authored/40expanded native-chat recovery cases, eight whole suites and two orphan test-support files without equivalent replacement. Lost alarms: lost-reply unconfirmed reconciliation, skipped rows/counts and missed-frame repair, unknown/pending outcome and omitted-failure-list compatibility, uncertain history after dismissal, retry/refusal/dismiss lifecycle, hidden/consumed picker ownership, result-tree keyboard focus/disclosure and all-skipped retirement; unconfirmed-over-conflict guidance and failed-chat changes despite older host timestamps; nearest-listed ancestor/cyclic forest shape, descendant membership, host ordering/missing-host local fallback; skipped/readiness/admission counts, provisional skip/progress monotonicity, early per-chat verdicts with batch pending protection, older-host waiting, start-slot/delivery distinction, retry-over-failure and unknown-after-withdrawal attention; remote snooze/reconnect/reoffer, unseen mixed summary through open/close, watched completion retirement, new success beside old failure, failed-reread mixed-result preservation, filter/collapse completion resets, retry summary replacement and current-offer/history selection; cross-host workspace identity, rendered cyclic reachability, nested tri-state/toggle propagation, project eligibility isolation and collapse preserving selection. Exact fallback-list completion barrier, batched verdict/cleanup retention, stale-read versus dismissal publication race, and requested-but-never-rendered finished-run retirement remain; they do not replace retired alarms. Audit3146 combines source reviews3132/3133/3135/3138/3143: intentionally retire20authored/31expanded cases without equivalent replacement. Provider-session losses: structured-native terminal-resume exclusion, metadata-less completed identity, new-turn completion clearing, Pi provider-only/periodic/manual promotion, changed-transcript launch-config isolation, Pi/omp/prime-agent completed-session remote/manual-shutdown promotion, and quit/done precedence over heartbeat. Side-thread/question losses: finished-pane acquisition, hidden title/recap states, local/relay/relay-done conversation takeover with prompt/session/child resets, plain-message abandonment, compaction/session replacement and completion resets. Codex startup losses: incoming-owner cached child replacement, old-relay foreign live-session correction, completed foreign-root turn-fact permutations. Transcript losses: real temporary-JSONL partial sibling/final-child completion, unlabelled child attribution, compact cached replay preservation and100/1000completed-child roster retention/release. Compiler-ratchet losses: valid-line uncompiled-list parser grammar examples and injected-existence stale-path filtering; these did not exercise actual filesystem canonicalization or build exclusion. These are real lifecycle, ownership, replay, liveness and retention alarms, including recent#40246 regressions, deliberately lost. Retained conditional record replacement, clockless root/SSH owner isolation, persisted main-thread fork rejection, partial/final question-answer lifetime, cached-roster/missing-ID/live HTTP/durable startup boundaries and restarted-relay refusal/acceptance do not replace those losses. No native/SSH/WSL execution or equivalent coverage is claimed. Audit3128 scoped coverage reduction: Audit3121 removes VoiceDictationLanguageSetting.test.tsx (Spanish-to-es callback and unsupported-model Korean option presence) and voice-speech-model-rows.test.ts (provider/language-order/retired-on-disk list policy); these real narrow alarms are deliberately retired without replacement. VoiceSpeechModelSection per-model concurrent deletion remains unchanged. Audit3122 removes the direct absolute/parent-segment sparse-directory exception-type sample and the five-row IPC sparse-preset error-code/non-save table (two authored/six expanded cases). Those real typed-validation and IPC refusal/error-code alarms are deliberately retired. Keep both real symlink/junction floating-directory trust cases and the minimal RPC structured validation-reason serialization case. The RPC case does not replace IPC save/refusal behavior, typed normalization for both path inputs, actual Git sparse checkout or rendered localization. No equivalent replacement or fresh test/runtime/platform/remote/performance validation is claimed. Audit3124 removes ExperimentalPane.test.tsx (ordinary Pet switch callback), WorkspaceDirectorySetting.test.tsx (padded absolute saved-path normalization/no-write blur), and repository-search.perf.test.ts (navigation/selected-pane builder-call policy, fixture cardinality/nonempty entries and renamed project keyword inclusion). These real narrow alarms are retired without replacement; RepositoryPane.search.test.tsx search-to-sparse-editor request remains unchanged. Audit3129: resolver Windows case-insensitive and POSIX case-sensitive configured-env composition plus mocked-base launch-preflight Windows composition are intentionally no longer checked by the two deleted suites. No equivalent coverage claimed. Keep runtime-structured-agent-host-env.test.ts unchanged: configured Windows Claude-home account identity and host-account precedence remain checked. Audit3114 incorporates source3101: retire three structured Claude child-environment wrapper cases covering inherited stamp isolation/default and explicit entrypoint, Windows SDK-key canonicalization/default/duplicate-key order, and configured lookup/final environment/config-dir conjunction. Keep direct auth/session sanitation and Windows-versus-Linux overlay checks, actual executable lookup from supplied inherited PATH, native Windows child environment delivery, and stale option-mutation fencing. These are not equivalent replacements for the retired wrapper alarms. No fresh test/runtime, real login-shell probe, Claude SDK startup, remote/mixed-version, UI or performance result is claimed. Audit3114 incorporates source3105: retire 17 authored/20 expanded daemon launch-note cases, including the entire two-case SessionLaunchNote suite. Deliberately lose split-marker carry across same-token re-arm, stale-token retirement refusal, foreground tri-state and serial settlement, omitted-note/no-incarnation mixed-version policy, sticky retirement, first-incarnation/replacement launch preservation and held-launch precedence. Keep only the unchanged unresolved foreground-read race against a later finished attach. Supplied notes/foreground and runtime calls do not establish actual daemon/main restart, SSH, native Windows observation, mobile UI, equivalent replacement or fresh runtime/performance validation. Audit3114 incorporates source3109: retire six authored/35 expanded pricing cases: 21 accepted model-name examples, 10 unsupported/future-model fail-closed examples, malformed TTL clamp, unknown-model estimate refusal, flat-model long-context disregard and oversized long-context clamp. Keep mixed five-minute/one-hour write allocation and short/all-long/mixed long-context allocation with original fixed oracles. Real parser/refusal/bounds alarms are knowingly lost without equivalent replacement; retained tests do not validate provider rates, actual billing or request threshold classification. Preserve the archived usage-scan-append source-freeze receipt without transferring historical execution/performance credit. No fresh runtime result is claimed. Audit3108 source-only reduction (3094/3095/3100): retire 27 authored/30 expanded cases, including complete markdown view-state, file-preview link-open and CLI agent-server-route suites, without replacement. Deliberate losses include preview visibility/reference lifetime and same-path owners; SSH stat, directory/missing-target, explicit-null owner, nonmarkdown line/column, local URI routing, remote-to-client guard and same-file reuse; document-preview source-owner/folder/reuse routing, stable grant location and outside-workspace POSIX/Windows request projection; and verified remote CLI send/check refusal, suggested --on argv/copy, shell no-probe bypass, unverified-launch admission and older-peer refusal. Retain two markdown source-runtime/qualified-reveal alarms, one stale grant-rejection fence and two remote read/mutation evidence policies, with original callbacks. Final last-wins reveal did not prove transient cancellation; CLI prerequisite did not prove no real send, and envelope tests do not execute server refusal. No fresh runtime, rendered UI, actual file/SSH/paired transport, authorization, mixed-version or performance result is claimed. Audit3096 source-only reduction (3087/3088): retire 69 authored/76 expanded cases, including complete recovery-portals and reconnect-banner suites. Intentionally lose dead/default TUI replay, generated alternate-frame style composition, reset/mode/dimension and legacy missing-mode-boundary alarms, UI notice/action/reveal policies, and isolated recovery lifecycle variants, without equivalent replacement. Retained registrations and callbacks are unchanged; headless cells are not pixels, and no fresh runtime, host, SSH, WSL, rendered-app or performance result is claimed. Audit3086 source-only reduction (3079/3080/3081): intentionally retire 93 authored/100 expanded mock-boundary cases, including the complete spawn-errors and SSH reconnect overlay suites, without replacement. Retired alarms include spawn classification/ownership, reply ceilings and renderer-write failure recovery, disconnect/detach fencing branches, authority facts, and overlay retry/visibility wiring. Retained callbacks are unchanged; no fresh execution, real PTY/SSH, rendered UI, or performance result is claimed. Audit2432: The broad unit command loses the isolated BranchPicker open-change notification sample. Its unique true/false callback alarm is intentionally retired; reopening/status-refresh behavior was not exercised. No equivalent replacement or fresh validation of the reduced selector is claimed. Audit2425: The broad unit command loses the workspace-copy-status supplied readError forwarding sample. It did not exercise the branch-switch blocking promised by its title. This alarm is intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2417: The broad unit command loses two ordinary clean Git cherry-pick/revert success samples and two terminal startup foreground-read work-budget samples. These unique alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2412: The broad unit command loses the whole six-case fake-React-hook scroll-anchor suite, two generic draft-retention samples, a simple new-agent order sample, a real history-publication batching-count sample, an unmounted handoff abort/timer sample and three basic WSL preview/error samples. These alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2404: The broad unit command loses the standalone share-name lookup 503 propagation suite, initial deletion placement-kind sample, direct changed-mtime stale sample, first-pass rollback existence example and abandoned-preparation directory sample. These exact alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2397 review amendment: The broad unit command loses three standalone suites, two partial-case definitions and two URL table rows across package/download/placement tests. Keep initial wrong-port authorization, modified independent-copy digest refusal and abort-after-begin cancellation dispatch. The remaining alarms are deliberately retired; no equivalent complete replacement or fresh validation of the reduced selector is claimed. Audit2393 current-parent refresh2401: Remove the basic skill-install service alias sample and original public managed-remove receiptless refusal case. Preserve the upstream request ownership suite and transaction interruption coverage. No equivalent complete replacement or fresh validation of the reduced selector is claimed. Audit2389: The broad unit command loses the missing-preview suite, plain-global destination sample and prepublished-receipt recovery example. No equivalent replacement or fresh validation of the reduced selector is claimed. Audit2385: The broad unit command loses four authored walker/staging/protocol examples (six expanded cases); no equivalent replacement or fresh validation is claimed for the reduced suite. Audit2383: The unscoped Vitest command no longer includes the removed Antigravity catalogue suite; its exact provider-root/owner example has no equivalent replacement or fresh validation claim. Audit2377/2381: The unscoped Vitest command includes the reduced bundled-skill and native-discovery suites; the eight removed backup/legacy/catalogue/symlink/SSH-builder examples have no replacement-equivalence or fresh validation claim here. Audit2133 current-parent preparation: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2095 current-parent preparation2126: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit1579 removes workflow/manifest/regex/private binary-header and diagnostic metric inventories, fixture selectors, injected forwarding/platform/signature/process examples, unproven overlap and internal churn counters without equivalent replacement coverage. Retains actual Git trust/diffs; filesystem hash/ELF-region/native discovery; child CLI module repair; compiler/lock/publication/rollback and synthetic Electron install/cache ownership; executable shell quoting/exit; controlled notary/timer cleanup; local patched extractor file/AST freshness; real Chromium/WebKit CSP/sandbox/HTTPS image/referrer/link/preservation controls under parsed Android headers. Five unchanged setup-pnpm/VM request-cleanup definitions reviewed and not rerun. GitHub, installer/archive, OS metric, client, native delegate, compressor, builder and Apple boundaries injected or absent where recorded. No actual native PTY, shipped full/native app, real Actions/cache/npm signature authority, downloaded Electron archive, real objdump/linker/native CLI/AppImage, signing/NSIS/notary/upload/updater or live freeze proof. Historical scope before this audit: Published Linux 1.4.188 desktop against current source in both directions; scheduled weekly and manually runnable. No required PR check.", "motivatingLinks": ["https://github.com/stablyai/orca/actions/runs/34069063016"], "invariant": "A paired client and host without client-hosted browser capabilities retain server-hosted browser placement across supported version skew.", - "oracle": "Audit 3292 combines adopted 3285/3287/3289/3293 removals: 40 authored declarations and 47 expanded scenarios, including whole frame-editor-view, ambiguous remote-delete-refusal, unverifiable-host subscription and editor-close cleanup suites. The previously reviewed dock-badge suite was already removed upstream in PR 40895 and receives zero new removal credit. Intentionally retired alarms include background browser selection and last-tab landing; main startup fallback, SSH project cleanup/survivor routing, exact-PR contradiction/saved-push positives, replay/sidecar rollback and wrapped remote error normalization; records/snapshot missing-diff hydration, ambiguous folder-owner delete refusal, focus no-op notifications, nested editor context-only cache check, pending broadcast-first status and ordinary four-confirmation aggregation; preview-source frontmatter pruning, approved local/runtime agent dispatch, non-GitHub legacy PR cache invalidation, stale merged-head transient-error fallback, empty-queue immediate query reply and unverified-to-concrete preflight risk. Additional intentionally retired alarms are injected host subscription/unsubscribe counts, synthetic editor reveal/draft/fallback/scoped close, ambiguous unread refusals and hidden mark/read roundtrip, immediate connect backoff/noError, positive mirrored evidence-clock renewal, supplied VM failure/success projections and git-local/folder-SSH wake permutations. Remaining temporal/ownership cases are narrower; no equivalent replacement or fresh execution is claimed. Audit 3283 removes 20 authored declarations and 31 expanded scenarios, including two whole suites. Retired alarms cover PR refresh-state pruning, shared runtime subscription cleanup and store isolation, language content-change routing and older completion ownership, ordinary panel retry-timer cleanup and pending loading, four hosted-review lifetime permutations, mocked terminal creation error/order wiring, five sleep-inventory variants with pending-frame-only assertions, palette fallback/composite highlights, Windows/UNC encoded-editor input rows, mixed-repository partial failure counts, title setters and generated-title bypass/replacement, five window-close coordinator delegation/guard/finally branches, and ambiguous-old-record frame reveal. These regression checks are intentionally lost under the test-value audit; retained cases are not equivalent replacements. Prior coverage notes and receipts remain historical. Audit 3273 removes 14 authored declarations and 19 expanded scenarios across four whole suites and eight partial suites. Retired alarms cover saved-local cancellation/layout ownership, ambiguous-owner warning reset, folder attachment routing, VM false-capability bypass, abandoned reveal warmup cleanup and viewport claim deduplication/rearming, quiet unrelated remote-removal refusal, startup-command one-shot consumption, repository/floating recovery-ledger rows, fake-React pinned-scroll intent, split-ratio state identity/subscriber suppression and fractional change, cross-host project-group join refusal, three PR request-lifetime permutations, upstream-status preservation on error, and unresolved Git-owner refusal. These regression checks are intentionally lost under the test-value audit; retained scenarios are not equivalent replacements. Historical coverage receipts remain historical, including gate35 subscriber claims. Audit 3256 removes these specific alarms from the broad root unit commands: skill dialog active-share selection, close and pending-share handoff; simple keyed-record deletion; marker live-region insertion, simple landing and nine baseline policy examples; General search/control navigation inventory; orphan-count cache bootstrap; seven Codex code classifications and HTTP 429 warning mapping; two skill unread-root verdict examples; peer-mail payload and conversation-ID rejection; and the GitHub organization TABLE text-field optimistic rollback/failed-envelope example. These include real behaviors; retained tests do not provide equivalent coverage for every removed scenario. Mobile losses are recorded separately and are not coverage of these root commands. Audit3246 retires NewRowsMarker reveal/no-repeat and pane-scoped beforeinput checks; skill-owner option availability/count/dedup/order; six styled Input/Textarea IME forwarding rows; the static Codex/OpenCode smart-key inventory; tab-map AST ratchet diagnostic fixtures; child-roster work-budget and retained-aggregate alarms; malformed persisted floating-cwd fallback/no-crash/empty exact-root checks; the unanswered-host empty-list discriminator; the direct invalidated-cache commit-false assertion; one redundant digit-keyup IME row; cached non-supported Claude title-generator rows; and the duplicate late naming-result singleton. These root broad commands lose those specific alarms without equivalent replacement. Distinct retained owner/state checks have their own bounded claims; the real scheduler still rejects stale response data, while the direct false-return alarm is retired. Audit3231 retires supported-host restore-pane key mapping, closed/open creation-sidebar toggle visibility, unrelated scope-error/null classification and quick-submit reveal/no-create checks. These broad commands lose those real narrow alarms; no replacement coverage is claimed. Audit3219 removes the synthetic Cmd+J extra-source suite; this broad command no longer checks its match/tie placement and selection, announced count, empty-query cap, or workspace hiding with retained recent tabs. No replacement coverage is claimed. Audit3209 composes approved sources3202/3206: deliberately retires seven authored/expanded cases in four whole suites without equivalent replacement. Work-item queries lose real GitHub/GitLab oversized ASCII secret-prefix empty-query and whitespace-before-trim refusal alarms; inputs share the imported size bound and exercise only its fast length branch, with no multibyte or actual provider/exposure guarantee. Skill sharing loses complete/partial managed-bundle and destination-ambiguity association checks plus three negative origin/path/scheme admission examples; these do not establish uploaded contents, arbitrary-URL fetching, authorization or execution. Retain exact originless-project direct-link fallback, cloud-delete confirmation, bundled-target repair/owner isolation and explicit Windows-host preference over stale WSL suites. Rejected3201 runtime-preference removal is excluded. No real cloud/network/host/disk, mobile or mixed-version execution validation is claimed. Audit3200 composes approved source3194: deliberately retires thirteen authored registrations/twenty-seven expanded cases in six whole automation host/list policy suites without equivalent replacement. Real RPC category/retryability and wrapped-timeout recognition, unscoped-failure/scoped-success health evidence precedence, exact-ID create selectors and per-run workspace omission, paired-web local/SSH/absent host catalog routing, incompatible/removed/unhydrated/offline execution health, runtime-before-nested-SSH recovery dispatch, and no-owned-focus/successor/foreign-list focus policy alarms are consciously lost. Retain exact20line orphan allow/refuse/precondition and exact90line cross-host same-ID search suites. No retry-timer/fence lifecycle, actual reconnect/network/write delivery, native focus, mobile/mixed-version runtime or disk persistence coverage is claimed. Audit3191 combines approved source3182/3187/3188: deliberately retires thirteen authored Vitest registrations and fifteen expanded cases, including five whole suites, without equivalent replacement. Attachment intake loses real portal/native-capture terminal interception and unowned-container refusal, immediate child-only committed availability/claim-ref negotiation and delivery, and direct-target over stable focused/background composer routing through disable/re-enable/remount and independent question focus. Exact destination/cache/draft and final-stat owner/workspace/File-release suites remain; they do not replace Surface recipient routing. Automation authoring loses destination runtime catalog membership, local/direct-SSH exclusion of paired-runtime repos, unknown-runtime empty catalog, logical project/host/setup/repo/path context payload, and missing/nonready setup refusal; these were genuine direct helper alarms, while exact schedule transformation, legacy schedule and setup-decision suites remain. Agent picker loses setup-chat/terminal/missing-installer/unsupported-or-unknown-host row projection samples and the ordinary unsearched menu variant; the entire original26-line resume recipe suite remains, including reported bypass versus default/absent permission modes, as does the exact search-result menu callback with its fixtures, model/effort commits and staged Arguments reopen outcome. Rejected predecessor3180 full recipe deletion is excluded. No actual native drag/cursor/focus/IME, upload bytes or disk/restart persistence, full automation save/scheduler/runtime transport, real resume-process flags/environment delivery, or native menu/rendered layout validation is claimed. Audit3178 combines source3169/3170/3175: deliberately retires eight authored units (six Vitest cases and two imperative custom relay scenarios), including two whole suites, without equivalent replacement. Voice Section loses per-model pending-delete isolation across interleaved A/B completion and the two-success refresh-call alarm; exact VoicePane delayed key-clear/newer enabled-toggle merge remains and does not replace row deletion coverage. Speech loses dedicated rating-scale/inclusive-ceiling, unsupported-versus-unmeasured, explicit/system-language precedence/locale alias, accuracy versus fast named/default/best-measured selection, and unmeasured/no-match examples; exact offered-user-pick versus retired-selection case and its fixture remain. Relay loses legacy ping-delivery count/liveness sampled before the silence deadline and grouped malformed Bearer/host-ID 401/429 routing checks; twelve real Worker/DurableObject/shipped-client scenarios remain, not equivalent replacement for those narrow alarms. Six prior speech cases are not all deleted: approved successor3175 keeps the original user-choice case. No actual credential/file persistence, native/GPU/engine/download delivery, production assignment policy or deployed-runtime validation is claimed by this reduction. Audit3165 combines source3160/3162: deliberately retires six authored/expanded cases across three whole suites without equivalent replacement. Launch/status losses: observed React-render pending/resuming coordination across settings and deferred offer read; stale-offer reread suppressing dialog reopen; held-local-chat recovery visibility with new-chat preferences off; disabled-local admission avoiding offer RPC despite an injected but unconsumed paired-tab fixture; and run-only lost-reply uncertainty reachability until direct viewed-run retirement. Launch probe does not prove arbitrary synchronous-store atomicity, the paired fixture is not remote runtime enrollment, and the status case directly marks viewed state rather than rendering the summary. Crew-hook losses: old-host method_not_found cache persists across party changes but is released by independently supplied connection generation/verified pairing status or pairing revision, with actual frame publication and teardown. These are real narrow coordination, admission, uncertainty and mixed-version cache alarms consciously lost. Exact web verified-runtime writer handoff guard remains; it does not replace those alarms or prove live host/native/mobile delivery. Audit3156 combines3147/3150/3152/3153/3154: deliberately retires39authored/40expanded native-chat recovery cases, eight whole suites and two orphan test-support files without equivalent replacement. Lost alarms: lost-reply unconfirmed reconciliation, skipped rows/counts and missed-frame repair, unknown/pending outcome and omitted-failure-list compatibility, uncertain history after dismissal, retry/refusal/dismiss lifecycle, hidden/consumed picker ownership, result-tree keyboard focus/disclosure and all-skipped retirement; unconfirmed-over-conflict guidance and failed-chat changes despite older host timestamps; nearest-listed ancestor/cyclic forest shape, descendant membership, host ordering/missing-host local fallback; skipped/readiness/admission counts, provisional skip/progress monotonicity, early per-chat verdicts with batch pending protection, older-host waiting, start-slot/delivery distinction, retry-over-failure and unknown-after-withdrawal attention; remote snooze/reconnect/reoffer, unseen mixed summary through open/close, watched completion retirement, new success beside old failure, failed-reread mixed-result preservation, filter/collapse completion resets, retry summary replacement and current-offer/history selection; cross-host workspace identity, rendered cyclic reachability, nested tri-state/toggle propagation, project eligibility isolation and collapse preserving selection. Exact fallback-list completion barrier, batched verdict/cleanup retention, stale-read versus dismissal publication race, and requested-but-never-rendered finished-run retirement remain; they do not replace retired alarms. Audit3146 combines source reviews3132/3133/3135/3138/3143: intentionally retire20authored/31expanded cases without equivalent replacement. Provider-session losses: structured-native terminal-resume exclusion, metadata-less completed identity, new-turn completion clearing, Pi provider-only/periodic/manual promotion, changed-transcript launch-config isolation, Pi/omp/prime-agent completed-session remote/manual-shutdown promotion, and quit/done precedence over heartbeat. Side-thread/question losses: finished-pane acquisition, hidden title/recap states, local/relay/relay-done conversation takeover with prompt/session/child resets, plain-message abandonment, compaction/session replacement and completion resets. Codex startup losses: incoming-owner cached child replacement, old-relay foreign live-session correction, completed foreign-root turn-fact permutations. Transcript losses: real temporary-JSONL partial sibling/final-child completion, unlabelled child attribution, compact cached replay preservation and100/1000completed-child roster retention/release. Compiler-ratchet losses: valid-line uncompiled-list parser grammar examples and injected-existence stale-path filtering; these did not exercise actual filesystem canonicalization or build exclusion. These are real lifecycle, ownership, replay, liveness and retention alarms, including recent#40246 regressions, deliberately lost. Retained conditional record replacement, clockless root/SSH owner isolation, persisted main-thread fork rejection, partial/final question-answer lifetime, cached-roster/missing-ID/live HTTP/durable startup boundaries and restarted-relay refusal/acceptance do not replace those losses. No native/SSH/WSL execution or equivalent coverage is claimed. Audit3128 scoped coverage reduction: Audit3121 removes VoiceDictationLanguageSetting.test.tsx (Spanish-to-es callback and unsupported-model Korean option presence) and voice-speech-model-rows.test.ts (provider/language-order/retired-on-disk list policy); these real narrow alarms are deliberately retired without replacement. VoiceSpeechModelSection per-model concurrent deletion remains unchanged. Audit3122 removes the direct absolute/parent-segment sparse-directory exception-type sample and the five-row IPC sparse-preset error-code/non-save table (two authored/six expanded cases). Those real typed-validation and IPC refusal/error-code alarms are deliberately retired. Keep both real symlink/junction floating-directory trust cases and the minimal RPC structured validation-reason serialization case. The RPC case does not replace IPC save/refusal behavior, typed normalization for both path inputs, actual Git sparse checkout or rendered localization. No equivalent replacement or fresh test/runtime/platform/remote/performance validation is claimed. Audit3124 removes ExperimentalPane.test.tsx (ordinary Pet switch callback), WorkspaceDirectorySetting.test.tsx (padded absolute saved-path normalization/no-write blur), and repository-search.perf.test.ts (navigation/selected-pane builder-call policy, fixture cardinality/nonempty entries and renamed project keyword inclusion). These real narrow alarms are retired without replacement; RepositoryPane.search.test.tsx search-to-sparse-editor request remains unchanged. Audit3129: resolver Windows case-insensitive and POSIX case-sensitive configured-env composition plus mocked-base launch-preflight Windows composition are intentionally no longer checked by the two deleted suites. No equivalent coverage claimed. Keep runtime-structured-agent-host-env.test.ts unchanged: configured Windows Claude-home account identity and host-account precedence remain checked. Audit3114 incorporates source3101: retire three structured Claude child-environment wrapper cases covering inherited stamp isolation/default and explicit entrypoint, Windows SDK-key canonicalization/default/duplicate-key order, and configured lookup/final environment/config-dir conjunction. Keep direct auth/session sanitation and Windows-versus-Linux overlay checks, actual executable lookup from supplied inherited PATH, native Windows child environment delivery, and stale option-mutation fencing. These are not equivalent replacements for the retired wrapper alarms. No fresh test/runtime, real login-shell probe, Claude SDK startup, remote/mixed-version, UI or performance result is claimed. Audit3114 incorporates source3105: retire 17 authored/20 expanded daemon launch-note cases, including the entire two-case SessionLaunchNote suite. Deliberately lose split-marker carry across same-token re-arm, stale-token retirement refusal, foreground tri-state and serial settlement, omitted-note/no-incarnation mixed-version policy, sticky retirement, first-incarnation/replacement launch preservation and held-launch precedence. Keep only the unchanged unresolved foreground-read race against a later finished attach. Supplied notes/foreground and runtime calls do not establish actual daemon/main restart, SSH, native Windows observation, mobile UI, equivalent replacement or fresh runtime/performance validation. Audit3114 incorporates source3109: retire six authored/35 expanded pricing cases: 21 accepted model-name examples, 10 unsupported/future-model fail-closed examples, malformed TTL clamp, unknown-model estimate refusal, flat-model long-context disregard and oversized long-context clamp. Keep mixed five-minute/one-hour write allocation and short/all-long/mixed long-context allocation with original fixed oracles. Real parser/refusal/bounds alarms are knowingly lost without equivalent replacement; retained tests do not validate provider rates, actual billing or request threshold classification. Preserve the archived usage-scan-append source-freeze receipt without transferring historical execution/performance credit. No fresh runtime result is claimed. Audit3108 source-only reduction (3094/3095/3100): retire 27 authored/30 expanded cases, including complete markdown view-state, file-preview link-open and CLI agent-server-route suites, without replacement. Deliberate losses include preview visibility/reference lifetime and same-path owners; SSH stat, directory/missing-target, explicit-null owner, nonmarkdown line/column, local URI routing, remote-to-client guard and same-file reuse; document-preview source-owner/folder/reuse routing, stable grant location and outside-workspace POSIX/Windows request projection; and verified remote CLI send/check refusal, suggested --on argv/copy, shell no-probe bypass, unverified-launch admission and older-peer refusal. Retain two markdown source-runtime/qualified-reveal alarms, one stale grant-rejection fence and two remote read/mutation evidence policies, with original callbacks. Final last-wins reveal did not prove transient cancellation; CLI prerequisite did not prove no real send, and envelope tests do not execute server refusal. No fresh runtime, rendered UI, actual file/SSH/paired transport, authorization, mixed-version or performance result is claimed. Audit3096 source-only reduction (3087/3088): retire 69 authored/76 expanded cases, including complete recovery-portals and reconnect-banner suites. Intentionally lose dead/default TUI replay, generated alternate-frame style composition, reset/mode/dimension and legacy missing-mode-boundary alarms, UI notice/action/reveal policies, and isolated recovery lifecycle variants, without equivalent replacement. Retained registrations and callbacks are unchanged; headless cells are not pixels, and no fresh runtime, host, SSH, WSL, rendered-app or performance result is claimed. Audit3086 source-only reduction (3079/3080/3081): intentionally retire 93 authored/100 expanded mock-boundary cases, including the complete spawn-errors and SSH reconnect overlay suites, without replacement. Retired alarms include spawn classification/ownership, reply ceilings and renderer-write failure recovery, disconnect/detach fencing branches, authority facts, and overlay retry/visibility wiring. Retained callbacks are unchanged; no fresh execution, real PTY/SSH, rendered UI, or performance result is claimed. Audit2432: The broad unit command loses the isolated BranchPicker open-change notification sample. Its unique true/false callback alarm is intentionally retired; reopening/status-refresh behavior was not exercised. No equivalent replacement or fresh validation of the reduced selector is claimed. Audit2425: The broad unit command loses the workspace-copy-status supplied readError forwarding sample. It did not exercise the branch-switch blocking promised by its title. This alarm is intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2417: The broad unit command loses two ordinary clean Git cherry-pick/revert success samples and two terminal startup foreground-read work-budget samples. These unique alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2412: The broad unit command loses the whole six-case fake-React-hook scroll-anchor suite, two generic draft-retention samples, a simple new-agent order sample, a real history-publication batching-count sample, an unmounted handoff abort/timer sample and three basic WSL preview/error samples. These alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2404: The broad unit command loses the standalone share-name lookup 503 propagation suite, initial deletion placement-kind sample, direct changed-mtime stale sample, first-pass rollback existence example and abandoned-preparation directory sample. These exact alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2397 review amendment: The broad unit command loses three standalone suites, two partial-case definitions and two URL table rows across package/download/placement tests. Keep initial wrong-port authorization, modified independent-copy digest refusal and abort-after-begin cancellation dispatch. The remaining alarms are deliberately retired; no equivalent complete replacement or fresh validation of the reduced selector is claimed. Audit2393 current-parent refresh2401: Remove the basic skill-install service alias sample and original public managed-remove receiptless refusal case. Preserve the upstream request ownership suite and transaction interruption coverage. No equivalent complete replacement or fresh validation of the reduced selector is claimed. Audit2389: The broad unit command loses the missing-preview suite, plain-global destination sample and prepublished-receipt recovery example. No equivalent replacement or fresh validation of the reduced selector is claimed. Audit2385: The broad unit command loses four authored walker/staging/protocol examples (six expanded cases); no equivalent replacement or fresh validation is claimed for the reduced suite. Audit2383: The unscoped Vitest command no longer includes the removed Antigravity catalogue suite; its exact provider-root/owner example has no equivalent replacement or fresh validation claim. Audit2377/2381: The unscoped Vitest command includes the reduced bundled-skill and native-discovery suites; the eight removed backup/legacy/catalogue/symlink/SSH-builder examples have no replacement-equivalence or fresh validation claim here. Audit2133 current-parent preparation: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2095 current-parent preparation2126: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Require both existing named browser placement scenarios to pass three times with one attempt, zero skips, zero failures, and no report errors.", + "oracle": "Audit 3301 combines adopted source batches 3296 and 3299: retire 27 authored declarations and 36 expanded scenarios, including six whole suites. Intentionally lost alarms cover failed-verification/recovery/restart counters and mocked hosting/toast; early overlapping pane-read scheduling/count; unreadable removal listing draft guard; bulk-purge remote-qualified and raw-local guard maps; initial-snapshot blank/mode/oversize/printable/fresh-spawn callback and replay examples; fallback mobile file close and ordinary MRU; default queue overload/drain; seeded browser-page reuse and supplied missing-page URL recreation; ambiguous sleep/hibernation owner refusal and untouched bindings/origins; ordinary selection/activity/fallback priority; skip-remote success and retained hints; supplied structured-chat unsent retention and scoped removal draft eviction; caller-chat focus precedence; open/draft PR cache eviction and merged-head fallback result inventories. Retained adverse-ordering and ownership cases are narrower and do not establish equivalent replacements. No fresh runtime, native, physical provider, cross-platform, mobile or mixed-version evidence is claimed. Audit 3292 combines adopted 3285/3287/3289/3293 removals: 40 authored declarations and 47 expanded scenarios, including whole frame-editor-view, ambiguous remote-delete-refusal, unverifiable-host subscription and editor-close cleanup suites. The previously reviewed dock-badge suite was already removed upstream in PR 40895 and receives zero new removal credit. Intentionally retired alarms include background browser selection and last-tab landing; main startup fallback, SSH project cleanup/survivor routing, exact-PR contradiction/saved-push positives, replay/sidecar rollback and wrapped remote error normalization; records/snapshot missing-diff hydration, ambiguous folder-owner delete refusal, focus no-op notifications, nested editor context-only cache check, pending broadcast-first status and ordinary four-confirmation aggregation; preview-source frontmatter pruning, approved local/runtime agent dispatch, non-GitHub legacy PR cache invalidation, stale merged-head transient-error fallback, empty-queue immediate query reply and unverified-to-concrete preflight risk. Additional intentionally retired alarms are injected host subscription/unsubscribe counts, synthetic editor reveal/draft/fallback/scoped close, ambiguous unread refusals and hidden mark/read roundtrip, immediate connect backoff/noError, positive mirrored evidence-clock renewal, supplied VM failure/success projections and git-local/folder-SSH wake permutations. Remaining temporal/ownership cases are narrower; no equivalent replacement or fresh execution is claimed. Audit 3283 removes 20 authored declarations and 31 expanded scenarios, including two whole suites. Retired alarms cover PR refresh-state pruning, shared runtime subscription cleanup and store isolation, language content-change routing and older completion ownership, ordinary panel retry-timer cleanup and pending loading, four hosted-review lifetime permutations, mocked terminal creation error/order wiring, five sleep-inventory variants with pending-frame-only assertions, palette fallback/composite highlights, Windows/UNC encoded-editor input rows, mixed-repository partial failure counts, title setters and generated-title bypass/replacement, five window-close coordinator delegation/guard/finally branches, and ambiguous-old-record frame reveal. These regression checks are intentionally lost under the test-value audit; retained cases are not equivalent replacements. Prior coverage notes and receipts remain historical. Audit 3273 removes 14 authored declarations and 19 expanded scenarios across four whole suites and eight partial suites. Retired alarms cover saved-local cancellation/layout ownership, ambiguous-owner warning reset, folder attachment routing, VM false-capability bypass, abandoned reveal warmup cleanup and viewport claim deduplication/rearming, quiet unrelated remote-removal refusal, startup-command one-shot consumption, repository/floating recovery-ledger rows, fake-React pinned-scroll intent, split-ratio state identity/subscriber suppression and fractional change, cross-host project-group join refusal, three PR request-lifetime permutations, upstream-status preservation on error, and unresolved Git-owner refusal. These regression checks are intentionally lost under the test-value audit; retained scenarios are not equivalent replacements. Historical coverage receipts remain historical, including gate35 subscriber claims. Audit 3256 removes these specific alarms from the broad root unit commands: skill dialog active-share selection, close and pending-share handoff; simple keyed-record deletion; marker live-region insertion, simple landing and nine baseline policy examples; General search/control navigation inventory; orphan-count cache bootstrap; seven Codex code classifications and HTTP 429 warning mapping; two skill unread-root verdict examples; peer-mail payload and conversation-ID rejection; and the GitHub organization TABLE text-field optimistic rollback/failed-envelope example. These include real behaviors; retained tests do not provide equivalent coverage for every removed scenario. Mobile losses are recorded separately and are not coverage of these root commands. Audit3246 retires NewRowsMarker reveal/no-repeat and pane-scoped beforeinput checks; skill-owner option availability/count/dedup/order; six styled Input/Textarea IME forwarding rows; the static Codex/OpenCode smart-key inventory; tab-map AST ratchet diagnostic fixtures; child-roster work-budget and retained-aggregate alarms; malformed persisted floating-cwd fallback/no-crash/empty exact-root checks; the unanswered-host empty-list discriminator; the direct invalidated-cache commit-false assertion; one redundant digit-keyup IME row; cached non-supported Claude title-generator rows; and the duplicate late naming-result singleton. These root broad commands lose those specific alarms without equivalent replacement. Distinct retained owner/state checks have their own bounded claims; the real scheduler still rejects stale response data, while the direct false-return alarm is retired. Audit3231 retires supported-host restore-pane key mapping, closed/open creation-sidebar toggle visibility, unrelated scope-error/null classification and quick-submit reveal/no-create checks. These broad commands lose those real narrow alarms; no replacement coverage is claimed. Audit3219 removes the synthetic Cmd+J extra-source suite; this broad command no longer checks its match/tie placement and selection, announced count, empty-query cap, or workspace hiding with retained recent tabs. No replacement coverage is claimed. Audit3209 composes approved sources3202/3206: deliberately retires seven authored/expanded cases in four whole suites without equivalent replacement. Work-item queries lose real GitHub/GitLab oversized ASCII secret-prefix empty-query and whitespace-before-trim refusal alarms; inputs share the imported size bound and exercise only its fast length branch, with no multibyte or actual provider/exposure guarantee. Skill sharing loses complete/partial managed-bundle and destination-ambiguity association checks plus three negative origin/path/scheme admission examples; these do not establish uploaded contents, arbitrary-URL fetching, authorization or execution. Retain exact originless-project direct-link fallback, cloud-delete confirmation, bundled-target repair/owner isolation and explicit Windows-host preference over stale WSL suites. Rejected3201 runtime-preference removal is excluded. No real cloud/network/host/disk, mobile or mixed-version execution validation is claimed. Audit3200 composes approved source3194: deliberately retires thirteen authored registrations/twenty-seven expanded cases in six whole automation host/list policy suites without equivalent replacement. Real RPC category/retryability and wrapped-timeout recognition, unscoped-failure/scoped-success health evidence precedence, exact-ID create selectors and per-run workspace omission, paired-web local/SSH/absent host catalog routing, incompatible/removed/unhydrated/offline execution health, runtime-before-nested-SSH recovery dispatch, and no-owned-focus/successor/foreign-list focus policy alarms are consciously lost. Retain exact20line orphan allow/refuse/precondition and exact90line cross-host same-ID search suites. No retry-timer/fence lifecycle, actual reconnect/network/write delivery, native focus, mobile/mixed-version runtime or disk persistence coverage is claimed. Audit3191 combines approved source3182/3187/3188: deliberately retires thirteen authored Vitest registrations and fifteen expanded cases, including five whole suites, without equivalent replacement. Attachment intake loses real portal/native-capture terminal interception and unowned-container refusal, immediate child-only committed availability/claim-ref negotiation and delivery, and direct-target over stable focused/background composer routing through disable/re-enable/remount and independent question focus. Exact destination/cache/draft and final-stat owner/workspace/File-release suites remain; they do not replace Surface recipient routing. Automation authoring loses destination runtime catalog membership, local/direct-SSH exclusion of paired-runtime repos, unknown-runtime empty catalog, logical project/host/setup/repo/path context payload, and missing/nonready setup refusal; these were genuine direct helper alarms, while exact schedule transformation, legacy schedule and setup-decision suites remain. Agent picker loses setup-chat/terminal/missing-installer/unsupported-or-unknown-host row projection samples and the ordinary unsearched menu variant; the entire original26-line resume recipe suite remains, including reported bypass versus default/absent permission modes, as does the exact search-result menu callback with its fixtures, model/effort commits and staged Arguments reopen outcome. Rejected predecessor3180 full recipe deletion is excluded. No actual native drag/cursor/focus/IME, upload bytes or disk/restart persistence, full automation save/scheduler/runtime transport, real resume-process flags/environment delivery, or native menu/rendered layout validation is claimed. Audit3178 combines source3169/3170/3175: deliberately retires eight authored units (six Vitest cases and two imperative custom relay scenarios), including two whole suites, without equivalent replacement. Voice Section loses per-model pending-delete isolation across interleaved A/B completion and the two-success refresh-call alarm; exact VoicePane delayed key-clear/newer enabled-toggle merge remains and does not replace row deletion coverage. Speech loses dedicated rating-scale/inclusive-ceiling, unsupported-versus-unmeasured, explicit/system-language precedence/locale alias, accuracy versus fast named/default/best-measured selection, and unmeasured/no-match examples; exact offered-user-pick versus retired-selection case and its fixture remain. Relay loses legacy ping-delivery count/liveness sampled before the silence deadline and grouped malformed Bearer/host-ID 401/429 routing checks; twelve real Worker/DurableObject/shipped-client scenarios remain, not equivalent replacement for those narrow alarms. Six prior speech cases are not all deleted: approved successor3175 keeps the original user-choice case. No actual credential/file persistence, native/GPU/engine/download delivery, production assignment policy or deployed-runtime validation is claimed by this reduction. Audit3165 combines source3160/3162: deliberately retires six authored/expanded cases across three whole suites without equivalent replacement. Launch/status losses: observed React-render pending/resuming coordination across settings and deferred offer read; stale-offer reread suppressing dialog reopen; held-local-chat recovery visibility with new-chat preferences off; disabled-local admission avoiding offer RPC despite an injected but unconsumed paired-tab fixture; and run-only lost-reply uncertainty reachability until direct viewed-run retirement. Launch probe does not prove arbitrary synchronous-store atomicity, the paired fixture is not remote runtime enrollment, and the status case directly marks viewed state rather than rendering the summary. Crew-hook losses: old-host method_not_found cache persists across party changes but is released by independently supplied connection generation/verified pairing status or pairing revision, with actual frame publication and teardown. These are real narrow coordination, admission, uncertainty and mixed-version cache alarms consciously lost. Exact web verified-runtime writer handoff guard remains; it does not replace those alarms or prove live host/native/mobile delivery. Audit3156 combines3147/3150/3152/3153/3154: deliberately retires39authored/40expanded native-chat recovery cases, eight whole suites and two orphan test-support files without equivalent replacement. Lost alarms: lost-reply unconfirmed reconciliation, skipped rows/counts and missed-frame repair, unknown/pending outcome and omitted-failure-list compatibility, uncertain history after dismissal, retry/refusal/dismiss lifecycle, hidden/consumed picker ownership, result-tree keyboard focus/disclosure and all-skipped retirement; unconfirmed-over-conflict guidance and failed-chat changes despite older host timestamps; nearest-listed ancestor/cyclic forest shape, descendant membership, host ordering/missing-host local fallback; skipped/readiness/admission counts, provisional skip/progress monotonicity, early per-chat verdicts with batch pending protection, older-host waiting, start-slot/delivery distinction, retry-over-failure and unknown-after-withdrawal attention; remote snooze/reconnect/reoffer, unseen mixed summary through open/close, watched completion retirement, new success beside old failure, failed-reread mixed-result preservation, filter/collapse completion resets, retry summary replacement and current-offer/history selection; cross-host workspace identity, rendered cyclic reachability, nested tri-state/toggle propagation, project eligibility isolation and collapse preserving selection. Exact fallback-list completion barrier, batched verdict/cleanup retention, stale-read versus dismissal publication race, and requested-but-never-rendered finished-run retirement remain; they do not replace retired alarms. Audit3146 combines source reviews3132/3133/3135/3138/3143: intentionally retire20authored/31expanded cases without equivalent replacement. Provider-session losses: structured-native terminal-resume exclusion, metadata-less completed identity, new-turn completion clearing, Pi provider-only/periodic/manual promotion, changed-transcript launch-config isolation, Pi/omp/prime-agent completed-session remote/manual-shutdown promotion, and quit/done precedence over heartbeat. Side-thread/question losses: finished-pane acquisition, hidden title/recap states, local/relay/relay-done conversation takeover with prompt/session/child resets, plain-message abandonment, compaction/session replacement and completion resets. Codex startup losses: incoming-owner cached child replacement, old-relay foreign live-session correction, completed foreign-root turn-fact permutations. Transcript losses: real temporary-JSONL partial sibling/final-child completion, unlabelled child attribution, compact cached replay preservation and100/1000completed-child roster retention/release. Compiler-ratchet losses: valid-line uncompiled-list parser grammar examples and injected-existence stale-path filtering; these did not exercise actual filesystem canonicalization or build exclusion. These are real lifecycle, ownership, replay, liveness and retention alarms, including recent#40246 regressions, deliberately lost. Retained conditional record replacement, clockless root/SSH owner isolation, persisted main-thread fork rejection, partial/final question-answer lifetime, cached-roster/missing-ID/live HTTP/durable startup boundaries and restarted-relay refusal/acceptance do not replace those losses. No native/SSH/WSL execution or equivalent coverage is claimed. Audit3128 scoped coverage reduction: Audit3121 removes VoiceDictationLanguageSetting.test.tsx (Spanish-to-es callback and unsupported-model Korean option presence) and voice-speech-model-rows.test.ts (provider/language-order/retired-on-disk list policy); these real narrow alarms are deliberately retired without replacement. VoiceSpeechModelSection per-model concurrent deletion remains unchanged. Audit3122 removes the direct absolute/parent-segment sparse-directory exception-type sample and the five-row IPC sparse-preset error-code/non-save table (two authored/six expanded cases). Those real typed-validation and IPC refusal/error-code alarms are deliberately retired. Keep both real symlink/junction floating-directory trust cases and the minimal RPC structured validation-reason serialization case. The RPC case does not replace IPC save/refusal behavior, typed normalization for both path inputs, actual Git sparse checkout or rendered localization. No equivalent replacement or fresh test/runtime/platform/remote/performance validation is claimed. Audit3124 removes ExperimentalPane.test.tsx (ordinary Pet switch callback), WorkspaceDirectorySetting.test.tsx (padded absolute saved-path normalization/no-write blur), and repository-search.perf.test.ts (navigation/selected-pane builder-call policy, fixture cardinality/nonempty entries and renamed project keyword inclusion). These real narrow alarms are retired without replacement; RepositoryPane.search.test.tsx search-to-sparse-editor request remains unchanged. Audit3129: resolver Windows case-insensitive and POSIX case-sensitive configured-env composition plus mocked-base launch-preflight Windows composition are intentionally no longer checked by the two deleted suites. No equivalent coverage claimed. Keep runtime-structured-agent-host-env.test.ts unchanged: configured Windows Claude-home account identity and host-account precedence remain checked. Audit3114 incorporates source3101: retire three structured Claude child-environment wrapper cases covering inherited stamp isolation/default and explicit entrypoint, Windows SDK-key canonicalization/default/duplicate-key order, and configured lookup/final environment/config-dir conjunction. Keep direct auth/session sanitation and Windows-versus-Linux overlay checks, actual executable lookup from supplied inherited PATH, native Windows child environment delivery, and stale option-mutation fencing. These are not equivalent replacements for the retired wrapper alarms. No fresh test/runtime, real login-shell probe, Claude SDK startup, remote/mixed-version, UI or performance result is claimed. Audit3114 incorporates source3105: retire 17 authored/20 expanded daemon launch-note cases, including the entire two-case SessionLaunchNote suite. Deliberately lose split-marker carry across same-token re-arm, stale-token retirement refusal, foreground tri-state and serial settlement, omitted-note/no-incarnation mixed-version policy, sticky retirement, first-incarnation/replacement launch preservation and held-launch precedence. Keep only the unchanged unresolved foreground-read race against a later finished attach. Supplied notes/foreground and runtime calls do not establish actual daemon/main restart, SSH, native Windows observation, mobile UI, equivalent replacement or fresh runtime/performance validation. Audit3114 incorporates source3109: retire six authored/35 expanded pricing cases: 21 accepted model-name examples, 10 unsupported/future-model fail-closed examples, malformed TTL clamp, unknown-model estimate refusal, flat-model long-context disregard and oversized long-context clamp. Keep mixed five-minute/one-hour write allocation and short/all-long/mixed long-context allocation with original fixed oracles. Real parser/refusal/bounds alarms are knowingly lost without equivalent replacement; retained tests do not validate provider rates, actual billing or request threshold classification. Preserve the archived usage-scan-append source-freeze receipt without transferring historical execution/performance credit. No fresh runtime result is claimed. Audit3108 source-only reduction (3094/3095/3100): retire 27 authored/30 expanded cases, including complete markdown view-state, file-preview link-open and CLI agent-server-route suites, without replacement. Deliberate losses include preview visibility/reference lifetime and same-path owners; SSH stat, directory/missing-target, explicit-null owner, nonmarkdown line/column, local URI routing, remote-to-client guard and same-file reuse; document-preview source-owner/folder/reuse routing, stable grant location and outside-workspace POSIX/Windows request projection; and verified remote CLI send/check refusal, suggested --on argv/copy, shell no-probe bypass, unverified-launch admission and older-peer refusal. Retain two markdown source-runtime/qualified-reveal alarms, one stale grant-rejection fence and two remote read/mutation evidence policies, with original callbacks. Final last-wins reveal did not prove transient cancellation; CLI prerequisite did not prove no real send, and envelope tests do not execute server refusal. No fresh runtime, rendered UI, actual file/SSH/paired transport, authorization, mixed-version or performance result is claimed. Audit3096 source-only reduction (3087/3088): retire 69 authored/76 expanded cases, including complete recovery-portals and reconnect-banner suites. Intentionally lose dead/default TUI replay, generated alternate-frame style composition, reset/mode/dimension and legacy missing-mode-boundary alarms, UI notice/action/reveal policies, and isolated recovery lifecycle variants, without equivalent replacement. Retained registrations and callbacks are unchanged; headless cells are not pixels, and no fresh runtime, host, SSH, WSL, rendered-app or performance result is claimed. Audit3086 source-only reduction (3079/3080/3081): intentionally retire 93 authored/100 expanded mock-boundary cases, including the complete spawn-errors and SSH reconnect overlay suites, without replacement. Retired alarms include spawn classification/ownership, reply ceilings and renderer-write failure recovery, disconnect/detach fencing branches, authority facts, and overlay retry/visibility wiring. Retained callbacks are unchanged; no fresh execution, real PTY/SSH, rendered UI, or performance result is claimed. Audit2432: The broad unit command loses the isolated BranchPicker open-change notification sample. Its unique true/false callback alarm is intentionally retired; reopening/status-refresh behavior was not exercised. No equivalent replacement or fresh validation of the reduced selector is claimed. Audit2425: The broad unit command loses the workspace-copy-status supplied readError forwarding sample. It did not exercise the branch-switch blocking promised by its title. This alarm is intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2417: The broad unit command loses two ordinary clean Git cherry-pick/revert success samples and two terminal startup foreground-read work-budget samples. These unique alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2412: The broad unit command loses the whole six-case fake-React-hook scroll-anchor suite, two generic draft-retention samples, a simple new-agent order sample, a real history-publication batching-count sample, an unmounted handoff abort/timer sample and three basic WSL preview/error samples. These alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2404: The broad unit command loses the standalone share-name lookup 503 propagation suite, initial deletion placement-kind sample, direct changed-mtime stale sample, first-pass rollback existence example and abandoned-preparation directory sample. These exact alarms are intentionally retired without equivalent replacement or fresh validation of the reduced selector. Audit2397 review amendment: The broad unit command loses three standalone suites, two partial-case definitions and two URL table rows across package/download/placement tests. Keep initial wrong-port authorization, modified independent-copy digest refusal and abort-after-begin cancellation dispatch. The remaining alarms are deliberately retired; no equivalent complete replacement or fresh validation of the reduced selector is claimed. Audit2393 current-parent refresh2401: Remove the basic skill-install service alias sample and original public managed-remove receiptless refusal case. Preserve the upstream request ownership suite and transaction interruption coverage. No equivalent complete replacement or fresh validation of the reduced selector is claimed. Audit2389: The broad unit command loses the missing-preview suite, plain-global destination sample and prepublished-receipt recovery example. No equivalent replacement or fresh validation of the reduced selector is claimed. Audit2385: The broad unit command loses four authored walker/staging/protocol examples (six expanded cases); no equivalent replacement or fresh validation is claimed for the reduced suite. Audit2383: The unscoped Vitest command no longer includes the removed Antigravity catalogue suite; its exact provider-root/owner example has no equivalent replacement or fresh validation claim. Audit2377/2381: The unscoped Vitest command includes the reduced bundled-skill and native-discovery suites; the eight removed backup/legacy/catalogue/symlink/SSH-builder examples have no replacement-equivalence or fresh validation claim here. Audit2133 current-parent preparation: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2095 current-parent preparation2126: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Require both existing named browser placement scenarios to pass three times with one attempt, zero skips, zero failures, and no report errors.", "commands": [ "gh workflow run packaged-browser-e2e.yml", "pnpm exec playwright test tests/e2e/packaged-mixed-version-browser-placement.spec.ts --config tests/playwright.config.ts --project=electron-headless --workers=1 --repeat-each=3 --retries=0", @@ -14527,7 +14517,8 @@ "Audit 3256 removes these specific alarms from the broad root unit commands: skill dialog active-share selection, close and pending-share handoff; simple keyed-record deletion; marker live-region insertion, simple landing and nine baseline policy examples; General search/control navigation inventory; orphan-count cache bootstrap; seven Codex code classifications and HTTP 429 warning mapping; two skill unread-root verdict examples; peer-mail payload and conversation-ID rejection; and the GitHub organization TABLE text-field optimistic rollback/failed-envelope example. These include real behaviors; retained tests do not provide equivalent coverage for every removed scenario. Mobile losses are recorded separately and are not coverage of these root commands.", "Audit 3273 removes 14 authored declarations and 19 expanded scenarios across four whole suites and eight partial suites. Retired alarms cover saved-local cancellation/layout ownership, ambiguous-owner warning reset, folder attachment routing, VM false-capability bypass, abandoned reveal warmup cleanup and viewport claim deduplication/rearming, quiet unrelated remote-removal refusal, startup-command one-shot consumption, repository/floating recovery-ledger rows, fake-React pinned-scroll intent, split-ratio state identity/subscriber suppression and fractional change, cross-host project-group join refusal, three PR request-lifetime permutations, upstream-status preservation on error, and unresolved Git-owner refusal. These regression checks are intentionally lost under the test-value audit; retained scenarios are not equivalent replacements. Historical coverage receipts remain historical, including gate35 subscriber claims.", "Audit 3283 removes 20 authored declarations and 31 expanded scenarios, including two whole suites. Retired alarms cover PR refresh-state pruning, shared runtime subscription cleanup and store isolation, language content-change routing and older completion ownership, ordinary panel retry-timer cleanup and pending loading, four hosted-review lifetime permutations, mocked terminal creation error/order wiring, five sleep-inventory variants with pending-frame-only assertions, palette fallback/composite highlights, Windows/UNC encoded-editor input rows, mixed-repository partial failure counts, title setters and generated-title bypass/replacement, five window-close coordinator delegation/guard/finally branches, and ambiguous-old-record frame reveal. These regression checks are intentionally lost under the test-value audit; retained cases are not equivalent replacements. Prior coverage notes and receipts remain historical.", - "Audit 3292 combines adopted 3285/3287/3289/3293 removals: 40 authored declarations and 47 expanded scenarios, including whole frame-editor-view, ambiguous remote-delete-refusal, unverifiable-host subscription and editor-close cleanup suites. The previously reviewed dock-badge suite was already removed upstream in PR 40895 and receives zero new removal credit. Intentionally retired alarms include background browser selection and last-tab landing; main startup fallback, SSH project cleanup/survivor routing, exact-PR contradiction/saved-push positives, replay/sidecar rollback and wrapped remote error normalization; records/snapshot missing-diff hydration, ambiguous folder-owner delete refusal, focus no-op notifications, nested editor context-only cache check, pending broadcast-first status and ordinary four-confirmation aggregation; preview-source frontmatter pruning, approved local/runtime agent dispatch, non-GitHub legacy PR cache invalidation, stale merged-head transient-error fallback, empty-queue immediate query reply and unverified-to-concrete preflight risk. Additional intentionally retired alarms are injected host subscription/unsubscribe counts, synthetic editor reveal/draft/fallback/scoped close, ambiguous unread refusals and hidden mark/read roundtrip, immediate connect backoff/noError, positive mirrored evidence-clock renewal, supplied VM failure/success projections and git-local/folder-SSH wake permutations. Remaining temporal/ownership cases are narrower; no equivalent replacement or fresh execution is claimed." + "Audit 3292 combines adopted 3285/3287/3289/3293 removals: 40 authored declarations and 47 expanded scenarios, including whole frame-editor-view, ambiguous remote-delete-refusal, unverifiable-host subscription and editor-close cleanup suites. The previously reviewed dock-badge suite was already removed upstream in PR 40895 and receives zero new removal credit. Intentionally retired alarms include background browser selection and last-tab landing; main startup fallback, SSH project cleanup/survivor routing, exact-PR contradiction/saved-push positives, replay/sidecar rollback and wrapped remote error normalization; records/snapshot missing-diff hydration, ambiguous folder-owner delete refusal, focus no-op notifications, nested editor context-only cache check, pending broadcast-first status and ordinary four-confirmation aggregation; preview-source frontmatter pruning, approved local/runtime agent dispatch, non-GitHub legacy PR cache invalidation, stale merged-head transient-error fallback, empty-queue immediate query reply and unverified-to-concrete preflight risk. Additional intentionally retired alarms are injected host subscription/unsubscribe counts, synthetic editor reveal/draft/fallback/scoped close, ambiguous unread refusals and hidden mark/read roundtrip, immediate connect backoff/noError, positive mirrored evidence-clock renewal, supplied VM failure/success projections and git-local/folder-SSH wake permutations. Remaining temporal/ownership cases are narrower; no equivalent replacement or fresh execution is claimed.", + "Audit 3301 combines adopted source batches 3296 and 3299: retire 27 authored declarations and 36 expanded scenarios, including six whole suites. Intentionally lost alarms cover failed-verification/recovery/restart counters and mocked hosting/toast; early overlapping pane-read scheduling/count; unreadable removal listing draft guard; bulk-purge remote-qualified and raw-local guard maps; initial-snapshot blank/mode/oversize/printable/fresh-spawn callback and replay examples; fallback mobile file close and ordinary MRU; default queue overload/drain; seeded browser-page reuse and supplied missing-page URL recreation; ambiguous sleep/hibernation owner refusal and untouched bindings/origins; ordinary selection/activity/fallback priority; skip-remote success and retained hints; supplied structured-chat unsent retention and scoped removal draft eviction; caller-chat focus precedence; open/draft PR cache eviction and merged-head fallback result inventories. Retained adverse-ordering and ownership cases are narrower and do not establish equivalent replacements. No fresh runtime, native, physical provider, cross-platform, mobile or mixed-version evidence is claimed." ], "demotionRule": "Keep experimental if any direction skips or fails; do not extend timeouts or retry to green." }, diff --git a/config/scripts/ci/sharding/ci-shard-timings.json b/config/scripts/ci/sharding/ci-shard-timings.json index 64ed22ade00..c5fe443c505 100644 --- a/config/scripts/ci/sharding/ci-shard-timings.json +++ b/config/scripts/ci/sharding/ci-shard-timings.json @@ -5853,7 +5853,6 @@ "src/renderer/src/components/terminal-pane/pty-transport/remote-runtime/remote-runtime-pty-transport-activation-inventory-fallback.test.ts": 1311, "src/renderer/src/components/terminal-pane/pty-transport/remote-runtime/remote-runtime-pty-transport-create-handoff.test.ts": 14353, "src/renderer/src/components/terminal-pane/pty-transport/remote-runtime/remote-runtime-pty-transport-create-outcome-recovery.test.ts": 2041, - "src/renderer/src/components/terminal-pane/pty-transport/remote-runtime/remote-runtime-pty-transport-empty-initial-snapshot.test.ts": 1491, "src/renderer/src/components/terminal-pane/pty-transport/remote-runtime/remote-runtime-pty-transport-end-verdict.test.ts": 942, "src/renderer/src/components/terminal-pane/pty-transport/remote-runtime/remote-runtime-pty-transport-expired-pane-recovery.test.ts": 1763, "src/renderer/src/components/terminal-pane/pty-transport/remote-runtime/remote-runtime-pty-transport-healthy-link-reattach.test.ts": 1595, @@ -6628,7 +6627,6 @@ "src/renderer/src/store/slices/browser/tabs/browser-tab-creation-placement.test.ts": 1886, "src/renderer/src/store/slices/browser/pages/browser-workspace-doc-location.test.ts": 2007, "src/renderer/src/store/slices/browser/browser.test.ts": 2001, - "src/renderer/src/store/slices/worktrees/teardown/bulk-worktree-purge-terminal-maps-leak.test.ts": 1727, "src/renderer/src/store/terminals/codex-restart-notice-lifecycle.test.ts": 1685, "src/renderer/src/store/slices/tabs/content-tabs-from-main-frames.test.ts": 2025, "src/renderer/src/store/slices/tabs/content-tabs-paired-server-workspace.test.ts": 1923, @@ -6674,7 +6672,6 @@ "src/renderer/src/store/github/pull-requests/github-linked-review-clear-ownership.test.ts": 891, "src/renderer/src/store/slices/editor/git/github-post-operation-owner.test.ts": 2062, "src/renderer/src/store/github/pull-requests/github-pr-branch-direct-refresh-scope.test.ts": 667, - "src/renderer/src/store/github/pull-requests/github-pr-branch-fallback-results.test.ts": 658, "src/renderer/src/store/github/pull-requests/github-pr-branch-linked-pr-divergence.test.ts": 662, "src/renderer/src/store/github/comments/github-pr-comment-read-order.test.ts": 570, "src/renderer/src/store/github/comments/github-pr-comments.test.ts": 746, @@ -6743,10 +6740,8 @@ "src/renderer/src/store/slices/worktrees/create/sparse-presets.test.ts": 217, "src/renderer/src/store/slices/ssh/ssh.test.ts": 1843, "src/renderer/src/lib/workspace/activation/active-worktree-removal-successor.test.ts": 1867, - "src/renderer/src/store/slices/worktrees/session/store-active-worktree-selection.test.ts": 2039, "src/renderer/src/store/terminals/store-create-tab-start-in-main.test.ts": 1801, "src/renderer/src/store/slices/tabs/store-open-to-side-layout-owner.test.ts": 1919, - "src/renderer/src/store/slices/browser/hydration/store-session-browser-hydration.test.ts": 1906, "src/renderer/src/store/repos/store-session-cascades.test.ts": 1775, "src/renderer/src/store/slices/editor/hydration/store-session-editor-hydration.test.ts": 1719, "src/renderer/src/store/terminals/store-session-terminal-reconnect.test.ts": 2279, @@ -6755,7 +6750,6 @@ "src/renderer/src/store/terminals/store-sleep-exact-runtime-stop.test.ts": 1842, "src/renderer/src/store/terminals/store-sleep-pane-hibernation.test.ts": 1932, "src/renderer/src/store/terminals/store-sleep-runtime-convergence.test.ts": 1767, - "src/renderer/src/store/terminals/store-sleep-twin-host-owner.test.ts": 1706, "src/renderer/src/store/slices/worktrees/teardown/store-worktree-removal-cascade.test.ts": 1786, "src/renderer/src/store/slices/worktrees/teardown/tab-worktree-orphan-map-purge-leak.test.ts": 1936, "src/renderer/src/store/slices/tabs/tabs-close-dangling-group.test.ts": 1849, diff --git a/src/renderer/src/components/terminal-pane/pty-transport/remote-runtime/remote-runtime-pty-transport-empty-initial-snapshot.test.ts b/src/renderer/src/components/terminal-pane/pty-transport/remote-runtime/remote-runtime-pty-transport-empty-initial-snapshot.test.ts deleted file mode 100644 index 919a42c9ce2..00000000000 --- a/src/renderer/src/components/terminal-pane/pty-transport/remote-runtime/remote-runtime-pty-transport-empty-initial-snapshot.test.ts +++ /dev/null @@ -1,184 +0,0 @@ -import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' -import { createRemoteRuntimeTransportMocks } from '../remote/remote-runtime-pty-transport-test-harness' -import type { MultiplexSubscriptionCallbacks } from '../remote/remote-runtime-pty-transport-stream-fixtures' -import { REMOTE_TERMINAL_SNAPSHOT_TOO_LARGE } from '../../../../runtime/hosted-terminals/snapshots/remote-terminal-snapshot-policy' -import { - TerminalStreamOpcode, - encodeTerminalStreamJson -} from '../../../../../../shared/terminal/stream/terminal-stream-protocol' - -const appStore = vi.hoisted(() => ({ - getState: vi.fn(() => { - throw new Error('These transport fixtures must not read app-store ownership') - }) -})) - -vi.mock('@/store/index', () => ({ useAppStore: { getState: appStore.getState } })) - -afterEach(() => { - expect(appStore.getState).not.toHaveBeenCalled() -}) - -let subscriptionCallbacks: MultiplexSubscriptionCallbacks = null -let resolvedPaneHandle = 'terminal-1' - -const { - runtimeCall, - subscriptionSendBinary, - latestSubscribePayload, - emitOutput, - emitSnapshot, - emitSnapshotFrame, - resetRemoteRuntimeTransport -} = createRemoteRuntimeTransportMocks({ - getCallbacks: () => subscriptionCallbacks, - setCallbacks: (callbacks) => { - subscriptionCallbacks = callbacks - }, - getResolvedPaneHandle: () => resolvedPaneHandle, - setResolvedPaneHandle: (handle) => { - resolvedPaneHandle = handle - } -}) - -function subscribed(streamId: number): void { - subscriptionCallbacks?.onResponse({ - ok: true, - result: { type: 'subscribed', streamId, capabilities: { outputPause: 1 } } - }) -} - -type AttachMode = 'attach' | 'connect-reattach' | 'connect-spawn' - -async function attachTransport(mode: AttachMode) { - const { createRemoteRuntimePtyTransport } = await import('./remote-runtime-pty-transport') - const onReplayData = vi.fn() - const onStreamRecovered = vi.fn() - const onConnect = vi.fn() - const onError = vi.fn() - const callbacks = { onReplayData, onStreamRecovered, onConnect, onError } - const transport = createRemoteRuntimePtyTransport('env-1', { - worktreeId: 'wt-1', - tabId: 'tab-1', - leafId: 'pane:1' - }) - if (mode === 'attach') { - // A pane restored after a client restart attaches to the host handle it persisted. - transport.attach({ - existingPtyId: 'remote:env-1@@terminal-1', - cols: 152, - rows: 42, - callbacks - }) - } else { - const fallback = runtimeCall.getMockImplementation() - runtimeCall.mockImplementation(async (request: { method: string }) => - request.method === 'terminal.create' - ? { - ok: true, - result: { - terminal: { - handle: 'terminal-1', - isReattach: mode === 'connect-reattach' - } - } - } - : fallback?.(request) - ) - await transport.connect({ url: '', callbacks }) - } - await vi.waitFor(() => expect(subscriptionSendBinary).toHaveBeenCalled()) - return { - transport, - streamId: latestSubscribePayload().streamId, - ...callbacks - } -} - -// Idle agents send no new paint; imageless initial attach must pull retained host content instead of leaving a cursor-only pane (#18464/#21208/#23884). -describe('remote pane whose first attach replays no image', () => { - beforeEach(() => { - resetRemoteRuntimeTransport() - }) - - it.each(['attach', 'connect-reattach'] as const)( - 'pulls the retained buffer when the initial pushed snapshot is empty (%s)', - async (mode) => { - const { transport, streamId, onReplayData, onStreamRecovered, onConnect } = - await attachTransport(mode) - - emitSnapshot(streamId, '') - subscribed(streamId) - - await vi.waitFor(() => expect(onConnect).toHaveBeenCalledTimes(1)) - expect(onReplayData).not.toHaveBeenCalled() - expect(onStreamRecovered).toHaveBeenCalledTimes(1) - transport.destroy?.() - } - ) - - it('pulls the retained buffer when the initial image holds only modes and a cursor', async () => { - const { transport, streamId, onReplayData, onStreamRecovered, onConnect } = - await attachTransport('attach') - - // A host model seeded only by bytes since attach: bracketed paste, cursor home, cursor shown. - emitSnapshot(streamId, '\x1b[?2004h\x1b[H\x1b[?25h') - subscribed(streamId) - - await vi.waitFor(() => expect(onConnect).toHaveBeenCalledTimes(1)) - // Still replayed so its modes apply; the pull then supplies the screen. - expect(onReplayData).toHaveBeenCalledTimes(1) - expect(onStreamRecovered).toHaveBeenCalledTimes(1) - transport.destroy?.() - }) - - it('pulls the retained buffer when the initial snapshot exceeded the replay limit', async () => { - const { transport, streamId, onReplayData, onStreamRecovered, onConnect, onError } = - await attachTransport('attach') - - emitSnapshotFrame( - streamId, - TerminalStreamOpcode.SnapshotStart, - encodeTerminalStreamJson({ kind: 'scrollback' }) - ) - const chunk = new Uint8Array(1024 * 1024).fill(0x61) - for (let i = 0; i < 3; i += 1) { - emitSnapshotFrame(streamId, TerminalStreamOpcode.SnapshotChunk, chunk) - } - emitSnapshotFrame(streamId, TerminalStreamOpcode.SnapshotEnd, new Uint8Array()) - subscribed(streamId) - - await vi.waitFor(() => expect(onConnect).toHaveBeenCalledTimes(1)) - expect(onReplayData).not.toHaveBeenCalled() - expect(onError).not.toHaveBeenCalledWith(REMOTE_TERMINAL_SNAPSHOT_TOO_LARGE) - expect(onStreamRecovered).toHaveBeenCalledTimes(1) - transport.destroy?.() - }) - - it('does not pull again when the initial snapshot carried the screen', async () => { - const { transport, streamId, onReplayData, onStreamRecovered, onConnect } = - await attachTransport('attach') - - emitSnapshot(streamId, 'IDLE_AGENT_PROMPT') - subscribed(streamId) - - await vi.waitFor(() => expect(onConnect).toHaveBeenCalledTimes(1)) - expect(onReplayData.mock.calls.map((call) => call[0])).toEqual(['IDLE_AGENT_PROMPT']) - expect(onStreamRecovered).not.toHaveBeenCalled() - emitOutput(streamId, 'LIVE') - expect(onStreamRecovered).not.toHaveBeenCalled() - transport.destroy?.() - }) - - it('does not pull for a terminal this pane just created', async () => { - const { transport, streamId, onStreamRecovered, onConnect } = - await attachTransport('connect-spawn') - - emitSnapshot(streamId, '') - subscribed(streamId) - - await vi.waitFor(() => expect(onConnect).toHaveBeenCalledTimes(1)) - expect(onStreamRecovered).not.toHaveBeenCalled() - transport.destroy?.() - }) -}) diff --git a/src/renderer/src/components/terminal-pane/pty-transport/remote-runtime/remote-runtime-pty-transport-mirror-resolve-overlap.test.ts b/src/renderer/src/components/terminal-pane/pty-transport/remote-runtime/remote-runtime-pty-transport-mirror-resolve-overlap.test.ts index 07312c19853..65b5a1e80aa 100644 --- a/src/renderer/src/components/terminal-pane/pty-transport/remote-runtime/remote-runtime-pty-transport-mirror-resolve-overlap.test.ts +++ b/src/renderer/src/components/terminal-pane/pty-transport/remote-runtime/remote-runtime-pty-transport-mirror-resolve-overlap.test.ts @@ -10,17 +10,16 @@ vi.mock('@/store/index', () => ({ useAppStore: { getState: () => ({}) } })) let subscriptionCallbacks: MultiplexSubscriptionCallbacks = null let resolvedPaneHandle = 'terminal-1' -const { runtimeCall, subscriptionSendBinary, resetRemoteRuntimeTransport } = - createRemoteRuntimeTransportMocks({ - getCallbacks: () => subscriptionCallbacks, - setCallbacks: (callbacks) => { - subscriptionCallbacks = callbacks - }, - getResolvedPaneHandle: () => resolvedPaneHandle, - setResolvedPaneHandle: (handle) => { - resolvedPaneHandle = handle - } - }) +const { runtimeCall, resetRemoteRuntimeTransport } = createRemoteRuntimeTransportMocks({ + getCallbacks: () => subscriptionCallbacks, + setCallbacks: (callbacks) => { + subscriptionCallbacks = callbacks + }, + getResolvedPaneHandle: () => resolvedPaneHandle, + setResolvedPaneHandle: (handle) => { + resolvedPaneHandle = handle + } +}) function calledMethods(): string[] { return runtimeCall.mock.calls.map(([request]) => request.method) @@ -48,42 +47,6 @@ describe('web mirror reveal: resolvePane overlaps the activation', () => { }) } - it('sends resolvePane before the activation answers, and reads it once', async () => { - const defaultCall = runtimeCall.getMockImplementation()! - let answerActivate: () => void = () => {} - runtimeCall.mockImplementation((request: { method: string }) => { - if (request.method === 'session.tabs.activate') { - return new Promise((resolve) => { - answerActivate = () => resolve(defaultCall(request)) - }) - } - if (request.method === 'terminal.resolvePane') { - return Promise.resolve(defaultCall(request)).then((response) => ({ - ...response, - result: { - terminal: { ...response.result.terminal, incarnationId: 'incarnation-resolved' } - } - })) - } - return defaultCall(request) - }) - - const attached = attachMirror() - await vi.waitFor(() => expect(calledMethods()).toContain('terminal.resolvePane'), { - timeout: 10_000 - }) - // The activation has not answered, yet the pane read is already on the wire. - expect(calledMethods()).toContain('session.tabs.activate') - expect(subscriptionSendBinary).not.toHaveBeenCalled() - - answerActivate() - await expect(attached).resolves.toMatchObject({ - id: 'remote:env-1@@terminal-1', - incarnationId: 'incarnation-resolved' - }) - expect(calledMethods().filter((method) => method === 'terminal.resolvePane')).toHaveLength(1) - }) - it('re-reads the pane after an activation that materialized a different handle', async () => { const defaultCall = runtimeCall.getMockImplementation()! let activated = false diff --git a/src/renderer/src/runtime/web-session-tabs-sync/navigation/web-session-tabs-sync-focus-intent.test.ts b/src/renderer/src/runtime/web-session-tabs-sync/navigation/web-session-tabs-sync-focus-intent.test.ts index 5512ddf7dbe..f5670983b64 100644 --- a/src/renderer/src/runtime/web-session-tabs-sync/navigation/web-session-tabs-sync-focus-intent.test.ts +++ b/src/renderer/src/runtime/web-session-tabs-sync/navigation/web-session-tabs-sync-focus-intent.test.ts @@ -25,40 +25,6 @@ vi.mock('../../../store/index', () => ({ describe('applyWebSessionTabsSnapshot', () => { beforeEach(resetWebSessionTabsSyncTestState) - it('honors a caller chat target even when the host observation selects another chat', () => { - const state = makeState() - const chat = (id: string, isActive: boolean) => ({ - type: 'agent-session' as const, - id, - title: id, - sessionId: id.slice('agent-session:'.length), - agent: 'codex' as const, - isActive - }) - const snapshot = makeSnapshot([chat('agent-session:a', true), chat('agent-session:c', false)], { - activeTabId: 'agent-session:a', - activeTabType: 'agent-session', - tabGroups: [ - { - id: 'host-group-1', - activeTabId: 'agent-session:a', - tabOrder: ['agent-session:a', 'agent-session:c'] - } - ] - }) - recordWebSessionFocusIntent({ environmentId: ENV }, WT, 'agent-session:c') - const patch = applyWebSessionTabsSnapshot(state, snapshot, ENV, NOW) - if (!patch) { - throw new Error('Expected caller focus to produce a navigation patch') - } - const selected = patch.groupsByWorktree?.[WT]?.find( - (group) => group.id === patch.activeGroupIdByWorktree?.[WT] - )?.activeTabId - expect(patch.unifiedTabsByWorktree?.[WT]?.find((tab) => tab.id === selected)?.entityId).toBe( - 'c' - ) - }) - it('replays a snapshot that beat the RPC response and focuses the exact adopted leaf', () => { const mirroredTabId = toWebTerminalSurfaceTabId('host-tab-1') const root = { diff --git a/src/renderer/src/store/github/pull-requests/github-pr-branch-fallback-results.test.ts b/src/renderer/src/store/github/pull-requests/github-pr-branch-fallback-results.test.ts deleted file mode 100644 index a747b6564f7..00000000000 --- a/src/renderer/src/store/github/pull-requests/github-pr-branch-fallback-results.test.ts +++ /dev/null @@ -1,232 +0,0 @@ -import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' -import { _clearGitHubPRRefreshStartedEntriesForTest } from '../requests/request-coordination' -import { - createTestStore, - makePR, - makePRRefreshWorktree, - mockApi, - resetRemoteRuntimeMocks -} from '../github-slice-test-harness' -import type { AppState } from '../../types' -import { getHostedReviewCacheKey } from '../../slices/hosted-review/hosted-review-cache-identity' - -describe('createGitHubSlice.fetchPRForBranch', () => { - beforeEach(() => { - vi.clearAllMocks() - resetRemoteRuntimeMocks() - mockApi.gh.prForBranch.mockResolvedValue(null) - mockApi.gh.refreshPRNow.mockReset() - mockApi.gh.refreshPRNow.mockResolvedValue({ kind: 'no-pr', fetchedAt: Date.now() }) - mockApi.hostedReview.forBranch.mockResolvedValue(null) - _clearGitHubPRRefreshStartedEntriesForTest() - }) - - afterEach(() => { - _clearGitHubPRRefreshStartedEntriesForTest() - vi.useRealTimers() - }) - - it.each(['open', 'draft'] as const)( - 'clears visible cached %s PR data when a fallback refresh misses', - async (state) => { - const store = createTestStore() - const repoPath = '/repo' - const repoId = 'repo-1' - const branch = 'feature/fallback-miss' - const cachedPR = makePR({ number: 12, state, title: 'Visible cached PR' }) - const hostedReviewCacheKey = getHostedReviewCacheKey(repoPath, branch, null, repoId) - - store.setState({ - repos: [{ id: repoId, path: repoPath, name: 'repo', kind: 'git' }], - prCache: { - [`${repoId}::${branch}`]: { - data: cachedPR, - fetchedAt: 1 - } - }, - hostedReviewCache: { - [hostedReviewCacheKey]: { - data: { - provider: 'github', - number: 12, - title: 'Visible cached PR', - state, - url: 'https://github.com/acme/orca/pull/12', - status: 'pending', - updatedAt: '2026-03-28T00:00:00Z', - mergeable: 'UNKNOWN' - }, - fetchedAt: 1, - linkedReviewHintKey: 'github:12' - } - } - } as unknown as Partial) - mockApi.gh.refreshPRNow.mockResolvedValueOnce({ kind: 'no-pr', fetchedAt: 2 }) - - await expect( - store.getState().fetchPRForBranch(repoPath, branch, { - force: true, - repoId, - fallbackPRNumber: 12 - }) - ).resolves.toBeNull() - expect(store.getState().prCache[`${repoId}::${branch}`]).toEqual({ - data: null, - fetchedAt: 2 - }) - expect(store.getState().hostedReviewCache[hostedReviewCacheKey]).toEqual({ - data: null, - fetchedAt: 2, - linkedReviewHintKey: 'github:12' - }) - } - ) - - it('preserves cached merged PR data when a forced no-PR refresh matches the worktree head', async () => { - vi.useFakeTimers() - const store = createTestStore() - const repoPath = '/repo' - const repoId = 'repo-1' - const branch = 'feature/merged-pr-head-match' - const worktreeId = 'wt-merged-direct-match' - const cachedPR = makePR({ - number: 12, - title: 'Merged PR still checked out', - state: 'merged', - headSha: 'merged-head' - }) - - store.setState({ - repos: [{ id: repoId, path: repoPath, name: 'repo', kind: 'git' }], - worktreesByRepo: { - [repoId]: [ - makePRRefreshWorktree({ - id: worktreeId, - repoId, - branch, - head: 'merged-head' - }) - ] - }, - prCache: { - [`${repoId}::${branch}`]: { - data: cachedPR, - fetchedAt: 1 - } - } - } as unknown as Partial) - mockApi.gh.refreshPRNow.mockResolvedValueOnce({ kind: 'no-pr', fetchedAt: 2 }) - - await expect( - store.getState().fetchPRForBranch(repoPath, branch, { - force: true, - repoId, - worktreeId - }) - ).resolves.toEqual(cachedPR) - expect(store.getState().prCache[`${repoId}::${branch}`]).toEqual({ - data: cachedPR, - fetchedAt: 1 - }) - await vi.advanceTimersByTimeAsync(1000) - expect(mockApi.cache.setGitHub).not.toHaveBeenCalled() - }) - - it.each([ - { - name: 'worktree id is missing', - worktreeId: undefined, - linkedPRNumber: undefined, - worktreesByRepo: {} - }, - { - name: 'worktree cannot be found', - worktreeId: 'wt-missing', - linkedPRNumber: undefined, - worktreesByRepo: { 'repo-1': [] } - }, - { - name: 'worktree head is empty', - worktreeId: 'wt-empty-head', - linkedPRNumber: undefined, - worktreesByRepo: { - 'repo-1': [ - makePRRefreshWorktree({ - id: 'wt-empty-head', - branch: 'feature/merged-pr-stale-direct', - head: '' - }) - ] - } - }, - { - name: 'cached PR head differs from worktree head', - worktreeId: 'wt-moved-head', - linkedPRNumber: undefined, - worktreesByRepo: { - 'repo-1': [ - makePRRefreshWorktree({ - id: 'wt-moved-head', - branch: 'feature/merged-pr-stale-direct', - head: 'new-head' - }) - ] - } - }, - { - name: 'an explicit linked PR lookup misses', - worktreeId: 'wt-linked-pr-miss', - linkedPRNumber: 12, - worktreesByRepo: { - 'repo-1': [ - makePRRefreshWorktree({ - id: 'wt-linked-pr-miss', - branch: 'feature/merged-pr-stale-direct', - head: 'merged-head', - linkedPR: 12 - }) - ] - } - } - ])('clears cached merged PR data on forced no-PR refresh when $name', async (testCase) => { - const store = createTestStore() - const repoPath = '/repo' - const repoId = 'repo-1' - const branch = 'feature/merged-pr-stale-direct' - const cachedPR = makePR({ - number: 12, - title: 'Stale merged PR', - state: 'merged', - headSha: 'merged-head' - }) - - store.setState({ - repos: [{ id: repoId, path: repoPath, name: 'repo', kind: 'git' }], - worktreesByRepo: testCase.worktreesByRepo, - prCache: { - [`${repoId}::${branch}`]: { - data: cachedPR, - fetchedAt: 1 - } - } - } as unknown as Partial) - mockApi.gh.refreshPRNow.mockResolvedValueOnce({ kind: 'no-pr', fetchedAt: 2 }) - - await expect( - store.getState().fetchPRForBranch(repoPath, branch, { - force: true, - repoId, - worktreeId: testCase.worktreeId, - linkedPRNumber: testCase.linkedPRNumber - }) - ).resolves.toBeNull() - const fetchedHeadOid = Object.values(testCase.worktreesByRepo) - .flat() - .find((worktree) => worktree.id === testCase.worktreeId)?.head - expect(store.getState().prCache[`${repoId}::${branch}`]).toEqual({ - data: null, - fetchedAt: 2, - ...(fetchedHeadOid ? { fetchedHeadOid } : {}) - }) - }) -}) diff --git a/src/renderer/src/store/repos/all-host-catalog-settlement.test.ts b/src/renderer/src/store/repos/all-host-catalog-settlement.test.ts index 0315cd843bd..a3c8f08b43a 100644 --- a/src/renderer/src/store/repos/all-host-catalog-settlement.test.ts +++ b/src/renderer/src/store/repos/all-host-catalog-settlement.test.ts @@ -143,19 +143,6 @@ describe('all-host folder workspace settlement', () => { expect(store.getState().folderWorkspaces.map((w) => w.id)).toEqual(['remote-folder']) expect(store.getState().restoredRuntimeHostIdByWorkspaceSessionKey).toEqual({}) }) - - it('keeps restored folder owner hints and lists no runtimes when remote hosts are skipped', async () => { - const store = storeWithRestoredFolderOwner() - - await store.getState().fetchFolderWorkspacesForAllHosts({ remoteHosts: 'skip' }) - await store.getState().fetchProjectGroupsForAllHosts({ remoteHosts: 'skip' }) - - expect(runtimeEnvironmentsList).not.toHaveBeenCalled() - expect(store.getState().folderWorkspaces.map((w) => w.id)).toEqual(['local-folder']) - expect(store.getState().restoredRuntimeHostIdByWorkspaceSessionKey).toEqual({ - [restoredFolderKey]: 'runtime:env-1' - }) - }) }) describe('all-host repo settlement', () => { diff --git a/src/renderer/src/store/slices/browser/hydration/store-session-browser-hydration.test.ts b/src/renderer/src/store/slices/browser/hydration/store-session-browser-hydration.test.ts deleted file mode 100644 index d42b446678f..00000000000 --- a/src/renderer/src/store/slices/browser/hydration/store-session-browser-hydration.test.ts +++ /dev/null @@ -1,174 +0,0 @@ -import { describe, it, expect, vi, beforeEach } from 'vitest' -import type * as AgentStatusModule from '@/lib/agent-status/aggregation/worktree-agent-status' -import type { BrowserPage } from '../../../../../../shared/browser-workspace-types' -import '../../../../../../shared/constants' -import { ORCA_LAYOUT_OWNER_IS_MAIN } from '../../../../../../shared/layout-owner-switch' -import { - RemoteBrowserPageSession, - type RemoteBrowserPageSessionDeps -} from '@/components/browser-pane/stream-remote/remote-browser-page-session' -import { RuntimeRpcCallError } from '@/runtime/rpc/calls/runtime-rpc-result' -import { resetRestoredBrowserClientHostAttachForTests } from '@/runtime/browser/client-hosting/restored-client-hosted-browser-host-attach' -import { createTestStore } from '../../../testing/app-store-test-fixture' -import { makeWorktree } from '../../worktrees/worktree.test-fixture' -import { createStoreSessionMockApi } from '../../../testing/app-store-session-api.test-fixture' -import { makeBrowserTab } from '../browser-tab.test-fixture' - -vi.mock('sonner', () => ({ toast: { info: vi.fn(), success: vi.fn(), error: vi.fn() } })) - -vi.mock('@/lib/agent-status/aggregation/worktree-agent-status', async (importOriginal) => { - const actual = await importOriginal() - return { - ...actual, - detectAgentStatusFromTitle: vi.fn().mockReturnValue(null) - } -}) - -createStoreSessionMockApi() - -describe('hydrateBrowserSession remote page handle seeding', () => { - const WT = 'repo1::/path/wt1' - - function createHydratedStore(page: Partial & { id: string }) { - const store = createTestStore() - store.setState({ - repos: [ - { id: 'repo1', path: '/repo1', displayName: 'Repo 1', badgeColor: '#000', addedAt: 0 } - ], - worktreesByRepo: { - repo1: [makeWorktree({ id: WT, repoId: 'repo1', path: '/path/wt1' })] - }, - activeWorktreeId: WT - }) - store.getState().hydrateBrowserSession({ - activeRepoId: 'repo1', - activeWorktreeId: WT, - activeTabId: null, - tabsByWorktree: {}, - terminalLayoutsByTabId: {}, - browserTabsByWorktree: { - [WT]: [makeBrowserTab({ id: 'workspace-1', worktreeId: WT, url: 'https://example.com/' })] - }, - browserPagesByWorkspace: { - 'workspace-1': [ - { - workspaceId: 'workspace-1', - worktreeId: WT, - url: 'https://example.com/', - title: 'Example', - loading: false, - faviconUrl: null, - canGoBack: false, - canGoForward: false, - loadError: null, - createdAt: 1, - ...page - } - ] - }, - activeBrowserTabIdByWorktree: { [WT]: 'workspace-1' } - }) - return store - } - - beforeEach(() => { - vi.clearAllMocks() - resetRestoredBrowserClientHostAttachForTests() - }) - - // Drive ensureRemotePage through the real session; store-map assertions alone cannot prove adopt versus create. - function createStreamedSession( - store: ReturnType, - deps: { - callRpc: RemoteBrowserPageSessionDeps['callRpc'] - currentUrl: string - closeMissingRemotePage?: (remotePageId: string | null) => void - } - ): RemoteBrowserPageSession { - let remotePage: string | null = null - return new RemoteBrowserPageSession({ - tokens: { - isCurrent: () => true, - get remotePage() { - return remotePage - }, - setRemotePage: (value: string | null) => { - remotePage = value - } - } as never, - callRpc: deps.callRpc, - getWorktreeSelector: () => WT, - getCurrentUrl: () => deps.currentUrl, - readStoredHandle: () => store.getState().remoteBrowserPageHandlesByPageId['page-1'] ?? null, - writeStoredHandle: (handle) => store.getState().setRemoteBrowserPageHandle('page-1', handle), - removeStoredHandle: (remotePageId) => - store.getState().removeRemoteBrowserPageHandle('page-1', remotePageId), - applyTabInfo: () => {}, - closeMissingRemotePage: deps.closeMissingRemotePage ?? (() => {}) - }) - } - - it('adopts a remote page this session already created', async () => { - const store = createHydratedStore({ id: 'page-1', browserRuntimeEnvironmentId: 'env-1' }) - store.getState().setRemoteBrowserPageHandle('page-1', { - environmentId: 'env-1', - remotePageId: 'remote-page-1' - }) - const callRpc = vi.fn(async (_target: unknown, _method: string) => ({ - tab: { url: 'https://example.com/', title: 'Example' } - })) - const session = createStreamedSession(store, { - callRpc: callRpc as never, - currentUrl: 'https://example.com/' - }) - - const resolved = await session.ensureRemotePage({ - environmentId: 'env-1', - generation: 1, - remotePageId: null - } as never) - - expect(resolved).toBe('remote-page-1') - expect(callRpc.mock.calls.map(([, method]) => method)).toEqual(['browser.tabShow']) - }) - - // Restarted runtime returns browser_tab_not_found; recreate at saved URL instead of adopting and deleting the row. - it('re-creates a restored server-hosted page at its saved URL instead of adopting it', async () => { - const store = createHydratedStore({ - id: 'page-1', - browserRuntimeEnvironmentId: 'env-1', - remoteBrowserPageId: 'remote-page-1', - url: 'https://example.com/saved' - }) - const callRpc = vi.fn(async (_target: unknown, method: string, _params?: unknown) => { - if (method === 'browser.tabShow') { - throw new RuntimeRpcCallError({ - ok: false, - error: { code: 'browser_tab_not_found', message: 'browser_tab_not_found' } - } as never) - } - return { browserPageId: 'remote-page-2' } - }) - const closeMissingRemotePage = vi.fn() - const session = createStreamedSession(store, { - callRpc: callRpc as never, - currentUrl: 'https://example.com/saved', - closeMissingRemotePage - }) - - const resolved = await session.ensureRemotePage({ - tabId: 'page-1', - environmentId: 'env-1', - generation: 1, - remotePageId: null - }) - - expect(closeMissingRemotePage).not.toHaveBeenCalled() - // Switch-on first probes the row id with tabShow; the restarted runtime has no such page. - expect(callRpc.mock.calls.map(([, method]) => method)).toEqual( - ORCA_LAYOUT_OWNER_IS_MAIN ? ['browser.tabShow', 'browser.tabCreate'] : ['browser.tabCreate'] - ) - expect(callRpc.mock.calls.at(-1)?.[2]).toMatchObject({ url: 'https://example.com/saved' }) - expect(resolved).toBe('remote-page-2') - }) -}) diff --git a/src/renderer/src/store/slices/runtime-status/runtime-status-snapshot.test.ts b/src/renderer/src/store/slices/runtime-status/runtime-status-snapshot.test.ts index 37784d99579..a711c14e8f9 100644 --- a/src/renderer/src/store/slices/runtime-status/runtime-status-snapshot.test.ts +++ b/src/renderer/src/store/slices/runtime-status/runtime-status-snapshot.test.ts @@ -1,6 +1,5 @@ import { beforeEach, expect, it, vi } from 'vitest' import { create } from 'zustand' -import { toast } from 'sonner' import { createRuntimeStatusSlice } from './create-runtime-status-slice' import { clearRuntimeEnvironmentConnectionGenerations as clearRuntimeEnvironmentConnectionGenerationsForTests } from './runtime-status-connection-generation' import type { RuntimeStatusSlice } from './runtime-status-types' @@ -8,7 +7,6 @@ import type { RuntimeHostStatusSnapshot } from '../../../../../shared/remote-run import type { RuntimeStatus } from '../../../../../shared/runtime-session-contracts' import type { PublicKnownRuntimeEnvironment } from '../../../../../shared/remote-runtime/host-catalog/runtime-environments' import { runtimeHostConnectionStateForEntry } from '@/runtime/hosts/connections/runtime-host-connection-state' -import { ensureBrowserClientHostOnRuntimeContact } from '@/runtime/browser/client-hosting/restored-client-hosted-browser-host-attach' import { setRuntimeEnvironmentCatalogRefresher } from '@/runtime/rpc/environment-revisions/runtime-environment-pairing-refresh' vi.mock('sonner', () => ({ toast: { warning: vi.fn(), dismiss: vi.fn() } })) @@ -55,44 +53,6 @@ function snapshot( } } -it('represents failed verification honestly without manufacturing a session restart or toast', () => { - const viewer = store() - viewer.getState().applyRuntimeHostStatusSnapshot(snapshot(1)) - const generation = viewer - .getState() - .runtimeStatusByEnvironmentId.get('env-a')?.connectionGeneration - viewer.getState().applyRuntimeHostStatusSnapshot(snapshot(2, { verification: 'unavailable' })) - expect( - runtimeHostConnectionStateForEntry(viewer.getState().runtimeStatusByEnvironmentId.get('env-a')) - ).toBe('runtime-unavailable') - expect(viewer.getState().runtimeStatusByEnvironmentId.get('env-a')?.connectionGeneration).toBe( - generation - ) - viewer.getState().applyRuntimeHostStatusSnapshot(snapshot(3)) - // Same-runtime recovery advances only resubscribe epoch, preserving mirror cache (#19647); reclaim hosting without a toast. - expect(viewer.getState().runtimeStatusByEnvironmentId.get('env-a')?.connectionGeneration).toBe( - generation - ) - expect(viewer.getState().runtimeStatusByEnvironmentId.get('env-a')?.hostContactEpoch).toBe(1) - expect(viewer.getState().runtimeStatusByEnvironmentId.get('env-a')?.status?.runtimeId).toBe( - 'rt-1' - ) - expect(ensureBrowserClientHostOnRuntimeContact).toHaveBeenCalledWith(expect.anything(), 'env-a') - vi.mocked(ensureBrowserClientHostOnRuntimeContact).mockClear() - expect(toast.warning).not.toHaveBeenCalled() - const reconnectedGeneration = viewer - .getState() - .runtimeStatusByEnvironmentId.get('env-a')?.connectionGeneration - viewer - .getState() - .applyRuntimeHostStatusSnapshot(snapshot(4, { status: { runtimeId: 'rt-2' } as RuntimeStatus })) - // A replacement runtime id is a restart: a genuinely new connection, so the generation moves. - expect(viewer.getState().runtimeStatusByEnvironmentId.get('env-a')?.connectionGeneration).toBe( - (reconnectedGeneration ?? 0) + 1 - ) - expect(ensureBrowserClientHostOnRuntimeContact).toHaveBeenCalledWith(expect.anything(), 'env-a') -}) - it('retains disconnect ordering and rejects publications for removed or replaced pairings', () => { const viewer = store() viewer.getState().applyRuntimeHostStatusSnapshot(snapshot(1)) diff --git a/src/renderer/src/store/slices/tabs/tabs-open-close-lifecycle.test.ts b/src/renderer/src/store/slices/tabs/tabs-open-close-lifecycle.test.ts index 62ae5a0cf80..b6ff5d40a03 100644 --- a/src/renderer/src/store/slices/tabs/tabs-open-close-lifecycle.test.ts +++ b/src/renderer/src/store/slices/tabs/tabs-open-close-lifecycle.test.ts @@ -5,10 +5,8 @@ import { buildMobileSessionTabSnapshots } from '../../../runtime/sync-runtime-gr import { closeMobileSessionTabInStore } from '../../../runtime/web-session-tabs-sync/closing/mobile-session-tab-close' import { createTabsSliceMockApi } from './tabs-slice-test-harness' import { createTestStore } from '../../testing/app-store-test-fixture' -import { makeLayout, makeTab } from '../../terminals/terminal-tab.test-fixture' import { makeOpenFile } from '../editor/types/open-file.test-fixture' import { makeTabGroup, makeUnifiedTab } from './tab-group.test-fixture' -import { makeBrowserTab } from '../browser/browser-tab.test-fixture' import { drawTabsFromMain } from './tabs-drawn-from-main.test-fixture' @@ -37,21 +35,6 @@ createTabsSliceMockApi() const WT = 'repo1::/tmp/feature' -/** The terminal row, browser record and open file main loads these tabs' entries with. */ -function seedContentRecords( - target: ReturnType, - ids: { terminalId: string; browserId?: string; fileId: string } -): void { - target.setState({ - tabsByWorktree: { [WT]: [makeTab({ id: ids.terminalId, worktreeId: WT })] }, - terminalLayoutsByTabId: { [ids.terminalId]: makeLayout() }, - browserTabsByWorktree: ids.browserId - ? { [WT]: [makeBrowserTab({ id: ids.browserId, worktreeId: WT, url: 'about:blank' })] } - : {}, - openFiles: [makeOpenFile({ id: ids.fileId, worktreeId: WT })] - }) -} - describe('TabsSlice', () => { let store: ReturnType @@ -112,58 +95,5 @@ describe('TabsSlice', () => { expect(store.getState().openFiles).toEqual([]) expect(buildMobileSessionTabSnapshots(store.getState())[0]?.tabs ?? []).toEqual([]) }) - - it('closes a mobile fallback file-id tab after the unified wrapper is already gone', () => { - const file = makeOpenFile({ - id: '/tmp/feature/src/app.ts', - filePath: '/tmp/feature/src/app.ts', - relativePath: 'src/app.ts', - language: 'typescript', - worktreeId: WT - }) - store.setState({ - openFiles: [file], - unifiedTabsByWorktree: { [WT]: [] }, - groupsByWorktree: { [WT]: [] }, - activeFileId: file.id, - activeFileIdByWorktree: { [WT]: file.id }, - activeWorktreeId: WT, - activeTabType: 'editor', - activeTabTypeByWorktree: { [WT]: 'editor' } - }) - - expect(buildMobileSessionTabSnapshots(store.getState())[0]?.tabs).toMatchObject([ - { id: file.id, type: 'file', filePath: file.filePath } - ]) - - expect(closeMobileSessionTabInStore(store.getState(), WT, file.id)).toBe(true) - - expect(store.getState().openFiles).toEqual([]) - expect(buildMobileSessionTabSnapshots(store.getState())[0]?.tabs ?? []).toEqual([]) - }) - - it('activates the previously-active tab across content types', async () => { - seedContentRecords(store, { terminalId: 'term-1', browserId: 'browser-1', fileId: 'f.ts' }) - const t1 = store.getState().createUnifiedTab(WT, 'terminal', { id: 'term-1' }) - const t2 = store.getState().createUnifiedTab(WT, 'browser', { id: 'browser-1' }) - const t3 = store.getState().createUnifiedTab(WT, 'editor', { id: 'f.ts' }) - const main = await drawTabsFromMain(store) - - // Visit order ...→t3→t1→t3; closing t3 should jump to t1, not browser neighbor t2. - store.getState().activateTab(t1.id) - store.getState().activateTab(t3.id) - store.getState().closeUnifiedTab(t3.id) - // A layout-owner build picks the previous tab once main's frame dropped the closed one. - await main.settle() - main.close() - - expect(store.getState().groupsByWorktree[WT][0].activeTabId).toBe(t1.id) - expect( - store - .getState() - .unifiedTabsByWorktree[WT].map((t) => t.id) - .sort() - ).toEqual([t1.id, t2.id].sort()) - }) }) }) diff --git a/src/renderer/src/store/slices/worktrees/session/store-active-worktree-selection.test.ts b/src/renderer/src/store/slices/worktrees/session/store-active-worktree-selection.test.ts deleted file mode 100644 index dd48af07e5f..00000000000 --- a/src/renderer/src/store/slices/worktrees/session/store-active-worktree-selection.test.ts +++ /dev/null @@ -1,199 +0,0 @@ -import { describe, it, expect, vi, beforeEach } from 'vitest' -import '../../workspace-attention/workspace-unread-characterization-fixture' -import type * as AgentStatusModule from '@/lib/agent-status/aggregation/worktree-agent-status' -import { buildWorktreeComparator } from '../../../../../../shared/sidebar-list/smart-sort' -import '../../../../../../shared/workspace-scope' -import { createTestStore, seedStore } from '../../../testing/app-store-test-fixture' -import { makeOpenFile } from '../../editor/types/open-file.test-fixture' -import { makeTab } from '../../../terminals/terminal-tab.test-fixture' -import { makeTabGroup, makeUnifiedTab } from '../../tabs/tab-group.test-fixture' -import { makeWorktree } from '../worktree.test-fixture' -import { createStoreCascadesMockApi } from '../../../testing/app-store-cascade-api.test-fixture' - -const mockUnregisterPtyDataHandlers = vi.hoisted(() => vi.fn<() => unknown[]>(() => [])) -const mockRestorePtyDataHandlersAfterFailedShutdown = vi.hoisted(() => vi.fn()) - -vi.mock('sonner', () => ({ - toast: { info: vi.fn(), success: vi.fn(), error: vi.fn(), warning: vi.fn() } -})) - -vi.mock('@/components/terminal-pane/pty-transport/delivery/pty-dispatcher', () => ({})) - -vi.mock('@/components/terminal-pane/pty-transport/shutdown/pty-shutdown-data-suspension', () => ({ - restorePtyDataHandlersAfterFailedShutdown: mockRestorePtyDataHandlersAfterFailedShutdown, - unregisterPtyDataHandlers: mockUnregisterPtyDataHandlers -})) - -vi.mock('@/lib/agent-status/aggregation/worktree-agent-status', async (importOriginal) => { - const actual = await importOriginal() - return { - ...actual, - detectAgentStatusFromTitle: vi.fn().mockReturnValue(null) - } -}) - -const mockApi = createStoreCascadesMockApi() - -describe('setActiveWorktree', () => { - beforeEach(() => { - vi.clearAllMocks() - mockApi.worktrees.updateMeta.mockResolvedValue({}) - }) - - it('does not change smart-sort rank after selection when a background event bumps sortEpoch', () => { - const store = createTestStore() - const focusedId = 'repo1::/path/focused' - const backgroundId = 'repo1::/path/background' - const now = new Date('2026-04-16T12:00:00.000Z').getTime() - - vi.spyOn(Date, 'now').mockReturnValue(now) - - seedStore(store, { - worktreesByRepo: { - repo1: [ - makeWorktree({ - id: focusedId, - repoId: 'repo1', - displayName: 'Focused', - lastActivityAt: now - 2 * 60_000 - }), - makeWorktree({ - id: backgroundId, - repoId: 'repo1', - displayName: 'Background', - lastActivityAt: now - 60_000 - }) - ] - }, - refreshGitHubForWorktree: vi.fn(), - refreshGitHubForWorktreeIfStale: vi.fn() - }) - - store.getState().setActiveWorktree(focusedId) - store.getState().bumpWorktreeActivity(backgroundId) - - const worktrees = [...store.getState().worktreesByRepo.repo1] - const repoMap = new Map(store.getState().repos.map((repo) => [repo.id, repo])) - worktrees.sort(buildWorktreeComparator('smart', repoMap, now, new Map())) - - expect(worktrees.map((worktree) => worktree.id)).toEqual([backgroundId, focusedId]) - }) - - it('falls back to the worktree browser tab when the restored editor id belongs to a different worktree', () => { - const store = createTestStore() - const wt1 = 'repo1::/path/wt1' - const wt2 = 'repo1::/path/wt2' - const otherFileId = '/path/wt2/file.ts' - const browserTabId = 'browser-1' - - seedStore(store, { - worktreesByRepo: { - repo1: [ - makeWorktree({ id: wt1, repoId: 'repo1', path: '/path/wt1' }), - makeWorktree({ id: wt2, repoId: 'repo1', path: '/path/wt2' }) - ] - }, - openFiles: [makeOpenFile({ id: otherFileId, worktreeId: wt2 })], - activeFileIdByWorktree: { [wt1]: otherFileId }, - browserTabsByWorktree: { - [wt1]: [ - { - id: browserTabId, - worktreeId: wt1, - url: 'https://example.com', - title: 'Example', - loading: false, - faviconUrl: null, - canGoBack: false, - canGoForward: false, - loadError: null, - createdAt: 0 - } - ] - }, - activeBrowserTabIdByWorktree: { [wt1]: browserTabId }, - activeTabTypeByWorktree: { [wt1]: 'editor' } - }) - - store.getState().setActiveWorktree(wt1) - - const s = store.getState() - expect(s.activeWorktreeId).toBe(wt1) - expect(s.activeBrowserTabId).toBe(browserTabId) - expect(s.activeTabType).toBe('browser') - expect(s.activeFileId).toBeNull() - }) - - it('prefers the unified active tab over stale legacy browser restore state', () => { - const store = createTestStore() - const wt = 'repo1::/path/wt1' - const groupId = 'group-1' - const terminalId = 'terminal-1' - const browserTabId = 'browser-1' - - seedStore(store, { - worktreesByRepo: { - repo1: [makeWorktree({ id: wt, repoId: 'repo1', path: '/path/wt1' })] - }, - tabsByWorktree: { - [wt]: [makeTab({ id: terminalId, worktreeId: wt })] - }, - browserTabsByWorktree: { - [wt]: [ - { - id: browserTabId, - worktreeId: wt, - url: 'https://example.com', - title: 'Example', - loading: false, - faviconUrl: null, - canGoBack: false, - canGoForward: false, - loadError: null, - createdAt: 0 - } - ] - }, - activeBrowserTabIdByWorktree: { [wt]: browserTabId }, - activeTabTypeByWorktree: { [wt]: 'browser' }, - unifiedTabsByWorktree: { - [wt]: [ - makeUnifiedTab({ - id: 'tab-terminal-1', - entityId: terminalId, - worktreeId: wt, - groupId, - contentType: 'terminal' - }), - makeUnifiedTab({ - id: 'tab-browser-1', - entityId: browserTabId, - worktreeId: wt, - groupId, - contentType: 'browser' - }) - ] - }, - groupsByWorktree: { - [wt]: [ - makeTabGroup({ - id: groupId, - worktreeId: wt, - activeTabId: 'tab-terminal-1', - tabOrder: ['tab-terminal-1', 'tab-browser-1'] - }) - ] - }, - activeGroupIdByWorktree: { [wt]: groupId } - }) - - store.getState().setActiveWorktree(wt) - - const s = store.getState() - expect(s.activeWorktreeId).toBe(wt) - expect(s.activeTabType).toBe('terminal') - expect(s.activeTabTypeByWorktree[wt]).toBe('terminal') - expect(s.activeTabId).toBe(terminalId) - expect(s.activeBrowserTabId).toBe(browserTabId) - }) -}) diff --git a/src/renderer/src/store/slices/worktrees/teardown/bulk-worktree-purge-terminal-maps-leak.test.ts b/src/renderer/src/store/slices/worktrees/teardown/bulk-worktree-purge-terminal-maps-leak.test.ts deleted file mode 100644 index 354cf68eff7..00000000000 --- a/src/renderer/src/store/slices/worktrees/teardown/bulk-worktree-purge-terminal-maps-leak.test.ts +++ /dev/null @@ -1,178 +0,0 @@ -/** Bulk purge runs no terminal teardown; evict tab maps and PTY maps from live/durable bindings like single removal. External scans/project removal/hydration otherwise leak ephemeral terminal/agent keys for renderer lifetime. */ -import { describe, it, expect, vi, beforeEach } from 'vitest' -import type * as AgentStatusModule from '@/lib/agent-status/aggregation/worktree-agent-status' -import type * as RemoteRuntimePtyIdModule from '../../../../../../shared/remote-runtime/remote-runtime-pty-id' - -vi.mock('sonner', () => ({ - toast: { info: vi.fn(), success: vi.fn(), error: vi.fn(), warning: vi.fn() } -})) - -vi.mock('@/components/terminal-pane/pty-transport/delivery/pty-dispatcher', () => ({})) - -vi.mock('@/components/terminal-pane/pty-transport/shutdown/pty-shutdown-data-suspension', () => ({ - restorePtyDataHandlersAfterFailedShutdown: vi.fn(), - unregisterPtyDataHandlers: vi.fn() -})) - -vi.mock('@/lib/agent-status/aggregation/worktree-agent-status', async (importOriginal) => { - const actual = await importOriginal() - return { ...actual, detectAgentStatusFromTitle: vi.fn().mockReturnValue(null) } -}) - -vi.mock('../../../../../../shared/remote-runtime/remote-runtime-pty-id', async (importOriginal) => { - const actual = await importOriginal() - return { ...actual, parseRemoteRuntimePtyId: vi.fn(actual.parseRemoteRuntimePtyId) } -}) - -const mockApi = { - worktrees: { remove: vi.fn().mockResolvedValue(undefined) }, - pty: { kill: vi.fn().mockResolvedValue(undefined) } -} - -// @ts-expect-error -- minimal window.api stub for the store under test -globalThis.window = { api: mockApi } - -import { createTestStore, seedStore } from '../../../testing/app-store-test-fixture' -import { makeWorktree } from '../worktree.test-fixture' -import { makeTab } from '../../../terminals/terminal-tab.test-fixture' -import '../../../../../../shared/remote-runtime/remote-runtime-pty-id' - -const WT1 = 'repo1::/path/wt1' -const WT2 = 'repo1::/path/wt2' -const TAB1 = 'tab-wt1' -const TAB2 = 'tab-wt2' -const PTY1 = 'pty-wt1' -const PTY1_SPLIT = 'pty-wt1-split' -const REMOTE_PTY1 = 'remote:env-1@@terminal-wt1' -const REMOTE_HANDLE1 = 'terminal-wt1' -const REMOTE_PTY2_SAME_HANDLE = 'remote:env-2@@terminal-wt1' -const PTY2 = 'pty-wt2' - -function seedMaps(store: ReturnType): void { - seedStore(store, { - worktreesByRepo: { - repo1: [ - makeWorktree({ id: WT1, repoId: 'repo1', path: '/path/wt1' }), - makeWorktree({ id: WT2, repoId: 'repo1', path: '/path/wt2' }) - ] - }, - tabsByWorktree: { - [WT1]: [makeTab({ id: TAB1, worktreeId: WT1, ptyId: PTY1 })], - [WT2]: [makeTab({ id: TAB2, worktreeId: WT2, ptyId: PTY2 })] - }, - // Slept/stale tabs lack live PTY index entries; recover owned IDs from durable wake bindings. - ptyIdsByTabId: { [TAB1]: [], [TAB2]: [PTY2] }, - terminalLayoutsByTabId: { - [TAB1]: { - root: { - type: 'split', - direction: 'horizontal', - first: { type: 'leaf', leafId: 'leaf-1' }, - second: { type: 'leaf', leafId: 'leaf-2' } - }, - activeLeafId: 'leaf-1', - expandedLeafId: null, - ptyIdsByLeafId: { 'leaf-1': PTY1_SPLIT, 'leaf-2': REMOTE_PTY1 } - } - }, - lastKnownRelayPtyIdByTabId: { [TAB1]: PTY1, [TAB2]: PTY2 }, - pendingReconnectPtyIdByTabId: { [TAB1]: PTY1, [TAB2]: PTY2 }, - deferredSshSessionIdsByTabId: { [TAB1]: 'ssh-sess-1', [TAB2]: 'ssh-sess-2' }, - pendingInitialCwdByTabId: { [TAB1]: '/path/wt1', [TAB2]: '/path/wt2' }, - pendingIssueCommandSplitByTabId: { - [TAB1]: { command: 'a' }, - [TAB2]: { command: 'b' } - }, - pendingStartupByTabId: { [TAB1]: { command: 'start-a' }, [TAB2]: { command: 'start-b' } }, - codexRestartNoticeByPtyId: { - [PTY1]: { previousAccountLabel: 'a1', nextAccountLabel: 'a2' }, - [PTY2]: { previousAccountLabel: 'b1', nextAccountLabel: 'b2' } - }, - migrationUnsupportedByPtyId: { - [PTY1]: { - ptyId: PTY1, - paneKey: `${TAB1}:leaf-1`, - reason: 'legacy-numeric-pane-key', - source: 'local', - updatedAt: 1 - }, - [PTY2]: { - ptyId: PTY2, - paneKey: `${TAB2}:leaf-1`, - reason: 'legacy-numeric-pane-key', - source: 'local', - updatedAt: 2 - } - }, - suppressedPtyExitIds: { - [PTY1]: true, - [PTY1_SPLIT]: true, - [REMOTE_PTY1]: true, - [PTY2]: true - }, - pendingPaneAccountRestarts: { - [PTY1]: 'codex', - [PTY1_SPLIT]: 'codex', - [REMOTE_PTY1]: 'codex', - [PTY2]: 'codex' - } - }) -} - -describe('bulk worktree purge evicts the per-tab/per-pty terminal maps it previously leaked', () => { - beforeEach(() => vi.clearAllMocks()) - - it('keeps environment-scoped remote guard identities independent', () => { - const store = createTestStore() - seedMaps(store) - store.setState((s) => ({ - ptyIdsByTabId: { - ...s.ptyIdsByTabId, - [TAB2]: [...s.ptyIdsByTabId[TAB2], REMOTE_PTY2_SAME_HANDLE] - }, - suppressedPtyExitIds: { - ...s.suppressedPtyExitIds, - [REMOTE_PTY2_SAME_HANDLE]: true - }, - pendingPaneAccountRestarts: { - ...s.pendingPaneAccountRestarts, - [REMOTE_PTY2_SAME_HANDLE]: 'codex' - } - })) - - store.getState().purgeWorktreeTerminalState([WT1]) - const s = store.getState() - - expect(s.suppressedPtyExitIds[REMOTE_PTY1]).toBeUndefined() - expect(s.pendingPaneAccountRestarts[REMOTE_PTY1]).toBeUndefined() - expect(s.suppressedPtyExitIds[REMOTE_PTY2_SAME_HANDLE]).toBe(true) - expect(s.pendingPaneAccountRestarts[REMOTE_PTY2_SAME_HANDLE]).toBe('codex') - }) - - it('retains a raw remote handle that is also a surviving local PTY id', () => { - const store = createTestStore() - seedMaps(store) - store.setState((s) => ({ - ptyIdsByTabId: { - ...s.ptyIdsByTabId, - [TAB2]: [...s.ptyIdsByTabId[TAB2], REMOTE_HANDLE1] - }, - pendingPaneAccountRestarts: { - ...s.pendingPaneAccountRestarts, - [REMOTE_HANDLE1]: 'codex' - }, - suppressedPtyExitIds: { - ...s.suppressedPtyExitIds, - [REMOTE_HANDLE1]: true - } - })) - - store.getState().purgeWorktreeTerminalState([WT1]) - const s = store.getState() - - expect(s.suppressedPtyExitIds[REMOTE_PTY1]).toBeUndefined() - expect(s.pendingPaneAccountRestarts[REMOTE_PTY1]).toBeUndefined() - expect(s.suppressedPtyExitIds[REMOTE_HANDLE1]).toBe(true) - expect(s.pendingPaneAccountRestarts[REMOTE_HANDLE1]).toBe('codex') - }) -}) diff --git a/src/renderer/src/store/slices/worktrees/teardown/native-chat-launch-draft-teardown.test.ts b/src/renderer/src/store/slices/worktrees/teardown/native-chat-launch-draft-teardown.test.ts index fba83e07b1c..29927ef75ae 100644 --- a/src/renderer/src/store/slices/worktrees/teardown/native-chat-launch-draft-teardown.test.ts +++ b/src/renderer/src/store/slices/worktrees/teardown/native-chat-launch-draft-teardown.test.ts @@ -1,12 +1,7 @@ /** Evict nativeChatLaunchDraftByTabId wherever launch prompt retires (close, orphan sweep, bulk/single purge); stranded drafts otherwise keep publishing to mobile. */ -import { afterEach, describe, it, expect, vi, beforeEach } from 'vitest' +import { describe, it, expect, vi, beforeEach } from 'vitest' import type * as AgentStatusModule from '@/lib/agent-status/aggregation/worktree-agent-status' -import { - drawTabsFromMain, - type TabsDrawnFromMain -} from '../../tabs/tabs-drawn-from-main.test-fixture' - vi.mock('sonner', () => ({ toast: { info: vi.fn(), success: vi.fn(), error: vi.fn(), warning: vi.fn() } })) @@ -51,12 +46,7 @@ globalThis.window = { api: mockApi } import { createTestStore, seedStore } from '../../../testing/app-store-test-fixture' import { makeWorktree } from '../worktree.test-fixture' import { makeTab } from '../../../terminals/terminal-tab.test-fixture' -import { makeTabGroup, makeUnifiedTab } from '../../tabs/tab-group.test-fixture' -import { - readNativeChatComposerDraft, - updateNativeChatComposerDraft -} from '@/components/native-chat/drafts/native-chat-composer-draft-store' -import { structuredAgentSessionDraftScopeKey } from '@/components/native-chat/drafts/native-chat-draft-scope' +import { readNativeChatComposerDraft } from '@/components/native-chat/drafts/native-chat-composer-draft-store' import { addNativeChatPendingAttachment, settleNativeChatPendingAttachment @@ -91,15 +81,10 @@ function seedDrafts(store: ReturnType): void { } describe('nativeChatLaunchDraftByTabId teardown', () => { - let main: TabsDrawnFromMain | undefined beforeEach(() => { vi.clearAllMocks() mockApi.worktrees.remove.mockResolvedValue(undefined) }) - afterEach(() => { - main?.close() - main = undefined - }) it('a user tab close drops the uploads still on their way in that tab’s panes only', () => { const store = createTestStore() @@ -117,64 +102,4 @@ describe('nativeChatLaunchDraftByTabId teardown', () => { expect(settled).toEqual([false, true]) expect(readNativeChatComposerDraft(`${TAB1}:leaf-b`).images).toEqual([]) }) - - function seedStructuredChat(store: ReturnType) { - const chat = makeUnifiedTab({ - id: 'chat-tab', - entityId: 'session-1', - contentType: 'agent-session', - worktreeId: WT1, - groupId: 'group-1' - }) - seedStore(store, { - worktreesByRepo: { - repo1: [ - makeWorktree({ id: WT1, repoId: 'repo1', path: '/path/wt1' }), - makeWorktree({ id: WT2, repoId: 'repo1', path: '/path/wt2' }) - ] - }, - unifiedTabsByWorktree: { [WT1]: [chat] }, - groupsByWorktree: { - [WT1]: [ - makeTabGroup({ - id: 'group-1', - worktreeId: WT1, - activeTabId: chat.id, - tabOrder: [chat.id] - }) - ] - } - }) - return chat - } - - it('closing a structured chat tab keeps its conversation’s unsent draft', async () => { - const store = createTestStore() - const chat = seedStructuredChat(store) - main = await drawTabsFromMain(store) - const conversation = structuredAgentSessionDraftScopeKey('session-1') - updateNativeChatComposerDraft(conversation, { text: 'unsent' }, 'immediate') - - store.getState().closeUnifiedTab(chat.id) - await main.settle() - - // Main's frame drops a workspace with no tabs left; the window keeps an empty list. - expect(store.getState().unifiedTabsByWorktree[WT1] ?? []).toEqual([]) - expect(readNativeChatComposerDraft(conversation).text).toBe('unsent') - }) - - it('removing a worktree drops its structured chats’ conversation drafts only', async () => { - const store = createTestStore() - seedStructuredChat(store) - const removed = structuredAgentSessionDraftScopeKey('session-1') - const other = structuredAgentSessionDraftScopeKey('session-2') - updateNativeChatComposerDraft(removed, { text: 'unsent' }, 'immediate') - updateNativeChatComposerDraft(other, { text: 'kept' }, 'immediate') - - const result = await store.getState().removeWorktree({ id: WT1, executionHostId: null }) - - expect(result).toEqual({ ok: true }) - expect(readNativeChatComposerDraft(removed).text).toBe('') - expect(readNativeChatComposerDraft(other).text).toBe('kept') - }) }) diff --git a/src/renderer/src/store/slices/worktrees/teardown/worktrees-background-removal.test.ts b/src/renderer/src/store/slices/worktrees/teardown/worktrees-background-removal.test.ts index bdae93d8147..de28b759da6 100644 --- a/src/renderer/src/store/slices/worktrees/teardown/worktrees-background-removal.test.ts +++ b/src/renderer/src/store/slices/worktrees/teardown/worktrees-background-removal.test.ts @@ -131,20 +131,4 @@ describe('removing a worktree the host deletes in the background', () => { expect(attempt.draft?.text).toBe('pending task') clearNativeChatComposerDraftsForTests() }) - - it('lost removal reply keeps draft when listing is unreadable', async () => { - clearNativeChatComposerDraftsForTests() - seedRow(store) - hostListsOnRefresh(new Error('unreadable')) - const scope = nativeChatLaunchPromptDraftScopeKey(worktreeId, 'codex', 'local') - updateNativeChatComposerDraft(scope, { text: 'pending task' }, 'immediate') - const attempt = captureNativeChatComposerSubmission(scope) - mockApi.worktrees.remove.mockRejectedValue(new Error('Request timed out: worktree.rm')) - const result = await store - .getState() - .removeWorktree({ id: worktreeId, executionHostId: 'local' }) - expect(result.ok).toBe(false) - expect(attempt.draft?.text).toBe('pending task') - clearNativeChatComposerDraftsForTests() - }) }) diff --git a/src/renderer/src/store/terminals/store-sleep-twin-host-owner.test.ts b/src/renderer/src/store/terminals/store-sleep-twin-host-owner.test.ts deleted file mode 100644 index 404d7c15730..00000000000 --- a/src/renderer/src/store/terminals/store-sleep-twin-host-owner.test.ts +++ /dev/null @@ -1,166 +0,0 @@ -import { describe, it, expect, vi, beforeEach } from 'vitest' -import type * as AgentStatusModule from '@/lib/agent-status/aggregation/worktree-agent-status' -import { createCompatibleRuntimeStatusResponseIfNeeded } from '../../runtime/rpc/testing/runtime-compatibility-test-fixture' -import { clearRuntimeCompatibilityCache as clearRuntimeCompatibilityCacheForTests } from '../../runtime/rpc/compatibility/runtime-compatibility-cache' -import { createTestStore, seedStore } from '../testing/app-store-test-fixture' -import { makeRuntimeOwnedWorktree } from '../slices/worktrees/worktree-owner.test-fixture' -import { makeTab } from './terminal-tab.test-fixture' -import { makeWorktree } from '../slices/worktrees/worktree.test-fixture' -import { shutdownBufferCaptures } from '@/components/terminal-pane/snapshots/shutdown-buffer-captures' -import { applySleepRuntimeRpcDefault } from './terminal-sleep-rpc.test-fixture' -import { createStoreCascadesMockApi } from '../testing/app-store-cascade-api.test-fixture' - -const mockUnregisterPtyDataHandlers = vi.hoisted(() => vi.fn<() => unknown[]>(() => [])) - -vi.mock('sonner', () => ({ - toast: { info: vi.fn(), success: vi.fn(), error: vi.fn(), warning: vi.fn() } -})) - -vi.mock('@/components/terminal-pane/pty-transport/delivery/pty-dispatcher', () => ({})) - -vi.mock('@/components/terminal-pane/pty-transport/shutdown/pty-shutdown-data-suspension', () => ({ - restorePtyDataHandlersAfterFailedShutdown: vi.fn(), - unregisterPtyDataHandlers: mockUnregisterPtyDataHandlers -})) - -vi.mock('@/lib/agent-status/aggregation/worktree-agent-status', async (importOriginal) => { - const actual = await importOriginal() - return { ...actual, detectAgentStatusFromTitle: vi.fn().mockReturnValue(null) } -}) - -const mockApi = createStoreCascadesMockApi() - -const WT = 'repo1::/path/wt1' -const LEAF = '11111111-1111-4111-8111-111111111111' -const PANE_KEY = `tab-1:${LEAF}` - -// Same repo ID/path on both SSH and managed-runtime hosts exercises owner-qualified sleep. -function seedTwin(store: ReturnType, ptyIds: string[]): void { - seedStore(store, { - worktreesByRepo: { - repo1: [ - makeWorktree({ id: WT, repoId: 'repo1', path: '/path/wt1', hostId: 'ssh:ssh-1' }), - makeRuntimeOwnedWorktree({ id: WT, repoId: 'repo1', path: '/path/wt1' }, 'runtime-1') - ] - }, - tabsByWorktree: { - [WT]: [makeTab({ id: 'tab-1', worktreeId: WT, title: 'Codex', ptyId: ptyIds[0] ?? null })] - }, - terminalLayoutsByTabId: { - 'tab-1': { - root: { type: 'leaf', leafId: LEAF }, - activeLeafId: LEAF, - expandedLeafId: null, - ptyIdsByLeafId: ptyIds[0] ? { [LEAF]: ptyIds[0] } : {} - } - }, - ptyIdsByTabId: { 'tab-1': ptyIds } - }) - store - .getState() - .setAgentStatus( - PANE_KEY, - { state: 'done', prompt: 'resume target', agentType: 'codex' }, - 'Codex', - { updatedAt: 2000, stateStartedAt: 1000 }, - { tabId: 'tab-1', worktreeId: WT }, - { providerSession: { key: 'session_id', id: 'target-session' } } - ) -} - -function isRuntimeCall(value: unknown): value is { selector: string; method: string } { - return ( - typeof value === 'object' && - value !== null && - 'selector' in value && - typeof value.selector === 'string' && - 'method' in value && - typeof value.method === 'string' - ) -} - -function runtimeCallsFor(method: string): { selector: string }[] { - return mockApi.runtimeEnvironments.call.mock.calls - .map((call: unknown[]) => call[0]) - .filter(isRuntimeCall) - .filter((args) => args.method === method) -} - -describe('sleeping a worktree published by an SSH host and a runtime twin', () => { - beforeEach(() => { - vi.clearAllMocks() - clearRuntimeCompatibilityCacheForTests() - mockApi.pty.kill.mockResolvedValue(undefined) - mockUnregisterPtyDataHandlers.mockReturnValue([]) - applySleepRuntimeRpcDefault(mockApi) - shutdownBufferCaptures.clear() - }) - - it.each([ - ['a remote PTY that names no runtime', ['remote:pty-1']], - ['no bound PTY at all', []], - ['PTYs split across two runtimes', ['remote:runtime-1@@pty-1', 'remote:runtime-2@@pty-2']] - ])('refuses, leaving bindings and resume records untouched, for %s', async (_label, ptyIds) => { - const store = createTestStore() - seedTwin(store, ptyIds) - const warn = vi.spyOn(console, 'warn').mockImplementation(() => {}) - - await expect( - store.getState().shutdownWorktreeTerminals(WT, { keepIdentifiers: true }) - ).rejects.toThrow('ambiguous_terminal_owner') - - expect(runtimeCallsFor('terminal.sleep')).toEqual([]) - expect(mockApi.pty.kill).not.toHaveBeenCalled() - expect(store.getState().ptyIdsByTabId['tab-1']).toEqual(ptyIds) - expect(store.getState().sleepingAgentSessionsByPaneKey[PANE_KEY]?.origin).toBe('live') - expect(warn).toHaveBeenCalled() - warn.mockRestore() - }) -}) - -describe('hibernating a completed agent pane in a twin-published worktree', () => { - beforeEach(() => { - vi.clearAllMocks() - clearRuntimeCompatibilityCacheForTests() - mockApi.pty.kill.mockResolvedValue(undefined) - mockUnregisterPtyDataHandlers.mockReturnValue([]) - shutdownBufferCaptures.clear() - mockApi.runtimeEnvironments.call.mockImplementation((args: { method: string }) => - Promise.resolve( - createCompatibleRuntimeStatusResponseIfNeeded(args) ?? { - id: 'rpc', - ok: true, - result: - args.method === 'terminal.stopExact' - ? { stoppedPtyIds: ['pty-1'], livePtyIds: ['pty-1'], postStopVerified: true } - : {}, - _meta: { runtimeId: 'remote-runtime' } - } - ) - ) - }) - - it.each([ - ['a remote PTY with no host stop to run', 'remote:runtime-1@@pty-1', undefined], - ['a remote PTY that names no runtime', 'remote:pty-1', 'pty-1'] - ])('refuses %s without touching bindings', async (_label, ptyId, expectedRuntimePtyId) => { - const store = createTestStore() - seedTwin(store, [ptyId]) - const warn = vi.spyOn(console, 'warn').mockImplementation(() => {}) - - await expect( - store.getState().shutdownCompletedAgentPaneForHibernation(WT, { - paneKey: PANE_KEY, - tabId: 'tab-1', - leafId: LEAF, - ptyId, - ...(expectedRuntimePtyId ? { expectedRuntimePtyId } : {}) - }) - ).rejects.toThrow('ambiguous_terminal_owner') - - expect(runtimeCallsFor('terminal.stopExact')).toEqual([]) - expect(store.getState().ptyIdsByTabId['tab-1']).toEqual([ptyId]) - expect(store.getState().sleepingAgentSessionsByPaneKey[PANE_KEY]?.origin).toBe('live') - warn.mockRestore() - }) -}) diff --git a/src/renderer/src/web/web-preload-api-runtime-calls.test.ts b/src/renderer/src/web/web-preload-api-runtime-calls.test.ts index 723cd635f7f..2cbf682efdd 100644 --- a/src/renderer/src/web/web-preload-api-runtime-calls.test.ts +++ b/src/renderer/src/web/web-preload-api-runtime-calls.test.ts @@ -17,43 +17,6 @@ describe('web preload runtime calls', () => { vi.doUnmock('./web-runtime-client') }) - it('surfaces per-environment queue overload without invoking the client', async () => { - let release!: () => void - const blocked = new Promise>((resolve) => { - release = () => - resolve({ - id: 'runtime.blocked', - ok: true, - result: null, - _meta: { runtimeId: 'runtime-a' } - }) - }) - const call = vi.fn(() => blocked) - vi.doMock('./web-runtime-client', () => ({ - WebRuntimeClient: class { - call = call - close(): void {} - } - })) - const globals = installBrowserGlobals('Linux') - writeStoredRuntimeEnvironment(globals.storage, 'web-server-a') - const { installWebPreloadApi } = await import('./web-preload-api') - installWebPreloadApi() - - const accepted = Array.from({ length: 264 }, (_, index) => - globals.window.api.runtime.call({ method: `runtime.blocked.${index}` }) - ) - const overloaded = globals.window.api.runtime.call({ method: 'runtime.overloaded' }) - - await expect(overloaded).rejects.toMatchObject({ - code: 'runtime_rpc_queue_overloaded', - scope: 'selector' - }) - expect(call).toHaveBeenCalledTimes(8) - release() - await expect(Promise.all(accepted)).resolves.toHaveLength(264) - }) - it('revokes unsent work and refuses queued or delivered work after pairing replacement', async () => { let release!: () => void const blocked = new Promise>((resolve) => { From 1af64194a46d338777058c06954c2c8ee4a437be Mon Sep 17 00:00:00 2001 From: Neil <4138956+nwparker@users.noreply.github.com> Date: Tue, 10 Nov 2026 16:04:03 -0800 Subject: [PATCH 11/11] refactor: group renderer agent sessions and runtime modules by owner (#40911) * refactor: group renderer agent sessions and runtime modules by owner * fix: carry moved owner paths into refactor ratchets * test: remove retired empty sleep guard registration --- config/flaky-test-pattern-baseline.txt | 9 +- config/focus-setting-read-baseline.txt | 10 +- config/reliability-gates.jsonc | 5 +- .../scripts/ci/sharding/ci-shard-timings.json | 66 +- ...eck-terminal-parking-ownership-ratchet.mjs | 2 +- .../appearance/terminal-app-theme.ts | 31 +- .../storage}/indexeddb-connection.ts | 0 .../app-shell/use-app-startup-hydration.ts | 4 +- .../use-terminal-viewer-color-publication.ts | 4 +- .../AgentDefaultSurfacePreviews.tsx | 7 +- .../runs/automation-run-workspace-action.ts | 6 +- .../components/cmd-j/quick-action-context.ts | 10 +- .../dashboard-popout/AgentTerminalPreview.tsx | 25 +- .../dashboard-preview-http-actions.ts | 16 +- .../dashboard/dashboard-card-labels.ts | 10 +- .../use-agent-row-conversation-name.ts | 2 +- .../editor/autosave/editor-autosave.ts | 4 +- .../editor/editor-dropped-file-open.ts | 18 +- .../links/markdown-preview-link-actions.ts | 2 +- .../markdown-preview-system-link-action.ts | 4 +- .../notebook/outputs/IpynbCellOutputs.tsx | 11 +- .../editor/open-editor-html-preview.test.ts | 23 +- .../editor/open-editor-html-preview.ts | 6 +- .../images/rich-markdown-image-insert.ts | 6 +- .../rich-markdown-editor-click-routing.ts | 18 +- .../feature-wall/FeatureWallBrowserAction.tsx | 8 +- ...e-feature-wall-task-source-presentation.ts | 7 +- .../use-integration-connection-status.ts | 5 +- .../FloatingTerminalPanelSurface.tsx | 2 +- .../floating-workspace-tab-creation.ts | 4 +- .../use-floating-terminal-create-actions.ts | 2 +- .../use-floating-terminal-panel-shortcuts.ts | 14 +- ...use-floating-terminal-panel-store-state.ts | 4 +- .../source-control-preflight-card-status.ts | 12 +- .../NativeChatResumeOnRestartModal.tsx | 16 +- .../native-chat-resume-bulk-progress.test.tsx | 150 ----- .../native-chat-appearance-style.ts | 7 +- .../use-native-chat-external-attachments.ts | 31 +- .../use-native-chat-workspace-file-drop.ts | 11 +- .../uploads/native-chat-attachment-owner.ts | 7 +- .../native-chat-composer-workspace.ts | 12 +- .../native-chat-skill-discovery-context.ts | 12 +- .../pickers/use-native-chat-mention-files.ts | 4 +- ...ativeChatMessageList.opening-send.test.tsx | 416 ------------- ...ChatMessageList.queued-turn-order.test.tsx | 163 ----- ...veChatMessageList.turn-membership.test.tsx | 538 ----------------- ...iveChatMessageList.turn-indicator.test.tsx | 259 -------- .../native-chat-composer-draft-indexeddb.ts | 10 +- .../drafts/native-chat-draft-owner.ts | 6 +- .../native-chat-image-runtime-context.ts | 18 +- .../media/visuals/NativeChatInlineVisual.tsx | 10 +- .../actions/NativeChatRowActionsProvider.tsx | 6 +- .../NativeChatAgentMessageSenders.tsx | 12 +- ...hat-agent-message-sender-identity.test.tsx | 103 +--- .../native-chat-agent-message-sender-label.ts | 9 +- ...ve-chat-agent-message-sender-open.test.tsx | 163 ----- .../rows/NativeChatMessageRow.test.tsx | 201 ------- .../native-chat-header-ownership.test.tsx | 136 ----- .../pane/actions/use-native-chat-hand-off.tsx | 17 +- .../ownership/native-chat-runtime-owner.ts | 4 +- .../pane/ownership/native-chat-tab-owner.ts | 2 +- .../pane/routing/native-chat-tab-directory.ts | 10 +- ...veChatQueuedMessageList.in-flight.test.tsx | 96 --- .../native-chat-session-option-discovery.ts | 16 +- ...ession-status-bridge-failed-start.test.tsx | 408 ------------- ...n-status-bridge-unconfirmed-start.test.tsx | 355 ----------- ...iveChatMessageList.unsent-message.test.tsx | 224 ------- ...ChatMessageList.subagent-sections.test.tsx | 230 ------- .../NativeChatMessageList.test.tsx | 484 --------------- .../usage/NativeChatUsageLimitActions.tsx | 22 +- ...tiveChatMessageList.older-history.test.tsx | 429 ------------- ...ChatMessageList.rail-history-jump.test.tsx | 354 ----------- .../NativeChatMessageList.windowing.test.tsx | 307 ---------- ...pace-name-field-foundation.source.test.tsx | 22 +- .../use-work-item-source-foundation.ts | 19 +- .../src/components/onboarding/ThemeStep.tsx | 14 +- .../orchestration-crew/CrewRowView.tsx | 9 +- .../PlainSshTerminalView.tsx | 16 +- .../plugins/state/plugin-theme-apply.ts | 14 +- .../pull-request-page/checks/tab.tsx | 18 +- .../FolderWorkspaceSourceControlPanel.tsx | 4 +- .../FolderWorkspaceWorktreesPanel.tsx | 6 +- .../scanning/ai-vault-saved-session-lists.ts | 10 +- .../ai-vault-original-pane-actions.ts | 6 +- .../ai-vault-session-launch-actions.ts | 26 +- .../ai-vault-session-resume-here.ts | 24 +- .../ai-vault-session-resume-in-chat-launch.ts | 18 +- .../use-ai-vault-session-display-title.ts | 4 +- .../sync/git-history-commit-context-menu.tsx | 4 +- .../editor/GeneralEditorSettingsSection.tsx | 6 +- .../form-controls/SettingsFormControls.tsx | 4 +- .../repository/mcp/McpConfigSection.tsx | 14 +- .../settings/shortcuts/ShortcutsPane.tsx | 15 +- .../components/settings/ssh/SshPane.test.tsx | 172 ------ .../src/components/settings/ssh/SshPane.tsx | 12 +- .../use-task-source-provider-readiness.ts | 6 +- .../TerminalAdvancedTypographyControls.tsx | 4 +- .../TerminalCursorAppearanceSection.tsx | 4 +- .../TerminalPaneAppearanceSection.tsx | 4 +- .../appearance/TerminalSettingsPreview.tsx | 7 +- .../appearance/TerminalWindowSection.tsx | 9 +- .../configuration/useTerminalConfigImport.ts | 14 +- .../terminal/themes/TerminalThemePicker.tsx | 4 +- .../terminal/themes/TerminalThemeSections.tsx | 20 +- .../setup-guide/use-setup-guide-progress.ts | 11 +- .../sidebar/SidebarTaskNavButton.tsx | 3 +- .../project-move-pause-follower.test.ts | 6 +- .../use-worktree-context-menu-commands.ts | 8 +- .../sleep/workspace-sleep-follower.ts | 12 +- .../listing/use-sleeping-sweep-retention.ts | 6 +- .../use-visible-worktrees-retention.test.tsx | 100 +-- .../SshStatusSegment.large-host-list.test.tsx | 138 ----- .../status-bar/SshStatusSegment.tsx | 10 +- .../src/components/tab-bar/EditorFileTab.tsx | 6 +- .../tab-bar/TerminalSortableTab.tsx | 5 +- .../cli-chat-resume-close-admission.ts | 14 +- .../tab-bar/cli-chat-resume-feedback.ts | 12 +- .../tab-bar/native-chat-cli-fork-run.ts | 27 +- .../tab-bar/use-tab-bar-runtime-model.ts | 26 +- .../tab-group/AiVaultSessionDropLayer.tsx | 11 +- .../components/tab-group/SplitPaneLanding.tsx | 9 +- .../tab-group/useTabGroupCreationCommands.ts | 11 +- .../task-page/use-task-page-store-bindings.ts | 4 +- .../detached/codex-detached-pane-restart.ts | 13 +- .../resolve-terminal-pane-appearance.ts | 4 +- .../appearance/terminal-appearance.ts | 5 +- .../host-state/terminal-pane-wsl-distro.ts | 2 +- .../file-drop/terminal-drop-local-wsl.ts | 4 +- .../terminal-drop-transport-owner.ts | 2 +- .../links/files/terminal-file-link-actions.ts | 16 +- .../files/terminal-file-link-browser-open.ts | 16 +- .../files/terminal-file-link-editor-open.ts | 4 +- .../files/terminal-file-link-hit-testing.ts | 17 +- .../links/files/terminal-file-open-routing.ts | 16 +- .../parked-terminal-byte-watcher.test.ts | 516 ---------------- .../emulation/pane-mode-2031-state.ts | 7 +- .../host-ownership/pane-project-runtime.ts | 2 +- ...-connection-deliberate-sleep-guard.spec.ts | 180 ------ .../pty-connection/run-deferred-connect.ts | 18 +- .../hidden-agent-resume-deferral.test.ts | 11 +- .../spawn/hidden-agent-resume-deferral.ts | 2 +- .../saved-resume-startup-cancellation.ts | 4 +- .../pty-connection-spawn-and-startup.test.ts | 2 - .../terminal-agent-session-fork.ts | 12 +- .../components/terminal-workspace-keydown.ts | 6 +- .../background-terminal-worktree-mount.ts | 8 +- .../initial-terminal-admission-wait.test.tsx | 304 ---------- .../terminal-worktree-prewarm-targets.ts | 6 +- .../components/use-terminal-create-actions.ts | 11 +- .../src/components/wsl-move/WslMoveDialog.tsx | 22 +- .../composer-state/attachment-drop-state.ts | 36 +- .../runtime-target-selection.ts | 9 +- .../ipc-events/agent-status-listeners.ts | 19 +- ...rect-ssh-hydration-target-metadata.test.ts | 40 +- .../ipc-events/direct-ssh-state-ipc-bridge.ts | 12 +- .../terminal-pane-title-ipc-bridge.ts | 12 +- .../terminal-presentation-ipc-bridge.ts | 4 +- .../ipc-events/terminal-request-ipc-bridge.ts | 4 +- .../runtime/useActiveProjectSkillRuntime.ts | 16 +- ...use-integration-provider-status-refresh.ts | 4 +- .../src/hooks/use-split-divider-setting.ts | 7 +- src/renderer/src/hooks/useDetectedAgents.ts | 8 +- .../hooks/useSettingsNavigationMetadata.ts | 18 +- ...e-ai-vault-structured-session-host.test.ts | 220 ------- ...ai-vault-structured-session-reveal.test.ts | 122 ---- .../agent-account-restart-startup.test.ts | 14 +- .../accounts/agent-account-restart-startup.ts | 20 +- .../claude-session-account-move.test.ts | 16 +- .../claude/claude-session-account-move.ts | 38 +- .../codex-pane-selection-lane.test.ts | 2 +- .../accounts}/codex-pane-selection-lane.ts | 38 +- .../accounts/codex/codex-session-restart.ts | 11 +- .../codex-stale-pane-account-identity.test.ts | 24 +- .../codex}/codex-stale-pane-sweep.test.ts | 28 +- .../accounts/codex/codex-stale-pane-sweep.ts | 8 +- .../agent-hibernation-coordinator.ts | 16 +- .../structured-agent-launch-settlement.ts | 16 +- ...codex-model-catalog-reader-test-fixture.ts | 4 +- ...launch-agent-picker-codex-contract.test.ts | 147 ----- ...unch-agent-structured-chat-test-fixture.ts | 15 +- .../pane/agent-launch-tab-publication.ts | 14 +- .../launch-parity-renderer.test-fixture.ts | 14 +- .../routing/agent-launch-route-input.test.ts | 16 +- .../routing/agent-launch-route-input.ts | 17 +- ...ent-launch-route-registered-agents.test.ts | 118 ---- .../routing/agent-session-launch-plan.ts | 49 +- .../structured-agent-session-action-launch.ts | 18 +- ...ructured-agent-session-create-hydration.ts | 4 +- ...structured-agent-session-launch-abandon.ts | 2 +- ...agent-session-launch-after-failure.test.ts | 75 +-- ...ed-agent-session-launch-close-race.test.ts | 291 --------- ...ctured-agent-session-launch-create-call.ts | 16 +- ...t-session-launch-different-request.test.ts | 44 +- ...tured-agent-session-launch-fork-support.ts | 12 +- ...ructured-agent-session-launch-fork.test.ts | 332 +--------- ...ructured-agent-session-launch-host-seed.ts | 24 + ...structured-agent-session-launch-intent.ts} | 59 +- ...agent-session-launch-join-delivery.test.ts | 23 +- ...tured-agent-session-launch-options.test.ts | 245 +------- ...structured-agent-session-launch-options.ts | 40 +- ...d-agent-session-launch-persistence.test.ts | 43 +- ...-agent-session-launch-probe-outage.test.ts | 7 +- .../structured-agent-session-launch-record.ts | 9 +- ...tructured-agent-session-launch-recovery.ts | 16 +- .../structured-agent-session-launch-reload.ts | 16 +- ...sion-launch-unconfirmed-or-retried.test.ts | 318 ---------- ...tured-agent-session-launch.test-fixture.ts | 32 +- .../structured-agent-session-launch.test.ts | 416 ------------- .../launch/structured-agent-session-launch.ts | 51 +- ...-agent-session-new-chat-own-launch.test.ts | 466 -------------- .../messaging/notes-send-agent-targets.ts | 25 +- ...ai-vault-structured-session-reveal.test.ts | 50 ++ .../activate-ai-vault-structured-session.ts | 28 +- .../open}/open-agent-message-sender.ts | 18 +- .../open}/open-existing-structured-session.ts | 30 +- .../open-located-agent-message-sender.ts | 20 +- ...-agent-session-selection-lifetime.test.tsx | 550 ----------------- ...finished-agent-resume-resurrection.test.ts | 8 +- .../resume}/forget-refused-pane-resume.ts | 10 +- .../history/ai-vault-resume-platform.ts | 2 +- .../resume/history/ai-vault-resume-shell.ts | 10 +- .../cli-conversation-exit-guidance.ts | 4 +- .../launch-ai-vault-session-and-reveal.ts | 4 +- .../history}/launch-ai-vault-session.ts | 6 +- .../resume}/host-mirror-handle-gap-wait.ts | 7 +- .../resume/host-mirrored-pane-liveness.ts | 6 +- .../paired-runtime-closed-tab-resume.test.ts | 83 +-- .../resume/resume-sleeping-agent-session.ts | 18 +- .../retracted-host-pane-resume.test.ts | 8 +- .../resume/sleeping-agent-session-launch.ts | 8 +- .../resume}/sleeping-agent-wake-requests.ts | 6 +- .../wake-sleeping-agents-in-background.ts | 12 +- .../tab-identity}/open-tab-occupant-agent.ts | 21 +- .../structured-chat-tab-index.ts | 4 +- .../tab-agent-remote-pty-selector.ts | 2 +- .../tab-identity}/tab-agent-status-index.ts | 8 +- .../tab-identity}/tab-agent.ts | 15 +- ...ab-agent-observed-signal-dispatch.test.tsx | 15 +- .../tab-identity/use-tab-agent.test.ts | 143 +++++ .../tab-identity}/use-tab-agent.ts | 15 +- .../src/lib/browser/documents/file-preview.ts | 17 +- .../browser/navigation/app-http-link-open.ts | 11 +- .../browser-link-destination.test.ts | 90 +-- .../navigation/browser-link-destination.ts | 22 +- .../browser-link-open-layout-owner.test.ts | 386 ------------ .../navigation/browser-link-open.test.ts | 32 +- .../browser/navigation/browser-link-open.ts | 16 +- .../navigation/http-link-browser-placement.ts | 8 +- .../navigation/http-link-completion.test.ts | 140 ----- .../navigation/http-link-destinations.ts | 12 +- .../http-link-in-group-availability.ts | 8 +- .../http-link-routing-store.test.ts | 266 +------- .../browser/navigation/http-link-routing.ts | 39 +- .../duplicate-browser-tab-options.ts | 2 +- .../workspace/workspace-browser-link-open.ts | 18 +- .../workspace-browser-route-eligibility.ts | 8 +- .../workspace/workspace-browser-tab-open.ts | 30 +- .../editor-file-operation-provenance.ts | 23 +- .../lib/host-mirror-handle-gap-drain.test.ts | 167 ----- .../lib/host-mirror-handle-gap-resume.test.ts | 568 ------------------ .../host-mirrored-pane-resume-replay.test.ts | 169 ------ .../lib/launch-agent-hosted-prompt.test.ts | 83 --- ...nch-parity-workspace-start.test-fixture.ts | 100 --- .../lib/link-source-local-open-owner.test.ts | 32 - .../src/lib/{ => links}/link-open-request.ts | 0 .../link-source-local-open-owner.ts | 12 +- .../placement}/adjacent-link-open-group.ts | 2 +- .../{ => links/placement}/link-open-intent.ts | 8 +- .../src/lib/open-agent-message-sender.test.ts | 175 ------ .../lib/rename-user-named-tab-access.test.ts | 197 ------ .../launch/open-mobile-emulator-tab.ts | 4 +- .../review}/review-owner.ts | 8 +- .../src/lib/structured-chat-tab-index.test.ts | 48 -- ...structured-session-open-consumers.test.tsx | 163 ----- .../src/lib/tab-agent-status-index.test.ts | 299 --------- ...terminal-input-activity-coalescing.test.ts | 100 --- src/renderer/src/lib/terminal-themes-data.ts | 11 - .../appearance}/terminal-theme.ts | 22 +- .../appearance/terminal-themes-data.ts | 10 + .../terminal-input-activity-coalescing.ts | 0 ...se-tab-agent-opencode-native-title.test.ts | 138 ----- src/renderer/src/lib/use-tab-agent.test.ts | 247 -------- ...leeping-agents-live-unmounted-pane.test.ts | 202 ------- .../workspace-ports/workspace-port-actions.ts | 14 +- .../client-creation-action-error.ts | 8 +- .../client-creation-action-policy.ts | 22 +- .../launch-work-item-direct-preflight.ts | 34 +- ...unch-work-item-direct-route-preparation.ts | 24 +- .../workspace-tab-palette-entry-builder.ts | 18 +- .../sleep}/worktree-sleep-intent.ts | 0 .../tabs}/unified-tab-anchor-insertion.ts | 4 +- .../lib/worktree-creation-host-inputs.test.ts | 58 -- .../worktree-creation-recovery-inputs.test.ts | 99 --- .../staged-browser-frame-handover.ts | 0 .../web-runtime-browser-creation-context.ts | 10 +- .../creation/web-runtime-browser-creation.ts | 12 +- .../web-runtime-browser-link-open.test.ts | 33 +- .../web-runtime-browser-link-session.test.ts | 262 -------- ...b-runtime-terminal-placement-settlement.ts | 2 +- ...ion-terminal-orphan-recovery-sleep.test.ts | 2 +- .../hosts/platform/execution-host-facts.ts | 17 +- .../local-preflight-context-cache.ts | 4 +- .../preflight}/local-preflight-context-key.ts | 2 +- .../preflight}/local-preflight-context.ts | 54 +- .../ssh}/ssh-config-passive-sync.test.ts | 2 +- .../hosts/ssh}/ssh-config-passive-sync.ts | 2 +- .../hosts/ssh}/ssh-mutation-expectation.ts | 6 +- .../forge/forge-credential-target.ts | 4 +- .../sync-runtime-graph/graph-publication.ts | 12 +- .../mobile-session-snapshots.ts | 10 +- .../mobile-terminal-theme.ts | 9 +- .../runtime/sync-runtime-graph/sync-key.ts | 6 +- .../runtime-session-mirror-targets.ts | 12 +- ...-runtime-session-mirror-environment-key.ts | 4 +- .../tracking-lifecycle.ts | 3 +- .../pull-requests/linked-review-clear.ts | 8 +- .../store/github/refresh/worktree-refresh.ts | 17 +- .../local-agent-inventory-outcome.ts | 4 +- .../local-agent-inventory-refresh.ts | 12 +- .../local-detected-agent-state.ts | 25 +- .../pages/browser-page-conversion-actions.ts | 18 +- .../browser/tabs/browser-tab-actions.ts | 4 +- .../editor/checks/check-run-details-owner.ts | 18 +- .../editor/markdown/markdown-link-action.ts | 9 +- .../slices/editor/opening/open-file-action.ts | 21 +- .../editor/tabs/editor-open-adjacent-group.ts | 5 +- .../editor/tabs/editor-open-target-group.ts | 14 +- .../workspace-review-repository.ts | 6 +- .../src/store/slices/preflight/preflight.ts | 12 +- .../create/worktree-create-parent-pick.ts | 19 +- .../metadata/update-worktree-meta.ts | 9 +- .../worktrees/session/set-active-worktree.ts | 6 +- .../workspace-activation-preparation.test.ts | 4 +- .../worktrees/teardown/remove-worktree.ts | 8 +- .../teardown/worktree-purge-state.ts | 6 +- .../store/terminals/terminal-created-shell.ts | 2 +- .../terminals/terminal-ephemeral-state.ts | 2 +- .../store/terminals/terminal-pty-bindings.ts | 4 +- .../store/terminals/terminal-pty-release.ts | 4 +- .../store/terminals/terminal-tab-creation.ts | 8 +- ...workspace-layout-frame-browser-handover.ts | 2 +- .../host-twin-isolation.test.ts | 257 -------- ...host-twin-state-projection.test-fixture.ts | 7 +- .../host-twin-worktree-purge.test.ts | 167 +---- .../host-isolation/host-twin.test-fixture.ts | 14 +- .../e2e/agent-sender-open-unheld.unit.test.ts | 382 ------------ ...ve-chat-image-runtime-context.unit.test.ts | 474 --------------- ...ive-chat-transcript-reasoning.unit.test.ts | 99 --- ...rt-workspace-linear-read-test-fixtures.tsx | 27 +- ...t-session-launch-continuation.unit.test.ts | 235 -------- 350 files changed, 1905 insertions(+), 17250 deletions(-) rename src/renderer/src/{lib => app-shell/storage}/indexeddb-connection.ts (100%) delete mode 100644 src/renderer/src/components/native-chat-recovery/integration/native-chat-resume-bulk-progress.test.tsx delete mode 100644 src/renderer/src/components/native-chat/conversation/slots/NativeChatMessageList.opening-send.test.tsx delete mode 100644 src/renderer/src/components/native-chat/conversation/slots/NativeChatMessageList.queued-turn-order.test.tsx delete mode 100644 src/renderer/src/components/native-chat/conversation/slots/NativeChatMessageList.turn-membership.test.tsx delete mode 100644 src/renderer/src/components/native-chat/conversation/turns/NativeChatMessageList.turn-indicator.test.tsx delete mode 100644 src/renderer/src/components/native-chat/messages/agent-senders/native-chat-agent-message-sender-open.test.tsx delete mode 100644 src/renderer/src/components/native-chat/messages/rows/NativeChatMessageRow.test.tsx delete mode 100644 src/renderer/src/components/native-chat/pane/actions/native-chat-header-ownership.test.tsx delete mode 100644 src/renderer/src/components/native-chat/queue/NativeChatQueuedMessageList.in-flight.test.tsx delete mode 100644 src/renderer/src/components/native-chat/session/status/structured-agent-session-status-bridge-failed-start.test.tsx delete mode 100644 src/renderer/src/components/native-chat/session/status/structured-agent-session-status-bridge-unconfirmed-start.test.tsx delete mode 100644 src/renderer/src/components/native-chat/session/structured/delivery/NativeChatMessageList.unsent-message.test.tsx delete mode 100644 src/renderer/src/components/native-chat/subagents/NativeChatMessageList.subagent-sections.test.tsx delete mode 100644 src/renderer/src/components/native-chat/surfaces/integration/NativeChatMessageList.test.tsx delete mode 100644 src/renderer/src/components/native-chat/viewport/history/NativeChatMessageList.older-history.test.tsx delete mode 100644 src/renderer/src/components/native-chat/viewport/navigation/NativeChatMessageList.rail-history-jump.test.tsx delete mode 100644 src/renderer/src/components/native-chat/viewport/virtualization/NativeChatMessageList.windowing.test.tsx delete mode 100644 src/renderer/src/components/settings/ssh/SshPane.test.tsx delete mode 100644 src/renderer/src/components/status-bar/SshStatusSegment.large-host-list.test.tsx delete mode 100644 src/renderer/src/components/terminal-pane/parking/output-watchers/parked-terminal-byte-watcher.test.ts delete mode 100644 src/renderer/src/components/terminal-pane/pty-connection/lifecycle/pty-connection-deliberate-sleep-guard.spec.ts delete mode 100644 src/renderer/src/components/terminal/initial-terminal-admission-wait.test.tsx delete mode 100644 src/renderer/src/lib/activate-ai-vault-structured-session-host.test.ts delete mode 100644 src/renderer/src/lib/activate-ai-vault-structured-session-reveal.test.ts rename src/renderer/src/lib/{ => agent-session/accounts}/codex-pane-selection-lane.test.ts (100%) rename src/renderer/src/lib/{ => agent-session/accounts}/codex-pane-selection-lane.ts (86%) rename src/renderer/src/lib/{ => agent-session/accounts/codex}/codex-stale-pane-account-identity.test.ts (76%) rename src/renderer/src/lib/{ => agent-session/accounts/codex}/codex-stale-pane-sweep.test.ts (86%) rename src/renderer/src/lib/{ => agent-session/launch/new-tab}/codex-model-catalog-reader-test-fixture.ts (75%) delete mode 100644 src/renderer/src/lib/agent-session/launch/new-tab/launch-agent-picker-codex-contract.test.ts rename src/renderer/src/lib/{ => agent-session/launch/parity}/launch-parity-renderer.test-fixture.ts (94%) delete mode 100644 src/renderer/src/lib/agent-session/launch/routing/agent-launch-route-registered-agents.test.ts delete mode 100644 src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-close-race.test.ts create mode 100644 src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-host-seed.ts rename src/renderer/src/lib/{launch-structured-agent-session.ts => agent-session/launch/structured-agent-session-launch-intent.ts} (82%) delete mode 100644 src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-unconfirmed-or-retried.test.ts delete mode 100644 src/renderer/src/lib/agent-session/launch/structured-agent-session-launch.test.ts delete mode 100644 src/renderer/src/lib/agent-session/launch/structured-agent-session-new-chat-own-launch.test.ts create mode 100644 src/renderer/src/lib/agent-session/open/activate-ai-vault-structured-session-reveal.test.ts rename src/renderer/src/lib/{ => agent-session/open}/activate-ai-vault-structured-session.ts (85%) rename src/renderer/src/lib/{ => agent-session/open}/open-agent-message-sender.ts (93%) rename src/renderer/src/lib/{ => agent-session/open}/open-existing-structured-session.ts (93%) rename src/renderer/src/lib/{ => agent-session/open}/open-located-agent-message-sender.ts (90%) delete mode 100644 src/renderer/src/lib/agent-session/options/structured-agent-session-selection-lifetime.test.tsx rename src/renderer/src/lib/{ => agent-session/resume}/finished-agent-resume-resurrection.test.ts (91%) rename src/renderer/src/lib/{ => agent-session/resume}/forget-refused-pane-resume.ts (84%) rename src/renderer/src/lib/{ => agent-session/resume/history}/cli-conversation-exit-guidance.ts (76%) rename src/renderer/src/lib/{ => agent-session/resume/history}/launch-ai-vault-session-and-reveal.ts (90%) rename src/renderer/src/lib/{ => agent-session/resume/history}/launch-ai-vault-session.ts (94%) rename src/renderer/src/lib/{ => agent-session/resume}/host-mirror-handle-gap-wait.ts (97%) rename src/renderer/src/lib/{ => agent-session/resume}/paired-runtime-closed-tab-resume.test.ts (53%) rename src/renderer/src/lib/{ => agent-session/resume}/retracted-host-pane-resume.test.ts (87%) rename src/renderer/src/lib/{ => agent-session/resume}/sleeping-agent-wake-requests.ts (84%) rename src/renderer/src/lib/{ => agent-session/tab-identity}/open-tab-occupant-agent.ts (79%) rename src/renderer/src/lib/{ => agent-session/tab-identity}/structured-chat-tab-index.ts (96%) rename src/renderer/src/lib/{ => agent-session/tab-identity}/tab-agent-remote-pty-selector.ts (85%) rename src/renderer/src/lib/{ => agent-session/tab-identity}/tab-agent-status-index.ts (89%) rename src/renderer/src/lib/{ => agent-session/tab-identity}/tab-agent.ts (89%) rename src/renderer/src/lib/{ => agent-session/tab-identity}/use-tab-agent-observed-signal-dispatch.test.tsx (86%) create mode 100644 src/renderer/src/lib/agent-session/tab-identity/use-tab-agent.test.ts rename src/renderer/src/lib/{ => agent-session/tab-identity}/use-tab-agent.ts (95%) delete mode 100644 src/renderer/src/lib/browser/navigation/browser-link-open-layout-owner.test.ts delete mode 100644 src/renderer/src/lib/browser/navigation/http-link-completion.test.ts rename src/renderer/src/lib/{ => browser/workspace}/duplicate-browser-tab-options.ts (81%) delete mode 100644 src/renderer/src/lib/host-mirror-handle-gap-drain.test.ts delete mode 100644 src/renderer/src/lib/host-mirror-handle-gap-resume.test.ts delete mode 100644 src/renderer/src/lib/host-mirrored-pane-resume-replay.test.ts delete mode 100644 src/renderer/src/lib/launch-agent-hosted-prompt.test.ts delete mode 100644 src/renderer/src/lib/launch-parity-workspace-start.test-fixture.ts delete mode 100644 src/renderer/src/lib/link-source-local-open-owner.test.ts rename src/renderer/src/lib/{ => links}/link-open-request.ts (100%) rename src/renderer/src/lib/{ => links/ownership}/link-source-local-open-owner.ts (64%) rename src/renderer/src/lib/{ => links/placement}/adjacent-link-open-group.ts (98%) rename src/renderer/src/lib/{ => links/placement}/link-open-intent.ts (95%) delete mode 100644 src/renderer/src/lib/open-agent-message-sender.test.ts delete mode 100644 src/renderer/src/lib/rename-user-named-tab-access.test.ts rename src/renderer/src/lib/{ => source-control/review}/review-owner.ts (89%) delete mode 100644 src/renderer/src/lib/structured-chat-tab-index.test.ts delete mode 100644 src/renderer/src/lib/structured-session-open-consumers.test.tsx delete mode 100644 src/renderer/src/lib/tab-agent-status-index.test.ts delete mode 100644 src/renderer/src/lib/terminal-input-activity-coalescing.test.ts delete mode 100644 src/renderer/src/lib/terminal-themes-data.ts rename src/renderer/src/lib/{ => terminal/appearance}/terminal-theme.ts (85%) create mode 100644 src/renderer/src/lib/terminal/appearance/terminal-themes-data.ts rename src/renderer/src/lib/{ => terminal/input}/terminal-input-activity-coalescing.ts (100%) delete mode 100644 src/renderer/src/lib/use-tab-agent-opencode-native-title.test.ts delete mode 100644 src/renderer/src/lib/use-tab-agent.test.ts delete mode 100644 src/renderer/src/lib/wake-sleeping-agents-live-unmounted-pane.test.ts rename src/renderer/src/lib/{ => workspace/creation/surface-policy}/client-creation-action-error.ts (75%) rename src/renderer/src/lib/{ => workspace/creation/surface-policy}/client-creation-action-policy.ts (87%) rename src/renderer/src/lib/{ => workspace/sleep}/worktree-sleep-intent.ts (100%) rename src/renderer/src/lib/{ => workspace/tabs}/unified-tab-anchor-insertion.ts (88%) delete mode 100644 src/renderer/src/lib/worktree-creation-host-inputs.test.ts delete mode 100644 src/renderer/src/lib/worktree-creation-recovery-inputs.test.ts rename src/renderer/src/{lib => runtime/browser/creation}/staged-browser-frame-handover.ts (100%) delete mode 100644 src/renderer/src/runtime/browser/creation/web-runtime-browser-link-session.test.ts rename src/renderer/src/{lib => runtime/hosts/preflight}/local-preflight-context-cache.ts (97%) rename src/renderer/src/{lib => runtime/hosts/preflight}/local-preflight-context-key.ts (95%) rename src/renderer/src/{lib => runtime/hosts/preflight}/local-preflight-context.ts (85%) rename src/renderer/src/{lib => runtime/hosts/ssh}/ssh-config-passive-sync.test.ts (96%) rename src/renderer/src/{lib => runtime/hosts/ssh}/ssh-config-passive-sync.ts (96%) rename src/renderer/src/{lib => runtime/hosts/ssh}/ssh-mutation-expectation.ts (91%) rename src/renderer/src/{lib => runtime/web-session-tabs-sync/subscriptions}/runtime-session-mirror-targets.ts (80%) delete mode 100644 src/renderer/src/store/workspaces/host-isolation/host-twin-isolation.test.ts delete mode 100644 tests/e2e/agent-sender-open-unheld.unit.test.ts delete mode 100644 tests/e2e/native-chat-image-runtime-context.unit.test.ts delete mode 100644 tests/e2e/native-chat-transcript-reasoning.unit.test.ts delete mode 100644 tests/e2e/structured-agent-session-launch-continuation.unit.test.ts diff --git a/config/flaky-test-pattern-baseline.txt b/config/flaky-test-pattern-baseline.txt index 019286efc69..362d8073cc6 100644 --- a/config/flaky-test-pattern-baseline.txt +++ b/config/flaky-test-pattern-baseline.txt @@ -627,12 +627,7 @@ 2 test-no-wall-clock:src/renderer/src/components/artifacts/ArtifactCollection.test.tsx 1 test-no-wall-clock:src/renderer/src/components/browser-pane/assemble-chrome/browser-workspace-pane.adoption-chrome.test.tsx 2 test-no-wall-clock:src/renderer/src/components/dashboard/useLiveDashboardSnapshot.test.ts -1 test-no-wall-clock:src/renderer/src/components/native-chat/conversation/slots/NativeChatMessageList.opening-send.test.tsx -1 test-no-wall-clock:src/renderer/src/components/native-chat/conversation/slots/NativeChatMessageList.queued-turn-order.test.tsx -2 test-no-wall-clock:src/renderer/src/components/native-chat/conversation/turns/NativeChatMessageList.turn-indicator.test.tsx 3 test-no-wall-clock:src/renderer/src/components/native-chat/conversation/turns/NativeChatResolvedView.turn-status.test.tsx -1 test-no-wall-clock:src/renderer/src/components/native-chat/session/structured/delivery/NativeChatMessageList.unsent-message.test.tsx -3 test-no-wall-clock:src/renderer/src/components/native-chat/surfaces/integration/NativeChatMessageList.test.tsx 2 test-no-wall-clock:src/renderer/src/components/native-chat/tools/tasks/NativeChatStructuredSessionStatus.test.tsx 1 test-no-wall-clock:src/renderer/src/components/sidebar/workspace-card/review/use-workspace-reference-details.test.tsx 1 test-no-wall-clock:src/renderer/src/components/sidebar/worktree-list/listing/WorktreeList.lineage-agent-expansion-coupling.test.tsx @@ -643,9 +638,7 @@ 2 test-no-wall-clock:src/renderer/src/components/workspace-cleanup/use-workspace-cleanup-removal.agent-stop.test.tsx 1 test-no-wall-clock:src/renderer/src/components/worktree-jump/WorktreeJumpPalette.recent-tabs.behavior.test.tsx 2 test-no-wall-clock:src/renderer/src/hooks/ipc-events/agent-status-terminal-title-tab-write.test.ts -1 test-no-wall-clock:src/renderer/src/lib/paired-runtime-closed-tab-resume.test.ts -2 test-no-wall-clock:src/renderer/src/lib/use-tab-agent-observed-signal-dispatch.test.tsx -2 test-no-wall-clock:src/renderer/src/lib/wake-sleeping-agents-live-unmounted-pane.test.ts +2 test-no-wall-clock:src/renderer/src/lib/agent-session/tab-identity/use-tab-agent-observed-signal-dispatch.test.tsx 1 test-no-wall-clock:src/renderer/src/lib/workspace/ownership/workspace-terminal-host-authority.test.ts 1 test-no-wall-clock:src/renderer/src/lib/workspace/activation/worktree-activation-emptied-workspace-reseed.test.ts 2 test-no-wall-clock:src/renderer/src/store/github/pull-requests/github-pr-branch-linked-pr-divergence.test.ts diff --git a/config/focus-setting-read-baseline.txt b/config/focus-setting-read-baseline.txt index 9278c5f26ac..7fc0cfa7341 100644 --- a/config/focus-setting-read-baseline.txt +++ b/config/focus-setting-read-baseline.txt @@ -220,15 +220,15 @@ 1 src/renderer/src/lib/browser/navigation/http-link-localhost-route.ts # extracted from http-link-routing.ts 1 src/renderer/src/lib/browser/navigation/http-link-routing.ts 2 src/renderer/src/lib/browser/workspace/workspace-browser-tab-open.ts -1 src/renderer/src/lib/client-creation-action-error.ts -2 src/renderer/src/lib/client-creation-action-policy.ts +1 src/renderer/src/lib/workspace/creation/surface-policy/client-creation-action-error.ts +2 src/renderer/src/lib/workspace/creation/surface-policy/client-creation-action-policy.ts 1 src/renderer/src/runtime/hosts/selection/default-creation-host.ts # the sanctioned reader of the default host -1 src/renderer/src/lib/launch-ai-vault-session.ts -1 src/renderer/src/lib/local-preflight-context.ts +1 src/renderer/src/lib/agent-session/resume/history/launch-ai-vault-session.ts +1 src/renderer/src/runtime/hosts/preflight/local-preflight-context.ts 2 src/renderer/src/runtime/hosts/observations/provider-runtime-context.ts 2 src/renderer/src/lib/workspace/ownership/repo-runtime-owner.ts 1 src/renderer/src/lib/workspace/ownership/runtime-session-mirror-owners.ts -1 src/renderer/src/lib/runtime-session-mirror-targets.ts +1 src/renderer/src/runtime/web-session-tabs-sync/subscriptions/runtime-session-mirror-targets.ts 1 src/renderer/src/lib/workspace/ownership/single-runtime-legacy-owner.ts 1 src/renderer/src/lib/skills/runtime/skill-runtime-command.ts 1 src/renderer/src/lib/workspace/ownership/terminal-close-route.ts diff --git a/config/reliability-gates.jsonc b/config/reliability-gates.jsonc index c51880345b9..852bc9e138b 100644 --- a/config/reliability-gates.jsonc +++ b/config/reliability-gates.jsonc @@ -8534,11 +8534,10 @@ "ORCA_BACKGROUND_LAUNCH=1 pnpm exec playwright test tests/e2e/paired-client-first-terminal-unopened-host-worktree.spec.ts --config tests/playwright.config.ts --project electron-headless --workers=1", "pnpm exec vitest run --config config/vitest.config.ts src/main/runtime/session-lifecycle/publication/mobile-session-tabs-agent-status-heartbeat.test.ts tests/e2e/session-tabs-decorative-title-fanout.unit.test.ts --maxWorkers=1", "pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/components/terminal-pane/parking/lifecycle/use-terminal-tab-cold-parking.test.ts --maxWorkers=1", - "pnpm exec vitest run --config config/vitest.config.ts src/main/runtime/construction/orca-runtime.test.ts src/main/runtime/rpc/terminal-multiplex-initial-snapshot-buffering.test.ts src/main/runtime/rpc/terminal-multiplex-snapshot-serialization.test.ts src/main/runtime/rpc/terminal-multiplex-pty-wait-capacity.test.ts src/main/runtime/rpc/terminal-subscribe-buffer.test.ts src/renderer/src/components/terminal-pane/parking/output-watchers/parked-terminal-byte-watcher.test.ts src/renderer/src/components/terminal-pane/pty-transport/output/terminal-side-effect-facts-handler.test.ts src/renderer/src/components/terminal-pane/pty-connection/tests/pty-connection-hidden-replay.test.ts src/renderer/src/components/terminal-pane/pty-connection/tests/pty-connection-visibility-and-exit.test.ts src/renderer/src/components/terminal-pane/pty-transport/remote-runtime/remote-runtime-pty-transport-activation-inventory-fallback.test.ts src/renderer/src/components/terminal-pane/parking/retention/terminal-hidden-view-parking.test.ts src/renderer/src/components/terminal-pane/parking/retention/terminal-hidden-worktree-retention.test.ts src/renderer/src/components/terminal-pane/parking/output-watchers/terminal-parked-tab-watchers.test.ts src/renderer/src/components/terminal-pane/parking/output-watchers/terminal-parked-watcher-reconciliation.test.ts src/renderer/src/runtime/hosted-terminals/streams/remote-runtime-terminal-stall-recovery.test.ts src/renderer/src/runtime/rpc/subscriptions/runtime-client-events.test.ts src/renderer/src/web/web-preload-api-runtime-environment.test.ts src/main/ipc/runtime-environments/runtime-environments-pairing.test.ts", + "pnpm exec vitest run --config config/vitest.config.ts src/main/runtime/construction/orca-runtime.test.ts src/main/runtime/rpc/terminal-multiplex-initial-snapshot-buffering.test.ts src/main/runtime/rpc/terminal-multiplex-snapshot-serialization.test.ts src/main/runtime/rpc/terminal-multiplex-pty-wait-capacity.test.ts src/main/runtime/rpc/terminal-subscribe-buffer.test.ts src/renderer/src/components/terminal-pane/pty-transport/output/terminal-side-effect-facts-handler.test.ts src/renderer/src/components/terminal-pane/pty-connection/tests/pty-connection-hidden-replay.test.ts src/renderer/src/components/terminal-pane/pty-connection/tests/pty-connection-visibility-and-exit.test.ts src/renderer/src/components/terminal-pane/pty-transport/remote-runtime/remote-runtime-pty-transport-activation-inventory-fallback.test.ts src/renderer/src/components/terminal-pane/parking/retention/terminal-hidden-view-parking.test.ts src/renderer/src/components/terminal-pane/parking/retention/terminal-hidden-worktree-retention.test.ts src/renderer/src/components/terminal-pane/parking/output-watchers/terminal-parked-tab-watchers.test.ts src/renderer/src/components/terminal-pane/parking/output-watchers/terminal-parked-watcher-reconciliation.test.ts src/renderer/src/runtime/hosted-terminals/streams/remote-runtime-terminal-stall-recovery.test.ts src/renderer/src/runtime/rpc/subscriptions/runtime-client-events.test.ts src/renderer/src/web/web-preload-api-runtime-environment.test.ts src/main/ipc/runtime-environments/runtime-environments-pairing.test.ts", "pnpm exec vitest run --config config/vitest.config.ts src/main/runtime/terminal/adoption/terminal-subscriber-driven-daemon-attach.test.ts", "pnpm exec vitest run --config config/vitest.config.ts src/main/runtime/session-tabs/runtime-inventory-publication-authority.test.ts src/main/runtime/rpc/methods/session-tabs/session-tabs-inventory-census-race.test.ts src/main/daemon/terminal-host/testing/terminal-host-agent-session.test.ts tests/e2e/session-tabs-empty-inventory-daemon-oracle.unit.test.ts --maxWorkers=1", "pnpm exec vitest run --config config/vitest.config.ts src/shared/remote-runtime/control/remote-runtime-shared-control-connection.test.ts", - "pnpm exec vitest run --config config/vitest.config.ts", "SKIP_BUILD=1 pnpm exec playwright test tests/e2e/paired-remote-terminal-host-restart-background-sync.spec.ts --config tests/playwright.config.ts --project electron-headless --workers=1", "ORCA_E2E_FORWARD_APP_LOGS=1 SKIP_BUILD=1 pnpm exec playwright test tests/e2e/paired-remote-terminal-host-restart-background-sync.spec.ts --config tests/playwright.config.ts --project electron-headless --workers=1 --repeat-each=10 --max-failures=1", "ORCA_E2E_WEB_CLIENT=1 SKIP_BUILD=1 pnpm exec playwright test tests/e2e/paired-remote-terminal-truncated-tail-first-paint.spec.ts --config tests/playwright.config.ts --project electron-headful --workers=1", @@ -8568,7 +8567,6 @@ "src/main/runtime/rpc/methods/session-tabs/session-tabs-inventory-census-race.test.ts", "src/main/daemon/terminal-host/testing/terminal-host-agent-session.test.ts", "tests/e2e/session-tabs-empty-inventory-daemon-oracle.unit.test.ts", - "src/renderer/src/components/terminal-pane/parking/output-watchers/parked-terminal-byte-watcher.test.ts", "src/renderer/src/components/terminal-pane/pty-transport/output/terminal-side-effect-facts-handler.test.ts", "src/renderer/src/components/terminal-pane/pty-connection/tests/pty-connection-hidden-replay.test.ts", "src/renderer/src/components/terminal-pane/pty-connection/tests/pty-connection-visibility-and-exit.test.ts", @@ -9014,6 +9012,7 @@ "Audit3231 retires supported-host restore-pane key mapping, closed/open creation-sidebar toggle visibility, unrelated scope-error/null classification and quick-submit reveal/no-create checks. These broad commands lose those real narrow alarms; no replacement coverage is claimed.", "Audit3246 retires NewRowsMarker reveal/no-repeat and pane-scoped beforeinput checks; skill-owner option availability/count/dedup/order; six styled Input/Textarea IME forwarding rows; the static Codex/OpenCode smart-key inventory; tab-map AST ratchet diagnostic fixtures; child-roster work-budget and retained-aggregate alarms; malformed persisted floating-cwd fallback/no-crash/empty exact-root checks; the unanswered-host empty-list discriminator; the direct invalidated-cache commit-false assertion; one redundant digit-keyup IME row; cached non-supported Claude title-generator rows; and the duplicate late naming-result singleton. These root broad commands lose those specific alarms without equivalent replacement. Distinct retained owner/state checks have their own bounded claims; the real scheduler still rejects stale response data, while the direct false-return alarm is retired.", "Terminal/runtime defining-owner cleanup retires complete parking timer, lifecycle, mocked close/disposal and render/flip/mount work-count cases under repository test policy. The retained watcher source has only two literal-oracle coverage decisions; the retained cold-parking hook source has only the layout-PTY exemption invalidation case. Lost alarms include cooldown/measure/pin wakeups, split exit/close attribution and cancellation, watcher disposal/restart, flood timer rearm, worktree verdict damping, and destroyed-transport cold restore. No equivalent replacement coverage or execution pass for the reduced cases is claimed; prior dated receipts retain their original scope.", + "Module-layout wave3 intentionally retires complete prohibited owning registrations in src/renderer/src/components/terminal-pane/parking/output-watchers/parked-terminal-byte-watcher.test.ts. Lost alarms: Loss of the OSC title forwarding/order alarm for both pane and tab titles. Loss of the bare Cursor Agent title versus synthetic spinner title/deduplication alarm. Loss of the unread BEL attribution and delayed OS bell notification alarm. Loss of the OSC-terminator BEL exclusion alarm across chunk boundaries. Loss of the working-to-idle prompt-cache and completion-notification alarm. Loss of the same-burst completion-over-bell coalescing alarm. Loss of the resumed-working cancellation of pending completion and cache timer alarm. Loss of the cross-chunk GitHub pull-request discovery and workspace/pane attribution alarm. Loss of the Command Code return-to-done callback wiring alarm; real composer delivery was not established. Loss of the already-in-flight Command Code scrape/return alarm. Loss of the park-time working seed to idle completion alarm. Loss of the no-unobserved-transition completion alarm. Loss of the shutdown cancellation and final-flush attention-suppression alarm. Loss of the sidecar unregistration and pending-bell cancellation alarm. Loss of the same-PTY previous-watcher disposal alarm. Loss of the cold snapshot title restoration without replayed attention alarm. Loss of the stale-derived idle fact state-clear/no-completion alarm. Loss of the fact-consumer disposal and written title-slot clearing alarm. No equivalent replacement coverage or reduced-selector pass is claimed.", "Audit 3256 removes these specific alarms from the broad root unit commands: skill dialog active-share selection, close and pending-share handoff; simple keyed-record deletion; marker live-region insertion, simple landing and nine baseline policy examples; General search/control navigation inventory; orphan-count cache bootstrap; seven Codex code classifications and HTTP 429 warning mapping; two skill unread-root verdict examples; peer-mail payload and conversation-ID rejection; and the GitHub organization TABLE text-field optimistic rollback/failed-envelope example. These include real behaviors; retained tests do not provide equivalent coverage for every removed scenario. Mobile losses are recorded separately and are not coverage of these root commands.", "Audit 3273 removes 14 authored declarations and 19 expanded scenarios across four whole suites and eight partial suites. Retired alarms cover saved-local cancellation/layout ownership, ambiguous-owner warning reset, folder attachment routing, VM false-capability bypass, abandoned reveal warmup cleanup and viewport claim deduplication/rearming, quiet unrelated remote-removal refusal, startup-command one-shot consumption, repository/floating recovery-ledger rows, fake-React pinned-scroll intent, split-ratio state identity/subscriber suppression and fractional change, cross-host project-group join refusal, three PR request-lifetime permutations, upstream-status preservation on error, and unresolved Git-owner refusal. These regression checks are intentionally lost under the test-value audit; retained scenarios are not equivalent replacements. Historical coverage receipts remain historical, including gate35 subscriber claims.", "Audit 3283 removes 20 authored declarations and 31 expanded scenarios, including two whole suites. Retired alarms cover PR refresh-state pruning, shared runtime subscription cleanup and store isolation, language content-change routing and older completion ownership, ordinary panel retry-timer cleanup and pending loading, four hosted-review lifetime permutations, mocked terminal creation error/order wiring, five sleep-inventory variants with pending-frame-only assertions, palette fallback/composite highlights, Windows/UNC encoded-editor input rows, mixed-repository partial failure counts, title setters and generated-title bypass/replacement, five window-close coordinator delegation/guard/finally branches, and ambiguous-old-record frame reveal. These regression checks are intentionally lost under the test-value audit; retained cases are not equivalent replacements. Prior coverage notes and receipts remain historical.", diff --git a/config/scripts/ci/sharding/ci-shard-timings.json b/config/scripts/ci/sharding/ci-shard-timings.json index c5fe443c505..0c336f13bd1 100644 --- a/config/scripts/ci/sharding/ci-shard-timings.json +++ b/config/scripts/ci/sharding/ci-shard-timings.json @@ -5099,7 +5099,6 @@ "src/renderer/src/components/mobile/WindowsFirewallNotice.test.tsx": 691, "src/renderer/src/components/mobile/paired-mobile-devices.test.ts": 192, "src/renderer/src/components/mobile/use-mobile-page-paired-devices.test.ts": 475, - "src/renderer/src/components/native-chat-recovery/integration/native-chat-resume-bulk-progress.test.tsx": 3261, "src/renderer/src/components/native-chat-recovery/offers/native-chat-resume-failed-chat-watch.test.ts": 1954, "src/renderer/src/components/native-chat-recovery/integration/native-chat-resume-finished-run.test.tsx": 4173, "src/renderer/src/components/native-chat/messages/rows/NativeChatAgentMessageCard.test.tsx": 3700, @@ -5121,27 +5120,15 @@ "src/renderer/src/components/native-chat/media/visuals/NativeChatMarkdown.visual.test.tsx": 2860, "src/renderer/src/components/native-chat/messages/reasoning/NativeChatMessageList.live-reasoning.test.tsx": 20337, "src/renderer/src/components/native-chat/NativeChatMessageList.new-rows-marker.test.tsx": 4304, - "src/renderer/src/components/native-chat/viewport/history/NativeChatMessageList.older-history.test.tsx": 12659, - "src/renderer/src/components/native-chat/conversation/slots/NativeChatMessageList.opening-send.test.tsx": 3604, - "src/renderer/src/components/native-chat/conversation/slots/NativeChatMessageList.queued-turn-order.test.tsx": 2949, - "src/renderer/src/components/native-chat/viewport/navigation/NativeChatMessageList.rail-history-jump.test.tsx": 23851, "src/renderer/src/components/native-chat/viewport/scroll/NativeChatMessageList.scroll-behavior.test.tsx": 14260, - "src/renderer/src/components/native-chat/subagents/NativeChatMessageList.subagent-sections.test.tsx": 7517, - "src/renderer/src/components/native-chat/surfaces/integration/NativeChatMessageList.test.tsx": 4252, - "src/renderer/src/components/native-chat/conversation/turns/NativeChatMessageList.turn-indicator.test.tsx": 4070, - "src/renderer/src/components/native-chat/conversation/slots/NativeChatMessageList.turn-membership.test.tsx": 3527, - "src/renderer/src/components/native-chat/session/structured/delivery/NativeChatMessageList.unsent-message.test.tsx": 3069, "src/renderer/src/components/native-chat/viewport/scroll/NativeChatMessageList.visual-scroll.test.tsx": 6691, - "src/renderer/src/components/native-chat/viewport/virtualization/NativeChatMessageList.windowing.test.tsx": 20958, "src/renderer/src/components/native-chat/viewport/rail/NativeChatMessageRail.test.tsx": 1134, - "src/renderer/src/components/native-chat/messages/rows/NativeChatMessageRow.test.tsx": 3533, "src/renderer/src/components/native-chat/NativeChatNewRowsMarker.test.tsx": 3019, "src/renderer/src/components/native-chat/usage/NativeChatNoticeRow.test.tsx": 3399, "src/renderer/src/components/native-chat/pane/actions/NativeChatPaneHeader.test.tsx": 2736, "src/renderer/src/components/native-chat/composer/editor/NativeChatPromptEditor.paragraph-selection.test.tsx": 652, "src/renderer/src/components/native-chat/composer/editor/NativeChatPromptEditor.test.tsx": 1110, "src/renderer/src/components/native-chat/prompts/NativeChatQuestionCard.test.tsx": 762, - "src/renderer/src/components/native-chat/queue/NativeChatQueuedMessageList.in-flight.test.tsx": 1865, "src/renderer/src/components/native-chat/queue/NativeChatQueuedMessageRows.test.tsx": 2691, "src/renderer/src/components/native-chat/prompts/NativeChatResolutionReceipt.test.tsx": 912, "src/renderer/src/components/native-chat/media/images/NativeChatResolvedView.context-menu.test.tsx": 4025, @@ -5198,7 +5185,6 @@ "src/renderer/src/components/native-chat/drafts/native-chat-draft-retention.test.ts": 1415, "src/renderer/src/components/native-chat/attachments/intake/native-chat-external-attachments-destination.test.tsx": 951, "src/renderer/src/components/native-chat/links/actions/native-chat-file-link-existence.test.ts": 1937, - "src/renderer/src/components/native-chat/pane/actions/native-chat-header-ownership.test.tsx": 2796, "src/renderer/src/components/native-chat/links/actions/native-chat-host-file-open.test.ts": 895, "src/renderer/src/components/native-chat/links/previews/native-chat-hover-preview-cache.test.ts": 49, "src/renderer/src/components/native-chat/attachments/chips/native-chat-image-references.test.tsx": 2485, @@ -5242,8 +5228,6 @@ "src/renderer/src/components/native-chat/viewport/rail/structured-agent-session-rail-outline.test.ts": 48, "src/renderer/src/components/native-chat/session/structured/read/structured-agent-session-read-transport.test.ts": 243, "src/renderer/src/components/native-chat/session/status/structured-agent-session-status-bridge-clock.test.tsx": 2070, - "src/renderer/src/components/native-chat/session/status/structured-agent-session-status-bridge-failed-start.test.tsx": 2398, - "src/renderer/src/components/native-chat/session/status/structured-agent-session-status-bridge-unconfirmed-start.test.tsx": 2328, "src/renderer/src/components/native-chat/conversation/projection/structured-agent-session-transcript-order.test.ts": 294, "src/renderer/src/components/native-chat/session/attention/structured-attention-dispatch.test.ts": 1974, "src/renderer/src/components/native-chat/session/status/structured-chat-sleep-startup.test.tsx": 2285, @@ -5465,7 +5449,6 @@ "src/renderer/src/components/settings/repository/worktrees/SparsePresetSettingsSection.test.tsx": 744, "src/renderer/src/components/settings/ssh/server-actions/SshHostDeltaMoveDialog.test.tsx": 438, "src/renderer/src/components/settings/ssh/server-actions/SshHostRecoverServerAction.test.tsx": 669, - "src/renderer/src/components/settings/ssh/SshPane.test.tsx": 1699, "src/renderer/src/components/settings/ssh/targets/SshTargetForm.test.tsx": 1014, "src/renderer/src/components/settings/ssh/targets/SshTargetList.test.tsx": 2093, "src/renderer/src/components/settings/tasks/TaskSourceSimpleSetup.test.tsx": 527, @@ -5628,7 +5611,6 @@ "src/renderer/src/components/stats/usage-overview-model.test.ts": 364, "src/renderer/src/components/status-bar/ClaudeSwitcherMenu.owner-lifetime.test.tsx": 2317, - "src/renderer/src/components/status-bar/SshStatusSegment.large-host-list.test.tsx": 1838, "src/renderer/src/components/status-bar/StatusBarUsageChangeNotices.test.tsx": 785, "src/renderer/src/components/status-bar/UpdateStatusSegment.test.tsx": 2484, "src/renderer/src/components/status-bar/account-switch-row-keyboard.test.tsx": 2286, @@ -5763,7 +5745,6 @@ "src/renderer/src/components/terminal-pane/pty-connection/agent-identity/foreground-process/pane-foreground-inspect-observation-identity.test.ts": 226, "src/renderer/src/components/terminal-pane/pty-connection/agent-identity/foreground-process/pane-foreground-process-exit-retire.test.ts": 329, "src/renderer/src/components/sidebar/workspace-card/activity/structured-chat-activity-status-live.test.tsx": 4146, - "src/renderer/src/components/terminal-pane/parking/output-watchers/parked-terminal-byte-watcher.test.ts": 2837, "src/renderer/src/components/terminal-pane/parking/output-watchers/parked-terminal-command-status.test.ts": 352, "src/renderer/src/components/terminal-pane/layout/close/pending-pane-close-confirmation.test.ts": 4695, "src/renderer/src/components/terminal-pane/layout/close/pending-runtime-pane-close.test.ts": 3487, @@ -5994,7 +5975,6 @@ "src/renderer/src/components/terminal/active-terminal-repair-loop.react185.test.tsx": 1998, "src/renderer/src/components/terminal/background-terminal-worktree-mount.test.ts": 1707, "src/renderer/src/components/terminal/background-terminal-worktree-visibility.test.ts": 1790, - "src/renderer/src/components/terminal/initial-terminal-admission-wait.test.tsx": 2444, "src/renderer/src/components/terminal/initial-terminal-structured-launch.test.tsx": 786, "src/renderer/src/components/terminal/running-terminal-close-guard.test.ts": 99, "src/renderer/src/components/terminal/startup-terminal-tab-hold.test.ts": 2118, @@ -6172,8 +6152,7 @@ "src/renderer/src/i18n/plugin-pack-plurals.test.ts": 191, "src/renderer/src/i18n/relative-time-format.test.ts": 53, "src/renderer/src/i18n/ui-intl-formatters.test.ts": 208, - "src/renderer/src/lib/activate-ai-vault-structured-session-host.test.ts": 589, - "src/renderer/src/lib/activate-ai-vault-structured-session-reveal.test.ts": 2099, + "src/renderer/src/lib/agent-session/open/activate-ai-vault-structured-session-reveal.test.ts": 2099, "src/renderer/src/lib/workspace/tabs/activate-tab-and-focus-pane.test.ts": 54, "src/renderer/src/lib/agent-session/messaging/terminal/active-agent-note-send-explicit-target.test.ts": 980, "src/renderer/src/lib/agent-session/messaging/terminal/active-agent-note-send-focused-session.test.ts": 536, @@ -6187,7 +6166,6 @@ "src/renderer/src/lib/agent-session/hibernation/agent-hibernation-runtime-liveness-race.test.ts": 1914, "src/renderer/src/lib/agent-session/launch/pane/agent-launch-pane-verdict-application.test.ts": 1869, "src/renderer/src/lib/agent-session/launch/routing/agent-launch-route-input.test.ts": 1659, - "src/renderer/src/lib/agent-session/launch/routing/agent-launch-route-registered-agents.test.ts": 1749, "src/renderer/src/lib/agent-session/launch/pane/agent-launch-tab-main-written.test.ts": 2084, "src/renderer/src/lib/agent-session/launch/pane/agent-launch-tab-publication.test.ts": 1855, "src/renderer/src/lib/agent-session/launch/pane/agent-launch-through-host.test.ts": 1975, @@ -6196,7 +6174,6 @@ "src/renderer/src/lib/agent-session/messaging/paste/agent-paste-draft.test.ts": 445, "src/renderer/src/lib/agent-session/resume/agent-resume-launch-target.test.ts": 3911, "src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-after-failure.test.ts": 870, - "src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-close-race.test.ts": 983, "src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-create-message.test.ts": 2521, "src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-different-request.test.ts": 885, "src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-exited-owner.test.ts": 1289, @@ -6207,9 +6184,6 @@ "src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-prompt.test.ts": 710, "src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-record.test.ts": 151, "src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-resume-identity.test.ts": 828, - "src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-unconfirmed-or-retried.test.ts": 1085, - "src/renderer/src/lib/agent-session/launch/structured-agent-session-launch.test.ts": 977, - "src/renderer/src/lib/agent-session/launch/structured-agent-session-new-chat-own-launch.test.ts": 2177, "src/renderer/src/lib/agent-session/structured-agent-session-draft-position-lifetime.test.tsx": 3166, "src/renderer/src/lib/agent-session/structured-agent-session-ordinary-draft.test.tsx": 9907, "src/renderer/src/lib/agent-session/structured-agent-session-provisional-tab.test.ts": 3672, @@ -6233,7 +6207,6 @@ "src/renderer/src/lib/bounded-generation-map.test.ts": 35, "src/renderer/src/lib/browser/history/browser-history-match.test.ts": 328, "src/renderer/src/lib/browser/navigation/browser-link-destination.test.ts": 1839, - "src/renderer/src/lib/browser/navigation/browser-link-open-layout-owner.test.ts": 3133, "src/renderer/src/lib/browser/navigation/browser-link-open.test.ts": 2215, "src/renderer/src/lib/browser/navigation/browser-link-profile-isolation.test.ts": 2511, "src/renderer/src/lib/browser/palette/browser-page-palette-activation.test.ts": 1983, @@ -6247,11 +6220,11 @@ "src/renderer/src/lib/workspace/search/palette/cmd-j-host-qualified-candidate-ownership.test.ts": 526, "src/renderer/src/lib/workspace/search/palette/cmd-j-linear-issue-intent.test.ts": 42, "src/renderer/src/lib/code-host-error-copy.test.ts": 297, - "src/renderer/src/lib/codex-pane-selection-lane.test.ts": 543, + "src/renderer/src/lib/agent-session/accounts/codex-pane-selection-lane.test.ts": 543, "src/renderer/src/lib/agent-session/accounts/codex/codex-session-restart-shell-flap.test.ts": 1745, "src/renderer/src/lib/agent-session/accounts/codex/codex-session-restart.test.ts": 2039, - "src/renderer/src/lib/codex-stale-pane-account-identity.test.ts": 1823, - "src/renderer/src/lib/codex-stale-pane-sweep.test.ts": 1817, + "src/renderer/src/lib/agent-session/accounts/codex/codex-stale-pane-account-identity.test.ts": 1823, + "src/renderer/src/lib/agent-session/accounts/codex/codex-stale-pane-sweep.test.ts": 1817, "src/renderer/src/lib/source-control/review/comments/comment-body-submit-state.test.ts": 55, "src/renderer/src/lib/composer-submit-cancellation.test.ts": 41, "src/renderer/src/lib/workspace/ownership/connection-context.test.ts": 1817, @@ -6266,13 +6239,9 @@ "src/renderer/src/runtime/hosts/platform/execution-host-facts.test.ts": 1796, "src/renderer/src/components/sidebar/sidebar-feedback/feedback-image-attachments.test.ts": 557, "src/renderer/src/lib/files/search/file-search-selection.test.ts": 51, - "src/renderer/src/lib/finished-agent-resume-resurrection.test.ts": 1872, + "src/renderer/src/lib/agent-session/resume/finished-agent-resume-resurrection.test.ts": 1872, "src/renderer/src/components/terminal-pane/parking/retention/foreground-terminal-tabs.test.ts": 55, "src/renderer/src/lib/work-items/github/github-source-runtime-context.test.ts": 62, - "src/renderer/src/lib/host-mirror-handle-gap-drain.test.ts": 1706, - "src/renderer/src/lib/host-mirror-handle-gap-resume.test.ts": 1811, - "src/renderer/src/lib/host-mirrored-pane-resume-replay.test.ts": 1814, - "src/renderer/src/lib/browser/navigation/http-link-completion.test.ts": 1760, "src/renderer/src/lib/browser/navigation/http-link-routing-store.test.ts": 2211, "src/renderer/src/lib/text-input/ime/ime-composition-keyboard-event.test.ts": 274, "src/renderer/src/lib/text-input/ime/ime-text-field.test.tsx": 739, @@ -6293,7 +6262,6 @@ "src/renderer/src/app-shell/startup/lazy-with-retry.never-landed-reload.test.ts": 194, "src/renderer/src/lib/work-items/linear/linear-board-drag-payload.test.ts": 58, "src/renderer/src/lib/work-items/linear/linear-issue-workspace-attachment.test.ts": 99, - "src/renderer/src/lib/link-source-local-open-owner.test.ts": 433, "src/renderer/src/lib/work-items/linked-work-item-context.test.ts": 64, "src/renderer/src/lib/editor/monaco/monaco-editor-gutter-disposal.test.ts": 295, "src/renderer/src/lib/monaco-languages/markdown-heading-outline.test.ts": 70, @@ -6310,11 +6278,10 @@ "src/renderer/src/lib/monaco-languages/textmate-token-provider.test.ts": 245, "src/renderer/src/lib/monaco-languages/zig-highlighting.test.ts": 7984, "src/renderer/src/lib/agent-session/resume/cli-fork/native-chat-cli-fork-preparation.test.ts": 2773, - "src/renderer/src/lib/open-agent-message-sender.test.ts": 1497, "src/renderer/src/lib/simulator/launch/open-mobile-emulator-tab.test.ts": 545, "src/renderer/src/lib/workspace/search/palette/order-empty-query-worktrees.test.ts": 62, "src/renderer/src/lib/files/drop/os-file-drop-cancellation-guard.test.ts": 204, - "src/renderer/src/lib/paired-runtime-closed-tab-resume.test.ts": 2008, + "src/renderer/src/lib/agent-session/resume/paired-runtime-closed-tab-resume.test.ts": 2008, "src/renderer/src/lib/pane-manager/pane-close-focus-successor.test.ts": 1123, "src/renderer/src/lib/pane-manager/pane-container-listener-lifecycle.test.ts": 312, "src/renderer/src/lib/pane-manager/pane-cursor-blink-suspension.test.ts": 429, @@ -6376,7 +6343,6 @@ "src/renderer/src/lib/workspace/creation/project-host-workspace-target.jira-mapping.test.ts": 76, "src/renderer/src/lib/workspace/creation/project-host-workspace-target.test.ts": 92, "src/renderer/src/lib/editor/file-operations/remap-open-editor-tabs-for-path-change.test.ts": 2178, - "src/renderer/src/lib/rename-user-named-tab-access.test.ts": 2804, "src/renderer/src/lib/renderer-agent-status-observation-ingress.test.ts": 81, "src/renderer/src/diagnostics/memory/renderer-memory-profile.test.ts": 70, "src/renderer/src/lib/agent-session/resume/resume-sleeping-agent-session-deferred-pane.test.ts": 1747, @@ -6390,7 +6356,7 @@ "src/renderer/src/lib/agent-session/resume/resume-sleeping-agent-session-suppress-navigation.test.ts": 1919, "src/renderer/src/lib/agent-session/resume/resume-sleeping-agent-session.test.ts": 2140, "src/renderer/src/lib/resume-stale-structured-agent-session.test.ts": 1774, - "src/renderer/src/lib/retracted-host-pane-resume.test.ts": 2009, + "src/renderer/src/lib/agent-session/resume/retracted-host-pane-resume.test.ts": 2009, "src/renderer/src/lib/review-owner.test.ts": 238, "src/renderer/src/lib/runtime-host-copy.test.ts": 317, "src/renderer/src/components/sidebar/sidebar-feed/sidebar-pending-layer.test.ts": 338, @@ -6401,21 +6367,16 @@ "src/renderer/src/lib/simulator/tabs/simulator-tab-layout-owner.test.ts": 2398, "src/renderer/src/lib/simulator/tabs/simulator-tab-palette-activation.test.ts": 1903, "src/renderer/src/lib/source-control/remote/source-control-remote-error.test.ts": 340, - "src/renderer/src/lib/ssh-config-passive-sync.test.ts": 1513, + "src/renderer/src/runtime/hosts/ssh/ssh-config-passive-sync.test.ts": 1513, "src/renderer/src/diagnostics/memory/state-collection-byte-estimate.test.ts": 86, "src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-draft.test.ts": 1042, "src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-prerequisites.test.ts": 2427, - "src/renderer/src/lib/agent-session/options/structured-agent-session-selection-lifetime.test.tsx": 2947, - "src/renderer/src/lib/structured-chat-tab-index.test.ts": 45, - "src/renderer/src/lib/structured-session-open-consumers.test.tsx": 2643, "src/renderer/src/lib/syntax-highlighting/incremental-syntax-tokenizer.test.ts": 665, "src/renderer/src/lib/syntax-highlighting/syntax-highlight-scheduler.test.ts": 149, "src/renderer/src/lib/syntax-highlighting/syntax-highlighter.test.ts": 539, "src/renderer/src/lib/syntax-highlighting/textmate-core.test.ts": 60, - "src/renderer/src/lib/tab-agent-status-index.test.ts": 210, "src/renderer/src/lib/task-provider-error-copy.test.ts": 363, "src/renderer/src/app-shell/appearance/terminal-app-theme.test.ts": 301, - "src/renderer/src/lib/terminal-input-activity-coalescing.test.ts": 43, "src/renderer/src/lib/text-input/paste/text-control-paste-ownership.test.ts": 217, "src/renderer/src/lib/text-input/paste/text-control-paste.test.ts": 222, "src/renderer/src/lib/text-generation-error-copy.test.ts": 466, @@ -6423,10 +6384,8 @@ "src/renderer/src/lib/typing-latency/renderer-long-tasks.test.ts": 75, "src/renderer/src/lib/typing-latency/sample-window.test.ts": 77, "src/renderer/src/attention/unread/unread-badge-count-selector.test.ts": 1930, - "src/renderer/src/lib/use-tab-agent-observed-signal-dispatch.test.tsx": 1971, - "src/renderer/src/lib/use-tab-agent-opencode-native-title.test.ts": 2093, - "src/renderer/src/lib/use-tab-agent.test.ts": 1961, - "src/renderer/src/lib/wake-sleeping-agents-live-unmounted-pane.test.ts": 2432, + "src/renderer/src/lib/agent-session/tab-identity/use-tab-agent-observed-signal-dispatch.test.tsx": 1971, + "src/renderer/src/lib/agent-session/tab-identity/use-tab-agent.test.ts": 1961, "src/renderer/src/runtime/hosts/capabilities/windows-terminal-capabilities-race.test.ts": 450, "src/renderer/src/lib/workspace/activation/workspace-activation-path-gate.test.ts": 2107, "src/renderer/src/lib/browser/workspace/workspace-browser-tab-open-placement.test.ts": 1996, @@ -6530,7 +6489,6 @@ "src/renderer/src/runtime/sync-runtime-graph/terminal-group-grid-sizes.test.ts": 194, "src/renderer/src/runtime/browser/creation/web-runtime-browser-creation-placement.test.ts": 1927, "src/renderer/src/runtime/browser/creation/web-runtime-browser-link-open.test.ts": 2217, - "src/renderer/src/runtime/browser/creation/web-runtime-browser-link-session.test.ts": 1964, "src/renderer/src/runtime/web-session-tabs-sync/closing/web-session-close-replay.test.ts": 1119, "src/renderer/src/runtime/web-session-tabs-sync/placement/web-session-open-files-batch-equivalence.test.ts": 1478, "src/renderer/src/runtime/web-session-tabs-sync/identity/web-session-restored-placeholder-identity.test.ts": 985, @@ -6580,7 +6538,6 @@ "src/renderer/src/store/github/requests/provider-request-coalescing.test.ts": 969, "src/renderer/src/store/slices/hosted-review/refresh/visible-hosted-review-refresh-scheduler.test.ts": 97, "src/renderer/src/store/github/repositories/wsl-stopped-distro-poll-refusal.test.ts": 696, - "src/renderer/src/store/workspaces/host-isolation/host-twin-isolation.test.ts": 1889, "src/renderer/src/store/workspaces/host-isolation/host-twin-worktree-purge.test.ts": 1945, "src/renderer/src/store/plugins/localization/plugin-language-packs-startup.test.ts": 435, "src/renderer/src/store/plugins/localization/plugin-language-packs.test.ts": 377, @@ -7851,13 +7808,11 @@ "tests/e2e/linear-store.unit.test.ts": 519, "tests/e2e/linear-write-lifetime.unit.test.ts": 5214, "tests/e2e/multi-workspace-typing-bench.unit.test.ts": 550, - "tests/e2e/native-chat-image-runtime-context.unit.test.ts": 2124, "tests/e2e/native-chat-live-history.unit.test.ts": 3258, "tests/e2e/native-chat-rewind-boundary.unit.test.ts": 2977, "tests/e2e/native-chat-ssh-transcript.unit.test.ts": 1166, "tests/e2e/native-chat-startup-option-pickers.unit.test.ts": 9377, - "tests/e2e/native-chat-transcript-reasoning.unit.test.ts": 3341, "tests/e2e/nested-agent-idle-owner.unit.test.ts": 2469, "tests/e2e/omp-child-session-recovery.unit.test.ts": 2205, "tests/e2e/omp-retired-host-renderer.unit.test.ts": 2546, @@ -7881,7 +7836,6 @@ "tests/e2e/source-control-action-phone-launch.unit.test.ts": 746, "tests/e2e/ssh-browser-network-execution-route.docker.unit.test.ts": 413, "tests/e2e/structured-agent-session-launch-admission.unit.test.ts": 4762, - "tests/e2e/structured-agent-session-launch-continuation.unit.test.ts": 23572, "tests/e2e/structured-agent-session-read-owner.unit.test.ts": 6912, "tests/e2e/structured-attention-headless-delivery.unit.test.ts": 328, "tests/e2e/structured-attention-prompt-relay.unit.test.ts": 14045, diff --git a/config/scripts/static-analysis/ratchets/renderer-state/check-terminal-parking-ownership-ratchet.mjs b/config/scripts/static-analysis/ratchets/renderer-state/check-terminal-parking-ownership-ratchet.mjs index 112b837bbb7..8d823b050a9 100644 --- a/config/scripts/static-analysis/ratchets/renderer-state/check-terminal-parking-ownership-ratchet.mjs +++ b/config/scripts/static-analysis/ratchets/renderer-state/check-terminal-parking-ownership-ratchet.mjs @@ -125,7 +125,7 @@ const EFFECT_BOUNDARIES = new Set([ `${WATCHERS}terminal-parked-pty-watcher.ts#startParkedPtyWatcher`, `${RENDERER}components/terminal-pane/parking/capture/parked-terminal-buffer-capture.ts#captureParkedTerminalBuffers`, `${RENDERER}lib/agent-session/resume/sleeping-agent-session-launch.ts#launchSleepingAgentSession`, - `${RENDERER}lib/host-mirror-handle-gap-wait.ts#parkUntilHostMirrorHandleLands`, + `${RENDERER}lib/agent-session/resume/host-mirror-handle-gap-wait.ts#parkUntilHostMirrorHandleLands`, `${RENDERER}runtime/web-session-tabs-sync/hydration/host-session-mirror-hydration.ts#parkUntilHostSessionMirrorHydrates` ]) const ENUMERATORS = new Set(['entries', 'values', 'keys', 'assign']) diff --git a/src/renderer/src/app-shell/appearance/terminal-app-theme.ts b/src/renderer/src/app-shell/appearance/terminal-app-theme.ts index 32dc7c0e44a..b638a1dc940 100644 --- a/src/renderer/src/app-shell/appearance/terminal-app-theme.ts +++ b/src/renderer/src/app-shell/appearance/terminal-app-theme.ts @@ -1,31 +1,22 @@ -import type { ITheme } from '@xterm/xterm' -import type { GlobalSettings } from '../../../../shared/global-settings-types' -import { - completePluginAppThemeTokens, - type PluginThemeTokenColorRule -} from '../../../../shared/plugins/artifacts/plugin-theme-artifact' +import { completePluginAppThemeTokens } from '../../../../shared/plugins/artifacts/plugin-theme-artifact' +import type { PluginThemeTokenColorRule } from '../../../../shared/plugins/artifacts/plugin-theme-artifact' import { pluginAppThemeCssFallback } from '../../../../shared/plugins/artifacts/plugin-theme-css-fallbacks' import { MATCH_TERMINAL_APP_THEME } from '../../../../shared/plugin-theme-settings' -import { - resolveTerminalPalette, - type TerminalPaletteSettings as TerminalAppThemeSettings -} from '../../../../shared/terminal-themes/terminal-theme-selection' -import type { AppThemePaint } from './document-theme' +import { resolveTerminalPalette } from '../../../../shared/terminal-themes/terminal-theme-selection' +import type { TerminalPaletteSettings as TerminalAppThemeSettings } from '../../../../shared/terminal-themes/terminal-theme-selection' import { hashThemeContent } from '../../lib/editor/appearance/plugin-monaco-theme' -import type { ColorProbe } from './plugin-theme-tokens' -import { - contrastRatio, - mix, - readableOn, - rgbaToHex, - type Rgba -} from '../../../../shared/color/rgba-contrast' -import { getSystemPrefersDark } from '../../lib/terminal-theme' +import { contrastRatio, mix, readableOn, rgbaToHex } from '../../../../shared/color/rgba-contrast' +import type { Rgba } from '../../../../shared/color/rgba-contrast' +import { getSystemPrefersDark } from '../../lib/terminal/appearance/terminal-theme' import { isTerminalBackgroundLight, resolveOpaqueTerminalBackground } from '../../../../shared/terminal-themes/terminal-title-contrast' import { terminalPaletteRgba } from '../../../../shared/terminal-themes/terminal-palette-rgba' +import type { ITheme } from '@xterm/xterm' +import type { GlobalSettings } from '../../../../shared/global-settings-types' +import type { AppThemePaint } from './document-theme' +import type { ColorProbe } from './plugin-theme-tokens' export type TerminalAppTheme = AppThemePaint & { id: typeof MATCH_TERMINAL_APP_THEME diff --git a/src/renderer/src/lib/indexeddb-connection.ts b/src/renderer/src/app-shell/storage/indexeddb-connection.ts similarity index 100% rename from src/renderer/src/lib/indexeddb-connection.ts rename to src/renderer/src/app-shell/storage/indexeddb-connection.ts diff --git a/src/renderer/src/app-shell/use-app-startup-hydration.ts b/src/renderer/src/app-shell/use-app-startup-hydration.ts index 218046472ca..1e388fc3bc6 100644 --- a/src/renderer/src/app-shell/use-app-startup-hydration.ts +++ b/src/renderer/src/app-shell/use-app-startup-hydration.ts @@ -24,7 +24,7 @@ import { recoverFromDegradedStartup } from '../startup/startup-degraded-recovery import { restoreSshConnectionsForStartup } from '../startup/startup-ssh-connection-restore' import { collectActiveWorkspaceSshTargetIds } from '../startup/active-workspace-ssh-targets' import { publishTerminalViewAttributesAtAppStart } from '../components/terminal-pane/appearance/terminal-appearance' -import { getSystemPrefersDark } from '../lib/terminal-theme' +import { getSystemPrefersDark } from '../lib/terminal/appearance/terminal-theme' import { collectTerminalProviderSnapshotPtyIds, refreshTerminalProviderSnapshotCapabilities @@ -40,12 +40,12 @@ import { listRuntimeSessionHostsForStartup } from './startup-runtime-session-hos import { mapWithConcurrency } from '../../../shared/map-with-concurrency' import { collectWslMovedWorkspaceKeysFromSession } from '../store/repos/wsl-moved-projects' import { wslMovedSessionReadApi } from '../store/repos/wsl-moved-local-session-rows' -import type { OnboardingState } from '../../../shared/onboarding-state-types' import { ensureLocalRuntimeCapabilities } from '../runtime/hosts/capabilities/local-runtime-capabilities' import { finishStartupWorktreeHydration, refreshStartupWorktrees } from '../startup/startup-worktree-refresh' +import type { OnboardingState } from '../../../shared/onboarding-state-types' /** Hydrate settings/UI/catalog/session, reconnect and restore terminals before unlocking saves. Failure boots in degraded no-save mode to protect disk state. */ export function useAppStartupHydration(onOnboardingLoaded: (state: OnboardingState) => void): void { diff --git a/src/renderer/src/app-shell/use-terminal-viewer-color-publication.ts b/src/renderer/src/app-shell/use-terminal-viewer-color-publication.ts index c510b7304e1..89875c6d7b0 100644 --- a/src/renderer/src/app-shell/use-terminal-viewer-color-publication.ts +++ b/src/renderer/src/app-shell/use-terminal-viewer-color-publication.ts @@ -1,9 +1,9 @@ import { useEffect } from 'react' -import { getSystemPrefersDark } from '@/lib/terminal-theme' +import { getSystemPrefersDark } from '@/lib/terminal/appearance/terminal-theme' import { publishTerminalViewAttributesAtAppStart } from '../components/terminal-pane/appearance/terminal-appearance' import { subscribeToPublishedTerminalViewAttributes } from '../components/terminal-pane/appearance/terminal-view-attributes-publisher' import { remoteRuntimeTerminalColorPush } from '../runtime/hosted-terminals/streams/remote-runtime-terminal-color-push' -import { useAppStore } from '../store' +import { useAppStore } from '../store/index' /** Reports this window's terminal theme to its own host and to every paired host. */ export function useTerminalViewerColorPublication(): void { diff --git a/src/renderer/src/components/agent/launch-settings/AgentDefaultSurfacePreviews.tsx b/src/renderer/src/components/agent/launch-settings/AgentDefaultSurfacePreviews.tsx index aa9c0a5cf9a..10e58143629 100644 --- a/src/renderer/src/components/agent/launch-settings/AgentDefaultSurfacePreviews.tsx +++ b/src/renderer/src/components/agent/launch-settings/AgentDefaultSurfacePreviews.tsx @@ -1,6 +1,6 @@ -import { useMemo, type CSSProperties, type JSX, type ReactNode } from 'react' +import { useMemo } from 'react' +import type { CSSProperties, JSX, ReactNode } from 'react' import { ArrowUp, ChevronDown, Eye, Hand, Plus, X } from 'lucide-react' -import type { GlobalSettings } from '../../../../../shared/global-settings-types' import { FlowDiagram } from '@/components/feature-tips/ChatUiHereFeatureTipVisual' import { CHAT_DEMO_FILE, @@ -18,8 +18,9 @@ import { useSystemPrefersDark } from '@/hooks/theme/use-system-prefers-dark' import { useIntlLocale, useTranslate } from '@/i18n/use-translate' import { AgentIcon } from '@/components/agent/icons/AgentIcon' import { buildFontFamily } from '../../../../../shared/monospace-font-family' -import { resolveEffectiveTerminalAppearance } from '@/lib/terminal-theme' +import { resolveEffectiveTerminalAppearance } from '@/lib/terminal/appearance/terminal-theme' import { cn } from '@/lib/class-names' +import type { GlobalSettings } from '../../../../../shared/global-settings-types' // The tip's chat miniature, finished and denser so it fits a tile; nothing here animates. const CHAT_SCALE: CSSProperties & { '--chat-font-size': string } = { '--chat-font-size': '10px' } diff --git a/src/renderer/src/components/automations/runs/automation-run-workspace-action.ts b/src/renderer/src/components/automations/runs/automation-run-workspace-action.ts index 82764baa8bd..7c6b8797c46 100644 --- a/src/renderer/src/components/automations/runs/automation-run-workspace-action.ts +++ b/src/renderer/src/components/automations/runs/automation-run-workspace-action.ts @@ -1,14 +1,12 @@ -import { openExistingStructuredSession } from '@/lib/open-existing-structured-session' +import { openExistingStructuredSession } from '@/lib/agent-session/open/open-existing-structured-session' import { ALL_TUI_AGENTS } from '../../../../../shared/agent-launch/catalog/tui-agent-display-names' import { isStructuredAgentSessionIdFor } from '../../../../../shared/agent-session/structured-agent-session-create' -import type { AutomationRun } from '../../../../../shared/automations/history/automation-run' import { toast } from 'sonner' import { translate } from '@/i18n/i18n' import { activateAndRevealWorktree, activateAndRevealFolderWorkspace } from '@/lib/workspace/activation/worktree-activation' -import type { ActivateAndRevealResult } from '@/lib/workspace/activation/worktree-activation-outcome' import { activateWslMovedWorkspace } from '@/lib/workspace/activation/wsl-moved-chat-activation' import { useAppStore } from '@/store/index' import { activateTerminalTabOnOwner } from '@/lib/workspace/tabs/terminal-tab-owner-activation' @@ -17,6 +15,8 @@ import { resolveWebSessionVisibleTabId } from '@/runtime/web-session-tabs-sync/n import { parsePaneKey } from '../../../../../shared/workspace-layout/stable-pane-id' import { parseWorkspaceKey } from '../../../../../shared/workspace-scope' import { buildAutomationRunOpenLayout } from './automation-run-pane-layout' +import type { AutomationRun } from '../../../../../shared/automations/history/automation-run' +import type { ActivateAndRevealResult } from '@/lib/workspace/activation/worktree-activation-outcome' import type { AutomationsPageActionContext } from '../automations-page-action-context' let cancelPendingReveal: (() => void) | undefined diff --git a/src/renderer/src/components/cmd-j/quick-action-context.ts b/src/renderer/src/components/cmd-j/quick-action-context.ts index 62cea06a987..a69d82df00e 100644 --- a/src/renderer/src/components/cmd-j/quick-action-context.ts +++ b/src/renderer/src/components/cmd-j/quick-action-context.ts @@ -1,16 +1,16 @@ -import type { AppState } from '@/store/types' import { translate } from '@/i18n/i18n' import { findFirstIndexedWorktree } from '@/lib/workspace/ownership/worktree-runtime-owner-index' -import type { Worktree } from '../../../../shared/worktree/types' -import type { SshConnectionStatus } from '../../../../shared/ssh-types' -import { getClientCreationActionPolicy } from '@/lib/client-creation-action-policy' +import { getClientCreationActionPolicy } from '@/lib/workspace/creation/surface-policy/client-creation-action-policy' import { canRunNativeChatSplitTarget, resolveActiveNativeChatSplitTarget, runActiveNativeChatSplit } from '@/components/native-chat/pane/routing/native-chat-layout-actions' -import type { NativeChatSplitDirection } from '@/components/native-chat/pane/routing/native-chat-pane-shortcut' import { selectWorktreesByRepo } from '@/store/workspaces/catalog/workspace-record-fields' +import type { AppState } from '@/store/types' +import type { Worktree } from '../../../../shared/worktree/types' +import type { SshConnectionStatus } from '../../../../shared/ssh-types' +import type { NativeChatSplitDirection } from '@/components/native-chat/pane/routing/native-chat-pane-shortcut' import type { TabSplitDirection } from '@/store/slices/tabs/tabs-slice-contract' export type CmdJUnavailableReason = diff --git a/src/renderer/src/components/dashboard-popout/AgentTerminalPreview.tsx b/src/renderer/src/components/dashboard-popout/AgentTerminalPreview.tsx index f5ced3a45ee..952a64d9b1f 100644 --- a/src/renderer/src/components/dashboard-popout/AgentTerminalPreview.tsx +++ b/src/renderer/src/components/dashboard-popout/AgentTerminalPreview.tsx @@ -1,6 +1,4 @@ -import type { PreviewTerminalLinkHandler } from './preview-terminal-links' import { useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react' -import type { ITheme, Terminal } from '@xterm/xterm' import { useShallow } from 'zustand/react/shallow' import { composeActiveTerminalTheme } from '@/components/terminal-pane/appearance/terminal-appearance' import { useSystemPrefersDark } from '@/hooks/theme/use-system-prefers-dark' @@ -13,29 +11,26 @@ import { previewAdvertisesKittyKeyboard } from './preview-terminal-options' import { syncPreviewTerminalLigatures } from './preview-terminal-ligatures' -import type { DashboardCardTerminalInput } from '../../../../shared/dashboard-snapshot' import { terminalPreviewUnavailableMessage } from './terminal-preview-unavailable-message' -import { resolveEffectiveTerminalAppearance } from '@/lib/terminal-theme' +import { resolveEffectiveTerminalAppearance } from '@/lib/terminal/appearance/terminal-theme' import { cn } from '@/lib/class-names' import { useAppStore } from '@/store/index' import { usePluginFontReady } from '@/store/plugins/appearance/plugin-fonts' import { createPreviewGridClaim } from './preview-grid-claim' import { createPreviewBoxFit } from './preview-terminal-box-fit' -import { - openStandaloneTerminal, - type StandaloneTerminal -} from '../standalone-terminal/open-standalone-terminal' -import type { TerminalPreviewDataPayload } from '../../../../shared/terminal/replay/terminal-preview' +import { openStandaloneTerminal } from '../standalone-terminal/open-standalone-terminal' +import type { StandaloneTerminal } from '../standalone-terminal/open-standalone-terminal' import { terminalPreviewApiFor } from './terminal-preview-api' - import { LinkActionPopover } from '@/components/link-actions/LinkActionPopover' -import { - closeLinkActionRequest, - type LinkActionRequest -} from '@/components/link-actions/link-action-request' +import { closeLinkActionRequest } from '@/components/link-actions/link-action-request' +import type { LinkActionRequest } from '@/components/link-actions/link-action-request' import { installDashboardPreviewLinkInteraction } from './dashboard-preview-link-interaction' -import type { DashboardPreviewLinkSource } from './dashboard-preview-http-actions' import { useTranslate } from '@/i18n/use-translate' +import type { PreviewTerminalLinkHandler } from './preview-terminal-links' +import type { ITheme, Terminal } from '@xterm/xterm' +import type { DashboardCardTerminalInput } from '../../../../shared/dashboard-snapshot' +import type { TerminalPreviewDataPayload } from '../../../../shared/terminal/replay/terminal-preview' +import type { DashboardPreviewLinkSource } from './dashboard-preview-http-actions' const PREVIEW_SCROLLBACK_ROWS = 24 // Preview snapshots bound history; pane scrollback would only cost memory. diff --git a/src/renderer/src/components/dashboard-popout/dashboard-preview-http-actions.ts b/src/renderer/src/components/dashboard-popout/dashboard-preview-http-actions.ts index d2bf0a8f9b3..91bd1aef3a0 100644 --- a/src/renderer/src/components/dashboard-popout/dashboard-preview-http-actions.ts +++ b/src/renderer/src/components/dashboard-popout/dashboard-preview-http-actions.ts @@ -1,29 +1,31 @@ import { toast } from 'sonner' import { intentPresentation } from '@/lib/browser/workspace/workspace-browser-tab-presentation' -import type { DashboardCard } from '../../../../shared/dashboard-snapshot' import { parseAppSshPtyId } from '../../../../shared/ssh-pty-id' import { parseRoutableExecutionHostId } from '../../../../shared/execution-host' import { parseRemoteRuntimePtyId, isRemoteRuntimePtyId } from '../../../../shared/remote-runtime/remote-runtime-pty-id' -import { useAppStore } from '@/store' +import { useAppStore } from '@/store/index' import { resolveOwner } from '@/lib/workspace/ownership/resolve-owner' import { resolveWorktreeOperationRoute } from '@/lib/workspace/ownership/worktree-operation-route' import { createBrowserLinkHostMatcher } from '@/lib/browser/navigation/browser-link-owner' -import { getWorkspaceClientCreationActionPolicy } from '@/lib/client-creation-action-policy' +import { getWorkspaceClientCreationActionPolicy } from '@/lib/workspace/creation/surface-policy/client-creation-action-policy' import { canOpenWorkspaceBrowserTabOnRuntime, canOpenWorkspaceBrowserTabOnSsh } from '@/lib/browser/workspace/workspace-browser-route-eligibility' -import type { HttpLinkSourceOwner } from '@/lib/browser/navigation/http-link-routing' import { buildHttpLinkActions, httpLinkActionDestinationsFor, - openRoutedHttpLink, - type HttpLinkDestination, - type HttpLinkActionDestinations + openRoutedHttpLink } from '@/lib/browser/navigation/http-link-destinations' +import type { + HttpLinkDestination, + HttpLinkActionDestinations +} from '@/lib/browser/navigation/http-link-destinations' +import type { DashboardCard } from '../../../../shared/dashboard-snapshot' +import type { HttpLinkSourceOwner } from '@/lib/browser/navigation/http-link-routing' export type DashboardPreviewLinkSource = Pick< DashboardCard, diff --git a/src/renderer/src/components/dashboard/dashboard-card-labels.ts b/src/renderer/src/components/dashboard/dashboard-card-labels.ts index 3440cad19e5..ce2310922be 100644 --- a/src/renderer/src/components/dashboard/dashboard-card-labels.ts +++ b/src/renderer/src/components/dashboard/dashboard-card-labels.ts @@ -1,15 +1,13 @@ import { getAgentRowConversationName } from '../../../../shared/agent-status/presentation/agent-row-conversation-name' import { DASHBOARD_MAX_LABEL_LENGTH } from '../../../../shared/dashboard-snapshot' import { parsePaneKey } from '../../../../shared/workspace-layout/stable-pane-id' -import type { TerminalLayoutSnapshot } from '../../../../shared/workspace-layout/terminal-tab-types' import { resolveAgentRowPaneLiveTitle } from './agent-row-pane-live-title' +import { structuredChatTabById } from '@/lib/agent-session/tab-identity/structured-chat-tab-index' +import { projectedStructuredChatTabName } from '@/runtime/native-chat/naming/structured-chat-tab-name' +import type { StructuredChatTabNames } from '@/runtime/native-chat/naming/structured-chat-tab-name' +import type { TerminalLayoutSnapshot } from '../../../../shared/workspace-layout/terminal-tab-types' import type { DashboardAgentRow } from './useDashboardData' import type { AppState } from '@/store/types' -import { structuredChatTabById } from '@/lib/structured-chat-tab-index' -import { - projectedStructuredChatTabName, - type StructuredChatTabNames -} from '@/runtime/native-chat/naming/structured-chat-tab-name' export function rowTask(row: DashboardAgentRow): string { return (row.entry.orchestration?.taskTitle ?? '').trim() || (row.entry.prompt ?? '').trim() diff --git a/src/renderer/src/components/dashboard/use-agent-row-conversation-name.ts b/src/renderer/src/components/dashboard/use-agent-row-conversation-name.ts index add52e79690..1fa9c15b620 100644 --- a/src/renderer/src/components/dashboard/use-agent-row-conversation-name.ts +++ b/src/renderer/src/components/dashboard/use-agent-row-conversation-name.ts @@ -3,7 +3,7 @@ import { getAgentRowConversationName } from '../../../../shared/agent-status/pre import { parsePaneKey } from '../../../../shared/workspace-layout/stable-pane-id' import { structuredChatDisplayName } from '../../../../shared/structured-chat-row-name' import { resolveAgentRowPaneLiveTitle } from './agent-row-pane-live-title' -import { structuredChatTabById } from '@/lib/structured-chat-tab-index' +import { structuredChatTabById } from '@/lib/agent-session/tab-identity/structured-chat-tab-index' import { useStructuredChatTabConversationName } from '@/runtime/native-chat/naming/structured-conversation-name' import type { AppState } from '@/store/types' import type { DashboardAgentRow } from './useDashboardData' diff --git a/src/renderer/src/components/editor/autosave/editor-autosave.ts b/src/renderer/src/components/editor/autosave/editor-autosave.ts index ae683c99964..0d09179ff5d 100644 --- a/src/renderer/src/components/editor/autosave/editor-autosave.ts +++ b/src/renderer/src/components/editor/autosave/editor-autosave.ts @@ -1,5 +1,4 @@ import { joinPath } from '@/lib/path' -import type { OpenFile } from '@/store/slices/editor/types/open-file' import { areLocalWindowsWslPathAliases } from '../../../../../shared/cross-platform-path' import { externalChangePathKeyFor } from '@/store/slices/editor/buffers/editor-buffer-identity' import { isLocalWindowsDesktopClient } from '@/app-shell/chrome/desktop-window-chrome' @@ -8,8 +7,9 @@ import { MAX_EDITOR_AUTO_SAVE_DELAY_MS, MIN_EDITOR_AUTO_SAVE_DELAY_MS } from '../../../../../shared/constants' -import { clampNumber } from '@/lib/terminal-theme' +import { clampNumber } from '@/lib/terminal/appearance/terminal-theme' import { isAutosavePausedForNonUtf8File } from './editor-non-utf8-autosave-pause' +import type { OpenFile } from '@/store/slices/editor/types/open-file' export const ORCA_EDITOR_QUIESCE_FILE_SAVES_EVENT = 'orca:editor-quiesce-file-saves' export const ORCA_EDITOR_EXTERNAL_FILE_CHANGE_EVENT = 'orca:editor-external-file-change' diff --git a/src/renderer/src/components/editor/editor-dropped-file-open.ts b/src/renderer/src/components/editor/editor-dropped-file-open.ts index b925fa2af10..052d355878f 100644 --- a/src/renderer/src/components/editor/editor-dropped-file-open.ts +++ b/src/renderer/src/components/editor/editor-dropped-file-open.ts @@ -1,35 +1,33 @@ -import type { EditorFileDropDestination } from './editor-file-drop-destination' import { toast } from 'sonner' import { detectLanguage } from '../../../../shared/editor-language/editor-language-detect' import { isPathInsideWorktree, toWorktreeRelativePath } from '../../../../shared/terminal/links/terminal-links' -import { useAppStore } from '@/store' +import { useAppStore } from '@/store/index' import { getConnectionId } from '@/lib/workspace/ownership/connection-context' import { basename, joinPath } from '@/lib/path' -import type { WorktreeRuntimeOwnerState } from '@/lib/workspace/ownership/worktree-runtime-owner-state' import { importExternalPathsToRuntime } from '@/runtime/files/imports/runtime-file-import-client' -import type { RuntimeFileOperationArgs } from '@/runtime/files/runtime-file-client-types' import { runtimeTargetEnvironmentId } from '@/runtime/rpc/targets/runtime-client-target' -import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target' import { translate } from '@/i18n/i18n' import { describeSharedDropFailureReason } from '@/lib/files/drop/drop-skip-reason-copy' -import { captureWorktreeSshMutationExpectation } from '@/lib/ssh-mutation-expectation' +import { captureWorktreeSshMutationExpectation } from '@/runtime/hosts/ssh/ssh-mutation-expectation' import { statUserOpenedPath } from '@/lib/files/access/user-opened-local-path' import { FLOATING_TERMINAL_WORKTREE_ID } from '../../../../shared/constants' import { DROP_STAGING_RELATIVE_DIR } from '../../../../shared/drop-staging-ignore' import { openDocumentInFloatingWorkspace } from '@/components/floating-terminal/open-document-in-floating-workspace' import { requireRuntimeTargetForFileOwner } from '@/lib/files/access/file-owner-runtime-target' import { parseExecutionHostId } from '../../../../shared/execution-host' -import { - isResolvedWorkspaceFileDragExecutionHost, - type WorkspaceFileDragSource -} from '@/lib/files/drop/workspace-file-drag' +import { isResolvedWorkspaceFileDragExecutionHost } from '@/lib/files/drop/workspace-file-drag' +import type { WorkspaceFileDragSource } from '@/lib/files/drop/workspace-file-drag' import { captureFileExplorerOperationGuard, getFileExplorerOperationOwner } from '../right-sidebar/file-explorer/navigation/file-explorer-operation-owner' +import type { EditorFileDropDestination } from './editor-file-drop-destination' +import type { WorktreeRuntimeOwnerState } from '@/lib/workspace/ownership/worktree-runtime-owner-state' +import type { RuntimeFileOperationArgs } from '@/runtime/files/runtime-file-client-types' +import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target' export function shouldUploadRemoteEditorFileDrop( target: RuntimeClientTarget, diff --git a/src/renderer/src/components/editor/markdown-preview/links/markdown-preview-link-actions.ts b/src/renderer/src/components/editor/markdown-preview/links/markdown-preview-link-actions.ts index 8da806ffd8d..e0df54cdc63 100644 --- a/src/renderer/src/components/editor/markdown-preview/links/markdown-preview-link-actions.ts +++ b/src/renderer/src/components/editor/markdown-preview/links/markdown-preview-link-actions.ts @@ -6,7 +6,7 @@ import { isLocalPathOpenBlocked, showLocalPathOpenBlockedToast } from '@/lib/files/os-open/local-path-open-guard' -import { getLinkSourceLocalOpenOwner } from '@/lib/link-source-local-open-owner' +import { getLinkSourceLocalOpenOwner } from '@/lib/links/ownership/link-source-local-open-owner' import { openHttpLink } from '@/lib/browser/navigation/http-link-routing' import { translate } from '@/i18n/i18n' import { requireRuntimeTargetForFileOwner } from '@/lib/files/access/file-owner-runtime-target' diff --git a/src/renderer/src/components/editor/markdown-preview/links/markdown-preview-system-link-action.ts b/src/renderer/src/components/editor/markdown-preview/links/markdown-preview-system-link-action.ts index 65b1398fe15..2c13bc007a2 100644 --- a/src/renderer/src/components/editor/markdown-preview/links/markdown-preview-system-link-action.ts +++ b/src/renderer/src/components/editor/markdown-preview/links/markdown-preview-system-link-action.ts @@ -5,19 +5,19 @@ import { showLocalPathOpenBlockedToast } from '@/lib/files/os-open/local-path-open-guard' import { openHttpLink } from '@/lib/browser/navigation/http-link-routing' -import { getLinkSourceLocalOpenOwner } from '@/lib/link-source-local-open-owner' +import { getLinkSourceLocalOpenOwner } from '@/lib/links/ownership/link-source-local-open-owner' import { useAppStore } from '@/store/index' import { absolutePathToFileUri, resolveMarkdownLinkTarget } from '../../markdown/link-routing/markdown-internal-links' import { openMarkdownFileLinkWithSystemDefault } from '../../markdown/link-routing/markdown-file-link-system-open' -import type { MarkdownPreviewLinkContext } from './markdown-preview-link-actions' import { getMarkdownPreviewLinkTarget, isMarkdownPreviewSystemBrowserModifier, resolveMarkdownPreviewHttpOpenOptions } from '../../markdown/link-routing/markdown-preview-links' +import type { MarkdownPreviewLinkContext } from './markdown-preview-link-actions' export function handleMarkdownPreviewSystemLinkClick({ event, diff --git a/src/renderer/src/components/editor/notebook/outputs/IpynbCellOutputs.tsx b/src/renderer/src/components/editor/notebook/outputs/IpynbCellOutputs.tsx index 64854e84dc6..f4e8908f551 100644 --- a/src/renderer/src/components/editor/notebook/outputs/IpynbCellOutputs.tsx +++ b/src/renderer/src/components/editor/notebook/outputs/IpynbCellOutputs.tsx @@ -1,16 +1,17 @@ -import type { ITheme } from '@xterm/xterm' import { cn } from '@/lib/class-names' -import '@/lib/terminal-theme' -import { getTheme } from '@/lib/terminal-themes-data' +import '@/lib/terminal/appearance/terminal-theme' +import { getTheme } from '@/lib/terminal/appearance/terminal-themes-data' import { DEFAULT_TERMINAL_THEME_DARK, DEFAULT_TERMINAL_THEME_LIGHT } from '../../../../../../shared/terminal-themes/terminal-theme-selection' import { IpynbMarkdownCell } from '../cells/IpynbCellEditor' import { IpynbHtmlOutput } from './IpynbHtmlOutput' -import { parseAnsiSegments, type AnsiColor } from './ipynb-ansi' -import type { IpynbCell, IpynbOutput, IpynbOutputItem } from '../document/ipynb-parse' +import { parseAnsiSegments } from './ipynb-ansi' +import type { AnsiColor } from './ipynb-ansi' import { useDocumentDarkTheme } from '@/hooks/use-document-dark-theme' +import type { ITheme } from '@xterm/xterm' +import type { IpynbCell, IpynbOutput, IpynbOutputItem } from '../document/ipynb-parse' const ANSI_PALETTE_KEYS = [ 'black', diff --git a/src/renderer/src/components/editor/open-editor-html-preview.test.ts b/src/renderer/src/components/editor/open-editor-html-preview.test.ts index 63d543b1e44..752bf9141e6 100644 --- a/src/renderer/src/components/editor/open-editor-html-preview.test.ts +++ b/src/renderer/src/components/editor/open-editor-html-preview.test.ts @@ -1,5 +1,5 @@ import { afterEach, beforeEach, expect, it, vi } from 'vitest' -import { useAppStore } from '@/store' +import { useAppStore } from '@/store/index' import { createStoreCascadesMockApi } from '@/store/testing/app-store-cascade-api.test-fixture' import { EDITOR_OWNER, @@ -10,7 +10,7 @@ import { seedBrowserLinkTestStore, WORKSPACE } from '@/lib/browser/navigation/browser-link-open.test-fixture' -import { beginLinkOpenRequest } from '@/lib/link-open-request' +import { beginLinkOpenRequest } from '@/lib/links/link-open-request' import { registerEditorFrameFlush } from './save/flush/editor-pending-flush' import { openEditorHtmlPreview } from './open-editor-html-preview' @@ -214,25 +214,6 @@ it('refuses a local preview when the file gains remote host evidence during its expect(useAppStore.getState().browserTabsByWorktree[WORKSPACE] ?? []).toEqual([]) }) -it.each(['refused', 'rejected'] as const)( - 'keeps the editor selected when its guest flush is %s', - async (failure) => { - const unregister = registerEditorFrameFlush('report', () => - failure === 'refused' ? Promise.resolve(false) : Promise.reject(new Error('flush failed')) - ) - try { - await openEditorHtmlPreview('report', 'source') - const state = useAppStore.getState() - expect(state.browserTabsByWorktree[WORKSPACE] ?? []).toEqual([]) - expect( - state.groupsByWorktree[WORKSPACE]?.find((group) => group.id === 'a')?.activeTabId - ).toBe('source') - } finally { - unregister() - } - } -) - it('cancels preview when its editor tab closes but the file stays open in another tab', async () => { useAppStore.setState((state) => ({ unifiedTabsByWorktree: { diff --git a/src/renderer/src/components/editor/open-editor-html-preview.ts b/src/renderer/src/components/editor/open-editor-html-preview.ts index 320351d3638..f846736d618 100644 --- a/src/renderer/src/components/editor/open-editor-html-preview.ts +++ b/src/renderer/src/components/editor/open-editor-html-preview.ts @@ -1,5 +1,5 @@ import { toast } from 'sonner' -import { useAppStore } from '@/store' +import { useAppStore } from '@/store/index' import { editorViewPlacement, editorViewTab @@ -8,8 +8,8 @@ import { openFileInBrowserTab } from '@/lib/browser/documents/file-preview' import { resolveFileBrowserLinkExecutionHostId } from '@/lib/browser/documents/file-preview-link-open' import { captureBrowserLinkReveal } from '@/lib/browser/navigation/browser-link-reveal' import { createBrowserLinkHostMatcher } from '@/lib/browser/navigation/browser-link-owner' -import { beginLinkOpenRequest, subscribeLinkOpenRequests } from '@/lib/link-open-request' -import { captureLinkOpenIntent } from '@/lib/link-open-intent' +import { beginLinkOpenRequest, subscribeLinkOpenRequests } from '@/lib/links/link-open-request' +import { captureLinkOpenIntent } from '@/lib/links/placement/link-open-intent' import { flushEditorFrames } from './save/flush/editor-pending-flush' export async function openEditorHtmlPreview( diff --git a/src/renderer/src/components/editor/rich-markdown/images/rich-markdown-image-insert.ts b/src/renderer/src/components/editor/rich-markdown/images/rich-markdown-image-insert.ts index 78a965234d9..baa7c77cdfd 100644 --- a/src/renderer/src/components/editor/rich-markdown/images/rich-markdown-image-insert.ts +++ b/src/renderer/src/components/editor/rich-markdown/images/rich-markdown-image-insert.ts @@ -1,4 +1,3 @@ -import type { Editor } from '@tiptap/react' import { toast } from 'sonner' import { dirname, basename } from '@/lib/path' import { getConnectionId } from '@/lib/workspace/ownership/connection-context' @@ -10,18 +9,19 @@ import { } from '@/lib/editor/file-operations/editor-file-operation-owner' import { editorTabDocumentFolderAccess } from '@/lib/files/access/local-file-access' import { requireRuntimeTargetForFileOwner } from '@/lib/files/access/file-owner-runtime-target' -import { captureDirectSshMutationExpectation } from '@/lib/ssh-mutation-expectation' +import { captureDirectSshMutationExpectation } from '@/runtime/hosts/ssh/ssh-mutation-expectation' import { translate } from '@/i18n/i18n' import { parseWorkspaceKey } from '../../../../../../shared/workspace-scope' import { extractIpcErrorMessage } from './rich-markdown-ipc-error-message' import { buildRichMarkdownImageInsertContent } from './rich-markdown-image-insert-content' import { showRichMarkdownImageInsertionCanceled } from './rich-markdown-image-insertion-feedback' -import type { RichMarkdownImageInsertionRange } from './rich-markdown-image-insertion-target' import { richMarkdownClipboardInsertionOrderKey } from '../clipboard/rich-markdown-clipboard-insertion-order' import { selectFolderWorkspaces, selectWorktreesByRepo } from '@/store/workspaces/catalog/workspace-record-fields' +import type { Editor } from '@tiptap/react' +import type { RichMarkdownImageInsertionRange } from './rich-markdown-image-insertion-target' import type { RuntimeFileOperationArgs } from '@/runtime/files/runtime-file-client-types' import type { LocalFileAccess } from '../../../../../../shared/file-access/local-file-access' diff --git a/src/renderer/src/components/editor/rich-markdown/links/rich-markdown-editor-click-routing.ts b/src/renderer/src/components/editor/rich-markdown/links/rich-markdown-editor-click-routing.ts index 7878353d3d5..bf4e6a7d2bc 100644 --- a/src/renderer/src/components/editor/rich-markdown/links/rich-markdown-editor-click-routing.ts +++ b/src/renderer/src/components/editor/rich-markdown/links/rich-markdown-editor-click-routing.ts @@ -1,8 +1,4 @@ -import type { MutableRefObject } from 'react' -import type { Editor } from '@tiptap/react' -import type { EditorView } from '@tiptap/pm/view' import { toast } from 'sonner' -import type { HttpLinkSourceOwner } from '@/lib/browser/navigation/http-link-routing' import { httpLinkActionDestinationsFor, openRoutedHttpLink @@ -17,7 +13,7 @@ import { isLocalPathOpenBlocked, showLocalPathOpenBlockedToast } from '@/lib/files/os-open/local-path-open-guard' -import { getLinkSourceLocalOpenOwner } from '@/lib/link-source-local-open-owner' +import { getLinkSourceLocalOpenOwner } from '@/lib/links/ownership/link-source-local-open-owner' import { absolutePathToFileUri as toFileUrlForOsEscape, resolveMarkdownLinkTarget @@ -25,13 +21,15 @@ import { import { openMarkdownFileLinkWithSystemDefault } from '../../markdown/link-routing/markdown-file-link-system-open' import { scrollToAnchorInEditor } from '../../markdown/navigation/markdown-anchor-scroll' import { getRichMarkdownCommentAtPos } from '../review/rich-markdown-review-annotations' -import type { DiffComment } from '../../../../../../shared/diff-comment-types' import { toRuntimeExecutionHostId } from '../../../../../../shared/execution-host' import { translate } from '@/i18n/i18n' -import { - classifyHtmlSuperscriptLinkAction, - type RichMarkdownHtmlSuperscriptLinkContext -} from '../citations/rich-markdown-html-superscript-link-context' +import { classifyHtmlSuperscriptLinkAction } from '../citations/rich-markdown-html-superscript-link-context' +import type { RichMarkdownHtmlSuperscriptLinkContext } from '../citations/rich-markdown-html-superscript-link-context' +import type { MutableRefObject } from 'react' +import type { Editor } from '@tiptap/react' +import type { EditorView } from '@tiptap/pm/view' +import type { HttpLinkSourceOwner } from '@/lib/browser/navigation/http-link-routing' +import type { DiffComment } from '../../../../../../shared/diff-comment-types' export type ActivateMarkdownLink = ( href: string, diff --git a/src/renderer/src/components/feature-wall/FeatureWallBrowserAction.tsx b/src/renderer/src/components/feature-wall/FeatureWallBrowserAction.tsx index f7c96eec088..fe369f2c93e 100644 --- a/src/renderer/src/components/feature-wall/FeatureWallBrowserAction.tsx +++ b/src/renderer/src/components/feature-wall/FeatureWallBrowserAction.tsx @@ -5,7 +5,6 @@ import { useOnboardingSkillRuntime } from '@/hooks/skills/runtime/use-onboarding import { FeatureSetupInlineTerminal } from '../onboarding/FeatureSetupInlineTerminal' import { buildAgentFeatureSkillInstallCommand } from '@/lib/skills/installation/agent-feature-install-commands' import { buildSkillCommandForRuntime } from '../../lib/skills/runtime/skill-runtime-command' -import type { OnboardingFeatureSetupRuntimeContext } from '../onboarding/onboarding-feature-setup-runtime' import { useCallback, useState } from 'react' import { ArrowUpRight, Download, Loader2 } from 'lucide-react' import { toast } from 'sonner' @@ -22,14 +21,15 @@ import { import { BundledSkillInstallStatus } from '../skills/setup/BundledSkillInstallStatus' import { onboardingFeatureSetupRunTelemetry, - runOnboardingFeatureSetup, - type OnboardingFeatureSetupSelection + runOnboardingFeatureSetup } from '../onboarding/onboarding-feature-setup' +import type { OnboardingFeatureSetupSelection } from '../onboarding/onboarding-feature-setup' import { promptForSetupGuideProject, useSetupTargetWorktree } from './FeatureWallSetupWorkflowActions' -import { getClientCreationActionPolicy } from '@/lib/client-creation-action-policy' +import { getClientCreationActionPolicy } from '@/lib/workspace/creation/surface-policy/client-creation-action-policy' +import type { OnboardingFeatureSetupRuntimeContext } from '../onboarding/onboarding-feature-setup-runtime' export function BrowserAction(props: { done: boolean }): React.JSX.Element { const t = useTranslate() diff --git a/src/renderer/src/components/feature-wall/use-feature-wall-task-source-presentation.ts b/src/renderer/src/components/feature-wall/use-feature-wall-task-source-presentation.ts index b927c969e98..075ee1243b8 100644 --- a/src/renderer/src/components/feature-wall/use-feature-wall-task-source-presentation.ts +++ b/src/renderer/src/components/feature-wall/use-feature-wall-task-source-presentation.ts @@ -1,9 +1,10 @@ import { useEffect } from 'react' -import type { FeatureWallWorkflow } from '../../../../shared/feature-wall-workflows' -import { useAppStore } from '@/store' -import { getLocalPreflightContext, localPreflightContextKey } from '@/lib/local-preflight-context' +import { useAppStore } from '@/store/index' +import { getLocalPreflightContext } from '@/runtime/hosts/preflight/local-preflight-context' import { getProviderRuntimeContextKey } from '@/runtime/hosts/observations/provider-runtime-context' import { deriveIntegrationConnectionStatus } from './use-integration-connection-status' +import type { FeatureWallWorkflow } from '../../../../shared/feature-wall-workflows' +import { localPreflightContextKey } from '../../runtime/hosts/preflight/local-preflight-context-key' export type FeatureWallTaskSourcePresentation = { workflow: FeatureWallWorkflow diff --git a/src/renderer/src/components/feature-wall/use-integration-connection-status.ts b/src/renderer/src/components/feature-wall/use-integration-connection-status.ts index 39b9eee1736..8aaedf5efa1 100644 --- a/src/renderer/src/components/feature-wall/use-integration-connection-status.ts +++ b/src/renderer/src/components/feature-wall/use-integration-connection-status.ts @@ -1,6 +1,7 @@ -import { useAppStore } from '@/store' -import { getLocalPreflightContext, localPreflightContextKey } from '@/lib/local-preflight-context' +import { useAppStore } from '@/store/index' +import { getLocalPreflightContext } from '@/runtime/hosts/preflight/local-preflight-context' import { getProviderRuntimeContextKey } from '@/runtime/hosts/observations/provider-runtime-context' +import { localPreflightContextKey } from '../../runtime/hosts/preflight/local-preflight-context-key' export type IntegrationStepState = 'active' | 'done' | 'upcoming' diff --git a/src/renderer/src/components/floating-terminal/FloatingTerminalPanelSurface.tsx b/src/renderer/src/components/floating-terminal/FloatingTerminalPanelSurface.tsx index cccb6558352..9eab191f6d4 100644 --- a/src/renderer/src/components/floating-terminal/FloatingTerminalPanelSurface.tsx +++ b/src/renderer/src/components/floating-terminal/FloatingTerminalPanelSurface.tsx @@ -3,7 +3,7 @@ import { TabGroupSplitNodeTree } from '@/components/tab-group/TabGroupSplitNodeT import { WorkspaceTabDragLayer } from '@/components/tab-group/WorkspaceTabDragLayer' import { WorkspacePaneOverlayLayers } from '@/components/WorkspacePaneOverlayLayers' import { isTerminalImeInputContextRefreshing } from '@/components/terminal-pane/input/ime/terminal-ime-input-context-refresh' -import { buildDuplicatedBrowserTabOptions } from '@/lib/duplicate-browser-tab-options' +import { buildDuplicatedBrowserTabOptions } from '@/lib/browser/workspace/duplicate-browser-tab-options' import { FLOATING_TERMINAL_WORKTREE_ID } from '../../../../shared/constants' import { FloatingTerminalEmptyState } from './FloatingTerminalEmptyState' import { renderFloatingTerminalOrchestrationCard } from './FloatingTerminalOrchestrationCard' diff --git a/src/renderer/src/components/floating-terminal/floating-workspace-tab-creation.ts b/src/renderer/src/components/floating-terminal/floating-workspace-tab-creation.ts index 37009a22a4e..95e79de813c 100644 --- a/src/renderer/src/components/floating-terminal/floating-workspace-tab-creation.ts +++ b/src/renderer/src/components/floating-terminal/floating-workspace-tab-creation.ts @@ -2,11 +2,11 @@ import { FLOATING_TERMINAL_WORKTREE_ID } from '../../../../shared/constants' import { createUntitledMarkdownFileWithTemplateSelection } from '../../lib/editor/file-operations/create-untitled-markdown' import { getConnectionId } from '../../lib/workspace/ownership/connection-context' import { detectLanguage } from '../../../../shared/editor-language/editor-language-detect' -import type { AppState } from '@/store/types' import { focusTerminalTabSurface } from '../terminal-pane/input/focus/focus-terminal-tab-surface' import { createNonSecureContextUuid as createBrowserUuid } from '../../../../shared/non-secure-context-uuid' import { translate } from '@/i18n/i18n' -import { assertClientCreationActionAvailable } from '../../lib/client-creation-action-policy' +import { assertClientCreationActionAvailable } from '../../lib/workspace/creation/surface-policy/client-creation-action-policy' +import type { AppState } from '@/store/types' type FloatingWorkspaceTerminalStore = Pick diff --git a/src/renderer/src/components/floating-terminal/use-floating-terminal-create-actions.ts b/src/renderer/src/components/floating-terminal/use-floating-terminal-create-actions.ts index b69f668cf45..dd99ef0b024 100644 --- a/src/renderer/src/components/floating-terminal/use-floating-terminal-create-actions.ts +++ b/src/renderer/src/components/floating-terminal/use-floating-terminal-create-actions.ts @@ -3,7 +3,7 @@ import { toast } from 'sonner' import { resolveGroupTabFromVisibleId } from '@/components/tab-group/tab-group-visible-id' import { getConnectionId } from '@/lib/workspace/ownership/connection-context' import { createUntitledMarkdownFileWithTemplateSelection } from '@/lib/editor/file-operations/create-untitled-markdown' -import { ensureClientCreationActionAllowed } from '@/lib/client-creation-action-error' +import { ensureClientCreationActionAllowed } from '@/lib/workspace/creation/surface-policy/client-creation-action-error' import { openDocumentInFloatingWorkspace } from '@/components/floating-terminal/open-document-in-floating-workspace' import { extractIpcErrorMessage } from '@/runtime/errors/ipc-error' import { focusTerminalTabSurface } from '@/components/terminal-pane/input/focus/focus-terminal-tab-surface' diff --git a/src/renderer/src/components/floating-terminal/use-floating-terminal-panel-shortcuts.ts b/src/renderer/src/components/floating-terminal/use-floating-terminal-panel-shortcuts.ts index f4d6ce4e291..99a918ef649 100644 --- a/src/renderer/src/components/floating-terminal/use-floating-terminal-panel-shortcuts.ts +++ b/src/renderer/src/components/floating-terminal/use-floating-terminal-panel-shortcuts.ts @@ -1,6 +1,7 @@ -import { useCallback, useEffect, useRef, type KeyboardEvent as ReactKeyboardEvent } from 'react' +import { useCallback, useEffect, useRef } from 'react' +import type { KeyboardEvent as ReactKeyboardEvent } from 'react' import { isTerminalPaneCloseChord } from '@/components/terminal-pane/input/keyboard/terminal-shortcut-policy' -import { ensureClientCreationActionAllowed } from '@/lib/client-creation-action-error' +import { ensureClientCreationActionAllowed } from '@/lib/workspace/creation/surface-policy/client-creation-action-error' import { matchFloatingWorkspacePanelOwnedAction, matchFloatingWorkspacePanelShortcut @@ -10,13 +11,10 @@ import { getShortcutPlatform } from '@/lib/keyboard/shortcut-platform' import { requestTerminalTabRename } from '@/components/tab-bar/terminal-tab-rename-request' import { resolveTerminalAgentTabShortcut } from '@/components/terminal-agent-tab-shortcut' import { launchFloatingWorkspaceAgentShortcut } from '@/components/agent-tab-shortcut-launch' -import { useAppStore } from '@/store' +import { useAppStore } from '@/store/index' import { FLOATING_TERMINAL_WORKTREE_ID } from '../../../../shared/constants' -import { - keybindingMatchesAction, - type KeybindingContext, - type KeybindingMatchOptions -} from '../../../../shared/keybindings' +import { keybindingMatchesAction } from '../../../../shared/keybindings' +import type { KeybindingContext, KeybindingMatchOptions } from '../../../../shared/keybindings' import type { FloatingPanelShortcutInput, FloatingPanelShortcutResolution, diff --git a/src/renderer/src/components/floating-terminal/use-floating-terminal-panel-store-state.ts b/src/renderer/src/components/floating-terminal/use-floating-terminal-panel-store-state.ts index a167b0414fb..398d95877e1 100644 --- a/src/renderer/src/components/floating-terminal/use-floating-terminal-panel-store-state.ts +++ b/src/renderer/src/components/floating-terminal/use-floating-terminal-panel-store-state.ts @@ -1,5 +1,5 @@ -import { getClientCreationActionPolicy } from '@/lib/client-creation-action-policy' -import { useAppStore } from '@/store' +import { getClientCreationActionPolicy } from '@/lib/workspace/creation/surface-policy/client-creation-action-policy' +import { useAppStore } from '@/store/index' import { FLOATING_TERMINAL_WORKTREE_ID } from '../../../../shared/constants' import { selectFloatingTerminalPanelInputs } from './floating-terminal-panel-inputs' diff --git a/src/renderer/src/components/integrations/source-control/source-control-preflight-card-status.ts b/src/renderer/src/components/integrations/source-control/source-control-preflight-card-status.ts index 7db6312828a..692e2aa5d76 100644 --- a/src/renderer/src/components/integrations/source-control/source-control-preflight-card-status.ts +++ b/src/renderer/src/components/integrations/source-control/source-control-preflight-card-status.ts @@ -1,12 +1,12 @@ import { useState } from 'react' import { useMountedRef } from '@/hooks/useMountedRef' -import { getLocalPreflightContext } from '@/lib/local-preflight-context' -import { localPreflightContextKey } from '@/lib/local-preflight-context-key' +import { getLocalPreflightContext } from '@/runtime/hosts/preflight/local-preflight-context' +import { localPreflightContextKey } from '@/runtime/hosts/preflight/local-preflight-context-key' import { useAppStore } from '@/store/index' -import { - getPreflightIntegrationStatuses, - type PreflightIntegrationStatuses, - type PreflightRefreshProvider +import { getPreflightIntegrationStatuses } from './integrations-pane-status' +import type { + PreflightIntegrationStatuses, + PreflightRefreshProvider } from './integrations-pane-status' type CliStatus = { diff --git a/src/renderer/src/components/native-chat-recovery/NativeChatResumeOnRestartModal.tsx b/src/renderer/src/components/native-chat-recovery/NativeChatResumeOnRestartModal.tsx index 569fbb2d98e..24a8fd71521 100644 --- a/src/renderer/src/components/native-chat-recovery/NativeChatResumeOnRestartModal.tsx +++ b/src/renderer/src/components/native-chat-recovery/NativeChatResumeOnRestartModal.tsx @@ -4,32 +4,32 @@ import { Button } from '../ui/button' import { Checkbox } from '../ui/checkbox' import { Dialog, DialogContent, DialogFooter } from '../ui/dialog' import { useAppStore } from '../../store/index' -import { useTranslate, type Translate } from '@/i18n/use-translate' -import { activateAiVaultStructuredSession } from '@/lib/activate-ai-vault-structured-session' +import { useTranslate } from '@/i18n/use-translate' +import type { Translate } from '@/i18n/use-translate' +import { activateAiVaultStructuredSession } from '@/lib/agent-session/open/activate-ai-vault-structured-session' import { ResumeOnRestartGroups } from './tree/NativeChatResumeOnRestartGroups' import { ResumeTreeRow } from './tree/NativeChatResumeTreeRow' import { resumeFailureGuidance, - resumeFailureSelectable, - type ResumeFailureAction + resumeFailureSelectable } from './failures/native-chat-resume-failure-guidance' +import type { ResumeFailureAction } from './failures/native-chat-resume-failure-guidance' import { resumeSelectionState, - toggleResumeSelection, - type ResumeCandidate, - type ResumeFailure + toggleResumeSelection } from './tree/native-chat-resume-on-restart-grouping' +import type { ResumeCandidate, ResumeFailure } from './tree/native-chat-resume-on-restart-grouping' import { useNativeChatRestartOffer, useNativeChatRestartResuming, useNativeChatRestartRun } from './offers/native-chat-resume-on-restart-store' -import type { NativeChatRestartStore } from './offers/native-chat-restart-runtime-store' import { useResumeRunPanel } from './runs/NativeChatResumeRunPanel' import { resumeRunFailures } from './runs/native-chat-resume-run-view' import { NativeChatResumeAutoNote } from './dialogs/NativeChatResumeAutoNote' import { NativeChatRemoteResumeActions } from './dialogs/NativeChatRemoteResumeActions' import { moveInTree } from './tree/native-chat-resume-tree-keys' +import type { NativeChatRestartStore } from './offers/native-chat-restart-runtime-store' /** Resume reattaches and sends a continuation, never the original user prompt; disclose this before sending. Automatic preference skips the prompt but uses the same host safety checks. * The store owns runs across dialog closes. Closing snoozes; Dismiss all deletes durable offers. Row Retry/Dismiss keep the dialog open, and settled runs cannot close a user-reopened dialog. Unretryable failures stay outside Resume. */ diff --git a/src/renderer/src/components/native-chat-recovery/integration/native-chat-resume-bulk-progress.test.tsx b/src/renderer/src/components/native-chat-recovery/integration/native-chat-resume-bulk-progress.test.tsx deleted file mode 100644 index 577e63211ee..00000000000 --- a/src/renderer/src/components/native-chat-recovery/integration/native-chat-resume-bulk-progress.test.tsx +++ /dev/null @@ -1,150 +0,0 @@ -// @vitest-environment happy-dom -import { - createResumeModalFixture, - offered, - failure, - type RestartRpc, - type ResumeStatusStream -} from './native-chat-resume-modal.test-support' -import { act } from 'react' -import { expect, it, vi, type Mock } from 'vitest' -import { NativeChatResumeOnRestartModal } from '../NativeChatResumeRuntimeModal' - -import { NativeChatResumeStatusSegment } from '../../status-bar/NativeChatResumeStatusSegment' -import type { ResumeCandidate, ResumeFailure } from '../tree/native-chat-resume-on-restart-grouping' -import type { AgentSessionStatusSummary } from '../../../../../shared/agent-session/agent-session-wire' - -const rpc: Mock = vi.hoisted(() => vi.fn()) -const statusStream: ResumeStatusStream = vi.hoisted(() => ({ - emit: (_event: Parameters[0]) => {}, - snapshot: new Map() -})) -vi.mock('../../../runtime/native-chat/requests/structured-agent-session-call', () => ({ - callStructuredAgentSession: rpc -})) - -vi.mock('../../../runtime/native-chat/requests/structured-agent-session-subscriptions', () => ({ - subscribeStructuredAgentSessionStatus: async ( - _target: unknown, - emit: (event: Parameters[0]) => void - ) => { - statusStream.emit = emit - emit({ type: 'snapshot', sessions: [...statusStream.snapshot.values()] }) - return { unsubscribe: () => {} } - } -})) -vi.mock('@/lib/activate-ai-vault-structured-session', () => ({ - activateAiVaultStructuredSession: vi.fn(async () => true) -})) -vi.mock('sonner', async () => - (await import('./native-chat-resume-sonner-mock.test-support')).resumeSonnerMock() -) - -const { mount, button, offerIds, runStatus } = createResumeModalFixture(rpc, statusStream) - -function emitPhase( - sessionId: string, - phase?: NonNullable['phase'] -): void { - statusStream.emit({ - type: 'status', - session: { - sessionId, - workspaceId: 'workspace', - agent: 'codex', - status: 'idle', - latestPrompt: '', - updatedAt: 1, - ...(phase ? { restartResume: { phase } } : {}) - } - }) -} - -it('keeps the run in flight after every feed verdict until the fallback list is published', async () => { - const answer = Promise.withResolvers<{ - continued: { sessionId: string; outcome: 'continued' }[] - }>() - const listing = Promise.withResolvers<{ sessions: ResumeCandidate[]; failed: ResumeFailure[] }>() - let reads = 0 - rpc.mockImplementation(async (_target, method) => - method === 'agentSession.restartContinue' - ? answer.promise - : reads++ === 0 - ? { sessions: offered, failed: [] } - : listing.promise - ) - await mount( - <> - - - - ) - await act(async () => button('Resume 2 chats').click()) - await act(async () => button('Resuming chats 0/2').click()) - await act(async () => { - for (const { sessionId } of offered) { - statusStream.emit({ - type: 'status', - session: { - sessionId, - workspaceId: 'workspace', - agent: 'codex', - status: 'idle', - latestPrompt: '', - updatedAt: 1, - restartResume: { phase: 'continued' } - } - }) - } - answer.resolve({ - continued: offered.map(({ sessionId }) => ({ sessionId, outcome: 'continued' })) - }) - }) - expect(button('Resuming chats 2/2')).toBeTruthy() - await act(async () => offered.forEach(({ sessionId }) => emitPhase(sessionId))) - expect(button('Resuming chats 2/2')).toBeTruthy() - expect(runStatus('Prompt a')).toBe('Prompt a: Resumed') - expect(button('Resuming…').disabled).toBe(true) - expect(document.body.textContent).not.toContain('chats to resume') - await act(async () => listing.resolve({ sessions: [], failed: [] })) - expect(offerIds()).toEqual([]) - expect(button('Done').disabled).toBe(false) - expect(document.body.textContent).not.toContain('Resuming chats') -}) - -it('retains success and refusal frames through cleanup before a delayed bulk reply', async () => { - const reply = Promise.withResolvers() - rpc.mockImplementation(async (_target, method) => - method === 'agentSession.restartResumable' ? { sessions: offered, failed: [] } : reply.promise - ) - await mount( - <> - - - - ) - await act(async () => button('Resume 2 chats').click()) - // Verdicts and cleanup can arrive together before React gets a render. - await act(async () => { - emitPhase('a', 'continued') - emitPhase('b', 'refused') - emitPhase('a') - emitPhase('b') - }) - expect(button('Resuming chats 2/2')).toBeTruthy() - await act(async () => button('Resuming chats 2/2').click()) - expect(runStatus('Prompt a')).toBe('Prompt a: Resumed') - expect(runStatus('Prompt b')).toBe('Prompt b: Couldn’t resume') - expect(document.querySelector('[role="dialog"]')?.textContent).toContain('Need you1') - await act(async () => - reply.resolve({ - sessions: [], - failed: [failure('b')], - continued: [ - { sessionId: 'a', outcome: 'continued' }, - { sessionId: 'b', outcome: 'refused' } - ] - }) - ) - expect(document.querySelector('[role="dialog"]')?.textContent).toContain('Resumed 1 of 2 chats') -}) diff --git a/src/renderer/src/components/native-chat/appearance/native-chat-appearance-style.ts b/src/renderer/src/components/native-chat/appearance/native-chat-appearance-style.ts index 878ca97a5be..d01c4028497 100644 --- a/src/renderer/src/components/native-chat/appearance/native-chat-appearance-style.ts +++ b/src/renderer/src/components/native-chat/appearance/native-chat-appearance-style.ts @@ -1,17 +1,18 @@ import './native-chat-appearance.css' -import { useMemo, type CSSProperties } from 'react' +import { useMemo } from 'react' +import type { CSSProperties } from 'react' import { useShallow } from 'zustand/react/shallow' -import type { GlobalSettings } from '../../../../../shared/global-settings-types' import { resolveNativeChatAppearanceSettings } from '../../../../../shared/native-chat/native-chat-appearance-settings' import { resolveConfiguredTerminalColors } from '../../../../../shared/terminal-themes/terminal-theme-selection' import { MATCH_TERMINAL_APP_THEME } from '../../../../../shared/plugin-theme-settings' import { buildFontFamily } from '../../../../../shared/monospace-font-family' import { buildAppFontFamily } from '@/app-shell/appearance/app-font-family' import { resolveEditorFontStack } from '../../../../../shared/editor/editor-typography' -import { getSystemPrefersDark } from '@/lib/terminal-theme' +import { getSystemPrefersDark } from '@/lib/terminal/appearance/terminal-theme' import { isTerminalBackgroundLight } from '../../../../../shared/terminal-themes/terminal-title-contrast' import { useSystemPrefersDark } from '../../../hooks/theme/use-system-prefers-dark' import { terminalChatSelectionMix } from '@/app-shell/appearance/chat-selection-mix' +import type { GlobalSettings } from '../../../../../shared/global-settings-types' export const NATIVE_CHAT_APPEARANCE_ROOT_CLASS = 'native-chat-appearance bg-chat-canvas' // Bottom padding clears 20px control overhang; rail padding also covers its 34px overlay on macOS without scrollbar gutters. diff --git a/src/renderer/src/components/native-chat/attachments/intake/use-native-chat-external-attachments.ts b/src/renderer/src/components/native-chat/attachments/intake/use-native-chat-external-attachments.ts index dfe8717a953..a9ec94c2539 100644 --- a/src/renderer/src/components/native-chat/attachments/intake/use-native-chat-external-attachments.ts +++ b/src/renderer/src/components/native-chat/attachments/intake/use-native-chat-external-attachments.ts @@ -1,13 +1,15 @@ import { captureNativeChatEditDraftDestination } from '../../drafts/native-chat-composer-draft-memory' import { useCallback, useLayoutEffect, useRef } from 'react' -import { useAppStore } from '@/store' +import { useAppStore } from '@/store/index' import { NATIVE_FILE_DROP_MAX_PATHS } from '../../../../../../shared/file-import/native-file-drop' import { isSameComposerWorkspace, - nativeChatAttachmentOwnerUnchanged, - type ComposerWorkspace, - type NativeChatAttachmentFocusOptions, - type NativeChatResolvedPathOptions + nativeChatAttachmentOwnerUnchanged +} from '../uploads/native-chat-resolved-path-ownership' +import type { + ComposerWorkspace, + NativeChatAttachmentFocusOptions, + NativeChatResolvedPathOptions } from '../uploads/native-chat-resolved-path-ownership' import { nativeChatAttachmentOwnerChangedNotice, @@ -18,21 +20,24 @@ import { import { resolveNativeChatAttachmentOwner, resolveNativeChatAttachmentOwnerForWorktree, - resolveNativeChatRuntimeSessionAttachmentOwner, - type NativeChatAttachmentOwner, - type NativeChatStructuredAttachmentSession + resolveNativeChatRuntimeSessionAttachmentOwner +} from '../uploads/native-chat-attachment-owner' +import type { + NativeChatAttachmentOwner, + NativeChatStructuredAttachmentSession } from '../uploads/native-chat-attachment-owner' - import { attachNativeChatSessionAttachmentPaths, - reserveNativeChatAttachmentChips, - type NativeChatPendingAttachmentChips, - type NativeChatReservedAttachment + reserveNativeChatAttachmentChips +} from './native-chat-session-attachment-drop' +import type { + NativeChatPendingAttachmentChips, + NativeChatReservedAttachment } from './native-chat-session-attachment-drop' import { releaseBrowserAttachmentFiles } from '@/lib/files/drop/browser-attachment-files' import { attachNativeChatLocalAttachmentPaths } from './native-chat-local-attachment-drop' import { useMountedRef } from '@/hooks/useMountedRef' -import { chatWorkspaceByTabId as findTerminalTabWorktreeId } from '../../../../lib/structured-chat-tab-index' +import { chatWorkspaceByTabId as findTerminalTabWorktreeId } from '../../../../lib/agent-session/tab-identity/structured-chat-tab-index' import type { CapturedNativeChatDrop } from './native-chat-pane-file-drop' export type UseNativeChatExternalAttachmentsArgs = { diff --git a/src/renderer/src/components/native-chat/attachments/intake/use-native-chat-workspace-file-drop.ts b/src/renderer/src/components/native-chat/attachments/intake/use-native-chat-workspace-file-drop.ts index a5c1f3ea13c..663bb35066b 100644 --- a/src/renderer/src/components/native-chat/attachments/intake/use-native-chat-workspace-file-drop.ts +++ b/src/renderer/src/components/native-chat/attachments/intake/use-native-chat-workspace-file-drop.ts @@ -1,5 +1,6 @@ -import { useCallback, useLayoutEffect, useRef, type DragEventHandler } from 'react' -import { useAppStore } from '@/store' +import { useCallback, useLayoutEffect, useRef } from 'react' +import type { DragEventHandler } from 'react' +import { useAppStore } from '@/store/index' import { getWorkspaceFileDragRejectionMessage, hasWorkspaceFileDragType, @@ -12,13 +13,13 @@ import { resolveNativeChatAttachmentHost } from '../uploads/native-chat-attachment-owner' import { nativeChatWorktreeNotReadyNotice } from './native-chat-attachment-notices' -import { chatWorkspaceByTabId as findTerminalTabWorktreeId } from '../../../../lib/structured-chat-tab-index' +import { chatWorkspaceByTabId as findTerminalTabWorktreeId } from '../../../../lib/agent-session/tab-identity/structured-chat-tab-index' import { parseExecutionHostId } from '../../../../../../shared/execution-host' import { nativeChatAttachmentOwnerUnchanged, - nativeChatWorkspaceAttachmentMismatchNotice, - type NativeChatResolvedPathOptions + nativeChatWorkspaceAttachmentMismatchNotice } from '../uploads/native-chat-resolved-path-ownership' +import type { NativeChatResolvedPathOptions } from '../uploads/native-chat-resolved-path-ownership' export type NativeChatResolvedPathSink = ( paths: string[], diff --git a/src/renderer/src/components/native-chat/attachments/uploads/native-chat-attachment-owner.ts b/src/renderer/src/components/native-chat/attachments/uploads/native-chat-attachment-owner.ts index bd841d66836..34c081b7412 100644 --- a/src/renderer/src/components/native-chat/attachments/uploads/native-chat-attachment-owner.ts +++ b/src/renderer/src/components/native-chat/attachments/uploads/native-chat-attachment-owner.ts @@ -1,18 +1,17 @@ -import type { AppState } from '../../../../store/types' -import { chatWorkspaceByTabId as findTerminalTabWorktreeId } from '../../../../lib/structured-chat-tab-index' - +import { chatWorkspaceByTabId as findTerminalTabWorktreeId } from '../../../../lib/agent-session/tab-identity/structured-chat-tab-index' import { FLOATING_TERMINAL_WORKTREE_ID } from '../../../../../../shared/constants' import { getKnownExecutionHostIdForWorktree } from '../../../../lib/workspace/ownership/worktree-runtime-owner' import { runtimeEnvironmentIdForWorkspaceOwner } from '../../../../lib/workspace/ownership/resolve-owner' import { getConnectionIdFromState } from '../../../../lib/workspace/ownership/connection-owner-resolution' import { - type ExecutionHostId, toRuntimeExecutionHostId, getConnectionExecutionHostId, parseExecutionHostId } from '../../../../../../shared/execution-host' +import type { ExecutionHostId } from '../../../../../../shared/execution-host' import { findKnownWorktreeById } from '../../../../store/slices/worktrees/listing/detected-worktree-meta' import { getRuntimeEnvironmentRevision } from '../../../../runtime/rpc/environment-revisions/runtime-environment-revision' +import type { AppState } from '../../../../store/types' /** The paired host validates every stored attachment path when admitting a structured send. */ export type NativeChatRuntimeSessionAttachmentOwner = { diff --git a/src/renderer/src/components/native-chat/composer/controls/native-chat-composer-workspace.ts b/src/renderer/src/components/native-chat/composer/controls/native-chat-composer-workspace.ts index c0c904f9ad1..ff2855bd521 100644 --- a/src/renderer/src/components/native-chat/composer/controls/native-chat-composer-workspace.ts +++ b/src/renderer/src/components/native-chat/composer/controls/native-chat-composer-workspace.ts @@ -1,11 +1,9 @@ -import type { AppState } from '@/store/types' -import { workspaceTabs } from '@/lib/structured-chat-tab-index' +import { workspaceTabs } from '@/lib/agent-session/tab-identity/structured-chat-tab-index' import { selectExecutionHostDisplayLabel } from '@/runtime/hosts/display/execution-host-display-label' import { findIndexedRepoOwnerForHost } from '@/lib/workspace/ownership/repo-owner-index' -import { getWslDistroFromPath } from '@/lib/local-preflight-context' +import { getWslDistroFromPath } from '@/runtime/hosts/preflight/local-preflight-context' import { selectWslHostDistro } from '@/components/wsl-host-mark/WslHostMark' import { resolvePaneWslDistro } from '@/components/terminal-pane/host-state/terminal-pane-wsl-distro' -import type { Repo } from '../../../../../../shared/repo-types' import { getHostSettingOverride } from '../../../../../../shared/host-setting-overrides' import { isFolderRepo } from '../../../../../../shared/repo-kind' import { parseWorkspaceKey } from '../../../../../../shared/workspace-scope' @@ -19,9 +17,9 @@ import { import { isUnresolvedOwnerHostId, parseExecutionHostId, - toRuntimeExecutionHostId, - type ExecutionHostId + toRuntimeExecutionHostId } from '../../../../../../shared/execution-host' +import type { ExecutionHostId } from '../../../../../../shared/execution-host' import { floatingWorkspaceToWorktree, isFloatingWorkspaceId @@ -29,6 +27,8 @@ import { import { createNativeChatTabOwnerSelector } from '../../pane/ownership/native-chat-tab-owner' import { FILE_LINK_CONTEXT_INPUT_KEYS } from '../../links/actions/native-chat-file-link-context' import { resolveNativeChatTabDirectory } from '../../pane/routing/native-chat-tab-directory' +import type { AppState } from '@/store/types' +import type { Repo } from '../../../../../../shared/repo-types' import type { NativeChatStructuredComposerTransport } from '../submit/native-chat-structured-composer-transport' const OWNER_CONTEXT_INPUT_KEYS = FILE_LINK_CONTEXT_INPUT_KEYS.filter( diff --git a/src/renderer/src/components/native-chat/composer/pickers/native-chat-skill-discovery-context.ts b/src/renderer/src/components/native-chat/composer/pickers/native-chat-skill-discovery-context.ts index 5778b1b25f1..57360aa7609 100644 --- a/src/renderer/src/components/native-chat/composer/pickers/native-chat-skill-discovery-context.ts +++ b/src/renderer/src/components/native-chat/composer/pickers/native-chat-skill-discovery-context.ts @@ -1,21 +1,21 @@ -import type { AppState } from '../../../../store/types' -import type { SkillDiscoveryTarget } from '../../../../../../shared/skills' import { parseExecutionHostId } from '../../../../../../shared/execution-host' -import type { RuntimeClientTarget } from '../../../../../../shared/runtime-client-target' import { getExecutionHostIdForWorktree } from '@/lib/workspace/ownership/worktree-runtime-owner' import { runtimeEnvironmentIdForWorkspaceOwner } from '@/lib/workspace/ownership/resolve-owner' -import { getLocalProjectExecutionRuntimeContext } from '@/lib/local-preflight-context' +import { getLocalProjectExecutionRuntimeContext } from '@/runtime/hosts/preflight/local-preflight-context' import { resolveWorkspaceDirectory } from '@/lib/workspace/paths/workspace-directory' import { resolveNativeChatTabDirectory, - resolveNativeChatTabDirectoryResolution, - type NativeChatTabDirectoryState + resolveNativeChatTabDirectoryResolution } from '../../pane/routing/native-chat-tab-directory' +import type { NativeChatTabDirectoryState } from '../../pane/routing/native-chat-tab-directory' import { selectDetectedWorktreesByRepo, selectFolderWorkspaces, selectWorktreesByRepo } from '@/store/workspaces/catalog/workspace-record-fields' +import type { AppState } from '../../../../store/types' +import type { SkillDiscoveryTarget } from '../../../../../../shared/skills' +import type { RuntimeClientTarget } from '../../../../../../shared/runtime-client-target' export type NativeChatSkillStateInputs = Pick< AppState, diff --git a/src/renderer/src/components/native-chat/composer/pickers/use-native-chat-mention-files.ts b/src/renderer/src/components/native-chat/composer/pickers/use-native-chat-mention-files.ts index 45c1552182c..b300a41b5aa 100644 --- a/src/renderer/src/components/native-chat/composer/pickers/use-native-chat-mention-files.ts +++ b/src/renderer/src/components/native-chat/composer/pickers/use-native-chat-mention-files.ts @@ -1,9 +1,9 @@ import { useMemo } from 'react' -import { useAppStore } from '@/store' +import { useAppStore } from '@/store/index' import { useRuntimeFileListForWorktree } from '@/components/quick-open-file-list' import { rankQuickOpenFilesWithHistory } from '@/components/quick-open-history-ranking' import { useQuickOpenHistory } from '@/lib/files/search/quick-open-file-history' -import { chatWorkspaceByTabId as findTerminalTabWorktreeId } from '../../../../lib/structured-chat-tab-index' +import { chatWorkspaceByTabId as findTerminalTabWorktreeId } from '../../../../lib/agent-session/tab-identity/structured-chat-tab-index' import { useFileListWorktree } from '@/store/workspaces/selection/use-selected-worktree' const MENTION_FILE_LIMIT = 20 diff --git a/src/renderer/src/components/native-chat/conversation/slots/NativeChatMessageList.opening-send.test.tsx b/src/renderer/src/components/native-chat/conversation/slots/NativeChatMessageList.opening-send.test.tsx deleted file mode 100644 index 05bc7bcf3ae..00000000000 --- a/src/renderer/src/components/native-chat/conversation/slots/NativeChatMessageList.opening-send.test.tsx +++ /dev/null @@ -1,416 +0,0 @@ -// @vitest-environment happy-dom -// Queued sends wait after the opening turn’s live status until actual handover, including across Stop. - -import '@testing-library/jest-dom/vitest' -import { cleanup, screen } from '@testing-library/react' -import { render } from '../../messages/actions/native-chat-tooltip-test-harness' -import { afterAll, afterEach, beforeAll, describe, expect, it, vi } from 'vitest' - -// Why: these fixtures have neither inline visual owners nor sender navigation. -const unusedChatLeaves = vi.hoisted(() => ({ - inlineVisual: vi.fn(() => { - throw new Error('Unexpected inline visual in transcript fixture') - }), - openSender: vi.fn(() => { - throw new Error('Unexpected sender navigation in transcript fixture') - }) -})) -vi.mock('../../media/visuals/NativeChatInlineVisual', () => ({ - NativeChatInlineVisual: unusedChatLeaves.inlineVisual -})) -vi.mock('@/lib/open-agent-message-sender', () => ({ - openAgentMessageSender: unusedChatLeaves.openSender -})) -import { agentSessionFailureFact } from '../../../../../../shared/agent-session/failures/agent-session-failure' -import { agentSessionFailureWords } from '../../../../../../shared/agent-session/failures/agent-session-failure-words' -import { agentJournalSubmissionKey } from '../../../../../../shared/agent-session/journal/agent-session-journal-item-key' -import type { - AgentJournalItemBody, - AgentJournalRenderItem, - AgentJournalSubmission -} from '../../../../../../shared/agent-session/journal/agent-session-journal-types' -import type { AgentJournalTurnScope } from '../../../../../../shared/agent-session/journal/agent-session-journal-turn-scope' -import { - projectStructuredAgentSessionMessages, - type StructuredAgentSessionOptimisticMessage -} from '../../../../../../shared/agent-session/view/structured-agent-session-message-projection' -import { selectStructuredAgentSettledTurns } from '../../../../../../shared/agent-session/view/structured-agent-session-turn-timing' -import { NativeChatMessageList } from '../../NativeChatMessageList' -import { installNativeChatMessageListTestViewport } from '../../viewport/virtualization/native-chat-message-list-test-viewport' -import { DISPATCH_REJECTED_CANCELLED } from '../../../../../../shared/agent-session/requests/structured-agent-session-dispatch-rejection' - -describe('a message sent while the turn ahead is still opening', () => { - let restoreViewport = (): void => {} - beforeAll(() => { - restoreViewport = installNativeChatMessageListTestViewport() - }) - afterAll(() => restoreViewport()) - afterEach(cleanup) - - const THREAD: AgentJournalTurnScope = { kind: 'thread' } - const NOW = 100_000 - - function item( - itemId: string, - sequence: number, - body: AgentJournalItemBody - ): AgentJournalRenderItem { - return { itemId, revision: 0, sequence, observedAt: sequence, body, turnScope: THREAD } - } - - const userMessage = (id: string, sequence: number, text: string) => - item(agentJournalSubmissionKey(id), sequence, { - kind: 'message', - role: 'user', - blocks: [{ type: 'text', text }] - }) - - function submission( - clientMessageId: string, - overrides: Partial = {} - ): AgentJournalSubmission { - return { - clientMessageId, - fence: 1, - payloadFingerprint: clientMessageId, - dispatchState: 'pending', - providerItemId: null, - reason: null, - submittedAt: NOW, - resolvedAt: null, - handoverRecorded: true, - ...overrides - } - } - - /** A finished warm-up, then "first" handed over (row 5) with no turn record yet: its turn opens. */ - function openingFirst(): { - items: AgentJournalRenderItem[] - submissions: AgentJournalSubmission[] - } { - return { - items: [ - userMessage('warm', 1, 'warm up'), - item('turn-warm', 2, { - kind: 'turn', - turnId: 'turn-warm', - state: 'completed', - outcome: 'success', - userItemId: agentJournalSubmissionKey('warm'), - startedAt: 1_000, - completedAt: 2_000 - }), - userMessage('first', 5, 'first') - ], - submissions: [ - submission('warm', { dispatchState: 'accepted', resolvedAt: 2_000 }), - submission('first', { acceptedSequence: 3, handedOverAt: NOW }) - ] - } - } - - /** The first send's turn record, written as its turn opens; Codex names its own provider key. */ - const firstTurnOpened = (sequence: number) => - item('turn-first', sequence, { - kind: 'turn', - turnId: 'turn-first', - state: 'running', - userItemId: FIRST_TURN_PROVIDER_KEY, - startedAt: NOW - }) - const FIRST_TURN_PROVIDER_KEY = 'codex:thread:turn-first:0' - const inFirstTurn: AgentJournalTurnScope = { kind: 'turn', turnItemId: 'turn-first' } - - /** This client's own send the host has not recorded yet: its lane still runs the first handover. */ - const unrecorded = ( - clientMessageId: string, - text: string - ): StructuredAgentSessionOptimisticMessage => ({ - clientMessageId, - body: { kind: 'message', role: 'user', blocks: [{ type: 'text', text }] }, - queuedAt: NOW + 100 - }) - - function frame( - items: AgentJournalRenderItem[], - submissions: AgentJournalSubmission[], - optimistic: StructuredAgentSessionOptimisticMessage[], - stopping = false - ): React.JSX.Element { - return ( - - ) - } - - function follows(later: HTMLElement, earlier: HTMLElement): boolean { - return Boolean(earlier.compareDocumentPosition(later) & Node.DOCUMENT_POSITION_FOLLOWING) - } - - const liveStatus = () => screen.getByText(/^Working for/) - const liveActivity = () => screen.getByText(/^(Working|Stopping)…$/) - - /** `text` is drawn after the live turn: its status and its activity line. */ - function waitsAtTheTail(text: string): void { - expect(follows(screen.getByText(text), liveStatus())).toBe(true) - expect(follows(screen.getByText(text), liveActivity())).toBe(true) - } - - // Stop withdraws B from the queue; its settled row stays after the live turn’s status and above its activity. - it('stays after the live turn when a Stop takes it back, with no frame above the live status', () => { - const { items, submissions } = openingFirst() - const view = render(frame(items, submissions, [unrecorded('b', 'B')])) - waitsAtTheTail('B') - - // Pressed: Stopping, with B now recorded and queued behind the first send. - const queued = [...items, userMessage('b', 4, 'B')] - view.rerender( - frame(queued, [...submissions, submission('b', { acceptedSequence: 4 })], [], true) - ) - waitsAtTheTail('B') - - const withdrawn = submission('b', { - acceptedSequence: 4, - dispatchState: 'rejected', - resolvedAt: NOW + 200, - ...agentSessionFailureWords(agentSessionFailureFact('cancelled'), { surface: 'rejection' }) - }) - view.rerender(frame(queued, [...submissions, withdrawn], [], true)) - const stopRow = screen.getByText('Stopped manually') - expect(follows(screen.getByText('B'), liveStatus())).toBe(true) - expect(follows(stopRow, screen.getByText('B'))).toBe(true) - expect(follows(liveActivity(), stopRow)).toBe(true) - }) - - /** Check each commit keeps second at its handover position and the live status under first. */ - function walkTurnOpening( - steps: [ - AgentJournalRenderItem[], - AgentJournalSubmission[], - StructuredAgentSessionOptimisticMessage[] - ][] - ): void { - const view = render(
) - for (const step of steps) { - view.rerender(frame(...step)) - expect(follows(liveStatus(), screen.getByText('first'))).toBe(true) - expect(follows(screen.getByText('second'), liveStatus())).toBe(true) - expect(follows(liveActivity(), screen.getByText('second'))).toBe(true) - } - } - - function turnOpening() { - const { items, submissions } = openingFirst() - const [warm, first] = submissions - if (!warm || !first) { - throw new Error('expected the warm-up and the first send') - } - const opened = [...items, firstTurnOpened(6)] - return { - submissions, - warm, - first, - opened, - // Handed over as a steer once the turn opened (row 8). - steered: [...opened, { ...userMessage('second', 8, 'second'), turnScope: inFirstTurn }], - echoed: (sent: AgentJournalSubmission): AgentJournalSubmission => ({ - ...sent, - dispatchState: 'accepted', - providerItemId: FIRST_TURN_PROVIDER_KEY, - resolvedAt: NOW + 20 - }) - } - } - - it('draws it where it lands at every step of the turn opening, even with the steer echoed first', () => { - const { submissions, warm, first, opened, steered, echoed } = turnOpening() - const handedOver = submission('second', { acceptedSequence: 7, handedOverAt: NOW + 10 }) - walkTurnOpening([ - // The turn record is in; the host has not recorded "second" yet. - [opened, submissions, [unrecorded('second', 'second')]], - // Recorded after the turn record, not yet handed over. - [ - [...opened, userMessage('second', 7, 'second')], - [...submissions, submission('second', { acceptedSequence: 7 })], - [] - ], - [steered, [...submissions, handedOver], []], - // Codex echoes the steer before the send that opened the turn, then that send. - [steered, [warm, first, echoed(handedOver)], []], - [steered, [warm, echoed(first), echoed(handedOver)], []] - ]) - }) - - // Two messages queued behind /compact, or sent while Stopping: "second" is accepted above the - // first send's handover, and the first send's turn record lands before "second" is handed over. - it('draws it where it lands at every step when it was accepted above the first send', () => { - const { submissions, warm, first, opened, steered, echoed } = turnOpening() - const [warmUp, warmTurn, firstRow, turnRecord] = opened - if (!warmUp || !warmTurn || !firstRow || !turnRecord) { - throw new Error('expected the warm-up, the first send and its turn record') - } - const queuedAbove = [warmUp, warmTurn, userMessage('second', 4, 'second'), firstRow, turnRecord] - const queued = submission('second', { acceptedSequence: 4 }) - const handedOver = { ...queued, handedOverAt: NOW + 10 } - walkTurnOpening([ - [queuedAbove, [...submissions, queued], []], - // The first send echoes while "second" is still queued. - [queuedAbove, [warm, echoed(first), queued], []], - [steered, [...submissions, handedOver], []], - [steered, [warm, first, echoed(handedOver)], []], - [steered, [warm, echoed(first), echoed(handedOver)], []] - ]) - }) -}) - -describe('a send a Stop took back before the agent started it', () => { - let restoreViewport = (): void => {} - beforeAll(() => { - restoreViewport = installNativeChatMessageListTestViewport() - }) - afterAll(() => restoreViewport()) - afterEach(cleanup) - - const STOP_ROW = 'Stopped manually' - const THREAD: AgentJournalTurnScope = { kind: 'thread' } - let sequence = 0 - - function item( - itemId: string, - body: AgentJournalItemBody, - turnScope: AgentJournalTurnScope = THREAD - ): AgentJournalRenderItem { - sequence += 1 - return { itemId, revision: 0, sequence, observedAt: sequence, body, turnScope } - } - - const sent = (id: string, text: string) => - item(agentJournalSubmissionKey(id), { - kind: 'message', - role: 'user', - blocks: [{ type: 'text', text }] - }) - - function turn( - itemId: string, - userId: string, - seconds: number, - end: { state: 'completed' | 'interrupted'; outcome: 'success' | 'cancellation' } - ) { - return item(itemId, { - kind: 'turn', - turnId: itemId, - ...end, - userItemId: agentJournalSubmissionKey(userId), - startedAt: 1_000, - completedAt: 1_000 + seconds * 1_000 - }) - } - - function warmUp(): AgentJournalRenderItem[] { - return [ - sent('warm-up', 'warm up'), - turn('t1', 'warm-up', 3, { state: 'completed', outcome: 'success' }), - item( - 't1-answer', - { kind: 'message', role: 'assistant', blocks: [{ type: 'text', text: 'Warmed up.' }] }, - { kind: 'turn', turnItemId: 't1' } - ) - ] - } - - function submission( - clientMessageId: string, - overrides: Partial = {} - ): AgentJournalSubmission { - return { - clientMessageId, - fence: 1, - payloadFingerprint: clientMessageId, - dispatchState: 'accepted', - providerItemId: null, - reason: null, - submittedAt: 1, - resolvedAt: 2, - ...overrides - } - } - - const stopped = (id: string, overrides: Partial = {}) => - submission(id, { dispatchState: 'rejected', reason: DISPATCH_REJECTED_CANCELLED, ...overrides }) - - function journalList( - items: AgentJournalRenderItem[], - submissions: AgentJournalSubmission[], - live: { isWorking: boolean; workingStartedAt: number | null } = { - isWorking: false, - workingStartedAt: null - } - ): React.JSX.Element { - return ( - - ) - } - - function follows(later: HTMLElement, earlier: HTMLElement): boolean { - return Boolean(earlier.compareDocumentPosition(later) & Node.DOCUMENT_POSITION_FOLLOWING) - } - - it('keeps no clock it showed while the send waited on its turn', () => { - const items = [...warmUp(), sent('never-ran', 'look around')] - const { rerender } = render( - journalList( - items, - [submission('warm-up'), submission('never-ran', { dispatchState: 'pending' })], - { - isWorking: true, - workingStartedAt: Date.now() - 5_000 - } - ) - ) - expect(screen.getByText('Working for 5s')).toBeInTheDocument() - - rerender(journalList(items, [submission('warm-up'), stopped('never-ran')])) - - expect(screen.getAllByText(/^(Worked|Working) for/).map((node) => node.textContent)).toEqual([ - 'Worked for 3s' - ]) - expect(follows(screen.getByText(STOP_ROW), screen.getByText('look around'))).toBe(true) - }) -}) diff --git a/src/renderer/src/components/native-chat/conversation/slots/NativeChatMessageList.queued-turn-order.test.tsx b/src/renderer/src/components/native-chat/conversation/slots/NativeChatMessageList.queued-turn-order.test.tsx deleted file mode 100644 index ca097e112b9..00000000000 --- a/src/renderer/src/components/native-chat/conversation/slots/NativeChatMessageList.queued-turn-order.test.tsx +++ /dev/null @@ -1,163 +0,0 @@ -// @vitest-environment happy-dom - -import '@testing-library/jest-dom/vitest' - -import { cleanup, screen } from '@testing-library/react' -import { render } from '../../messages/actions/native-chat-tooltip-test-harness' -import { afterAll, afterEach, beforeAll, describe, expect, it, vi } from 'vitest' - -// Why: these fixtures have neither inline visual owners nor sender navigation. -const unusedChatLeaves = vi.hoisted(() => ({ - inlineVisual: vi.fn(() => { - throw new Error('Unexpected inline visual in transcript fixture') - }), - openSender: vi.fn(() => { - throw new Error('Unexpected sender navigation in transcript fixture') - }) -})) -vi.mock('../../media/visuals/NativeChatInlineVisual', () => ({ - NativeChatInlineVisual: unusedChatLeaves.inlineVisual -})) -vi.mock('@/lib/open-agent-message-sender', () => ({ - openAgentMessageSender: unusedChatLeaves.openSender -})) -import type { - AgentJournalItemBody, - AgentJournalRenderItem -} from '../../../../../../shared/agent-session/journal/agent-session-journal-types' -import type { AgentJournalTurnScope } from '../../../../../../shared/agent-session/journal/agent-session-journal-turn-scope' -import type { NativeChatMessage } from '../../../../../../shared/native-chat/native-chat-types' -import type { NativeChatLiveSession } from '../../session/terminal/read/native-chat-live-session-contract' -import { NativeChatMessageList } from '../../NativeChatMessageList' -import { installNativeChatMessageListTestViewport } from '../../viewport/virtualization/native-chat-message-list-test-viewport' - -let restoreViewport = (): void => {} -beforeAll(() => { - restoreViewport = installNativeChatMessageListTestViewport() -}) -afterAll(() => restoreViewport()) -afterEach(cleanup) - -const text = ( - id: string, - role: NativeChatMessage['role'], - body: string, - timestamp: number -): NativeChatMessage => ({ - id, - role, - blocks: [{ type: 'text', text: body }], - timestamp, - source: 'transcript' -}) -const toolRun = (id: string, timestamp: number): NativeChatMessage => ({ - id, - role: 'assistant', - blocks: [{ type: 'tool-call', name: 'Bash', input: { command: 'sleep 5' }, state: 'completed' }], - timestamp, - source: 'transcript' -}) - -// The journal records B mid-turn before A’s remaining output; B’s own turn opens after A ends. -const messages = [ - text('user-a', 'user', 'Run the first job', 1), - toolRun('a-tool-1', 2), - text('user-b', 'user', 'Then run the second job', 3), - toolRun('a-tool-2', 4), - text('a-answer', 'assistant', 'FIRST DONE', 5), - text('b-answer', 'assistant', 'SECOND DONE', 6) -] - -/** With `statesScope` false the rows carry no turn scope, as a host older than turn scopes writes. */ -function journal(bState: 'running' | 'completed', statesScope: boolean): AgentJournalRenderItem[] { - const thread: AgentJournalTurnScope = { kind: 'thread' } - const inTurn = (turnItemId: string): AgentJournalTurnScope => ({ kind: 'turn', turnItemId }) - const row = ( - itemId: string, - body: AgentJournalItemBody, - turnScope: AgentJournalTurnScope, - sequence: number - ): AgentJournalRenderItem => ({ - itemId, - revision: 0, - sequence, - observedAt: sequence, - body, - ...(statesScope ? { turnScope } : {}) - }) - const said = (role: 'user' | 'assistant'): AgentJournalItemBody => ({ - kind: 'message', - role, - blocks: [] - }) - return [ - row('user-a', said('user'), thread, 1), - row( - 'turn-a', - { kind: 'turn', turnId: 'turn-a', state: 'completed', userItemId: 'user-a' }, - thread, - 2 - ), - row('a-tool-1', said('assistant'), inTurn('turn-a'), 3), - // Handed over while A runs, so the host scopes it to A's turn until its own opens. - row('user-b', said('user'), inTurn('turn-a'), 4), - row('a-tool-2', said('assistant'), inTurn('turn-a'), 5), - row('a-answer', said('assistant'), inTurn('turn-a'), 6), - row( - 'turn-b', - { kind: 'turn', turnId: 'turn-b', state: bState, userItemId: 'user-b' }, - thread, - 7 - ), - row('b-answer', said('assistant'), inTurn('turn-b'), 8) - ] -} - -const session = (status: NativeChatLiveSession['status']): NativeChatLiveSession => ({ - messages, - status, - sessionId: 'session-1', - agent: 'claude', - hasMore: false, - loadingEarlier: false, - olderHistoryGeneration: 0, - loadEarlier: vi.fn(), - readPhase: 'ready' -}) - -function expectInOrder(...nodes: Element[]): void { - for (const [index, node] of nodes.slice(1).entries()) { - expect(nodes[index]!.compareDocumentPosition(node)).toBe(Node.DOCUMENT_POSITION_FOLLOWING) - } -} - -const bar = (label: string | RegExp): Element => - screen.getByText(label).closest('[data-native-chat-turn-status]')! - -describe.each([['states each row’s turn', true]])( - 'a message the provider answered after the running turn, on a host that %s', - (_host, statesScope) => { - it("draws A's remaining rows and answer under A's bar, then B's bubble and turn", () => { - render( - - ) - - expectInOrder( - screen.getByText('Run the first job'), - bar('Worked for 17s'), - screen.getByText('FIRST DONE'), - screen.getByText('Then run the second job'), - bar(/Working for/), - screen.getByText('SECOND DONE') - ) - }) - } -) diff --git a/src/renderer/src/components/native-chat/conversation/slots/NativeChatMessageList.turn-membership.test.tsx b/src/renderer/src/components/native-chat/conversation/slots/NativeChatMessageList.turn-membership.test.tsx deleted file mode 100644 index c376839d8d6..00000000000 --- a/src/renderer/src/components/native-chat/conversation/slots/NativeChatMessageList.turn-membership.test.tsx +++ /dev/null @@ -1,538 +0,0 @@ -// @vitest-environment happy-dom - -import '@testing-library/jest-dom/vitest' - -import { cleanup, screen, fireEvent } from '@testing-library/react' -import { render } from '../../messages/actions/native-chat-tooltip-test-harness' - -import { afterAll, afterEach, beforeAll, describe, expect, it, vi } from 'vitest' - -// Why: these fixtures have neither inline visual owners nor sender navigation. -const unusedChatLeaves = vi.hoisted(() => ({ - inlineVisual: vi.fn(() => { - throw new Error('Unexpected inline visual in transcript fixture') - }), - openSender: vi.fn(() => { - throw new Error('Unexpected sender navigation in transcript fixture') - }) -})) -vi.mock('../../media/visuals/NativeChatInlineVisual', () => ({ - NativeChatInlineVisual: unusedChatLeaves.inlineVisual -})) -vi.mock('@/lib/open-agent-message-sender', () => ({ - openAgentMessageSender: unusedChatLeaves.openSender -})) - -import { - agentJournalItemKey, - agentJournalSubmissionKey -} from '../../../../../../shared/agent-session/journal/agent-session-journal-item-key' - -import type { - AgentJournalItemBody, - AgentJournalRenderItem, - AgentJournalSubmission -} from '../../../../../../shared/agent-session/journal/agent-session-journal-types' -import type { AgentJournalTurnScope } from '../../../../../../shared/agent-session/journal/agent-session-journal-turn-scope' - -import { projectStructuredAgentSessionMessages } from '../../../../../../shared/agent-session/view/structured-agent-session-message-projection' - -import { selectStructuredAgentSettledTurns } from '../../../../../../shared/agent-session/view/structured-agent-session-turn-timing' - -import { NativeChatMessageList } from '../../NativeChatMessageList' - -import { installNativeChatMessageListTestViewport } from '../../viewport/virtualization/native-chat-message-list-test-viewport' - -import type { NativeChatLiveSession } from '../../session/terminal/read/native-chat-live-session-contract' - -import type { NativeChatMessage } from '../../../../../../shared/native-chat/native-chat-types' - -{ - const THREAD: AgentJournalTurnScope = { kind: 'thread' } - const inTurn = (turnItemId: string): AgentJournalTurnScope => ({ kind: 'turn', turnItemId }) - let sequence = 0 - - function item( - itemId: string, - body: AgentJournalItemBody, - turnScope: AgentJournalTurnScope = THREAD - ): AgentJournalRenderItem { - sequence += 1 - return { itemId, revision: 0, sequence, observedAt: sequence, body, turnScope } - } - const say = ( - itemId: string, - role: 'user' | 'assistant', - text: string, - scope: AgentJournalTurnScope = THREAD - ) => item(itemId, { kind: 'message', role, blocks: [{ type: 'text', text }] }, scope) - const work = (itemId: string, scope: AgentJournalTurnScope) => - item( - itemId, - { - kind: 'message', - role: 'assistant', - blocks: [{ type: 'tool-call', name: 'shell', input: { command: 'ls' }, state: 'completed' }] - }, - scope - ) - const settledTurn = (itemId: string, userItemId: string, seconds: number, start: number) => - item(itemId, { - kind: 'turn', - turnId: itemId, - state: 'completed', - outcome: 'success', - userItemId, - startedAt: start, - completedAt: start + seconds * 1000 - }) - - function fruitTurn(): AgentJournalRenderItem[] { - return [ - say('u1', 'user', 'List three fruits'), - settledTurn('t1', 'u1', 4, 1_000), - say('t1-narration', 'assistant', 'Thinking about fruit.', inTurn('t1')), - work('t1-work', inTurn('t1')), - say('t1-answer', 'assistant', 'Apple, banana, cherry.', inTurn('t1')) - ] - } - - function journalList( - items: AgentJournalRenderItem[], - submissions: AgentJournalSubmission[] = [], - { - isWorking = false, - workingStartedAt = null, - hostTiming = true - }: { isWorking?: boolean; workingStartedAt?: number | null; hostTiming?: boolean } = {} - ): React.JSX.Element { - return ( - - ) - } - - function renderJournal( - items: AgentJournalRenderItem[], - submissions: AgentJournalSubmission[] = [], - isWorking = false - ): void { - render(journalList(items, submissions, { isWorking })) - } - - function follows(later: HTMLElement, earlier: HTMLElement): boolean { - return Boolean(earlier.compareDocumentPosition(later) & Node.DOCUMENT_POSITION_FOLLOWING) - } - - describe('NativeChatMessageList turns from the turn record', () => { - let restoreViewport = (): void => {} - beforeAll(() => { - restoreViewport = installNativeChatMessageListTestViewport() - }) - afterAll(() => restoreViewport()) - afterEach(cleanup) - - it('draws a message waiting behind /compact after the compaction, never above it', () => { - const compactEntry = agentJournalSubmissionKey('cmd-1') - const commandTurn = agentJournalItemKey({ - provider: 'orca', - clientMessageId: 'command-turn:cmd-1' - }) - const held = agentJournalSubmissionKey('held') - const items = [ - ...fruitTurn(), - item(compactEntry, { - kind: 'message', - role: 'user', - blocks: [{ type: 'text', text: '/compact' }], - command: { name: 'compact' } - }), - settledTurn(commandTurn, compactEntry, 2, 10_000), - // Accepted while the command ran, so written before the command's result. - say(held, 'user', 'Say DONE'), - item( - 'command-result', - { kind: 'status', text: 'Conversation compacted.', presentation: 'compaction' }, - inTurn(commandTurn) - ) - ] - const submission = ( - clientMessageId: string, - handedOverAt?: number - ): AgentJournalSubmission => ({ - clientMessageId, - fence: 1, - payloadFingerprint: clientMessageId, - dispatchState: - handedOverAt === undefined && clientMessageId === 'held' ? 'pending' : 'accepted', - providerItemId: null, - reason: null, - submittedAt: 9_000, - resolvedAt: null, - handoverRecorded: true, - ...(handedOverAt !== undefined ? { handedOverAt } : {}) - }) - // The command settled; the loop has not yet handed the held message over. - renderJournal(items, [submission('cmd-1', 9_500), submission('held')]) - - expect( - follows( - screen.getByText('Say DONE'), - screen.getByRole('separator', { name: 'Context compacted' }) - ) - ).toBe(true) - }) - - it('folds a turn the provider resumed on its own under its own status', () => { - const wake = agentJournalItemKey({ - provider: 'legacy', - agent: 'claude', - sessionId: 'session-1', - recordId: 'turn-lifecycle:wake' - }) - const items = [ - ...fruitTurn(), - // Claude keys a resumed turn's record on itself: no message opened it. - settledTurn(wake, wake, 9, 20_000), - say('wake-narration', 'assistant', 'The background build finished.', inTurn(wake)), - work('wake-work', inTurn(wake)), - say('wake-answer', 'assistant', 'All tests pass now.', inTurn(wake)) - ] - renderJournal(items) - - const previousStatus = screen.getByText('Worked for 4s') - const ownStatus = screen.getByText('Worked for 9s') - expect(follows(ownStatus, screen.getByText('Apple, banana, cherry.'))).toBe(true) - expect(follows(ownStatus, previousStatus)).toBe(true) - expect(screen.queryByText('The background build finished.')).toBeNull() - expect(screen.getByText('All tests pass now.')).toBeInTheDocument() - expect(screen.getAllByRole('button', { name: 'Toggle turn details' })).toHaveLength(2) - }) - - it('clocks a turn the provider opened under its own key, not the user turn before it', () => { - const wake = 'wake' - const ask = say('u1', 'user', 'List three fruits') - const answer = (state: 'running' | 'completed') => [ - ask, - item('t1', { kind: 'turn', turnId: 't1', state, userItemId: 'u1' }), - say('t1-answer', 'assistant', 'Apple, banana, cherry.', inTurn('t1')) - ] - const local = { hostTiming: false } - const { rerender } = render( - journalList(answer('running'), [], { - ...local, - isWorking: true, - workingStartedAt: Date.now() - 7_000 - }) - ) - rerender(journalList(answer('completed'), [], local)) - expect(screen.getByText('Worked for 7s')).toBeInTheDocument() - - const woken = [ - ...answer('completed'), - item(wake, { kind: 'turn', turnId: wake, state: 'running', userItemId: 'claude:wake' }), - say('wake-answer', 'assistant', 'Checking the background build.', inTurn(wake)) - ] - rerender(journalList(woken, [], { ...local, isWorking: true, workingStartedAt: Date.now() })) - expect(screen.getByText('Worked for 7s')).toBeInTheDocument() - }) - - it('draws a message waiting behind a running /compact after its live activity', () => { - const compactEntry = agentJournalSubmissionKey('cmd-1') - const commandTurn = agentJournalItemKey({ - provider: 'orca', - clientMessageId: 'command-turn:cmd-1' - }) - const held = agentJournalSubmissionKey('held') - const items = [ - ...fruitTurn(), - item(compactEntry, { - kind: 'message', - role: 'user', - blocks: [{ type: 'text', text: '/compact' }], - command: { name: 'compact' } - }), - item(commandTurn, { - kind: 'turn', - turnId: 'compact:cmd-1', - state: 'running', - userItemId: compactEntry, - startedAt: 10_000 - }), - say(held, 'user', 'Say DONE') - ] - const submission = ( - clientMessageId: string, - handedOverAt?: number - ): AgentJournalSubmission => ({ - clientMessageId, - fence: 1, - payloadFingerprint: clientMessageId, - dispatchState: handedOverAt === undefined ? 'pending' : 'accepted', - providerItemId: null, - reason: null, - submittedAt: 9_000, - resolvedAt: null, - handoverRecorded: true, - ...(handedOverAt !== undefined ? { handedOverAt } : {}) - }) - const { container } = render( - journalList(items, [submission('cmd-1', 9_500), submission('held')], { - isWorking: true, - workingStartedAt: 10_000 - }) - ) - - const activity = container.querySelector('[data-native-chat-turn-activity]') - expect(activity).not.toBeNull() - expect(follows(activity!, screen.getByText('/compact'))).toBe(true) - expect(follows(screen.getByText('Say DONE'), activity!)).toBe(true) - }) - - it("keeps a steer on its way into an ordinary running turn above that turn's activity", () => { - const steer = agentJournalSubmissionKey('steer') - const items = [ - say('u1', 'user', 'List three fruits'), - item('t1', { - kind: 'turn', - turnId: 't1', - state: 'running', - userItemId: 'u1', - startedAt: 10_000 - }), - say('t1-narration', 'assistant', 'Thinking about fruit.', inTurn('t1')), - say(steer, 'user', 'Make it four') - ] - const { container } = render( - journalList( - items, - [ - { - clientMessageId: 'steer', - fence: 1, - payloadFingerprint: 'steer', - dispatchState: 'pending', - providerItemId: null, - reason: null, - submittedAt: 10_500, - resolvedAt: null, - handoverRecorded: true - } - ], - { isWorking: true, workingStartedAt: 10_000 } - ) - ) - - const activity = container.querySelector('[data-native-chat-turn-activity]') - expect(activity).not.toBeNull() - expect(follows(activity!, screen.getByText('Make it four'))).toBe(true) - }) - }) -} - -{ - describe('NativeChatMessageList host-settled turn timing', () => { - afterEach(cleanup) - - let restoreViewport = (): void => {} - - beforeAll(() => { - restoreViewport = installNativeChatMessageListTestViewport() - }) - - afterAll(() => restoreViewport()) - - const session: NativeChatLiveSession = { - messages: [ - { - id: 'user-settled', - role: 'user', - blocks: [{ type: 'text', text: 'Settled on the host' }], - timestamp: 1, - source: 'transcript' - }, - { - id: 'assistant-settled', - role: 'assistant', - blocks: [{ type: 'text', text: 'Done.' }], - timestamp: 2, - source: 'transcript' - } - ], - status: 'ready', - sessionId: 'session-1', - agent: 'codex', - hasMore: false, - loadingEarlier: false, - olderHistoryGeneration: 0, - loadEarlier: vi.fn(), - readPhase: 'ready' - } - - it('does not render a local completed duration when the host cannot verify the end', () => { - const now = vi.spyOn(Date, 'now').mockReturnValue(1_000) - const unknownTurns = new Map([['user-settled', null]]) - try { - const { rerender } = render( - - ) - now.mockReturnValue(60_000) - rerender( - - ) - expect(screen.queryByText(/Worked for/)).not.toBeInTheDocument() - } finally { - now.mockRestore() - } - }) - }) - - describe('a thought joining a work run', () => { - let restoreViewport = (): void => {} - beforeAll(() => { - restoreViewport = installNativeChatMessageListTestViewport() - }) - afterAll(() => restoreViewport()) - afterEach(cleanup) - - const STARTED = 1_000 - - const prompt: NativeChatMessage = { - id: 'user-1', - role: 'user', - blocks: [{ type: 'text', text: 'Start the task' }], - timestamp: STARTED - 500, - source: 'transcript' - } - - const command: NativeChatMessage = { - id: 'tool-1', - role: 'assistant', - blocks: [ - { type: 'tool-call', name: 'Bash', input: { command: 'ls logs' }, state: 'completed' } - ], - timestamp: STARTED, - source: 'transcript' - } - - function reasoning(state: 'running' | 'completed'): NativeChatMessage { - return { - id: 'r-1', - role: 'reasoning', - blocks: [{ type: 'text', text: 'Weighing two approaches' }], - timestamp: STARTED + 50, - source: 'transcript', - state, - ...(state === 'completed' ? { completedAt: STARTED + 12_000 } : {}) - } - } - - function journal(rows: readonly NativeChatMessage[]): AgentJournalRenderItem[] { - return [ - { - itemId: prompt.id, - revision: 1, - sequence: 1, - observedAt: 1, - body: { kind: 'message', role: 'user', blocks: prompt.blocks } - }, - { - itemId: 'turn-1', - revision: 1, - sequence: 2, - observedAt: 2, - body: { kind: 'turn', turnId: 'turn-1', state: 'running', userItemId: prompt.id } - }, - ...rows.map((row, index) => ({ - itemId: row.id, - revision: 1, - sequence: index + 3, - observedAt: index + 3, - body: { - kind: 'message' as const, - role: row.role, - blocks: row.blocks, - ...(row.state ? { state: row.state } : {}) - } - })) - ] - } - - function list( - rows: readonly NativeChatMessage[], - props: Partial> = {} - ): React.JSX.Element { - const session: NativeChatLiveSession = { - messages: [prompt, ...rows], - status: 'working', - sessionId: 'session-1', - agent: 'claude', - hasMore: false, - loadingEarlier: false, - olderHistoryGeneration: 0, - loadEarlier: vi.fn(), - readPhase: 'ready' - } - return ( - - ) - } - - const runHeader = (): HTMLElement => - document.querySelector('[data-native-chat-tool-run-state]')! - - it('keeps a thought the reader opened live open inside its collapsed run', () => { - const { rerender } = render(list([command, reasoning('running')])) - fireEvent.click(screen.getByRole('button', { name: 'Thinking' })) - expect(screen.getByText('Weighing two approaches')).toBeInTheDocument() - - rerender(list([command, reasoning('completed')])) - expect(runHeader()).toHaveAttribute('aria-expanded', 'false') - expect(screen.queryByText('Weighing two approaches')).toBeNull() - - fireEvent.click(runHeader()) - expect(screen.getByRole('button', { name: /Thought for/ })).toHaveAttribute( - 'aria-expanded', - 'true' - ) - expect(screen.getByText('Weighing two approaches')).toBeInTheDocument() - }) - }) -} diff --git a/src/renderer/src/components/native-chat/conversation/turns/NativeChatMessageList.turn-indicator.test.tsx b/src/renderer/src/components/native-chat/conversation/turns/NativeChatMessageList.turn-indicator.test.tsx deleted file mode 100644 index 0e9617fbe84..00000000000 --- a/src/renderer/src/components/native-chat/conversation/turns/NativeChatMessageList.turn-indicator.test.tsx +++ /dev/null @@ -1,259 +0,0 @@ -// @vitest-environment happy-dom - -import '@testing-library/jest-dom/vitest' - -import { cleanup, screen } from '@testing-library/react' -import { render } from '../../messages/actions/native-chat-tooltip-test-harness' -import { afterAll, afterEach, beforeAll, describe, expect, it, vi } from 'vitest' - -// Why: these fixtures have neither inline visual owners nor sender navigation. -const unusedChatLeaves = vi.hoisted(() => ({ - inlineVisual: vi.fn(() => { - throw new Error('Unexpected inline visual in transcript fixture') - }), - openSender: vi.fn(() => { - throw new Error('Unexpected sender navigation in transcript fixture') - }) -})) -vi.mock('../../media/visuals/NativeChatInlineVisual', () => ({ - NativeChatInlineVisual: unusedChatLeaves.inlineVisual -})) -vi.mock('@/lib/open-agent-message-sender', () => ({ - openAgentMessageSender: unusedChatLeaves.openSender -})) -import type { NativeChatLiveSession } from '../../session/terminal/read/native-chat-live-session-contract' -import { NativeChatMessageList } from '../../NativeChatMessageList' -import { installNativeChatMessageListTestViewport } from '../../viewport/virtualization/native-chat-message-list-test-viewport' -import type { - AgentJournalItemBody, - AgentJournalRenderItem -} from '../../../../../../shared/agent-session/journal/agent-session-journal-types' -import type { AgentJournalTurnScope } from '../../../../../../shared/agent-session/journal/agent-session-journal-turn-scope' - -let restoreViewport = (): void => {} -beforeAll(() => { - restoreViewport = installNativeChatMessageListTestViewport() -}) -afterAll(() => restoreViewport()) -afterEach(cleanup) - -const session: NativeChatLiveSession = { - messages: [ - { - id: 'assistant-1', - role: 'assistant', - blocks: [{ type: 'text', text: 'Selectable agent response.' }], - timestamp: 1, - source: 'transcript' - } - ], - status: 'ready', - sessionId: 'session-1', - agent: 'codex', - hasMore: false, - loadingEarlier: false, - olderHistoryGeneration: 0, - loadEarlier: vi.fn(), - readPhase: 'ready' -} - -// Live turns show a prompt clock and tail activity; settled turns retain the clock bar. -describe('NativeChatMessageList turn indicator', () => { - it('replaces a bridge ask row and settles it from the FIFO tool result', () => { - const user = { - id: 'bridge-user', - role: 'user' as const, - blocks: [{ type: 'text' as const, text: 'Help me choose' }], - timestamp: 1, - source: 'transcript' as const - } - const call = { - id: 'bridge-ask', - role: 'assistant' as const, - blocks: [ - { - type: 'tool-call' as const, - name: 'AskUserQuestion', - input: { questions: [{ question: 'Which branch?' }] } - } - ], - timestamp: 2, - source: 'transcript' as const - } - const bridgeSession: NativeChatLiveSession = { - ...session, - agent: 'claude', - messages: [user, call], - transcriptLifecycle: { state: 'working', turnId: user.id, timestamp: 1 } - } - const rendered = render( - - ) - - expect(screen.getByText('Awaiting user input:')).toBeInTheDocument() - expect(screen.getByText('Which branch?')).toBeInTheDocument() - expect(screen.queryByText(/AskUserQuestion/)).toBeNull() - - rendered.rerender( - - ) - - expect(screen.queryByText('Awaiting user input:')).toBeNull() - expect(screen.getByText('Asked:')).toBeInTheDocument() - expect(screen.queryByText(/AskUserQuestion/)).toBeNull() - }) - - it.each([ - ["a host that states each row's turn", true], - ['a host that states none', false] - ])( - 'keeps the live bar under the prompt that opened the running turn, not a message sent mid-turn, on %s', - (_, scoped) => { - const prompt = (id: string, text: string): NativeChatLiveSession['messages'][number] => ({ - id, - role: 'user', - blocks: [{ type: 'text', text }], - timestamp: 1, - source: 'transcript' - }) - const messages = [ - prompt('user-a', 'Run four sleeps'), - { - id: 'tool-a', - role: 'assistant' as const, - blocks: [ - { - type: 'tool-call' as const, - name: 'Bash', - input: { command: 'sleep 15' }, - state: 'running' as const - } - ], - timestamp: 2, - source: 'transcript' as const - }, - prompt('user-b', 'Also say banana') - ] - // B was handed over while A's turn runs, so a host that states scopes puts it in that turn. - const t1: AgentJournalTurnScope = { kind: 'turn', turnItemId: 't1' } - const thread: AgentJournalTurnScope = { kind: 'thread' } - const row = ( - itemId: string, - sequence: number, - body: AgentJournalItemBody, - turnScope: AgentJournalTurnScope - ): AgentJournalRenderItem => ({ - itemId, - revision: 1, - sequence, - observedAt: sequence, - body, - ...(scoped ? { turnScope } : {}) - }) - const journal = (t1State: 'running' | 'completed', t2State?: 'running' | 'completed') => [ - row('user-a', 1, { kind: 'message', role: 'user', blocks: [] }, thread), - row('t1', 2, { kind: 'turn', turnId: 't1', state: t1State, userItemId: 'user-a' }, thread), - row('tool-a', 3, { kind: 'message', role: 'assistant', blocks: [] }, t1), - row('user-b', 4, { kind: 'message', role: 'user', blocks: [] }, t1), - ...(t2State - ? [ - row( - 't2', - 5, - { kind: 'turn', turnId: 't2', state: t2State, userItemId: 'user-b' }, - thread - ) - ] - : []) - ] - const list = (props: Partial>) => ( - - ) - // B was sent while A's turn runs: the host's record still names A as the running turn's opener. - const { rerender } = render( - list({ - workingStartedAt: Date.now() - 5000, - settledTurns: new Map(), - journalItems: journal('running') - }) - ) - const barA = screen.getByText('Working for 5s').closest('[data-native-chat-turn-status]') - expect(screen.getAllByText(/Working for/)).toHaveLength(1) - expect(screen.getByText('Run four sleeps').compareDocumentPosition(barA!)).toBe( - Node.DOCUMENT_POSITION_FOLLOWING - ) - expect(barA!.compareDocumentPosition(screen.getByText('Also say banana'))).toBe( - Node.DOCUMENT_POSITION_FOLLOWING - ) - - // A’s bar settles under A; tool scope or journal order keeps A’s work inside its fold. - const expectSettledUnderA = () => { - const settledA = screen - .getByText('Worked for 17s') - .closest('[data-native-chat-turn-status]') - expect(screen.getByText('Run four sleeps').compareDocumentPosition(settledA!)).toBe( - Node.DOCUMENT_POSITION_FOLLOWING - ) - expect(settledA!.compareDocumentPosition(screen.getByText('Also say banana'))).toBe( - Node.DOCUMENT_POSITION_FOLLOWING - ) - } - - // B's own turn opens: A settles in place and B counts from A's end. - rerender( - list({ - workingStartedAt: Date.now() - 1000, - settledTurns: new Map([['user-a', { startedAt: 1, workedSeconds: 17 }]]), - journalItems: journal('completed', 'running') - }) - ) - expectSettledUnderA() - const barB = screen.getByText('Working for 1s').closest('[data-native-chat-turn-status]') - expect(screen.getByText('Also say banana').compareDocumentPosition(barB!)).toBe( - Node.DOCUMENT_POSITION_FOLLOWING - ) - - rerender( - list({ - isWorking: false, - session: { ...session, status: 'ready', messages }, - workingStartedAt: null, - settledTurns: new Map([ - ['user-a', { startedAt: 1, workedSeconds: 17 }], - ['user-b', { startedAt: 2, workedSeconds: 51 }] - ]), - journalItems: journal('completed', 'completed') - }) - ) - expectSettledUnderA() - expect( - screen - .getByText('Also say banana') - .compareDocumentPosition(screen.getByText('Worked for 51s')) - ).toBe(Node.DOCUMENT_POSITION_FOLLOWING) - expect(screen.queryByText(/Working for/)).toBeNull() - } - ) -}) diff --git a/src/renderer/src/components/native-chat/drafts/native-chat-composer-draft-indexeddb.ts b/src/renderer/src/components/native-chat/drafts/native-chat-composer-draft-indexeddb.ts index 41ebdcefbd2..d3575f4cee4 100644 --- a/src/renderer/src/components/native-chat/drafts/native-chat-composer-draft-indexeddb.ts +++ b/src/renderer/src/components/native-chat/drafts/native-chat-composer-draft-indexeddb.ts @@ -1,14 +1,14 @@ // Keep persistence thin; the draft store owns merge and lifecycle policy. -import type { - NativeChatComposerDraftStorage, - StoredNativeChatComposerDraft -} from './native-chat-composer-draft-storage' import { committedTransaction, indexedDbConnection, settledRequest -} from '@/lib/indexeddb-connection' +} from '@/app-shell/storage/indexeddb-connection' +import type { + NativeChatComposerDraftStorage, + StoredNativeChatComposerDraft +} from './native-chat-composer-draft-storage' const DATABASE_NAME = 'orca-native-chat-composer-drafts' const DATABASE_VERSION = 1 diff --git a/src/renderer/src/components/native-chat/drafts/native-chat-draft-owner.ts b/src/renderer/src/components/native-chat/drafts/native-chat-draft-owner.ts index 8cff22c0b3d..7ab37c7b842 100644 --- a/src/renderer/src/components/native-chat/drafts/native-chat-draft-owner.ts +++ b/src/renderer/src/components/native-chat/drafts/native-chat-draft-owner.ts @@ -1,5 +1,3 @@ -import type { AppState } from '../../../store/types' -import type { NativeChatComposerDraftOwner } from '@/components/native-chat/drafts/native-chat-composer-draft-storage' import { nativeChatDraftScopeTabId, structuredAgentSessionIdOfDraftScope @@ -7,8 +5,10 @@ import { import { chatWorkspaceByTabId, structuredChatWorkspacesBySessionId -} from '../../../lib/structured-chat-tab-index' +} from '../../../lib/agent-session/tab-identity/structured-chat-tab-index' import { resolveWorktreeOperationRoute } from '../../../lib/workspace/ownership/worktree-operation-route' +import type { AppState } from '../../../store/types' +import type { NativeChatComposerDraftOwner } from '@/components/native-chat/drafts/native-chat-composer-draft-storage' function workspaceOfDraftScope( state: Pick, diff --git a/src/renderer/src/components/native-chat/media/images/native-chat-image-runtime-context.ts b/src/renderer/src/components/native-chat/media/images/native-chat-image-runtime-context.ts index a7a017009ee..ca00c041b7d 100644 --- a/src/renderer/src/components/native-chat/media/images/native-chat-image-runtime-context.ts +++ b/src/renderer/src/components/native-chat/media/images/native-chat-image-runtime-context.ts @@ -1,17 +1,12 @@ -import { useAppStore } from '@/store' -import type { AppState } from '@/store/types' -import type { RuntimeFileOperationArgs } from '@/runtime/files/runtime-file-client-types' +import { useAppStore } from '@/store/index' import { runtimeTargetForOwnerEnvironment } from '@/runtime/rpc/targets/runtime-client-target' -import type { RuntimeClientTarget } from '../../../../../../shared/runtime-client-target' -import { - resolveWorktreeOperationRouteResult, - type WorktreeOperationRouteResolution -} from '@/lib/workspace/ownership/worktree-operation-route' +import { resolveWorktreeOperationRouteResult } from '@/lib/workspace/ownership/worktree-operation-route' +import type { WorktreeOperationRouteResolution } from '@/lib/workspace/ownership/worktree-operation-route' import { createNativeChatTabOwnerSelector, findNativeChatTabOwnerWorktreeId } from '../../pane/ownership/native-chat-tab-owner' -import { captureDirectSshMutationExpectation } from '@/lib/ssh-mutation-expectation' +import { captureDirectSshMutationExpectation } from '@/runtime/hosts/ssh/ssh-mutation-expectation' import { parseExecutionHostId, toRuntimeExecutionHostId @@ -21,12 +16,15 @@ import { resolveNativeChatTabDirectory } from '../../pane/routing/native-chat-ta import { resolveOwner } from '@/lib/workspace/ownership/resolve-owner' import { useMemo } from 'react' import { shallow } from 'zustand/shallow' -import { firstRegisteredStructuredChatTab } from '@/lib/structured-chat-tab-index' +import { firstRegisteredStructuredChatTab } from '@/lib/agent-session/tab-identity/structured-chat-tab-index' import { selectDetectedWorktreesByRepo, selectFolderWorkspaces, selectWorktreesByRepo } from '@/store/workspaces/catalog/workspace-record-fields' +import type { AppState } from '@/store/types' +import type { RuntimeFileOperationArgs } from '@/runtime/files/runtime-file-client-types' +import type { RuntimeClientTarget } from '../../../../../../shared/runtime-client-target' /** The transcript must not read until ownership and its path are both known. */ export type NativeChatImageRuntimeContext = RuntimeFileOperationArgs | null diff --git a/src/renderer/src/components/native-chat/media/visuals/NativeChatInlineVisual.tsx b/src/renderer/src/components/native-chat/media/visuals/NativeChatInlineVisual.tsx index a8c5369ce30..edc7937b816 100644 --- a/src/renderer/src/components/native-chat/media/visuals/NativeChatInlineVisual.tsx +++ b/src/renderer/src/components/native-chat/media/visuals/NativeChatInlineVisual.tsx @@ -1,10 +1,9 @@ -import { useAppStore } from '@/store' -import { captureLinkOpenIntent } from '@/lib/link-open-intent' -import { beginLinkOpenRequest } from '@/lib/link-open-request' +import { useAppStore } from '@/store/index' +import { captureLinkOpenIntent } from '@/lib/links/placement/link-open-intent' +import { beginLinkOpenRequest } from '@/lib/links/link-open-request' import { useContext, useEffect, useRef, useState } from 'react' import { SquareArrowOutUpRight } from 'lucide-react' import { toast } from 'sonner' -import type { ArtifactWriteRequest } from '../../../../../../shared/artifacts/artifacts' import { ArtifactPublishButton } from '@/components/artifacts/ArtifactPublishButton' import { ArtifactPublishPreparationError } from '@/components/artifacts/artifact-publish-flow' import { Button } from '@/components/ui/button' @@ -20,9 +19,10 @@ import { import { NATIVE_CHAT_VISUAL_RESERVED_HEIGHT, NativeChatVisualFrame } from './NativeChatVisualFrame' import { observeTranscriptVisibility } from '../images/native-chat-image-visibility' import { NativeChatForwardedGestureContext } from '../../viewport/scroll/native-chat-reader-scroll-input' -import type { NativeChatVisualOwner } from './native-chat-visual-owner' import { readNativeChatVisual } from './native-chat-visual-read-client' import { useNativeChatVisualDocument } from './use-native-chat-visual-document' +import type { ArtifactWriteRequest } from '../../../../../../shared/artifacts/artifacts' +import type { NativeChatVisualOwner } from './native-chat-visual-owner' export function NativeChatVisualUnavailable(): React.JSX.Element { const t = useTranslate() diff --git a/src/renderer/src/components/native-chat/messages/actions/NativeChatRowActionsProvider.tsx b/src/renderer/src/components/native-chat/messages/actions/NativeChatRowActionsProvider.tsx index 831010543ca..1040d251e8c 100644 --- a/src/renderer/src/components/native-chat/messages/actions/NativeChatRowActionsProvider.tsx +++ b/src/renderer/src/components/native-chat/messages/actions/NativeChatRowActionsProvider.tsx @@ -1,6 +1,5 @@ import { useMemo } from 'react' -import { openDesktopStructuredSession } from '@/lib/activate-ai-vault-structured-session' -import type { NativeChatStructuredViewProps } from '@/components/native-chat/native-chat-view-types' +import { openDesktopStructuredSession } from '@/lib/agent-session/open/activate-ai-vault-structured-session' import { NativeChatForkContext, NativeChatForkedFromContext, @@ -8,9 +7,10 @@ import { NativeChatSideChatForkPointContext } from '@/components/native-chat/messages/actions/native-chat-fork-context' import { NativeChatRewindContext } from '@/components/native-chat/messages/actions/native-chat-rewind-context' +import { useNativeChatTabOwnerWorktreeId } from '@/components/native-chat/pane/ownership/use-native-chat-tab-owner' +import type { NativeChatStructuredViewProps } from '@/components/native-chat/native-chat-view-types' import type { NativeChatRewindSurface } from '@/components/native-chat/messages/actions/use-native-chat-rewind-host' import type { NativeChatPaneForks } from '@/components/native-chat/messages/actions/use-native-chat-fork' -import { useNativeChatTabOwnerWorktreeId } from '@/components/native-chat/pane/ownership/use-native-chat-tab-owner' /** What the pane's transcript rows offer: rewind on prompts, fork on responses, and the chat a * "Forked from" divider opens. */ diff --git a/src/renderer/src/components/native-chat/messages/agent-senders/NativeChatAgentMessageSenders.tsx b/src/renderer/src/components/native-chat/messages/agent-senders/NativeChatAgentMessageSenders.tsx index a0569defe54..1ba07b8a322 100644 --- a/src/renderer/src/components/native-chat/messages/agent-senders/NativeChatAgentMessageSenders.tsx +++ b/src/renderer/src/components/native-chat/messages/agent-senders/NativeChatAgentMessageSenders.tsx @@ -2,19 +2,19 @@ import { Fragment } from 'react' import { ArrowUpRight } from 'lucide-react' import { Button } from '@/components/ui/button' import { useTranslate } from '@/i18n/use-translate' -import { openAgentMessageSender } from '@/lib/open-agent-message-sender' -import type { RuntimeClientTarget } from '../../../../../../shared/runtime-client-target' +import { openAgentMessageSender } from '@/lib/agent-session/open/open-agent-message-sender' import { useNativeChatVisualOwner } from '../../media/visuals/native-chat-visual-owner' -import { - agentMessageSendersShown, - type AgentMessageSender, - type AgentMessageSource +import { agentMessageSendersShown } from '../../../../../../shared/agent-session/agent-session-message-source' +import type { + AgentMessageSender, + AgentMessageSource } from '../../../../../../shared/agent-session/agent-session-message-source' import { unnamedSenderLabel, useAgentMessageSenderLabel } from './native-chat-agent-message-sender-label' import { useAgentMessageSenderOpens } from './native-chat-agent-message-sender-view' +import type { RuntimeClientTarget } from '../../../../../../shared/runtime-client-target' /** Link a sender only where its one resolution can open something; otherwise a plain name. */ export function NativeChatAgentMessageSenders({ diff --git a/src/renderer/src/components/native-chat/messages/agent-senders/native-chat-agent-message-sender-identity.test.tsx b/src/renderer/src/components/native-chat/messages/agent-senders/native-chat-agent-message-sender-identity.test.tsx index 60fd7b7c5cf..366dc502a46 100644 --- a/src/renderer/src/components/native-chat/messages/agent-senders/native-chat-agent-message-sender-identity.test.tsx +++ b/src/renderer/src/components/native-chat/messages/agent-senders/native-chat-agent-message-sender-identity.test.tsx @@ -4,22 +4,19 @@ import { structuredAgentSessionTabId } from '../../../../../../shared/agent-session/view/structured-agent-session-projection' import '@testing-library/jest-dom/vitest' -import { act, cleanup, fireEvent, render, screen } from '@testing-library/react' +import { cleanup, render, screen } from '@testing-library/react' import { afterEach, beforeEach, expect, it, vi } from 'vitest' -import { useAppStore } from '@/store' +import { useAppStore } from '@/store/index' +import { foldAgentSessionConversationNames } from '../../../../../../shared/agent-session/agent-session-conversation-names' +import type { AgentSessionConversationNames } from '../../../../../../shared/agent-session/agent-session-conversation-names' +import { testOrcaSessionId } from '../../../../../../shared/orca-session-address-test-fixture' +import { NativeChatAgentMessageSenders } from './NativeChatAgentMessageSenders' import type { AgentSessionConversationName, AgentSessionStatusSummary } from '../../../../../../shared/agent-session/agent-session-wire' -import { - foldAgentSessionConversationNames, - type AgentSessionConversationNames -} from '../../../../../../shared/agent-session/agent-session-conversation-names' import type { AgentMessageSource } from '../../../../../../shared/agent-session/agent-session-message-source' -import type { AgentStatusEntry } from '../../../../../../shared/agent-status/contracts/agent-status-types' -import { testOrcaSessionId } from '../../../../../../shared/orca-session-address-test-fixture' import type { Tab } from '../../../../../../shared/tab-types' -import { NativeChatAgentMessageSenders } from './NativeChatAgentMessageSenders' const feeds = vi.hoisted( () => @@ -63,14 +60,14 @@ vi.mock('@/runtime/native-chat/status/structured-agent-session-status-feed', () } })) const openAgentMessageSender = vi.hoisted(() => vi.fn()) -vi.mock('@/lib/open-agent-message-sender', () => ({ openAgentMessageSender })) +vi.mock('@/lib/agent-session/open/open-agent-message-sender', () => ({ openAgentMessageSender })) const ROOT = testOrcaSessionId('root-chat') const RECIPIENT = 'recipient' const SENDER = 'sender' -const PANE = 'terminal:11111111-1111-4111-8111-111111111111' +void 'terminal:11111111-1111-4111-8111-111111111111' const initial = useAppStore.getInitialState() -const providerA = { key: 'session_id' as const, id: 'provider-a' } +void { key: 'session_id' as const, id: 'provider-a' } function summary(sessionId: string): AgentSessionStatusSummary { return { @@ -131,21 +128,6 @@ function publish( listener() } } -function row(provider = providerA, agentType = 'claude'): AgentStatusEntry { - return { - paneKey: PANE, - terminalHandle: 'term-a', - worktreeId: SENDER, - state: 'working', - prompt: '', - updatedAt: 1, - stateStartedAt: 1, - stateHistory: [], - agentType, - providerSession: provider, - connectionId: null - } -} beforeEach(() => { openAgentMessageSender.mockClear() @@ -167,73 +149,6 @@ afterEach(() => { feeds.clear() }) -it('shows a chat sender by its current rename', () => { - const renamed = 'Production Release Scan & Compatibility Review' - useAppStore.setState({ unifiedTabsByWorktree: { [SENDER]: [tab(ROOT, '')] } }) - const feed = feeds.get('local')! - const status = feed.snapshot - expect(feed.names.has(ROOT)).toBe(false) - render() - expect(screen.getByText('Original sender')).toBeInTheDocument() - act(() => publish('local', undefined, [{ sessionId: ROOT, conversationName: null }])) - expect(screen.getByText('Original sender')).toBeInTheDocument() - act(() => publish('local', undefined, [{ sessionId: ROOT, conversationName: renamed }])) - const name = screen.getByText(renamed) - expect(name).toBeInTheDocument() - fireEvent.click(name) - expect(openAgentMessageSender).toHaveBeenCalledWith( - source(), - source().senders[0], - RECIPIENT, - undefined, - undefined, - renamed - ) - expect(feed.snapshot).toBe(status) - expect(status.get(ROOT)?.conversationName).toBeUndefined() -}) - -it.each([false, true])( - 'keeps CLI A saved name after provider B and a terminal rename reuse the shell (%s queued)', - (queued) => { - const terminal = { - id: 'terminal', - ptyId: 'pty', - worktreeId: SENDER, - title: 'Claude Code', - customTitle: 'Resumed A', - color: null, - sortOrder: 0, - createdAt: 0 - } - useAppStore.setState({ - agentStatusByPaneKey: { [PANE]: row() }, - tabsByWorktree: { [SENDER]: [terminal] } - }) - const from = source(true) - render() - expect(screen.getByText('Original sender')).toBeInTheDocument() - act(() => { - useAppStore.setState({ - agentStatusByPaneKey: { [PANE]: row({ key: 'session_id', id: 'provider-b' }) }, - tabsByWorktree: { [SENDER]: [{ ...terminal, customTitle: 'Renamed B' }] } - }) - }) - const link = screen.getByText('Original sender') - expect(link).toBeInTheDocument() - fireEvent.click(link) - expect(openAgentMessageSender).toHaveBeenCalledWith( - from, - from.senders[0], - RECIPIENT, - undefined, - undefined, - 'Original sender' - ) - expect(feeds.get('local')!.activations).toBe(0) - } -) - it('uses the same published /clear successor for the live sender label', () => { const live = testOrcaSessionId('22222222-2222-4222-8222-222222222222') publish('local', [summary(live)], [{ sessionId: live, conversationName: 'Continued sender' }]) diff --git a/src/renderer/src/components/native-chat/messages/agent-senders/native-chat-agent-message-sender-label.ts b/src/renderer/src/components/native-chat/messages/agent-senders/native-chat-agent-message-sender-label.ts index bdb35559a61..a866c94c8a2 100644 --- a/src/renderer/src/components/native-chat/messages/agent-senders/native-chat-agent-message-sender-label.ts +++ b/src/renderer/src/components/native-chat/messages/agent-senders/native-chat-agent-message-sender-label.ts @@ -4,13 +4,13 @@ import { } from '@/runtime/native-chat/agent-senders/agent-sender-associations' import { agentMessageSenderLabel } from '../../../../../../shared/agent-session/agent-message-presentation' import { translate } from '@/i18n/i18n' -import { useTranslate, type Translate } from '@/i18n/use-translate' +import { useTranslate } from '@/i18n/use-translate' +import type { Translate } from '@/i18n/use-translate' import { useAppStore } from '@/store/index' -import type { AppState } from '@/store/types' import { structuredChatTabBySessionId, structuredChatWorkspacesBySessionId -} from '@/lib/structured-chat-tab-index' +} from '@/lib/agent-session/tab-identity/structured-chat-tab-index' import { useStructuredConversationName } from '@/runtime/native-chat/naming/structured-conversation-name' import { structuredAgentSessionOwnerForTab, @@ -18,10 +18,11 @@ import { resolveStructuredAgentSessionOwner, executionHostIdForStructuredTarget } from '@/runtime/native-chat/session-ownership/structured-agent-session-owner' +import { getKnownExecutionHostIdForWorktree } from '@/lib/workspace/ownership/worktree-runtime-owner' +import type { AppState } from '@/store/types' import type { RuntimeClientTarget } from '../../../../../../shared/runtime-client-target' import type { AgentMessageSender } from '../../../../../../shared/agent-session/agent-session-message-source' import type { Tab } from '../../../../../../shared/tab-types' -import { getKnownExecutionHostIdForWorktree } from '@/lib/workspace/ownership/worktree-runtime-owner' export function unnamedSenderLabel(t: Translate = translate): string { return t('components.native-chat.agentMessage.unnamedSender', 'an agent') diff --git a/src/renderer/src/components/native-chat/messages/agent-senders/native-chat-agent-message-sender-open.test.tsx b/src/renderer/src/components/native-chat/messages/agent-senders/native-chat-agent-message-sender-open.test.tsx deleted file mode 100644 index 5d2a83ba1ab..00000000000 --- a/src/renderer/src/components/native-chat/messages/agent-senders/native-chat-agent-message-sender-open.test.tsx +++ /dev/null @@ -1,163 +0,0 @@ -// @vitest-environment happy-dom -import { act, cleanup } from '@testing-library/react' -import { afterEach, beforeEach, expect, it, vi } from 'vitest' - -const mocks = vi.hoisted(() => ({ - callRuntimeRpc: vi.fn(), - activatePane: vi.fn(), - activateChat: vi.fn(async () => true), - paneUnavailable: vi.fn(), - toastInfo: vi.fn(), - focusRenderer: vi.fn(() => true), - focusRuntime: vi.fn(async () => undefined) -})) -vi.mock('@/components/terminal-pane/links/handles/terminal-handle-links', () => ({ - focusRendererTerminalHandle: mocks.focusRenderer, - focusRuntimeTerminalHandle: mocks.focusRuntime -})) -vi.mock('sonner', async (original) => ({ - ...(await original>()), - toast: { info: mocks.toastInfo, error: vi.fn() } -})) -vi.mock('@/runtime/rpc/calls/runtime-rpc-call', async (original) => ({ - ...(await original>()), - callRuntimeRpc: mocks.callRuntimeRpc -})) -vi.mock('@/components/sidebar/workspace-card/activity/use-worktree-agent-activation', () => ({ - activateWorktreeAgentPane: mocks.activatePane -})) -vi.mock('@/components/terminal-pane/agent-status/stale-agent-row', async (original) => ({ - ...(await original>()), - showAgentPaneUnavailable: mocks.paneUnavailable -})) -vi.mock('@/lib/activate-ai-vault-structured-session', async (original) => ({ - ...(await original>()), - activateAiVaultStructuredSession: mocks.activateChat -})) -vi.mock('@/lib/agent-session/structured-agent-session-tab-activation', async (original) => ({ - ...(await original>()), - activateStructuredAgentSessionById: mocks.activateChat -})) - -import { useAppStore } from '@/store' - -import { openAgentMessageSender } from '@/lib/open-agent-message-sender' - -import { - agentMessageSenderOpens, - resolveAgentMessageSenderTarget -} from './native-chat-agent-message-sender-target' - -import { initialStore, resetSenderStore, status } from './native-chat-agent-sender.test-fixture' -import type { AgentSenderPublication } from '../../../../../../shared/agent-sender-associations' -import type { - AgentMessageSender, - AgentMessageSource -} from '../../../../../../shared/agent-session/agent-session-message-source' - -import { FLOATING_TERMINAL_WORKTREE_ID } from '../../../../../../shared/constants' -import { handleGlobalSessionEvent } from '@/runtime/web-session-tabs-sync/global-session-events' -import { receivedAgentSenderPublications } from '@/runtime/web-session-tabs-sync/received-agent-sender-publications' -import { VisibilityResumeCoordinator } from '@/runtime/web-session-tabs-sync/visibility-resume-coordinator' -import { resetWebSessionTabsSnapshotFreshnessForTests } from '@/runtime/web-session-tabs-sync/tracking-lifecycle' - -let revision = 0 -/** Each delivery is the host's next revision, as a publishing host stamps it. */ -const publication = ( - associations: AgentSenderPublication['associations'] = [] -): AgentSenderPublication => ({ - associations, - principals: [], - attachments: [], - revision: { epoch: 'host', revision: ++revision } -}) -const terminal = (handle = 'term_0', agent: AgentMessageSender['agent'] = 'claude') => ({ - party: { address: handle, terminalHandle: handle, orcaSessionId: null }, - name: 'Worker', - agent -}) -const sourceOf = (sender: AgentMessageSender): AgentMessageSource => ({ - kind: 'agent', - senders: [sender], - orchestration: null -}) - -/** What the card draws for this sender: its avatar, and whether its name is a link. */ - -beforeEach(() => { - vi.useFakeTimers({ toFake: ['Date'] }) - vi.setSystemTime(2_000_000) - resetSenderStore() - for (const mock of Object.values(mocks)) { - mock.mockClear() - } -}) -afterEach(() => { - cleanup() - useAppStore.setState(initialStore, true) - vi.useRealTimers() -}) - -it("asks a paired host for its floating terminal's sender, which this window never mirrors", async () => { - resetWebSessionTabsSnapshotFreshnessForTests() - const paired = { kind: 'environment', environmentId: 'paired' } as const - const frame = (worktree: string, revision: number, identity: string) => { - const scope = publication([{ identity, paneKey: status(0).paneKey, worktreeId: worktree }]) - return { - type: 'updated', - worktree, - publicationEpoch: 'host', - snapshotVersion: revision, - activeGroupId: null, - activeTabId: null, - activeTabType: null, - tabs: [], - agentSenderAssociations: { ...scope, revision: { epoch: 'paired-host', revision } } - } - } - // The window's real stream receipt, as for any paired frame. - const receive = (event: ReturnType) => - act(() => - handleGlobalSessionEvent({ - environmentId: 'paired', - expectedEnvironmentConnectionGeneration: 0, - expectedTrackingGeneration: 0, - visibilityGeneration: 0, - isCurrent: () => true, - event, - response: { id: 'stream', ok: true, result: event, _meta: { runtimeId: 'rt-1' } }, - awaitingVisibilityResumeInventory: { value: false }, - coordinator: new VisibilityResumeCoordinator({ - environments: [], - environmentIdBySubscriptionSpec: [], - omissions: new Map(), - activeRuntimeWorktreeKey: () => null - }) - }) - ) - const floatingTabs = useAppStore.getState().tabsByWorktree[FLOATING_TERMINAL_WORKTREE_ID] - receive(frame(FLOATING_TERMINAL_WORKTREE_ID, 1, 'term_float')) - receive(frame('workspace', 2, 'term_0')) - const state = useAppStore.getState() - expect(Object.keys(state.agentSenderPublicationsByHost['runtime:paired'])).toEqual(['workspace']) - expect(state.tabsByWorktree[FLOATING_TERMINAL_WORKTREE_ID]).toBe(floatingTabs) - const floating = terminal('term_float') - const resolved = resolveAgentMessageSenderTarget(state, floating, 'workspace', paired, undefined) - expect(resolved).toEqual({ kind: 'gone', sender: 'terminal' }) - expect(agentMessageSenderOpens(resolved, floating)).toBe(true) - await openAgentMessageSender( - sourceOf(floating), - floating, - 'workspace', - paired, - undefined, - 'Worker' - ) - expect(mocks.callRuntimeRpc).toHaveBeenCalled() - expect(mocks.activatePane).not.toHaveBeenCalled() - // This machine's own floating terminal still publishes its senders. - const local = receivedAgentSenderPublications({}, 'local', [ - frame(FLOATING_TERMINAL_WORKTREE_ID, 3, 'term_local') - ]) - expect(Object.keys(local.local)).toEqual([FLOATING_TERMINAL_WORKTREE_ID]) -}) diff --git a/src/renderer/src/components/native-chat/messages/rows/NativeChatMessageRow.test.tsx b/src/renderer/src/components/native-chat/messages/rows/NativeChatMessageRow.test.tsx deleted file mode 100644 index 489be59fd78..00000000000 --- a/src/renderer/src/components/native-chat/messages/rows/NativeChatMessageRow.test.tsx +++ /dev/null @@ -1,201 +0,0 @@ -// @vitest-environment happy-dom -import { NativeChatHostSetupContext } from '../../host-access/native-chat-host-setup' -import '@testing-library/jest-dom/vitest' -import { cleanup, fireEvent, screen, waitFor } from '@testing-library/react' -import { render } from '../actions/native-chat-tooltip-test-harness' -import { afterEach, describe, expect, it, vi } from 'vitest' - -// Why: these fixtures have neither inline visual owners nor sender navigation. -const unusedChatLeaves = vi.hoisted(() => ({ - inlineVisual: vi.fn(() => { - throw new Error('Unexpected inline visual in transcript fixture') - }), - openSender: vi.fn(() => { - throw new Error('Unexpected sender navigation in transcript fixture') - }) -})) -vi.mock('../../media/visuals/NativeChatInlineVisual', () => ({ - NativeChatInlineVisual: unusedChatLeaves.inlineVisual -})) -vi.mock('@/lib/open-agent-message-sender', () => ({ - openAgentMessageSender: unusedChatLeaves.openSender -})) -afterEach(() => { - expect(unusedChatLeaves.inlineVisual).not.toHaveBeenCalled() - expect(unusedChatLeaves.openSender).not.toHaveBeenCalled() -}) -import type { NativeChatMessage } from '../../../../../../shared/native-chat/native-chat-types' -import { MessageRow } from './NativeChatMessageRow' -import type { NativeChatRewindSurface } from '../actions/use-native-chat-rewind-host' -import { readNativeChatQuotableSelection } from '../../selection-quotes/native-chat-quote-selection' -import type { AgentJournalSubmission } from '../../../../../../shared/agent-session/journal/agent-session-journal-types' -import { agentJournalSubmissionKey } from '../../../../../../shared/agent-session/journal/agent-session-journal-item-key' -import { useStructuredAgentSessionDeliveryNotices } from '../../session/structured/delivery/use-structured-agent-session-delivery-notices' - -const confirm = vi.hoisted(() => vi.fn()) -vi.mock('@/lib/syntax-highlighting/oniguruma', async () => ({ - loadOniguruma: (await import('@/lib/syntax-highlighting/oniguruma-test-harness')) - .loadNodeOniguruma -})) -vi.mock('@/components/confirmation-dialog-context', () => ({ - useConfirmationDialog: () => confirm -})) - -afterEach(cleanup) -const signInView = { signingIn: false, signIn: vi.fn() } -const setupView = { signIn: signInView, install: null } - -function renderMessage( - role: NativeChatMessage['role'], - timestamp: number | null = 0, - rewind?: NativeChatRewindSurface -) { - return render( - - ) -} - -describe('MessageRow control visibility', () => { - it('copies an assistant reply without its visual lines, which mean nothing outside Orca', async () => { - const writeClipboardText = vi.fn().mockResolvedValue(undefined) - Object.assign(window, { api: { ui: { writeClipboardText } } }) - - render( - - ) - fireEvent.click(screen.getByRole('button', { name: 'Copy message' })) - - await waitFor(() => { - expect(writeClipboardText).toHaveBeenCalledWith('Here it is.\n\nDone.') - }) - }) -}) - -describe('which messages can be quoted', () => { - it.each([ - ['assistant', 'Message text'], - ['user', undefined], - ['system', undefined] - ] as const)('a selection in a %s message', (role, quoted) => { - const { container } = renderMessage(role) - window.getSelection()!.selectAllChildren(screen.getByText('Message text')) - - expect(readNativeChatQuotableSelection(container)?.text).toBe(quoted) - }) -}) - -describe('what a user message says about its delivery', () => { - function RecordedMessage({ submission }: { submission: AgentJournalSubmission }) { - const notices = useStructuredAgentSessionDeliveryNotices({ - pending: [], - submissions: [submission], - journalItems: [], - agentName: 'Codex', - startFailures: [] - }) - const id = agentJournalSubmissionKey(submission.clientMessageId) - return ( - - ) - } - - it('lets a user sign in from the refused message when no composer notice is shown', () => { - const { signIn } = signInView - render( - - - - ) - fireEvent.click(screen.getByRole('button', { name: 'Sign in' })) - expect(signIn).toHaveBeenCalledOnce() - }) - - it.each(['accepted', 'rejected', 'unknown'] as const)( - 'keeps a recorded steer Sending through handoff until it becomes %s', - (dispatchState) => { - const held: AgentJournalSubmission = { - clientMessageId: 'steer', - fence: 1, - payloadFingerprint: 'steer', - dispatchState: 'pending', - providerItemId: null, - reason: null, - submittedAt: 1, - resolvedAt: null, - handoverRecorded: true - } - const { rerender } = render() - expect(screen.getByText('Sending…')).toBeInTheDocument() - expect(screen.queryByRole('time')).toBeNull() - - const handedOver = { ...held, handedOverAt: 2 } - rerender() - expect(screen.getByText('Sending…')).toBeInTheDocument() - - rerender( - - ) - expect(screen.queryByText('Sending…')).toBeNull() - expect(screen.getByRole('time')).toBeInTheDocument() - if (dispatchState === 'rejected') { - expect(screen.getByText('Codex refused the message.')).toBeInTheDocument() - } - } - ) -}) diff --git a/src/renderer/src/components/native-chat/pane/actions/native-chat-header-ownership.test.tsx b/src/renderer/src/components/native-chat/pane/actions/native-chat-header-ownership.test.tsx deleted file mode 100644 index 9d967d9cec6..00000000000 --- a/src/renderer/src/components/native-chat/pane/actions/native-chat-header-ownership.test.tsx +++ /dev/null @@ -1,136 +0,0 @@ -// @vitest-environment happy-dom - -import { act, cleanup, fireEvent, render, within } from '@testing-library/react' -import { afterEach, beforeEach, expect, it, vi } from 'vitest' -import { TooltipProvider } from '@/components/ui/tooltip' -import { useAppStore } from '@/store' - -import type { Tab } from '../../../../../../shared/tab-types' -import { createTabsSliceMockApi } from '@/store/slices/tabs/tabs-slice-test-harness' -import { makeTabGroup } from '@/store/slices/tabs/tab-group.test-fixture' -import { - makeFolderWorkspace, - makeUnifiedTab -} from '../../../worktree-jump/worktree-jump-palette-test-fixtures' - -import * as history from '../../../right-sidebar/ai-vault/scanning/ai-vault-panel-session-list-request' -import type { NativeChatCliForkPreparation } from '@/lib/agent-session/resume/cli-fork/native-chat-cli-fork-preparation' -import type { NativeChatStructuredViewProps } from '../../native-chat-view-types' - -const mocks = vi.hoisted(() => ({ prepare: vi.fn(), launch: vi.fn(), close: vi.fn() })) -vi.mock('@/store', async () => { - const { createTestStore } = await import('@/store/testing/app-store-test-fixture') - return { useAppStore: createTestStore() } -}) -vi.mock('../../NativeChatView', async () => { - const { nativeChatPaneHeader } = await import('./NativeChatPaneHeader') - return { - default: (props: NativeChatStructuredViewProps) => ( -
- {nativeChatPaneHeader(props, 'folder:workspace', 'dark')} - {props.sessionId} -
- ) - } -}) -vi.mock('@/lib/workspace/tabs/workspace-tab-commands', () => ({ - dispatchWorkspaceTabCommand: mocks.close -})) -vi.mock('@/lib/agent-session/resume/cli-fork/native-chat-cli-fork-preparation', () => ({ - prepareNativeChatCliFork: mocks.prepare -})) -vi.mock('@/lib/launch-ai-vault-session-and-reveal', () => ({ - launchAiVaultSessionAndReveal: mocks.launch -})) -vi.mock('@/lib/agent-session/resume/history/ai-vault-session-fork-startup', () => ({ - assertAiVaultCopiedSessionLaunchAllowed: () => {}, - buildAiVaultForkStartupForWorktree: () => ({ command: 'fixture-fork' }) -})) - -import StructuredAgentSessionPaneOverlayLayer from '../routing/StructuredAgentSessionPaneOverlayLayer' - -const workspace = 'folder:workspace' -const initial = useAppStore.getInitialState() -const fullRequest = vi.spyOn(history, 'resolveAiVaultPanelSessionListRequest') - -const testWindow = window -const originalApi = window.api -const api = createTabsSliceMockApi() -vi.stubGlobal('window', testWindow) -beforeEach(() => { - vi.clearAllMocks() - Object.assign(window, { api }) - useAppStore.setState(initial, true) - useAppStore.setState({ - folderWorkspaces: [makeFolderWorkspace({ id: 'workspace', folderPath: '/repo' })] - }) -}) -afterEach(() => { - cleanup() - useAppStore.setState(initial, true) - Object.assign(window, { api: originalApi }) -}) -function seedChats(size: number) { - const tabs: Tab[] = Array.from({ length: size }, (_, index) => ({ - ...makeUnifiedTab(`chat-${index}`, workspace, `session-${index}`, `Chat ${index}`), - contentType: 'agent-session', - agentSessionAgent: 'codex', - executionHostId: 'local', - groupId: index === size - 1 ? 'second' : 'first' - })) - const groups = ['first', 'second'].map((id) => - makeTabGroup({ - id, - worktreeId: workspace, - tabOrder: tabs.filter((tab) => tab.groupId === id).map((tab) => tab.id), - activeTabId: id === 'first' ? 'chat-0' : `chat-${size - 1}` - }) - ) - useAppStore.setState({ - unifiedTabsByWorktree: { [workspace]: tabs }, - groupsByWorktree: { [workspace]: groups }, - activeGroupIdByWorktree: { [workspace]: 'first' } - }) -} -function overlay(active: boolean) { - return ( - - - - ) -} -function chat(container: HTMLElement, id: string) { - return within(container).getByText(`session-${id.slice(5)}`).parentElement! -} - -it('keeps the real Continue pending operation disabled across header hide/reveal and launches once', async () => { - seedChats(10) - const preparation = Promise.withResolvers() - mocks.prepare.mockReturnValue(preparation.promise) - mocks.launch.mockResolvedValue(undefined) - const view = render(overlay(true)) - const source = chat(view.container, 'chat-0') - const button = () => within(source).getByRole('button', { name: 'Continue with Terminal Agent' }) - expect(fullRequest).not.toHaveBeenCalled() - fireEvent.click(button()) - expect(button().hasAttribute('disabled')).toBe(true) - expect(button().getAttribute('aria-busy')).toBe('true') - view.rerender(overlay(false)) - expect(within(source).queryByRole('button')).toBeNull() - expect(useAppStore.getState().getTab('chat-0')).not.toBeNull() - view.rerender(overlay(true)) - expect(button().hasAttribute('disabled')).toBe(true) - expect(button().getAttribute('aria-busy')).toBe('true') - fireEvent.click(button()) - expect(mocks.prepare).toHaveBeenCalledTimes(1) - await act(async () => - preparation.resolve({ - copied: false, - session: { agent: 'codex', sessionId: 'fork', cwd: '/repo', codexHome: null } - }) - ) - expect(mocks.launch).toHaveBeenCalledTimes(1) - expect(button().hasAttribute('disabled')).toBe(false) - expect(button().hasAttribute('aria-busy')).toBe(false) - expect(fullRequest).toHaveBeenCalledTimes(1) -}) diff --git a/src/renderer/src/components/native-chat/pane/actions/use-native-chat-hand-off.tsx b/src/renderer/src/components/native-chat/pane/actions/use-native-chat-hand-off.tsx index f02a53bffa8..1fbf651df4a 100644 --- a/src/renderer/src/components/native-chat/pane/actions/use-native-chat-hand-off.tsx +++ b/src/renderer/src/components/native-chat/pane/actions/use-native-chat-hand-off.tsx @@ -1,24 +1,23 @@ import { toast } from 'sonner' import { translate } from '@/i18n/i18n' import { withTimeout } from '../../../../../../shared/promise-timeout-fallback' -import { useCallback, useLayoutEffect, useRef, useState, type ReactNode } from 'react' -import { useAppStore } from '@/store' -import { structuredChatTabById } from '@/lib/structured-chat-tab-index' +import { useCallback, useLayoutEffect, useRef, useState } from 'react' +import type { ReactNode } from 'react' +import { useAppStore } from '@/store/index' +import { structuredChatTabById } from '@/lib/agent-session/tab-identity/structured-chat-tab-index' import { useStructuredChatTabConversationName } from '@/runtime/native-chat/naming/structured-conversation-name' import { AgentSessionContinuationDialog } from '@/components/agent-session-continuation/AgentSessionContinuationDialog' -import { - buildAgentSessionContinuationPrompt, - type AgentSessionContinuationRequest -} from '@/lib/agent-session/context/agent-session-continuation' +import { buildAgentSessionContinuationPrompt } from '@/lib/agent-session/context/agent-session-continuation' +import type { AgentSessionContinuationRequest } from '@/lib/agent-session/context/agent-session-continuation' import { isTuiAgent } from '../../../../../../shared/agent-launch/catalog/tui-agent-config' import { callStructuredAgentSession } from '@/runtime/native-chat/requests/structured-agent-session-call' import { supportsStructuredAgentSessionContinuationContext } from '@/runtime/native-chat/host-capabilities/structured-agent-session-host-support' -import type { AgentSessionContinuationContext } from '../../../../../../shared/agent-session/agent-session-wire' import { executionHostIdForStructuredTarget } from '@/runtime/native-chat/session-ownership/structured-agent-session-owner' +import { buildAgentSessionHandoffContext } from '../../../../../../shared/agent-session-handoff-context' +import type { AgentSessionContinuationContext } from '../../../../../../shared/agent-session/agent-session-wire' import type { NativeChatMessage } from '../../../../../../shared/native-chat/native-chat-types' import type { NativeChatStructuredViewProps } from '../../native-chat-view-types' import type { NativeChatFileLinkContext } from '../../links/actions/native-chat-file-link-context' -import { buildAgentSessionHandoffContext } from '../../../../../../shared/agent-session-handoff-context' export type NativeChatHandOff = { /** This chat can seed another agent from its owning workspace. */ diff --git a/src/renderer/src/components/native-chat/pane/ownership/native-chat-runtime-owner.ts b/src/renderer/src/components/native-chat/pane/ownership/native-chat-runtime-owner.ts index f252d3cdf55..a0761434ace 100644 --- a/src/renderer/src/components/native-chat/pane/ownership/native-chat-runtime-owner.ts +++ b/src/renderer/src/components/native-chat/pane/ownership/native-chat-runtime-owner.ts @@ -1,8 +1,8 @@ import { runtimeEnvironmentIdOrLocalUnlessTwin } from '@/lib/workspace/ownership/worktree-runtime-owner' +import { createNativeChatTabOwnerSelector } from './native-chat-tab-owner' +import { chatWorkspaceByTabId as findTerminalTabWorktreeId } from '../../../../lib/agent-session/tab-identity/structured-chat-tab-index' import type { WorktreeRuntimeOwnerState } from '@/lib/workspace/ownership/worktree-runtime-owner-state' import type { AppState } from '@/store/types' -import { createNativeChatTabOwnerSelector } from './native-chat-tab-owner' -import { chatWorkspaceByTabId as findTerminalTabWorktreeId } from '../../../../lib/structured-chat-tab-index' export type NativeChatRuntimeOwnerState = Pick & WorktreeRuntimeOwnerState diff --git a/src/renderer/src/components/native-chat/pane/ownership/native-chat-tab-owner.ts b/src/renderer/src/components/native-chat/pane/ownership/native-chat-tab-owner.ts index 9885da1fa04..d7924c868bf 100644 --- a/src/renderer/src/components/native-chat/pane/ownership/native-chat-tab-owner.ts +++ b/src/renderer/src/components/native-chat/pane/ownership/native-chat-tab-owner.ts @@ -1,7 +1,7 @@ import { chatWorkspaceByTabId, chatWorkspaceByTabId as findTerminalTabWorktreeId -} from '../../../../lib/structured-chat-tab-index' +} from '../../../../lib/agent-session/tab-identity/structured-chat-tab-index' import type { AppState } from '../../../../store/types' type NativeChatTabOwnerState = Pick & { diff --git a/src/renderer/src/components/native-chat/pane/routing/native-chat-tab-directory.ts b/src/renderer/src/components/native-chat/pane/routing/native-chat-tab-directory.ts index 10e18a26d0d..53d45011d08 100644 --- a/src/renderer/src/components/native-chat/pane/routing/native-chat-tab-directory.ts +++ b/src/renderer/src/components/native-chat/pane/routing/native-chat-tab-directory.ts @@ -1,11 +1,9 @@ -import type { ExecutionHostId } from '../../../../../../shared/execution-host' import { isFloatingWorkspaceId } from '../../../../../../shared/floating-workspace-worktree' -import { - resolveWorkspaceDirectory, - type WorkspaceDirectoryState -} from '@/lib/workspace/paths/workspace-directory' +import { resolveWorkspaceDirectory } from '@/lib/workspace/paths/workspace-directory' +import type { WorkspaceDirectoryState } from '@/lib/workspace/paths/workspace-directory' +import { firstRegisteredStructuredChatTab } from '@/lib/agent-session/tab-identity/structured-chat-tab-index' +import type { ExecutionHostId } from '../../../../../../shared/execution-host' import type { StructuredSessionLaunchDirectory } from '@/store/slices/agent-status/structured-session-launch-directories' -import { firstRegisteredStructuredChatTab } from '@/lib/structured-chat-tab-index' type NativeChatDirectoryTab = { id: string diff --git a/src/renderer/src/components/native-chat/queue/NativeChatQueuedMessageList.in-flight.test.tsx b/src/renderer/src/components/native-chat/queue/NativeChatQueuedMessageList.in-flight.test.tsx deleted file mode 100644 index 60699c4da8d..00000000000 --- a/src/renderer/src/components/native-chat/queue/NativeChatQueuedMessageList.in-flight.test.tsx +++ /dev/null @@ -1,96 +0,0 @@ -// @vitest-environment happy-dom - -import { cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react' -import { afterEach, expect, it, vi } from 'vitest' - -vi.mock('sonner', () => ({ toast: { error: vi.fn() } })) -// A card's sender line opens and names agents through modules this test does not exercise. -vi.mock('@/lib/open-agent-message-sender', () => ({ openAgentMessageSender: vi.fn() })) -vi.mock('@/runtime/native-chat/naming/structured-conversation-name', () => ({ - useStructuredChatTabConversationName: () => null -})) -vi.mock('../../../store/index', () => { - const state = { updateSettings: vi.fn() } - const useAppStore = (selector: (value: typeof state) => unknown): unknown => selector(state) - useAppStore.getState = () => state - return { useAppStore } -}) - -import { toast } from 'sonner' -import { TooltipProvider } from '@/components/ui/tooltip' -import { NativeChatQueuedMessageList } from './NativeChatQueuedMessageList' -import { useStructuredAgentSessionQueuedMessages } from './use-structured-agent-session-queued-messages' -import type { StructuredAgentSessionWrite } from '../session/structured/writes/use-structured-agent-session-mutate' -import type { AgentSessionQueuedMessage } from '../../../../../shared/agent-session/requests/agent-session-queued-message-wire' - -function waitingDraft(messageId: string, position: number): AgentSessionQueuedMessage { - return { - messageId, - position, - body: { kind: 'message', role: 'user', blocks: [{ type: 'text', text: `${messageId} text` }] }, - state: 'waiting' - } -} - -/** The list over the real controller, held after a Stop, deleting through `write`. */ -function renderHeldQueue( - queuedMessages: AgentSessionQueuedMessage[], - write: StructuredAgentSessionWrite, - mutate = vi.fn(async (..._call: [string, string, Record]) => null) -): void { - function HeldQueue(): React.JSX.Element { - const owner = useStructuredAgentSessionQueuedMessages({ - admit: () => ({ target: { kind: 'local' }, write: write, mutate: async () => null }), - capturePresentation: () => () => true, - enabled: true, - queuedMessages, - queuePause: { reason: 'stopped' }, - submissions: [], - hasPendingPrompt: false, - isWorking: false, - composerScopeKey: undefined, - mutate: mutate, - editTransport: { target: { kind: 'local' }, sessionId: 'session', capable: false, write } - }) - return - } - render( - - - - ) -} - -afterEach(cleanup) - -it('a slow Clear all greys Clear all, Resume and every card until the host answers', async () => { - vi.mocked(toast.error).mockClear() - const answer = Promise.withResolvers() - const write = vi.fn(async () => { - await answer.promise - return { - kind: 'not-done' as const, - notice: 'Could not delete', - failure: { kind: 'failed' as const } - } - }) - renderHeldQueue([waitingDraft('a', 1), waitingDraft('b', 2)], write) - const clearAll = () => screen.getByRole('button', { name: 'Clear all' }) - const controls = () => [ - clearAll(), - screen.getByRole('button', { name: 'Resume' }), - ...screen.getAllByRole('button', { name: /^(Delete|Steer|Send|More actions)$/ }) - ] - fireEvent.click(clearAll()) - fireEvent.click(clearAll()) - await waitFor(() => - controls().forEach((control) => expect(control).toHaveProperty('disabled', true)) - ) - expect(write).toHaveBeenCalledTimes(2) - answer.resolve() - await waitFor(() => - controls().forEach((control) => expect(control).toHaveProperty('disabled', false)) - ) - expect(screen.getAllByRole('listitem')).toHaveLength(2) - expect(toast.error).toHaveBeenCalledExactlyOnceWith('Could not delete') -}) diff --git a/src/renderer/src/components/native-chat/session/options/catalog/native-chat-session-option-discovery.ts b/src/renderer/src/components/native-chat/session/options/catalog/native-chat-session-option-discovery.ts index 82083821e4e..20433893bb7 100644 --- a/src/renderer/src/components/native-chat/session/options/catalog/native-chat-session-option-discovery.ts +++ b/src/renderer/src/components/native-chat/session/options/catalog/native-chat-session-option-discovery.ts @@ -1,6 +1,4 @@ -import type { AgentType } from '../../../../../../../shared/agent-status/contracts/agent-status-types' import { createClaudeCatalogOptions } from '../../../../../../../shared/agent-session/options/agent-session-option-catalog-claude-codex' -import type { CatalogModel } from '../../../../../../../shared/agent-session/options/agent-session-option-catalog-types' import { catalogModelsFromModelDiscovery } from '../../../../../../../shared/native-chat/input/native-chat-discovered-catalog-models' import { getCommitMessageModelDiscoveryHostKeyForLocalRuntime, @@ -13,19 +11,19 @@ import { getConnectionIdFromState } from '@/lib/workspace/ownership/connection-o import { getLocalProjectExecutionRuntimeContext, getWslDistroFromPath -} from '@/lib/local-preflight-context' +} from '@/runtime/hosts/preflight/local-preflight-context' import { discoverRuntimeCommitMessageModels } from '@/runtime/source-control/git/runtime-git-generation-client' -import { - getRuntimeGitScope, - type RuntimeGitContext -} from '@/runtime/source-control/git/runtime-git-client-context' +import { getRuntimeGitScope } from '@/runtime/source-control/git/runtime-git-client-context' +import type { RuntimeGitContext } from '@/runtime/source-control/git/runtime-git-client-context' import { callStructuredAgentSession } from '@/runtime/native-chat/requests/structured-agent-session-call' +import { useAppStore } from '@/store/index' +import { selectFileListWorktree } from '@/store/workspaces/selection/known-worktree-selection' +import type { AgentType } from '../../../../../../../shared/agent-status/contracts/agent-status-types' +import type { CatalogModel } from '../../../../../../../shared/agent-session/options/agent-session-option-catalog-types' import type { AgentSessionModelCatalogResult, AgentSessionModelOption } from '../../../../../../../shared/agent-session/agent-session-wire' -import { useAppStore } from '@/store/index' -import { selectFileListWorktree } from '@/store/workspaces/selection/known-worktree-selection' export type NativeChatModelDiscoveryContext = { hostKey: string diff --git a/src/renderer/src/components/native-chat/session/status/structured-agent-session-status-bridge-failed-start.test.tsx b/src/renderer/src/components/native-chat/session/status/structured-agent-session-status-bridge-failed-start.test.tsx deleted file mode 100644 index 99f419e3b7a..00000000000 --- a/src/renderer/src/components/native-chat/session/status/structured-agent-session-status-bridge-failed-start.test.tsx +++ /dev/null @@ -1,408 +0,0 @@ -// @vitest-environment happy-dom - -// Refused creates publish no host session; bridge launch failures into tab/workspace rows until retry or closure. - -import type * as LaunchErrors from '@/lib/agent-session/launch/structured-agent-session-launch-errors' -import { act, cleanup, render, waitFor } from '@testing-library/react' -import { afterEach, beforeEach, describe, expect, it, vi, type Mock } from 'vitest' -import type { - AgentSessionHistoryResult, - AgentSessionMutationResult, - AgentSessionSendResult, - AgentSessionStatusEvent -} from '../../../../../../shared/agent-session/agent-session-wire' - -import type { AgentStatusEntry } from '../../../../../../shared/agent-status/contracts/agent-status-types' -import { structuredAgentSessionPaneKey } from '../../../../../../shared/agent-session/view/structured-agent-session-projection' -import type { Tab } from '../../../../../../shared/tab-types' -import type { StructuredAgentSessionLaunchIntent } from '@/lib/launch-structured-agent-session' -import type { AppState } from '@/store/types' - -type TestStore = { - getState: () => AppState - setState: (state: Partial & { testRuntimeOwner?: string | null }) => void -} - -const mocks = vi.hoisted(() => { - const hoisted: { - store: TestStore | null - call: Mock - history: Mock - subscribeStatus: Mock - unsubscribe: Mock - createIntent: Mock - retryIntent: Mock - restoreIntent: Mock - launch: Mock - } = { - store: null, - call: vi.fn(), - history: vi.fn(), - subscribeStatus: vi.fn(), - unsubscribe: vi.fn(), - createIntent: vi.fn(), - retryIntent: vi.fn(), - restoreIntent: vi.fn(), - launch: vi.fn() - } - return hoisted -}) - -import { useAppStore } from '@/store' -mocks.store = useAppStore - -vi.mock('sonner', () => ({ toast: { error: vi.fn(), message: vi.fn() } })) - -vi.mock('@/lib/workspace/ownership/worktree-runtime-owner', () => ({ - getExecutionHostIdForWorktree: () => 'local' -})) - -vi.mock('../../../../runtime/native-chat/requests/structured-agent-session-call', () => ({ - callStructuredAgentSession: mocks.call -})) - -vi.mock('../../../../runtime/native-chat/requests/structured-agent-session-subscriptions', () => ({ - subscribeStructuredAgentSession: vi.fn(), - subscribeStructuredAgentSessionStatus: mocks.subscribeStatus -})) - -vi.mock('@/runtime/rpc/calls/runtime-rpc-call', () => ({ - callRuntimeRpc: mocks.history -})) -vi.mock('@/runtime/rpc/compatibility/runtime-compatibility-probe', () => ({ - ensureRuntimeEnvironmentCompatible: async () => {} -})) - -vi.mock('@/runtime/local-structured-session-tabs-sync/inventory-refresh', () => ({ - refreshLocalStructuredSessionTabs: vi.fn(async () => []) -})) - -const launchErrorMocks = vi.hoisted(() => { - class StructuredAgentSessionCreateRefusalError extends Error {} - return { StructuredAgentSessionCreateRefusalError } -}) - -vi.mock('@/lib/agent-session/launch/structured-agent-session-launch-errors', async () => ({ - ...(await vi.importActual( - '@/lib/agent-session/launch/structured-agent-session-launch-errors' - )), - ...launchErrorMocks -})) - -vi.mock('@/lib/agent-session/launch/structured-agent-session-launch-create-call', () => ({ - launchStructuredAgentSession: mocks.launch -})) - -vi.mock('@/lib/launch-structured-agent-session', () => { - return { - createStructuredAgentSessionLaunchIntent: mocks.createIntent, - retryStructuredAgentSessionLaunchIntent: mocks.retryIntent, - restoreStructuredAgentSessionLaunchIntent: mocks.restoreIntent, - abandonStructuredAgentSessionLaunchIntent: vi.fn(), - launchStructuredAgentSession: mocks.launch, - StructuredAgentSessionCreateRefusalError: - launchErrorMocks.StructuredAgentSessionCreateRefusalError - } -}) - -import { useRunningTerminalCloseConfirmStore } from '@/store/slices/tabs/closing/running-terminal-close-confirm' -import { StructuredAgentSessionStatusBridge } from './StructuredAgentSessionStatusBridge' -import { StructuredAgentSessionCreateRefusalError } from '@/lib/agent-session/launch/structured-agent-session-launch-errors' -import { - retryStructuredAgentSessionLaunch, - startStructuredAgentLaunch -} from '@/lib/agent-session/launch/structured-agent-session-launch' -import { resetStructuredAgentLaunchRegistryForTests } from '@/lib/agent-session/launch/structured-agent-session-launch-registry' -import { resetStructuredAgentLaunchPersistenceForTests } from '@/lib/agent-session/launch/structured-agent-session-launch-persistence' -import { resetStructuredAgentSessionStatusFeedsForTests } from '@/runtime/native-chat/status/structured-agent-session-status-feed' -import { - resetTerminalTabActivityFlagsCacheForTest, - resolveTerminalTabActivityStatus -} from '../../../tab-bar/terminal-tab-activity-status' - -import { countActivityUnread } from '../../../activity/useActivityUnreadCount' - -import { getDefaultSettings } from '../../../../../../shared/constants' -import { - sendStructuredAgentSessionMessage, - resetStructuredAgentSessionSendsForTests -} from '../structured/delivery/structured-agent-session-message-sender' -import { noteStructuredAgentSessionFence } from '../structured/delivery/structured-agent-session-send-attempt' - -async function closeChat(skipRunningProcessConfirm = false): Promise { - const { createWorkspaceTabCloseCommands } = - await import('../../../tab-group/workspace-tab-close-commands') - createWorkspaceTabCloseCommands({ - worktreeId: WORKTREE_ID, - groupTabs: [structuredTab] - }).closeItem(structuredTab.id, { skipRunningProcessConfirm }) -} - -const WORKTREE_ID = 'wt-1' -const SESSION_ID = 'session-1' -const TAB_CREATED_AT = 1_000 -const FAILED_AT = 10 * 60 * 60_000 -const PANE_KEY = structuredAgentSessionPaneKey(`structured-agent-session-${SESSION_ID}`, SESSION_ID) - -const structuredTab = { - id: `structured-agent-session-${SESSION_ID}`, - worktreeId: WORKTREE_ID, - groupId: 'group-1', - contentType: 'agent-session', - entityId: SESSION_ID, - label: 'Claude Chat', - customLabel: null, - color: null, - sortOrder: 0, - createdAt: TAB_CREATED_AT, - isPinned: false, - agentSessionAgent: 'claude', - executionHostId: 'local' -} satisfies Tab - -const intent: StructuredAgentSessionLaunchIntent = { - worktreeId: WORKTREE_ID, - sessionId: SESSION_ID, - executionHostId: 'local', - target: { kind: 'local' }, - agent: 'claude', - params: { - envelope: { - sessionId: SESSION_ID, - clientOperationId: 'operation-1', - expectedRuntimeFence: null, - payloadFingerprint: 'fingerprint-1' - }, - worktree: `id:${WORKTREE_ID}`, - agent: 'claude' - } -} - -function store(): TestStore { - if (!mocks.store) { - throw new Error('store missing') - } - return mocks.store -} - -function rows(): AgentStatusEntry[] { - return Object.values(store().getState().agentStatusByPaneKey) -} - -function tabStatus(): string { - const state = store().getState() - return resolveTerminalTabActivityStatus({ - tab: { id: structuredTab.id, title: structuredTab.label, launchAgent: 'claude' }, - agentStatusByPaneKey: state.agentStatusByPaneKey, - agentStatusEpoch: state.agentStatusEpoch - }) -} - -async function flush(): Promise { - for (let i = 0; i < 20; i += 1) { - await act(async () => { - await Promise.resolve() - }) - } -} - -async function connect(): Promise<(event: AgentSessionStatusEvent) => void> { - render() - await waitFor(() => expect(mocks.subscribeStatus).toHaveBeenCalledOnce()) - const emit: (event: AgentSessionStatusEvent) => void = mocks.subscribeStatus.mock.calls[0]?.[1] - // The host never created the session, so it publishes nothing for it. - act(() => emit({ type: 'snapshot', sessions: [] })) - return (event) => act(() => emit(event)) -} - -/** Preserve saved launches/acknowledgments across restart; drop live rows and launch memory. */ -async function restart(): Promise { - const { acknowledgedAgentsByPaneKey } = store().getState() - cleanup() - store().setState({ agentStatusByPaneKey: {}, acknowledgedAgentsByPaneKey }) - resetStructuredAgentLaunchRegistryForTests() - resetStructuredAgentLaunchPersistenceForTests() - resetStructuredAgentSessionStatusFeedsForTests() - resetTerminalTabActivityFlagsCacheForTest() - mocks.subscribeStatus.mockClear() - await connect() -} - -function setClock(now: number): void { - vi.spyOn(Date, 'now').mockReturnValue(now) -} - -function acknowledge(at: number): void { - store().setState({ acknowledgedAgentsByPaneKey: { [PANE_KEY]: at } }) -} - -function unread(): number { - return countActivityUnread(store().getState()) -} - -let failedStarts = 0 - -async function failStart(): Promise { - mocks.createIntent.mockReturnValueOnce(intent) - mocks.launch.mockRejectedValueOnce(new StructuredAgentSessionCreateRefusalError('refused')) - failedStarts += 1 - const launch = startStructuredAgentLaunch(WORKTREE_ID, 'claude', { - requestId: `request-${failedStarts}` - }) - await expect(launch.launchResult).rejects.toBeInstanceOf(StructuredAgentSessionCreateRefusalError) - await flush() -} - -const completeIdle: AgentSessionHistoryResult = { - ok: true, - page: { - sessionId: SESSION_ID, - epoch: 'e', - direction: 'tail', - items: [], - removedItemIds: [], - submissions: [], - window: { oldest: null, newest: null, nextCursor: { epoch: 'e', sequence: 1 } }, - hasOlder: false, - hasNewer: false, - latestTurn: null, - working: false, - actionablePromptIds: [], - backgroundTasks: null, - nextQueuedMessageId: null - } -} -const pendingClose = () => - useRunningTerminalCloseConfirmStore.getState().runningTerminalCloseConfirm -async function ready(mode = 'idle'): Promise { - const emit = await connect() - emit({ - type: 'status', - session: { - sessionId: SESSION_ID, - workspaceId: WORKTREE_ID, - agent: 'claude', - status: mode === 'idle' ? 'idle' : 'working', - latestPrompt: '', - updatedAt: 1 - } - }) - store().setState({ - settings: - mode === 'null settings' - ? null - : { - ...getDefaultSettings('/tmp/pr-34236'), - skipCloseTerminalWithRunningProcessConfirm: mode === 'opt-out' - } - }) - mocks.history.mockReset().mockResolvedValue(completeIdle) -} - -describe('a chat whose start failed', () => { - beforeEach(() => { - vi.clearAllMocks() - localStorage.clear() - resetStructuredAgentLaunchRegistryForTests() - resetStructuredAgentLaunchPersistenceForTests() - resetStructuredAgentSessionStatusFeedsForTests() - resetTerminalTabActivityFlagsCacheForTest() - mocks.subscribeStatus.mockResolvedValue({ unsubscribe: mocks.unsubscribe }) - mocks.retryIntent.mockImplementation((prior: StructuredAgentSessionLaunchIntent) => prior) - mocks.restoreIntent.mockReturnValue(intent) - store().setState({ - agentStatusByPaneKey: {}, - acknowledgedAgentsByPaneKey: {}, - retainedAgentsByPaneKey: {}, - unifiedTabsByWorktree: { [WORKTREE_ID]: [structuredTab] } - }) - }) - - afterEach(() => { - cleanup() - resetStructuredAgentSessionSendsForTests() - vi.useRealTimers() - useRunningTerminalCloseConfirmStore.getState().dismissRunningTerminalClose() - resetStructuredAgentSessionStatusFeedsForTests() - vi.restoreAllMocks() - }) - - it('stays read across a restart once seen, and a later failure is news again', async () => { - setClock(FAILED_AT) - await connect() - await failStart() - expect(rows()).toEqual([ - expect.objectContaining({ updatedAt: FAILED_AT, stateStartedAt: FAILED_AT }) - ]) - expect(unread()).toBe(1) - setClock(FAILED_AT + 60_000) - acknowledge(FAILED_AT + 60_000) - expect(unread()).toBe(0) - - await restart() - expect(rows()).toEqual([ - expect.objectContaining({ state: 'done', updatedAt: FAILED_AT, stateStartedAt: FAILED_AT }) - ]) - expect(unread()).toBe(0) - expect(tabStatus()).toBe('failed') - - setClock(FAILED_AT + 120_000) - mocks.launch.mockRejectedValueOnce(new StructuredAgentSessionCreateRefusalError('refused')) - act(() => { - retryStructuredAgentSessionLaunch(WORKTREE_ID, SESSION_ID) - }) - await flush() - expect(rows()).toEqual([ - expect.objectContaining({ - stateStartedAt: FAILED_AT + 120_000, - mainAgent: expect.objectContaining({ outcome: 'failure' }) - }) - ]) - expect(unread()).toBe(1) - }) - it('warns during real issued send and accepted handoff before status arrives', async () => { - await ready() - noteStructuredAgentSessionFence(SESSION_ID, 4) - const answer = Promise.withResolvers>() - mocks.call.mockReturnValue(answer.promise) - const sent = sendStructuredAgentSessionMessage({ - sessionId: SESSION_ID, - target: { kind: 'local' }, - text: 'continue' - }) - expect(sent).not.toBeNull() - await flush() - await closeChat() - expect(pendingClose()).not.toBeNull() - useRunningTerminalCloseConfirmStore.getState().dismissRunningTerminalClose() - answer.resolve({ - ok: true, - replayed: false, - fence: 4, - cursor: { epoch: 'e', sequence: 2 }, - value: { - clientMessageId: sent!.clientMessageId, - submission: { - clientMessageId: sent!.clientMessageId, - fence: 4, - payloadFingerprint: 'send', - dispatchState: 'accepted', - providerItemId: null, - reason: null, - submittedAt: 1, - resolvedAt: 2 - } - } - }) - expect(await sent!.outcome).toBe('recorded') - mocks.history.mockResolvedValue({ - ...completeIdle, - page: { ...completeIdle.page, working: true } - }) - await flush() - await closeChat() - await flush() - expect(pendingClose()).not.toBeNull() - expect(store().getState().unifiedTabsByWorktree[WORKTREE_ID]).toContainEqual(structuredTab) - }) -}) diff --git a/src/renderer/src/components/native-chat/session/status/structured-agent-session-status-bridge-unconfirmed-start.test.tsx b/src/renderer/src/components/native-chat/session/status/structured-agent-session-status-bridge-unconfirmed-start.test.tsx deleted file mode 100644 index 6fd6dc649d8..00000000000 --- a/src/renderer/src/components/native-chat/session/status/structured-agent-session-status-bridge-unconfirmed-start.test.tsx +++ /dev/null @@ -1,355 +0,0 @@ -import { markStructuredAgentSessionLaunchCancelled } from '@/lib/agent-session/launch/structured-agent-session-launch-cancel' -// @vitest-environment happy-dom - -// Lost create replies remain unmarked and recheck on reconnect; only confirmed failures earn failure marks. - -import type * as LaunchErrors from '@/lib/agent-session/launch/structured-agent-session-launch-errors' -import { act, cleanup, render, waitFor } from '@testing-library/react' -import { afterEach, beforeEach, describe, expect, it, vi, type Mock } from 'vitest' -import type { RuntimeMobileSessionTabsResult } from '../../../../../../shared/runtime-session-contracts' -import type { AgentStatusEntry } from '../../../../../../shared/agent-status/contracts/agent-status-types' -import type { Tab } from '../../../../../../shared/tab-types' -import type { StructuredAgentSessionLaunchIntent } from '@/lib/launch-structured-agent-session' -import type { AppState } from '@/store/types' - -type TestStore = { - getState: () => AppState - setState: (state: Partial) => void -} - -const mocks = vi.hoisted(() => { - const hoisted: { - store: TestStore | null - subscribeStatus: Mock - createIntent: Mock - restoreIntent: Mock - launch: Mock< - ( - intent: StructuredAgentSessionLaunchIntent, - onHostSeed?: unknown - ) => Promise<{ sessionId: string; fence: number }> - > - refresh: Mock - history: Mock - } = { - store: null, - subscribeStatus: vi.fn(), - createIntent: vi.fn(), - restoreIntent: vi.fn(), - launch: vi.fn(), - refresh: vi.fn(), - history: vi.fn() - } - return hoisted -}) - -vi.mock('@/store', async () => { - const { createTestStore } = await import('@/store/testing/app-store-test-fixture') - const useAppStore = createTestStore() - mocks.store = useAppStore - return { useAppStore } -}) - -vi.mock('sonner', () => ({ toast: { error: vi.fn(), message: vi.fn() } })) - -vi.mock('@/lib/workspace/ownership/worktree-runtime-owner', () => ({ - getExecutionHostIdForWorktree: () => 'local' -})) - -vi.mock('../../../../runtime/native-chat/requests/structured-agent-session-call', () => ({ - callStructuredAgentSession: mocks.history -})) - -vi.mock('../../../../runtime/native-chat/requests/structured-agent-session-subscriptions', () => ({ - subscribeStructuredAgentSession: vi.fn(), - subscribeStructuredAgentSessionStatus: mocks.subscribeStatus -})) - -vi.mock('@/runtime/local-structured-session-tabs-sync/inventory-refresh', () => ({ - refreshLocalStructuredSessionTabs: mocks.refresh -})) - -const launchErrorMocks = vi.hoisted(() => { - class StructuredAgentSessionCreateRefusalError extends Error {} - return { StructuredAgentSessionCreateRefusalError } -}) - -vi.mock('@/lib/agent-session/launch/structured-agent-session-launch-errors', async () => ({ - ...(await vi.importActual( - '@/lib/agent-session/launch/structured-agent-session-launch-errors' - )), - ...launchErrorMocks -})) - -vi.mock('@/lib/agent-session/launch/structured-agent-session-launch-create-call', () => ({ - launchStructuredAgentSession: mocks.launch -})) - -vi.mock('@/lib/launch-structured-agent-session', () => { - return { - createStructuredAgentSessionLaunchIntent: mocks.createIntent, - retryStructuredAgentSessionLaunchIntent: vi.fn((prior: unknown) => prior), - restoreStructuredAgentSessionLaunchIntent: mocks.restoreIntent, - abandonStructuredAgentSessionLaunchIntent: vi.fn(), - launchStructuredAgentSession: mocks.launch, - StructuredAgentSessionCreateRefusalError: - launchErrorMocks.StructuredAgentSessionCreateRefusalError - } -}) - -import { StructuredAgentSessionStatusBridge } from './StructuredAgentSessionStatusBridge' -import { ORCA_LAYOUT_OWNER_IS_MAIN } from '../../../../../../shared/layout-owner-switch' - -import { startStructuredAgentLaunch } from '@/lib/agent-session/launch/structured-agent-session-launch' -import { - getStructuredAgentSessionLaunchLifecycle, - resetStructuredAgentLaunchRegistryForTests -} from '@/lib/agent-session/launch/structured-agent-session-launch-registry' -import { resetStructuredAgentLaunchPersistenceForTests } from '@/lib/agent-session/launch/structured-agent-session-launch-persistence' -import { recheckUnconfirmedStructuredAgentLaunches } from '@/lib/agent-session/launch/structured-agent-session-launch-unconfirmed-recheck' -import { resetStructuredAgentSessionStatusFeedsForTests } from '@/runtime/native-chat/status/structured-agent-session-status-feed' -import { - resetTerminalTabActivityFlagsCacheForTest, - resolveTerminalTabActivityStatus -} from '../../../tab-bar/terminal-tab-activity-status' - -const WORKTREE_ID = 'wt-1' -const CLAUDE_SESSION = 'session-claude' -const CODEX_SESSION = 'session-codex' - -function chatTab(sessionId: string, agent: 'claude' | 'codex'): Tab { - return { - id: `structured-agent-session-${sessionId}`, - worktreeId: WORKTREE_ID, - groupId: 'group-1', - contentType: 'agent-session', - entityId: sessionId, - label: 'Chat', - customLabel: null, - color: null, - sortOrder: 0, - createdAt: 1_000, - isPinned: false, - agentSessionAgent: agent - } -} - -function launchIntent( - sessionId: string, - agent: 'claude' | 'codex' = 'claude' -): StructuredAgentSessionLaunchIntent { - return { - worktreeId: WORKTREE_ID, - sessionId, - executionHostId: 'local', - target: { kind: 'local' }, - agent, - params: { - envelope: { - sessionId, - clientOperationId: `operation-${sessionId}`, - expectedRuntimeFence: null, - payloadFingerprint: `fingerprint-${sessionId}` - }, - worktree: `id:${WORKTREE_ID}`, - agent - } - } -} - -function listing(...sessionIds: string[]): RuntimeMobileSessionTabsResult[] { - return [ - { - worktree: WORKTREE_ID, - publicationEpoch: 'epoch-1', - snapshotVersion: 1, - activeGroupId: null, - activeTabId: null, - activeTabType: null, - tabs: sessionIds.map((sessionId) => ({ - type: 'agent-session' as const, - id: `agent-session:${sessionId}`, - title: 'Chat', - sessionId, - agent: 'claude' as const, - isActive: false - })) - } - ] -} - -function store(): TestStore { - if (!mocks.store) { - throw new Error('store missing') - } - return mocks.store -} - -function rows(): AgentStatusEntry[] { - return Object.values(store().getState().agentStatusByPaneKey) -} - -function tabStatus(sessionId = CLAUDE_SESSION): string { - const state = store().getState() - return resolveTerminalTabActivityStatus({ - tab: { id: `structured-agent-session-${sessionId}`, title: 'Chat', launchAgent: 'claude' }, - agentStatusByPaneKey: state.agentStatusByPaneKey, - agentStatusEpoch: state.agentStatusEpoch - }) -} - -function lifecycle(sessionId = CLAUDE_SESSION): string | null { - return getStructuredAgentSessionLaunchLifecycle(WORKTREE_ID, sessionId) -} - -function createCalls(): number { - return mocks.launch.mock.calls.length -} - -async function flush(): Promise { - for (let i = 0; i < 30; i += 1) { - await act(async () => { - await Promise.resolve() - }) - } -} - -async function connect(): Promise { - render() - await waitFor(() => expect(mocks.subscribeStatus).toHaveBeenCalled()) - for (const [, emit] of mocks.subscribeStatus.mock.calls) { - act(() => emit({ type: 'snapshot', sessions: [] })) - } -} - -async function reload(): Promise { - cleanup() - store().setState({ agentStatusByPaneKey: {} }) - resetStructuredAgentLaunchRegistryForTests() - resetStructuredAgentLaunchPersistenceForTests() - resetStructuredAgentSessionStatusFeedsForTests() - resetTerminalTabActivityFlagsCacheForTest() - mocks.subscribeStatus.mockClear() - await connect() -} - -async function loseStart( - sessionId = CLAUDE_SESSION, - agent: 'claude' | 'codex' = 'claude' -): Promise { - mocks.createIntent.mockReturnValueOnce(launchIntent(sessionId, agent)) - const launch = startStructuredAgentLaunch(WORKTREE_ID, agent, { - requestId: `request-${sessionId}` - }) - await expect(launch.launchResult).rejects.toThrow('reply lost') - await flush() - expect(lifecycle(sessionId)).toBe('visibility-unknown') -} - -function hostIsReachableAgain(executionHostId: 'local' | `runtime:${string}` = 'local'): void { - act(() => recheckUnconfirmedStructuredAgentLaunches(executionHostId)) -} - -describe('a chat whose start was never confirmed', () => { - beforeEach(() => { - vi.clearAllMocks() - // Queued one-shot answers an earlier case left unconsumed must not leak into the next. - for (const mock of [mocks.createIntent, mocks.launch, mocks.refresh, mocks.restoreIntent]) { - mock.mockReset() - } - localStorage.clear() - resetStructuredAgentLaunchRegistryForTests() - resetStructuredAgentLaunchPersistenceForTests() - resetStructuredAgentSessionStatusFeedsForTests() - resetTerminalTabActivityFlagsCacheForTest() - mocks.subscribeStatus.mockResolvedValue({ unsubscribe: vi.fn() }) - mocks.launch.mockRejectedValue(new Error('reply lost')) - mocks.refresh.mockResolvedValue([]) - mocks.history.mockResolvedValue({ ok: true, page: { fence: 1 } }) - mocks.restoreIntent.mockImplementation((args: { sessionId: string }) => - launchIntent(args.sessionId) - ) - store().setState({ - agentStatusByPaneKey: {}, - acknowledgedAgentsByPaneKey: {}, - retainedAgentsByPaneKey: {}, - unifiedTabsByWorktree: { - [WORKTREE_ID]: [chatTab(CLAUDE_SESSION, 'claude'), chatTab(CODEX_SESSION, 'codex')] - } - }) - }) - - afterEach(() => { - cleanup() - resetStructuredAgentSessionStatusFeedsForTests() - }) - - it('re-checks a start a reload interrupted, without the user pressing Retry', async () => { - await connect() - mocks.createIntent.mockReturnValueOnce(launchIntent(CLAUDE_SESSION)) - mocks.launch.mockReturnValueOnce(new Promise(() => {})) - startStructuredAgentLaunch(WORKTREE_ID, 'claude', { requestId: `request-${CLAUDE_SESSION}` }) - await flush() - - await reload() - expect(lifecycle()).toBe('visibility-unknown') - expect(rows()).toEqual([]) - expect(tabStatus()).not.toBe('failed') - - mocks.launch.mockResolvedValueOnce({ sessionId: CLAUDE_SESSION, fence: 1 }) - mocks.refresh.mockResolvedValueOnce([]).mockResolvedValueOnce(listing(CLAUDE_SESSION)) - hostIsReachableAgain() - await flush() - - expect(mocks.launch).toHaveBeenLastCalledWith( - expect.objectContaining({ - sessionId: CLAUDE_SESSION, - params: expect.objectContaining({ - envelope: expect.objectContaining({ clientOperationId: `operation-${CLAUDE_SESSION}` }) - }) - }), - expect.any(Function), - true, - expect.any(Function) - ) - expect(lifecycle()).toBeNull() - expect(rows()).toEqual([]) - }) - - it('never re-creates a chat the user closed, before or after a reload', async () => { - await connect() - await loseStart(CLAUDE_SESSION, 'claude') - await loseStart(CODEX_SESSION, 'codex') - act(() => { - markStructuredAgentSessionLaunchCancelled( - WORKTREE_ID, - CLAUDE_SESSION, - 'local', - store().getState() - ) - }) - const creates = createCalls() - - hostIsReachableAgain() - await flush() - const recreated = (sessionId: string): number => - mocks.launch.mock.calls.slice(creates).filter(([intent]) => intent.sessionId === sessionId) - .length - expect(recreated(CODEX_SESSION)).toBe(1) - expect(recreated(CLAUDE_SESSION)).toBe(0) - - await reload() - hostIsReachableAgain() - await flush() - expect(recreated(CLAUDE_SESSION)).toBe(0) - if (ORCA_LAYOUT_OWNER_IS_MAIN) { - // Switch-on, main's host is told to close the chat instead of the window keeping a tombstone. - expect(mocks.history).toHaveBeenCalledWith({ kind: 'local' }, 'agentSession.close', { - sessionId: CLAUDE_SESSION - }) - expect(lifecycle(CLAUDE_SESSION)).toBeNull() - } else { - expect(lifecycle(CLAUDE_SESSION)).toBe('cancelled') - } - }) -}) diff --git a/src/renderer/src/components/native-chat/session/structured/delivery/NativeChatMessageList.unsent-message.test.tsx b/src/renderer/src/components/native-chat/session/structured/delivery/NativeChatMessageList.unsent-message.test.tsx deleted file mode 100644 index 844ae2b4b9b..00000000000 --- a/src/renderer/src/components/native-chat/session/structured/delivery/NativeChatMessageList.unsent-message.test.tsx +++ /dev/null @@ -1,224 +0,0 @@ -// @vitest-environment happy-dom - -// Unsent outbox messages stay below newer turns and their activity, without owning a turn bar. - -import '@testing-library/jest-dom/vitest' - -import { cleanup } from '@testing-library/react' -import { render } from '../../../messages/actions/native-chat-tooltip-test-harness' -import { afterAll, afterEach, beforeAll, describe, expect, it, vi } from 'vitest' - -// Why: these fixtures have neither inline visual owners nor sender navigation. -const unusedChatLeaves = vi.hoisted(() => ({ - inlineVisual: vi.fn(() => { - throw new Error('Unexpected inline visual in transcript fixture') - }), - openSender: vi.fn(() => { - throw new Error('Unexpected sender navigation in transcript fixture') - }) -})) -vi.mock('../../../media/visuals/NativeChatInlineVisual', () => ({ - NativeChatInlineVisual: unusedChatLeaves.inlineVisual -})) -vi.mock('@/lib/open-agent-message-sender', () => ({ - openAgentMessageSender: unusedChatLeaves.openSender -})) -afterEach(() => { - expect(unusedChatLeaves.inlineVisual).not.toHaveBeenCalled() - expect(unusedChatLeaves.openSender).not.toHaveBeenCalled() -}) -import type { - AgentJournalItemBody, - AgentJournalRenderItem, - AgentJournalSubmission -} from '../../../../../../../shared/agent-session/journal/agent-session-journal-types' -import type { AgentJournalTurnScope } from '../../../../../../../shared/agent-session/journal/agent-session-journal-turn-scope' -import { agentJournalSubmissionKey } from '../../../../../../../shared/agent-session/journal/agent-session-journal-item-key' -import type { NativeChatSettledTurns } from '../../../../../../../shared/native-chat/transcript/native-chat-turn-status' -import { DISPATCH_REJECTED_HOST_RESTARTED } from '../../../../../../../shared/agent-session/requests/structured-agent-session-dispatch-rejection' -import { NativeChatMessageList } from '../../../NativeChatMessageList' -import { structuredAgentSessionDeliveryNotices } from './structured-agent-session-delivery-notices' -import { installNativeChatMessageListTestViewport } from '../../../viewport/virtualization/native-chat-message-list-test-viewport' -import { projectStructuredAgentSessionMessages } from '../../../conversation/projection/structured-agent-session-message-projection' - -let restoreViewport = (): void => {} -beforeAll(() => { - restoreViewport = installNativeChatMessageListTestViewport() -}) -afterAll(() => restoreViewport()) -afterEach(cleanup) - -type Phase = 'in flight' | 'running' | 'done' - -const SEED = agentJournalSubmissionKey('seed') -const NEW = agentJournalSubmissionKey('new') - -function said(role: 'user' | 'assistant', text: string): AgentJournalItemBody { - return { kind: 'message', role, blocks: [{ type: 'text', text }] } -} - -function journal(phase: Phase, scoped: boolean): AgentJournalRenderItem[] { - const thread: AgentJournalTurnScope = { kind: 'thread' } - const row = ( - itemId: string, - body: AgentJournalItemBody, - turnScope: AgentJournalTurnScope - ): AgentJournalRenderItem => ({ - itemId, - revision: 0, - sequence: rows.length + 1, - observedAt: 1000 + rows.length, - body, - ...(scoped ? { turnScope } : {}) - }) - const rows: AgentJournalRenderItem[] = [] - rows.push(row(SEED, said('user', 'SEED PROMPT'), thread)) - rows.push( - row( - 'turn-seed', - { kind: 'turn', turnId: 'turn-seed', state: 'completed', userItemId: SEED }, - thread - ) - ) - rows.push( - row('seed-answer', said('assistant', 'SEED OK'), { kind: 'turn', turnItemId: 'turn-seed' }) - ) - rows.push(row(NEW, said('user', 'NEW PROMPT'), thread)) - if (phase !== 'in flight') { - rows.push( - row( - 'turn-new', - { - kind: 'turn', - turnId: 'turn-new', - state: phase === 'done' ? 'completed' : 'running', - userItemId: NEW - }, - thread - ) - ) - } - if (phase === 'done') { - rows.push( - row('new-answer', said('assistant', 'NEW OK'), { kind: 'turn', turnItemId: 'turn-new' }) - ) - } - return rows -} - -function submission( - id: string, - dispatchState: AgentJournalSubmission['dispatchState'] -): AgentJournalSubmission { - return { - clientMessageId: id, - fence: 1, - payloadFingerprint: id, - dispatchState, - providerItemId: null, - reason: null, - submittedAt: 1, - resolvedAt: null - } -} - -function drawn(container: HTMLElement): string[] { - const out: string[] = [] - for (const element of container.querySelectorAll('*')) { - if (element.hasAttribute('data-native-chat-turn-activity')) { - out.push('ACTIVITY') - } else if (element.hasAttribute('data-native-chat-turn-status')) { - out.push( - element.getAttribute('data-native-chat-turn-status') === 'active' ? 'WORKING' : 'WORKED' - ) - } else if (element.childElementCount === 0 && (element.textContent ?? '').endsWith('PROMPT')) { - out.push(element.textContent ?? '') - } - } - return out -} - -describe('a message the host rejected after a crash, with no outbox entry left', () => { - const LOST = agentJournalSubmissionKey('lost') - - function hostList(phase: Phase) { - const items = journal(phase, true) - const newIndex = items.findIndex((item) => item.itemId === NEW) - // Recorded between the seed's answer and the newer prompt; the next open rejected it. - items.splice(newIndex, 0, { - itemId: LOST, - revision: 0, - sequence: items[newIndex - 1]!.sequence, - sequenceIndex: 1, - observedAt: 1002.5, - body: said('user', 'LOST PROMPT'), - turnScope: { kind: 'thread' } - }) - const submissions: AgentJournalSubmission[] = [ - submission('seed', 'accepted'), - { - ...submission('lost', 'rejected'), - reason: DISPATCH_REJECTED_HOST_RESTARTED, - rejection: { kind: 'hostRestarted' } - }, - submission('new', phase === 'done' ? 'accepted' : 'pending') - ] - const settledTurns: NativeChatSettledTurns = new Map([ - [SEED, { startedAt: 1, workedSeconds: 3 }], - ...(phase === 'done' ? [[NEW, { startedAt: 2, workedSeconds: 5 }] as const] : []) - ]) - return ( - - ) - } - - it('draws it where it was sent, with its reason and no Retry, outside the newer turn', () => { - const { container, rerender } = render(hostList('running')) - expect(drawn(container)).toEqual([ - 'SEED PROMPT', - 'WORKED', - 'LOST PROMPT', - 'NEW PROMPT', - 'WORKING', - 'ACTIVITY' - ]) - expect(container.textContent).toContain('Orca restarted before this message was sent.') - expect(container.querySelector('button[aria-label="Retry"]')).toBeNull() - expect( - [...container.querySelectorAll('button')].map((button) => button.textContent) - ).not.toContain('Retry') - rerender(hostList('done')) - expect(drawn(container)).toEqual([ - 'SEED PROMPT', - 'WORKED', - 'LOST PROMPT', - 'NEW PROMPT', - 'WORKED' - ]) - expect(container.textContent).toContain('Worked for 5s') - }) -}) diff --git a/src/renderer/src/components/native-chat/subagents/NativeChatMessageList.subagent-sections.test.tsx b/src/renderer/src/components/native-chat/subagents/NativeChatMessageList.subagent-sections.test.tsx deleted file mode 100644 index 78427ceae40..00000000000 --- a/src/renderer/src/components/native-chat/subagents/NativeChatMessageList.subagent-sections.test.tsx +++ /dev/null @@ -1,230 +0,0 @@ -// @vitest-environment happy-dom - -import '@testing-library/jest-dom/vitest' - -import { cleanup, fireEvent, screen } from '@testing-library/react' -import { render } from '../messages/actions/native-chat-tooltip-test-harness' - -import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' - -// Why: these fixtures have neither inline visual owners nor sender navigation. -const unusedChatLeaves = vi.hoisted(() => ({ - inlineVisual: vi.fn(() => { - throw new Error('Unexpected inline visual in transcript fixture') - }), - openSender: vi.fn(() => { - throw new Error('Unexpected sender navigation in transcript fixture') - }) -})) -vi.mock('../media/visuals/NativeChatInlineVisual', () => ({ - NativeChatInlineVisual: unusedChatLeaves.inlineVisual -})) -vi.mock('@/lib/open-agent-message-sender', () => ({ - openAgentMessageSender: unusedChatLeaves.openSender -})) -import type { - AgentJournalItemBody, - AgentJournalProducerLinkage, - AgentJournalRenderItem -} from '../../../../../shared/agent-session/journal/agent-session-journal-types' - -import type { NativeChatSubagentState } from '../../../../../shared/native-chat/native-chat-types' - -import { projectStructuredItemsToNativeChat } from '../../../../../shared/agent-session/view/structured-agent-session-projection' - -import { NativeChatMessageList } from '../NativeChatMessageList' - -import { session, stubLayout } from '../viewport/virtualization/native-chat-windowing-test-harness' - -{ - function journalItem( - itemId: string, - body: AgentJournalItemBody, - sequence: number, - linkage: AgentJournalProducerLinkage = {} - ): AgentJournalRenderItem { - return { itemId, body, sequence, observedAt: sequence * 1000, revision: 1, ...linkage } - } - - const child: AgentJournalProducerLinkage = { agentId: 'task-1', producerKind: 'agent' } - const patch = '@@ -1 +1 @@\n-before\n+after' - const itemsWith = ( - state: NativeChatSubagentState, - answered: boolean - ): AgentJournalRenderItem[] => [ - journalItem( - 'ask', - { kind: 'message', role: 'user', blocks: [{ type: 'text', text: 'Review it' }] }, - 1 - ), - journalItem( - 'spawn', - { - kind: 'message', - role: 'system', - blocks: [ - { - type: 'subagent-group', - groupId: 'group-1', - agents: [{ id: 'task-1', label: 'explore the lane', state }] - } - ] - }, - 2 - ), - journalItem( - 'child-said', - { kind: 'message', role: 'assistant', blocks: [{ type: 'text', text: 'The PR is CLEAN.' }] }, - 3, - child - ), - journalItem( - 'child-edit', - { - kind: 'diff', - path: 'src/a.ts', - patch: { head: patch, truncated: false, digest: 'fixture', byteLength: patch.length } - }, - 4, - child - ), - ...(answered - ? [ - journalItem( - 'answer', - { - kind: 'message', - role: 'assistant', - blocks: [{ type: 'text', text: 'Delegated; nothing to fix.' }] - }, - 5 - ) - ] - : []) - ] - - /** `waiting`: the session runs and has produced nothing since the roster. */ - function listOf(state: NativeChatSubagentState, waiting = false): React.JSX.Element { - const items = itemsWith(state, !waiting) - return ( - - ) - } - - describe("a subagent's rows in the transcript", () => { - afterEach(cleanup) - let restoreLayout = (): void => {} - beforeEach(() => { - restoreLayout = stubLayout() - }) - afterEach(() => { - restoreLayout() - vi.restoreAllMocks() - }) - - // Journal turn records own subagent edits, even when a newer send is queued or the opener is unloaded. - it("counts a subagent's edit in the turn the journal says it was made in", () => { - const say = (itemId: string, role: 'user' | 'assistant', text: string, sequence: number) => - journalItem(itemId, { kind: 'message', role, blocks: [{ type: 'text', text }] }, sequence) - const turn = (turnId: string, userItemId: string, sequence: number) => - journalItem( - `turn-${turnId}`, - { kind: 'turn', turnId, state: 'completed', userItemId, startedAt: sequence * 1000 }, - sequence - ) - const childEdit = (itemId: string, path: string, sequence: number) => - journalItem( - itemId, - { - kind: 'diff', - path, - patch: { head: patch, truncated: false, digest: path, byteLength: patch.length } - }, - sequence, - child - ) - const [ask, spawn] = itemsWith('completed', false) - const items = [ - ask!, - turn('1', 'ask', 2), - { ...spawn!, sequence: 3 }, - say('ask-2', 'user', 'And the tests?', 4), - childEdit('child-edit', 'src/a.ts', 5), - say('answer-1', 'assistant', 'Edited a.', 6), - turn('2', 'ask-2', 7), - say('answer-2', 'assistant', 'Tests pass.', 8), - // Its opener is outside the loaded window, so the turn keys to its own record. - turn('3', 'older-send', 9), - childEdit('child-woke', 'src/b.ts', 10), - say('answer-3', 'assistant', 'Picked up the result.', 11) - ] - render( - - ) - const rollups = screen.getAllByRole('button', { name: /src\/[ab].ts/ }) - expect(rollups.map((rollup) => rollup.getAttribute('aria-label'))).toEqual([ - expect.stringMatching(/src\/a.ts/), - expect.stringMatching(/src\/b.ts/) - ]) - const inOrder = [ - screen.getByText('Edited a.'), - rollups[0]!, - screen.getByText('Tests pass.'), - screen.getByText('Picked up the result.'), - rollups[1]! - ] - for (const [index, node] of inOrder.slice(1).entries()) { - expect(inOrder[index]!.compareDocumentPosition(node)).toBe(Node.DOCUMENT_POSITION_FOLLOWING) - } - }) - - it('keeps a roster list open or closed past its row unmounting, and hides its sections while closed', () => { - const items = itemsWith('completed', true) - const view = (withRoster: boolean) => { - const shown = withRoster ? items : items.filter((next) => next.itemId !== 'spawn') - return ( - - ) - } - const { rerender } = render(view(true)) - fireEvent.click(screen.getByRole('button', { name: /Ran 1 subagent/ })) - fireEvent.click(screen.getByRole('button', { name: /explore the lane/, expanded: false })) - expect(screen.getByText('The PR is CLEAN.')).toBeInTheDocument() - - rerender(view(false)) - rerender(view(true)) - expect(screen.getByRole('button', { name: /Ran 1 subagent/, expanded: true })).toBeVisible() - - fireEvent.click(screen.getByRole('button', { name: /Ran 1 subagent/ })) - expect(screen.queryByText('The PR is CLEAN.')).toBeNull() - fireEvent.click(screen.getByRole('button', { name: /Ran 1 subagent/ })) - expect(screen.getByText('The PR is CLEAN.')).toBeInTheDocument() - }) - - it("keeps the reader's choice over the frontier, in either direction", () => { - const { rerender } = render(listOf('working', true)) - fireEvent.click(screen.getByRole('button', { name: /explore the lane/, expanded: true })) - rerender(listOf('working', true)) - expect(screen.queryByText('The PR is CLEAN.')).toBeNull() - - fireEvent.click(screen.getByRole('button', { name: /explore the lane/, expanded: false })) - rerender(listOf('working')) - expect(screen.getByText('The PR is CLEAN.')).toBeInTheDocument() - }) - }) -} diff --git a/src/renderer/src/components/native-chat/surfaces/integration/NativeChatMessageList.test.tsx b/src/renderer/src/components/native-chat/surfaces/integration/NativeChatMessageList.test.tsx deleted file mode 100644 index e3a09e7bfd0..00000000000 --- a/src/renderer/src/components/native-chat/surfaces/integration/NativeChatMessageList.test.tsx +++ /dev/null @@ -1,484 +0,0 @@ -// @vitest-environment happy-dom - -import '@testing-library/jest-dom/vitest' - -import { cleanup, fireEvent, screen } from '@testing-library/react' -import { render } from '../../messages/actions/native-chat-tooltip-test-harness' - -import { afterAll, afterEach, beforeAll, describe, expect, it, vi } from 'vitest' - -// Why: these fixtures have neither inline visual owners nor sender navigation. -const unusedChatLeaves = vi.hoisted(() => ({ - inlineVisual: vi.fn(() => { - throw new Error('Unexpected inline visual in transcript fixture') - }), - openSender: vi.fn(() => { - throw new Error('Unexpected sender navigation in transcript fixture') - }) -})) -vi.mock('../../media/visuals/NativeChatInlineVisual', () => ({ - NativeChatInlineVisual: unusedChatLeaves.inlineVisual -})) -vi.mock('@/lib/open-agent-message-sender', () => ({ - openAgentMessageSender: unusedChatLeaves.openSender -})) -afterEach(() => { - expect(unusedChatLeaves.inlineVisual).not.toHaveBeenCalled() - expect(unusedChatLeaves.openSender).not.toHaveBeenCalled() -}) - -import { subagentGroupFallbackText } from '../../../../../../shared/native-chat/transcript/native-chat-subagent-summary' - -import type { - NativeChatMessage, - NativeChatSubagentEntry -} from '../../../../../../shared/native-chat/native-chat-types' - -import type { NativeChatLiveSession } from '../../session/terminal/read/native-chat-live-session-contract' - -import { NativeChatMessageList } from '../../NativeChatMessageList' - -import { installNativeChatMessageListTestViewport } from '../../viewport/virtualization/native-chat-message-list-test-viewport' - -import type { AgentJournalRenderItem } from '../../../../../../shared/agent-session/journal/agent-session-journal-types' -import type { AgentJournalTurnScope } from '../../../../../../shared/agent-session/journal/agent-session-journal-turn-scope' - -{ - const session: NativeChatLiveSession = { - messages: [ - { - id: 'assistant-1', - role: 'assistant', - blocks: [{ type: 'text', text: 'Selectable agent response.' }], - timestamp: 1, - source: 'transcript' - } - ], - status: 'ready', - sessionId: 'session-1', - agent: 'codex', - hasMore: false, - loadingEarlier: false, - olderHistoryGeneration: 0, - loadEarlier: vi.fn(), - readPhase: 'ready' - } - - describe('NativeChatMessageList assistant messages', () => { - let restoreViewport = (): void => {} - beforeAll(() => { - restoreViewport = installNativeChatMessageListTestViewport() - }) - afterAll(() => restoreViewport()) - afterEach(cleanup) - it.each([true, false])( - 'copies selections across message roots from the transcript (math=%s)', - (math) => { - const sources = math - ? ['Before $x^2$ after.', 'Then \\(y_i\\).'] - : ['Before plain after.', 'Then plain.'] - const view = render( - ({ - id: `selection-${index}`, - role: 'assistant', - blocks: [{ type: 'text', text }], - timestamp: index + 1, - source: 'transcript' - })) - }} - isWorking={false} - expandSignal={false} - /> - ) - const transcript = view.container.querySelector('[data-native-chat-scroll]') - const paragraphs = view.container.querySelectorAll('[data-native-chat-quote-source] p') - if (!transcript || paragraphs.length !== 2) { - throw new Error('Missing transcript paragraphs') - } - const range = document.createRange() - range.setStart(paragraphs[0].firstChild ?? paragraphs[0], 0) - range.setEnd(paragraphs[1], paragraphs[1].childNodes.length) - const selection = document.getSelection() - selection?.removeAllRanges() - selection?.addRange(range) - for (const target of [paragraphs[0], transcript]) { - const setData = vi.fn() - const event = new Event('copy', { bubbles: true, cancelable: true }) - Object.defineProperty(event, 'clipboardData', { value: { setData } }) - fireEvent(target, event) - if (math) { - const copied = setData.mock.calls.find(([type]) => type === 'text/plain')?.[1] - expect(copied).toBe(sources.join('\n\n')) - expect(event.defaultPrevented).toBe(true) - } else { - expect(setData).not.toHaveBeenCalled() - expect(event.defaultPrevented).toBe(false) - } - } - const setData = vi.fn() - const handled = new Event('copy', { bubbles: true, cancelable: true }) - handled.preventDefault() - Object.defineProperty(handled, 'clipboardData', { value: { setData } }) - fireEvent(transcript, handled) - expect(setData).not.toHaveBeenCalled() - selection?.removeAllRanges() - } - ) - - // Prose settles the preceding run; reasoning asides remain inside it. - it('settles a run once prose follows it, but not for a reasoning aside', () => { - const run = { - id: 'assistant-tool-1', - role: 'assistant' as const, - blocks: [ - { - type: 'tool-call' as const, - name: 'shell', - input: { command: 'sleep 5' }, - state: 'running' as const - } - ], - timestamp: 1, - source: 'transcript' as const - } - const after = (role: 'assistant' | 'reasoning') => ({ - id: `after-${role}`, - role, - blocks: [{ type: 'text' as const, text: 'Looking at the output.' }], - timestamp: 2, - source: 'transcript' as const - }) - const { rerender } = render( - - ) - expect(screen.getByText('Running 1 command')).toBeInTheDocument() - - rerender( - - ) - expect(screen.queryByText('Running 1 command')).toBeNull() - expect(screen.getByText('sleep 5')).toBeInTheDocument() - }) - - it('keeps the current tool live when a stale completed lifecycle meets active hook state', () => { - render( - - ) - - expect(screen.getByText('Running 1 command')).toBeInTheDocument() - expect(screen.getByText('sleep 5')).toBeInTheDocument() - }) - }) - - // Exercise list assembly: folding, turn mapping and disclosure decide whether roster rows reach the DOM. - describe('NativeChatMessageList spawn-group roster', () => { - let restoreViewport = (): void => {} - beforeAll(() => { - restoreViewport = installNativeChatMessageListTestViewport() - }) - afterAll(() => restoreViewport()) - afterEach(cleanup) - const ROSTER: NativeChatSubagentEntry[] = [ - { id: 'a', label: 'read', state: 'completed' }, - { id: 'b', label: 'search', state: 'failed' } - ] - - /** Match the producer’s structured roster plus plain-text fallback for older clients. */ - function rosterMessage(agents: NativeChatSubagentEntry[], at: number): NativeChatMessage { - return { - id: 'roster-1', - role: 'system', - blocks: [ - { type: 'text', text: subagentGroupFallbackText(agents) }, - { type: 'subagent-group', groupId: 'thread-1:turn-1', agents } - ], - timestamp: at, - source: 'transcript' - } - } - - // Use ascending timestamps; equal times sort by id and can move the opener after its roster. - function rosterSession( - agents: NativeChatSubagentEntry[], - startedAt: number - ): NativeChatLiveSession { - return { - ...session, - status: 'ready', - messages: [ - { - id: 'user-fanout', - role: 'user', - blocks: [{ type: 'text', text: 'Fan this out' }], - timestamp: startedAt, - source: 'transcript' - }, - { - id: 'assistant-fanout', - role: 'assistant', - blocks: [ - { type: 'tool-call', name: 'shell', input: { command: 'pwd' }, state: 'completed' }, - { type: 'tool-result', output: '/repo' } - ], - timestamp: startedAt + 1, - source: 'transcript' - }, - rosterMessage(agents, startedAt + 2) - ] - } - } - - // Providers may fold a roster beside real prose; remove only its fallback twin. - it('keeps prose beside a roster block and drops only the twin', () => { - const startedAt = Date.now() - 3000 - const twin = subagentGroupFallbackText(ROSTER) - render( - - ) - - expect(screen.getByText('Handing the audit to two children.')).toBeInTheDocument() - expect(screen.getByRole('button', { name: /Ran 2 subagents/ })).toBeInTheDocument() - expect(screen.queryByText(twin)).toBeNull() - }) - - // A newer turn must not turn still-running children into completed or unverifiable agents. - it('keeps live children working after a newer turn supersedes their own', () => { - const startedAt = Date.now() - 3000 - const live = rosterSession( - [ - { id: 'a', label: 'read_readme', state: 'working', startedAt }, - { id: 'b', label: 'read_package', state: 'working', startedAt } - ], - startedAt - ) - render( - - ) - - const roster = screen.getByRole('button', { name: /Kicked off 2 subagents/ }) - expect(roster).toHaveTextContent('2 working') - expect(roster).not.toHaveTextContent('unverifiable') - expect(screen.queryByRole('button', { name: /Ran 2 subagents/ })).toBeNull() - }) - }) -} - -{ - const NARRATION = 'I am starting with the required readiness pass.' - const MORE_NARRATION = 'The branch is current and the reference corpus is refreshed.' - const ANSWER = 'Review complete: clean after fixes.' - - function session(startedAt: number): NativeChatLiveSession { - return { - messages: [ - { - id: 'user-1', - role: 'user', - blocks: [{ type: 'text', text: 'Please review this PR.' }], - timestamp: startedAt, - source: 'transcript' - }, - { - id: 'narration-1', - role: 'assistant', - blocks: [{ type: 'text', text: NARRATION }], - timestamp: startedAt + 1, - source: 'transcript' - }, - { - id: 'work-1', - role: 'assistant', - blocks: [ - { - type: 'tool-call', - name: 'shell', - input: { command: 'pnpm test' }, - state: 'completed' - }, - { type: 'tool-result', output: 'ok' } - ], - timestamp: startedAt + 2, - source: 'transcript' - }, - { - id: 'narration-2', - role: 'assistant', - blocks: [{ type: 'text', text: MORE_NARRATION }], - timestamp: startedAt + 3, - source: 'transcript' - }, - { - id: 'answer-1', - role: 'assistant', - blocks: [{ type: 'text', text: ANSWER }], - timestamp: startedAt + 4, - source: 'transcript' - } - ], - status: 'ready', - sessionId: 'session-1', - agent: 'codex', - hasMore: false, - loadingEarlier: false, - olderHistoryGeneration: 0, - loadEarlier: vi.fn(), - readPhase: 'ready' - } - } - - /** One turn owns every later row; statesScope=false models older hosts without row scopes. */ - function journalOf( - messages: readonly NativeChatMessage[], - statesScope: boolean - ): AgentJournalRenderItem[] { - const scope = (turnScope: AgentJournalTurnScope) => (statesScope ? { turnScope } : {}) - const [opener, ...rest] = messages - const entry = (message: NativeChatMessage, sequence: number): AgentJournalRenderItem => ({ - itemId: message.id, - revision: 0, - sequence, - observedAt: sequence, - body: { - kind: 'message', - role: message.role === 'user' ? 'user' : 'assistant', - blocks: [{ type: 'text', text: message.id }] - }, - ...scope({ kind: 'turn', turnItemId: 'turn-1' }) - }) - return [ - { ...entry(opener!, 1), ...scope({ kind: 'thread' }) }, - { - itemId: 'turn-1', - revision: 0, - sequence: 2, - observedAt: 2, - body: { kind: 'turn', turnId: 'turn-1', state: 'completed', userItemId: opener!.id }, - ...scope({ kind: 'thread' }) - }, - ...rest.map((message, index) => entry(message, index + 3)) - ] - } - - describe('NativeChatMessageList settled turn fold', () => { - let restoreViewport = (): void => {} - beforeAll(() => { - restoreViewport = installNativeChatMessageListTestViewport() - }) - afterAll(() => restoreViewport()) - afterEach(cleanup) - - // A mid-turn steer remains in the opener’s fold without gaining its own turn bar. - it.each([ - ['states each row’s turn', true], - ['states no scope', false] - ])( - "folds the rows after a mid-turn send behind the opener's bar on a host that %s", - (_host, statesScope) => { - const startedAt = Date.now() - 3000 - const base = session(startedAt) - const steer: (typeof base.messages)[number] = { - id: 'mid-b', - role: 'user', - blocks: [{ type: 'text', text: 'Also check the tests.' }], - timestamp: startedAt + 2, - source: 'transcript' - } - const messages = [...base.messages.slice(0, 3), steer, ...base.messages.slice(3)] - render( - - ) - - expect(screen.getByText('Also check the tests.')).toBeInTheDocument() - expect(screen.queryByText(NARRATION)).toBeNull() - expect(screen.queryByText(MORE_NARRATION)).toBeNull() - const toggles = screen.getAllByRole('button', { name: 'Toggle turn details' }) - expect(toggles).toHaveLength(1) - - fireEvent.click(toggles[0]!) - expect(screen.getByText(NARRATION)).toBeInTheDocument() - expect(screen.getByText(MORE_NARRATION)).toBeInTheDocument() - } - ) - }) -} diff --git a/src/renderer/src/components/native-chat/usage/NativeChatUsageLimitActions.tsx b/src/renderer/src/components/native-chat/usage/NativeChatUsageLimitActions.tsx index 5621382fb1a..ba2673addc3 100644 --- a/src/renderer/src/components/native-chat/usage/NativeChatUsageLimitActions.tsx +++ b/src/renderer/src/components/native-chat/usage/NativeChatUsageLimitActions.tsx @@ -5,34 +5,30 @@ import { useLayoutEffect, useMemo, useRef, - useState, - type ReactNode + useState } from 'react' +import type { ReactNode } from 'react' import { MessageSquarePlus } from 'lucide-react' import { Button } from '@/components/ui/button' import { useTranslate } from '@/i18n/use-translate' import { useAppStore } from '@/store/index' -import { structuredChatTabById } from '@/lib/structured-chat-tab-index' +import { structuredChatTabById } from '@/lib/agent-session/tab-identity/structured-chat-tab-index' import { useStructuredChatTabConversationName } from '@/runtime/native-chat/naming/structured-conversation-name' import { AgentSessionContinuationDialog } from '@/components/agent-session-continuation/AgentSessionContinuationDialog' -import { - buildAgentSessionContinuationPrompt, - type AgentSessionContinuationRequest -} from '@/lib/agent-session/context/agent-session-continuation' +import { buildAgentSessionContinuationPrompt } from '@/lib/agent-session/context/agent-session-continuation' +import type { AgentSessionContinuationRequest } from '@/lib/agent-session/context/agent-session-continuation' import { ClaudeSwitcherMenu } from '@/components/status-bar/ClaudeSwitcherMenu' import { ProviderAccountChatButton } from '@/components/status-bar/ProviderAccountChatButton' import { isTuiAgent } from '../../../../../shared/agent-launch/catalog/tui-agent-config' import { callStructuredAgentSession } from '@/runtime/native-chat/requests/structured-agent-session-call' -import type { AgentSessionOptionsResult } from '../../../../../shared/agent-session/options/agent-session-options-result' import { executionHostIdForStructuredTarget } from '@/runtime/native-chat/session-ownership/structured-agent-session-owner' -import { - NativeChatOrcaStopContext, - type NativeChatOrcaStopView -} from '@/components/native-chat/messages/notices/native-chat-orca-stop-context' +import { NativeChatOrcaStopContext } from '@/components/native-chat/messages/notices/native-chat-orca-stop-context' +import type { NativeChatOrcaStopView } from '@/components/native-chat/messages/notices/native-chat-orca-stop-context' +import { nativeChatMessageCopyText } from '../../../../../shared/native-chat/transcript/native-chat-message-copy-text' +import type { AgentSessionOptionsResult } from '../../../../../shared/agent-session/options/agent-session-options-result' import type { NativeChatMessage } from '../../../../../shared/native-chat/native-chat-types' import type { NativeChatStructuredViewProps } from '@/components/native-chat/native-chat-view-types' import type { NativeChatFileLinkContext } from '@/components/native-chat/links/actions/native-chat-file-link-context' -import { nativeChatMessageCopyText } from '../../../../../shared/native-chat/transcript/native-chat-message-copy-text' type UsageLimitActions = { account: ReactNode diff --git a/src/renderer/src/components/native-chat/viewport/history/NativeChatMessageList.older-history.test.tsx b/src/renderer/src/components/native-chat/viewport/history/NativeChatMessageList.older-history.test.tsx deleted file mode 100644 index 14df9d4defa..00000000000 --- a/src/renderer/src/components/native-chat/viewport/history/NativeChatMessageList.older-history.test.tsx +++ /dev/null @@ -1,429 +0,0 @@ -// @vitest-environment happy-dom -import { createRef, useSyncExternalStore } from 'react' -import type { NativeChatMessageListHandle } from '../../messages/actions/use-native-chat-reveal-latest' - -import '@testing-library/jest-dom/vitest' - -import { act, cleanup, fireEvent, screen } from '@testing-library/react' -import { render } from '../../messages/actions/native-chat-tooltip-test-harness' -import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' - -// Why: these fixtures have neither inline visual owners nor sender navigation. -const historyHost = vi.hoisted(() => ({ call: vi.fn(), subscribe: vi.fn() })) -vi.mock('../../../../runtime/native-chat/requests/structured-agent-session-call', () => ({ - callStructuredAgentSession: historyHost.call -})) - -vi.mock('../../../../runtime/native-chat/requests/structured-agent-session-subscriptions', () => ({ - subscribeStructuredAgentSession: historyHost.subscribe -})) - -const unusedChatLeaves = vi.hoisted(() => ({ - inlineVisual: vi.fn(() => { - throw new Error('Unexpected inline visual in transcript fixture') - }), - openSender: vi.fn(() => { - throw new Error('Unexpected sender navigation in transcript fixture') - }) -})) -vi.mock('../../media/visuals/NativeChatInlineVisual', () => ({ - NativeChatInlineVisual: unusedChatLeaves.inlineVisual -})) -vi.mock('@/lib/open-agent-message-sender', () => ({ - openAgentMessageSender: unusedChatLeaves.openSender -})) -afterEach(() => { - expect(unusedChatLeaves.inlineVisual).not.toHaveBeenCalled() - expect(unusedChatLeaves.openSender).not.toHaveBeenCalled() -}) -import type { NativeChatMessage } from '../../../../../../shared/native-chat/native-chat-types' -import { NativeChatMessageList } from '../../NativeChatMessageList' -import { createReadOwner } from '../../session/structured/read/structured-agent-session-read-owner-create' -import type { AgentSessionHistoryPage } from '../../../../../../shared/agent-session/agent-session-wire' -import { useAppStore } from '@/store' -import { transcriptWindowTop } from '../virtualization/native-chat-window-test-layout' -import type { NativeChatOlderPageResult } from './native-chat-pagination' -import type { NativeChatLiveSession } from '../../session/terminal/read/native-chat-live-session-contract' - -import { - layout, - marker, - session, - stubLayout, - stubResizeObserver -} from '../virtualization/native-chat-windowing-test-harness' - -// Unlike happy-dom, report on observe and whenever the sentinel crosses the prefetch edge. -type FakeObservation = { - callback: IntersectionObserverCallback - observer: IntersectionObserver - targets: Map -} -const observations = new Set() -const createdObservers: { root: Element | Document | null; rootMargin: string }[] = [] -let sentinelInRange = false - -class FakeIntersectionObserver implements IntersectionObserver { - readonly root: Element | Document | null - readonly rootMargin: string - readonly scrollMargin = '0px' - readonly thresholds: readonly number[] = [0] - private readonly observation: FakeObservation - constructor(callback: IntersectionObserverCallback, options: IntersectionObserverInit = {}) { - this.root = options.root ?? null - this.rootMargin = options.rootMargin ?? '0px' - this.observation = { callback, observer: this, targets: new Map() } - observations.add(this.observation) - createdObservers.push({ root: this.root, rootMargin: this.rootMargin }) - } - observe(target: Element): void { - this.observation.targets.set(target, null) - } - unobserve(target: Element): void { - this.observation.targets.delete(target) - } - disconnect(): void { - this.observation.targets.clear() - observations.delete(this.observation) - } - takeRecords(): IntersectionObserverEntry[] { - return [] - } -} - -function deliverIntersections(): void { - act(() => { - for (const observation of Array.from(observations)) { - const entries: IntersectionObserverEntry[] = [] - for (const [target, last] of observation.targets) { - if (last !== sentinelInRange) { - observation.targets.set(target, sentinelInRange) - entries.push({ - boundingClientRect: new DOMRect(), - intersectionRatio: sentinelInRange ? 1 : 0, - intersectionRect: new DOMRect(), - isIntersecting: sentinelInRange, - rootBounds: null, - target, - time: 0 - }) - } - } - if (entries.length > 0) { - observation.callback(entries, observation.observer) - } - } - }) -} - -async function settle(): Promise { - await act(async () => {}) -} - -const markers = (from: number, to: number): NativeChatMessage[] => - Array.from({ length: to - from }, (_, offset) => marker(from + offset)) - -/** The scroll root's `pt-10`, and the transcript column's `gap-5`. */ -const TOP_GUTTER_PX = 40 -const COLUMN_GAP_PX = 20 -/** In-flow chrome offsets the spacer by its height plus one flex-column gap. */ -const IN_FLOW_CHROME_PX = 32 - -function flowAboveSpacer(spacer: HTMLElement): number { - return transcriptWindowTop(spacer, TOP_GUTTER_PX, IN_FLOW_CHROME_PX + COLUMN_GAP_PX) -} - -type LoadEarlier = () => Promise - -function paging({ - messages, - loadEarlier, - hasMore = true, - loadingEarlier = false, - isVisible = true, - olderHistoryGeneration = 0, - readPhase = 'ready' -}: { - messages: NativeChatMessage[] - loadEarlier: LoadEarlier - hasMore?: boolean - loadingEarlier?: boolean - isVisible?: boolean - olderHistoryGeneration?: number - readPhase?: NativeChatLiveSession['readPhase'] -}): React.JSX.Element { - return ( - - ) -} - -afterEach(cleanup) - -describe('older history auto-load', () => { - let restoreLayout = (): void => {} - let restoreResizeObserver = (): void => {} - beforeEach(() => { - restoreLayout = stubLayout({ scrollGeometry: true, offsetChain: true }) - restoreResizeObserver = stubResizeObserver() - vi.stubGlobal('IntersectionObserver', FakeIntersectionObserver) - observations.clear() - createdObservers.length = 0 - sentinelInRange = false - layout.aboveTranscriptPx = 0 - layout.aboveSpacerPx = flowAboveSpacer - }) - afterEach(() => { - vi.useRealTimers() - vi.unstubAllGlobals() - restoreResizeObserver() - restoreLayout() - layout.aboveTranscriptPx = 0 - layout.aboveSpacerPx = null - }) - - it('keeps a returned window bounded through an intersecting sentinel and resumes on manual history intent', async () => { - restoreLayout() - restoreLayout = stubLayout({ - scrollGeometry: true, - offsetChain: true, - viewportHeight: () => 50 - }) - const handle = createRef() - let generation = 0 - let hasMore = true - const loadEarlier = vi.fn(async (): Promise => { - generation++ - hasMore = false - refresh() - return 'applied' - }) - const trimHistory = () => { - generation++ - refresh() - } - const element = () => ( - - ) - const view = render(element()) - function refresh() { - view.rerender(element()) - } - await settle() - // A send while already following preserves initial autofill. - act(() => handle.current?.revealLatest(true)) - expect(generation).toBe(0) - const scroller = view.container.querySelector('[data-native-chat-scroll]')! - fireEvent.wheel(scroller, { deltaY: -20 }) - scroller.scrollTop -= 20 - fireEvent.scroll(scroller) - // The send's near-end predicate remains true after a real departure. - act(() => handle.current?.revealLatest(true)) - sentinelInRange = true - deliverIntersections() - await settle() - deliverIntersections() - await settle() - expect(loadEarlier).not.toHaveBeenCalled() - fireEvent.click(screen.getByRole('button', { name: 'Load earlier messages' })) - await settle() - deliverIntersections() - expect(loadEarlier).toHaveBeenCalledOnce() - expect(screen.queryByRole('button', { name: 'Load earlier messages' })).toBeNull() - }) - - it('retires shared initial autofill across two views and still pages after deliberate history intent', async () => { - restoreLayout() - restoreLayout = stubLayout({ - scrollGeometry: true, - offsetChain: true, - viewportHeight: () => 50 - }) - const page = (oldest: number, direction: 'tail' | 'before'): AgentSessionHistoryPage => ({ - sessionId: 'shared-history', - epoch: 'epoch', - direction, - items: Array.from({ length: 200 }, (_, index) => ({ - itemId: `item-${oldest + index}`, - revision: 1, - sequence: oldest + index, - observedAt: oldest + index, - body: { - kind: 'message', - role: 'assistant', - blocks: [{ type: 'text', text: 'folded history' }] - } - })), - removedItemIds: [], - submissions: [], - window: { - oldest: { epoch: 'epoch', sequence: oldest }, - newest: { epoch: 'epoch', sequence: oldest + 199 }, - nextCursor: { epoch: 'epoch', sequence: oldest } - }, - liveCursor: { epoch: 'epoch', sequence: 2000 }, - hasOlder: true, - hasNewer: false - }) - historyHost.subscribe.mockResolvedValue({ unsubscribe: () => {} }) - historyHost.call.mockImplementation(async (_target, method, params) => { - if (method !== 'agentSession.history') { - throw new Error('Unexpected host call') - } - return { ok: true, page: page(params.cursor.sequence - 200, 'before') } - }) - const owner = createReadOwner('shared-history-test', 'shared-history', { kind: 'local' }) - owner.publishCreated(page(1801, 'tail')) - const deactivate = owner.activate({ - getState: useAppStore.getState, - subscribeRetryNow: () => () => {} - }) - const handle = createRef() - function View({ first = false }: { first?: boolean }) { - const snapshot = useSyncExternalStore(owner.subscribe, owner.getSnapshot) - return ( - - ) - } - try { - // Prime expanded source history before the live edge becomes intersecting. - for (let pageIndex = 0; pageIndex < 6; pageIndex++) { - await owner.loadOlder() - } - const view = render( - <> - - - - ) - await settle() - historyHost.call.mockClear() - const scroller = view.container.querySelector('[data-native-chat-scroll]')! - fireEvent.wheel(scroller, { deltaY: -20 }) - scroller.scrollTop -= 20 - fireEvent.scroll(scroller) - act(() => handle.current?.revealLatest(true)) - expect(owner.getSnapshot().state.items).toHaveLength(1024) - sentinelInRange = true - deliverIntersections() - await settle() - deliverIntersections() - await settle() - expect(historyHost.call).not.toHaveBeenCalled() - fireEvent.click(screen.getAllByRole('button', { name: 'Load earlier messages' })[1]!) - await settle() - expect(historyHost.call).toHaveBeenCalledOnce() - expect(owner.getSnapshot().state.items).toHaveLength(1224) - view.unmount() - } finally { - deactivate() - owner.dispose() - } - }) - - it('offers a manual load after a failed page, and resumes auto-loading once it succeeds', async () => { - const loadEarlier = vi - .fn() - .mockResolvedValueOnce('failed') - .mockResolvedValue('applied') - const base = markers(100, 150) - const { rerender } = render(paging({ messages: base, loadEarlier })) - sentinelInRange = true - deliverIntersections() - await settle() - - const retry = screen.getByRole('button', { name: 'Load earlier messages' }) - expect(screen.queryByRole('status')).not.toBeInTheDocument() - expect(observations.size).toBe(0) - sentinelInRange = false - deliverIntersections() - sentinelInRange = true - deliverIntersections() - expect(loadEarlier).toHaveBeenCalledTimes(1) - - fireEvent.click(retry) - await settle() - expect(loadEarlier).toHaveBeenCalledTimes(2) - expect(screen.queryByRole('button', { name: /load earlier/i })).not.toBeInTheDocument() - expect(screen.getByRole('status')).toBeInTheDocument() - - rerender(paging({ messages: base, loadEarlier, loadingEarlier: true })) - rerender(paging({ messages: [...markers(80, 100), ...base], loadEarlier })) - deliverIntersections() - expect(loadEarlier).toHaveBeenCalledTimes(3) - }) - - // Without this the recreated observer would ask for the same stuck page forever. - it('stops auto-loading, and offers a manual load, when a page made no progress', async () => { - const loadEarlier = vi.fn().mockResolvedValue('unchanged') - const base = markers(100, 150) - const { rerender } = render(paging({ messages: base, loadEarlier })) - sentinelInRange = true - deliverIntersections() - rerender(paging({ messages: base, loadEarlier, loadingEarlier: true })) - rerender(paging({ messages: base, loadEarlier })) - await settle() - deliverIntersections() - - expect(loadEarlier).toHaveBeenCalledTimes(1) - expect(observations.size).toBe(0) - expect(screen.getByRole('button', { name: 'Load earlier messages' })).toBeInTheDocument() - }) - - // Reconnect/reset starts a new paging generation and clears that generation’s failure. - it('resumes auto-loading, with no click, once the lane resets its paging generation', async () => { - const loadEarlier = vi - .fn() - .mockResolvedValueOnce('failed') - .mockResolvedValue('applied') - const base = markers(100, 150) - const { rerender } = render(paging({ messages: base, loadEarlier })) - sentinelInRange = true - deliverIntersections() - await settle() - expect(screen.getByRole('button', { name: 'Load earlier messages' })).toBeInTheDocument() - - rerender(paging({ messages: base, loadEarlier, olderHistoryGeneration: 1 })) - deliverIntersections() - - expect(loadEarlier).toHaveBeenCalledTimes(2) - expect(screen.queryByRole('button', { name: /load earlier/i })).not.toBeInTheDocument() - }) -}) diff --git a/src/renderer/src/components/native-chat/viewport/navigation/NativeChatMessageList.rail-history-jump.test.tsx b/src/renderer/src/components/native-chat/viewport/navigation/NativeChatMessageList.rail-history-jump.test.tsx deleted file mode 100644 index f4e5b364816..00000000000 --- a/src/renderer/src/components/native-chat/viewport/navigation/NativeChatMessageList.rail-history-jump.test.tsx +++ /dev/null @@ -1,354 +0,0 @@ -// @vitest-environment happy-dom - -import '@testing-library/jest-dom/vitest' - -import { act, cleanup, fireEvent, screen } from '@testing-library/react' -import { render } from '../../messages/actions/native-chat-tooltip-test-harness' -import { useCallback, useMemo, useState } from 'react' -import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' - -// Why: these fixtures have neither inline visual owners nor sender navigation. -const unusedChatLeaves = vi.hoisted(() => ({ - inlineVisual: vi.fn(() => { - throw new Error('Unexpected inline visual in transcript fixture') - }), - openSender: vi.fn(() => { - throw new Error('Unexpected sender navigation in transcript fixture') - }) -})) -vi.mock('../../media/visuals/NativeChatInlineVisual', () => ({ - NativeChatInlineVisual: unusedChatLeaves.inlineVisual -})) -vi.mock('@/lib/open-agent-message-sender', () => ({ - openAgentMessageSender: unusedChatLeaves.openSender -})) -afterEach(() => { - expect(unusedChatLeaves.inlineVisual).not.toHaveBeenCalled() - expect(unusedChatLeaves.openSender).not.toHaveBeenCalled() -}) -import type { NativeChatMessage } from '../../../../../../shared/native-chat/native-chat-types' -import { NativeChatMessageList } from '../../NativeChatMessageList' -import { - transcriptRowOffset, - transcriptWindowTop -} from '../virtualization/native-chat-window-test-layout' -import type { NativeChatRailOutlineEntry } from '../rail/native-chat-message-rail-items' -import type { NativeChatOlderPageResult } from '../history/native-chat-pagination' -import { - estimateNativeChatRowHeight, - nativeChatRowContentMetrics -} from '../virtualization/native-chat-row-height-estimate' -import { - deliverResizes, - layout, - marker, - overrideLayoutProperty, - session, - stubLayout, - stubResizeObserver -} from '../virtualization/native-chat-windowing-test-harness' - -afterEach(cleanup) - -const TOTAL = 60 -const PAGE = 20 -/** The scroll root's top gutter, always present. */ -const TOP_GUTTER_PX = 40 -/** In-flow older-history chrome disappears with the last page. */ -const OLDER_HISTORY_ROW_PX = 52 - -function message(index: number): NativeChatMessage { - return index % 5 === 0 - ? { - id: `message-${index}`, - role: 'user', - blocks: [{ type: 'text', text: `prompt-${index}` }], - timestamp: index + 1, - source: 'transcript' - } - : marker(index) -} - -const HISTORY = Array.from({ length: TOTAL }, (_, index) => message(index)) - -/** Every row measures exactly as estimated, so nothing but the jump moves the view. */ -const ROW_HEIGHT_BY_TEXT = new Map( - HISTORY.map((entry) => [ - entry.blocks[0]?.type === 'text' ? entry.blocks[0].text : '', - estimateNativeChatRowHeight(nativeChatRowContentMetrics(entry), { - hasReceipt: false, - hasStatus: false, - hasTurnDiff: false - }) - ]) -) - -/** Publish each page before settling its promise; the outline also includes unloaded prompts. */ -function PagedTranscript({ - holdPage -}: { - /** Awaited before a page lands, to keep it in flight. */ - holdPage?: () => Promise -}): React.JSX.Element { - const [loaded, setLoaded] = useState(PAGE) - const loadEarlier = useCallback(async (): Promise => { - await (holdPage?.() ?? Promise.resolve()) - setLoaded((current) => Math.min(TOTAL, current + PAGE)) - return 'applied' - }, [holdPage]) - const messages = useMemo(() => HISTORY.slice(TOTAL - loaded), [loaded]) - const railOutline = useMemo( - () => - HISTORY.slice(0, TOTAL - loaded) - .filter((entry) => entry.role === 'user') - .map((entry) => ({ - id: entry.id, - text: entry.blocks[0]?.type === 'text' ? entry.blocks[0].text : '', - hasImages: false - })), - [loaded] - ) - return ( - - ) -} - -function rowText(row: HTMLElement): string { - return /(?:prompt|marker)-\d+/.exec(row.querySelector('p')?.textContent ?? '')?.[0] ?? '' -} - -// A jump must detach end-follow and retain its landing as older history arrives. -describe('jumping from the rail while following the end', () => { - let restore: (() => void)[] = [] - let lastEventScrollTop = 0 - - beforeEach(() => { - vi.useFakeTimers({ - toFake: [ - 'Date', - 'performance', - 'setTimeout', - 'clearTimeout', - 'requestAnimationFrame', - 'cancelAnimationFrame' - ] - }) - const undoLayout = stubLayout({ scrollGeometry: true, offsetChain: true }) - const stubbedHeight = Object.getOwnPropertyDescriptor(HTMLElement.prototype, 'offsetHeight') - restore = [ - undoLayout, - stubResizeObserver(), - overrideLayoutProperty('offsetHeight', { - get(this: HTMLElement): number { - const estimated = - this.dataset.index === undefined ? undefined : ROW_HEIGHT_BY_TEXT.get(rowText(this)) - return estimated ?? stubbedHeight?.get?.call(this) ?? 0 - } - }), - // The rail stands down in a narrow pane. - overrideLayoutProperty('clientWidth', { get: () => 800 }), - // Rows sit at their `top` inside the spacer, which sits under the chrome. - overrideLayoutProperty('offsetTop', { - get(this: HTMLElement): number { - if (this.hasAttribute('data-native-chat-window')) { - return layout.aboveTranscriptPx - } - return this.dataset.index === undefined ? 0 : transcriptRowOffset(this) - } - }), - overrideLayoutProperty('offsetParent', { - get(this: HTMLElement): HTMLElement | null { - if (this.dataset.index !== undefined) { - return this.closest('[data-native-chat-window]') - } - return this.parentElement?.closest('[data-native-chat-scroll]') ?? null - } - }) - ] - // The older-history row counts only while it sits in the column's flow. - Object.defineProperty(layout, 'aboveTranscriptPx', { - configurable: true, - get: () => - transcriptWindowTop( - document.querySelector('[data-native-chat-window]'), - TOP_GUTTER_PX, - OLDER_HISTORY_ROW_PX - ) - }) - vi.spyOn(HTMLElement.prototype, 'scrollTo').mockImplementation(function scrollTo( - this: HTMLElement, - options?: ScrollToOptions | number - ): void { - if (typeof options === 'object' && options.top !== undefined) { - this.scrollTop = options.top - } - }) - lastEventScrollTop = 0 - }) - - afterEach(() => { - vi.useRealTimers() - vi.restoreAllMocks() - Object.defineProperty(layout, 'aboveTranscriptPx', { - configurable: true, - writable: true, - value: 0 - }) - for (const undo of restore.toReversed()) { - undo() - } - }) - - function scroller(): HTMLElement { - const element = document.querySelector('[data-native-chat-scroll]') - if (!element) { - throw new Error('no transcript scroll root') - } - return element - } - - /** Deliver layout changes and scroll events before the virtualizer's next frame. */ - async function frame(): Promise { - const element = scroller() - act(() => { - // The stubbed setter clamps, so re-writing the offset applies a shrink. - const offset = element.scrollTop - element.scrollTop = offset - deliverResizes() - }) - if (element.scrollTop !== lastEventScrollTop) { - lastEventScrollTop = element.scrollTop - fireEvent.scroll(element) - } - await act(async () => { - vi.advanceTimersByTime(16) - }) - } - - async function settle(frames: number): Promise { - for (let index = 0; index < frames; index += 1) { - await frame() - } - } - - function distanceFromBottom(): number { - const element = scroller() - return element.scrollHeight - element.clientHeight - element.scrollTop - } - - function rowOffsetFromViewportTop(prompt: string): number { - const row = screen.getByText(prompt).closest('[data-index]') - if (!row) { - throw new Error(`${prompt} has no mounted row`) - } - return layout.aboveTranscriptPx + row.offsetTop - scroller().scrollTop - } - - it('lets a later pick of a loaded message win over a jump still paging', async () => { - let releaseFirstPage: (() => void) | null = null - let held = false - const holdPage = (): Promise => { - if (held) { - return Promise.resolve() - } - held = true - return new Promise((resolve) => { - releaseFirstPage = resolve - }) - } - render() - await settle(10) - - fireEvent.click(screen.getByRole('button', { name: 'prompt-5' })) - await frame() - expect(releaseFirstPage).not.toBeNull() - fireEvent.click(screen.getByRole('button', { name: 'prompt-45' })) - await settle(40) - act(() => releaseFirstPage?.()) - await settle(60) - - // The superseded jump would have kept paging and pulled the reader to prompt-5. - expect(screen.queryByText('prompt-5')).toBeNull() - expect(Math.abs(rowOffsetFromViewportTop('prompt-45'))).toBeLessThanOrEqual(2) - }) - /** Holds the first older page in flight until released; later pages land at once. */ - function holdFirstPage(): { - holdPage: () => Promise - release: () => void - asked: () => number - } { - let release: (() => void) | null = null - let asked = 0 - return { - holdPage: () => { - asked += 1 - return asked > 1 - ? Promise.resolve() - : new Promise((resolve) => { - release = resolve - }) - }, - release: () => act(() => release?.()), - asked: () => asked - } - } - - async function pickUnloadedWhilePaging(prompt: string): Promise { - fireEvent.click(screen.getByRole('button', { name: prompt })) - await frame() - } - - it.each([ - ['a wheel over the transcript', () => fireEvent.wheel(scroller(), { deltaY: -40 })], - ['a scroll key', () => fireEvent.keyDown(scroller(), { key: 'PageUp' })], - ['a touch drag', () => fireEvent.touchMove(scroller())], - ['a scrollbar grab', () => fireEvent.pointerDown(scroller())] - ])('leaves the reader where they are after %s while the jump pages', async (_case, input) => { - const pages = holdFirstPage() - render() - await settle(10) - await pickUnloadedWhilePaging('prompt-5') - expect(pages.asked()).toBe(1) - - expect(screen.getByRole('button', { name: 'prompt-5' }).getAttribute('aria-busy')).toBe('true') - - input() - await frame() - expect(screen.getByRole('button', { name: 'prompt-5' }).getAttribute('aria-busy')).toBeNull() - pages.release() - await settle(60) - - // The abandoned jump would have paged on and pulled the reader up to prompt-5. - expect(pages.asked()).toBe(1) - expect(screen.queryByText('prompt-5')).toBeNull() - expect(distanceFromBottom()).toBe(0) - }) - - it('stays at the latest message when "Jump to latest" is pressed while the jump pages', async () => { - const pages = holdFirstPage() - render() - await settle(10) - // A reader parked above the end, so the button shows. - act(() => { - fireEvent.wheel(scroller(), { deltaY: -100 }) - scroller().scrollTop = 200 - }) - await settle(2) - await pickUnloadedWhilePaging('prompt-5') - expect(pages.asked()).toBe(1) - - fireEvent.click(screen.getByRole('button', { name: 'Jump to latest' })) - await frame() - pages.release() - await settle(60) - - expect(pages.asked()).toBe(1) - expect(screen.queryByText('prompt-5')).toBeNull() - expect(distanceFromBottom()).toBe(0) - }) -}) diff --git a/src/renderer/src/components/native-chat/viewport/virtualization/NativeChatMessageList.windowing.test.tsx b/src/renderer/src/components/native-chat/viewport/virtualization/NativeChatMessageList.windowing.test.tsx deleted file mode 100644 index a3436b4ad22..00000000000 --- a/src/renderer/src/components/native-chat/viewport/virtualization/NativeChatMessageList.windowing.test.tsx +++ /dev/null @@ -1,307 +0,0 @@ -// @vitest-environment happy-dom - -import '@testing-library/jest-dom/vitest' - -import { act, cleanup, fireEvent, screen } from '@testing-library/react' -import { render } from '../../messages/actions/native-chat-tooltip-test-harness' -import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' - -// Why: these fixtures have neither inline visual owners nor sender navigation. -const unusedChatLeaves = vi.hoisted(() => ({ - inlineVisual: vi.fn(() => { - throw new Error('Unexpected inline visual in transcript fixture') - }), - openSender: vi.fn(() => { - throw new Error('Unexpected sender navigation in transcript fixture') - }) -})) -vi.mock('../../media/visuals/NativeChatInlineVisual', () => ({ - NativeChatInlineVisual: unusedChatLeaves.inlineVisual -})) -vi.mock('@/lib/open-agent-message-sender', () => ({ - openAgentMessageSender: unusedChatLeaves.openSender -})) -import type { - AgentJournalItemBody, - AgentJournalRenderItem -} from '../../../../../../shared/agent-session/journal/agent-session-journal-types' -import { projectStructuredItemsToNativeChat } from '../../../../../../shared/agent-session/view/structured-agent-session-projection' -import { NativeChatMessageList } from '../../NativeChatMessageList' -import { NATIVE_CHAT_BOTTOM_THRESHOLD_PX } from '../scroll/native-chat-autoscroll' - -import { - deliverResizes, - list, - marker, - scrollTranscript, - session, - stubLayout, - stubResizeObserver, - TRANSCRIPT_LENGTH, - windowState -} from './native-chat-windowing-test-harness' - -afterEach(cleanup) - -function scrollRoot(container: HTMLElement): HTMLElement { - const scroller = container.querySelector('[data-native-chat-scroll]') - if (!scroller) { - throw new Error('no transcript scroll root') - } - return scroller -} - -/** Deliver resize and scroll events to a fixed point, as a painted frame would. */ -function paint(container: HTMLElement): void { - const scroller = scrollRoot(container) - let lastScrollTop = scroller.scrollTop - for (let pass = 0; pass < 12; pass += 1) { - let changed = false - act(() => { - changed = deliverResizes() - }) - if (scroller.scrollTop !== lastScrollTop) { - lastScrollTop = scroller.scrollTop - fireEvent.scroll(scroller) - changed = true - } - if (!changed) { - return - } - } - throw new Error('the transcript never settled: resize and scroll kept moving it') -} - -async function settleVirtualizer(container: HTMLElement): Promise { - for (let frame = 0; frame < 2; frame += 1) { - paint(container) - await act(async () => { - await new Promise((resolve) => requestAnimationFrame(() => resolve())) - }) - } - paint(container) -} - -describe('windowed transcript', () => { - let restoreLayout = (): void => {} - beforeEach(() => { - restoreLayout = stubLayout() - }) - afterEach(() => { - restoreLayout() - }) - - const transcript = Array.from({ length: TRANSCRIPT_LENGTH }, (_, index) => marker(index)) - - it('still has the tool run open when the row carrying it comes back', () => { - const withTool = [...transcript] - withTool[1] = { - ...marker(1), - blocks: [ - { type: 'text', text: 'marker-1' }, - { type: 'tool-call', name: 'shell', input: { command: 'ls' }, state: 'completed' } - ] - } - const { container } = render(list(withTool)) - - const header = screen.getByRole('button', { name: /^ls/ }) - expect(header).toHaveAttribute('aria-expanded', 'false') - fireEvent.click(header) - expect(screen.getByRole('button', { name: /^ls/ })).toHaveAttribute('aria-expanded', 'true') - - scrollTranscript(container, 5000) - expect(windowState(container).indexes).not.toContain(1) - expect(screen.queryByRole('button', { name: /^ls/ })).toBeNull() - - scrollTranscript(container, 0) - expect(screen.getByRole('button', { name: /^ls/ })).toHaveAttribute('aria-expanded', 'true') - }) -}) - -// Diff reveals name and pin an earlier, possibly unmounted message until its card can answer. -describe('revealing a diff from a turn rollup', () => { - let restoreLayout = (): void => {} - beforeEach(() => { - restoreLayout = stubLayout() - }) - afterEach(() => { - restoreLayout() - vi.restoreAllMocks() - }) - - function journalItem(itemId: string, body: AgentJournalItemBody, sequence: number) { - return { itemId, body, sequence, observedAt: sequence * 1000, revision: 1 } - } - - const patch = '@@ -1 +1 @@\n-before\n+after' - const items: AgentJournalRenderItem[] = [ - journalItem( - 'user', - { kind: 'message', role: 'user', blocks: [{ type: 'text', text: 'Edit it' }] }, - 1 - ), - journalItem( - 'diff', - { - kind: 'diff', - path: 'src/a.ts', - patch: { head: patch, truncated: false, digest: 'fixture', byteLength: patch.length } - }, - 2 - ), - ...Array.from({ length: TRANSCRIPT_LENGTH }, (_, index) => - journalItem( - `tail-${index}`, - { kind: 'message', role: 'assistant', blocks: [{ type: 'text', text: `marker-${index}` }] }, - index + 3 - ) - ) - ] - - it('opens an old edit inline at the visible turn outcome without mounting its source row', () => { - const scrollTo = vi.fn() - vi.spyOn(HTMLElement.prototype, 'scrollTo').mockImplementation(scrollTo) - const { container } = render( - - ) - // The pinned tail holds the rollup; its target diff has scrolled out of the window. - scrollTranscript(container, 4000) - expect(screen.queryByRole('button', { name: /^Edited .*a\.ts(?:\s|$)/ })).toBeNull() - - scrollTo.mockClear() - fireEvent.click(screen.getByRole('button', { name: /src\/a.ts/ })) - - expect(screen.getByText('Edited')).toBeInTheDocument() - expect(screen.getByText('after')).toBeInTheDocument() - expect(scrollTo).not.toHaveBeenCalled() - }) -}) - -describe('transcript with a hidden scroll root', () => { - it('preserves a detached viewport when messages append while hidden', async () => { - let isVisible = true - const restoreLayout = stubLayout({ - scrollGeometry: true, - isVisible: () => isVisible - }) - const restoreResizeObserver = stubResizeObserver() - const initialMessages = Array.from({ length: 120 }, (_, index) => marker(index)) - const appendedMessages = [ - ...initialMessages, - ...Array.from({ length: 20 }, (_, index) => marker(120 + index)) - ] - try { - const { container, rerender } = render(list(initialMessages, isVisible)) - await settleVirtualizer(container) - - const scroller = scrollRoot(container) - const readingAt = 2_000 - scrollTranscript(container, readingAt) - await settleVirtualizer(container) - expect(screen.getByRole('button', { name: /jump to latest/i })).toBeInTheDocument() - - isVisible = false - rerender(list(initialMessages, isVisible)) - await settleVirtualizer(container) - const scrollTo = vi.spyOn(scroller, 'scrollTo') - try { - rerender(list(appendedMessages, isVisible)) - await settleVirtualizer(container) - expect(scrollTo).not.toHaveBeenCalled() - } finally { - scrollTo.mockRestore() - } - - isVisible = true - rerender(list(appendedMessages, isVisible)) - await settleVirtualizer(container) - - expect(scroller.scrollTop).toBe(readingAt) - expect(screen.getByRole('button', { name: /jump to latest/i })).toBeInTheDocument() - } finally { - restoreResizeObserver() - restoreLayout() - } - }) - - it('preserves a detached viewport when a structured session catches up after reveal', async () => { - let isVisible = true - const restoreLayout = stubLayout({ - scrollGeometry: true, - isVisible: () => isVisible - }) - const restoreResizeObserver = stubResizeObserver() - const initialMessages = Array.from({ length: 120 }, (_, index) => marker(index)) - const appendedMessages = [ - ...initialMessages, - ...Array.from({ length: 20 }, (_, index) => marker(120 + index)) - ] - try { - const { container, rerender } = render(list(initialMessages, isVisible)) - await settleVirtualizer(container) - - const scroller = scrollRoot(container) - const readingAt = 2_000 - scrollTranscript(container, readingAt) - await settleVirtualizer(container) - expect(screen.getByRole('button', { name: /jump to latest/i })).toBeInTheDocument() - - isVisible = false - rerender(list(initialMessages, isVisible)) - await settleVirtualizer(container) - isVisible = true - rerender(list(initialMessages, isVisible)) - // The resumed transport can publish catch-up before the reveal write emits a scroll event. - rerender(list(appendedMessages, isVisible)) - await settleVirtualizer(container) - - expect(scroller.scrollTop).toBe(readingAt) - expect(screen.getByRole('button', { name: /jump to latest/i })).toBeInTheDocument() - } finally { - restoreResizeObserver() - restoreLayout() - } - }) - - it('catches a following viewport up after messages append while hidden', async () => { - let isVisible = true - const restoreLayout = stubLayout({ - scrollGeometry: true, - isVisible: () => isVisible - }) - const restoreResizeObserver = stubResizeObserver() - const initialMessages = Array.from({ length: 120 }, (_, index) => marker(index)) - const appendedMessages = [ - ...initialMessages, - ...Array.from({ length: 20 }, (_, index) => marker(120 + index)) - ] - try { - const { container, rerender } = render(list(initialMessages, isVisible)) - await settleVirtualizer(container) - - isVisible = false - rerender(list(initialMessages, isVisible)) - await settleVirtualizer(container) - rerender(list(appendedMessages, isVisible)) - await settleVirtualizer(container) - - isVisible = true - rerender(list(appendedMessages, isVisible)) - await settleVirtualizer(container) - - const scroller = scrollRoot(container) - expect( - scroller.scrollHeight - scroller.clientHeight - scroller.scrollTop - ).toBeLessThanOrEqual(NATIVE_CHAT_BOTTOM_THRESHOLD_PX) - expect(screen.queryByRole('button', { name: /jump to latest/i })).toBeNull() - } finally { - restoreResizeObserver() - restoreLayout() - } - }) -}) diff --git a/src/renderer/src/components/new-workspace/use-smart-workspace-name-field-foundation.source.test.tsx b/src/renderer/src/components/new-workspace/use-smart-workspace-name-field-foundation.source.test.tsx index 0c11b0d2d66..e1900287378 100644 --- a/src/renderer/src/components/new-workspace/use-smart-workspace-name-field-foundation.source.test.tsx +++ b/src/renderer/src/components/new-workspace/use-smart-workspace-name-field-foundation.source.test.tsx @@ -1,16 +1,13 @@ import { linearIssueReadFixture } from '@/store/slices/linear/linear-slice-test-harness' -// @vitest-environment happy-dom - import { act, cleanup, renderHook, waitFor } from '@testing-library/react' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' -import type { Repo } from '../../../../shared/repo-types' - -import type { LinearIssue } from '../../../../shared/linear/issue-types' - -import type { TaskSourceContext } from '../../../../shared/work-items/task-source-context' -import type { NormalizedWorkItemSourceSearchProps } from './smart-workspace-name-field-model' import { useWorkItemSourceSearch } from './use-work-item-source-search' import { referenceLinearIssue } from '../sidebar/workspace-card/review/workspace-reference-fixtures.test-support' +import type { Repo } from '../../../../shared/repo-types' +import type { LinearIssue } from '../../../../shared/linear/issue-types' +import type { TaskSourceContext } from '../../../../shared/work-items/task-source-context' +import type { NormalizedWorkItemSourceSearchProps } from './smart-workspace-name-field-model' +// @vitest-environment happy-dom const mocks = vi.hoisted(() => ({ readStatus: vi.fn(), @@ -38,7 +35,7 @@ vi.mock('@/lib/work-items/gitlab/gitlab-work-item-source-lookup', () => ({ listGitLabWorkItemsForSource: mocks.listGitlabWorkItems, lookupGitLabWorkItemByPathForSource: vi.fn() })) -vi.mock('@/store', () => ({ +vi.mock('@/store/index', () => ({ useAppStore: Object.assign( (selector: (state: unknown) => unknown) => selector({ @@ -51,8 +48,11 @@ vi.mock('@/store', () => ({ { getState: () => mocks.state, subscribe: () => () => {} } ) })) -vi.mock('@/lib/local-preflight-context', () => ({ - getLocalPreflightContext: () => ({}), +vi.mock('@/runtime/hosts/preflight/local-preflight-context', () => ({ + getLocalPreflightContext: () => ({}) +})) + +vi.mock('@/runtime/hosts/preflight/local-preflight-context-key', () => ({ localPreflightContextKey: () => 'test' })) vi.mock('@/i18n/i18n', () => ({ translate: (_key: string, fallback: string) => fallback })) diff --git a/src/renderer/src/components/new-workspace/use-work-item-source-foundation.ts b/src/renderer/src/components/new-workspace/use-work-item-source-foundation.ts index ce08bb48e6f..667e097bae2 100644 --- a/src/renderer/src/components/new-workspace/use-work-item-source-foundation.ts +++ b/src/renderer/src/components/new-workspace/use-work-item-source-foundation.ts @@ -1,22 +1,15 @@ -import type { LinearIssueData } from '@/store/slices/linear/linear-issue-read' -import type { LinearIssueView } from '@/store/slices/linear/linear-issue-read-lifecycle' import { getProviderRuntimeContextKey } from '@/runtime/hosts/observations/provider-runtime-context' import { useLinearIssueResult } from '@/hooks/linear-issue-committed-state' import { getLinearSourceScope } from '@/store/slices/linear/linear-slice-scope' import { getSelectedWorkspaceId } from '@/store/slices/linear/linear-cache' import { defaultScopeSource } from '@/runtime/hosts/selection/default-creation-host' -import type { LinearIssue } from '../../../../shared/linear/issue-types' import { parseBoundedSmartWorkspaceLinearIssueUrlIntent } from '../../../../shared/new-workspace/smart-workspace-linear-intent' import { isSmartWorkspaceSourceQueryWithinLimit } from '../../../../shared/new-workspace/smart-workspace-source-results' import React, { useMemo } from 'react' import { useShallow } from 'zustand/react/shallow' -import { useAppStore } from '@/store' -import { getLocalPreflightContext, localPreflightContextKey } from '@/lib/local-preflight-context' +import { useAppStore } from '@/store/index' +import { getLocalPreflightContext } from '@/runtime/hosts/preflight/local-preflight-context' import { buildTaskSourceContextFromRepo } from '../../../../shared/work-items/task-source-context' -import type { - NormalizedWorkItemSourceSearchProps, - RepoBackedSearchTarget -} from './smart-workspace-name-field-model' import { useJiraSourceConnection } from './use-jira-source-connection' import { useJiraUrlSource } from './use-jira-url-source' import { useLinearSourceConnection } from './use-linear-source-connection' @@ -24,6 +17,14 @@ import { useSmartWorkspaceFieldAvailability } from './use-smart-workspace-field- import { useWorkItemSourceState } from './use-work-item-source-state' import { useJiraComposerProject } from './use-jira-composer-project' import { useComposerSourceScope } from './use-composer-source-scope' +import type { LinearIssueData } from '@/store/slices/linear/linear-issue-read' +import type { LinearIssueView } from '@/store/slices/linear/linear-issue-read-lifecycle' +import type { LinearIssue } from '../../../../shared/linear/issue-types' +import { localPreflightContextKey } from '../../runtime/hosts/preflight/local-preflight-context-key' +import type { + NormalizedWorkItemSourceSearchProps, + RepoBackedSearchTarget +} from './smart-workspace-name-field-model' export function useWorkItemSourceFoundation(props: NormalizedWorkItemSourceSearchProps) { const { diff --git a/src/renderer/src/components/onboarding/ThemeStep.tsx b/src/renderer/src/components/onboarding/ThemeStep.tsx index aceb72b7cd3..10e81b5f9ba 100644 --- a/src/renderer/src/components/onboarding/ThemeStep.tsx +++ b/src/renderer/src/components/onboarding/ThemeStep.tsx @@ -5,21 +5,19 @@ import { toast } from 'sonner' import { track } from '@/diagnostics/telemetry/telemetry' import { useMountedRef } from '@/hooks/useMountedRef' import { GhosttyDiscoveryRow } from './GhosttyDiscoveryRow' -import type { GlobalSettings } from '../../../../shared/global-settings-types' -import type { DiscoveryStatusEmitted } from '../../../../shared/onboarding-state-types' import { i18n, translate } from '@/i18n/i18n' import { useTranslate } from '@/i18n/use-translate' import { ThemeSlotControl, useThemeLooks } from './ThemeLookGallery' import { ThemeLookCarousel, openThemePluginDirectory } from './ThemeLookCarousel' import { ThemeModeTiles } from './ThemeModeTiles' -import type { ThemeLook, ThemeLookBase } from './onboarding-theme-looks' import { themeLookSettingsUpdate } from './onboarding-theme-look-settings' -import { - terminalConfigImportSettingsUpdate, - type TerminalConfigImportPreview -} from '../../../../shared/terminal/appearance/terminal-config-import-preview' -import { getSystemPrefersDark } from '@/lib/terminal-theme' +import { terminalConfigImportSettingsUpdate } from '../../../../shared/terminal/appearance/terminal-config-import-preview' +import type { TerminalConfigImportPreview } from '../../../../shared/terminal/appearance/terminal-config-import-preview' +import { getSystemPrefersDark } from '@/lib/terminal/appearance/terminal-theme' import { useSystemPrefersDark } from '@/hooks/theme/use-system-prefers-dark' +import type { GlobalSettings } from '../../../../shared/global-settings-types' +import type { DiscoveryStatusEmitted } from '../../../../shared/onboarding-state-types' +import type { ThemeLook, ThemeLookBase } from './onboarding-theme-looks' type ThemeStepProps = { theme: GlobalSettings['theme'] diff --git a/src/renderer/src/components/orchestration-crew/CrewRowView.tsx b/src/renderer/src/components/orchestration-crew/CrewRowView.tsx index 9655e6d0087..0b9644e8ff7 100644 --- a/src/renderer/src/components/orchestration-crew/CrewRowView.tsx +++ b/src/renderer/src/components/orchestration-crew/CrewRowView.tsx @@ -2,15 +2,16 @@ import { memo } from 'react' import { ChevronDown, ChevronRight, ExternalLink } from 'lucide-react' import { Button } from '@/components/ui/button' import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip' -import { openOrchestrationCrewAgent } from '@/lib/open-agent-message-sender' +import { openOrchestrationCrewAgent } from '@/lib/agent-session/open/open-agent-message-sender' import { cn } from '@/lib/class-names' import { useTranslate } from '@/i18n/use-translate' import { useUiLanguageRevision } from '@/i18n/use-ui-language-revision' -import type { OrchestrationCrewRow } from '../../../../shared/orchestration/orchestration-crew' -import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target' import { CrewRowDetails, CrewRowTime as Time } from './CrewRowDetails' import { CrewRowMenu } from './CrewRowMenu' -import { CrewAgentIcons, type CrewRowLook } from './CrewAgentIcons' +import { CrewAgentIcons } from './CrewAgentIcons' +import type { CrewRowLook } from './CrewAgentIcons' +import type { OrchestrationCrewRow } from '../../../../shared/orchestration/orchestration-crew' +import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target' export function IconButton({ label, diff --git a/src/renderer/src/components/plain-ssh-terminal/PlainSshTerminalView.tsx b/src/renderer/src/components/plain-ssh-terminal/PlainSshTerminalView.tsx index 3741f3a20a8..76d6fe4c6bc 100644 --- a/src/renderer/src/components/plain-ssh-terminal/PlainSshTerminalView.tsx +++ b/src/renderer/src/components/plain-ssh-terminal/PlainSshTerminalView.tsx @@ -1,17 +1,11 @@ import { useEffect, useLayoutEffect, useRef } from 'react' import { FitAddon } from '@xterm/addon-fit' -import type { ITheme, Terminal } from '@xterm/xterm' -import type { GlobalSettings } from '../../../../shared/global-settings-types' -import type { - PlainSshTerminalEvent, - PlainSshTerminalOpenResult -} from '../../../../shared/plain-ssh-terminal' import { TerminalKittyKeyboardModeTracker } from '../../../../shared/terminal/protocol/input-modes/terminal-kitty-keyboard-mode-tracker' import { translate } from '@/i18n/i18n' -import { useAppStore } from '@/store' +import { useAppStore } from '@/store/index' import { useEffectiveMacOptionAsAlt } from '@/lib/keyboard-layout/use-effective-mac-option-as-alt' import { composeActiveTerminalTheme } from '@/components/terminal-pane/appearance/terminal-appearance' -import { resolveEffectiveTerminalAppearance } from '@/lib/terminal-theme' +import { resolveEffectiveTerminalAppearance } from '@/lib/terminal/appearance/terminal-theme' import { useSystemPrefersDark } from '@/hooks/theme/use-system-prefers-dark' import { resolveTerminalMinimumContrastRatio } from '../../../../shared/terminal-themes/terminal-contrast-correction' import { syncPreviewTerminalLigatures } from '@/components/dashboard-popout/preview-terminal-ligatures' @@ -22,6 +16,12 @@ import { import { openStandaloneTerminal } from '@/components/standalone-terminal/open-standalone-terminal' import { removePlainSshPanel } from '@/ssh/plain-ssh-terminal-panels' import { usePluginFontReady } from '@/store/plugins/appearance/plugin-fonts' +import type { ITheme, Terminal } from '@xterm/xterm' +import type { GlobalSettings } from '../../../../shared/global-settings-types' +import type { + PlainSshTerminalEvent, + PlainSshTerminalOpenResult +} from '../../../../shared/plain-ssh-terminal' export type PlainSshTerminalPhase = | { kind: 'opening' } diff --git a/src/renderer/src/components/plugins/state/plugin-theme-apply.ts b/src/renderer/src/components/plugins/state/plugin-theme-apply.ts index d0519d4b55a..9fe4048835f 100644 --- a/src/renderer/src/components/plugins/state/plugin-theme-apply.ts +++ b/src/renderer/src/components/plugins/state/plugin-theme-apply.ts @@ -1,7 +1,4 @@ import { toast } from 'sonner' -import type { GlobalSettings } from '../../../../../shared/global-settings-types' -import type { PluginThemeRegistration } from '../../../../../shared/plugins/artifacts/plugin-theme-artifact' -import type { PluginTerminalThemeRegistration } from '../../../../../shared/plugins/artifacts/plugin-terminal-theme-artifact' import { translate } from '@/i18n/i18n' import { resolveDocumentTheme } from '@/app-shell/appearance/document-theme' import { pluginAppThemeSlotUpdate } from '../../../../../shared/plugin-theme-settings' @@ -10,11 +7,9 @@ import { TERMINAL_COLOR_OVERRIDES_SETTING } from '../../../../../shared/terminal-themes/terminal-color-overrides' import { withTerminalPluginPalettes } from '@/lib/terminal/themes/terminal-plugin-palettes' -import { BUILTIN_TERMINAL_THEME_NAMES } from '@/lib/terminal-theme' -import { - disambiguatedPluginContentLabels, - type PluginContentLabelItem -} from '../presentation/plugin-name-disambiguation' +import { BUILTIN_TERMINAL_THEME_NAMES } from '@/lib/terminal/appearance/terminal-theme' +import { disambiguatedPluginContentLabels } from '../presentation/plugin-name-disambiguation' +import type { PluginContentLabelItem } from '../presentation/plugin-name-disambiguation' import { useAppStore } from '@/store/index' import { PLUGIN_ACTION_TOAST_DURATION_MS } from './plugin-action-toast' import { usePluginIconThemeStore } from '@/store/plugins/appearance/plugin-icon-themes' @@ -22,6 +17,9 @@ import { usePluginThemeStore, usePluginTerminalThemeStore } from '@/store/plugins/appearance/plugin-themes' +import type { GlobalSettings } from '../../../../../shared/global-settings-types' +import type { PluginThemeRegistration } from '../../../../../shared/plugins/artifacts/plugin-theme-artifact' +import type { PluginTerminalThemeRegistration } from '../../../../../shared/plugins/artifacts/plugin-terminal-theme-artifact' export function isPluginAppThemeSelected( settings: Pick, diff --git a/src/renderer/src/components/pull-request-page/checks/tab.tsx b/src/renderer/src/components/pull-request-page/checks/tab.tsx index b87c3675e4d..6d9f51e2b2e 100644 --- a/src/renderer/src/components/pull-request-page/checks/tab.tsx +++ b/src/renderer/src/components/pull-request-page/checks/tab.tsx @@ -2,14 +2,14 @@ import { isCompletePRCheckOwner } from '../../../../../shared/github/complete-pr import { usePRCheckRefreshOwner } from '@/hooks/use-pr-check-refresh-owner' import { getChecksTabSummaryPresentation } from '@/components/github-item-dialog/inspect-pull-request/checks-tab-summary' import React, { useCallback, useLayoutEffect, useMemo, useRef, useState } from 'react' -import { useAppStore } from '@/store' +import { useAppStore } from '@/store/index' import { useMountedRef } from '@/hooks/useMountedRef' import { createGitHubChecksTabState, resolveGitHubChecksTabState, - toggleGitHubChecksTabExpandedKey, - type GitHubChecksContextOwner + toggleGitHubChecksTabExpandedKey } from '@/components/github-checks-tab-state' +import type { GitHubChecksContextOwner } from '@/components/github-checks-tab-state' import { getCheckDetailsKey } from '@/components/github/pr-check-presentation' import { getCheckCounts, @@ -26,15 +26,10 @@ import { canUseGitHubRepoContext, getGitHubSourceRuntimeHost } from '@/lib/work-items/github/github-source-runtime-context' -import { getLocalRepoProjectExecutionRuntimeContext } from '@/lib/local-preflight-context' +import { getLocalRepoProjectExecutionRuntimeContext } from '@/runtime/hosts/preflight/local-preflight-context' import { CLIENT_PLATFORM } from '@/lib/workspace/creation/new-workspace' import { resolveRepoExecutionHostPlatform } from '@/runtime/hosts/platform/execution-host-facts' import { resolveSourceControlActionRecipe } from '../../../../../shared/source-control/ai/source-control-ai-operation-policy' -import type { - GitHubWorkItem, - GitHubWorkItemDetails -} from '../../../../../shared/github/work-item-types' -import type { PRCheckDetail } from '../../../../../shared/github/check-types' import { refreshPullRequestChecks } from './refresh' import { rerunPullRequestChecks } from './rerun' import { requestPullRequestCheckDetails } from './details-request' @@ -44,6 +39,11 @@ import { CheckRow } from './row' import { ChecksFixDialog } from './fix-dialog' import { ChecksTabLayouts } from './layouts' import { useTranslate } from '@/i18n/use-translate' +import type { + GitHubWorkItem, + GitHubWorkItemDetails +} from '../../../../../shared/github/work-item-types' +import type { PRCheckDetail } from '../../../../../shared/github/check-types' export function ChecksTab({ item, diff --git a/src/renderer/src/components/right-sidebar/FolderWorkspaceSourceControlPanel.tsx b/src/renderer/src/components/right-sidebar/FolderWorkspaceSourceControlPanel.tsx index 13cc391236b..4886a2d68ab 100644 --- a/src/renderer/src/components/right-sidebar/FolderWorkspaceSourceControlPanel.tsx +++ b/src/renderer/src/components/right-sidebar/FolderWorkspaceSourceControlPanel.tsx @@ -4,7 +4,7 @@ import { } from '@/store/slices/worktrees/metadata/cross-store-lineage-parents' import { memo, useCallback, useEffect, useMemo, useState } from 'react' import { RefreshCw } from 'lucide-react' -import { useAppStore } from '@/store' +import { useAppStore } from '@/store/index' import { selectFolderWorkspaces, selectWorktreesByRepo @@ -13,7 +13,7 @@ import { getAttachedWorktreesForFolderWorkspace, attachedWorktreeOwnerKey } from './folder-workspace-attached-worktrees' -import { resolveReviewRepository } from '@/lib/review-owner' +import { resolveReviewRepository } from '@/lib/source-control/review/review-owner' import { useTranslate } from '@/i18n/use-translate' import { useUiLanguageRevision } from '@/i18n/use-ui-language-revision' import { OverlayActivityOwner } from '@/components/ui/use-overlay-focus-scope' diff --git a/src/renderer/src/components/right-sidebar/FolderWorkspaceWorktreesPanel.tsx b/src/renderer/src/components/right-sidebar/FolderWorkspaceWorktreesPanel.tsx index b1c692f6d1c..f5ceec4583b 100644 --- a/src/renderer/src/components/right-sidebar/FolderWorkspaceWorktreesPanel.tsx +++ b/src/renderer/src/components/right-sidebar/FolderWorkspaceWorktreesPanel.tsx @@ -8,11 +8,10 @@ import { getLineageChildrenInlineStyle, LINEAGE_CHILDREN_INLINE_OFFSET } from '@/components/sidebar/worktree-list/rows/indentation' -import { useAppStore } from '@/store' +import { useAppStore } from '@/store/index' import { useTranslate } from '@/i18n/use-translate' import { getWorktreeHostIdentity } from '../../../../shared/worktree/host-qualified-identity' -import { resolveReviewRepository } from '@/lib/review-owner' -import type { Worktree } from '../../../../shared/worktree/types' +import { resolveReviewRepository } from '@/lib/source-control/review/review-owner' import { getAttachedWorktreesForFolderWorkspace } from './folder-workspace-attached-worktrees' import { useState } from 'react' import { @@ -20,6 +19,7 @@ import { selectWorktreesByRepo } from '@/store/workspaces/catalog/workspace-record-fields' import { FolderWorkspaceEmptyState } from './folder-workspace-empty-state' +import type { Worktree } from '../../../../shared/worktree/types' export default function FolderWorkspaceWorktreesPanel(): React.JSX.Element { const t = useTranslate() diff --git a/src/renderer/src/components/right-sidebar/ai-vault/scanning/ai-vault-saved-session-lists.ts b/src/renderer/src/components/right-sidebar/ai-vault/scanning/ai-vault-saved-session-lists.ts index b40e7397b39..a21b69d3b7a 100644 --- a/src/renderer/src/components/right-sidebar/ai-vault/scanning/ai-vault-saved-session-lists.ts +++ b/src/renderer/src/components/right-sidebar/ai-vault/scanning/ai-vault-saved-session-lists.ts @@ -1,9 +1,5 @@ // Last list per scope, kept across restarts so History can paint it while the rescan runs. -import type { - AiVaultListResult, - AiVaultSession -} from '../../../../../../shared/ai-vault/contracts/ai-vault-types' import { latestSessionConversationTurn } from '../../../../../../shared/ai-vault/session-display/ai-vault-session-display' import { useAppStore } from '@/store/index' import { isWebClientLocation } from '@/app-shell/platform/web-client-location' @@ -11,8 +7,12 @@ import { committedTransaction, indexedDbConnection, settledRequest -} from '@/lib/indexeddb-connection' +} from '@/app-shell/storage/indexeddb-connection' import { catalogRowsEqual } from '@/lib/catalog-reconciliation/catalog-row-reconciliation' +import type { + AiVaultListResult, + AiVaultSession +} from '../../../../../../shared/ai-vault/contracts/ai-vault-types' import type { AiVaultSessionLimit } from '../session-list/ai-vault-session-limit' const DATABASE_NAME = 'orca-ai-vault-session-lists' diff --git a/src/renderer/src/components/right-sidebar/ai-vault/session-actions/ai-vault-original-pane-actions.ts b/src/renderer/src/components/right-sidebar/ai-vault/session-actions/ai-vault-original-pane-actions.ts index b27eba0bc1a..d03fb7f2749 100644 --- a/src/renderer/src/components/right-sidebar/ai-vault/session-actions/ai-vault-original-pane-actions.ts +++ b/src/renderer/src/components/right-sidebar/ai-vault/session-actions/ai-vault-original-pane-actions.ts @@ -5,11 +5,9 @@ import { activateTabAndFocusPane } from '@/lib/workspace/tabs/activate-tab-and-f import { activateAndRevealWorkspace } from '@/lib/workspace/activation/worktree-activation' import { findFolderWorkspaceOwner } from '@/lib/workspace/ownership/folder-workspace-runtime-owner' import { useAppStore } from '@/store/index' -import { openDesktopStructuredSession } from '@/lib/activate-ai-vault-structured-session' +import { openDesktopStructuredSession } from '@/lib/agent-session/open/activate-ai-vault-structured-session' import { findStructuredAgentSessionTab } from '@/lib/agent-session/structured-agent-session-tab-activation' import { flashFocusedPaneRim } from '@/components/terminal-pane/input/focus/focused-pane-rim-flash' -import type { AgentDotState } from '@/components/AgentStateDot' -import type { AiVaultSession } from '../../../../../../shared/ai-vault/contracts/ai-vault-types' import { translate } from '@/i18n/i18n' import { parseWorkspaceKey } from '../../../../../../shared/workspace-scope' import { findOriginalAiVaultSessionPane } from './ai-vault-original-pane' @@ -18,6 +16,8 @@ import { findAiVaultSessionLiveStateInIndex, findOriginalAiVaultSessionPaneInIndex } from './ai-vault-original-pane-index' +import type { AgentDotState } from '@/components/AgentStateDot' +import type { AiVaultSession } from '../../../../../../shared/ai-vault/contracts/ai-vault-types' export function useAiVaultOriginalPaneActions(): { getOriginalPaneTarget: ( diff --git a/src/renderer/src/components/right-sidebar/ai-vault/session-actions/ai-vault-session-launch-actions.ts b/src/renderer/src/components/right-sidebar/ai-vault/session-actions/ai-vault-session-launch-actions.ts index b7312cb9b42..981b729582a 100644 --- a/src/renderer/src/components/right-sidebar/ai-vault/session-actions/ai-vault-session-launch-actions.ts +++ b/src/renderer/src/components/right-sidebar/ai-vault/session-actions/ai-vault-session-launch-actions.ts @@ -8,39 +8,39 @@ import { buildAiVaultResumeCopyCommandForWorktree, buildAiVaultResumeStartupForWorktree } from '@/lib/agent-session/resume/history/ai-vault-resume-command' -import type { - AiVaultResumeCommandSession, - AiVaultResumeStartup -} from '../../../../../../shared/ai-vault/resume/ai-vault-resume-startup' import { assertAiVaultCopiedSessionLaunchAllowed, buildAiVaultCopiedSessionStartupForWorktree, buildAiVaultForkStartupForWorktree } from '@/lib/agent-session/resume/history/ai-vault-session-fork-startup' -import { launchAiVaultSessionAndReveal } from '@/lib/launch-ai-vault-session-and-reveal' +import { launchAiVaultSessionAndReveal } from '@/lib/agent-session/resume/history/launch-ai-vault-session-and-reveal' import { useAppStore } from '@/store/index' -import type { - AiVaultAgent, - AiVaultSession -} from '../../../../../../shared/ai-vault/contracts/ai-vault-types' import { dropDeletedRemoteResumeCwd, prepareAiVaultSessionForFork, prepareAiVaultSessionForResume, prepareAiVaultSessionForTerminalResume } from '@/lib/agent-session/resume/history/ai-vault-session-resume-preparation' -import type { Worktree } from '../../../../../../shared/worktree/types' import { translate } from '@/i18n/i18n' import { describeAiVaultCliForkFailure } from './ai-vault-session-cli-fork' -import type { AiVaultSessionResumeTargetState } from './ai-vault-session-resume' import { prepareAiVaultSessionContinuation } from './ai-vault-session-continuation' -import type { AgentSessionContinuationRequest } from '@/lib/agent-session/context/agent-session-continuation' -import { activateAiVaultStructuredSession } from '@/lib/activate-ai-vault-structured-session' +import { activateAiVaultStructuredSession } from '@/lib/agent-session/open/activate-ai-vault-structured-session' import { adoptsCliConversations } from '../../../../../../shared/structured-agent-cli-conversation-adoption' import { newAgentLaunchRequestId } from '@/lib/agent-session/launch/routing/agent-launch-request-id' import { describeAiVaultResumeFailure } from '@/lib/agent-session/resume/history/ai-vault-resume-refusal' import { resumeAiVaultSessionInNewChat } from './ai-vault-session-resume-in-chat-launch' import { resolveAiVaultTargetWorkspacePath } from './ai-vault-session-launch-target' +import type { + AiVaultResumeCommandSession, + AiVaultResumeStartup +} from '../../../../../../shared/ai-vault/resume/ai-vault-resume-startup' +import type { + AiVaultAgent, + AiVaultSession +} from '../../../../../../shared/ai-vault/contracts/ai-vault-types' +import type { Worktree } from '../../../../../../shared/worktree/types' +import type { AiVaultSessionResumeTargetState } from './ai-vault-session-resume' +import type { AgentSessionContinuationRequest } from '@/lib/agent-session/context/agent-session-continuation' export function useAiVaultSessionLaunchActions({ activeWorktree, diff --git a/src/renderer/src/components/right-sidebar/ai-vault/session-actions/ai-vault-session-resume-here.ts b/src/renderer/src/components/right-sidebar/ai-vault/session-actions/ai-vault-session-resume-here.ts index bea7b4a11ae..b5ccefbe2f3 100644 --- a/src/renderer/src/components/right-sidebar/ai-vault/session-actions/ai-vault-session-resume-here.ts +++ b/src/renderer/src/components/right-sidebar/ai-vault/session-actions/ai-vault-session-resume-here.ts @@ -3,29 +3,27 @@ import { useAppStore } from '@/store/index' import { activateAiVaultStructuredSession, openDesktopStructuredSession -} from '@/lib/activate-ai-vault-structured-session' -import { insertUnifiedTabAfterAnchor } from '@/lib/unified-tab-anchor-insertion' +} from '@/lib/agent-session/open/activate-ai-vault-structured-session' +import { insertUnifiedTabAfterAnchor } from '@/lib/workspace/tabs/unified-tab-anchor-insertion' import { newAgentLaunchRequestId } from '@/lib/agent-session/launch/routing/agent-launch-request-id' import { captureNativeChatComposerFocusIntent, requestNativeChatComposerFocus } from '@/components/native-chat/composer/focus/native-chat-composer-focus-intent' -import type { ConfirmationDialogContextValue } from '@/components/confirmation-dialog-context' import { translate } from '@/i18n/i18n' import { agentLabel } from '../../../../../../shared/ai-vault/session-display/ai-vault-session-filters' -import { - aiVaultHistoryAgents, - type AiVaultAgent, - type AiVaultSession +import { aiVaultHistoryAgents } from '../../../../../../shared/ai-vault/contracts/ai-vault-types' +import type { + AiVaultAgent, + AiVaultSession } from '../../../../../../shared/ai-vault/contracts/ai-vault-types' -import { - adoptsCliConversations, - type CliConversationRowAgent -} from '../../../../../../shared/structured-agent-cli-conversation-adoption' -import type { Tab } from '../../../../../../shared/tab-types' +import { adoptsCliConversations } from '../../../../../../shared/structured-agent-cli-conversation-adoption' +import type { CliConversationRowAgent } from '../../../../../../shared/structured-agent-cli-conversation-adoption' import { structuredLaunchConversationOwner } from '@/lib/agent-session/launch/structured-agent-session-launch-failure' -import type { AiVaultSessionRowChatActions } from './ai-vault-session-chat-action' import { resumeAiVaultSessionInNewChat } from './ai-vault-session-resume-in-chat-launch' +import type { ConfirmationDialogContextValue } from '@/components/confirmation-dialog-context' +import type { Tab } from '../../../../../../shared/tab-types' +import type { AiVaultSessionRowChatActions } from './ai-vault-session-chat-action' /** The chat `/resume` was typed in; a picked row's conversation takes its place. */ export type AiVaultResumeHere = { diff --git a/src/renderer/src/components/right-sidebar/ai-vault/session-actions/ai-vault-session-resume-in-chat-launch.ts b/src/renderer/src/components/right-sidebar/ai-vault/session-actions/ai-vault-session-resume-in-chat-launch.ts index 7da5d121413..6f5ebe0a743 100644 --- a/src/renderer/src/components/right-sidebar/ai-vault/session-actions/ai-vault-session-resume-in-chat-launch.ts +++ b/src/renderer/src/components/right-sidebar/ai-vault/session-actions/ai-vault-session-resume-in-chat-launch.ts @@ -1,20 +1,14 @@ import { toast } from 'sonner' -import { - parseRoutableExecutionHostId, - type ExecutionHostId -} from '../../../../../../shared/execution-host' +import { parseRoutableExecutionHostId } from '../../../../../../shared/execution-host' +import type { ExecutionHostId } from '../../../../../../shared/execution-host' import { translate } from '@/i18n/i18n' import { useAppStore } from '@/store/index' -import type { AiVaultSession } from '../../../../../../shared/ai-vault/contracts/ai-vault-types' import { agentLabel } from '../../../../../../shared/ai-vault/session-display/ai-vault-session-filters' -import { - CLI_CONVERSATION_ADOPTING_AGENTS, - type CliConversationRowAgent -} from '../../../../../../shared/structured-agent-cli-conversation-adoption' +import { CLI_CONVERSATION_ADOPTING_AGENTS } from '../../../../../../shared/structured-agent-cli-conversation-adoption' +import type { CliConversationRowAgent } from '../../../../../../shared/structured-agent-cli-conversation-adoption' import { hasRuntimeRpcErrorCode } from '../../../../../../shared/runtime-rpc-error-code' import { prepareAiVaultSessionForResume } from '@/lib/agent-session/resume/history/ai-vault-session-resume-preparation' import { adoptAgentSessionLaunchVerdict } from '@/lib/agent-session/launch/routing/agent-session-launch-plan' -import type { AgentLaunchRequestId } from '@/lib/agent-session/launch/routing/agent-launch-request-id' import { activateAndRevealWorkspace } from '@/lib/workspace/activation/worktree-activation' import { beginStructuredAgentSessionProvisionalLaunch, @@ -22,10 +16,12 @@ import { } from '@/lib/agent-session/structured-agent-session-provisional-tab' import { admitStructuredLaunchOnHost } from '@/lib/agent-session/launch/structured-agent-session-host-admission' import { toRuntimeWorktreeSelector } from '@/runtime/rpc/targets/runtime-worktree-selector' -import { cliConversationExitGuidance } from '@/lib/cli-conversation-exit-guidance' +import { cliConversationExitGuidance } from '@/lib/agent-session/resume/history/cli-conversation-exit-guidance' import { structuredLaunchFailure } from '@/lib/agent-session/launch/structured-agent-session-launch-failure' import { workspaceHasSleepingAgentSessions } from '@/lib/workspace/activation/worktree-agent-activation-gate' import { resolveWebSessionVisibleTabId } from '@/runtime/web-session-tabs-sync/navigation/web-session-focus-intent' +import type { AiVaultSession } from '../../../../../../shared/ai-vault/contracts/ai-vault-types' +import type { AgentLaunchRequestId } from '@/lib/agent-session/launch/routing/agent-launch-request-id' import type { TuiAgent } from '../../../../../../shared/agent-launch/catalog/tui-agent' import type { StructuredAgentLaunchSettlement } from '@/lib/agent-session/launch/continuation/structured-agent-launch-settlement' import type { NativeChatComposerFocusIntent } from '@/components/native-chat/composer/focus/native-chat-composer-focus-intent' diff --git a/src/renderer/src/components/right-sidebar/ai-vault/session-list/use-ai-vault-session-display-title.ts b/src/renderer/src/components/right-sidebar/ai-vault/session-list/use-ai-vault-session-display-title.ts index 65754fe969d..56d812271dc 100644 --- a/src/renderer/src/components/right-sidebar/ai-vault/session-list/use-ai-vault-session-display-title.ts +++ b/src/renderer/src/components/right-sidebar/ai-vault/session-list/use-ai-vault-session-display-title.ts @@ -1,8 +1,8 @@ -import type { AiVaultSession } from '../../../../../../shared/ai-vault/contracts/ai-vault-types' import { structuredChatDisplayName } from '../../../../../../shared/structured-chat-row-name' import { useAppStore } from '@/store/index' -import { structuredChatTabBySessionId } from '@/lib/structured-chat-tab-index' +import { structuredChatTabBySessionId } from '@/lib/agent-session/tab-identity/structured-chat-tab-index' import { useStructuredConversationName } from '@/runtime/native-chat/naming/structured-conversation-name' +import type { AiVaultSession } from '../../../../../../shared/ai-vault/contracts/ai-vault-types' /** Native rows use live saved names, falling back to authoritative host titles across closed tabs and restarts. */ export function useAiVaultSessionDisplayTitle(session: AiVaultSession): string { diff --git a/src/renderer/src/components/right-sidebar/source-control/sync/git-history-commit-context-menu.tsx b/src/renderer/src/components/right-sidebar/source-control/sync/git-history-commit-context-menu.tsx index 0b2545a6b62..e5c8c2d5084 100644 --- a/src/renderer/src/components/right-sidebar/source-control/sync/git-history-commit-context-menu.tsx +++ b/src/renderer/src/components/right-sidebar/source-control/sync/git-history-commit-context-menu.tsx @@ -1,5 +1,4 @@ import { useSourceControlState, useSourceControlScope } from '../panel/worktree-scope' -import type React from 'react' import { Copy, Globe, Hash, Sparkles } from 'lucide-react' import { ContextMenuContent, @@ -7,8 +6,9 @@ import { ContextMenuSeparator } from '@/components/ui/context-menu' import { useTranslate } from '@/i18n/use-translate' +import { getClientCreationActionPolicy } from '@/lib/workspace/creation/surface-policy/client-creation-action-policy' +import type React from 'react' import type { GitHistoryItem } from '../../../../../../shared/git/history/git-history-types' -import { getClientCreationActionPolicy } from '@/lib/client-creation-action-policy' export type GitHistoryCommitAction = 'open-remote' | 'copy-hash' | 'copy-message' | 'explain' diff --git a/src/renderer/src/components/settings/editor/GeneralEditorSettingsSection.tsx b/src/renderer/src/components/settings/editor/GeneralEditorSettingsSection.tsx index 0814b8e72fc..bd99a2df236 100644 --- a/src/renderer/src/components/settings/editor/GeneralEditorSettingsSection.tsx +++ b/src/renderer/src/components/settings/editor/GeneralEditorSettingsSection.tsx @@ -1,13 +1,12 @@ import { GENERAL_SETTING_ANCHORS } from '../general/general-setting-anchors' -import type React from 'react' import { useState } from 'react' -import type { GlobalSettings } from '../../../../../shared/global-settings-types' +import type React from 'react' import { DEFAULT_EDITOR_AUTO_SAVE_DELAY_MS, MAX_EDITOR_AUTO_SAVE_DELAY_MS, MIN_EDITOR_AUTO_SAVE_DELAY_MS } from '../../../../../shared/constants' -import { clampNumber } from '@/lib/terminal-theme' +import { clampNumber } from '@/lib/terminal/appearance/terminal-theme' import { Input } from '../../ui/input' import { Label } from '../../ui/label' import { SearchableSetting } from '../section-layout/SearchableSetting' @@ -28,6 +27,7 @@ import { updateAutoSaveDelayDraftState } from './auto-save-delay-draft' import { SettingsGroup } from '../section-layout/SettingsGroup' +import type { GlobalSettings } from '../../../../../shared/global-settings-types' type GeneralEditorSettingsSectionProps = { settings: GlobalSettings diff --git a/src/renderer/src/components/settings/form-controls/SettingsFormControls.tsx b/src/renderer/src/components/settings/form-controls/SettingsFormControls.tsx index 23928294aba..9c8047f0bd4 100644 --- a/src/renderer/src/components/settings/form-controls/SettingsFormControls.tsx +++ b/src/renderer/src/components/settings/form-controls/SettingsFormControls.tsx @@ -1,12 +1,12 @@ // @protected-copy: preserve copy used by security settings. -import type React from 'react' import { useState } from 'react' +import type React from 'react' import { Input } from '../../ui/input' import { Label } from '../../ui/label' import { Tooltip, TooltipContent, TooltipTrigger } from '../../ui/tooltip' import { Switch } from '../../ui/switch' import { SettingsDisabledControlTooltip } from './SettingsDisabledControlTooltip' -import { normalizeColor } from '@/lib/terminal-theme' +import { normalizeColor } from '@/lib/terminal/appearance/terminal-theme' import { cn } from '@/lib/class-names' import { useTranslate } from '@/i18n/use-translate' diff --git a/src/renderer/src/components/settings/repository/mcp/McpConfigSection.tsx b/src/renderer/src/components/settings/repository/mcp/McpConfigSection.tsx index c8f7e141945..7471d384686 100644 --- a/src/renderer/src/components/settings/repository/mcp/McpConfigSection.tsx +++ b/src/renderer/src/components/settings/repository/mcp/McpConfigSection.tsx @@ -2,8 +2,6 @@ import { useCallback, useEffect, useMemo, useRef, useState } from 'react' import { AlertCircle, FileCode2, LoaderCircle, Plus, RefreshCw } from 'lucide-react' import { toast } from 'sonner' import { useMountedRef } from '@/hooks/useMountedRef' -import type { Repo } from '../../../../../../shared/repo-types' -import type { Worktree } from '../../../../../../shared/worktree/types' import { composeWorktreeId, getRepoIdFromWorktreeId } from '../../../../../../shared/worktree/id' import { getRepoExecutionHostId, @@ -29,22 +27,22 @@ import { Button } from '../../../ui/button' import { isWindowsUserAgent } from '../../../../app-shell/platform/user-agent-platform' import { McpConfigFileRow } from './McpConfigFileRow' import { McpMissingConfigList } from './McpMissingConfigList' -import { - type LoadedMcpConfigInspection, - loadMcpConfigInspections -} from '../../../../runtime/mcp/configuration/mcp-config-inspection' +import { loadMcpConfigInspections } from '../../../../runtime/mcp/configuration/mcp-config-inspection' +import type { LoadedMcpConfigInspection } from '../../../../runtime/mcp/configuration/mcp-config-inspection' import { formatMcpConfigSummary } from './mcp-config-summary' import { useTranslate } from '@/i18n/use-translate' -import { captureDirectSshMutationExpectation } from '@/lib/ssh-mutation-expectation' +import { captureDirectSshMutationExpectation } from '@/runtime/hosts/ssh/ssh-mutation-expectation' import { writeRuntimeFile } from '@/runtime/files/mutations/runtime-file-mutation-client' import { assertFileWriteApplied, missingOrIdenticalPrecondition } from '../../../../../../shared/file-write/file-write-disk-precondition' -import type { RuntimeFileOperationArgs } from '@/runtime/files/runtime-file-client-types' import { runtimeTargetForOwnerEnvironment } from '@/runtime/rpc/targets/runtime-client-target' import { selectWorktreesByRepo } from '@/store/workspaces/catalog/workspace-record-fields' import { SettingsGroup } from '../../section-layout/SettingsGroup' +import type { Repo } from '../../../../../../shared/repo-types' +import type { Worktree } from '../../../../../../shared/worktree/types' +import type { RuntimeFileOperationArgs } from '@/runtime/files/runtime-file-client-types' type McpConfigSectionProps = { repo: Repo diff --git a/src/renderer/src/components/settings/shortcuts/ShortcutsPane.tsx b/src/renderer/src/components/settings/shortcuts/ShortcutsPane.tsx index d4a163a6a48..aa80ff6d37c 100644 --- a/src/renderer/src/components/settings/shortcuts/ShortcutsPane.tsx +++ b/src/renderer/src/components/settings/shortcuts/ShortcutsPane.tsx @@ -13,11 +13,6 @@ import { } from '../../../../../shared/keybindings/profile-defaults' import { keybindingFromInputForAction } from '../../../../../shared/keybindings/input' import { normalizeKeybindingListForAction } from '../../../../../shared/keybindings/normalization' -import type { - KeybindingActionId, - KeybindingDefinition, - KeybindingInput -} from '../../../../../shared/keybindings/types' import { EMPTY_DISABLED_TUI_AGENTS } from './shortcut-groups' import { useAppStore } from '../../../store/index' import { KeybindingsFileActions } from './KeybindingsFileActions' @@ -27,7 +22,8 @@ import { removeBindingOverride, sameBindings } from './keybinding-override-edits' -import { ShortcutFilterRail, type ShortcutFilter } from './ShortcutFilterRail' +import { ShortcutFilterRail } from './ShortcutFilterRail' +import type { ShortcutFilter } from './ShortcutFilterRail' import { ShortcutRowsList } from './ShortcutRowsList' import { ShortcutTerminalPolicyControl } from './ShortcutTerminalPolicyControl' import { getTerminalShortcutPolicySearchEntry } from './shortcuts-search' @@ -43,11 +39,16 @@ import { useMountedRef } from '@/hooks/useMountedRef' import { useTranslate } from '@/i18n/use-translate' import { useEditablePluginCommands } from '@/store/plugins/catalog/plugin-contribution-catalog' import { buildShortcutDefinitionCatalog } from './shortcut-definition-catalog' -import { getClientCreationActionPolicy } from '@/lib/client-creation-action-policy' +import { getClientCreationActionPolicy } from '@/lib/workspace/creation/surface-policy/client-creation-action-policy' import { buildShortcutRowVisibility } from './shortcut-row-visibility' import { useMacCapturedDigitChords } from './use-mac-captured-digit-chords' import { keybindingValidationErrorText } from './keybinding-diagnostic-text' import { KeybindingFileDiagnostics } from './KeybindingFileDiagnostics' +import type { + KeybindingActionId, + KeybindingDefinition, + KeybindingInput +} from '../../../../../shared/keybindings/types' const isMac = navigator.userAgent.includes('Mac') const platform: NodeJS.Platform = isMac diff --git a/src/renderer/src/components/settings/ssh/SshPane.test.tsx b/src/renderer/src/components/settings/ssh/SshPane.test.tsx deleted file mode 100644 index a126a8f00ce..00000000000 --- a/src/renderer/src/components/settings/ssh/SshPane.test.tsx +++ /dev/null @@ -1,172 +0,0 @@ -// @vitest-environment happy-dom - -// @vitest-environment happy-dom -import { act, type ReactNode } from 'react' -import { createRoot } from 'react-dom/client' -import { afterEach, describe, expect, it, vi } from 'vitest' -import { resetSshConfigPassiveSyncForTests } from '../../../lib/ssh-config-passive-sync' -import type { SshConnectionState, SshTarget } from '../../../../../shared/ssh-types' - -import { TooltipProvider } from '@/components/ui/tooltip' -import { SshPane } from './SshPane' - -const mocks = vi.hoisted(() => ({ - success: vi.fn(), - toast: vi.fn(), - recordReadoptions: vi.fn(), - recordInteraction: vi.fn(), - requestRemove: vi.fn(), - requestBulkRemove: vi.fn(), - openSettingsTarget: vi.fn(), - connectionStates: new Map() -})) -vi.mock('sonner', () => ({ - toast: Object.assign(mocks.toast, { success: mocks.success, error: vi.fn() }) -})) -vi.mock('@/store/index', () => { - const state = { - sshConnectionStates: mocks.connectionStates, - recordFeatureInteraction: mocks.recordInteraction, - setSshTargetsMetadata: vi.fn(), - recordSshRepoReadoptions: mocks.recordReadoptions, - openSettingsTarget: mocks.openSettingsTarget, - repos: [], - worktreesByRepo: {} - } - return { - useAppStore: Object.assign((select: (value: typeof state) => unknown) => select(state), { - getState: () => state - }) - } -}) -vi.mock('@/ssh/ssh-old-relay-terminals-action', () => ({ - useSshConnectFailureToast: () => vi.fn() -})) -vi.mock('./targets/SshTargetForm', () => ({ SshTargetForm: () => null })) -vi.mock('../../ssh-host-form/ssh-target-draft', () => ({ EMPTY_FORM: {} })) -vi.mock('./targets/SshTargetDestructiveActions', () => ({ - SshTargetDestructiveActions: ({ - children - }: { - children: (actions: { - busyActionForTarget: () => undefined - requestRemove: () => void - requestBulkRemove: () => void - }) => ReactNode - }) => - children({ - busyActionForTarget: () => undefined, - requestRemove: mocks.requestRemove, - requestBulkRemove: mocks.requestBulkRemove - }) -})) -vi.mock('./server-actions/SshTargetServerStatus', () => ({ - SshTargetServerStatusLine: () => null, - SshTargetServerMenuItems: () => null, - SshTargetServerDialogs: () => null -})) -// Radix menus open on pointer events happy-dom doesn't model; render items as plain buttons. -vi.mock('../../ui/dropdown-menu', () => { - const passthrough = ({ children }: { children?: ReactNode }): ReactNode => children - return { - DropdownMenu: passthrough, - DropdownMenuTrigger: passthrough, - DropdownMenuContent: passthrough, - DropdownMenuSeparator: () => null, - DropdownMenuItem: ({ children, onSelect }: { children?: ReactNode; onSelect?: () => void }) => ( - - ) - } -}) -vi.mock('./targets/SshTargetsEmptyState', () => ({ SshTargetsEmptyState: () => null })) - -let root: ReturnType | null = null -let container: HTMLDivElement | null = null - -afterEach(async () => { - await act(async () => { - root?.unmount() - }) - container?.remove() - container = null - root = null - Reflect.deleteProperty(window, 'api') - resetSshConfigPassiveSyncForTests() - mocks.connectionStates.clear() - vi.clearAllMocks() -}) - -describe('bulk removal from SSH settings', () => { - const host = (id: string, extra: Partial = {}): SshTarget => ({ - id, - label: id, - host: `${id}.example.test`, - port: 22, - username: 'dev', - source: 'ssh-config', - ...extra - }) - - async function renderPane(targets: SshTarget[]): Promise { - Object.defineProperty(window, 'api', { - configurable: true, - value: { - ssh: { - importConfig: async () => ({ targets: [], repoReadoptions: [] }), - listTargets: async () => targets, - removeTarget: vi.fn(), - testConnection: async ({ targetId }: { targetId: string }) => - targetId === 'beta' ? { success: false, error: 'timed out' } : { success: true } - } - } - }) - container = document.createElement('div') - document.body.appendChild(container) - root = createRoot(container) - await act(async () => { - root?.render( - - - - ) - }) - return container - } - - function checkbox(host: HTMLElement, label: string): HTMLElement { - return host.querySelector(`[aria-label="Select ${label}"]`)! - } - - it('drops hosts the filter hides from the selection, so they are never removed unseen', async () => { - const names = ['alpha', 'beta', 'c3', 'c4', 'c5', 'c6', 'c7', 'c8', 'c9'] - const pane = await renderPane(names.map((name) => host(name))) - await act(async () => checkbox(pane, 'alpha').click()) - await act(async () => checkbox(pane, 'beta').click()) - expect(pane.textContent).toContain('2 selected') - const filter = pane.querySelector('input[aria-label="Filter hosts"]')! - await act(async () => { - Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, 'value')?.set?.call( - filter, - 'beta' - ) - filter.dispatchEvent(new Event('input', { bubbles: true })) - }) - expect(pane.textContent).toContain('1 selected') - const remove = Array.from(pane.querySelectorAll('button')).find( - (button) => button.textContent === 'Remove 1' - ) - await act(async () => remove?.click()) - expect(mocks.requestRemove).toHaveBeenCalledWith(expect.objectContaining({ id: 'beta' })) - expect(mocks.requestBulkRemove).not.toHaveBeenCalled() - - // Explain when filtering deselects the last host instead of silently hiding the bulk bar. - await act(async () => { - Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, 'value')?.set?.call(filter, 'c3') - filter.dispatchEvent(new Event('input', { bubbles: true })) - }) - expect(pane.textContent).not.toContain('selected ') - expect(pane.textContent).toContain('1 hidden host deselected') - }) -}) diff --git a/src/renderer/src/components/settings/ssh/SshPane.tsx b/src/renderer/src/components/settings/ssh/SshPane.tsx index e4cf3dcb957..c9ec1be93fe 100644 --- a/src/renderer/src/components/settings/ssh/SshPane.tsx +++ b/src/renderer/src/components/settings/ssh/SshPane.tsx @@ -1,7 +1,6 @@ import { selectWorktreesByRepo } from '@/store/workspaces/catalog/workspace-record-fields' import { useCallback, useEffect, useMemo, useState } from 'react' import { toast } from 'sonner' -import type { SshTarget } from '../../../../../shared/ssh-types' import { useAppStore } from '@/store/index' import { toastSshConnectFailure } from '@/ssh/ssh-connect-failure-toast' import { useMountedRef } from '@/hooks/useMountedRef' @@ -22,12 +21,8 @@ import { } from './targets/ssh-target-list-model' import { useSshBulkRemove } from './targets/use-ssh-bulk-remove' import { SshTargetForm } from './targets/SshTargetForm' -import { - EMPTY_FORM, - type EditingTarget, - getEditingTargetForSshTarget -} from '../../ssh-host-form/ssh-target-draft' - +import { EMPTY_FORM, getEditingTargetForSshTarget } from '../../ssh-host-form/ssh-target-draft' +import type { EditingTarget } from '../../ssh-host-form/ssh-target-draft' import { buildSshTargetSavePayload } from './targets/ssh-target-save-payload' import { HostRemoveDialog } from '../../sidebar/HostRemoveDialog' import { @@ -41,7 +36,8 @@ import { toSshExecutionHostId } from '../../../../../shared/execution-host' import { translate } from '@/i18n/i18n' import { useTranslate } from '@/i18n/use-translate' import { useSshAddTargetIntent } from './targets/use-ssh-add-target-intent' -import { syncSshConfigTargetsPassively } from '../../../lib/ssh-config-passive-sync' +import { syncSshConfigTargetsPassively } from '../../../runtime/hosts/ssh/ssh-config-passive-sync' +import type { SshTarget } from '../../../../../shared/ssh-types' type SshPaneProps = { addTargetIntentSignal?: number } diff --git a/src/renderer/src/components/settings/tasks/use-task-source-provider-readiness.ts b/src/renderer/src/components/settings/tasks/use-task-source-provider-readiness.ts index 12fbc051e46..1019b13600e 100644 --- a/src/renderer/src/components/settings/tasks/use-task-source-provider-readiness.ts +++ b/src/renderer/src/components/settings/tasks/use-task-source-provider-readiness.ts @@ -1,5 +1,4 @@ import { useMemo } from 'react' -import type { TaskProvider } from '../../../../../shared/work-items/task-providers' import { GLOBAL_AGENT_SKILL_SOURCE_KINDS, useInstalledAgentSkillNames @@ -7,10 +6,11 @@ import { import { useActiveProjectSkillRuntime } from '@/hooks/skills/runtime/useActiveProjectSkillRuntime' import { useLinearProviderConnected } from '@/hooks/useLinearProviderConnected' import { LINEAR_AGENT_SKILL_NAMES } from '@/lib/skills/installation/agent-feature-skill-names' -import { getLocalPreflightContext } from '@/lib/local-preflight-context' -import { localPreflightContextKey } from '@/lib/local-preflight-context-key' +import { getLocalPreflightContext } from '@/runtime/hosts/preflight/local-preflight-context' +import { localPreflightContextKey } from '@/runtime/hosts/preflight/local-preflight-context-key' import { getProviderRuntimeContextKey } from '@/runtime/hosts/observations/provider-runtime-context' import { useAppStore } from '@/store/index' +import type { TaskProvider } from '../../../../../shared/work-items/task-providers' import type { TaskProviderReadiness } from './task-source-setup-state' export function useTaskSourceProviderReadiness( diff --git a/src/renderer/src/components/settings/terminal/appearance/TerminalAdvancedTypographyControls.tsx b/src/renderer/src/components/settings/terminal/appearance/TerminalAdvancedTypographyControls.tsx index 075626ce914..653290c1e47 100644 --- a/src/renderer/src/components/settings/terminal/appearance/TerminalAdvancedTypographyControls.tsx +++ b/src/renderer/src/components/settings/terminal/appearance/TerminalAdvancedTypographyControls.tsx @@ -1,4 +1,3 @@ -import type { GlobalSettings } from '../../../../../../shared/global-settings-types' import { DEFAULT_TERMINAL_FONT_WEIGHT_BOLD, TERMINAL_FONT_WEIGHT_MAX, @@ -17,11 +16,12 @@ import { SettingsSegmentedControl } from '../../form-controls/SettingsFormControls' import { SearchableSetting } from '../../section-layout/SearchableSetting' -import { clampNumber } from '@/lib/terminal-theme' +import { clampNumber } from '@/lib/terminal/appearance/terminal-theme' import { useTranslate } from '@/i18n/use-translate' import { defaultTerminalFontWeight } from '../../../../../../shared/terminal/appearance/terminal-platform-defaults' import { isWindowsDesktopClient } from '@/lib/files/os-open/windows-path-access' import { getTerminalAdvancedTypographySearchEntries } from './terminal-typography-search' +import type { GlobalSettings } from '../../../../../../shared/global-settings-types' type TerminalAdvancedTypographyControlsProps = { settings: GlobalSettings diff --git a/src/renderer/src/components/settings/terminal/appearance/TerminalCursorAppearanceSection.tsx b/src/renderer/src/components/settings/terminal/appearance/TerminalCursorAppearanceSection.tsx index 5846001e6f7..2ce2f715aab 100644 --- a/src/renderer/src/components/settings/terminal/appearance/TerminalCursorAppearanceSection.tsx +++ b/src/renderer/src/components/settings/terminal/appearance/TerminalCursorAppearanceSection.tsx @@ -1,4 +1,3 @@ -import type { GlobalSettings } from '../../../../../../shared/global-settings-types' import { NumberField, SettingsRow, @@ -7,8 +6,9 @@ import { SettingsSwitchRow } from '../../form-controls/SettingsFormControls' import { SearchableSetting } from '../../section-layout/SearchableSetting' -import { clampNumber } from '@/lib/terminal-theme' +import { clampNumber } from '@/lib/terminal/appearance/terminal-theme' import { useTranslate } from '@/i18n/use-translate' +import type { GlobalSettings } from '../../../../../../shared/global-settings-types' type TerminalCursorAppearanceSectionProps = { settings: GlobalSettings diff --git a/src/renderer/src/components/settings/terminal/appearance/TerminalPaneAppearanceSection.tsx b/src/renderer/src/components/settings/terminal/appearance/TerminalPaneAppearanceSection.tsx index 3939ad1cb7d..dd310e60e98 100644 --- a/src/renderer/src/components/settings/terminal/appearance/TerminalPaneAppearanceSection.tsx +++ b/src/renderer/src/components/settings/terminal/appearance/TerminalPaneAppearanceSection.tsx @@ -1,9 +1,9 @@ -import type { GlobalSettings } from '../../../../../../shared/global-settings-types' import { DEFAULT_TERMINAL_INACTIVE_PANE_OPACITY } from '../../../../../../shared/constants' import { NumberField, SettingsSubsectionHeader } from '../../form-controls/SettingsFormControls' import { SearchableSetting } from '../../section-layout/SearchableSetting' -import { clampNumber, resolvePaneStyleOptions } from '@/lib/terminal-theme' +import { clampNumber, resolvePaneStyleOptions } from '@/lib/terminal/appearance/terminal-theme' import { useTranslate } from '@/i18n/use-translate' +import type { GlobalSettings } from '../../../../../../shared/global-settings-types' type TerminalPaneAppearanceSectionProps = { settings: GlobalSettings diff --git a/src/renderer/src/components/settings/terminal/appearance/TerminalSettingsPreview.tsx b/src/renderer/src/components/settings/terminal/appearance/TerminalSettingsPreview.tsx index 22396768c58..bc1e9fc9f86 100644 --- a/src/renderer/src/components/settings/terminal/appearance/TerminalSettingsPreview.tsx +++ b/src/renderer/src/components/settings/terminal/appearance/TerminalSettingsPreview.tsx @@ -11,15 +11,18 @@ import { usePluginFontReady } from '@/store/plugins/appearance/plugin-fonts' import { composeActiveTerminalTheme } from '@/components/terminal-pane/appearance/terminal-appearance' -import { clampNumber, resolveEffectiveTerminalAppearance } from '@/lib/terminal-theme' +import { + clampNumber, + resolveEffectiveTerminalAppearance +} from '@/lib/terminal/appearance/terminal-theme' import { resolveTerminalMinimumContrastRatio } from '../../../../../../shared/terminal-themes/terminal-contrast-correction' import { resolveTerminalFontWeights } from '../../../../../../shared/terminal/appearance/terminal-fonts' import { resolveTerminalLigaturesEnabled } from '../../../../../../shared/terminal/appearance/terminal-ligatures' import { normalizeTerminalLineHeight } from '../../../../../../shared/terminal/appearance/terminal-line-height-settings' import { PREVIEW_BUFFER } from './terminal-preview-content' import { Switch } from '@/components/ui/switch' -import type { GlobalSettings } from '../../../../../../shared/global-settings-types' import { useTranslate } from '@/i18n/use-translate' +import type { GlobalSettings } from '../../../../../../shared/global-settings-types' // Pin 36 columns for the 32-character sample plus margin; large fonts clip instead of wrapping. const PREVIEW_COLS = 36 diff --git a/src/renderer/src/components/settings/terminal/appearance/TerminalWindowSection.tsx b/src/renderer/src/components/settings/terminal/appearance/TerminalWindowSection.tsx index 80627651c22..80532a9a5e2 100644 --- a/src/renderer/src/components/settings/terminal/appearance/TerminalWindowSection.tsx +++ b/src/renderer/src/components/settings/terminal/appearance/TerminalWindowSection.tsx @@ -1,21 +1,20 @@ import { useState } from 'react' -import type { GlobalSettings } from '../../../../../../shared/global-settings-types' import { TERMINAL_COLOR_OVERRIDES_SETTING, - terminalColorOverridesForSlot, - type TerminalThemeSlot + terminalColorOverridesForSlot } from '../../../../../../shared/terminal-themes/terminal-color-overrides' +import type { TerminalThemeSlot } from '../../../../../../shared/terminal-themes/terminal-color-overrides' import { Button } from '../../../ui/button' import { Label } from '../../../ui/label' import { Switch } from '../../../ui/switch' import { ColorField, NumberField } from '../../form-controls/SettingsFormControls' import { SearchableSetting } from '../../section-layout/SearchableSetting' -import { clampNumber } from '@/lib/terminal-theme' +import { clampNumber } from '@/lib/terminal/appearance/terminal-theme' import { isWebClientLocation } from '@/app-shell/platform/web-client-location' import { WindowMaterialSetting } from '../../appearance/WindowMaterialSetting' import { useTranslate } from '@/i18n/use-translate' - import { COLOR_OVERRIDE_GROUPS } from './terminal-window-color-groups' +import type { GlobalSettings } from '../../../../../../shared/global-settings-types' type TerminalWindowSectionProps = { settings: GlobalSettings diff --git a/src/renderer/src/components/settings/terminal/configuration/useTerminalConfigImport.ts b/src/renderer/src/components/settings/terminal/configuration/useTerminalConfigImport.ts index 81a796345d8..1caae050e19 100644 --- a/src/renderer/src/components/settings/terminal/configuration/useTerminalConfigImport.ts +++ b/src/renderer/src/components/settings/terminal/configuration/useTerminalConfigImport.ts @@ -1,13 +1,13 @@ import { useRef, useState } from 'react' -import type { GlobalSettings } from '../../../../../../shared/global-settings-types' import { useMountedRef } from '../../../../hooks/useMountedRef' -import { - terminalConfigImportSettingsUpdate, - type TerminalConfigImportFormat, - type TerminalConfigImportPreview, - type TerminalConfigImportSource +import { terminalConfigImportSettingsUpdate } from '../../../../../../shared/terminal/appearance/terminal-config-import-preview' +import type { + TerminalConfigImportFormat, + TerminalConfigImportPreview, + TerminalConfigImportSource } from '../../../../../../shared/terminal/appearance/terminal-config-import-preview' -import { getSystemPrefersDark } from '@/lib/terminal-theme' +import { getSystemPrefersDark } from '@/lib/terminal/appearance/terminal-theme' +import type { GlobalSettings } from '../../../../../../shared/global-settings-types' export type UseTerminalConfigImportReturn = { format: TerminalConfigImportFormat diff --git a/src/renderer/src/components/settings/terminal/themes/TerminalThemePicker.tsx b/src/renderer/src/components/settings/terminal/themes/TerminalThemePicker.tsx index 88033942442..e33e9034059 100644 --- a/src/renderer/src/components/settings/terminal/themes/TerminalThemePicker.tsx +++ b/src/renderer/src/components/settings/terminal/themes/TerminalThemePicker.tsx @@ -1,11 +1,11 @@ -import type React from 'react' import { useState } from 'react' +import type React from 'react' import { Trash2 } from 'lucide-react' import { ThemeColorSwatch } from '../../../plugins/page/PluginThemeSwatch' import { SettingsRow } from '../../form-controls/SettingsFormControls' import { SettingsSearchableSelect } from '../../form-controls/SettingsSearchableSelect' import { useTranslate } from '@/i18n/use-translate' -import type { TerminalThemeOption } from '@/lib/terminal-theme' +import type { TerminalThemeOption } from '@/lib/terminal/appearance/terminal-theme' type ThemePickerProps = { label: string diff --git a/src/renderer/src/components/settings/terminal/themes/TerminalThemeSections.tsx b/src/renderer/src/components/settings/terminal/themes/TerminalThemeSections.tsx index 81c5361ea83..3a886ce55c9 100644 --- a/src/renderer/src/components/settings/terminal/themes/TerminalThemeSections.tsx +++ b/src/renderer/src/components/settings/terminal/themes/TerminalThemeSections.tsx @@ -1,21 +1,21 @@ import { usePluginTerminalThemes } from '@/store/plugins/appearance/plugin-themes' import { withTerminalPluginPalettes } from '@/lib/terminal/themes/terminal-plugin-palettes' -import { useState, type ReactNode } from 'react' +import { useState } from 'react' +import type { ReactNode } from 'react' import { toast } from 'sonner' import { useAppStore } from '@/store/index' -import type { GlobalSettings } from '../../../../../../shared/global-settings-types' import { parseCustomTerminalThemeSelection } from '../../../../../../shared/terminal-themes/terminal-custom-themes' import { terminalCustomThemeRemoval, - type TerminalCustomThemeRemoval, DEFAULT_TERMINAL_THEME_DARK, DEFAULT_TERMINAL_THEME_LIGHT } from '../../../../../../shared/terminal-themes/terminal-theme-selection' +import type { TerminalCustomThemeRemoval } from '../../../../../../shared/terminal-themes/terminal-theme-selection' import { hasTerminalColorOverrides, - TERMINAL_COLOR_OVERRIDES_SETTING, - type TerminalThemeSlot + TERMINAL_COLOR_OVERRIDES_SETTING } from '../../../../../../shared/terminal-themes/terminal-color-overrides' +import type { TerminalThemeSlot } from '../../../../../../shared/terminal-themes/terminal-color-overrides' import { ColorField, SettingsSegmentedControl, @@ -27,15 +27,15 @@ import { SearchableSetting } from '../../section-layout/SearchableSetting' import { TerminalSettingsPreview } from '../appearance/TerminalSettingsPreview' import { WarpThemeImportButton } from './WarpThemeImportButton' import { YamlThemeImportButton } from './YamlThemeImportButton' -import type { UseWarpThemeImportReturn } from './useWarpThemeImport' - import { getAvailableTerminalThemeOptions, - resolveEffectiveTerminalAppearance, - type TerminalThemeOption -} from '@/lib/terminal-theme' + resolveEffectiveTerminalAppearance +} from '@/lib/terminal/appearance/terminal-theme' +import type { TerminalThemeOption } from '@/lib/terminal/appearance/terminal-theme' import { useTranslate } from '@/i18n/use-translate' import { cn } from '@/lib/class-names' +import type { GlobalSettings } from '../../../../../../shared/global-settings-types' +import type { UseWarpThemeImportReturn } from './useWarpThemeImport' let lastEditedTerminalThemeTarget: TerminalThemeSlot | null = null diff --git a/src/renderer/src/components/setup-guide/use-setup-guide-progress.ts b/src/renderer/src/components/setup-guide/use-setup-guide-progress.ts index d1d61a59c13..4d7fe6deb47 100644 --- a/src/renderer/src/components/setup-guide/use-setup-guide-progress.ts +++ b/src/renderer/src/components/setup-guide/use-setup-guide-progress.ts @@ -1,9 +1,9 @@ import { useCallback, useEffect, useMemo, useRef, useState, useSyncExternalStore } from 'react' -import { useAppStore } from '@/store' +import { useAppStore } from '@/store/index' import { isGitRepoKind } from '../../../../shared/repo-kind' import { getRepoExecutionHostId } from '../../../../shared/execution-host' import { checkRuntimeHooks } from '@/runtime/repo-hooks/runtime-hooks-client' -import { getLocalPreflightContext, localPreflightContextKey } from '@/lib/local-preflight-context' +import { getLocalPreflightContext } from '@/runtime/hosts/preflight/local-preflight-context' import { hasEffectiveSetupCommand } from '@/runtime/repo-hooks/setup-script-status' import { getProviderRuntimeContextKey } from '@/runtime/hosts/observations/provider-runtime-context' import { @@ -16,10 +16,8 @@ import { useInstalledAgentSkill } from '@/hooks/skills/discovery/useInstalledAgentSkills' import { useOnboardingSkillRuntime } from '@/hooks/skills/runtime/use-onboarding-skill-runtime' -import { - getSetupGuideProgressSnapshot, - type FeatureWallSetupProgress -} from '../feature-wall/feature-wall-setup-progress' +import { getSetupGuideProgressSnapshot } from '../feature-wall/feature-wall-setup-progress' +import type { FeatureWallSetupProgress } from '../feature-wall/feature-wall-setup-progress' import { deriveIntegrationConnectionStatus } from '../feature-wall/use-integration-connection-status' import { useSetupGuideBrowserMilestoneProgress } from './setup-guide-browser-milestone-progress' import { @@ -34,6 +32,7 @@ import { setSetupScriptProbeCache, subscribeSetupScriptProbeCache } from './setup-script-probe-cache' +import { localPreflightContextKey } from '../../runtime/hosts/preflight/local-preflight-context-key' const SETUP_SCRIPT_PROBE_SETTLE_TIMEOUT_MS = 15_000 diff --git a/src/renderer/src/components/sidebar/SidebarTaskNavButton.tsx b/src/renderer/src/components/sidebar/SidebarTaskNavButton.tsx index d3eed6fd78e..62de718b65d 100644 --- a/src/renderer/src/components/sidebar/SidebarTaskNavButton.tsx +++ b/src/renderer/src/components/sidebar/SidebarTaskNavButton.tsx @@ -9,7 +9,7 @@ import { ContextMenuTrigger } from '@/components/ui/context-menu' import { PER_REPO_FETCH_LIMIT } from '../../../../shared/work-items/work-item-pagination' -import { getLocalPreflightContext, localPreflightContextKey } from '@/lib/local-preflight-context' +import { getLocalPreflightContext } from '@/runtime/hosts/preflight/local-preflight-context' import { cn } from '@/lib/class-names' import { useAppStore } from '@/store/index' import { useRepoMap } from '@/store/repos/use-repository-catalog' @@ -21,6 +21,7 @@ import { restoreAvailableDefaultTaskProvider, resolveVisibleTaskProvider } from '../../../../shared/work-items/task-providers' +import { localPreflightContextKey } from '../../runtime/hosts/preflight/local-preflight-context-key' function HideTaskSidebarMenu({ onHide }: { onHide: () => void }): React.JSX.Element { const t = useTranslate() diff --git a/src/renderer/src/components/sidebar/project-move-pause-follower.test.ts b/src/renderer/src/components/sidebar/project-move-pause-follower.test.ts index 8a5776cdf3a..08e516ad2fc 100644 --- a/src/renderer/src/components/sidebar/project-move-pause-follower.test.ts +++ b/src/renderer/src/components/sidebar/project-move-pause-follower.test.ts @@ -1,4 +1,5 @@ import { beforeEach, describe, expect, it, vi } from 'vitest' +import { createProjectMovePauseFollower } from './project-move-pause-follower' import type { AppState } from '@/store/types' import type { ProjectMovePauseResponse } from '../../../../shared/project-move-pause' @@ -21,10 +22,10 @@ const mocks = vi.hoisted(() => { payload: vi.fn(() => ({})) } }) -vi.mock('@/store', () => ({ +vi.mock('@/store/index', () => ({ useAppStore: { getState: () => mocks.state, subscribe: () => () => {} } })) -vi.mock('@/lib/worktree-sleep-intent', () => ({ +vi.mock('@/lib/workspace/sleep/worktree-sleep-intent', () => ({ clearWorktreeSleepIntent: vi.fn(), markWorktreeSleepIntent: vi.fn(), withWorktreeSleepTeardown: (_id: string, action: () => Promise) => action() @@ -36,7 +37,6 @@ vi.mock('@/lib/workspace/persistence/workspace-session-host-persistence', () => persistWorkspaceSessionByHost: mocks.persist })) vi.mock('sonner', () => ({ toast: { error: vi.fn(), warning: vi.fn() } })) -import { createProjectMovePauseFollower } from './project-move-pause-follower' function fixture() { const responses: ProjectMovePauseResponse[] = [] diff --git a/src/renderer/src/components/sidebar/workspace-actions/context-menu/use-worktree-context-menu-commands.ts b/src/renderer/src/components/sidebar/workspace-actions/context-menu/use-worktree-context-menu-commands.ts index 2fee024933e..82e0362fb2e 100644 --- a/src/renderer/src/components/sidebar/workspace-actions/context-menu/use-worktree-context-menu-commands.ts +++ b/src/renderer/src/components/sidebar/workspace-actions/context-menu/use-worktree-context-menu-commands.ts @@ -1,13 +1,10 @@ import { useCallback } from 'react' -import type { useAppStore } from '@/store/index' -import type { Repo } from '../../../../../../shared/repo-types' import { getRepoExecutionHostId, LOCAL_EXECUTION_HOST_ID } from '../../../../../../shared/execution-host' import { getRepoWorkspaceCreationTargetHint } from '@/lib/workspace/creation/project-host-workspace-target' -import { resolveReviewRepository } from '@/lib/review-owner' -import type { WorkspaceStatusDefinition, Worktree } from '../../../../../../shared/worktree/types' +import { resolveReviewRepository } from '@/lib/source-control/review/review-owner' import { createWorktreeContextMenuDeleteIntent, deferWorktreeContextMenuDeleteIntent @@ -24,6 +21,9 @@ import { planWorkspaceStatusAssignment, preserveDeleteSiblingPosition } from './worktree-context-menu-policy' +import type { useAppStore } from '@/store/index' +import type { Repo } from '../../../../../../shared/repo-types' +import type { WorkspaceStatusDefinition, Worktree } from '../../../../../../shared/worktree/types' function resolveChildWorktreeRepository(repos: readonly Repo[], worktree: Worktree): Repo | null { return resolveReviewRepository(repos, { diff --git a/src/renderer/src/components/sidebar/workspace-actions/sleep/workspace-sleep-follower.ts b/src/renderer/src/components/sidebar/workspace-actions/sleep/workspace-sleep-follower.ts index c6d0e7f9167..63f9424b6da 100644 --- a/src/renderer/src/components/sidebar/workspace-actions/sleep/workspace-sleep-follower.ts +++ b/src/renderer/src/components/sidebar/workspace-actions/sleep/workspace-sleep-follower.ts @@ -1,18 +1,18 @@ -import { useAppStore } from '@/store' +import { useAppStore } from '@/store/index' import { captureWorkspaceSelection, - restoreWorkspaceSelection, - type WorkspaceSelection + restoreWorkspaceSelection } from '@/lib/workspace/ownership/active-workspace-host' +import type { WorkspaceSelection } from '@/lib/workspace/ownership/active-workspace-host' import { clearWorktreeSleepIntent, markWorktreeSleepIntent, withWorktreeSleepTeardown -} from '@/lib/worktree-sleep-intent' -import type { HostTerminalStop } from '@/store/terminals/terminal-actions' -import type { WorkspaceSleepNotice } from '../../../../../../shared/workspace-sleep' +} from '@/lib/workspace/sleep/worktree-sleep-intent' import { preserveSidebarWorktreePosition } from './sleep-worktree-sidebar-position' import { toastWorkspaceSleepOutcome } from './sleep-worktree-flow' +import type { HostTerminalStop } from '@/store/terminals/terminal-actions' +import type { WorkspaceSleepNotice } from '../../../../../../shared/workspace-sleep' type FollowedSleep = { settle: (stop: HostTerminalStop) => void diff --git a/src/renderer/src/components/sidebar/worktree-list/listing/use-sleeping-sweep-retention.ts b/src/renderer/src/components/sidebar/worktree-list/listing/use-sleeping-sweep-retention.ts index 6fe4f8231f1..acf6c54f089 100644 --- a/src/renderer/src/components/sidebar/worktree-list/listing/use-sleeping-sweep-retention.ts +++ b/src/renderer/src/components/sidebar/worktree-list/listing/use-sleeping-sweep-retention.ts @@ -1,15 +1,15 @@ import { useEffect, useMemo, useRef, useState } from 'react' import { hasActiveWorkspaceActivity } from '@/lib/workspace/activity/worktree-activity-state' import { recomputeOn } from '@/lib/recompute-on' -import { hasWorktreeSleepIntent } from '@/lib/worktree-sleep-intent' +import { hasWorktreeSleepIntent } from '@/lib/workspace/sleep/worktree-sleep-intent' import { getIndexedAllWorktrees } from '@/store/slices/worktrees/listing/worktree-catalog-index' -import type { Worktree } from '../../../../../../shared/worktree/types' -import type { VisibleWorktreeOptions } from './compute-visible-worktrees' import { cloneSleepingSweepRetentionState, createSleepingSweepRetentionState, updateSleepingSweepRetention } from '../../../../../../shared/sidebar-list/sleeping-sweep-retention' +import type { Worktree } from '../../../../../../shared/worktree/types' +import type { VisibleWorktreeOptions } from './compute-visible-worktrees' type SweepActivityInputs = Pick< VisibleWorktreeOptions, diff --git a/src/renderer/src/components/sidebar/worktree-list/listing/use-visible-worktrees-retention.test.tsx b/src/renderer/src/components/sidebar/worktree-list/listing/use-visible-worktrees-retention.test.tsx index c02c7dea796..4d1f4ee31de 100644 --- a/src/renderer/src/components/sidebar/worktree-list/listing/use-visible-worktrees-retention.test.tsx +++ b/src/renderer/src/components/sidebar/worktree-list/listing/use-visible-worktrees-retention.test.tsx @@ -1,17 +1,20 @@ // @vitest-environment happy-dom -import { Suspense, startTransition, useEffect } from 'react' -import { act, cleanup, render, renderHook } from '@testing-library/react' +import 'react' +import { act, cleanup, renderHook } from '@testing-library/react' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' -import { useAppStore } from '@/store' +import { useAppStore } from '@/store/index' import { LOCAL_EXECUTION_HOST_ID } from '../../../../../../shared/execution-host' import { makeRepo, makeTerminalTab, makeWorktree } from '../../../worktree-jump/worktree-jump-palette-test-fixtures' -import { SLEEPING_SWEEP_SETTLE_MS } from '../../../../../../shared/sidebar-list/sleeping-sweep-retention' -import { forgetWorktreeSleepIntent, markWorktreeSleepIntent } from '@/lib/worktree-sleep-intent' +import '../../../../../../shared/sidebar-list/sleeping-sweep-retention' +import { + forgetWorktreeSleepIntent, + markWorktreeSleepIntent +} from '@/lib/workspace/sleep/worktree-sleep-intent' import { useVisibleSidebarWorktrees } from './use-visible-worktrees' const initialState = useAppStore.getInitialState() @@ -67,93 +70,6 @@ describe('useVisibleSidebarWorktrees sleeping retention', () => { vi.useRealTimers() }) - it('does not start a grace deadline in a suspended uncommitted render', () => { - let suspend = false - let commits = 0 - let suspendedRenders = 0 - const pending = new Promise(() => {}) - function Probe() { - const result = useVisibleSidebarWorktrees(args) - useEffect(() => { - commits += 1 - }) - if (suspend) { - suspendedRenders += 1 - throw pending - } - return {visibleIds(result).join(',')} - } - const view = () => ( - Pending}> - - - ) - const rendered = render(view()) - const initialCommits = commits - suspend = true - setPtyBound(false) - expect(suspendedRenders).toBeGreaterThan(0) - expect(commits).toBe(initialCommits) - - vi.setSystemTime(1_000 + SLEEPING_SWEEP_SETTLE_MS) - suspend = false - rendered.rerender(view()) - expect(rendered.getByText(worktree.id)).toBeDefined() - act(() => vi.advanceTimersByTime(SLEEPING_SWEEP_SETTLE_MS - 1)) - expect(rendered.getByText(worktree.id)).toBeDefined() - act(() => vi.advanceTimersByTime(1)) - expect(rendered.queryByText(worktree.id)).toBeNull() - }) - - it('does not reset committed retention when a show-sleeping transition is abandoned', async () => { - let suspendedRenders = 0 - let sleepingCommits = 0 - const pending = new Promise(() => {}) - function Probe({ showSleeping }: { showSleeping: boolean }) { - const result = useVisibleSidebarWorktrees({ - ...args, - filterState: { ...args.filterState, showSleepingWorkspaces: showSleeping } - }) - useEffect(() => { - if (showSleeping) { - sleepingCommits += 1 - } - }, [showSleeping]) - if (showSleeping) { - suspendedRenders += 1 - throw pending - } - return {visibleIds(result).join(',')} - } - const view = (showSleeping: boolean) => ( - Pending}> - - - ) - const rendered = render(view(false)) - await act(async () => { - startTransition(() => rendered.rerender(view(true))) - }) - expect(suspendedRenders).toBeGreaterThan(0) - expect(sleepingCommits).toBe(0) - expect(rendered.queryByText('Pending')).toBeNull() - - rendered.rerender(view(false)) - setPtyBound(false) - expect(rendered.getByText(worktree.id)).toBeDefined() - act(() => vi.advanceTimersByTime(SLEEPING_SWEEP_SETTLE_MS)) - expect(rendered.queryByText(worktree.id)).toBeNull() - }) - - it('forgets removed current worktrees even when their cached sort ID remains', () => { - const { result } = renderHook(() => useVisibleSidebarWorktrees(args)) - act(() => useAppStore.setState({ worktreesByRepo: {} })) - setPtyBound(false) - act(() => useAppStore.setState({ worktreesByRepo: { [repo.id]: [worktree] } })) - expect(visibleIds(result.current)).toEqual([]) - expect(vi.getTimerCount()).toBe(0) - }) - it('sweeps a deliberately slept row without a grace window', () => { const { result } = renderHook(() => useVisibleSidebarWorktrees(args)) markWorktreeSleepIntent(worktree.id) diff --git a/src/renderer/src/components/status-bar/SshStatusSegment.large-host-list.test.tsx b/src/renderer/src/components/status-bar/SshStatusSegment.large-host-list.test.tsx deleted file mode 100644 index 3a756b77fe5..00000000000 --- a/src/renderer/src/components/status-bar/SshStatusSegment.large-host-list.test.tsx +++ /dev/null @@ -1,138 +0,0 @@ -// @vitest-environment happy-dom -import type { PropsWithChildren } from 'react' -import { cleanup, fireEvent, render, screen } from '@testing-library/react' -import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' -import type { GlobalSettings } from '../../../../shared/global-settings-types' -import type { PublicKnownRuntimeEnvironment } from '../../../../shared/remote-runtime/host-catalog/runtime-environments' -import type { RuntimeEnvironmentStatus } from '../../../../shared/remote-runtime/host-status/runtime-host-status' -import type { SshConnectionState, SshConnectionStatus } from '../../../../shared/ssh-types' -import type { Repo } from '../../../../shared/repo-types' -import { SshStatusSegment } from './SshStatusSegment' -import { HOST_LIST_ROW_LIMIT } from '../host-picker/bounded-host-list' -import { SSH_STATUS_MENU_IDLE_ROW_LIMIT } from './ssh-status-menu-rows' - -function noSettings(): GlobalSettings | null { - return null -} - -const state = { - sshTargetLabels: new Map(), - sshConnectionStates: new Map(), - repos: new Array>(), - runtimeEnvironments: new Array(), - runtimeStatusByEnvironmentId: new Map(), - settings: noSettings(), - readRuntimeHostStatusSnapshots: vi.fn(async () => undefined), - hydrateRuntimeEnvironmentStatuses: vi.fn(), - recordFeatureInteraction: vi.fn(), - openSettingsTarget: vi.fn(), - setActiveView: vi.fn() -} - -vi.mock('../../store', () => { - const useAppStore = (selector: (value: typeof state) => unknown) => selector(state) - useAppStore.getState = () => state - return { useAppStore } -}) -vi.mock('../../lib/ssh-config-passive-sync', () => ({ - syncSshConfigTargetsPassively: vi.fn(async () => undefined) -})) -vi.mock('@/components/ui/dropdown-menu', () => { - const content = ({ children }: PropsWithChildren) =>
{children}
- return { - DropdownMenu: content, - DropdownMenuContent: content, - DropdownMenuItem: ({ children, onSelect }: PropsWithChildren<{ onSelect?: () => void }>) => ( -
- {children} -
- ), - DropdownMenuSeparator: () =>
, - DropdownMenuTrigger: content, - DropdownMenuSub: content, - DropdownMenuSubContent: content, - DropdownMenuSubTrigger: content - } -}) - -// Why 13,692: the host count from the generated ~/.ssh/config in the crash this guards. -const IMPORTED_HOST_COUNT = 13_692 - -function connectionState(targetId: string, status: SshConnectionStatus): SshConnectionState { - return { targetId, status, error: null, reconnectAttempt: 0 } -} - -beforeEach(() => { - vi.clearAllMocks() - state.sshTargetLabels = new Map( - Array.from({ length: IMPORTED_HOST_COUNT }, (_, index) => [ - `ssh-${index}`, - `node-${String(index).padStart(5, '0')}` - ]) - ) - state.sshConnectionStates = new Map([ - ['ssh-9000', connectionState('ssh-9000', 'connected')], - ['ssh-13000', connectionState('ssh-13000', 'reconnecting')] - ]) - state.repos = [{ id: 'repo-1', connectionId: 'ssh-12345' }] -}) - -afterEach(() => { - cleanup() -}) - -describe('the status menu with a very large imported SSH host list', () => { - it('renders a bounded number of idle host rows instead of one per imported host', () => { - render() - const connectButtons = screen.queryAllByRole('button', { name: 'Connect' }) - expect(connectButtons.length).toBeLessThanOrEqual(SSH_STATUS_MENU_IDLE_ROW_LIMIT + 1) - expect(document.body.getElementsByTagName('*').length).toBeLessThan(2_000) - }) - - it('always lists connected and in-progress hosts, wherever they sit in the list', () => { - render() - expect(screen.getByText('node-09000')).toBeTruthy() - expect(screen.getByText('node-13000')).toBeTruthy() - expect(screen.getByText('node-00000')).toBeTruthy() - expect(screen.queryByText('node-13691')).toBeNull() - }) - - it('offers a search for the hidden hosts that connects the exact host typed', async () => { - const connect = vi.fn(async () => undefined) - vi.stubGlobal('api', { ssh: { connect } }) - state.sshConnectionStates.set('ssh-5', connectionState('ssh-5', 'auth-failed')) - render() - const hidden = IMPORTED_HOST_COUNT - 3 - SSH_STATUS_MENU_IDLE_ROW_LIMIT - fireEvent.click(screen.getByRole('menuitem', { name: `Find among ${hidden} more SSH hosts…` })) - const search = await screen.findByRole('combobox') - fireEvent.change(search, { target: { value: 'node-13691' } }) - expect(screen.getByRole('option', { name: /node-13691/ })).toBeTruthy() - expect(screen.queryByRole('option', { name: /node-00005/ })).toBeNull() - fireEvent.keyDown(search, { key: 'Enter' }) - await vi.waitFor(() => expect(connect).toHaveBeenCalledWith({ targetId: 'ssh-13691' })) - expect(connect).toHaveBeenCalledTimes(1) - vi.unstubAllGlobals() - }) - - it('caps the search results and says how many more match', async () => { - render() - fireEvent.click(screen.getByRole('menuitem', { name: /^Find among/ })) - const search = await screen.findByRole('combobox') - fireEvent.change(search, { target: { value: 'node-1' } }) - expect(screen.getAllByRole('option').length).toBeLessThanOrEqual(HOST_LIST_ROW_LIMIT) - expect(screen.getByText(/more matches\. Keep typing/)).toBeTruthy() - fireEvent.change(search, { target: { value: 'no-such-host' } }) - expect(screen.getByText('No SSH hosts match.')).toBeTruthy() - }) - - it('returns focus to the status button when the search is closed from the keyboard', async () => { - render() - fireEvent.click(screen.getByRole('menuitem', { name: /^Find among/ })) - const search = await screen.findByRole('combobox') - search.focus() - fireEvent.keyDown(search, { key: 'Escape' }) - await vi.waitFor(() => expect(screen.queryByRole('combobox')).toBeNull()) - const trigger = screen.getByRole('button', { name: 'Remote host connection status' }) - await vi.waitFor(() => expect(document.activeElement).toBe(trigger)) - }) -}) diff --git a/src/renderer/src/components/status-bar/SshStatusSegment.tsx b/src/renderer/src/components/status-bar/SshStatusSegment.tsx index f26680b1ba7..a9bcb03240c 100644 --- a/src/renderer/src/components/status-bar/SshStatusSegment.tsx +++ b/src/renderer/src/components/status-bar/SshStatusSegment.tsx @@ -8,8 +8,7 @@ import { DropdownMenuSeparator, DropdownMenuTrigger } from '@/components/ui/dropdown-menu' -import { useAppStore } from '../../store' -import type { SshConnectionStatus } from '../../../../shared/ssh-types' +import { useAppStore } from '../../store/index' import { translate } from '@/i18n/i18n' import { useTranslate } from '@/i18n/use-translate' import { getHostDisplayLabelOverrides } from '../../../../shared/host-setting-overrides' @@ -29,19 +28,20 @@ import { connectedHostCountLabel, moreSshHostsLabel } from './ssh-status-segment import { SshHostFindPopover } from './SshHostFindPopover' import { splitSshStatusMenuRows } from './ssh-status-menu-rows' import { SshTargetStatusRow } from './SshTargetStatusRow' -import { syncSshConfigTargetsPassively } from '../../lib/ssh-config-passive-sync' +import { syncSshConfigTargetsPassively } from '../../runtime/hosts/ssh/ssh-config-passive-sync' import { connectRuntimeHostAndReloadProjects } from './runtime-environment-explicit-connect' import { runtimeHostBlockedCopy, runtimeHostBlockedRecovery, runtimeHostConnectionDetail, runtimeHostStatusForOverall, - sshStatusForOverall, - type RuntimeHostBlockedRecovery + sshStatusForOverall } from './remote-host-connection-status' +import type { RuntimeHostBlockedRecovery } from './remote-host-connection-status' import { runtimeHostConnectionStateForEntry } from '@/runtime/hosts/connections/runtime-host-connection-state' import { isConnectedRuntimeHostState } from '../../../../shared/remote-runtime/host-status/runtime-host-connection-state' import { RuntimeRepairDialog } from '../runtime-access/RuntimeRepairDialog' +import type { SshConnectionStatus } from '../../../../shared/ssh-types' export function SshStatusSegment({ compact, diff --git a/src/renderer/src/components/tab-bar/EditorFileTab.tsx b/src/renderer/src/components/tab-bar/EditorFileTab.tsx index a216bf4d1cc..dd7479ee214 100644 --- a/src/renderer/src/components/tab-bar/EditorFileTab.tsx +++ b/src/renderer/src/components/tab-bar/EditorFileTab.tsx @@ -1,5 +1,4 @@ import { editorTabWorkspace } from '@/store/slices/editor/tabs/workspace-editor-files' -import type { EditorFileTabProps } from './editor-file-tab-props' import { ContextMenu, ContextMenuTrigger } from '@/components/ui/context-menu' import { useCallback, useEffect, useRef, useState } from 'react' import { useSortable } from '@dnd-kit/sortable' @@ -14,15 +13,13 @@ import { detectLanguage } from '../../../../shared/editor-language/editor-langua import { FileTypeIcon } from '@/components/FileTypeIcon' import { useWorktreeById } from '@/store/workspaces/selection/use-selected-worktree' import { getOpenFileExecutionHostId } from '@/lib/workspace/ownership/unified-tab-host-ownership' -import { resolveReviewRepository } from '@/lib/review-owner' +import { resolveReviewRepository } from '@/lib/source-control/review/review-owner' import { useAppStore } from '@/store/index' import { STATUS_COLORS } from '../../lib/source-control/paths/git-path-decoration' import { STATUS_LABELS } from '../../../../shared/git/status/git-status-labels' - import { getUntitledFileRoot } from '@/components/editor/untitled-file-rename-path' import { preventMiddleButtonDefault } from './middle-button-default-guard' import { CLOSE_ALL_CONTEXT_MENUS_EVENT } from '@/lib/overlay-interaction/close-all-context-menus' - import { ACTIVE_TAB_INDICATOR_CLASSES, getDropIndicatorClasses, @@ -41,6 +38,7 @@ import { useTabContextMenuOpening } from './tab-context-menu-opening' import { editorTabDocumentFolderAccess } from '@/lib/files/access/local-file-access' import { useTabCustomEditor } from '@/store/plugins/file-editors/plugin-custom-editors' import { PluginContributionIcon } from '../plugins/PluginContributionIcon' +import type { EditorFileTabProps } from './editor-file-tab-props' export default function EditorFileTab({ file, diff --git a/src/renderer/src/components/tab-bar/TerminalSortableTab.tsx b/src/renderer/src/components/tab-bar/TerminalSortableTab.tsx index 3deeaef1609..b388f334dfb 100644 --- a/src/renderer/src/components/tab-bar/TerminalSortableTab.tsx +++ b/src/renderer/src/components/tab-bar/TerminalSortableTab.tsx @@ -1,6 +1,7 @@ -import { useTabAgent } from '@/lib/use-tab-agent' +import { useTabAgent } from '@/lib/agent-session/tab-identity/use-tab-agent' +import SortableTab from './SortableTab' +import type { SortableTabProps } from './SortableTab' import type { TerminalTab } from '../../../../shared/workspace-layout/terminal-tab-types' -import SortableTab, { type SortableTabProps } from './SortableTab' type TerminalSortableTabProps = Omit & { tab: TerminalTab } diff --git a/src/renderer/src/components/tab-bar/cli-chat-resume-close-admission.ts b/src/renderer/src/components/tab-bar/cli-chat-resume-close-admission.ts index ce230942d68..1ef9fccbc0f 100644 --- a/src/renderer/src/components/tab-bar/cli-chat-resume-close-admission.ts +++ b/src/renderer/src/components/tab-bar/cli-chat-resume-close-admission.ts @@ -1,5 +1,5 @@ import { toast } from 'sonner' -import { useAppStore } from '@/store' +import { useAppStore } from '@/store/index' import { getExecutionHostIdForWorktree } from '@/lib/workspace/ownership/worktree-runtime-owner' import { admitStructuredLaunchOnHost } from '@/lib/agent-session/launch/structured-agent-session-host-admission' import { structuredChatUnavailableText } from '@/lib/agent-session/launch/structured-agent-session-launch-failure' @@ -7,7 +7,6 @@ import { notifyHostPermissionRefused } from '@/lib/agent-session/launch/structur import { toRuntimeWorktreeSelector } from '@/runtime/rpc/targets/runtime-worktree-selector' import { readStructuredChatHostPermissionVerdict } from '@/runtime/native-chat/host-capabilities/structured-chat-host-permission' import { structuredAgentSessionHostSupports } from '@/runtime/native-chat/host-capabilities/structured-agent-session-host-support' -import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target' import { probePtyRunningWork } from '../terminal/pty-running-work-probe' import { waitForPromiseWithSignal } from '../../../../shared/abort-signal-reason' import { STRUCTURED_AGENT_SESSION_CLOSE_TERMINAL_FOR_CHAT_RUNTIME_CAPABILITY } from '../../../../shared/agent-session/structured-agent-session-surface-capabilities' @@ -16,16 +15,17 @@ import { namesCliConversation } from '../../../../shared/structured-agent-cli-conversation-adoption' import { recognizeAgentProcess } from '../../../../shared/agent-status/process/agent-process-recognition' -import type { TuiAgent } from '../../../../shared/agent-launch/catalog/tui-agent' -import type { CliChatResumeSource } from './cli-chat-resume-source' import { reportCliChatResumeOwner } from './cli-chat-resume-feedback' import { cliChatResumeClosingPaneKeys } from './cli-chat-resume-close-terminal' -import { cliConversationExitGuidance } from '@/lib/cli-conversation-exit-guidance' -import type { AgentSessionLaunchPlan } from '@/lib/agent-session/launch/routing/agent-session-launch-plan' +import { cliConversationExitGuidance } from '@/lib/agent-session/resume/history/cli-conversation-exit-guidance' import { structuredLaunchesHoldingIdentity } from '@/lib/agent-session/launch/structured-agent-session-launch-holders' import { structuredLaunchIdentity } from '@/lib/agent-session/launch/structured-agent-session-launch-registry' -import type { StructuredLaunchState } from '@/lib/agent-session/launch/structured-agent-session-launch-state-store' import { openStructuredAgentSessionProvisionalTab } from '@/lib/agent-session/launch/structured-agent-session-launch-surface' +import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target' +import type { TuiAgent } from '../../../../shared/agent-launch/catalog/tui-agent' +import type { CliChatResumeSource } from './cli-chat-resume-source' +import type { AgentSessionLaunchPlan } from '@/lib/agent-session/launch/routing/agent-session-launch-plan' +import type { StructuredLaunchState } from '@/lib/agent-session/launch/structured-agent-session-launch-state-store' /** keep: the agent quit, so the terminal stays; close: continuing stops the pane's agent; * ask: the pane runs another job, so the terminal's own running-process prompt asks. */ diff --git a/src/renderer/src/components/tab-bar/cli-chat-resume-feedback.ts b/src/renderer/src/components/tab-bar/cli-chat-resume-feedback.ts index 7b6562c51c1..3970fa31922 100644 --- a/src/renderer/src/components/tab-bar/cli-chat-resume-feedback.ts +++ b/src/renderer/src/components/tab-bar/cli-chat-resume-feedback.ts @@ -1,19 +1,19 @@ import { toast } from 'sonner' -import { useAppStore } from '@/store' +import { useAppStore } from '@/store/index' import { translate } from '@/i18n/i18n' import { structuredLaunchConversationOwner, structuredLaunchFailure } from '@/lib/agent-session/launch/structured-agent-session-launch-failure' -import { activateAiVaultStructuredSession } from '@/lib/activate-ai-vault-structured-session' +import { activateAiVaultStructuredSession } from '@/lib/agent-session/open/activate-ai-vault-structured-session' import { agentSessionWriteFailureText } from '../native-chat/messages/notices/agent-session-write-notice-text' import { agentLabel } from '../../../../shared/ai-vault/session-display/ai-vault-session-filters' -import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target' -import { cliConversationExitGuidance } from '@/lib/cli-conversation-exit-guidance' -import type { AgentSessionConversationOwner } from '../../../../shared/agent-session/failures/agent-session-refusal-details' -import type { CliChatResumeSource } from './cli-chat-resume-source' +import { cliConversationExitGuidance } from '@/lib/agent-session/resume/history/cli-conversation-exit-guidance' import { retryStructuredAgentSessionLaunch } from '@/lib/agent-session/launch/structured-agent-session-launch' import { reopenNativeChatCliForkOrigin } from './native-chat-cli-fork-run' +import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target' +import type { AgentSessionConversationOwner } from '../../../../shared/agent-session/failures/agent-session-refusal-details' +import type { CliChatResumeSource } from './cli-chat-resume-source' /** Main's answer to a chat that already holds the conversation: the header opens it, the menu says so. */ export async function reportCliChatResumeOwner( diff --git a/src/renderer/src/components/tab-bar/native-chat-cli-fork-run.ts b/src/renderer/src/components/tab-bar/native-chat-cli-fork-run.ts index f1ff6929ea2..355264c0899 100644 --- a/src/renderer/src/components/tab-bar/native-chat-cli-fork-run.ts +++ b/src/renderer/src/components/tab-bar/native-chat-cli-fork-run.ts @@ -1,18 +1,16 @@ import { useSyncExternalStore } from 'react' import { useAppStore } from '@/store/index' -import type { AppState } from '@/store/types' import { readIpcErrorMessage } from '@/runtime/errors/ipc-error' -import { parseExecutionHostId, type ExecutionHostId } from '../../../../shared/execution-host' -import { - prepareNativeChatCliFork, - type NativeChatCliForkSubject -} from '@/lib/agent-session/resume/cli-fork/native-chat-cli-fork-preparation' +import { parseExecutionHostId } from '../../../../shared/execution-host' +import type { ExecutionHostId } from '../../../../shared/execution-host' +import { prepareNativeChatCliFork } from '@/lib/agent-session/resume/cli-fork/native-chat-cli-fork-preparation' +import type { NativeChatCliForkSubject } from '@/lib/agent-session/resume/cli-fork/native-chat-cli-fork-preparation' import { assertAiVaultCopiedSessionLaunchAllowed, buildAiVaultCopiedSessionStartupForWorktree, buildAiVaultForkStartupForWorktree } from '@/lib/agent-session/resume/history/ai-vault-session-fork-startup' -import { launchAiVaultSessionAndReveal } from '@/lib/launch-ai-vault-session-and-reveal' +import { launchAiVaultSessionAndReveal } from '@/lib/agent-session/resume/history/launch-ai-vault-session-and-reveal' import { notifyAiVaultSessionPreparationFailure } from '../right-sidebar/ai-vault/session-actions/ai-vault-session-launch-feedback' import { describeAiVaultCliForkFailure } from '../right-sidebar/ai-vault/session-actions/ai-vault-session-cli-fork' import { @@ -23,17 +21,16 @@ import { onRuntimeEnvironmentsRetired, onRuntimeEnvironmentRevisionsChanged } from '@/runtime/rpc/environment-revisions/runtime-environment-revision' -import type { AiVaultAgent } from '../../../../shared/ai-vault/contracts/ai-vault-types' -import { - resolveNativeChatCliForkIdentity, - type NativeChatCliForkIdentity -} from './tab-session-history-switch' +import { resolveNativeChatCliForkIdentity } from './tab-session-history-switch' +import type { NativeChatCliForkIdentity } from './tab-session-history-switch' import { translate } from '@/i18n/i18n' -import { openDesktopStructuredSession } from '@/lib/activate-ai-vault-structured-session' -import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target' -import type { TerminalPaneLayoutNode } from '../../../../shared/workspace-layout/terminal-tab-types' +import { openDesktopStructuredSession } from '@/lib/agent-session/open/activate-ai-vault-structured-session' import { moveStructuredAgentLaunchDraft } from '@/lib/agent-session/launch/structured-agent-session-launch-draft' import { structuredAgentSessionDraftScopeKey } from '@/components/native-chat/drafts/native-chat-draft-scope' +import type { AppState } from '@/store/types' +import type { AiVaultAgent } from '../../../../shared/ai-vault/contracts/ai-vault-types' +import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target' +import type { TerminalPaneLayoutNode } from '../../../../shared/workspace-layout/terminal-tab-types' const pending = new Map() const listeners = new Set<() => void>() diff --git a/src/renderer/src/components/tab-bar/use-tab-bar-runtime-model.ts b/src/renderer/src/components/tab-bar/use-tab-bar-runtime-model.ts index af51cf1bd74..95cccb75985 100644 --- a/src/renderer/src/components/tab-bar/use-tab-bar-runtime-model.ts +++ b/src/renderer/src/components/tab-bar/use-tab-bar-runtime-model.ts @@ -1,34 +1,32 @@ import { useMemo } from 'react' import { useShallow } from 'zustand/react/shallow' -import type { GitFileStatus } from '../../../../shared/git/status/git-status-types' -import type { GlobalSettings } from '../../../../shared/global-settings-types' -import type { Tab } from '../../../../shared/tab-types' -import type { ProjectExecutionRuntimeResolution } from '../../../../shared/execution-host/project-execution-runtime' -import { useAppStore } from '../../store' +import { useAppStore } from '../../store/index' import { buildStatusMap } from '../../lib/source-control/paths/git-path-decoration' -import type { AgentDetectionTarget } from '@/hooks/useDetectedAgents' import { useAgentDetectionTargetForWorktree } from '@/hooks/useAgentDetectionTarget' import '@/lib/workspace/ownership/connection-context' import { getConnectionIdFromState } from '@/lib/workspace/ownership/connection-owner-resolution' -import { getLocalProjectExecutionRuntimeContext } from '@/lib/local-preflight-context' +import { getLocalProjectExecutionRuntimeContext } from '@/runtime/hosts/preflight/local-preflight-context' import { isNativeChatTranscriptLocalReadable } from '../../../../shared/native-chat/transcript/native-chat-transcript-readability' import { runtimeEnvironmentIdOrLocalUnlessTwin } from '@/lib/workspace/ownership/worktree-runtime-owner' import { runtimeTargetForOwnerEnvironment } from '@/runtime/rpc/targets/runtime-client-target' import { useOptionalShortcutLabel, useShortcutLabel } from '@/hooks/useShortcutLabel' import { getWindowsTerminalCapabilityOwnerKey, - useWindowsTerminalCapabilities, - type WindowsTerminalCapabilities + useWindowsTerminalCapabilities } from '@/runtime/hosts/capabilities/windows-terminal-capabilities' +import type { WindowsTerminalCapabilities } from '@/runtime/hosts/capabilities/windows-terminal-capabilities' import { shouldShowMobileEmulatorTabIntro } from '../emulator-pane/mobile-emulator-tab-intro-visibility' -import { - selectTabBarAgentProjections, - type TabBarAgentProjections -} from './tab-agent-types-by-tab-id' +import { selectTabBarAgentProjections } from './tab-agent-types-by-tab-id' +import type { TabBarAgentProjections } from './tab-agent-types-by-tab-id' import { shouldShowWindowsShellMenu } from './windows-shell-menu-visibility' import { createUnifiedTabLookup } from './tab-bar-item-model' -import { getClientCreationActionPolicy } from '@/lib/client-creation-action-policy' +import { getClientCreationActionPolicy } from '@/lib/workspace/creation/surface-policy/client-creation-action-policy' import { selectWorktreesByRepo } from '@/store/workspaces/catalog/workspace-record-fields' +import type { GitFileStatus } from '../../../../shared/git/status/git-status-types' +import type { GlobalSettings } from '../../../../shared/global-settings-types' +import type { Tab } from '../../../../shared/tab-types' +import type { ProjectExecutionRuntimeResolution } from '../../../../shared/execution-host/project-execution-runtime' +import type { AgentDetectionTarget } from '@/hooks/useDetectedAgents' const isWindows = navigator.userAgent.includes('Windows') export const isMacOs = navigator.userAgent.includes('Mac') diff --git a/src/renderer/src/components/tab-group/AiVaultSessionDropLayer.tsx b/src/renderer/src/components/tab-group/AiVaultSessionDropLayer.tsx index c4f38328e52..957ef92e6a1 100644 --- a/src/renderer/src/components/tab-group/AiVaultSessionDropLayer.tsx +++ b/src/renderer/src/components/tab-group/AiVaultSessionDropLayer.tsx @@ -1,5 +1,6 @@ import { getAiVaultResumeWorkspaceWslDistro } from '@/lib/agent-session/resume/history/ai-vault-resume-shell' -import { useCallback, useEffect, useRef, useState, type CSSProperties } from 'react' +import { useCallback, useEffect, useRef, useState } from 'react' +import type { CSSProperties } from 'react' import { toast } from 'sonner' import { canResumeAiVaultSessionOnTarget } from '../../../../shared/ai-vault/resume/ai-vault-resume-target' import { @@ -15,14 +16,14 @@ import { } from '@/lib/agent-session/resume/history/ai-vault-session-drag' import { buildAiVaultDropRepinStartup } from '@/lib/agent-session/resume/history/ai-vault-resume-command' import { getAiVaultAgentProviderSession } from '../../../../shared/ai-vault/resume/ai-vault-resume-startup' -import { launchAiVaultSessionInNewTab } from '@/lib/launch-ai-vault-session' +import { launchAiVaultSessionInNewTab } from '@/lib/agent-session/resume/history/launch-ai-vault-session' import { prepareAiVaultTerminalResumeRequest } from '@/lib/agent-session/resume/history/ai-vault-session-resume-preparation' import { describeAiVaultResumeFailure } from '@/lib/agent-session/resume/history/ai-vault-resume-refusal' -import { useAppStore } from '@/store' +import { useAppStore } from '@/store/index' import { resolveDropZone } from './tab-drop-zone' -import type { TabDropZone } from './useTabDragSplit' import { translate } from '@/i18n/i18n' -import { activateAiVaultStructuredSession } from '@/lib/activate-ai-vault-structured-session' +import { activateAiVaultStructuredSession } from '@/lib/agent-session/open/activate-ai-vault-structured-session' +import type { TabDropZone } from './useTabDragSplit' type PaneDropTarget = { groupId: string diff --git a/src/renderer/src/components/tab-group/SplitPaneLanding.tsx b/src/renderer/src/components/tab-group/SplitPaneLanding.tsx index e4f3678719e..9462fb27934 100644 --- a/src/renderer/src/components/tab-group/SplitPaneLanding.tsx +++ b/src/renderer/src/components/tab-group/SplitPaneLanding.tsx @@ -1,15 +1,16 @@ import { useRef, useState } from 'react' -import { FilePlus, Globe, Smartphone, TerminalSquare, type LucideIcon } from 'lucide-react' +import { FilePlus, Globe, Smartphone, TerminalSquare } from 'lucide-react' +import type { LucideIcon } from 'lucide-react' import { useShallow } from 'zustand/react/shallow' -import { useAppStore } from '../../store' +import { useAppStore } from '../../store/index' import { useOptionalShortcutLabel } from '@/hooks/useShortcutLabel' import { useTranslate } from '@/i18n/use-translate' import { ensureClientCreationActionAllowed, showClientCreationActionError -} from '@/lib/client-creation-action-error' +} from '@/lib/workspace/creation/surface-policy/client-creation-action-error' import { openNewTerminalTabInWorkspace } from '@/store/terminals/terminal-active-workspace-creation' -import { getWorkspaceClientCreationActionPolicy } from '@/lib/client-creation-action-policy' +import { getWorkspaceClientCreationActionPolicy } from '@/lib/workspace/creation/surface-policy/client-creation-action-policy' import { openMobileEmulatorTab } from '@/lib/simulator/launch/open-mobile-emulator-tab' import { ensureSimulatorTab, diff --git a/src/renderer/src/components/tab-group/useTabGroupCreationCommands.ts b/src/renderer/src/components/tab-group/useTabGroupCreationCommands.ts index 23ab7a1c9dd..eb0bdd518d3 100644 --- a/src/renderer/src/components/tab-group/useTabGroupCreationCommands.ts +++ b/src/renderer/src/components/tab-group/useTabGroupCreationCommands.ts @@ -1,22 +1,23 @@ import { toast } from 'sonner' -import { useAppStore } from '../../store' +import { useAppStore } from '../../store/index' import { focusTerminalTabSurface } from '../terminal-pane/input/focus/focus-terminal-tab-surface' import { createNonSecureContextUuid as createBrowserUuid } from '../../../../shared/non-secure-context-uuid' import { createWebRuntimeSessionBrowserTab } from '../../runtime/browser/creation/web-runtime-browser-creation' import { createWebRuntimeSessionTerminal } from '../../runtime/hosted-terminals/creation/web-runtime-terminal-creation' import { isWebRuntimeSessionActive } from '../../runtime/web-session-tabs-sync/identity/web-runtime-session-environment' -import { openTabBarEntry, type TabCreateEntryArgs } from '../tab-bar/tab-create-entry-action' +import { openTabBarEntry } from '../tab-bar/tab-create-entry-action' +import type { TabCreateEntryArgs } from '../tab-bar/tab-create-entry-action' import { openMobileEmulatorTab } from '@/lib/simulator/launch/open-mobile-emulator-tab' import { ensureSimulatorTab, getSimulatorTabForWorktree } from '@/lib/simulator/tabs/ensure-simulator-tab' -import { buildDuplicatedBrowserTabOptions } from '@/lib/duplicate-browser-tab-options' +import { buildDuplicatedBrowserTabOptions } from '@/lib/browser/workspace/duplicate-browser-tab-options' import { runtimeEnvironmentIdOrLocalUnlessTwin } from '@/lib/workspace/ownership/worktree-runtime-owner' import { browserWorkspaceHasRemoteOwner } from '@/runtime/browser/ownership/remote-browser-tab-ownership' -import { getClientCreationActionPolicy } from '@/lib/client-creation-action-policy' -import type { TabGroupWorktreeSnapshot } from './useTabGroupItemProjections' +import { getClientCreationActionPolicy } from '@/lib/workspace/creation/surface-policy/client-creation-action-policy' import { translate } from '@/i18n/i18n' +import type { TabGroupWorktreeSnapshot } from './useTabGroupItemProjections' export function useTabGroupCreationCommands({ groupId, diff --git a/src/renderer/src/components/task-page/use-task-page-store-bindings.ts b/src/renderer/src/components/task-page/use-task-page-store-bindings.ts index 0bd82ad783a..56acd6e319d 100644 --- a/src/renderer/src/components/task-page/use-task-page-store-bindings.ts +++ b/src/renderer/src/components/task-page/use-task-page-store-bindings.ts @@ -2,8 +2,8 @@ import { useTranslation } from 'react-i18next' import { useAppStore } from '@/store/index' import { useRepoMap } from '@/store/repos/use-repository-catalog' import { useAllWorktrees } from '@/store/slices/worktrees/listing/use-worktree-catalog' -import { localPreflightContextKey } from '@/lib/local-preflight-context-key' -import { getLocalPreflightContext } from '@/lib/local-preflight-context' +import { localPreflightContextKey } from '@/runtime/hosts/preflight/local-preflight-context-key' +import { getLocalPreflightContext } from '@/runtime/hosts/preflight/local-preflight-context' import { getProviderRuntimeContextKey, isEnvironmentRuntimeContextKey diff --git a/src/renderer/src/components/terminal-pane/account-restart/detached/codex-detached-pane-restart.ts b/src/renderer/src/components/terminal-pane/account-restart/detached/codex-detached-pane-restart.ts index 5ae8845d6fa..df890e14109 100644 --- a/src/renderer/src/components/terminal-pane/account-restart/detached/codex-detached-pane-restart.ts +++ b/src/renderer/src/components/terminal-pane/account-restart/detached/codex-detached-pane-restart.ts @@ -3,10 +3,6 @@ import { isTerminalLeafId, makePaneKey } from '../../../../../../shared/workspace-layout/stable-pane-id' -import type { TerminalLayoutSnapshot } from '../../../../../../shared/workspace-layout/terminal-tab-types' -import type { LocatedCodexPane } from './located-codex-pane' - -import type { AppState } from '@/store/types' import { useAppStore } from '@/store/index' import { singlePaneLayoutSnapshot } from '@/store/terminals/terminal-single-pane-layout' import { hasRegisteredRuntimeTerminalTab } from '@/runtime/hosted-terminals/mounted-surfaces/mounted-terminal-tab-registry' @@ -15,9 +11,8 @@ import { buildPaneAccountRestartStartup } from '@/lib/agent-session/accounts/agent-account-restart-startup' import { isClaudePaneMidTurn } from '@/lib/agent-session/accounts/claude/claude-session-account-move' -import type { AccountRestartAgent } from '@/store/terminals/terminal-contracts' -import { isForeignMachineCodexPtyId } from '@/lib/codex-pane-selection-lane' -import { getLocalProjectExecutionRuntimeContext } from '@/lib/local-preflight-context' +import { isForeignMachineCodexPtyId } from '@/lib/agent-session/accounts/codex-pane-selection-lane' +import { getLocalProjectExecutionRuntimeContext } from '@/runtime/hosts/preflight/local-preflight-context' import { getCachedWindowsTerminalCapabilities, hasCachedWindowsTerminalCapabilities @@ -37,6 +32,10 @@ import { reapUnboundCodexPty, releaseReplacedCodexPanePty } from './detached-pane-restart-pty-release' +import type { TerminalLayoutSnapshot } from '../../../../../../shared/workspace-layout/terminal-tab-types' +import type { LocatedCodexPane } from './located-codex-pane' +import type { AppState } from '@/store/types' +import type { AccountRestartAgent } from '@/store/terminals/terminal-contracts' const inFlightPtyIds = new Set() diff --git a/src/renderer/src/components/terminal-pane/appearance/resolve-terminal-pane-appearance.ts b/src/renderer/src/components/terminal-pane/appearance/resolve-terminal-pane-appearance.ts index c708d738b43..83b23fb7a2a 100644 --- a/src/renderer/src/components/terminal-pane/appearance/resolve-terminal-pane-appearance.ts +++ b/src/renderer/src/components/terminal-pane/appearance/resolve-terminal-pane-appearance.ts @@ -1,13 +1,13 @@ -import type { CSSProperties } from 'react' import { DEFAULT_TERMINAL_DIVIDER_DARK, normalizeColor, resolveEffectiveTerminalAppearance -} from '@/lib/terminal-theme' +} from '@/lib/terminal/appearance/terminal-theme' import { isTerminalBackgroundLight, resolveOpaqueTerminalBackground } from '../../../../../shared/terminal-themes/terminal-title-contrast' +import type { CSSProperties } from 'react' import type { TerminalPaneMobileController } from '../controller/use-terminal-pane-mobile-actions' export function resolveTerminalPaneAppearance({ diff --git a/src/renderer/src/components/terminal-pane/appearance/terminal-appearance.ts b/src/renderer/src/components/terminal-pane/appearance/terminal-appearance.ts index 5adda4f2f9d..5ea4290090b 100644 --- a/src/renderer/src/components/terminal-pane/appearance/terminal-appearance.ts +++ b/src/renderer/src/components/terminal-pane/appearance/terminal-appearance.ts @@ -3,7 +3,10 @@ import type { PaneManager } from '@/lib/pane-manager/pane-manager' import type { GlobalSettings } from '../../../../../shared/global-settings-types' import { resolveTerminalFontWeights } from '../../../../../shared/terminal/appearance/terminal-fonts' import { resolveTerminalLigaturesEnabled } from '../../../../../shared/terminal/appearance/terminal-ligatures' -import { resolvePaneStyleOptions, resolveEffectiveTerminalAppearance } from '@/lib/terminal-theme' +import { + resolvePaneStyleOptions, + resolveEffectiveTerminalAppearance +} from '@/lib/terminal/appearance/terminal-theme' import { buildFontFamily } from '../../../../../shared/monospace-font-family' import { pluginFontFamilyWhenLoaded } from '@/store/plugins/appearance/plugin-fonts' import '@/lib/pane-manager/pane-tree-ops' diff --git a/src/renderer/src/components/terminal-pane/host-state/terminal-pane-wsl-distro.ts b/src/renderer/src/components/terminal-pane/host-state/terminal-pane-wsl-distro.ts index 8eacdc09f35..ed97172616f 100644 --- a/src/renderer/src/components/terminal-pane/host-state/terminal-pane-wsl-distro.ts +++ b/src/renderer/src/components/terminal-pane/host-state/terminal-pane-wsl-distro.ts @@ -1,4 +1,4 @@ -import { getLocalProjectExecutionRuntimeContext } from '@/lib/local-preflight-context' +import { getLocalProjectExecutionRuntimeContext } from '@/runtime/hosts/preflight/local-preflight-context' import { getCachedWindowsTerminalCapabilities, hasCachedWindowsTerminalCapabilities diff --git a/src/renderer/src/components/terminal-pane/input/file-drop/terminal-drop-local-wsl.ts b/src/renderer/src/components/terminal-pane/input/file-drop/terminal-drop-local-wsl.ts index 82323057e72..fc77457969e 100644 --- a/src/renderer/src/components/terminal-pane/input/file-drop/terminal-drop-local-wsl.ts +++ b/src/renderer/src/components/terminal-pane/input/file-drop/terminal-drop-local-wsl.ts @@ -1,8 +1,8 @@ -import { getLocalProjectExecutionRuntimeContext } from '@/lib/local-preflight-context' +import { getLocalProjectExecutionRuntimeContext } from '@/runtime/hosts/preflight/local-preflight-context' import { CLIENT_PLATFORM } from '@/lib/workspace/creation/new-workspace' -import type { useAppStore } from '@/store/index' import { isWindowsAbsolutePathLike } from '../../../../../../shared/cross-platform-path' import { parseWslUncPath } from '../../../../../../shared/wsl-paths' +import type { useAppStore } from '@/store/index' export function isWorktreeUsingLocalWslRuntime( state: ReturnType, diff --git a/src/renderer/src/components/terminal-pane/input/file-drop/terminal-drop-transport-owner.ts b/src/renderer/src/components/terminal-pane/input/file-drop/terminal-drop-transport-owner.ts index 869d23f3919..d9ddf9adc92 100644 --- a/src/renderer/src/components/terminal-pane/input/file-drop/terminal-drop-transport-owner.ts +++ b/src/renderer/src/components/terminal-pane/input/file-drop/terminal-drop-transport-owner.ts @@ -1,5 +1,5 @@ import { parseExecutionHostId } from '../../../../../../shared/execution-host' -import { captureDirectSshMutationExpectation } from '@/lib/ssh-mutation-expectation' +import { captureDirectSshMutationExpectation } from '@/runtime/hosts/ssh/ssh-mutation-expectation' import { useAppStore } from '@/store/index' import type { PtyTransport } from '../../pty-transport/pty-transport-types' diff --git a/src/renderer/src/components/terminal-pane/links/files/terminal-file-link-actions.ts b/src/renderer/src/components/terminal-pane/links/files/terminal-file-link-actions.ts index 4b423f485f1..130a8ccd0b8 100644 --- a/src/renderer/src/components/terminal-pane/links/files/terminal-file-link-actions.ts +++ b/src/renderer/src/components/terminal-pane/links/files/terminal-file-link-actions.ts @@ -1,6 +1,3 @@ -import type { FileOpenFailure } from './terminal-file-open-failure' -import type { LinkActionRequest } from '@/components/link-actions/link-action-request' -import type { HttpLinkSourceOwner } from '@/lib/browser/navigation/http-link-routing' import { buildHttpLinkActions } from '@/lib/browser/navigation/http-link-destinations' import { openDetectedFilePath } from './terminal-file-open-routing' import { @@ -11,13 +8,10 @@ import { } from '../../host-files/terminal-file-path-mapping' import { isHtmlFilePath, localHtmlFileDestinations } from './local-html-file-destinations' import { isTerminalLinkDirectActivation } from '../gestures/terminal-link-activation' -import { - requestTerminalLinkAction, - type TerminalLinkActionContext -} from '../terminal-link-action-request' +import { requestTerminalLinkAction } from '../terminal-link-action-request' +import type { TerminalLinkActionContext } from '../terminal-link-action-request' import { resolveKnownWorktreeRootPathLink } from './terminal-worktree-path-link' import { translate } from '@/i18n/i18n' -import type { Translate } from '@/i18n/use-translate' import { getRevealInFileManagerLabel, revealInFileManager @@ -28,7 +22,11 @@ import { isLocalPathOpenBlocked } from '@/lib/files/os-open/local-path-open-guard' import '@/store/slices/editor/tabs/editor-open-target-group' -import { canOpenLinkInSourceGroup } from '@/lib/link-open-intent' +import { canOpenLinkInSourceGroup } from '@/lib/links/placement/link-open-intent' +import type { FileOpenFailure } from './terminal-file-open-failure' +import type { LinkActionRequest } from '@/components/link-actions/link-action-request' +import type { HttpLinkSourceOwner } from '@/lib/browser/navigation/http-link-routing' +import type { Translate } from '@/i18n/use-translate' export type TerminalFileLinkActionDeps = { worktreeId: string diff --git a/src/renderer/src/components/terminal-pane/links/files/terminal-file-link-browser-open.ts b/src/renderer/src/components/terminal-pane/links/files/terminal-file-link-browser-open.ts index d6d3057d115..4f006012ef7 100644 --- a/src/renderer/src/components/terminal-pane/links/files/terminal-file-link-browser-open.ts +++ b/src/renderer/src/components/terminal-pane/links/files/terminal-file-link-browser-open.ts @@ -1,19 +1,17 @@ -import { getWorkspaceClientCreationActionPolicy } from '@/lib/client-creation-action-policy' +import { getWorkspaceClientCreationActionPolicy } from '@/lib/workspace/creation/surface-policy/client-creation-action-policy' import { absolutePathToFileUri } from '@/components/editor/markdown/link-routing/markdown-internal-links' import { useAppStore } from '@/store/index' -import { - openPlannedFileBrowserLink, - type FileBrowserLinkTarget -} from '@/lib/browser/documents/file-preview-link-open' -import type { - BrowserLinkOpenContext, - BrowserOpenOutcome -} from '@/lib/browser/navigation/browser-link-destination' +import { openPlannedFileBrowserLink } from '@/lib/browser/documents/file-preview-link-open' +import type { FileBrowserLinkTarget } from '@/lib/browser/documents/file-preview-link-open' import { activateAndRevealWorkspace } from '@/lib/workspace/activation/worktree-activation' import { getWorkspaceFilePreviewPlan, openFileInBrowserTab } from '@/lib/browser/documents/file-preview' +import type { + BrowserLinkOpenContext, + BrowserOpenOutcome +} from '@/lib/browser/navigation/browser-link-destination' export async function openResolvedHtmlFileInBrowser( params: FileBrowserLinkTarget & { diff --git a/src/renderer/src/components/terminal-pane/links/files/terminal-file-link-editor-open.ts b/src/renderer/src/components/terminal-pane/links/files/terminal-file-link-editor-open.ts index 4a92ecaa3b7..f1287ffade6 100644 --- a/src/renderer/src/components/terminal-pane/links/files/terminal-file-link-editor-open.ts +++ b/src/renderer/src/components/terminal-pane/links/files/terminal-file-link-editor-open.ts @@ -2,14 +2,14 @@ import { detectLanguage } from '../../../../../../shared/editor-language/editor- import { useAppStore } from '@/store/index' import { scheduleEditorLineReveal } from '@/store/slices/editor/focus/editor-focus-reveal' import '@/store/slices/editor/tabs/editor-open-target-group' -import { isLiveLinkOpenGroup as isLiveEditorOpenGroup } from '@/lib/link-open-intent' +import { isLiveLinkOpenGroup as isLiveEditorOpenGroup } from '@/lib/links/placement/link-open-intent' +import { flashRevealedEditorView } from '@/components/tab-group/editor-reveal-flash' import type { OpenFile } from '@/store/slices/editor/types/open-file' import type { EditorOpenLinkIntent, EditorOpenResult } from '@/store/slices/editor/types/editor-open-link-intent' import type { ExecutionHostId } from '../../../../../../shared/execution-host' -import { flashRevealedEditorView } from '@/components/tab-group/editor-reveal-flash' /** An explicit group request may only end in an editor in the scope it was captured from. */ export function isExplicitEditorScopeKept( diff --git a/src/renderer/src/components/terminal-pane/links/files/terminal-file-link-hit-testing.ts b/src/renderer/src/components/terminal-pane/links/files/terminal-file-link-hit-testing.ts index f838205f709..82d482aa998 100644 --- a/src/renderer/src/components/terminal-pane/links/files/terminal-file-link-hit-testing.ts +++ b/src/renderer/src/components/terminal-pane/links/files/terminal-file-link-hit-testing.ts @@ -1,25 +1,22 @@ -import type { FileOpenFailure } from './terminal-file-open-failure' -import { - readTerminalPathExistence, - type TerminalPathExistsCache -} from './terminal-path-exists-cache' -import type { IBufferLine } from '@xterm/xterm' +import { readTerminalPathExistence } from './terminal-path-exists-cache' +import type { TerminalPathExistsCache } from './terminal-path-exists-cache' import { findTerminalFileLinksAtBufferPosition } from '../../../../../../shared/terminal/links/terminal-link-buffer-hit-testing' import { terminalLogicalLinkHasOscLink } from '../../../../../../shared/terminal/links/terminal-osc-link-cells' import { openDetectedFilePath } from './terminal-file-open-routing' import { getTerminalFileContext } from '../../host-files/terminal-file-path-mapping' import type { TerminalFileContext } from '../../host-files/terminal-file-path-mapping' -import { beginLinkOpenRequest as reserveDetectedFilePathOpenTurn } from '@/lib/link-open-request' +import { beginLinkOpenRequest as reserveDetectedFilePathOpenTurn } from '@/lib/links/link-open-request' import { fileLinkTargetExists, mayCheckFileLinkTargetUnprompted, - resolveFileLinkTarget, - type FileLinkHost, - type FileLinkTarget + resolveFileLinkTarget } from './terminal-file-link-target' +import type { FileLinkHost, FileLinkTarget } from './terminal-file-link-target' import { createTerminalPathExistenceBatch } from './terminal-path-existence-batch' import { runtimeTargetEnvironmentId } from '@/runtime/rpc/targets/runtime-client-target' import { getRuntimeEnvironmentRevision } from '@/runtime/rpc/environment-revisions/runtime-environment-revision' +import type { FileOpenFailure } from './terminal-file-open-failure' +import type { IBufferLine } from '@xterm/xterm' type FileLinkHitTestDeps = { startupCwd: string diff --git a/src/renderer/src/components/terminal-pane/links/files/terminal-file-open-routing.ts b/src/renderer/src/components/terminal-pane/links/files/terminal-file-open-routing.ts index d0d4e5ac96e..9928429ddea 100644 --- a/src/renderer/src/components/terminal-pane/links/files/terminal-file-open-routing.ts +++ b/src/renderer/src/components/terminal-pane/links/files/terminal-file-open-routing.ts @@ -1,4 +1,3 @@ -import type { FileOpenFailure } from './terminal-file-open-failure' import { downloadAndOpenRemoteTerminalFile } from './terminal-remote-file-download-open' import { isMissingRuntimePathError } from '@/runtime/files/metadata/runtime-file-metadata-client' import { useAppStore } from '@/store/index' @@ -25,23 +24,20 @@ import { CLIENT_LOCAL_FILE_TARGET, hostGrantedEditorFields, resolveHostWorkspaceFile, - revealHostWorkspaceRoot, - type HostWorkspaceFile + revealHostWorkspaceRoot } from '../../host-files/terminal-host-workspace-file' +import type { HostWorkspaceFile } from '../../host-files/terminal-host-workspace-file' import { captureEditorOpenLinkIntent } from '@/store/slices/editor/tabs/editor-open-target-group' -import { beginLinkOpenRequest as reserveDetectedFilePathOpenTurn } from '@/lib/link-open-request' +import { beginLinkOpenRequest as reserveDetectedFilePathOpenTurn } from '@/lib/links/link-open-request' import { openTerminalHtmlFileInBrowser } from './terminal-file-link-browser-open' - import { refuseOpenInGroupRequest } from './terminal-file-open-in-group-toast' import { isExplicitEditorScopeKept, openLinkedFileInEditor } from './terminal-file-link-editor-open' import { resolveLinkedFileEditorTarget } from '../../host-files/terminal-file-editor-target' - import { runtimeTargetEnvironmentId } from '@/runtime/rpc/targets/runtime-client-target' -import { - httpLinkDirectClickDestination, - type HttpLinkDestination -} from '@/lib/browser/navigation/http-link-destinations' +import { httpLinkDirectClickDestination } from '@/lib/browser/navigation/http-link-destinations' +import type { HttpLinkDestination } from '@/lib/browser/navigation/http-link-destinations' import { isHtmlFilePath, localHtmlFileDestinations } from './local-html-file-destinations' +import type { FileOpenFailure } from './terminal-file-open-failure' type TerminalFileOpenDeps = { worktreeId: string diff --git a/src/renderer/src/components/terminal-pane/parking/output-watchers/parked-terminal-byte-watcher.test.ts b/src/renderer/src/components/terminal-pane/parking/output-watchers/parked-terminal-byte-watcher.test.ts deleted file mode 100644 index a15316d6c54..00000000000 --- a/src/renderer/src/components/terminal-pane/parking/output-watchers/parked-terminal-byte-watcher.test.ts +++ /dev/null @@ -1,516 +0,0 @@ -import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' -import type { TerminalSideEffectFact } from '../../../../../../shared/terminal/output/terminal-side-effect-facts' -import type { ParkedTerminalByteWatcherOptions } from './parked-terminal-byte-watcher' -import type * as ParkedTerminalCommandStatus from './parked-terminal-command-status' - -const PTY_ID = 'pty-parked-1' -const TAB_ID = 'tab-1' -const WORKTREE_ID = 'repo-1::/tmp/wt-1' -const LEAF_ID = '11111111-1111-4111-8111-111111111111' -const PANE_KEY = `${TAB_ID}:${LEAF_ID}` -const PANE_ID = 1 -// Mirrors PARKED_NOTIFICATION_GRACE_MS / AGENT_TASK_COMPLETE_NOTIFICATION_GRACE_MS. -const NOTIFICATION_GRACE_MS = 250 - -// Real titles classify braille spinners as working and Claude’s ✳ prefix as idle. -const WORKING_TITLE_OSC = '\x1b]0;⠋ Build feature\x07' -const IDLE_TITLE = '✳ Build feature' -const IDLE_TITLE_OSC = `\x1b]0;${IDLE_TITLE}\x07` - -type MockStoreState = { - settings: { - theme?: 'system' | 'dark' | 'light' - promptCacheTimerEnabled?: boolean - experimentalTerminalAttention?: boolean - terminalMainSideEffectAuthority?: boolean - terminalHiddenDeliveryGate?: boolean - notifications?: { enabled?: boolean; agentTaskComplete?: boolean } - } | null - setRuntimePaneTitle: ReturnType - clearRuntimePaneTitle: ReturnType - updateTabTitle: ReturnType - markTerminalBell: ReturnType - setCacheTimerStartedAt: ReturnType - observeTerminalGitHubPullRequestLink: ReturnType - agentStatusByPaneKey: Record - paneForegroundAgentByPaneKey: Record -} - -const dispatchTerminalNotification = vi.fn() -let mockStoreState: MockStoreState - -vi.mock('../../notifications/dispatch-terminal-notification', () => ({ - dispatchTerminalNotification -})) - -// Command-status semantics live in their own suite; verify watcher-to-policy wiring here. -const commandStatusPolicy = { - onCommandFinished: vi.fn(), - onCommandCodeWorking: vi.fn(), - onCommandCodeDone: vi.fn(), - dispose: vi.fn() -} -// Partial mock: readInFlightCommandCodeTurn stays real so detector seeding reads the store. -vi.mock('./parked-terminal-command-status', async (importOriginal) => ({ - ...(await importOriginal()), - createParkedTerminalCommandStatusPolicy: vi.fn(() => commandStatusPolicy) -})) - -vi.mock('@/lib/terminal-theme', () => ({ - getSystemPrefersDark: () => true -})) - -vi.mock('@/store/index', () => ({ useAppStore: { getState: () => mockStoreState } })) - -function createMockStoreState(): MockStoreState { - return { - // Pin legacy byte mode here; dedicated cases below cover main-authority facts. - settings: { - theme: 'system', - promptCacheTimerEnabled: true, - experimentalTerminalAttention: false, - terminalMainSideEffectAuthority: false, - notifications: { enabled: true, agentTaskComplete: true } - }, - setRuntimePaneTitle: vi.fn(), - clearRuntimePaneTitle: vi.fn(), - updateTabTitle: vi.fn(), - markTerminalBell: vi.fn(), - setCacheTimerStartedAt: vi.fn(), - observeTerminalGitHubPullRequestLink: vi.fn(), - agentStatusByPaneKey: {}, - paneForegroundAgentByPaneKey: {} - } -} - -describe('startParkedTerminalByteWatcher', () => { - const originalWindow = (globalThis as { window?: typeof window }).window - let onData: ((payload: { id: string; data: string }) => void) | null = null - - function emit(data: string): void { - onData?.({ id: PTY_ID, data }) - } - - // The output processor defers title/bell side effects onto a 0ms drain timer. - function flushSideEffects(): void { - vi.advanceTimersByTime(0) - } - - async function startWatcher( - overrides: Partial = {} - ): Promise<{ dispose: () => void; ptyWrite: ReturnType }> { - const { startParkedTerminalByteWatcher } = await import('./parked-terminal-byte-watcher') - const ptyWrite = vi.fn() - ;(window as unknown as { api: { pty: Record } }).api.pty.write = ptyWrite - const dispose = startParkedTerminalByteWatcher({ - ptyId: PTY_ID, - tabId: TAB_ID, - worktreeId: WORKTREE_ID, - leafId: LEAF_ID, - paneId: PANE_ID, - ...overrides - }) - return { dispose, ptyWrite } - } - - beforeEach(() => { - vi.resetModules() - vi.useFakeTimers() - dispatchTerminalNotification.mockClear() - commandStatusPolicy.onCommandFinished.mockClear() - commandStatusPolicy.onCommandCodeWorking.mockClear() - commandStatusPolicy.onCommandCodeDone.mockClear() - commandStatusPolicy.dispose.mockClear() - onData = null - mockStoreState = createMockStoreState() - ;(globalThis as { window: typeof window }).window = { - ...originalWindow, - api: { - pty: { - onData: vi.fn((callback: (payload: { id: string; data: string }) => void) => { - onData = callback - return () => {} - }), - onReplay: vi.fn(() => () => {}), - onExit: vi.fn(() => () => {}), - ackData: vi.fn() - } - } - } as unknown as typeof window - }) - - afterEach(() => { - vi.useRealTimers() - if (originalWindow) { - ;(globalThis as { window: typeof window }).window = originalWindow - } else { - delete (globalThis as { window?: typeof window }).window - } - }) - - it('forwards every OSC title in order to the pane and tab title store actions', async () => { - const { dispose } = await startWatcher() - - emit(`${WORKING_TITLE_OSC}${IDLE_TITLE_OSC}`) - flushSideEffects() - - expect(mockStoreState.setRuntimePaneTitle.mock.calls).toEqual([ - [TAB_ID, PANE_ID, '⠋ Build feature'], - [TAB_ID, PANE_ID, IDLE_TITLE] - ]) - expect(mockStoreState.updateTabTitle.mock.calls).toEqual([ - [TAB_ID, '⠋ Build feature'], - [TAB_ID, IDLE_TITLE] - ]) - dispose() - }) - - // Publish hookless Cursor identity once; redraws must not overwrite its synthesized status title (#10258). - it('stores the bare cursor-agent native title once, then keeps the synthetic title', async () => { - const { dispose } = await startWatcher() - - emit('\x1b]0;Cursor Agent\x07') - emit('\x1b]0;Cursor Agent\x07') - emit('\x1b]0;⠋ Cursor Agent\x07') - emit('\x1b]0;Cursor Agent\x07') - flushSideEffects() - - expect(mockStoreState.setRuntimePaneTitle.mock.calls).toEqual([ - [TAB_ID, PANE_ID, 'Cursor Agent'], - [TAB_ID, PANE_ID, '⠋ Cursor Agent'] - ]) - expect(mockStoreState.updateTabTitle.mock.calls).toEqual([ - [TAB_ID, 'Cursor Agent'], - [TAB_ID, '⠋ Cursor Agent'] - ]) - dispose() - }) - - it('marks unread on BEL and schedules the delayed terminal-bell OS notification', async () => { - const workspaceOwner = { executionHostId: 'ssh:qa' as const, runtimeEnvironmentId: 'hub' } - const { dispose } = await startWatcher({ workspaceOwner }) - - emit('build finished\x07') - flushSideEffects() - - expect(mockStoreState.markTerminalBell).toHaveBeenCalledWith({ - worktreeId: WORKTREE_ID, - tabId: TAB_ID, - paneKey: PANE_KEY - }) - expect(dispatchTerminalNotification).not.toHaveBeenCalled() - - vi.advanceTimersByTime(NOTIFICATION_GRACE_MS) - - expect(dispatchTerminalNotification).toHaveBeenCalledTimes(1) - expect(dispatchTerminalNotification).toHaveBeenCalledWith(WORKTREE_ID, { - source: 'terminal-bell', - paneKey: PANE_KEY, - ptyId: PTY_ID, - workspaceOwner - }) - dispose() - }) - - it('does not treat an OSC-terminator BEL as a bell, even split across chunks', async () => { - const { dispose } = await startWatcher() - - emit('\x1b]0;par') - emit('tial title\x07') - flushSideEffects() - vi.advanceTimersByTime(NOTIFICATION_GRACE_MS * 4) - - expect(mockStoreState.markTerminalBell).not.toHaveBeenCalled() - expect(dispatchTerminalNotification).not.toHaveBeenCalled() - dispose() - }) - - it('fires the prompt-cache timer and agent-task-complete on working→idle', async () => { - const { dispose } = await startWatcher() - - emit(WORKING_TITLE_OSC) - flushSideEffects() - expect(mockStoreState.setCacheTimerStartedAt).toHaveBeenLastCalledWith(PANE_KEY, null) - - emit(IDLE_TITLE_OSC) - flushSideEffects() - expect(mockStoreState.setCacheTimerStartedAt).toHaveBeenLastCalledWith( - PANE_KEY, - expect.any(Number) - ) - expect(dispatchTerminalNotification).not.toHaveBeenCalled() - - vi.advanceTimersByTime(NOTIFICATION_GRACE_MS) - - expect(dispatchTerminalNotification).toHaveBeenCalledTimes(1) - expect(dispatchTerminalNotification).toHaveBeenCalledWith(WORKTREE_ID, { - source: 'agent-task-complete', - terminalTitle: IDLE_TITLE, - paneKey: PANE_KEY, - ptyId: PTY_ID - }) - dispose() - }) - - it('lets a same-burst completion supersede the pending bell OS notification', async () => { - const { dispose } = await startWatcher() - - emit(WORKING_TITLE_OSC) - flushSideEffects() - emit(`${IDLE_TITLE_OSC}\x07`) - flushSideEffects() - vi.advanceTimersByTime(NOTIFICATION_GRACE_MS * 8) - - // The bell still marks unread immediately; only the OS notification yields. - expect(mockStoreState.markTerminalBell).toHaveBeenCalledWith({ - worktreeId: WORKTREE_ID, - tabId: TAB_ID, - paneKey: PANE_KEY - }) - expect(dispatchTerminalNotification).toHaveBeenCalledTimes(1) - expect(dispatchTerminalNotification).toHaveBeenCalledWith( - WORKTREE_ID, - expect.objectContaining({ source: 'agent-task-complete' }) - ) - dispose() - }) - - it('cancels the pending completion and clears the cache timer when working resumes', async () => { - const { dispose } = await startWatcher() - - emit(WORKING_TITLE_OSC) - emit(IDLE_TITLE_OSC) - flushSideEffects() - emit(WORKING_TITLE_OSC) - flushSideEffects() - vi.advanceTimersByTime(NOTIFICATION_GRACE_MS * 4) - - expect(dispatchTerminalNotification).not.toHaveBeenCalled() - expect(mockStoreState.setCacheTimerStartedAt).toHaveBeenLastCalledWith(PANE_KEY, null) - dispose() - }) - - it('observes GitHub PR links across chunk boundaries', async () => { - const { dispose } = await startWatcher() - - emit('PR: https://github.com/orca-dev/orca/pull/42') - expect(mockStoreState.observeTerminalGitHubPullRequestLink).not.toHaveBeenCalled() - - emit('1\r\ndone') - expect(mockStoreState.observeTerminalGitHubPullRequestLink).toHaveBeenCalledTimes(1) - expect(mockStoreState.observeTerminalGitHubPullRequestLink).toHaveBeenCalledWith( - WORKTREE_ID, - expect.objectContaining({ - url: 'https://github.com/orca-dev/orca/pull/421', - number: 421, - slug: { owner: 'orca-dev', repo: 'orca', host: 'github.com' } - }), - expect.objectContaining({ tabId: TAB_ID, ptyId: PTY_ID }) - ) - dispose() - }) - - it('feeds a Command Code return to the idle composer through as done', async () => { - const { dispose } = await startWatcher() - - emit('# Command Code v0.27.2\r\n') - emit('❯ Fix the spinner\r\n') - emit('\r\n❯ Ask your question...\r\n') - - expect(commandStatusPolicy.onCommandCodeDone).toHaveBeenCalledWith('Fix the spinner') - dispose() - }) - - it('arms the Command Code scrape from a turn already in flight at park time', async () => { - // The banner is gone by park time; the live row must seed Command Code identity. - mockStoreState.agentStatusByPaneKey = { - [PANE_KEY]: { state: 'working', prompt: 'Fix the spinner', agentType: 'command-code' } - } - const { dispose } = await startWatcher() - - emit('\r\n❯ Ask your question...\r\n') - - expect(commandStatusPolicy.onCommandCodeDone).toHaveBeenCalledWith('Fix the spinner') - dispose() - }) - - it('fires completion when seeded with a working title and the agent goes idle while parked', async () => { - // Seed prior working state so the recreated tracker can recognize working→idle. - const { dispose } = await startWatcher({ initialTitle: '⠋ Build feature' }) - - emit(IDLE_TITLE_OSC) - flushSideEffects() - vi.advanceTimersByTime(NOTIFICATION_GRACE_MS) - - expect(dispatchTerminalNotification).toHaveBeenCalledTimes(1) - expect(dispatchTerminalNotification).toHaveBeenCalledWith(WORKTREE_ID, { - source: 'agent-task-complete', - terminalTitle: IDLE_TITLE, - paneKey: PANE_KEY, - ptyId: PTY_ID - }) - dispose() - }) - - it('does not fire completion for an idle title without a seed or observed transition', async () => { - const { dispose } = await startWatcher() - - emit(IDLE_TITLE_OSC) - flushSideEffects() - vi.advanceTimersByTime(NOTIFICATION_GRACE_MS * 4) - - expect(dispatchTerminalNotification).not.toHaveBeenCalled() - dispose() - }) - - it('shutdown dispose cancels the armed completion timer and silences the final flush', async () => { - const { dispose } = await startWatcher() - - emit(WORKING_TITLE_OSC) - emit(IDLE_TITLE_OSC) - flushSideEffects() - - // Equivalent to shutdownWorktreeTerminals → disposeParkedTerminalWatchersForPtyIds. - dispose() - vi.advanceTimersByTime(NOTIFICATION_GRACE_MS * 4) - expect(dispatchTerminalNotification).not.toHaveBeenCalled() - - // The teardown flush that main emits after pty.kill must be a no-op. - emit('final teardown flush\x07') - flushSideEffects() - vi.advanceTimersByTime(NOTIFICATION_GRACE_MS * 4) - expect(mockStoreState.markTerminalBell).not.toHaveBeenCalled() - expect(dispatchTerminalNotification).not.toHaveBeenCalled() - }) - - it('dispose unregisters the sidecar and cancels the pending bell notification', async () => { - const { dispose } = await startWatcher() - - emit('\x07') - flushSideEffects() - expect(mockStoreState.markTerminalBell).toHaveBeenCalledTimes(1) - - dispose() - vi.advanceTimersByTime(NOTIFICATION_GRACE_MS * 4) - expect(dispatchTerminalNotification).not.toHaveBeenCalled() - - emit('\x07') - flushSideEffects() - expect(mockStoreState.markTerminalBell).toHaveBeenCalledTimes(1) - - // Idempotent: a second dispose must not throw or clobber another watcher. - dispose() - }) - - it('disposes the previous watcher when a new one starts for the same PTY', async () => { - await startWatcher({ paneId: 1 }) - const second = await startWatcher({ paneId: 2 }) - - emit(IDLE_TITLE_OSC) - flushSideEffects() - - expect(mockStoreState.setRuntimePaneTitle).toHaveBeenCalledTimes(1) - expect(mockStoreState.setRuntimePaneTitle).toHaveBeenCalledWith(TAB_ID, 2, IDLE_TITLE) - second.dispose() - }) - - // Main-authority mode parses bytes once in main; parked policy consumes derived facts, including PR links. - describe('with main side-effect authority on', () => { - function enableMainAuthority(): void { - mockStoreState.settings = { - ...mockStoreState.settings, - terminalMainSideEffectAuthority: true - } - } - - async function dispatchFacts( - facts: TerminalSideEffectFact[], - options: { seq?: number; replay?: boolean } = {} - ): Promise { - const handler = await import('../../pty-transport/output/terminal-side-effect-facts-handler') - handler._dispatchTerminalSideEffectBatchForTest({ - ptyId: PTY_ID, - seq: options.seq ?? 0, - ...(options.replay ? { replay: true } : {}), - facts - }) - } - - it('restores a cold-started watcher title without replaying attention facts', async () => { - enableMainAuthority() - const getSideEffectSnapshot = vi.fn().mockResolvedValue({ - ptyId: PTY_ID, - seq: 42, - replay: true, - facts: [ - { kind: 'title', normalizedTitle: IDLE_TITLE, rawTitle: IDLE_TITLE }, - { kind: 'bell' }, - { kind: 'agent-idle', title: IDLE_TITLE } - ] satisfies TerminalSideEffectFact[] - }) - ;( - window as unknown as { - api: { pty: { getSideEffectSnapshot: typeof getSideEffectSnapshot } } - } - ).api.pty.getSideEffectSnapshot = getSideEffectSnapshot - - const { dispose } = await startWatcher({ restoreTitleOnRegister: true }) - await Promise.resolve() - - expect(getSideEffectSnapshot).toHaveBeenCalledWith(PTY_ID) - expect(mockStoreState.setRuntimePaneTitle).toHaveBeenCalledWith(TAB_ID, PANE_ID, IDLE_TITLE) - expect(mockStoreState.updateTabTitle).toHaveBeenCalledWith(TAB_ID, IDLE_TITLE) - expect(mockStoreState.markTerminalBell).not.toHaveBeenCalled() - expect(mockStoreState.setCacheTimerStartedAt).not.toHaveBeenCalled() - expect(dispatchTerminalNotification).not.toHaveBeenCalled() - dispose() - }) - - it('clears state without completion attention for stale-derived idle facts', async () => { - enableMainAuthority() - const { dispose } = await startWatcher() - - await dispatchFacts([ - { kind: 'title', normalizedTitle: '⠋ Build feature', rawTitle: '⠋ Build feature' }, - { kind: 'agent-working' } - ]) - // Stale-title expiry clears caches without granting completion to a merely paused agent. - await dispatchFacts([ - { - kind: 'title', - normalizedTitle: 'Build feature', - rawTitle: 'Build feature', - staleWorkingTitleClear: true - }, - { kind: 'agent-idle', title: 'Build feature', staleWorkingTitleClear: true } - ]) - - expect(mockStoreState.setRuntimePaneTitle).toHaveBeenLastCalledWith( - TAB_ID, - PANE_ID, - 'Build feature' - ) - expect(mockStoreState.setCacheTimerStartedAt).toHaveBeenLastCalledWith(PANE_KEY, null) - vi.advanceTimersByTime(NOTIFICATION_GRACE_MS * 4) - expect(dispatchTerminalNotification).not.toHaveBeenCalled() - expect(mockStoreState.markTerminalBell).not.toHaveBeenCalled() - dispose() - }) - - it('dispose unregisters the fact consumer and clears a written title slot', async () => { - enableMainAuthority() - const { dispose } = await startWatcher() - - await dispatchFacts([{ kind: 'title', normalizedTitle: IDLE_TITLE, rawTitle: IDLE_TITLE }]) - expect(mockStoreState.setRuntimePaneTitle).toHaveBeenCalledWith(TAB_ID, PANE_ID, IDLE_TITLE) - - dispose() - expect(mockStoreState.clearRuntimePaneTitle).toHaveBeenCalledWith(TAB_ID, PANE_ID) - - await dispatchFacts([{ kind: 'bell' }]) - vi.advanceTimersByTime(NOTIFICATION_GRACE_MS * 4) - expect(mockStoreState.markTerminalBell).not.toHaveBeenCalled() - expect(dispatchTerminalNotification).not.toHaveBeenCalled() - }) - }) -}) diff --git a/src/renderer/src/components/terminal-pane/pty-connection/emulation/pane-mode-2031-state.ts b/src/renderer/src/components/terminal-pane/pty-connection/emulation/pane-mode-2031-state.ts index a42061ed5f7..9e2e8240785 100644 --- a/src/renderer/src/components/terminal-pane/pty-connection/emulation/pane-mode-2031-state.ts +++ b/src/renderer/src/components/terminal-pane/pty-connection/emulation/pane-mode-2031-state.ts @@ -1,13 +1,12 @@ -import { useAppStore } from '@/store' -import { getSystemPrefersDark } from '@/lib/terminal-theme' +import { useAppStore } from '@/store/index' +import { getSystemPrefersDark } from '@/lib/terminal/appearance/terminal-theme' import { resolveTerminalColorSchemeMode, scanMode2031ReplyDecision, INITIAL_MODE_2031_REPLY_SCAN_STATE } from '../../../../../../shared/terminal/protocol/queries/terminal-color-scheme-protocol' -import type { ConnectPanePtySession } from '../connect-pane-pty-session' - import { maybePushMode2031Flip } from '../../emulation/terminal-mode-2031-replies' +import type { ConnectPanePtySession } from '../connect-pane-pty-session' export function bindLivePaneMode2031Observation(session: ConnectPanePtySession): void { // DECSET 2031 subscribes silently; late replies paint junk after fish withdraws it (#9993). Scan raw chunks because xterm batching hides per-chunk subscription state. diff --git a/src/renderer/src/components/terminal-pane/pty-connection/host-ownership/pane-project-runtime.ts b/src/renderer/src/components/terminal-pane/pty-connection/host-ownership/pane-project-runtime.ts index c35f4a6aba8..918e646e3b8 100644 --- a/src/renderer/src/components/terminal-pane/pty-connection/host-ownership/pane-project-runtime.ts +++ b/src/renderer/src/components/terminal-pane/pty-connection/host-ownership/pane-project-runtime.ts @@ -1,4 +1,4 @@ -import { getLocalProjectExecutionRuntimeContext } from '@/lib/local-preflight-context' +import { getLocalProjectExecutionRuntimeContext } from '@/runtime/hosts/preflight/local-preflight-context' import { getCachedWindowsTerminalCapabilities, hasCachedWindowsTerminalCapabilities diff --git a/src/renderer/src/components/terminal-pane/pty-connection/lifecycle/pty-connection-deliberate-sleep-guard.spec.ts b/src/renderer/src/components/terminal-pane/pty-connection/lifecycle/pty-connection-deliberate-sleep-guard.spec.ts deleted file mode 100644 index 5b190eec736..00000000000 --- a/src/renderer/src/components/terminal-pane/pty-connection/lifecycle/pty-connection-deliberate-sleep-guard.spec.ts +++ /dev/null @@ -1,180 +0,0 @@ -import { bindPtyConnectionTestMocks } from '../test-fixtures/pty-connection-mocks.spec' -import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' -import { flushAsyncTicks } from '../test-fixtures/pty-connection-test-async' -import { - createMockTransport, - createPane, - createManager, - LEAF_1, - type MockTransport -} from '../test-fixtures/pty-connection-test-pane-fixtures' -import { - buildPaneConnectionDeps, - type PtyConnectionAgentTitleMocks, - bindPaneAgentTitleMocks -} from '../test-fixtures/pty-connection-test-deps' -import { createInitialStoreState } from '../test-fixtures/pty-connection-test-store-fixtures' -import type { StoreState } from '../test-fixtures/pty-connection-test-store-state' -import { - installTerminalTestGlobals, - restoreTerminalTestGlobals -} from '../test-fixtures/pty-connection-test-environment' - -export function registerPtyConnectionDeliberateSleepGuardTests(): void { - let mockStoreState: StoreState - let transportFactoryQueue: MockTransport[] = [] - let createdTransportOptions: Record[] = [] - let storeSubscribers: ((state: StoreState) => void)[] = [] - - function createDeps(overrides: Record = {}) { - return buildPaneConnectionDeps(() => mockStoreState, overrides) - } - - describe('deliberate sleep keeps mounted panes cold', () => { - beforeEach(async () => { - vi.clearAllMocks() - transportFactoryQueue = [] - createdTransportOptions = [] - storeSubscribers = [] - mockStoreState = createInitialStoreState(() => mockStoreState) - bindPtyConnectionTestMocks({ - getState: () => mockStoreState, - getTransportQueue: () => transportFactoryQueue, - getTransportOptions: () => createdTransportOptions, - getStoreSubscribers: () => storeSubscribers, - setStoreSubscribers: (subscribers) => { - storeSubscribers = subscribers - } - }) - await installTerminalTestGlobals() - }) - - afterEach(async () => { - const { clearWorktreeSleepIntent } = await import('@/lib/worktree-sleep-intent') - clearWorktreeSleepIntent('wt-1') - await restoreTerminalTestGlobals() - }) - - it('does not connect a waiting pane whose tab was remounted by the wake', async () => { - const { connectPanePty } = await import('../connect-pane-pty') - const agentTitleMocks4 = await vi.importMock( - '@/lib/agent-status/aggregation/worktree-agent-status' - ) - const { clearWorktreeSleepIntent, markWorktreeSleepIntent } = - await import('@/lib/worktree-sleep-intent') - const transport = createMockTransport() - transportFactoryQueue.push(transport) - mockStoreState = { - ...mockStoreState, - activeWorktreeId: 'wt-other', - tabsByWorktree: { 'wt-1': [{ id: 'tab-remounted', ptyId: 'wt-1@@dead', generation: 0 }] } - } - markWorktreeSleepIntent('wt-1') - const deps = createDeps({ - tabId: 'tab-remounted', - restoredLeafId: LEAF_1, - restoredPtyIdByLeafId: { [LEAF_1]: 'wt-1@@dead' }, - isVisibleRef: { current: false } - }) - connectPanePty( - createPane(1) as never, - createManager(1) as never, - bindPaneAgentTitleMocks(deps as never, agentTitleMocks4) - ) - await flushAsyncTicks() - - // Why: activation bumps generation in the same set() that precedes the clear. - mockStoreState = { - ...mockStoreState, - tabsByWorktree: { 'wt-1': [{ id: 'tab-remounted', ptyId: 'wt-1@@dead', generation: 1 }] } - } - clearWorktreeSleepIntent('wt-1') - await flushAsyncTicks() - - expect(transport.connect).not.toHaveBeenCalled() - }) - - it('re-arms after a wake so a second sleep can hold the pane again', async () => { - const { connectPanePty } = await import('../connect-pane-pty') - const agentTitleMocks6 = await vi.importMock( - '@/lib/agent-status/aggregation/worktree-agent-status' - ) - const { clearWorktreeSleepIntent, markWorktreeSleepIntent } = - await import('@/lib/worktree-sleep-intent') - const transport = createMockTransport() - transportFactoryQueue.push(transport) - let releaseCwd: (cwd: string) => void = () => {} - const cwdPromise = new Promise((resolve) => { - releaseCwd = resolve - }) - markWorktreeSleepIntent('wt-1') - const deps = createDeps({ - tabId: 'tab-resleep', - isVisibleRef: { current: false }, - cwdPromise - }) - - connectPanePty( - createPane(1) as never, - createManager(1) as never, - bindPaneAgentTitleMocks(deps as never, agentTitleMocks6) - ) - await flushAsyncTicks() - // Wake: the pane leaves the sleep gate and parks on the cwd gate. - clearWorktreeSleepIntent('wt-1') - await flushAsyncTicks() - // Sleep again before the cwd settles, then wake again. - markWorktreeSleepIntent('wt-1') - releaseCwd('/cwd') - await flushAsyncTicks() - expect(transport.connect).not.toHaveBeenCalled() - clearWorktreeSleepIntent('wt-1') - await flushAsyncTicks() - - expect(transport.connect).toHaveBeenCalledTimes(1) - }) - - it('drops the wake listener when a waiting pane is disposed', async () => { - const sleepIntent = await import('@/lib/worktree-sleep-intent') - const subscribe = sleepIntent.onWorktreeSleepIntentCleared - const paneWakeListener = vi.fn() - const subscribeSpy = vi - .spyOn(sleepIntent, 'onWorktreeSleepIntentCleared') - .mockImplementation((worktreeId, listener) => - subscribe(worktreeId, () => { - paneWakeListener() - listener() - }) - ) - try { - const { connectPanePty } = await import('../connect-pane-pty') - const agentTitleMocks7 = await vi.importMock( - '@/lib/agent-status/aggregation/worktree-agent-status' - ) - const transport = createMockTransport() - transportFactoryQueue.push(transport) - sleepIntent.markWorktreeSleepIntent('wt-1') - const deps = createDeps({ tabId: 'tab-disposed', isVisibleRef: { current: false } }) - - const binding = connectPanePty( - createPane(1) as never, - createManager(1) as never, - bindPaneAgentTitleMocks(deps as never, agentTitleMocks7) - ) - await flushAsyncTicks() - expect(subscribeSpy).toHaveBeenCalledTimes(1) - binding.dispose() - const wakeCalls: number[] = [] - subscribe('wt-1', () => wakeCalls.push(1)) - sleepIntent.clearWorktreeSleepIntent('wt-1') - await flushAsyncTicks() - - expect(transport.connect).not.toHaveBeenCalled() - expect(wakeCalls).toHaveLength(1) - expect(paneWakeListener).not.toHaveBeenCalled() - } finally { - subscribeSpy.mockRestore() - } - }) - }) -} diff --git a/src/renderer/src/components/terminal-pane/pty-connection/run-deferred-connect.ts b/src/renderer/src/components/terminal-pane/pty-connection/run-deferred-connect.ts index c48496d89a1..8fe2373f3ac 100644 --- a/src/renderer/src/components/terminal-pane/pty-connection/run-deferred-connect.ts +++ b/src/renderer/src/components/terminal-pane/pty-connection/run-deferred-connect.ts @@ -2,7 +2,6 @@ import { isRemoteRuntimePtyId } from '../../../../../shared/remote-runtime/remot import { createTerminalZeroDimensionsMessage } from '../../../../../shared/terminal/viewport/terminal-zero-dimensions-diagnostic' import { isWorktreeRemovalFenceError } from '../../../../../shared/worktree/removal-fence-error' import { safeFit } from '@/lib/pane-manager/pane-fit' -// Preserve WebGL hook registration before deferred connection setup. import '@/lib/pane-manager/pane-webgl-renderer' import { getWindowParkVisible, @@ -10,28 +9,25 @@ import { } from '@/lib/window-activity/window-park-visibility' import { useAppStore } from '@/store/index' import { createCodexBackfillErrorDetector } from '../provider-notices/codex-backfill/codex-backfill-error-detector' -import { hasWorktreeSleepIntent, onWorktreeSleepIntentCleared } from '@/lib/worktree-sleep-intent' - +import { + hasWorktreeSleepIntent, + onWorktreeSleepIntentCleared +} from '@/lib/workspace/sleep/worktree-sleep-intent' import { recordPtyConnectDiagnostic } from './instrumentation/pty-connect-diagnostics' import { defersToMainPaneStart } from './spawn/main-pane-start-request' import { findTerminalTabForPane } from './terminal-tab-id' import { isDeferredSplitInputHold } from './pane-transport-options' - -import type { ConnectPanePtySession } from './connect-pane-pty-session' import { bindBuildColdRestoreAgentResumeStartup } from './startup/cold-restore-resume-startup' - import { bindForegroundOutputRefresh } from './output/foreground-output-refresh' import { bindRegisterPaneSerializer } from './serialization/pane-serializer-register' import { bindHandleReattachResult } from './reattach/reattach-result-handler' import { runDeferredSessionAttach } from './deferred-session-attach' - import { bindSerializeHiddenOutputSnapshot } from './output-restore/hidden-output-snapshot-serialize' import { bindHiddenStartupDelivery } from './spawn/hidden-startup-delivery' import { bindHiddenOutputFloodRepaint } from './output-restore/hidden-output-flood-repaint' import { bindPaneSerializerReadiness } from './serialization/pane-serializer-readiness' import { bindStartupDraftPaste } from './startup/startup-draft-paste' import { bindSessionRestoredBannerAdmission } from './notifications/session-restored-banner-admission' - import { bindDeferredColdRestoreAndSnapshot } from './deferred-cold-restore-and-snapshot' import { bindLivePaneMode2031Observation, @@ -48,13 +44,11 @@ import { bindHiddenRendererQueryAdmission, bindHiddenStartupRendererQueryWrite } from './output/hidden-startup-renderer-query-write' - import { bindHiddenOutputRestoreChunk } from './output-restore/hidden-output-restore-chunk' import { bindSnapshotKittyKeyboardModes } from './emulation/snapshot-kitty-keyboard-modes' import { bindRendererOrderedSequence } from './output/renderer-ordered-sequence' import { bindHiddenOutputRestoreDrain } from './output-restore/hidden-output-restore-drain' import { bindAbandonHiddenOutputRestore } from './output-restore/hidden-output-restore-abandon' - import { bindHiddenOutputRestoreSnapshot } from './output-restore/hidden-output-restore-snapshot' import { bindHiddenOutputRestoreRequest } from './output-restore/hidden-output-restore-request' import { bindLiveDataCallback } from './output/live-data-callback' @@ -62,9 +56,11 @@ import { bindBeginReattachLiveDataDeferral, bindReattachLiveDataDeferral } from './output/reattach-live-data-deferral' - import { bindParkRevealSnapshotVerdictActions } from './output-restore/park-reveal-snapshot-verdict' import { bindRemoteProgramRedraw } from './geometry/remote-program-redraw' +import type { ConnectPanePtySession } from './connect-pane-pty-session' + +// Preserve WebGL hook registration before deferred connection setup. export function installRunDeferredConnect(session: ConnectPanePtySession): void { const cwdPromise = session.deps.cwdPromise diff --git a/src/renderer/src/components/terminal-pane/pty-connection/spawn/hidden-agent-resume-deferral.test.ts b/src/renderer/src/components/terminal-pane/pty-connection/spawn/hidden-agent-resume-deferral.test.ts index 0b086e11036..88e5795d2b8 100644 --- a/src/renderer/src/components/terminal-pane/pty-connection/spawn/hidden-agent-resume-deferral.test.ts +++ b/src/renderer/src/components/terminal-pane/pty-connection/spawn/hidden-agent-resume-deferral.test.ts @@ -1,20 +1,19 @@ import { describe, expect, it, vi } from 'vitest' +import { + deferHiddenAgentResume, + noteHiddenAgentResumePtyEnded +} from './hidden-agent-resume-deferral' import type { ColdRestoreAgentResumeStartup } from '../startup/fresh-spawn-types' import type { ConnectPanePtySession } from '../connect-pane-pty-session' const wakeRequests = vi.hoisted(() => ({ take: vi.fn(() => false) })) -vi.mock('@/lib/sleeping-agent-wake-requests', () => ({ +vi.mock('@/lib/agent-session/resume/sleeping-agent-wake-requests', () => ({ takeSleepingAgentWakeRequest: wakeRequests.take })) vi.mock('../reattach/deferred-session-reattach-connect', () => ({ startDeferredSessionReattach: vi.fn() })) -import { - deferHiddenAgentResume, - noteHiddenAgentResumePtyEnded -} from './hidden-agent-resume-deferral' - function hiddenPaneSession(): ConnectPanePtySession { // oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: deferHiddenAgentResume reads only these session members. return { diff --git a/src/renderer/src/components/terminal-pane/pty-connection/spawn/hidden-agent-resume-deferral.ts b/src/renderer/src/components/terminal-pane/pty-connection/spawn/hidden-agent-resume-deferral.ts index 6ecac818bfb..2bd0148d513 100644 --- a/src/renderer/src/components/terminal-pane/pty-connection/spawn/hidden-agent-resume-deferral.ts +++ b/src/renderer/src/components/terminal-pane/pty-connection/spawn/hidden-agent-resume-deferral.ts @@ -1,5 +1,5 @@ import { isRemoteRuntimePtyId } from '../../../../../../shared/remote-runtime/remote-runtime-pty-id' -import { takeSleepingAgentWakeRequest } from '@/lib/sleeping-agent-wake-requests' +import { takeSleepingAgentWakeRequest } from '@/lib/agent-session/resume/sleeping-agent-wake-requests' import { holdPaneResumeUntilShown, releasePaneResumeHold diff --git a/src/renderer/src/components/terminal-pane/pty-connection/startup/saved-resume-startup-cancellation.ts b/src/renderer/src/components/terminal-pane/pty-connection/startup/saved-resume-startup-cancellation.ts index ae22d5a59ef..fcccfb08c9a 100644 --- a/src/renderer/src/components/terminal-pane/pty-connection/startup/saved-resume-startup-cancellation.ts +++ b/src/renderer/src/components/terminal-pane/pty-connection/startup/saved-resume-startup-cancellation.ts @@ -1,10 +1,10 @@ -import { forgetRefusedPaneResume } from '@/lib/forget-refused-pane-resume' +import { forgetRefusedPaneResume } from '@/lib/agent-session/resume/forget-refused-pane-resume' import { useAppStore } from '@/store/index' +import { clearStaleAgentTabTitleOnConfirmedShell } from '../agent-identity/confirmed-shell-agent-title' import type { ColdRestoreAgentResumeStartup } from './fresh-spawn-types' import type { PtyPaneStartup } from './pty-pane-startup' import type { PtyConnectResult } from '../../pty-transport/pty-transport-types' import type { ConnectPanePtySession } from '../connect-pane-pty-session' -import { clearStaleAgentTabTitleOnConfirmedShell } from '../agent-identity/confirmed-shell-agent-title' export function installSavedResumeStartupCancellation(session: ConnectPanePtySession): void { session.cancelSavedResumeStartup = ( diff --git a/src/renderer/src/components/terminal-pane/pty-connection/tests/pty-connection-spawn-and-startup.test.ts b/src/renderer/src/components/terminal-pane/pty-connection/tests/pty-connection-spawn-and-startup.test.ts index 6cf4f7756b3..7e7b1f12427 100644 --- a/src/renderer/src/components/terminal-pane/pty-connection/tests/pty-connection-spawn-and-startup.test.ts +++ b/src/renderer/src/components/terminal-pane/pty-connection/tests/pty-connection-spawn-and-startup.test.ts @@ -5,7 +5,6 @@ import { registerPtyConnectionRestoredRuntimePaneBindingTests } from '../reattac import { registerPtyConnectionTerminalPasteStartupCommandDeliveryTests } from '../startup/pty-connection-startup-command-delivery.spec' import { registerPtyConnectionCommandCodeStatusInferenceTests } from '../agent-identity/pty-connection-command-code-status-inference.spec' import { registerPtyConnectionStartupDraftDeliveryTests } from '../startup/pty-connection-startup-draft-delivery.spec' -import { registerPtyConnectionDeliberateSleepGuardTests } from '../lifecycle/pty-connection-deliberate-sleep-guard.spec' import { registerPtyConnectionRemoteRuntimeAttachTests } from '../reattach/pty-connection-remote-runtime-attach.spec' import { registerPtyConnectionRuntimePaneTransportRoutingTests } from '../host-ownership/pty-connection-runtime-pane-transport-routing.spec' @@ -19,7 +18,6 @@ describe('pty-connection-startup-command-delivery', () => { registerPtyConnectionTerminalPasteStartupCommandDeliveryTests() }) describe('pty-connection-startup-draft-delivery', registerPtyConnectionStartupDraftDeliveryTests) -describe('pty-connection-deliberate-sleep-guard', registerPtyConnectionDeliberateSleepGuardTests) describe('pty-connection-remote-runtime-attach', () => { registerPtyConnectionRemoteRuntimeAttachTests() registerPtyConnectionRuntimePaneTransportRoutingTests() diff --git a/src/renderer/src/components/terminal-pane/session-fork/terminal-agent-session-fork.ts b/src/renderer/src/components/terminal-pane/session-fork/terminal-agent-session-fork.ts index df5d16cfe1c..347e9b2c323 100644 --- a/src/renderer/src/components/terminal-pane/session-fork/terminal-agent-session-fork.ts +++ b/src/renderer/src/components/terminal-pane/session-fork/terminal-agent-session-fork.ts @@ -1,26 +1,24 @@ import { toast } from 'sonner' -import type { ManagedPane } from '@/lib/pane-manager/pane-manager-types' import { launchAgentInNewTab } from '@/lib/agent-session/launch/new-tab/launch-agent-in-new-tab' import { settleAgentTabLaunch } from '@/lib/agent-session/launch/new-tab/launch-agent-in-new-tab-host-agents' import { newAgentPromptOutcome } from '@/lib/agent-session/launch/prompt/new-agent-prompt-outcome' import { buildAgentSessionForkPrompt } from '@/lib/agent-session/context/agent-session-fork-context' import { activateAndRevealWorktree } from '@/lib/workspace/activation/worktree-activation' import { resolveOwner } from '@/lib/workspace/ownership/resolve-owner' -import { - toRuntimeExecutionHostId, - type ExecutionHostId -} from '../../../../../shared/execution-host' +import { toRuntimeExecutionHostId } from '../../../../../shared/execution-host' +import type { ExecutionHostId } from '../../../../../shared/execution-host' import { useAppStore } from '@/store/index' import { makePaneKey } from '../../../../../shared/workspace-layout/stable-pane-id' import { TUI_AGENT_CONFIG } from '../../../../../shared/agent-launch/catalog/tui-agent-config' import { getForkAgentLaunchPlatform } from './terminal-agent-session-fork-launch-platform' import { slugifyForWorkspaceName } from '../../../../../shared/workspace-name' import { FLOATING_TERMINAL_WORKTREE_ID } from '../../../../../shared/constants' -import type { TuiAgent } from '../../../../../shared/agent-launch/catalog/tui-agent' -import { getLocalProjectExecutionRuntimeContext } from '@/lib/local-preflight-context' +import { getLocalProjectExecutionRuntimeContext } from '@/runtime/hosts/preflight/local-preflight-context' import { translate } from '@/i18n/i18n' import { planAgentSessionLaunch } from '@/lib/agent-session/launch/routing/agent-session-launch-plan' import { newAgentLaunchRequestId } from '@/lib/agent-session/launch/routing/agent-launch-request-id' +import type { ManagedPane } from '@/lib/pane-manager/pane-manager-types' +import type { TuiAgent } from '../../../../../shared/agent-launch/catalog/tui-agent' type ForkAgentSessionFromPaneArgs = { pane: ManagedPane diff --git a/src/renderer/src/components/terminal-workspace-keydown.ts b/src/renderer/src/components/terminal-workspace-keydown.ts index 1376d24dd9a..506a29320fb 100644 --- a/src/renderer/src/components/terminal-workspace-keydown.ts +++ b/src/renderer/src/components/terminal-workspace-keydown.ts @@ -1,7 +1,7 @@ import { toast } from 'sonner' import { dispatchWorkspaceTabCommand } from '@/lib/workspace/tabs/workspace-tab-commands' - -import { type KeybindingActionId, keybindingMatchesAction } from '../../../shared/keybindings' +import { keybindingMatchesAction } from '../../../shared/keybindings' +import type { KeybindingActionId } from '../../../shared/keybindings' import { matchesRecentTabSwitcherChord } from '../../../shared/window-shortcut-policy' import { useAppStore } from '../store/index' import { @@ -18,7 +18,7 @@ import { showTerminalShortcutCaptureNotification } from '@/lib/notifications/ter import { ensureClientCreationActionAllowed, showClientCreationActionError -} from '@/lib/client-creation-action-error' +} from '@/lib/workspace/creation/surface-policy/client-creation-action-error' import { FLOATING_TERMINAL_WORKTREE_ID } from '../../../shared/constants' import { translate } from '@/i18n/i18n' import { getKeybindingContext } from './terminal-workspace-model' diff --git a/src/renderer/src/components/terminal/background-terminal-worktree-mount.ts b/src/renderer/src/components/terminal/background-terminal-worktree-mount.ts index a4731ce4c9e..466681cad5c 100644 --- a/src/renderer/src/components/terminal/background-terminal-worktree-mount.ts +++ b/src/renderer/src/components/terminal/background-terminal-worktree-mount.ts @@ -1,9 +1,7 @@ -import { - BACKGROUND_MOUNT_TERMINAL_WORKTREE_EVENT, - type BackgroundMountTerminalWorktreeDetail -} from '@/constants/terminal' +import { BACKGROUND_MOUNT_TERMINAL_WORKTREE_EVENT } from '@/constants/terminal' +import type { BackgroundMountTerminalWorktreeDetail } from '@/constants/terminal' import { parseExecutionHostId } from '../../../../shared/execution-host' -import { requestSleepingAgentWakeOnMount } from '@/lib/sleeping-agent-wake-requests' +import { requestSleepingAgentWakeOnMount } from '@/lib/agent-session/resume/sleeping-agent-wake-requests' const pendingMounts = new Map() const requestListeners = new Set<() => void>() diff --git a/src/renderer/src/components/terminal/initial-terminal-admission-wait.test.tsx b/src/renderer/src/components/terminal/initial-terminal-admission-wait.test.tsx deleted file mode 100644 index 1e7904aff1e..00000000000 --- a/src/renderer/src/components/terminal/initial-terminal-admission-wait.test.tsx +++ /dev/null @@ -1,304 +0,0 @@ -// @vitest-environment happy-dom -import type * as ParkedWatcherRegistryModule from '../terminal-pane/parking/output-watchers/terminal-parked-watcher-registry' -import { act, createElement } from 'react' -import { createRoot, type Root } from 'react-dom/client' -import { afterEach, beforeEach, describe, expect, it, vi, type MockInstance } from 'vitest' -import type { AppState } from '@/store/types' -import type { StructuredAgentLaunchSettlement } from '@/lib/agent-session/launch/continuation/structured-agent-launch-settlement' - -const mocks = vi.hoisted(() => { - const answers: ((support: unknown) => void)[] = [] - return { - gate: vi.fn(), - createTab: vi.fn(), - createUnifiedTab: vi.fn(), - begin: vi.fn(), - answers - } -}) - -const owner = vi.hoisted((): { store: ReturnType | null } => ({ - store: null -})) -vi.mock('@/store', async () => { - const module = (await import('@/lib/launch-parity-renderer.test-fixture')).launchStoreModuleMock( - owner - ) - return { - useAppStore: Object.assign( - (selector: (state: AppState) => unknown) => owner.store!(selector), - module.useAppStore - ) - } -}) -vi.mock('@/lib/workspace/activation/worktree-agent-activation-gate', () => ({ - gateWorktreeAgentActivation: mocks.gate -})) -vi.mock('@/lib/agent-session/resume/resume-sleeping-agent-session', () => ({ - resumeSleepingAgentSessionsForWorktree: vi.fn() -})) -vi.mock('@/lib/workspace/ownership/workspace-terminal-host-authority', () => ({ - createWorkspaceTerminalHostAuthoritySelector: () => () => 'none' -})) -vi.mock('../terminal-pane/parking/output-watchers/terminal-parked-tab-watchers', () => ({ - syncParkedTerminalTabWatchersForWorkspaces: vi.fn() -})) - -vi.mock( - '../terminal-pane/parking/output-watchers/terminal-parked-watcher-registry', - async (importOriginal) => ({ - ...(await importOriginal()), - pruneParkedTerminalWatchers: vi.fn(), - terminalWatcherLiveWorkspaceIds: () => new Set(), - disposeAllParkedTerminalWatchers: vi.fn() - }) -) -vi.mock('../../runtime/native-chat/requests/structured-agent-session-call', () => ({ - callStructuredAgentSession: (_target: unknown, method: string) => - method === 'agentSession.createSupport' - ? new Promise((resolve) => { - const answer = (support: unknown) => { - mocks.answers.splice(mocks.answers.indexOf(answer), 1) - resolve(support) - } - mocks.answers.push(answer) - }) - : new Promise(() => undefined) -})) - -// Main answers the window's chat-tab open (switch-on builds). -vi.mock('@/runtime/rpc/calls/runtime-rpc-call', async (importOriginal) => - ( - await import('@/runtime/workspace-layout/testing/layout-apply-test-transport.test-fixture') - ).runtimeRpcClientWithLayoutApply(await importOriginal()) -) - -vi.mock('@/runtime/workspace-layout/frames/runtime-layout-client', async (importOriginal) => - ( - await import('@/runtime/workspace-layout/testing/layout-apply-test-transport.test-fixture') - ).runtimeLayoutClientWithTestFrames(await importOriginal()) -) - -import { createTestStore, seedStore } from '@/store/testing/app-store-test-fixture' -import { makeWorktree } from '@/store/slices/worktrees/worktree.test-fixture' -import { - drawTabsFromMain, - type TabsDrawnFromMain -} from '@/store/slices/tabs/tabs-drawn-from-main.test-fixture' -import { isPendingTab } from '@/runtime/workspace-layout/intents/layout-owner-pending-tabs' -import { useTerminalWatcherEffects } from '../use-terminal-watcher-effects' -import { beginStructuredAgentSessionProvisionalLaunch } from '@/lib/agent-session/structured-agent-session-provisional-tab' -import { isEmptyWorkspaceDefaultSurfacePending } from '@/lib/workspace/activation/initial-surface/empty-workspace-default-surface-claims' -import type { AgentSessionLaunchPlan } from '@/lib/agent-session/launch/routing/agent-session-launch-plan' -import { ORCA_LAYOUT_OWNER_IS_MAIN } from '../../../../shared/layout-owner-switch' -import { layoutApplyTestTransport } from '@/runtime/workspace-layout/testing/layout-apply-test-transport.test-fixture' - -Object.assign(globalThis, { IS_REACT_ACT_ENVIRONMENT: true }) -let root: Root | undefined - -let main: TabsDrawnFromMain -let warnings: MockInstance -const owned: { - launch: NonNullable> - done: boolean -}[] = [] -const begins: { finish: () => void; cancel: ReturnType }[] = [] -beforeEach(async () => { - vi.resetAllMocks() - owner.store = createTestStore() - seedStore(owner.store, { - worktreesByRepo: { repo: [makeWorktree({ id: 'wt-1', repoId: 'repo' })] }, - activeWorktreeId: 'wt-1' - }) - mocks.createUnifiedTab.mockImplementation(owner.store.getState().createUnifiedTab) - owner.store.setState({ createUnifiedTab: mocks.createUnifiedTab }) - expect(owner.store.getState().readLocalAgentInventory('wt-1')).toEqual({ - ids: null, - state: 'pending' - }) - main = await drawTabsFromMain(owner.store) - warnings = vi.spyOn(console, 'warn') -}) - -afterEach(async () => { - await act(async () => root?.unmount()) - root = undefined - for (const entry of owned) { - if (!entry.done) { - entry.launch.cancel() - } - } - while (mocks.answers.length) { - mocks.answers[0]!({ supported: false }) - } - for (const begin of begins.splice(0)) { - begin.finish() - } - await Promise.all(owned.splice(0).map(({ launch }) => launch.settlement)) - await main.settle() - expect(mocks.answers).toEqual([]) - expect(begins).toEqual([]) - expect(layoutApplyTestTransport.pendingCount).toBe(0) - expect( - warnings.mock.calls.filter( - ([message]) => message === '[layout-owner] pending tab waiter threw:' - ) - ).toEqual([]) - main.close() - vi.restoreAllMocks() - owner.store = null -}) - -function launchChat(args: Parameters[0]) { - const launch = beginStructuredAgentSessionProvisionalLaunch(args) - if (!launch) { - throw new Error('Expected admitted launch handle') - } - const entry = { launch, done: false } - owned.push(entry) - void launch.settlement.then(() => { - entry.done = true - }) - return launch -} - -async function finishChat(launch: NonNullable>): Promise { - const begin = begins.pop()! - begin.finish() - await expect(launch.settlement).resolves.toEqual({ kind: 'structured', sessionId: 'claude_1' }) - await main.settle() - expect(begin.cancel).not.toHaveBeenCalled() - const tab = owner - .store!.getState() - .unifiedTabsByWorktree['wt-1']?.find((row) => row.entityId === 'claude_1') - expect(tab).toBeDefined() - expect(owner.store!.getState().getTab(tab!.id)).toBe(tab) - expect(isPendingTab(tab!.id)).toBe(false) - expect(isEmptyWorkspaceDefaultSurfacePending('wt-1')).toBe(false) -} - -/** No shell created here or (switch-on) asked of main. */ -function expectNoShell(): void { - expect(mocks.createTab).not.toHaveBeenCalled() - expect(layoutApplyTestTransport.sentOfType('createTerminalTab')).toEqual([]) -} - -/** Observe the original create/open request count; finishChat verifies the actual drawn row. */ -async function expectChatOpenedOnce(): Promise { - if (ORCA_LAYOUT_OWNER_IS_MAIN) { - await layoutApplyTestTransport.settle() - expect(layoutApplyTestTransport.sentOfType('openAgentSessionTab')).toEqual([ - expect.objectContaining({ workspace: 'wt-1', sessionId: 'claude_1' }) - ]) - expect(mocks.createUnifiedTab).not.toHaveBeenCalled() - return - } - expect(mocks.createUnifiedTab).toHaveBeenCalledOnce() -} - -function Watcher(): null { - useTerminalWatcherEffects({ - activeWorktreeId: 'wt-1', - workspaceSessionReady: true, - terminalStartupRestorationReady: true, - hydrationSucceeded: false, - workspaceSurfaceIds: [], - workspaceSurfaceIdSet: new Set(), - tabsByWorktree: {}, - createTab: mocks.createTab, - reconcileWorktreeTabModel: () => ({ renderableTabCount: 0, activeRenderableTabId: null }), - activationDeferredMountTabIdsByWorktreeRef: { current: new Map() }, - activeTabId: null, - activeTabIdByWorktree: {}, - activeView: 'terminal', - activityTerminalPortals: [], - anyMountedWorktreeHasLayout: false, - backgroundMountRevision: 0, - effectiveParkedTerminalWorktreeIds: new Set(), - evictionExemptTerminalTabIds: new Set(), - getEffectiveLayoutForWorktree: () => undefined, - groupsByWorktree: {}, - measurableBackgroundWorktreeIdsRef: { current: new Set() }, - mountedWorktreeIdsRef: { current: new Set() }, - pairedRuntimeParkingEnvironmentIds: new Set(), - pendingStartupByTabId: {}, - renderedActiveWorktreeId: 'wt-1', - startupTerminalTabHold: null, - terminalParkingEnabled: false, - terminalProviderSnapshotCapabilityRevision: 0, - terminalSshParkingEnabled: false, - terminalTitleSnapshotAuthorityEnabled: false - }) - return null -} - -function localChatPlan(): AgentSessionLaunchPlan { - mocks.begin.mockImplementation(() => { - const result = Promise.withResolvers() - const cancel = vi.fn() - begins.push({ - finish: () => result.resolve({ kind: 'structured', sessionId: 'claude_1' }), - cancel - }) - return { sessionId: 'claude_1', executionHostId: 'local', settlement: result.promise, cancel } - }) - return { - route: 'structured-native-chat', - requestId: 'request-1', - agent: 'claude', - worktreeId: 'wt-1', - executionHostId: 'local', - begin: mocks.begin, - launch: vi.fn() - } -} - -function gateAnsweredLater(): { - gate: Promise<'empty'> - finish: () => void -} { - let finish!: () => void - const gate = new Promise<'empty'>((resolve) => { - finish = () => resolve('empty') - }) - mocks.gate.mockReturnValue(gate) - return { gate, finish } -} - -// While admission waits, no launch record exists yet; passive seeding must not add Terminal 1 beside the chat. -describe('a local chat launch waiting on its host', () => { - it('keeps a watched create free of a stray shell until its chat opens', async () => { - const { finish } = gateAnsweredLater() - const launch = launchChat({ - plan: localChatPlan(), - hooks: {}, - beforeOpen: () => true - }) - expect(isEmptyWorkspaceDefaultSurfacePending('wt-1')).toBe(true) - - root = createRoot(document.createElement('div')) - await act(async () => root?.render(createElement(Watcher))) - await act(async () => finish()) - expectNoShell() - - await act(async () => mocks.answers[0]?.({ supported: true })) - await expectChatOpenedOnce() - expectNoShell() - await finishChat(launch) - }) - - it("keeps an empty workspace's default chat free of a shell seeded by the shared gate", async () => { - const { gate, finish } = gateAnsweredLater() - const pendingLaunch = gate.then(() => launchChat({ plan: localChatPlan(), hooks: {} })) - root = createRoot(document.createElement('div')) - await act(async () => root?.render(createElement(Watcher))) - await act(async () => finish()) - expect(mocks.begin).not.toHaveBeenCalled() - expectNoShell() - - await act(async () => mocks.answers[0]?.({ supported: true })) - await expectChatOpenedOnce() - expectNoShell() - await finishChat(await pendingLaunch) - }) -}) diff --git a/src/renderer/src/components/terminal/terminal-worktree-prewarm-targets.ts b/src/renderer/src/components/terminal/terminal-worktree-prewarm-targets.ts index eb7c00b6f61..83f20f59c53 100644 --- a/src/renderer/src/components/terminal/terminal-worktree-prewarm-targets.ts +++ b/src/renderer/src/components/terminal/terminal-worktree-prewarm-targets.ts @@ -1,9 +1,9 @@ import { sleepingAgentRecordIndex } from '@/store/terminals/sleeping-agent-record-index' -import type { AppState } from '@/store/types' -import type { TerminalTab } from '../../../../shared/workspace-layout/terminal-tab-types' -import { getSleepingRecordTabId } from '@/lib/sleeping-agent-wake-requests' +import { getSleepingRecordTabId } from '@/lib/agent-session/resume/sleeping-agent-wake-requests' import '../terminal-pane/parking/output-watchers/terminal-parked-tab-watchers' import { parkedTerminalTabCoverage } from '../terminal-pane/parking/output-watchers/parked-terminal-tab-coverage' +import type { AppState } from '@/store/types' +import type { TerminalTab } from '../../../../shared/workspace-layout/terminal-tab-types' export function selectRevealTerminalTabIds(state: AppState, worktreeId: string): Set { const revealTabIds = new Set() diff --git a/src/renderer/src/components/use-terminal-create-actions.ts b/src/renderer/src/components/use-terminal-create-actions.ts index 8a4819c276f..83107b9997e 100644 --- a/src/renderer/src/components/use-terminal-create-actions.ts +++ b/src/renderer/src/components/use-terminal-create-actions.ts @@ -1,6 +1,6 @@ import { useCallback } from 'react' import { toast } from 'sonner' -import { useAppStore } from '../store' +import { useAppStore } from '../store/index' import { focusTerminalTabSurface } from '@/components/terminal-pane/input/focus/focus-terminal-tab-surface' import { createNonSecureContextUuid as createBrowserUuid } from '../../../shared/non-secure-context-uuid' import { createWebRuntimeSessionBrowserTab } from '@/runtime/browser/creation/web-runtime-browser-creation' @@ -8,11 +8,12 @@ import { createWebRuntimeSessionTerminal } from '@/runtime/hosted-terminals/crea import { isWebRuntimeSessionActive } from '@/runtime/web-session-tabs-sync/identity/web-runtime-session-environment' import { openMobileEmulatorTab } from '@/lib/simulator/launch/open-mobile-emulator-tab' import { persistAgentLaunchTabOrder } from '@/lib/agent-session/launch/pane/launch-agent-tab-order' -import { buildDuplicatedBrowserTabOptions } from '@/lib/duplicate-browser-tab-options' +import { buildDuplicatedBrowserTabOptions } from '@/lib/browser/workspace/duplicate-browser-tab-options' import { browserWorkspaceHasRemoteOwner } from '@/runtime/browser/ownership/remote-browser-tab-ownership' -import { getClientCreationActionPolicy } from '@/lib/client-creation-action-policy' -import { showClientCreationActionError } from '@/lib/client-creation-action-error' -import { openTabBarEntry, type TabCreateEntryArgs } from './tab-bar/tab-create-entry-action' +import { getClientCreationActionPolicy } from '@/lib/workspace/creation/surface-policy/client-creation-action-policy' +import { showClientCreationActionError } from '@/lib/workspace/creation/surface-policy/client-creation-action-error' +import { openTabBarEntry } from './tab-bar/tab-create-entry-action' +import type { TabCreateEntryArgs } from './tab-bar/tab-create-entry-action' import { translate } from '@/i18n/i18n' import { getActiveWorktreeRuntimeEnvironmentId } from './terminal-workspace-model' import type { TerminalColdActivationController } from './terminal-cold-activation' diff --git a/src/renderer/src/components/wsl-move/WslMoveDialog.tsx b/src/renderer/src/components/wsl-move/WslMoveDialog.tsx index bb2148d5d00..7589953eb87 100644 --- a/src/renderer/src/components/wsl-move/WslMoveDialog.tsx +++ b/src/renderer/src/components/wsl-move/WslMoveDialog.tsx @@ -1,7 +1,7 @@ import React, { useEffect } from 'react' import { useShallow } from 'zustand/react/shallow' import { useTranslate } from '@/i18n/use-translate' -import { useAppStore } from '@/store' +import { useAppStore } from '@/store/index' import { Dialog, DialogContent, @@ -10,10 +10,6 @@ import { DialogTitle } from '@/components/ui/dialog' import { LoadingSpinner } from '@/components/LoadingSpinner' -import type { - WslMoveBlocker, - WslMoveRowRef -} from '../../../../shared/wsl-move/wsl-move-driver-types' import { cancelWslMove, wslMoveDialogLocked, @@ -27,14 +23,9 @@ import { import { collectWslMoveSleptPaneBindings } from './wsl-move-slept-pane-bindings' import { followWslMoveOrchestratorStatus } from './wsl-move-orchestrator-status' import { findWorktreeById } from '@/store/github/refresh/worktree-refresh' -import { getWslDistroFromPath } from '@/lib/local-preflight-context' -import { - wslMoveBlockerProjects, - wslMoveCounts, - wslMoveProjectRows, - type WslMoveCatalog -} from './wsl-move-scope-rows' -import type { WslMoveBlockerView } from './WslMoveBlockerList' +import { getWslDistroFromPath } from '@/runtime/hosts/preflight/local-preflight-context' +import { wslMoveBlockerProjects, wslMoveCounts, wslMoveProjectRows } from './wsl-move-scope-rows' +import type { WslMoveCatalog } from './wsl-move-scope-rows' import { selectFolderWorkspaces, selectWorktreesByRepo @@ -48,6 +39,11 @@ import { useWslMoveQuitGuard } from './use-wsl-move-quit-guard' import { WslMovePreviewBody, wslMoveNotMovingLines } from './WslMovePreviewBody' import { WslMoveProgressBody } from './WslMoveProgressBody' import { WslMoveResultBody, wslMoveResultTitle } from './WslMoveResultBody' +import type { + WslMoveBlocker, + WslMoveRowRef +} from '../../../../shared/wsl-move/wsl-move-driver-types' +import type { WslMoveBlockerView } from './WslMoveBlockerList' function useMoveCatalog(): WslMoveCatalog { return useAppStore( diff --git a/src/renderer/src/hooks/composer-state/attachment-drop-state.ts b/src/renderer/src/hooks/composer-state/attachment-drop-state.ts index 0b13f9ee53c..f31a25226c7 100644 --- a/src/renderer/src/hooks/composer-state/attachment-drop-state.ts +++ b/src/renderer/src/hooks/composer-state/attachment-drop-state.ts @@ -1,3 +1,19 @@ +import { useCallback } from 'react' +import { toast } from 'sonner' +import { translate } from '@/i18n/i18n' +import { joinPath } from '@/lib/path' +import { DROP_STAGING_RELATIVE_DIR } from '../../../../shared/drop-staging-ignore' +import { captureDirectSshMutationExpectation } from '@/runtime/hosts/ssh/ssh-mutation-expectation' +import { useAppStore } from '@/store/index' +import { importExternalPathsToRuntime } from '@/runtime/files/imports/runtime-file-import-client' +import { readIpcErrorMessage } from '@/runtime/errors/ipc-error' +import { showComposerDropFailureToast } from '../composer-drop-failure-toast' +import { collectComposerDropResult } from '../composer-drop-result' +import type { ComposerDropFailure, ComposerDropItemResult } from '../composer-drop-result' +import { applyComposerNativeFileDrop } from '../composer-native-file-drop' +import { useMountedRef } from '../useMountedRef' +import { userNamedFileAccess } from '@/lib/files/access/local-file-access' +import { runtimeTargetForOwnerEnvironment } from '@/runtime/rpc/targets/runtime-client-target' import type { ComposerModel } from './composer-model' type AttachmentDropStateInput = Pick< @@ -16,26 +32,6 @@ type AttachmentDropStateInput = Pick< selectedWorktreeId: string | null } -import { useCallback } from 'react' -import { toast } from 'sonner' -import { translate } from '@/i18n/i18n' -import { joinPath } from '@/lib/path' -import { DROP_STAGING_RELATIVE_DIR } from '../../../../shared/drop-staging-ignore' -import { captureDirectSshMutationExpectation } from '@/lib/ssh-mutation-expectation' -import { useAppStore } from '@/store/index' -import { importExternalPathsToRuntime } from '@/runtime/files/imports/runtime-file-import-client' -import { readIpcErrorMessage } from '@/runtime/errors/ipc-error' -import { showComposerDropFailureToast } from '../composer-drop-failure-toast' -import { - collectComposerDropResult, - type ComposerDropFailure, - type ComposerDropItemResult -} from '../composer-drop-result' -import { applyComposerNativeFileDrop } from '../composer-native-file-drop' -import { useMountedRef } from '../useMountedRef' -import { userNamedFileAccess } from '@/lib/files/access/local-file-access' -import { runtimeTargetForOwnerEnvironment } from '@/runtime/rpc/targets/runtime-client-target' - // Local drops bypass the runtime importer's skip classification. function localDropFailure(detail: string | undefined): ComposerDropFailure { if (detail?.startsWith('ENOENT')) { diff --git a/src/renderer/src/hooks/composer-state/runtime-target-selection.ts b/src/renderer/src/hooks/composer-state/runtime-target-selection.ts index 3ea8fb36602..74f60cc056b 100644 --- a/src/renderer/src/hooks/composer-state/runtime-target-selection.ts +++ b/src/renderer/src/hooks/composer-state/runtime-target-selection.ts @@ -1,6 +1,4 @@ import { ipcOrRuntimeTargetForHostId } from '@/runtime/rpc/targets/runtime-client-target' -import type { ComposerRuntimeTargetSelectionInput } from './composer-target-input-contracts' - import { useEffect, useMemo, useRef } from 'react' import { getFolderSourceRepos } from '@/components/sidebar/workspace-creation/folder/folder-workspace-source-repos' import { parseExecutionHostId, getRepoExecutionHostId } from '../../../../shared/execution-host' @@ -8,22 +6,23 @@ import { getSelectedRepoSshGate } from '@/lib/workspace/creation/new-workspace-s import { selectRepoSshGateInput } from '@/lib/workspace/catalog/repo-ssh-connection' import { useFolderWorkspaceComposerPathStatus } from '@/components/sidebar/workspace-creation/folder/folder-workspace-composer-path-status' import { useDetectedAgents } from '@/hooks/useDetectedAgents' -import type { TuiAgent } from '../../../../shared/agent-launch/catalog/tui-agent' import { resolveWorkspaceCreationTarget } from '@/lib/workspace/creation/project-host-workspace-target' import { isGitRepoKind } from '../../../../shared/repo-kind' import { CLIENT_PLATFORM } from '@/lib/workspace/creation/new-workspace' -import { getLocalRepoProjectExecutionRuntimeContext } from '@/lib/local-preflight-context' +import { getLocalRepoProjectExecutionRuntimeContext } from '@/runtime/hosts/preflight/local-preflight-context' import { resolveExecutionHostAgentStartupShell, resolveRepoExecutionHostPlatform } from '@/runtime/hosts/platform/execution-host-facts' -import type { ExecutionHostPlatformFact } from '@/runtime/hosts/platform/execution-host-platform-fact' import { useAppStore } from '@/store/index' import { repoIsRemote } from '../../../../shared/agent-launch/startup/agent-launch-remote' import { buildProjectHostSetupOptions } from '@/lib/workspace/creation/project-host-setup-options' import { buildNewWorkspaceCreateTargetOptions } from '@/lib/workspace/creation/new-workspace-project-options' import { getRuntimeEnvironmentIdForRepo } from '@/lib/workspace/ownership/repo-runtime-owner' import { useEphemeralVmRecipeOptions } from '@/hooks/useEphemeralVmRecipeOptions' +import type { ComposerRuntimeTargetSelectionInput } from './composer-target-input-contracts' +import type { TuiAgent } from '../../../../shared/agent-launch/catalog/tui-agent' +import type { ExecutionHostPlatformFact } from '@/runtime/hosts/platform/execution-host-platform-fact' export function useComposerRuntimeTargetSelection(input: ComposerRuntimeTargetSelectionInput) { const { diff --git a/src/renderer/src/hooks/ipc-events/agent-status-listeners.ts b/src/renderer/src/hooks/ipc-events/agent-status-listeners.ts index 5783ac2fd25..b3715cccbea 100644 --- a/src/renderer/src/hooks/ipc-events/agent-status-listeners.ts +++ b/src/renderer/src/hooks/ipc-events/agent-status-listeners.ts @@ -1,17 +1,20 @@ import { CLOSE_TERMINAL_PANE_EVENT } from '@/constants/terminal' +import { + resolveLegacyWorkerTerminalRecoveryAction, + rollbackLegacyWorkerTerminalSurfaceInStore +} from '../legacy-worker-terminal-recovery-event' +import { useAppStore } from '../../store/index' +import { + forgetRefusedPaneResume, + namesRefusedResume +} from '@/lib/agent-session/resume/forget-refused-pane-resume' +import { resolveAgentPaneAuthorityKey } from '@/store/slices/agent-status/agent-pane-authority' +import { resolvePaneKey } from '../../lib/agent-status/ownership/agent-status-pane-ownership' import type { AgentStatusClearIpcPayload, AgentStatusIpcPayload, RefusedPaneResume } from '../../../../shared/agent-status/contracts/agent-status-ipc-payload' -import { - resolveLegacyWorkerTerminalRecoveryAction, - rollbackLegacyWorkerTerminalSurfaceInStore -} from '../legacy-worker-terminal-recovery-event' -import { useAppStore } from '../../store' -import { forgetRefusedPaneResume, namesRefusedResume } from '@/lib/forget-refused-pane-resume' -import { resolveAgentPaneAuthorityKey } from '@/store/slices/agent-status/agent-pane-authority' -import { resolvePaneKey } from '../../lib/agent-status/ownership/agent-status-pane-ownership' import type { PendingAgentStatusEvent } from './agent-status-bridge-types' /** An already delivered event for the pane naming a refused conversation would restore it. */ diff --git a/src/renderer/src/hooks/ipc-events/direct-ssh-hydration-target-metadata.test.ts b/src/renderer/src/hooks/ipc-events/direct-ssh-hydration-target-metadata.test.ts index 2cf0f4feb28..4d6b3c53b9a 100644 --- a/src/renderer/src/hooks/ipc-events/direct-ssh-hydration-target-metadata.test.ts +++ b/src/renderer/src/hooks/ipc-events/direct-ssh-hydration-target-metadata.test.ts @@ -1,12 +1,9 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' -import { useAppStore } from '@/store' -import { - selectRuntimeAwareSshTargetLabel, - selectRuntimeAwareSshTargetRemoved -} from '@/store/slices/ssh/runtime-environment-ssh-selectors' -import type { SshConnectionState } from '../../../../shared/ssh-types' +import { useAppStore } from '@/store/index' +import { selectRuntimeAwareSshTargetRemoved } from '@/store/slices/ssh/runtime-environment-ssh-selectors' import { registerDirectSshStateIpcBridge } from './direct-ssh-state-ipc-bridge' -import { resetSshConfigPassiveSyncForTests } from '../../lib/ssh-config-passive-sync' +import { resetSshConfigPassiveSyncForTests } from '../../runtime/hosts/ssh/ssh-config-passive-sync' +import type { SshConnectionState } from '../../../../shared/ssh-types' type SshApiStub = { importConfig?: () => Promise<{ @@ -78,35 +75,6 @@ describe('direct SSH hydration target metadata', () => { vi.restoreAllMocks() }) - it('lands live target labels while the removed-labels round trip is still in flight', async () => { - let listTargetsCalls = 0 - stubWindow({ - listTargets: () => { - listTargetsCalls += 1 - return Promise.resolve([{ id: 'ssh-live', label: 'devbox' }]) - }, - listRemovedTargetLabels: () => new Promise(() => {}), - getState: () => Promise.resolve(connectingState('ssh-live')) - }) - - unsubs.push(registerDirectSshStateIpcBridge(unsubs)) - await settle() - - expect({ - label: selectRuntimeAwareSshTargetLabel(useAppStore.getState(), null, 'ssh-live'), - status: useAppStore.getState().sshConnectionStates.get('ssh-live')?.status - }).toEqual({ label: 'devbox', status: 'connecting' }) - - // Known-target pushes bypass lookups on an already-unresponsive link. - listTargetsCalls = 0 - onStateChangedHandler?.({ targetId: 'ssh-live', state: connectingState('ssh-live') }) - await settle() - expect({ - listTargetsCalls, - status: useAppStore.getState().sshConnectionStates.get('ssh-live')?.status - }).toEqual({ listTargetsCalls: 0, status: 'connecting' }) - }) - it('keeps the target list and records the failure when removed labels are unavailable', async () => { const warn = vi.spyOn(console, 'warn').mockImplementation(() => {}) stubWindow({ diff --git a/src/renderer/src/hooks/ipc-events/direct-ssh-state-ipc-bridge.ts b/src/renderer/src/hooks/ipc-events/direct-ssh-state-ipc-bridge.ts index db03f003195..efd4e3bb513 100644 --- a/src/renderer/src/hooks/ipc-events/direct-ssh-state-ipc-bridge.ts +++ b/src/renderer/src/hooks/ipc-events/direct-ssh-state-ipc-bridge.ts @@ -1,15 +1,13 @@ import { canConnectSshStatus } from '@/ssh/ssh-connection-recoverability' -import type { DirectSshAuthority, SshConnectionState } from '../../../../shared/ssh-types' -import { useAppStore } from '../../store' +import { useAppStore } from '../../store/index' import { directSshAuthoritiesEqual } from '../../store/slices/worktrees/listing/direct-ssh-authority' -import { - directSshAuthorityFromConnectionState, - type DirectSshConnectedStateOrigin -} from '../direct-ssh-state-routing' +import { directSshAuthorityFromConnectionState } from '../direct-ssh-state-routing' +import type { DirectSshConnectedStateOrigin } from '../direct-ssh-state-routing' import { hydrateDirectSshInitialState } from './direct-ssh-initial-state-hydration' -import { syncSshConfigTargetsPassively } from '../../lib/ssh-config-passive-sync' +import { syncSshConfigTargetsPassively } from '../../runtime/hosts/ssh/ssh-config-passive-sync' import { applySshManagedServerTransition } from './ssh-managed-server-state-effects' import { createDirectSshUnrestoredForwardSync } from './direct-ssh-unrestored-forward-sync' +import type { DirectSshAuthority, SshConnectionState } from '../../../../shared/ssh-types' type AuthorityDeadline = { timer: ReturnType; settle: () => void } diff --git a/src/renderer/src/hooks/ipc-events/terminal-pane-title-ipc-bridge.ts b/src/renderer/src/hooks/ipc-events/terminal-pane-title-ipc-bridge.ts index a9fa5c00bd9..5146d6a079e 100644 --- a/src/renderer/src/hooks/ipc-events/terminal-pane-title-ipc-bridge.ts +++ b/src/renderer/src/hooks/ipc-events/terminal-pane-title-ipc-bridge.ts @@ -1,18 +1,16 @@ -import { - SET_TERMINAL_PANE_TITLE_EVENT, - type SetTerminalPaneTitleDetail -} from '@/constants/terminal' +import { SET_TERMINAL_PANE_TITLE_EVENT } from '@/constants/terminal' +import type { SetTerminalPaneTitleDetail } from '@/constants/terminal' import '../../components/terminal-pane/layout/terminal-layout-leaf-traversal' import { collectLayoutLeafIdsInOrder, resolveRootlessTerminalLayoutLeafId } from '../../../../shared/workspace-layout/terminal-pane-tree' -import { chatWorkspaceByTabId as findTerminalTabWorktreeId } from '@/lib/structured-chat-tab-index' +import { chatWorkspaceByTabId as findTerminalTabWorktreeId } from '@/lib/agent-session/tab-identity/structured-chat-tab-index' import { sendLayoutCommandToOwner } from '@/runtime/workspace-layout/commands/layout-owner-command' -import { useAppStore } from '../../store' -import type { TerminalLayoutSnapshot } from '../../../../shared/workspace-layout/terminal-tab-types' +import { useAppStore } from '../../store/index' import { isTerminalLeafId } from '../../../../shared/workspace-layout/stable-pane-id' import { ORCA_LAYOUT_OWNER_IS_MAIN } from '../../../../shared/layout-owner-switch' +import type { TerminalLayoutSnapshot } from '../../../../shared/workspace-layout/terminal-tab-types' function showRuntimePaneTitle(tabId: string, leafId: string, title: string | null): void { const store = useAppStore.getState() diff --git a/src/renderer/src/hooks/ipc-events/terminal-presentation-ipc-bridge.ts b/src/renderer/src/hooks/ipc-events/terminal-presentation-ipc-bridge.ts index 7c3ad1e95be..c6c389db558 100644 --- a/src/renderer/src/hooks/ipc-events/terminal-presentation-ipc-bridge.ts +++ b/src/renderer/src/hooks/ipc-events/terminal-presentation-ipc-bridge.ts @@ -7,12 +7,12 @@ import { SPLIT_TERMINAL_PANE_EVENT } from '@/constants/terminal' import type { SplitTerminalPaneDetail } from '@/constants/terminal' import { singlePaneLayoutSnapshot } from '@/store/terminals/terminal-single-pane-layout' import { verifyTerminalRevealIdentity } from '@/lib/workspace/tabs/terminal-reveal-identity' -import { insertUnifiedTabAfterAnchor } from '@/lib/unified-tab-anchor-insertion' +import { insertUnifiedTabAfterAnchor } from '@/lib/workspace/tabs/unified-tab-anchor-insertion' import { tryMakePaneKey } from './agent-status-routing' import { registerLaunchRecipe } from './launch-recipe-registration' import { wasAgentLaunchPaneClosedByUser } from '@/lib/agent-session/launch/pane/agent-launch-pane-closes' import { revealWorkspaceSurface } from '@/lib/workspace/activation/workspace-surface-reveal' -import { useAppStore } from '../../store' +import { useAppStore } from '../../store/index' import { ORCA_LAYOUT_OWNER_IS_MAIN } from '../../../../shared/layout-owner-switch' import { activateExistingLeafInLayout, diff --git a/src/renderer/src/hooks/ipc-events/terminal-request-ipc-bridge.ts b/src/renderer/src/hooks/ipc-events/terminal-request-ipc-bridge.ts index f6c72d1e923..6e977753cfe 100644 --- a/src/renderer/src/hooks/ipc-events/terminal-request-ipc-bridge.ts +++ b/src/renderer/src/hooks/ipc-events/terminal-request-ipc-bridge.ts @@ -1,9 +1,9 @@ import { requestBackgroundTerminalWorktreeMount } from '@/components/terminal/background-terminal-worktree-mount' import { resolveTerminalWorktreeRoute } from '@/lib/workspace/ownership/terminal-worktree-route' -import { insertUnifiedTabAfterAnchor } from '@/lib/unified-tab-anchor-insertion' +import { insertUnifiedTabAfterAnchor } from '@/lib/workspace/tabs/unified-tab-anchor-insertion' import { translate } from '@/i18n/i18n' import { revealWorkspaceSurface } from '@/lib/workspace/activation/workspace-surface-reveal' -import { useAppStore } from '../../store' +import { useAppStore } from '../../store/index' import { focusTerminalInitiatedTab, resolveTerminalPresentation } from './terminal-command-state' export function registerTerminalRequestIpcBridge(unsubs: (() => void)[]): void { diff --git a/src/renderer/src/hooks/skills/runtime/useActiveProjectSkillRuntime.ts b/src/renderer/src/hooks/skills/runtime/useActiveProjectSkillRuntime.ts index dead2f1a9c7..9f55a96c8cf 100644 --- a/src/renderer/src/hooks/skills/runtime/useActiveProjectSkillRuntime.ts +++ b/src/renderer/src/hooks/skills/runtime/useActiveProjectSkillRuntime.ts @@ -1,33 +1,33 @@ import { useMemo, useState } from 'react' import { useShallow } from 'zustand/react/shallow' -import type { ProjectExecutionRuntimeResolution } from '../../../../../shared/execution-host/project-execution-runtime' -import type { SkillDiscoveryTarget } from '../../../../../shared/skills' import { useActiveSkillDiscoveryRuntimeTarget } from '../discovery/use-active-skill-discovery-runtime-target' -import type { RuntimeClientTarget } from '../../../../../shared/runtime-client-target' import { LOCAL_EXECUTION_HOST_ID } from '../../../../../shared/execution-host' import { getGlobalWindowsExecutionRuntimeContext, getLocalProjectExecutionRuntimeContext -} from '@/lib/local-preflight-context' +} from '@/runtime/hosts/preflight/local-preflight-context' import { getProjectAgentSkillRuntime, getProjectAgentSkillTerminalShellOverride, getProjectSkillDiscoveryTarget, - getProjectSkillInstallDisabledReason, - type ProjectAgentSkillRuntime + getProjectSkillInstallDisabledReason } from '@/lib/skills/runtime/project-skill-runtime' +import type { ProjectAgentSkillRuntime } from '@/lib/skills/runtime/project-skill-runtime' import { useWindowsTerminalCapabilities } from '@/runtime/hosts/capabilities/windows-terminal-capabilities' import { resolveBundledSkillTarget, - servingExecutionHostId, - type BundledSkillTarget + servingExecutionHostId } from '@/lib/skills/runtime/bundled-skill-target' +import type { BundledSkillTarget } from '@/lib/skills/runtime/bundled-skill-target' import { getResolvedExecutionHostIdForWorktree } from '@/lib/workspace/ownership/resolved-worktree-execution-host' import { useAppStore } from '@/store/index' import { selectFolderWorkspaces, selectWorktreesByRepo } from '@/store/workspaces/catalog/workspace-record-fields' +import type { ProjectExecutionRuntimeResolution } from '../../../../../shared/execution-host/project-execution-runtime' +import type { SkillDiscoveryTarget } from '../../../../../shared/skills' +import type { RuntimeClientTarget } from '../../../../../shared/runtime-client-target' type ActiveProjectSkillRuntime = { projectRuntime?: ProjectExecutionRuntimeResolution diff --git a/src/renderer/src/hooks/use-integration-provider-status-refresh.ts b/src/renderer/src/hooks/use-integration-provider-status-refresh.ts index 1bb8e8a5655..f217c6c0885 100644 --- a/src/renderer/src/hooks/use-integration-provider-status-refresh.ts +++ b/src/renderer/src/hooks/use-integration-provider-status-refresh.ts @@ -1,6 +1,6 @@ import { useEffect } from 'react' -import { getLocalPreflightContext } from '@/lib/local-preflight-context' -import { localPreflightContextKey } from '@/lib/local-preflight-context-key' +import { getLocalPreflightContext } from '@/runtime/hosts/preflight/local-preflight-context' +import { localPreflightContextKey } from '@/runtime/hosts/preflight/local-preflight-context-key' import { getProviderRuntimeContextKey } from '@/runtime/hosts/observations/provider-runtime-context' import { useAppStore } from '@/store/index' diff --git a/src/renderer/src/hooks/use-split-divider-setting.ts b/src/renderer/src/hooks/use-split-divider-setting.ts index 4f7c9698908..f296095e3fe 100644 --- a/src/renderer/src/hooks/use-split-divider-setting.ts +++ b/src/renderer/src/hooks/use-split-divider-setting.ts @@ -1,7 +1,10 @@ import { useEffect } from 'react' -import { useAppStore } from '@/store' +import { useAppStore } from '@/store/index' import { useSystemPrefersDark } from '@/hooks/theme/use-system-prefers-dark' -import { DEFAULT_TERMINAL_DIVIDER_DARK, DEFAULT_TERMINAL_DIVIDER_LIGHT } from '@/lib/terminal-theme' +import { + DEFAULT_TERMINAL_DIVIDER_DARK, + DEFAULT_TERMINAL_DIVIDER_LIGHT +} from '@/lib/terminal/appearance/terminal-theme' import { selectTerminalTheme } from '../../../shared/terminal-themes/terminal-theme-selection' /** diff --git a/src/renderer/src/hooks/useDetectedAgents.ts b/src/renderer/src/hooks/useDetectedAgents.ts index 703592b1dd7..9e0d5f44b4c 100644 --- a/src/renderer/src/hooks/useDetectedAgents.ts +++ b/src/renderer/src/hooks/useDetectedAgents.ts @@ -1,11 +1,11 @@ import { useAppStateViewActive, useAppStateValue } from '@/store/retained-views/app-state-view' import { useCallback, useEffect, useRef } from 'react' -import { useAppStore } from '@/store' -import { getLocalAgentPreflightContext } from '@/lib/local-preflight-context' -import { localAgentInventoryContextKey } from '@/lib/local-preflight-context-key' +import { useAppStore } from '@/store/index' +import { getLocalAgentPreflightContext } from '@/runtime/hosts/preflight/local-preflight-context' +import { localAgentInventoryContextKey } from '@/runtime/hosts/preflight/local-preflight-context-key' import { runtimeHostContactForEntry } from '../../../shared/remote-runtime/host-status/runtime-host-contact' -import type { TuiAgent } from '../../../shared/agent-launch/catalog/tui-agent' import { getRuntimeAgentInventoryKey } from '@/store/slices/agent-inventory/runtime-agent-inventory-key' +import type { TuiAgent } from '../../../shared/agent-launch/catalog/tui-agent' export type UseDetectedAgentsResult = { /** Null while detection is in flight on first load. */ diff --git a/src/renderer/src/hooks/useSettingsNavigationMetadata.ts b/src/renderer/src/hooks/useSettingsNavigationMetadata.ts index cff20541fbf..29769de46cd 100644 --- a/src/renderer/src/hooks/useSettingsNavigationMetadata.ts +++ b/src/renderer/src/hooks/useSettingsNavigationMetadata.ts @@ -1,7 +1,5 @@ import { useMemo } from 'react' import { useShallow } from 'zustand/react/shallow' -// Share Settings/Cmd+J visibility without Settings pane UI imports; an architecture test enforces this boundary. -// Share Settings/Cmd+J visibility without Settings pane UI imports; an architecture test enforces this boundary. import { getRuntimeEnvironmentsSearchEntry, getWebRuntimeEnvironmentsSearchEntry @@ -9,8 +7,7 @@ import { import { getTerminalPaneSearchEntries } from '@/components/settings/terminal/terminal-search' import { isMacUserAgent, isWindowsUserAgent } from '@/app-shell/platform/user-agent-platform' import { useLinearProviderConnected } from '@/hooks/useLinearProviderConnected' -import { getClientCreationActionPolicy } from '@/lib/client-creation-action-policy' -import type { SettingsNavSection } from '@/components/settings/navigation/settings-navigation-types' +import { getClientCreationActionPolicy } from '@/lib/workspace/creation/surface-policy/client-creation-action-policy' import { isWebClientLocation } from '@/app-shell/platform/web-client-location' import { isWindowsTerminalCapabilityHost, @@ -23,19 +20,24 @@ import { useChatSettingsOwnPermissions, useStructuredAgentSessionHostQueuesMessages } from '@/runtime/native-chat/host-capabilities/structured-agent-session-host-capability' -import type { ProjectGroupingModel } from '../../../shared/project-section-grouping' -import type { Repo } from '../../../shared/repo-types' import { buildCapabilitySettingsSections, buildSetupSettingsSections } from './settings-navigation-capability-sections' -import type { SettingsNavigationBuildOptions } from './settings-navigation-build-options' import { buildInterfaceSettingsSections } from './settings-navigation-interface-sections' import { buildRemoteSettingsSections } from './settings-navigation-remote-sections' import { buildWorkflowSettingsSections } from './settings-navigation-workflow-sections' import { useWindowsTerminalCapabilityOwnerKey } from './useWindowsTerminalCapabilityOwnerKey' import { useUiLanguageRevision } from '@/i18n/use-ui-language-revision' -import { useTranslate, type Translate } from '@/i18n/use-translate' +import { useTranslate } from '@/i18n/use-translate' +import type { Translate } from '@/i18n/use-translate' +import type { SettingsNavSection } from '@/components/settings/navigation/settings-navigation-types' +import type { ProjectGroupingModel } from '../../../shared/project-section-grouping' +import type { Repo } from '../../../shared/repo-types' +import type { SettingsNavigationBuildOptions } from './settings-navigation-build-options' + +// Share Settings/Cmd+J visibility without Settings pane UI imports; an architecture test enforces this boundary. +// Share Settings/Cmd+J visibility without Settings pane UI imports; an architecture test enforces this boundary. export { isWebClientLocation } from '@/app-shell/platform/web-client-location' diff --git a/src/renderer/src/lib/activate-ai-vault-structured-session-host.test.ts b/src/renderer/src/lib/activate-ai-vault-structured-session-host.test.ts deleted file mode 100644 index be489e4d00a..00000000000 --- a/src/renderer/src/lib/activate-ai-vault-structured-session-host.test.ts +++ /dev/null @@ -1,220 +0,0 @@ -import { beforeEach, expect, it, vi } from 'vitest' -import type { Tab } from '../../../shared/tab-types' - -const mocks = vi.hoisted(() => { - const tabs: Record = {} - return { - navigate: vi.fn(), - moved: vi.fn(() => false), - call: vi.fn(), - supports: vi.fn(), - apply: vi.fn(), - activateTab: vi.fn(), - focusGroup: vi.fn(), - setActiveTabType: vi.fn(), - state: { - activeWorktreeId: 'workspace', - activeWorkspaceExecutionHostId: 'local' as const, - unifiedTabsByWorktree: tabs - } - } -}) -vi.mock('sonner', () => ({ toast: { error: vi.fn() } })) -vi.mock('@/runtime/local-structured-session-tabs-sync/inventory-refresh', () => ({ - refreshLocalStructuredSessionWorktreeTabs: async () => undefined -})) -vi.mock('./workspace/activation/worktree-activation', () => ({ - activateAndRevealWorktree: mocks.navigate -})) -vi.mock('./workspace/activation/wsl-moved-chat-activation', () => ({ - activateWslMovedWorkspace: mocks.moved -})) -vi.mock('@/store', () => ({ - useAppStore: { - getState: () => ({ - ...mocks.state, - activateTab: mocks.activateTab, - focusGroup: mocks.focusGroup, - setActiveTabType: mocks.setActiveTabType - }) - } -})) -vi.mock('@/runtime/rpc/calls/runtime-rpc-call', async (original) => ({ - ...(await original>()), - callRuntimeRpc: mocks.call -})) -vi.mock('@/runtime/rpc/compatibility/runtime-capability-proof', async (original) => ({ - ...(await original>()), - runtimeEnvironmentSupportsCapability: mocks.supports -})) -vi.mock('@/runtime/local-structured-session-tabs-sync/snapshot-apply', async (original) => ({ - ...(await original>()), - applyStructuredSessionTabSnapshots: mocks.apply -})) - -import { openExistingStructuredSession } from './open-existing-structured-session' -import { - activateAiVaultStructuredSession, - openDesktopStructuredSession -} from './activate-ai-vault-structured-session' - -const TARGET = { kind: 'environment', environmentId: 'remote-2' } as const -function tab(id: string, host: 'local' | 'runtime:remote-2'): Tab { - return { - id, - worktreeId: 'workspace', - entityId: 'sender', - executionHostId: host, - groupId: 'group', - contentType: 'agent-session', - label: 'Claude Chat', - customLabel: null, - color: null, - sortOrder: 0, - createdAt: 0 - } -} -beforeEach(() => { - vi.clearAllMocks() - mocks.state.activeWorktreeId = 'workspace' - mocks.moved.mockReturnValue(false) - mocks.state.unifiedTabsByWorktree = { workspace: [tab('wrong-local', 'local')] } - mocks.supports.mockResolvedValue(true) - mocks.call.mockImplementation(async (_host, method: string) => { - if (method === 'orchestration.partyLocation') { - return { location: { kind: 'chat', sessionId: 'sender', worktreeId: 'workspace' } } - } - if (method === 'agentSession.reveal') { - // The paired mirror, rather than the local snapshot apply, publishes the revealed tab. - mocks.state.unifiedTabsByWorktree.workspace.push(tab('right-remote', 'runtime:remote-2')) - } - return { ok: true, sessionId: 'sender', workspaceId: 'workspace', agent: 'claude' } - }) -}) - -it('bounds a missing local History lookup and releases coalescing for a legitimate retry', async () => { - vi.useFakeTimers() - try { - mocks.state.unifiedTabsByWorktree = {} - mocks.call.mockImplementation(async (_host, method) => - method === 'orchestration.partyLocation' ? new Promise(() => {}) : { ok: true } - ) - const session = { structuredSession: { sessionId: 'missing', workspaceId: 'workspace' } } - const first = activateAiVaultStructuredSession(session, undefined, { kind: 'local' }) - const second = activateAiVaultStructuredSession(session, undefined, { kind: 'local' }) - await vi.advanceTimersByTimeAsync(5001) - await Promise.all([first, second]) - expect( - mocks.call.mock.calls.filter((call) => call[1] === 'orchestration.partyLocation') - ).toHaveLength(1) - const retry = activateAiVaultStructuredSession(session, undefined, { kind: 'local' }) - await vi.advanceTimersByTimeAsync(5001) - await retry - expect( - mocks.call.mock.calls.filter((call) => call[1] === 'orchestration.partyLocation') - ).toHaveLength(2) - } finally { - vi.useRealTimers() - } -}) - -it('derives the implicit owner and refuses the equal-ID other-owner decoy', async () => { - mocks.state.unifiedTabsByWorktree.workspace.unshift(tab('wrong-remote', 'runtime:remote-2')) - const pointer = { structuredSession: { workspaceId: 'workspace', sessionId: 'sender' } } - expect(await activateAiVaultStructuredSession(pointer)).toBe(true) - expect(mocks.activateTab).toHaveBeenCalledExactlyOnceWith('wrong-local', { - worktreeId: 'workspace' - }) - expect(mocks.supports).not.toHaveBeenCalled() - mocks.activateTab.mockClear() - await activateAiVaultStructuredSession(pointer, undefined, TARGET) - expect(mocks.activateTab).toHaveBeenCalledExactlyOnceWith('wrong-remote', { - worktreeId: 'workspace' - }) -}) - -it.each(['initialize', 'activate'] as const)( - 'admits before synchronous %s re-entry', - async (boundary) => { - const pointer = { workspaceId: 'workspace', sessionId: 'sync' } - const joined: Promise[] = [] - const joiningInitialize = vi.fn(() => true) - const joiningPresent = vi.fn() - const reenter = () => - joined.push( - openExistingStructuredSession(pointer, { - target: TARGET, - initialize: joiningInitialize, - present: joiningPresent - }) - ) - const parts = { - tabs: () => [{ id: 'sync-tab', sessionId: pointer.sessionId }], - activate: vi.fn(() => { - if (boundary === 'activate') { - reenter() - } - return true - }), - refresh: vi.fn(async () => undefined), - reveal: vi.fn(async () => 'gone' as const) - } - const present = vi.fn() - expect( - await openExistingStructuredSession(pointer, { - target: TARGET, - deps: parts, - present, - initialize: () => { - if (boundary === 'initialize') { - reenter() - } - return true - } - }) - ).toBe('activated') - expect(await Promise.all(joined)).toEqual(['activated']) - expect(parts.activate).toHaveBeenCalledOnce() - expect(present).toHaveBeenCalledOnce() - expect(joiningInitialize).not.toHaveBeenCalled() - expect(joiningPresent).not.toHaveBeenCalled() - } -) - -it('keeps indirect continuation discovery independent from direct exact selection', async () => { - mocks.state.unifiedTabsByWorktree.workspace.push(tab('direct', 'runtime:remote-2')) - const successor = tab('successor-issued', 'runtime:remote-2') - successor.entityId = 'successor' - successor.agentSessionAgent = 'codex' - mocks.state.unifiedTabsByWorktree.workspace.push(successor) - const located = Promise.withResolvers<{ - location: { kind: 'chat'; sessionId: string; worktreeId: string } - }>() - const locate = vi.fn(() => located.promise) - const indirect = openDesktopStructuredSession( - { kind: 'notification', worktreeId: 'workspace', sessionId: 'sender' }, - TARGET, - undefined, - locate - ) - const direct = activateAiVaultStructuredSession( - { structuredSession: { workspaceId: 'workspace', sessionId: 'sender' } }, - undefined, - TARGET - ) - expect(await direct).toBe(true) - expect(mocks.activateTab).toHaveBeenCalledExactlyOnceWith('direct', { worktreeId: 'workspace' }) - located.resolve({ location: { kind: 'chat', sessionId: 'successor', worktreeId: 'workspace' } }) - expect(await indirect).toEqual({ - kind: 'opened', - target: { sessionId: 'successor', worktreeId: 'workspace', agent: 'codex' }, - tab: { id: 'successor-issued', sessionId: 'successor', agent: 'codex' } - }) - expect(locate).toHaveBeenCalledOnce() - expect(mocks.activateTab).toHaveBeenLastCalledWith('successor-issued', { - worktreeId: 'workspace' - }) - expect( - mocks.call.mock.calls.filter(([, method]) => method === 'agentSession.reveal') - ).toHaveLength(0) -}) diff --git a/src/renderer/src/lib/activate-ai-vault-structured-session-reveal.test.ts b/src/renderer/src/lib/activate-ai-vault-structured-session-reveal.test.ts deleted file mode 100644 index f640f70b1b3..00000000000 --- a/src/renderer/src/lib/activate-ai-vault-structured-session-reveal.test.ts +++ /dev/null @@ -1,122 +0,0 @@ -/** Negotiate reveal against the workspace’s answering host; local build capabilities say nothing about a paired host’s version. */ - -import { beforeEach, describe, expect, it, vi } from 'vitest' - -const mocks = vi.hoisted(() => ({ - call: vi.fn(), - supports: vi.fn(), - environmentIdFor: vi.fn() -})) - -// The real target resolution is the thing under test; only the transport is stubbed. -vi.mock('@/runtime/rpc/calls/runtime-rpc-call', () => ({ - callRuntimeRpc: mocks.call -})) -vi.mock('@/runtime/rpc/compatibility/runtime-capability-proof', () => ({ - runtimeEnvironmentSupportsCapability: mocks.supports -})) - -vi.mock('./workspace/ownership/worktree-runtime-owner', () => ({ - runtimeEnvironmentIdOrLocalUnlessTwin: mocks.environmentIdFor -})) - -import { - activateAiVaultStructuredSession, - revealStructuredSession -} from './activate-ai-vault-structured-session' -import { STRUCTURED_AGENT_SESSION_REVEAL_RUNTIME_CAPABILITY } from '../../../shared/agent-session/structured-agent-session-surface-capabilities' - -const target = { worktreeId: 'workspace-1', sessionId: 'session-1' } - -beforeEach(() => { - vi.clearAllMocks() - mocks.call.mockResolvedValue({ - ok: true, - sessionId: target.sessionId, - workspaceId: target.worktreeId, - agent: 'codex' - }) - mocks.supports.mockResolvedValue(true) - mocks.environmentIdFor.mockReturnValue(null) -}) - -describe('revealStructuredSession', () => { - it('keeps a known recipient target when the active workspace would resolve locally', async () => { - const host = { kind: 'environment', environmentId: 'recipient-host' } as const - await expect(revealStructuredSession({ ...target, target: host })).resolves.toEqual({ - ...target, - agent: 'codex' - }) - expect(mocks.supports).toHaveBeenCalledWith( - 'recipient-host', - STRUCTURED_AGENT_SESSION_REVEAL_RUNTIME_CAPABILITY, - expect.any(Number) - ) - expect(mocks.call).toHaveBeenCalledWith( - host, - 'agentSession.reveal', - { sessionId: 'session-1' }, - expect.any(Object) - ) - }) - - it('reports a paired host that cannot open it rather than sending an unknown method', async () => { - // An old host’s method_not_found must request an update rather than claim the chat is gone. - mocks.environmentIdFor.mockReturnValue('legacy-env') - mocks.supports.mockResolvedValue(false) - - await expect(revealStructuredSession(target)).resolves.toBe('host-cannot-open') - - expect(mocks.call).not.toHaveBeenCalled() - }) -}) - -it('returns the actual revealed identity/workspace/provider for reconciliation', async () => { - mocks.call.mockResolvedValue({ - ok: true, - sessionId: 'successor', - workspaceId: 'actual-owner', - agent: 'claude' - }) - expect(await revealStructuredSession(target)).toEqual({ - sessionId: 'successor', - worktreeId: 'actual-owner', - agent: 'claude' - }) -}) - -it('bounds a cached stalled probe, releases the shared click and permits a subsequent explicit retry', async () => { - vi.useFakeTimers() - const host = { kind: 'environment', environmentId: 'cached-stalled' } as const - const cached = new Promise(() => {}) - mocks.supports.mockReturnValue(cached) - mocks.call.mockImplementation(async () => ({ - location: { kind: 'chat', sessionId: target.sessionId, worktreeId: target.worktreeId } - })) - const parts = { - tabs: () => [], - activate: vi.fn(() => false), - refresh: vi.fn(async () => undefined), - reveal: revealStructuredSession, - unavailable: vi.fn(), - gone: vi.fn(), - hostCannotOpen: vi.fn() - } - const session = { - structuredSession: { workspaceId: target.worktreeId, sessionId: target.sessionId } - } - try { - const click = activateAiVaultStructuredSession(session, parts, host) - await vi.advanceTimersByTimeAsync(5_001) - expect(await click).toBe(true) - expect(parts.unavailable).toHaveBeenCalledOnce() - expect(mocks.call.mock.calls.map(([, method]) => method)).toEqual([ - 'orchestration.partyLocation' - ]) - mocks.supports.mockResolvedValue(false) - expect(await activateAiVaultStructuredSession(session, parts, host)).toBe(true) - expect(parts.hostCannotOpen).toHaveBeenCalledOnce() - } finally { - vi.useRealTimers() - } -}) diff --git a/src/renderer/src/lib/agent-session/accounts/agent-account-restart-startup.test.ts b/src/renderer/src/lib/agent-session/accounts/agent-account-restart-startup.test.ts index 4f163da4f5a..cc1c5ed36d5 100644 --- a/src/renderer/src/lib/agent-session/accounts/agent-account-restart-startup.test.ts +++ b/src/renderer/src/lib/agent-session/accounts/agent-account-restart-startup.test.ts @@ -1,24 +1,22 @@ import { beforeEach, describe, expect, it, vi } from 'vitest' -import type { AgentStatusEntry } from '../../../../../shared/agent-status/contracts/agent-status-types' import { useAppStore } from '@/store/index' import { makePaneKey } from '../../../../../shared/workspace-layout/stable-pane-id' import { getDefaultSettings } from '../../../../../shared/constants' -import type { ProjectExecutionRuntimeResolution } from '../../../../../shared/execution-host/project-execution-runtime' -import type * as localPreflightContext from '@/lib/local-preflight-context' import { resolveAgentResumeLaunchTarget } from '@/lib/agent-session/resume/agent-resume-launch-target' import { makeTerminalTab } from '@/store/terminals/terminal-row.test-fixture' import { makeWorktree } from '@/store/slices/worktrees/worktree.test-fixture' import { TEST_REPO } from '@/store/repos/repo.test-fixture' -import { - buildPaneAccountRestartStartup, - type AgentAccountRestartStartup -} from './agent-account-restart-startup' +import { buildPaneAccountRestartStartup } from './agent-account-restart-startup' +import type { AgentAccountRestartStartup } from './agent-account-restart-startup' +import type { AgentStatusEntry } from '../../../../../shared/agent-status/contracts/agent-status-types' +import type { ProjectExecutionRuntimeResolution } from '../../../../../shared/execution-host/project-execution-runtime' +import type * as localPreflightContext from '@/runtime/hosts/preflight/local-preflight-context' let projectRuntimeContext: ProjectExecutionRuntimeResolution | undefined vi.mock('@/lib/agent-session/resume/agent-resume-launch-target', { spy: true }) -vi.mock('@/lib/local-preflight-context', async (importOriginal) => ({ +vi.mock('@/runtime/hosts/preflight/local-preflight-context', async (importOriginal) => ({ ...(await importOriginal()), getLocalProjectExecutionRuntimeContext: () => projectRuntimeContext })) diff --git a/src/renderer/src/lib/agent-session/accounts/agent-account-restart-startup.ts b/src/renderer/src/lib/agent-session/accounts/agent-account-restart-startup.ts index 07d4ae894b7..3ade2d2e779 100644 --- a/src/renderer/src/lib/agent-session/accounts/agent-account-restart-startup.ts +++ b/src/renderer/src/lib/agent-session/accounts/agent-account-restart-startup.ts @@ -1,30 +1,30 @@ import { getConnectionIdFromState } from '@/lib/workspace/ownership/connection-owner-resolution' import { useAppStore } from '@/store/index' -import type { AppState } from '@/store/types' import { buildAgentResumeStartupPlan } from '../../../../../shared/agent-launch/startup/tui-agent-resume-startup' import { resolveRuntimeHostReportedPlatform, resolveRuntimeHostTerminalWindowsShell, resolveSshHostReportedPlatform, - resolveAgentResumeLaunchTarget, - type AgentResumeLaunchTarget + resolveAgentResumeLaunchTarget } from '@/lib/agent-session/resume/agent-resume-launch-target' +import type { AgentResumeLaunchTarget } from '@/lib/agent-session/resume/agent-resume-launch-target' import { getExecutionHostIdForWorktree } from '@/lib/workspace/ownership/worktree-runtime-owner' import { runtimeEnvironmentIdUnlessTwin } from '@/lib/workspace/ownership/resolve-owner' -import { getLocalProjectExecutionRuntimeContext } from '@/lib/local-preflight-context' +import { getLocalProjectExecutionRuntimeContext } from '@/runtime/hosts/preflight/local-preflight-context' import { repoMatchesHostIdentity } from '@/store/repos/repo-host-identity' import { isSessionHeldByAnotherPane } from '@/lib/agent-session/identity/claude-session-pane-holders' import { makePaneKey } from '../../../../../shared/workspace-layout/stable-pane-id' -import { - normalizeAgentProviderSession, - type AgentProviderSessionMetadata, - type SleepingAgentLaunchConfig +import { normalizeAgentProviderSession } from '../../../../../shared/agent-session/lifecycle/agent-session-resume' +import type { + AgentProviderSessionMetadata, + SleepingAgentLaunchConfig } from '../../../../../shared/agent-session/lifecycle/agent-session-resume' import { resolveResumeLaunchRecipe } from '../../../../../shared/agent-launch/choices/resume-launch-recipe' -import type { AccountRestartAgent } from '@/store/terminals/terminal-contracts' -import type { ProjectExecutionRuntimeResolution } from '../../../../../shared/execution-host/project-execution-runtime' import { resolveAgentLaunchCommand } from '../../../../../shared/agent-launch/startup/tui-agent-launch-command' import { resolveStartupShell } from '../../../../../shared/agent-launch/startup/tui-agent-startup-shell' +import type { AppState } from '@/store/types' +import type { AccountRestartAgent } from '@/store/terminals/terminal-contracts' +import type { ProjectExecutionRuntimeResolution } from '../../../../../shared/execution-host/project-execution-runtime' export type AgentAccountRestartStartup = { command: string diff --git a/src/renderer/src/lib/agent-session/accounts/claude/claude-session-account-move.test.ts b/src/renderer/src/lib/agent-session/accounts/claude/claude-session-account-move.test.ts index d5373f10d71..0fd54873569 100644 --- a/src/renderer/src/lib/agent-session/accounts/claude/claude-session-account-move.test.ts +++ b/src/renderer/src/lib/agent-session/accounts/claude/claude-session-account-move.test.ts @@ -1,13 +1,7 @@ import { beforeEach, describe, expect, it, vi } from 'vitest' import { useAppStore } from '@/store/index' -import type { AgentStatusEntry } from '../../../../../../shared/agent-status/contracts/agent-status-types' import { makePaneKey } from '../../../../../../shared/workspace-layout/stable-pane-id' -import type { TerminalTab } from '../../../../../../shared/workspace-layout/terminal-tab-types' -import type { ClaudeManagedAccount } from '../../../../../../shared/managed-account-types' -import type { ProjectExecutionRuntimeResolution } from '../../../../../../shared/execution-host/project-execution-runtime' import { getDefaultSettings } from '../../../../../../shared/constants' -import type * as localPreflightContext from '@/lib/local-preflight-context' -import type * as paneSelectionLane from '../../../codex-pane-selection-lane' import { confirmRuntimeTerminalForegroundProcess, inspectRuntimeTerminalProcess @@ -16,6 +10,12 @@ import { findClaudeSwitchSessions, findQueuedClaudeRestartsOnAccount } from './claude-session-account-move' +import type { AgentStatusEntry } from '../../../../../../shared/agent-status/contracts/agent-status-types' +import type { TerminalTab } from '../../../../../../shared/workspace-layout/terminal-tab-types' +import type { ClaudeManagedAccount } from '../../../../../../shared/managed-account-types' +import type { ProjectExecutionRuntimeResolution } from '../../../../../../shared/execution-host/project-execution-runtime' +import type * as localPreflightContext from '@/runtime/hosts/preflight/local-preflight-context' +import type * as paneSelectionLane from '../codex-pane-selection-lane' import type { ClaudeHostFolders } from './claude-pane-account-folder' const laneByPtyId: Record = {} @@ -28,11 +28,11 @@ vi.mock('@/runtime/hosted-terminals/inspection/runtime-terminal-process-inspecti vi.mock('../../../../app-shell/platform/renderer-app-platform', () => ({ getRendererAppPlatform: () => 'win32' })) -vi.mock('@/lib/local-preflight-context', async (importOriginal) => ({ +vi.mock('@/runtime/hosts/preflight/local-preflight-context', async (importOriginal) => ({ ...(await importOriginal()), getLocalProjectExecutionRuntimeContext: () => projectRuntime })) -vi.mock('../../../codex-pane-selection-lane', async (importOriginal) => ({ +vi.mock('../codex-pane-selection-lane', async (importOriginal) => ({ ...(await importOriginal()), resolveCodexPaneSelectionLane: ({ ptyId }: { ptyId: string }) => ({ laneKey: laneByPtyId[ptyId] ?? 'host', diff --git a/src/renderer/src/lib/agent-session/accounts/claude/claude-session-account-move.ts b/src/renderer/src/lib/agent-session/accounts/claude/claude-session-account-move.ts index da1a04cecd7..6077967ee0b 100644 --- a/src/renderer/src/lib/agent-session/accounts/claude/claude-session-account-move.ts +++ b/src/renderer/src/lib/agent-session/accounts/claude/claude-session-account-move.ts @@ -2,12 +2,10 @@ /** Find sessions affected by account selection; resume preserves the session while launch reads the newly selected account folder. */ import { useAppStore } from '@/store/index' -import type { AppState } from '@/store/types' import { confirmRuntimeTerminalForegroundProcess, inspectRuntimeTerminalProcess } from '@/runtime/hosted-terminals/inspection/runtime-terminal-process-inspection' - import { isAgentForegroundWrapperProcess, recognizeAgentProcess @@ -17,35 +15,31 @@ import { isTerminalLeafId, makePaneKey } from '../../../../../../shared/workspace-layout/stable-pane-id' -import { - type TerminalProcessInspection as RuntimeTerminalProcessInspection, - isClientOnlyUnverifiableInspection -} from '../../../../../../shared/terminal/pty/lifecycle/terminal-process-inspection' +import { isClientOnlyUnverifiableInspection } from '../../../../../../shared/terminal/pty/lifecycle/terminal-process-inspection' +import type { TerminalProcessInspection as RuntimeTerminalProcessInspection } from '../../../../../../shared/terminal/pty/lifecycle/terminal-process-inspection' import { getCodexSelectionLaneKey, - normalizeCodexAccountSelectionTarget, - type CodexAccountSelectionTarget + normalizeCodexAccountSelectionTarget } from '../../../../../../shared/codex-selection-lane' +import type { CodexAccountSelectionTarget } from '../../../../../../shared/codex-selection-lane' +import { resolvePaneAgentSessionId } from '@/lib/agent-session/identity/pane-agent-session-id' +import { resolveAgentAccountRestartResumeStartup } from '../agent-account-restart-startup' +import { isSessionHeldByAnotherPane } from '../../identity/claude-session-pane-holders' +import { isClaudePaneOnAccount, resolveClaudePaneFolder } from './claude-pane-account-folder' +import type { ClaudeHostFolders } from './claude-pane-account-folder' +import { + getCodexAccountSwitchLaneMatcher, + isForeignMachineCodexPtyId, + isLocalCodexSelectionLaneKey, + resolveCodexPaneSelectionLane +} from '../codex-pane-selection-lane' +import type { AppState } from '@/store/types' import type { RuntimeClientTarget } from '../../../../../../shared/runtime-client-target' import type { ClaudeManagedAccount, ClaudeRateLimitAccountsState } from '../../../../../../shared/managed-account-types' import type { TerminalTab } from '../../../../../../shared/workspace-layout/terminal-tab-types' -import { resolvePaneAgentSessionId } from '@/lib/agent-session/identity/pane-agent-session-id' -import { resolveAgentAccountRestartResumeStartup } from '../agent-account-restart-startup' -import { isSessionHeldByAnotherPane } from '../../identity/claude-session-pane-holders' -import { - isClaudePaneOnAccount, - resolveClaudePaneFolder, - type ClaudeHostFolders -} from './claude-pane-account-folder' -import { - getCodexAccountSwitchLaneMatcher, - isForeignMachineCodexPtyId, - isLocalCodexSelectionLaneKey, - resolveCodexPaneSelectionLane -} from '../../../codex-pane-selection-lane' export type ClaudeSessionMoveCandidate = { ptyId: string diff --git a/src/renderer/src/lib/codex-pane-selection-lane.test.ts b/src/renderer/src/lib/agent-session/accounts/codex-pane-selection-lane.test.ts similarity index 100% rename from src/renderer/src/lib/codex-pane-selection-lane.test.ts rename to src/renderer/src/lib/agent-session/accounts/codex-pane-selection-lane.test.ts index ebb32d5b9c3..457e32a4f4c 100644 --- a/src/renderer/src/lib/codex-pane-selection-lane.test.ts +++ b/src/renderer/src/lib/agent-session/accounts/codex-pane-selection-lane.test.ts @@ -1,10 +1,10 @@ import { describe, expect, it } from 'vitest' -import type { AppState } from '@/store/types' import { getCodexAccountSwitchLaneMatcher, resolveCodexPaneSelectionLane, resolveCodexPaneSelectionLaneKey } from './codex-pane-selection-lane' +import type { AppState } from '@/store/types' type LaneState = Pick< AppState, diff --git a/src/renderer/src/lib/codex-pane-selection-lane.ts b/src/renderer/src/lib/agent-session/accounts/codex-pane-selection-lane.ts similarity index 86% rename from src/renderer/src/lib/codex-pane-selection-lane.ts rename to src/renderer/src/lib/agent-session/accounts/codex-pane-selection-lane.ts index cf2c173b2b5..08752277052 100644 --- a/src/renderer/src/lib/codex-pane-selection-lane.ts +++ b/src/renderer/src/lib/agent-session/accounts/codex-pane-selection-lane.ts @@ -1,33 +1,33 @@ -import type { AppState } from '@/store/types' -import type { RuntimeClientTarget } from '../../../shared/runtime-client-target' -import { parseRemoteRuntimePtyId } from '../../../shared/remote-runtime/remote-runtime-pty-id' +import { parseRemoteRuntimePtyId } from '../../../../../shared/remote-runtime/remote-runtime-pty-id' import { getCodexSelectionLaneKey, - normalizeCodexAccountSelectionTarget, - type CodexAccountSelectionTarget -} from '../../../shared/codex-selection-lane' -import { FLOATING_TERMINAL_WORKTREE_ID } from '../../../shared/constants' + normalizeCodexAccountSelectionTarget +} from '../../../../../shared/codex-selection-lane' +import type { CodexAccountSelectionTarget } from '../../../../../shared/codex-selection-lane' +import { FLOATING_TERMINAL_WORKTREE_ID } from '../../../../../shared/constants' import { isWslShellName, - resolveLocalWindowsTerminalRuntimeOptions, - type LocalWindowsTerminalRuntimeOptions -} from '../../../shared/local-windows-terminal-runtime' -import { parseAppSshPtyId } from '../../../shared/ssh-pty-id' -import { resolveTerminalStartupCwd } from '../../../shared/shell/launch/terminal-startup-cwd' -import type { TerminalTab } from '../../../shared/workspace-layout/terminal-tab-types' -import { parseWorkspaceKey } from '../../../shared/workspace-scope' -import { parseWslUncPath } from '../../../shared/wsl-paths' -import { getLocalProjectExecutionRuntimeContext } from './local-preflight-context' -import { getRendererAppPlatform } from '../app-shell/platform/renderer-app-platform' -import { wslHostDistroForTarget } from '../runtime/provider-accounts/ownership/wsl-host-account-owner' + resolveLocalWindowsTerminalRuntimeOptions +} from '../../../../../shared/local-windows-terminal-runtime' +import type { LocalWindowsTerminalRuntimeOptions } from '../../../../../shared/local-windows-terminal-runtime' +import { parseAppSshPtyId } from '../../../../../shared/ssh-pty-id' +import { resolveTerminalStartupCwd } from '../../../../../shared/shell/launch/terminal-startup-cwd' +import { parseWorkspaceKey } from '../../../../../shared/workspace-scope' +import { parseWslUncPath } from '../../../../../shared/wsl-paths' +import { getLocalProjectExecutionRuntimeContext } from '../../../runtime/hosts/preflight/local-preflight-context' +import { getRendererAppPlatform } from '../../../app-shell/platform/renderer-app-platform' +import { wslHostDistroForTarget } from '../../../runtime/provider-accounts/ownership/wsl-host-account-owner' import { getCachedWindowsTerminalCapabilities, hasCachedWindowsTerminalCapabilities -} from '../runtime/hosts/capabilities/windows-terminal-capabilities' +} from '../../../runtime/hosts/capabilities/windows-terminal-capabilities' import { selectFolderWorkspaces, selectWorktreesByRepo } from '@/store/workspaces/catalog/workspace-record-fields' +import type { AppState } from '@/store/types' +import type { RuntimeClientTarget } from '../../../../../shared/runtime-client-target' +import type { TerminalTab } from '../../../../../shared/workspace-layout/terminal-tab-types' type CodexPaneLaneState = Pick< AppState, diff --git a/src/renderer/src/lib/agent-session/accounts/codex/codex-session-restart.ts b/src/renderer/src/lib/agent-session/accounts/codex/codex-session-restart.ts index a06fdfbb48b..c7bec73a456 100644 --- a/src/renderer/src/lib/agent-session/accounts/codex/codex-session-restart.ts +++ b/src/renderer/src/lib/agent-session/accounts/codex/codex-session-restart.ts @@ -1,10 +1,8 @@ -import type { AppState } from '@/store/types' import { useAppStore } from '@/store/index' import { confirmRuntimeTerminalForegroundProcess, inspectRuntimeTerminalProcess } from '@/runtime/hosted-terminals/inspection/runtime-terminal-process-inspection' - import { translate } from '@/i18n/i18n' import { getCodexAccountDisplayLabel, @@ -15,16 +13,15 @@ import { isCodexForegroundProcess, isCodexRestartEligiblePane } from './codex-pane-restart-eligibility' -import { - type TerminalProcessInspection as RuntimeTerminalProcessInspection, - isClientOnlyUnverifiableInspection -} from '../../../../../../shared/terminal/pty/lifecycle/terminal-process-inspection' +import { isClientOnlyUnverifiableInspection } from '../../../../../../shared/terminal/pty/lifecycle/terminal-process-inspection' +import type { TerminalProcessInspection as RuntimeTerminalProcessInspection } from '../../../../../../shared/terminal/pty/lifecycle/terminal-process-inspection' import { getCodexAccountSwitchLaneMatcher, isForeignMachineCodexPtyId, isLocalCodexSelectionLaneKey, resolveCodexPaneSelectionLane -} from '../../../codex-pane-selection-lane' +} from '../codex-pane-selection-lane' +import type { AppState } from '@/store/types' import type { CodexAccountSelectionTarget } from '../../../../../../shared/codex-selection-lane' import type { RuntimeClientTarget } from '../../../../../../shared/runtime-client-target' import type { TuiAgent } from '../../../../../../shared/agent-launch/catalog/tui-agent' diff --git a/src/renderer/src/lib/codex-stale-pane-account-identity.test.ts b/src/renderer/src/lib/agent-session/accounts/codex/codex-stale-pane-account-identity.test.ts similarity index 76% rename from src/renderer/src/lib/codex-stale-pane-account-identity.test.ts rename to src/renderer/src/lib/agent-session/accounts/codex/codex-stale-pane-account-identity.test.ts index 08d6bff31f6..de9fd19d453 100644 --- a/src/renderer/src/lib/codex-stale-pane-account-identity.test.ts +++ b/src/renderer/src/lib/agent-session/accounts/codex/codex-stale-pane-account-identity.test.ts @@ -1,7 +1,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' -import { useAppStore } from '@/store' -import { clearRuntimeCompatibilityCache as clearRuntimeCompatibilityCacheForTests } from '@/runtime/rpc/compatibility/runtime-compatibility-cache' -import { markRestoredStaleCodexSessionsForRestart } from './agent-session/accounts/codex/codex-session-restart' +import { useAppStore } from '@/store/index' +import { clearRuntimeCompatibilityCache } from '@/runtime/rpc/compatibility/runtime-compatibility-cache' +import { markRestoredStaleCodexSessionsForRestart } from './codex-session-restart' // One login can produce separate ChatGPT-workspace accounts with the same email label. const SHARED_EMAIL = 'shared@example.com' @@ -23,7 +23,7 @@ describe('stale Codex panes are decided by account id, not label', () => { const originalWindow = (globalThis as { window?: typeof window }).window beforeEach(() => { - clearRuntimeCompatibilityCacheForTests() + clearRuntimeCompatibilityCache() useAppStore.setState({ settings: null as never, tabsByWorktree: { @@ -78,22 +78,6 @@ describe('stale Codex panes are decided by account id, not label', () => { } }) - it('distinguishes same-email accounts even without workspace names', async () => { - vi.mocked(window.api.codexAccounts.listStalePanes).mockResolvedValue([ - { ptyId: 'pty-1', launchAccountId: 'account-a', activeAccountId: 'account-b' } - ]) - - const scans = await markRestoredStaleCodexSessionsForRestart() - - expect(noticeFor('pty-1')).toMatchObject({ - previousAccountLabel: `${SHARED_EMAIL} (account-a)`, - nextAccountLabel: `${SHARED_EMAIL} (account-b)`, - previousAccountId: 'account-a', - nextAccountId: 'account-b' - }) - expect(scans.find((scan) => scan.ptyId === 'pty-1')?.notified).toBe(true) - }) - it('does not report notified for a pane whose notice the store dropped', async () => { // The existing notice remembers account-b as launch account, so re-marking against active account-b collapses it. useAppStore.setState({ diff --git a/src/renderer/src/lib/codex-stale-pane-sweep.test.ts b/src/renderer/src/lib/agent-session/accounts/codex/codex-stale-pane-sweep.test.ts similarity index 86% rename from src/renderer/src/lib/codex-stale-pane-sweep.test.ts rename to src/renderer/src/lib/agent-session/accounts/codex/codex-stale-pane-sweep.test.ts index e57730bdf7f..e54d59f5d3a 100644 --- a/src/renderer/src/lib/codex-stale-pane-sweep.test.ts +++ b/src/renderer/src/lib/agent-session/accounts/codex/codex-stale-pane-sweep.test.ts @@ -1,9 +1,9 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' -import { useAppStore } from '@/store' +import { useAppStore } from '@/store/index' import { notifyCodexPaneBoundForStaleSweep, resetCodexStalePaneSweepForTests -} from './agent-session/accounts/codex/codex-stale-pane-sweep' +} from './codex-stale-pane-sweep' const ACCOUNT_A = 'account-a@example.com' const ACCOUNT_B = 'account-b@example.com' @@ -14,10 +14,6 @@ const STALE_PANE = { activeAccountId: 'account-b' } -function inspectCallCountFor(ptyId: string): number { - return vi.mocked(window.api.pty.inspectProcess).mock.calls.filter(([id]) => id === ptyId).length -} - describe('notifyCodexPaneBoundForStaleSweep', () => { const originalWindow = (globalThis as { window?: typeof window }).window @@ -199,24 +195,4 @@ describe('notifyCodexPaneBoundForStaleSweep', () => { nextAccountId: 'account-b' }) }) - - it('still sweeps the local panes bound alongside a remote one', async () => { - useAppStore.setState({ ptyIdsByTabId: { 'tab-1': ['pty-1', 'remote:env-1@@term-1'] } }) - vi.mocked(window.api.codexAccounts.listStalePanes).mockResolvedValue([STALE_PANE]) - - notifyCodexPaneBoundForStaleSweep('remote:env-1@@term-1') - notifyCodexPaneBoundForStaleSweep('pty-1') - await vi.advanceTimersByTimeAsync(300) - - expect(window.api.codexAccounts.listStalePanes).toHaveBeenCalledExactlyOnceWith({ - ptyIds: ['pty-1'] - }) - expect(inspectCallCountFor('remote:env-1@@term-1')).toBe(0) - expect(useAppStore.getState().codexRestartNoticeByPtyId['pty-1']).toEqual({ - previousAccountLabel: ACCOUNT_A, - nextAccountLabel: ACCOUNT_B, - previousAccountId: 'account-a', - nextAccountId: 'account-b' - }) - }) }) diff --git a/src/renderer/src/lib/agent-session/accounts/codex/codex-stale-pane-sweep.ts b/src/renderer/src/lib/agent-session/accounts/codex/codex-stale-pane-sweep.ts index f75695e6c9f..21679aa8991 100644 --- a/src/renderer/src/lib/agent-session/accounts/codex/codex-stale-pane-sweep.ts +++ b/src/renderer/src/lib/agent-session/accounts/codex/codex-stale-pane-sweep.ts @@ -1,8 +1,6 @@ -import { - markRestoredStaleCodexSessionsForRestart, - type CodexPaneScanResult -} from './codex-session-restart' -import { isForeignMachineCodexPtyId } from '../../../codex-pane-selection-lane' +import { markRestoredStaleCodexSessionsForRestart } from './codex-session-restart' +import type { CodexPaneScanResult } from './codex-session-restart' +import { isForeignMachineCodexPtyId } from '../codex-pane-selection-lane' // Coalesce startup binds, then retry reattach beyond the measured 5.8s Windows tail; keep retries bounded so unresolved panes cannot become polling loops. const SWEEP_ATTEMPT_DELAYS_MS = [300, 1500, 4000, 10_000, 20_000] as const diff --git a/src/renderer/src/lib/agent-session/hibernation/agent-hibernation-coordinator.ts b/src/renderer/src/lib/agent-session/hibernation/agent-hibernation-coordinator.ts index 106dac947b6..caa584ae727 100644 --- a/src/renderer/src/lib/agent-session/hibernation/agent-hibernation-coordinator.ts +++ b/src/renderer/src/lib/agent-session/hibernation/agent-hibernation-coordinator.ts @@ -4,12 +4,8 @@ import { planAgentHibernationCandidates } from './agent-hibernation-planner' import type { AgentHibernationCandidate } from './agent-hibernation-planner' -import type { AgentHibernationPlannerSnapshot } from './agent-hibernation-planner-snapshot' -import { - confirmAgentHibernationCandidates, - type AgentHibernationConfirmationState -} from './agent-hibernation-confirmation' -import type { AppState } from '@/store/types' +import { confirmAgentHibernationCandidates } from './agent-hibernation-confirmation' +import type { AgentHibernationConfirmationState } from './agent-hibernation-confirmation' import { getAllDrivers } from '../../pane-manager/mobile-driver-state' import { getForegroundTerminalTabIds, @@ -21,17 +17,19 @@ import { getHibernationPtyBindingFirstSeenAtByPaneKey, observeHibernationPtyBindings } from './agent-hibernation-pane-age' -import { mergePendingTerminalInputActivity } from '../../terminal-input-activity-coalescing' +import { mergePendingTerminalInputActivity } from '../../terminal/input/terminal-input-activity-coalescing' import { collectHostPtyEvidence, getRuntimeLivenessTargetWorktrees, - resolveAgentHibernationRuntimeOwner, - type HostPtyEvidence + resolveAgentHibernationRuntimeOwner } from './agent-hibernation-host-evidence' +import type { HostPtyEvidence } from './agent-hibernation-host-evidence' import { getWindowParkVisible, subscribeWindowParkVisibility } from '../../window-activity/window-park-visibility' +import type { AgentHibernationPlannerSnapshot } from './agent-hibernation-planner-snapshot' +import type { AppState } from '@/store/types' export const AGENT_HIBERNATION_TICK_MS = 60 * 1000 diff --git a/src/renderer/src/lib/agent-session/launch/continuation/structured-agent-launch-settlement.ts b/src/renderer/src/lib/agent-session/launch/continuation/structured-agent-launch-settlement.ts index c553734b199..913e6131050 100644 --- a/src/renderer/src/lib/agent-session/launch/continuation/structured-agent-launch-settlement.ts +++ b/src/renderer/src/lib/agent-session/launch/continuation/structured-agent-launch-settlement.ts @@ -1,19 +1,19 @@ -import type { TuiAgent } from '../../../../../../shared/agent-launch/catalog/tui-agent' -import type { ExecutionHostId } from '../../../../../../shared/execution-host' -import '@/lib/launch-structured-agent-session' -import { StructuredAgentSessionCreateRefusalError } from '@/lib/agent-session/launch/structured-agent-session-launch-errors' +import '@/lib/agent-session/launch/structured-agent-session-launch-intent' +import { + StructuredAgentSessionCreateRefusalError, + StructuredAgentSessionCreateAbandonedError +} from '@/lib/agent-session/launch/structured-agent-session-launch-errors' +import type { StructuredAgentSessionCreateGate } from '@/lib/agent-session/launch/structured-agent-session-launch-errors' import { cancelStructuredAgentLaunch, startStructuredAgentLaunch } from '@/lib/agent-session/launch/structured-agent-session-launch' +import type { TuiAgent } from '../../../../../../shared/agent-launch/catalog/tui-agent' +import type { ExecutionHostId } from '../../../../../../shared/execution-host' import type { StructuredAgentLaunchOptions, StructuredPromptDeliveryResult } from '@/lib/agent-session/launch/structured-agent-session-launch-callers' -import { - StructuredAgentSessionCreateAbandonedError, - type StructuredAgentSessionCreateGate -} from '../structured-agent-session-launch-errors' export type StructuredAgentLaunchSettlement = | { diff --git a/src/renderer/src/lib/codex-model-catalog-reader-test-fixture.ts b/src/renderer/src/lib/agent-session/launch/new-tab/codex-model-catalog-reader-test-fixture.ts similarity index 75% rename from src/renderer/src/lib/codex-model-catalog-reader-test-fixture.ts rename to src/renderer/src/lib/agent-session/launch/new-tab/codex-model-catalog-reader-test-fixture.ts index a48385385c2..ded8f98739d 100644 --- a/src/renderer/src/lib/codex-model-catalog-reader-test-fixture.ts +++ b/src/renderer/src/lib/agent-session/launch/new-tab/codex-model-catalog-reader-test-fixture.ts @@ -1,5 +1,5 @@ import { vi } from 'vitest' -import type { AgentSessionModelOption } from '../../../shared/agent-session/agent-session-wire' +import type { AgentSessionModelOption } from '../../../../../../shared/agent-session/agent-session-wire' export const { fetchCodexModelCatalogListing } = await vi.importActual<{ fetchCodexModelCatalogListing(input: { @@ -19,4 +19,4 @@ export const { fetchCodexModelCatalogListing } = await vi.importActual<{ configured?: { model?: string; effort?: string } listedServiceTiers?: readonly string[] }> -}>('../../../main/codex/structured/catalog/codex-structured-model-catalog') +}>('../../../../../../main/codex/structured/catalog/codex-structured-model-catalog') diff --git a/src/renderer/src/lib/agent-session/launch/new-tab/launch-agent-picker-codex-contract.test.ts b/src/renderer/src/lib/agent-session/launch/new-tab/launch-agent-picker-codex-contract.test.ts deleted file mode 100644 index 2f911c0e818..00000000000 --- a/src/renderer/src/lib/agent-session/launch/new-tab/launch-agent-picker-codex-contract.test.ts +++ /dev/null @@ -1,147 +0,0 @@ -// @vitest-environment happy-dom -import { expect, it, vi } from 'vitest' -import { - agentPickerDraft, - agentPickerLaunchInputs, - type AgentPickerEntry -} from '../../../../../../shared/agent-launch/picker/agent-launch-picker' -import { - acceptAgentPickerArguments, - applyAgentPickerEdit -} from '../../../../../../shared/agent-launch/picker/agent-launch-picker-edits' -import { agentPickerPanelArguments } from '../../../../../../shared/agent-launch/picker/agent-launch-picker-arguments' -import { mockCreateTab, queuedStartups, store } from './launch-agent-in-new-tab-test-fixture' -import { fetchCodexModelCatalogListing } from '../../../codex-model-catalog-reader-test-fixture' - -it('passes the recorded Codex catalog tier and approval/sandbox policy through the common reader, picker and real compiler', async () => { - const { default: capture } = - await import('../../../../../../shared/fixtures/agent-picker-cli-recordings.json') - const { launchAgentInNewTab } = await import('./launch-agent-in-new-tab') - const listing = await fetchCodexModelCatalogListing({ - connection: { request: vi.fn().mockResolvedValue(capture.modelList) } - }) - const model = listing.models[0] - const tier = model.serviceTiers![0].value - expect(capture.policy.sandbox.type).toBe('workspaceWrite') - const raw = `-a ${capture.policy.approvalPolicy} -s workspace-write -c approvals_reviewer=${capture.policy.approvalsReviewer}` - const entry: AgentPickerEntry = { - agent: 'codex', - label: 'Codex', - rows: [{ agent: 'codex', kind: 'chat' }], - surfaces: ['chat', 'terminal'], - defaultSurface: 'terminal', - terminal: {}, - structured: {}, - arguments: `${raw} --add-dir docs`, - catalog: { origin: 'probe', fetchedAt: 1, models: listing.models } - } - const selected = applyAgentPickerEdit(entry, agentPickerDraft(entry), { - kind: 'speed', - key: 'serviceTier', - value: tier, - model: model.id - }) - const view = agentPickerPanelArguments(entry, selected) - expect(view.permission).toBeDefined() - const edited = acceptAgentPickerArguments( - entry, - applyAgentPickerEdit(entry, selected, { - kind: 'arguments', - text: '--add-dir src' - }) - ) - for (const next of [selected, edited]) { - mockCreateTab.mockClear() - const inputs = agentPickerLaunchInputs({ ...next, surface: 'terminal' }, entry) - launchAgentInNewTab({ - requestId: 'recorded-policy', - agent: 'codex', - worktreeId: 'wt-1', - requestedSurface: 'terminal', - ...inputs - }) - expect(queuedStartups()[0]?.command).toContain(`'service_tier=${tier}'`) - expect(queuedStartups()[0]?.command).toContain("'-a' 'on-request' '-s' 'workspace-write'") - expect( - agentPickerLaunchInputs({ ...next, surface: 'chat' }, entry).sessionOptions?.serviceTier - ).toBe(tier) - } - const standard = acceptAgentPickerArguments( - entry, - applyAgentPickerEdit(entry, selected, { - kind: 'arguments', - text: '-c service_tier=default --add-dir src' - }) - ) - expect(standard).toMatchObject({ choices: { options: { serviceTier: 'default' } } }) - expect( - agentPickerLaunchInputs({ ...standard, surface: 'chat' }, entry).sessionOptions?.serviceTier - ).toBe('default') - expect(agentPickerLaunchInputs({ ...standard, surface: 'terminal' }, entry).agentArgs).toContain( - 'service_tier=default' - ) - expect(view.choices.options?.serviceTier).toBe(tier) - const removed = applyAgentPickerEdit(entry, selected, { kind: 'remove-chip', key: 'serviceTier' }) - expect(agentPickerPanelArguments(entry, removed).choices.options?.serviceTier).toBe('default') -}) - -it('conserves quoted Codex string sources through common acceptance and the terminal compiler', async () => { - const { launchAgentInNewTab } = await import('./launch-agent-in-new-tab') - const { tokenizeStartupCommand } = - await import('../../../../../../shared/agent-launch/startup/tui-agent-startup-shell') - const { agentChoiceConfigString } = - await import('../../../../../../shared/agent-launch/choices/agent-choice-cli-apply') - const own: AgentPickerEntry = { - agent: 'codex', - label: 'Codex', - rows: [{ agent: 'codex', kind: 'cli' }], - surfaces: ['chat', 'terminal'], - defaultSurface: 'terminal', - terminal: { permissionMode: 'own' }, - structured: {}, - arguments: '', - catalog: { origin: 'unknown' } - } - for (const [key, scalar] of [ - ['model', 'some-model'], - ['model', 'true'], - ['model', '42'], - ['model', 'a"b'], - ['model_reasoning_effort', 'high'], - ['model_reasoning_effort', 'future_effort'] - ]) { - const operand = `${key}=${JSON.stringify(scalar)}` - const raw = `-c '${operand}' --search` - const draft = acceptAgentPickerArguments( - own, - applyAgentPickerEdit(own, agentPickerDraft(own), { kind: 'arguments', text: raw }) - ) - const semanticKey = key === 'model' ? 'model' : 'effort' - expect(agentPickerPanelArguments(own, draft).text).toBe('--search') - expect( - agentPickerLaunchInputs({ ...draft, surface: 'chat' }, own).chatSessionOptions?.[semanticKey] - ).toBe(scalar) - for (const command of ['codex', 'cx']) { - store.settings.agentCmdOverrides = { codex: command } - mockCreateTab.mockClear() - launchAgentInNewTab({ - requestId: 'quoted-string-source', - agent: 'codex', - worktreeId: 'wt-1', - requestedSurface: 'terminal', - ...agentPickerLaunchInputs(draft, own) - }) - const startup = queuedStartups()[0] - expect(startup?.launchConfig?.agentArgs).toContain(raw) - const compiled = tokenizeStartupCommand(startup?.command ?? '', 'posix') - expect(compiled.ok).toBe(true) - if (!compiled.ok) { - throw new Error('Expected valid terminal startup') - } - expect(compiled.tokens[0]).toBe(command) - const operands = compiled.tokens.filter((token) => token.startsWith(`${key}=`)) - expect(operands).toEqual([operand]) - expect(agentChoiceConfigString(operands[0].slice(key.length + 1))).toBe(scalar) - } - } -}) diff --git a/src/renderer/src/lib/agent-session/launch/new-tab/launch-agent-structured-chat-test-fixture.ts b/src/renderer/src/lib/agent-session/launch/new-tab/launch-agent-structured-chat-test-fixture.ts index 75f73bf4e3d..99dd79857f3 100644 --- a/src/renderer/src/lib/agent-session/launch/new-tab/launch-agent-structured-chat-test-fixture.ts +++ b/src/renderer/src/lib/agent-session/launch/new-tab/launch-agent-structured-chat-test-fixture.ts @@ -1,4 +1,3 @@ -import type { structuredLaunchIntent } from './structured-session-launch-intent.test-fixture' import { afterEach, beforeEach, vi } from 'vitest' import { createTestStore, seedStore } from '@/store/testing/app-store-test-fixture' import { makeWorktree } from '@/store/slices/worktrees/worktree.test-fixture' @@ -8,12 +7,13 @@ import { makeUnifiedTab, makeTabGroup } from '@/store/slices/tabs/tab-group.test import { drawTabsFromMain } from '@/store/slices/tabs/tabs-drawn-from-main.test-fixture' import type * as Frames from '@/store/slices/tabs/tabs-drawn-from-main.test-fixture' import { createGlobalSettingsFixture } from '../../../../../../shared/global-settings-test-fixture' -import type { GlobalSettings } from '../../../../../../shared/global-settings-types' import { registerStructuredSelectionCatalogStore } from '../../options/structured-agent-session-selection-controller' +import type { structuredLaunchIntent } from './structured-session-launch-intent.test-fixture' +import type { GlobalSettings } from '../../../../../../shared/global-settings-types' import type { AppState } from '@/store/types' import type { pasteDraftWhenAgentReady } from '../../messaging/paste/agent-paste-draft' import type { waitForAgentReady } from '../../messaging/paste/agent-ready-wait' -import type { createStructuredAgentSessionLaunchIntent as create } from '../../../launch-structured-agent-session' +import type { createStructuredAgentSessionLaunchIntent as create } from '../structured-agent-session-launch-intent' import type { launchStructuredAgentSession as launch } from '../structured-agent-session-launch-create-call' import type { refreshLocalStructuredSessionTabs as refreshTabs } from '@/runtime/local-structured-session-tabs-sync/inventory-refresh' import type { toast } from 'sonner' @@ -81,7 +81,7 @@ function launchScenarioSettings(): GlobalSettings { vi.mock('@/hooks/useShortcutLabel', () => ({ useOptionalShortcutLabel: () => null })) vi.mock('@/store/index', async () => - (await import('../../../launch-parity-renderer.test-fixture')).launchStoreModuleMock(owner) + (await import('../parity/launch-parity-renderer.test-fixture')).launchStoreModuleMock(owner) ) vi.mock('@/runtime/rpc/calls/runtime-rpc-call', async (original) => ( @@ -141,13 +141,16 @@ vi.mock('@/lib/agent-session/launch/structured-agent-session-launch-create-call' launchStructuredAgentSession: mockLaunchStructuredCodexSession })) -vi.mock('@/lib/launch-structured-agent-session', () => ({ +vi.mock('@/lib/agent-session/launch/structured-agent-session-launch-intent', () => ({ createStructuredAgentSessionLaunchIntent: mockCreateStructuredCodexSessionLaunchIntent, - abandonStructuredAgentSessionLaunchIntent: vi.fn(), retryStructuredAgentSessionLaunchIntent: mockRetryStructuredAgentSessionLaunchIntent, launchStructuredAgentSession: mockLaunchStructuredCodexSession, ...launchErrorMocks })) + +vi.mock('@/lib/agent-session/launch/structured-agent-session-launch-abandon', () => ({ + abandonStructuredAgentSessionLaunchIntent: vi.fn() +})) vi.mock('@/runtime/local-structured-session-tabs-sync/inventory-refresh', () => ({ refreshLocalStructuredSessionTabs: mockRefreshLocalStructuredSessionTabs })) diff --git a/src/renderer/src/lib/agent-session/launch/pane/agent-launch-tab-publication.ts b/src/renderer/src/lib/agent-session/launch/pane/agent-launch-tab-publication.ts index 574c7968ad9..8bc1330a2c5 100644 --- a/src/renderer/src/lib/agent-session/launch/pane/agent-launch-tab-publication.ts +++ b/src/renderer/src/lib/agent-session/launch/pane/agent-launch-tab-publication.ts @@ -1,17 +1,17 @@ /** Publish under host-reserved IDs before the agent exists so PTY routing names this pane and retries reuse its tab; the pane’s spawn waits in main and attaches to the host’s process. */ +import { folderWorkspaceToWorktree } from '../../../../../../shared/folder-workspaces/folder-workspace-worktree' +import { presentAgentLaunchTab } from './agent-launch-tab-presentation' +import { useAppStore } from '../../../../store/index' +import { resolveUnifiedTabCreatePlacement } from '../../../../store/slices/tabs/tabs-create-placement' +import { insertUnifiedTabAfterAnchor } from '../../../workspace/tabs/unified-tab-anchor-insertion' +import { rememberAgentLaunchPanePrompt } from './agent-launch-pane-prompt' +import { selectFolderWorkspaces } from '@/store/workspaces/catalog/workspace-record-fields' import type { AgentLaunchPlacementReceipt } from '../../../../../../shared/agent-launch/contracts/agent-launch-intent' import type { AgentLaunchTabPublished, AgentLaunchTabPublishRequest } from '../../../../../../shared/agent-launch/contracts/agent-launch-tab-publication' -import { folderWorkspaceToWorktree } from '../../../../../../shared/folder-workspaces/folder-workspace-worktree' -import { presentAgentLaunchTab } from './agent-launch-tab-presentation' -import { useAppStore } from '../../../../store/index' -import { resolveUnifiedTabCreatePlacement } from '../../../../store/slices/tabs/tabs-create-placement' -import { insertUnifiedTabAfterAnchor } from '../../../unified-tab-anchor-insertion' -import { rememberAgentLaunchPanePrompt } from './agent-launch-pane-prompt' -import { selectFolderWorkspaces } from '@/store/workspaces/catalog/workspace-record-fields' function landedGroupId(worktreeId: string, tabId: string): string | undefined { return useAppStore diff --git a/src/renderer/src/lib/launch-parity-renderer.test-fixture.ts b/src/renderer/src/lib/agent-session/launch/parity/launch-parity-renderer.test-fixture.ts similarity index 94% rename from src/renderer/src/lib/launch-parity-renderer.test-fixture.ts rename to src/renderer/src/lib/agent-session/launch/parity/launch-parity-renderer.test-fixture.ts index 39dfeb5b488..fb9a81e77d4 100644 --- a/src/renderer/src/lib/launch-parity-renderer.test-fixture.ts +++ b/src/renderer/src/lib/agent-session/launch/parity/launch-parity-renderer.test-fixture.ts @@ -1,15 +1,17 @@ // Load each renderer client OS against a real one-workspace store; suites own their vi.mock declarations. import { vi } from 'vitest' import { useStore } from 'zustand' -import type * as StoreHelpersNamespace from '@/store/testing/app-store-test-fixture' -import type * as CapabilitiesNamespace from '@/runtime/hosts/capabilities/local-runtime-capabilities' import { LAUNCH_FOLDER_ID, LAUNCH_REPO_ID, - launchWorkspaceId, - type LaunchClient, - type LaunchWorkspace -} from '../../../shared/agent-launch/fixtures/launch-parity-window-request.test-fixture' + launchWorkspaceId +} from '../../../../../../shared/agent-launch/fixtures/launch-parity-window-request.test-fixture' +import type { + LaunchClient, + LaunchWorkspace +} from '../../../../../../shared/agent-launch/fixtures/launch-parity-window-request.test-fixture' +import type * as StoreHelpersNamespace from '@/store/testing/app-store-test-fixture' +import type * as CapabilitiesNamespace from '@/runtime/hosts/capabilities/local-runtime-capabilities' const USER_AGENT: Record = { darwin: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Orca', diff --git a/src/renderer/src/lib/agent-session/launch/routing/agent-launch-route-input.test.ts b/src/renderer/src/lib/agent-session/launch/routing/agent-launch-route-input.test.ts index 93e5d1b8789..d43c3cfca51 100644 --- a/src/renderer/src/lib/agent-session/launch/routing/agent-launch-route-input.test.ts +++ b/src/renderer/src/lib/agent-session/launch/routing/agent-launch-route-input.test.ts @@ -1,11 +1,13 @@ import { EVERY_AGENT_CHAT } from '../../../../../../shared/native-chat/every-agent-chat.test-fixture' import { beforeEach, describe, expect, it, vi } from 'vitest' - import { STRUCTURED_AGENT_SESSION_CLIENT_LAUNCH_MODE_CAPABILITY, STRUCTURED_AGENT_SESSION_RUNTIME_CAPABILITY } from '../../../../../../shared/agent-session/agent-session-runtime-capabilities' - +import { folderWorkspaceKey } from '../../../../../../shared/workspace-scope' +import { buildAgentLaunchRouteInput } from './agent-launch-route-input' +import type { AgentLaunchRouteArgs, AgentLaunchRouteStore } from './agent-launch-route-input' +import { planAgentSessionLaunch } from './agent-session-launch-plan' import type * as ConnectionOwnerResolutionModule from '../../../workspace/ownership/connection-owner-resolution' const mocks = vi.hoisted(() => ({ @@ -25,7 +27,7 @@ vi.mock('@/lib/workspace/ownership/connection-owner-resolution', async (importOr ...(await importOriginal()), getConnectionIdFromState: mocks.getConnectionIdFromState })) -vi.mock('@/lib/local-preflight-context', () => ({ +vi.mock('@/runtime/hosts/preflight/local-preflight-context', () => ({ getLocalProjectExecutionRuntimeContext: mocks.getLocalProjectExecutionRuntimeContext, getLocalRepoProjectExecutionRuntimeContext: mocks.getLocalRepoProjectExecutionRuntimeContext })) @@ -37,14 +39,6 @@ vi.mock('@/runtime/hosts/capabilities/local-runtime-capabilities', () => ({ })) vi.mock('@/lib/agent-session/launch/continuation/structured-agent-launch-settlement', () => ({})) -import { folderWorkspaceKey } from '../../../../../../shared/workspace-scope' -import { - buildAgentLaunchRouteInput, - type AgentLaunchRouteArgs, - type AgentLaunchRouteStore -} from './agent-launch-route-input' -import { planAgentSessionLaunch } from './agent-session-launch-plan' - const routeFor = (appStore: AgentLaunchRouteStore, args: AgentLaunchRouteArgs) => planAgentSessionLaunch(appStore, { ...args, requestId: 'route-check' }).route diff --git a/src/renderer/src/lib/agent-session/launch/routing/agent-launch-route-input.ts b/src/renderer/src/lib/agent-session/launch/routing/agent-launch-route-input.ts index 84ba26b20bb..fc0fe438133 100644 --- a/src/renderer/src/lib/agent-session/launch/routing/agent-launch-route-input.ts +++ b/src/renderer/src/lib/agent-session/launch/routing/agent-launch-route-input.ts @@ -1,17 +1,11 @@ -import type { ProjectLaunchContext } from '../../../../../../shared/rpc-contract/preflight-params' import { LOCAL_EXECUTION_HOST_ID, parseExecutionHostId, toRuntimeExecutionHostId } from '../../../../../../shared/execution-host' -import type { AppState } from '@/store/types' -import type { Worktree } from '../../../../../../shared/worktree/types' import { findFirstIndexedWorktree } from '@/lib/workspace/ownership/worktree-runtime-owner-index' import { requestsCwdOutsideWorkspaceRootForWorkspace } from '../../../../../../shared/shell/launch/terminal-startup-cwd' -import type { TuiAgent } from '../../../../../../shared/agent-launch/catalog/tui-agent' import { workspaceKindForWorktreeId } from '../../../../../../shared/agent-launch/contracts/workspace-launch-kind' -import type { AgentLaunchRoutingInput } from '@/lib/agent-session/launch/routing/agent-launch-routing' -// Import the resolver directly: the connection-context facade reaches the store root and creates a launch-graph cycle. import { getConnectionIdFromState, getRepoConnectionIdFromState @@ -19,8 +13,7 @@ import { import { getLocalProjectExecutionRuntimeContext, getLocalRepoProjectExecutionRuntimeContext -} from '@/lib/local-preflight-context' -import type { NativeChatLaunchPromptDelivery } from '@/lib/agent-session/launch/prompt/native-chat-launch-prompt-delivery' +} from '@/runtime/hosts/preflight/local-preflight-context' import { isNativeChatTranscriptLocalReadable } from '../../../../../../shared/native-chat/transcript/native-chat-transcript-readability' import { getExecutionHostIdForWorktree } from '@/lib/workspace/ownership/worktree-runtime-owner' import { readLocalRuntimeCapabilitiesOrUnknown } from '@/runtime/hosts/capabilities/local-runtime-capabilities' @@ -33,6 +26,14 @@ import { } from '@/store/workspaces/catalog/workspace-record-fields' import { readHostStructuredAgents } from '@/runtime/native-chat/agent-catalogs/host-structured-agents' import { lastVerifiedRuntimeStatus } from '../../../../../../shared/remote-runtime/host-status/runtime-host-status' +import type { ProjectLaunchContext } from '../../../../../../shared/rpc-contract/preflight-params' +import type { AppState } from '@/store/types' +import type { Worktree } from '../../../../../../shared/worktree/types' +import type { TuiAgent } from '../../../../../../shared/agent-launch/catalog/tui-agent' +import type { AgentLaunchRoutingInput } from '@/lib/agent-session/launch/routing/agent-launch-routing' +import type { NativeChatLaunchPromptDelivery } from '@/lib/agent-session/launch/prompt/native-chat-launch-prompt-delivery' + +// Import the resolver directly: the connection-context facade reaches the store root and creates a launch-graph cycle. export type ProspectiveWorkspaceKind = NonNullable diff --git a/src/renderer/src/lib/agent-session/launch/routing/agent-launch-route-registered-agents.test.ts b/src/renderer/src/lib/agent-session/launch/routing/agent-launch-route-registered-agents.test.ts deleted file mode 100644 index 006b4741dcb..00000000000 --- a/src/renderer/src/lib/agent-session/launch/routing/agent-launch-route-registered-agents.test.ts +++ /dev/null @@ -1,118 +0,0 @@ -import { EVERY_AGENT_CHAT } from '../../../../../../shared/native-chat/every-agent-chat.test-fixture' -import { beforeEach, describe, expect, it, vi } from 'vitest' -import { - STRUCTURED_AGENT_SESSION_CLIENT_LAUNCH_MODE_CAPABILITY, - STRUCTURED_AGENT_SESSION_RUNTIME_CAPABILITY -} from '../../../../../../shared/agent-session/agent-session-runtime-capabilities' -import { STRUCTURED_AGENT_SESSION_REGISTERED_AGENTS_RUNTIME_CAPABILITY } from '../../../../../../shared/agent-session/structured-agent-session-surface-capabilities' -import type { RuntimeCapability } from '../../../../../../shared/protocol-version' -import type { GlobalSettings } from '../../../../../../shared/global-settings-types' -import type { RuntimeEnvironmentStatus } from '../../../../../../shared/remote-runtime/host-status/runtime-host-status' -import type { TuiAgent } from '../../../../../../shared/agent-launch/catalog/tui-agent' - -const mocks = vi.hoisted(() => ({ - readLocalRuntimeCapabilitiesOrUnknown: vi.fn(), - callRuntimeRpc: vi.fn() -})) - -vi.mock('@/lib/workspace/ownership/worktree-runtime-owner', () => ({ - getExecutionHostIdForWorktree: vi.fn() -})) -vi.mock('@/lib/local-preflight-context', () => ({ - getLocalProjectExecutionRuntimeContext: vi.fn(), - getLocalRepoProjectExecutionRuntimeContext: vi.fn() -})) -vi.mock('@/app-shell/platform/web-client-location', () => ({ isWebClientLocation: () => false })) -vi.mock('@/runtime/hosts/capabilities/local-runtime-capabilities', () => ({ - readLocalRuntimeCapabilitiesOrUnknown: mocks.readLocalRuntimeCapabilitiesOrUnknown -})) -vi.mock('@/runtime/rpc/calls/runtime-rpc-call', () => ({ - callRuntimeRpc: mocks.callRuntimeRpc -})) -vi.mock('@/lib/agent-session/launch/continuation/structured-agent-launch-settlement', () => ({})) - -import { - loadHostStructuredAgents, - resetHostStructuredAgentsForTests -} from '@/runtime/native-chat/agent-catalogs/host-structured-agents' -import type { AgentLaunchRouteStore, ProspectiveWorkspace } from './agent-launch-route-input' -import { planAgentSessionLaunch } from './agent-session-launch-plan' - -const STRUCTURED: RuntimeCapability[] = [STRUCTURED_AGENT_SESSION_RUNTIME_CAPABILITY] -const REGISTERED: RuntimeCapability[] = [ - STRUCTURED_AGENT_SESSION_RUNTIME_CAPABILITY, - STRUCTURED_AGENT_SESSION_CLIENT_LAUNCH_MODE_CAPABILITY, - STRUCTURED_AGENT_SESSION_REGISTERED_AGENTS_RUNTIME_CAPABILITY -] -const LISTS_GROK = { - agents: [ - { agent: 'claude', capabilities: {} }, - { agent: 'codex', capabilities: {} }, - { agent: 'grok', capabilities: {} } - ] -} -const SETTINGS = { - nativeChatProviders: EVERY_AGENT_CHAT -} -const LOCAL: ProspectiveWorkspace = { kind: 'git-worktree', repoId: 'repo-1' } -const PAIRED: ProspectiveWorkspace = { kind: 'git-worktree', runtimeEnvironmentId: 'env-1' } - -function pairedStatus(runtimeId: string): RuntimeEnvironmentStatus { - return { - status: { - runtimeId, - capabilities: REGISTERED, - rendererGraphEpoch: 0, - graphStatus: 'ready', - authoritativeWindowId: null, - liveTabCount: 0, - liveLeafCount: 0 - }, - checkedAt: 1 - } -} - -type RouteSettings = Partial & - Partial> - -function store( - overrides: { settings?: RouteSettings; runtimeId?: string } = {} -): AgentLaunchRouteStore { - const state = { - settings: { ...SETTINGS, ...overrides.settings }, - localDetectedAgentIdsByContext: { host: [] }, - runtimeStatusByEnvironmentId: new Map([['env-1', pairedStatus(overrides.runtimeId ?? 'rt-1')]]), - worktreesByRepo: {}, - folderWorkspaces: [] - } - // oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: the route builder reads only the settings, host statuses and workspace rows given here; a missing member reads as absent, as the sibling route tests rely on. - return state as unknown as AgentLaunchRouteStore -} - -const routeFor = (appStore: AgentLaunchRouteStore, agent: TuiAgent, workspace = LOCAL) => - planAgentSessionLaunch(appStore, { requestId: 'request-1', agent, workspace }).route - -beforeEach(() => { - resetHostStructuredAgentsForTests() - mocks.callRuntimeRpc.mockReset().mockResolvedValue(LISTS_GROK) - mocks.readLocalRuntimeCapabilitiesOrUnknown.mockReset().mockReturnValue(REGISTERED) -}) - -describe('structured launch of a host-registered agent', () => { - it('never offers it from a host without the registered-agents capability', async () => { - await loadHostStructuredAgents('local', REGISTERED, null) - mocks.readLocalRuntimeCapabilitiesOrUnknown.mockReturnValue(STRUCTURED) - - expect(routeFor(store(), 'grok')).not.toBe('structured-native-chat') - expect(routeFor(store(), 'claude')).toBe('structured-native-chat') - }) - - it("reads a paired host's list only from the runtime that gave it", async () => { - await loadHostStructuredAgents('runtime:env-1', REGISTERED, 'rt-1') - - expect(routeFor(store(), 'grok', PAIRED)).toBe('structured-native-chat') - expect(routeFor(store({ runtimeId: 'rt-2' }), 'grok', PAIRED)).not.toBe( - 'structured-native-chat' - ) - }) -}) diff --git a/src/renderer/src/lib/agent-session/launch/routing/agent-session-launch-plan.ts b/src/renderer/src/lib/agent-session/launch/routing/agent-session-launch-plan.ts index de3c6094008..a1187c0f60c 100644 --- a/src/renderer/src/lib/agent-session/launch/routing/agent-session-launch-plan.ts +++ b/src/renderer/src/lib/agent-session/launch/routing/agent-session-launch-plan.ts @@ -2,43 +2,36 @@ import { notifyAgentLaunchFailure, agentLaunchRecoveryMessage } from '@/lib/agent-session/launch/failure/agent-launch-failure' +import { isLocalExecutionHost, parseExecutionHostId } from '../../../../../../shared/execution-host' +import type { ExecutionHostId } from '../../../../../../shared/execution-host' +import { STRUCTURED_AGENT_SESSION_REGISTERED_AGENTS_RUNTIME_CAPABILITY } from '../../../../../../shared/agent-session/structured-agent-session-surface-capabilities' +import '../structured-agent-session-launch-intent' +import { StructuredAgentSessionOwnerUnresolvedError } from '../structured-agent-session-launch-errors' +import { buildAgentLaunchRouteInput } from './agent-launch-route-input' +import type { AgentLaunchRouteArgs, AgentLaunchRouteStore } from './agent-launch-route-input' +import { + resolveAgentLaunchRoute, + structuredAgentLaunchDowngrade, + structuredAgentLaunchSupported +} from './agent-launch-routing' +import type { AgentLaunchRoute, AgentLaunchRoutingInput } from './agent-launch-routing' +import { beginStructuredAgentLaunchSettlement } from '../continuation/structured-agent-launch-settlement' +import type { + StructuredAgentLaunchHandle, + StructuredAgentLaunchHooks, + StructuredAgentLaunchSettlement +} from '../continuation/structured-agent-launch-settlement' +import { relearnHostStructuredAgents } from '../../../../runtime/native-chat/agent-catalogs/host-structured-agents' +import { awaitLocalRuntimeCapabilities } from '../../../../runtime/hosts/capabilities/local-runtime-capabilities' import type { StructuredLaunchSurfaceAddress } from '../structured-agent-session-launch-record' import type { StructuredAgentSessionForkSource, StructuredAgentSessionResumeSource } from '../../../../../../shared/agent-session/structured-agent-session-create' import type { TuiAgent } from '../../../../../../shared/agent-launch/catalog/tui-agent' -import { - isLocalExecutionHost, - parseExecutionHostId, - type ExecutionHostId -} from '../../../../../../shared/execution-host' -import { STRUCTURED_AGENT_SESSION_REGISTERED_AGENTS_RUNTIME_CAPABILITY } from '../../../../../../shared/agent-session/structured-agent-session-surface-capabilities' -import '../../../launch-structured-agent-session' -import { StructuredAgentSessionOwnerUnresolvedError } from '../structured-agent-session-launch-errors' -import { - buildAgentLaunchRouteInput, - type AgentLaunchRouteArgs, - type AgentLaunchRouteStore -} from './agent-launch-route-input' -import { - resolveAgentLaunchRoute, - structuredAgentLaunchDowngrade, - structuredAgentLaunchSupported, - type AgentLaunchRoute, - type AgentLaunchRoutingInput -} from './agent-launch-routing' import type { NativeChatLaunchPromptDelivery } from '../prompt/native-chat-launch-prompt-delivery' -import { - beginStructuredAgentLaunchSettlement, - type StructuredAgentLaunchHandle, - type StructuredAgentLaunchHooks, - type StructuredAgentLaunchSettlement -} from '../continuation/structured-agent-launch-settlement' import type { StructuredAgentLaunchOptions } from '../structured-agent-session-launch-callers' import type { AgentLaunchRequestId } from './agent-launch-request-id' -import { relearnHostStructuredAgents } from '../../../../runtime/native-chat/agent-catalogs/host-structured-agents' -import { awaitLocalRuntimeCapabilities } from '../../../../runtime/hosts/capabilities/local-runtime-capabilities' export type AgentLaunchSurface = 'chat' | 'terminal' diff --git a/src/renderer/src/lib/agent-session/launch/structured-agent-session-action-launch.ts b/src/renderer/src/lib/agent-session/launch/structured-agent-session-action-launch.ts index ca4180c90b9..30a463682bc 100644 --- a/src/renderer/src/lib/agent-session/launch/structured-agent-session-action-launch.ts +++ b/src/renderer/src/lib/agent-session/launch/structured-agent-session-action-launch.ts @@ -7,25 +7,25 @@ import { publishStructuredLaunchChange } from './structured-agent-session-launch-registry' import { focusTerminalTabSurface } from '../../../components/terminal-pane/input/focus/focus-terminal-tab-surface' -import type { Tab } from '../../../../../shared/tab-types' -import type { StructuredAgentLaunchSettlement } from './continuation/structured-agent-launch-settlement' -import type { ProvisionalLaunchArgs } from '../structured-agent-session-provisional-tab' -import { insertUnifiedTabAfterAnchor } from '../../unified-tab-anchor-insertion' +import { insertUnifiedTabAfterAnchor } from '../../workspace/tabs/unified-tab-anchor-insertion' import { useAppStore } from '@/store/index' -import type { OpenedAgentSessionTab } from './pane/structured-agent-session-tab-open-through-layout-owner' import { ORCA_LAYOUT_OWNER_IS_MAIN } from '../../../../../shared/layout-owner-switch' import { sendLayoutCommandToOwner } from '@/runtime/workspace-layout/commands/layout-owner-command' import { declinedTerminalCanOpen, - openDeclinedStructuredLaunchTerminal, - type StructuredLaunchTerminal + openDeclinedStructuredLaunchTerminal } from '@/lib/agent-session/launch/structured-agent-session-launch-admission' +import type { StructuredLaunchTerminal } from '@/lib/agent-session/launch/structured-agent-session-launch-admission' import { notifyHostDeclined } from '@/lib/agent-session/launch/structured-agent-session-launch-admission-notices' -import type { ExecutionHostId } from '../../../../../shared/execution-host' -import type { RuntimeClientTarget } from '../../../../../shared/runtime-client-target' import { structuredAgentSessionDraftScopeKey } from '@/components/native-chat/drafts/native-chat-draft-scope' import { nativeChatComposerHasUserContent } from '@/components/native-chat/attachments/chips/native-chat-pending-attachment-cache' import { StructuredAgentSessionCreateRefusalError } from '@/lib/agent-session/launch/structured-agent-session-launch-errors' +import type { Tab } from '../../../../../shared/tab-types' +import type { StructuredAgentLaunchSettlement } from './continuation/structured-agent-launch-settlement' +import type { ProvisionalLaunchArgs } from '../structured-agent-session-provisional-tab' +import type { OpenedAgentSessionTab } from './pane/structured-agent-session-tab-open-through-layout-owner' +import type { ExecutionHostId } from '../../../../../shared/execution-host' +import type { RuntimeClientTarget } from '../../../../../shared/runtime-client-target' export function openDeclinedTerminal( args: ProvisionalLaunchArgs, diff --git a/src/renderer/src/lib/agent-session/launch/structured-agent-session-create-hydration.ts b/src/renderer/src/lib/agent-session/launch/structured-agent-session-create-hydration.ts index 3e5fde09aa1..b3715950cf8 100644 --- a/src/renderer/src/lib/agent-session/launch/structured-agent-session-create-hydration.ts +++ b/src/renderer/src/lib/agent-session/launch/structured-agent-session-create-hydration.ts @@ -1,10 +1,10 @@ -import type { AgentSessionHistoryPage } from '../../../../../shared/agent-session/agent-session-wire' -import type { StructuredAgentSessionLaunchIntent } from '../../launch-structured-agent-session' import { hasStructuredAgentLaunchCancellationTombstonePersisted } from './structured-agent-session-launch-persistence' import { wasStructuredAgentLaunchClosedByLocalCancel } from './structured-agent-session-local-launch-cancel' import { ORCA_LAYOUT_OWNER_IS_MAIN } from '../../../../../shared/layout-owner-switch' import { getStructuredAgentSessionReadOwner } from '@/components/native-chat/session/structured/read/structured-agent-session-read-owner' import { noteStructuredAgentSessionFence } from '@/components/native-chat/session/structured/delivery/structured-agent-session-send-attempt' +import type { AgentSessionHistoryPage } from '../../../../../shared/agent-session/agent-session-wire' +import type { StructuredAgentSessionLaunchIntent } from './structured-agent-session-launch-intent' /** The host's create proof belongs to the existing reader until its tab closes. */ export function publishStructuredAgentSessionCreateHydration( diff --git a/src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-abandon.ts b/src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-abandon.ts index a21417d37ce..8d47c286a4e 100644 --- a/src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-abandon.ts +++ b/src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-abandon.ts @@ -1,6 +1,6 @@ import { clearWebSessionFocusIntentIfMatches } from '@/runtime/web-session-tabs-sync/navigation/web-session-focus-intent' import { structuredAgentSessionFocusOwner } from '@/runtime/native-chat/session-ownership/structured-agent-session-owner' -import type { StructuredAgentSessionLaunchIntent } from '../../launch-structured-agent-session' +import type { StructuredAgentSessionLaunchIntent } from './structured-agent-session-launch-intent' export function abandonStructuredAgentSessionLaunchIntent( intent: StructuredAgentSessionLaunchIntent diff --git a/src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-after-failure.test.ts b/src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-after-failure.test.ts index c95c13a7cf5..9a99ccf7f24 100644 --- a/src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-after-failure.test.ts +++ b/src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-after-failure.test.ts @@ -1,9 +1,31 @@ // @vitest-environment happy-dom -import type * as LaunchErrors from '@/lib/agent-session/launch/structured-agent-session-launch-errors' import { beforeEach, describe, expect, it, vi } from 'vitest' +import { StructuredAgentSessionCreateRefusalError } from '@/lib/agent-session/launch/structured-agent-session-launch-errors' +import type * as LaunchErrors from '@/lib/agent-session/launch/structured-agent-session-launch-errors' +import { refreshLocalStructuredSessionTabs } from '@/runtime/local-structured-session-tabs-sync/inventory-refresh' +import { + cancelStructuredAgentLaunch, + retryStructuredAgentSessionLaunch, + startStructuredAgentLaunch +} from './structured-agent-session-launch' +import { getStructuredAgentLaunchStatus } from './structured-agent-session-launch-status' +import { + getStructuredAgentSessionLaunchLifecycle, + resetStructuredAgentLaunchRegistryForTests +} from './structured-agent-session-launch-registry' +import { + resetStructuredAgentSessionSendsForTests, + sendStructuredAgentSessionMessage +} from '@/components/native-chat/session/structured/delivery/structured-agent-session-message-sender' +import { getStructuredAgentSessionPendingSends } from '@/components/native-chat/session/structured/delivery/structured-agent-session-pending-sends' +import { relaunchFailedStructuredAgentSessionWithMessage } from './structured-agent-session-launch-message' +import { clearNativeChatComposerDraftsForTests as clearNativeChatDraftCacheForTests } from '@/components/native-chat/drafts/native-chat-draft-reset' +import { readNativeChatDraftCache } from '@/components/native-chat/drafts/native-chat-draft-views' +import { structuredAgentSessionDraftScopeKey } from '@/components/native-chat/drafts/native-chat-draft-scope' +import { resetStructuredAgentLaunchPersistenceForTests } from './structured-agent-session-launch-persistence' import type { RuntimeMobileSessionTabsResult } from '../../../../../shared/runtime-session-contracts' -import type { StructuredAgentSessionLaunchIntent } from '@/lib/launch-structured-agent-session' +import type { StructuredAgentSessionLaunchIntent } from '@/lib/agent-session/launch/structured-agent-session-launch-intent' const mocks = vi.hoisted(() => ({ abandonIntent: vi.fn(), @@ -35,18 +57,21 @@ vi.mock('@/lib/agent-session/launch/structured-agent-session-launch-create-call' launchStructuredAgentSession: mocks.launch })) -vi.mock('@/lib/launch-structured-agent-session', () => { +vi.mock('@/lib/agent-session/launch/structured-agent-session-launch-intent', () => { return { createStructuredAgentSessionLaunchIntent: mocks.createIntent, retryStructuredAgentSessionLaunchIntent: mocks.retryIntent, restoreStructuredAgentSessionLaunchIntent: mocks.restoreIntent, - abandonStructuredAgentSessionLaunchIntent: mocks.abandonIntent, launchStructuredAgentSession: mocks.launch, StructuredAgentSessionCreateRefusalError: launchErrorMocks.StructuredAgentSessionCreateRefusalError } }) +vi.mock('@/lib/agent-session/launch/structured-agent-session-launch-abandon', () => ({ + abandonStructuredAgentSessionLaunchIntent: mocks.abandonIntent +})) + vi.mock('@/runtime/local-structured-session-tabs-sync/inventory-refresh', () => ({ refreshLocalStructuredSessionTabs: vi.fn() })) @@ -86,29 +111,6 @@ vi.mock('@/lib/agent-catalog/agent-catalog', () => ({ getAgentCatalog: () => [{ id: 'codex', label: 'Codex' }] })) -import { StructuredAgentSessionCreateRefusalError } from '@/lib/agent-session/launch/structured-agent-session-launch-errors' -import { refreshLocalStructuredSessionTabs } from '@/runtime/local-structured-session-tabs-sync/inventory-refresh' -import { - cancelStructuredAgentLaunch, - retryStructuredAgentSessionLaunch, - startStructuredAgentLaunch -} from './structured-agent-session-launch' -import { getStructuredAgentLaunchStatus } from './structured-agent-session-launch-status' -import { - getStructuredAgentSessionLaunchLifecycle, - resetStructuredAgentLaunchRegistryForTests -} from './structured-agent-session-launch-registry' -import { - resetStructuredAgentSessionSendsForTests, - sendStructuredAgentSessionMessage -} from '@/components/native-chat/session/structured/delivery/structured-agent-session-message-sender' -import { getStructuredAgentSessionPendingSends } from '@/components/native-chat/session/structured/delivery/structured-agent-session-pending-sends' -import { relaunchFailedStructuredAgentSessionWithMessage } from './structured-agent-session-launch-message' -import { clearNativeChatComposerDraftsForTests as clearNativeChatDraftCacheForTests } from '@/components/native-chat/drafts/native-chat-draft-reset' -import { readNativeChatDraftCache } from '@/components/native-chat/drafts/native-chat-draft-views' -import { structuredAgentSessionDraftScopeKey } from '@/components/native-chat/drafts/native-chat-draft-scope' -import { resetStructuredAgentLaunchPersistenceForTests } from './structured-agent-session-launch-persistence' - type Receipt = { sessionId: string; fence: number } const WORKTREE_ID = 'wt-after-failure' @@ -260,25 +262,6 @@ describe('a new launch after a failed one', () => { expect(getStructuredAgentLaunchStatus(WORKTREE_ID, 'codex')).toBe('idle') }) - it('restores a failed chat after reload without unregistering a newer launch', async () => { - await refuseFirstLaunch() - resetStructuredAgentLaunchRegistryForTests() - let resolveFresh!: (receipt: Receipt) => void - mocks.launch - .mockImplementationOnce(() => new Promise((resolve) => (resolveFresh = resolve))) - .mockResolvedValueOnce({ sessionId: failed.sessionId, fence: 1 }) - const next = startStructuredAgentLaunch(WORKTREE_ID, 'codex', { requestId: 'request-5' }) - - expect(retryStructuredAgentSessionLaunch(WORKTREE_ID, failed.sessionId)).toBe(true) - await flushLaunchSettlement() - - expect(getStructuredAgentSessionLaunchLifecycle(WORKTREE_ID, failed.sessionId)).toBeNull() - expect(getStructuredAgentSessionLaunchLifecycle(WORKTREE_ID, fresh.sessionId)).toBe('pending') - expect(getStructuredAgentLaunchStatus(WORKTREE_ID, 'codex')).toBe('pending') - resolveFresh({ sessionId: fresh.sessionId, fence: 1 }) - await expect(next.launchResult).resolves.toEqual({ sessionId: fresh.sessionId, fence: 1 }) - }) - it('reads a failed resume as not starting, so resuming again opens a new chat', async () => { const resumeFrom = { providerSessionId: 'provider-1' } mocks.createIntent.mockReturnValueOnce(failed).mockReturnValueOnce(fresh) diff --git a/src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-close-race.test.ts b/src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-close-race.test.ts deleted file mode 100644 index 1889792d8bf..00000000000 --- a/src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-close-race.test.ts +++ /dev/null @@ -1,291 +0,0 @@ -// @vitest-environment happy-dom - -import type * as LaunchErrors from '@/lib/agent-session/launch/structured-agent-session-launch-errors' -import { beforeEach, describe, expect, it, vi } from 'vitest' -import { toast } from 'sonner' -import type { RuntimeMobileSessionTabsResult } from '../../../../../shared/runtime-session-contracts' -import type * as RecoveryModule from '@/lib/agent-session/launch/structured-agent-session-launch-recovery' -import type { StructuredAgentSessionLaunchIntent } from '@/lib/launch-structured-agent-session' -import { ORCA_LAYOUT_OWNER_IS_MAIN } from '../../../../../shared/layout-owner-switch' - -const mocks = vi.hoisted(() => ({ - abandonIntent: vi.fn(), - callStructuredAgentSession: vi.fn(), - callRuntimeRpc: vi.fn(), - createIntent: vi.fn(), - retryIntent: vi.fn(), - restoreIntent: vi.fn(), - launch: vi.fn(), - seedDraft: vi.fn(), - clearDraft: vi.fn(), - rendererTabs: {} as Record, - listeners: new Set<(state: { unifiedTabsByWorktree: Record }) => void>() -})) - -vi.mock('sonner', () => ({ - toast: { - error: vi.fn(), - message: vi.fn() - } -})) - -const launchErrorMocks = vi.hoisted(() => { - class StructuredAgentSessionCreateRefusalError extends Error {} - return { StructuredAgentSessionCreateRefusalError } -}) - -vi.mock('@/lib/agent-session/launch/structured-agent-session-launch-errors', async () => ({ - ...(await vi.importActual( - '@/lib/agent-session/launch/structured-agent-session-launch-errors' - )), - ...launchErrorMocks -})) - -vi.mock('@/lib/agent-session/launch/structured-agent-session-launch-create-call', () => ({ - launchStructuredAgentSession: mocks.launch -})) - -vi.mock('@/lib/launch-structured-agent-session', () => { - return { - createStructuredAgentSessionLaunchIntent: mocks.createIntent, - retryStructuredAgentSessionLaunchIntent: mocks.retryIntent, - restoreStructuredAgentSessionLaunchIntent: mocks.restoreIntent, - abandonStructuredAgentSessionLaunchIntent: mocks.abandonIntent, - launchStructuredAgentSession: mocks.launch, - StructuredAgentSessionCreateRefusalError: - launchErrorMocks.StructuredAgentSessionCreateRefusalError - } -}) - -vi.mock('@/lib/agent-session/launch/structured-agent-session-launch-recovery', async () => { - const actual = await vi.importActual( - '@/lib/agent-session/launch/structured-agent-session-launch-recovery' - ) - return { ...actual, launchAndReconcile: vi.fn(actual.launchAndReconcile) } -}) - -vi.mock('@/runtime/local-structured-session-tabs-sync/inventory-refresh', () => ({ - refreshLocalStructuredSessionTabs: vi.fn() -})) - -vi.mock('../../../runtime/native-chat/requests/structured-agent-session-call', () => ({ - callStructuredAgentSession: mocks.callStructuredAgentSession -})) - -vi.mock('@/runtime/rpc/calls/runtime-rpc-call', () => ({ - callRuntimeRpc: mocks.callRuntimeRpc -})) -vi.mock('@/runtime/rpc/compatibility/runtime-compatibility-probe', () => ({ - ensureRuntimeEnvironmentCompatible: vi.fn(async () => undefined) -})) - -vi.mock('@/store/index', () => ({ - useAppStore: { - getState: () => ({ - unifiedTabsByWorktree: mocks.rendererTabs, - seedNativeChatLaunchDraft: mocks.seedDraft, - clearNativeChatLaunchDraft: mocks.clearDraft - }), - subscribe: ( - listener: (state: { unifiedTabsByWorktree: Record }) => void - ) => { - mocks.listeners.add(listener) - return () => mocks.listeners.delete(listener) - } - } -})) - -vi.mock('@/i18n/i18n', () => ({ - translate: (_key: string, fallback: string, options?: { value0?: string }) => - fallback.replace('{{value0}}', options?.value0 ?? '') -})) - -vi.mock('@/lib/agent-catalog/agent-catalog', () => ({ - getAgentLabel: (agent: string) => (agent === 'codex' ? 'Codex' : 'Claude'), - getAgentCatalog: () => [ - { id: 'claude', label: 'Claude' }, - { id: 'codex', label: 'Codex' } - ] -})) - -import { refreshLocalStructuredSessionTabs } from '@/runtime/local-structured-session-tabs-sync/inventory-refresh' -import { - cancelStructuredAgentLaunch, - startStructuredAgentLaunch -} from './structured-agent-session-launch' -import { - hasStructuredAgentSessionLaunchCancellationTombstone, - resetStructuredAgentLaunchRegistryForTests -} from './structured-agent-session-launch-registry' -import { resetStructuredAgentSessionSendsForTests } from '@/components/native-chat/session/structured/delivery/structured-agent-session-message-sender' -import { clearNativeChatComposerDraftsForTests as clearNativeChatDraftCacheForTests } from '@/components/native-chat/drafts/native-chat-draft-reset' -import { readNativeChatDraftCache } from '@/components/native-chat/drafts/native-chat-draft-views' -import { structuredAgentSessionDraftScopeKey } from '@/components/native-chat/drafts/native-chat-draft-scope' -import { hasStagedStructuredLaunchPrompt } from './structured-agent-session-launch-prompt' -import { resetStructuredAgentLaunchPersistenceForTests } from './structured-agent-session-launch-persistence' - -function launchIntent( - worktreeId: string, - sessionId = `session-${worktreeId}` -): StructuredAgentSessionLaunchIntent { - return { - worktreeId, - executionHostId: 'local', - target: { kind: 'local' }, - sessionId, - agent: 'codex', - params: { - envelope: { - sessionId, - clientOperationId: `operation-${sessionId}`, - expectedRuntimeFence: null, - payloadFingerprint: `fingerprint-${sessionId}` - }, - worktree: `id:${worktreeId}`, - agent: 'codex' - } - } -} - -async function flushLaunchSettlement(): Promise { - for (let i = 0; i < 20; i += 1) { - await Promise.resolve() - } -} - -describe('a close that races a structured launch', () => { - beforeEach(() => { - vi.clearAllMocks() - localStorage.clear() - resetStructuredAgentLaunchPersistenceForTests() - resetStructuredAgentLaunchRegistryForTests() - resetStructuredAgentSessionSendsForTests() - clearNativeChatDraftCacheForTests() - mocks.rendererTabs = {} - mocks.listeners.clear() - mocks.createIntent.mockImplementation((worktreeId: string, agent: 'claude' | 'codex') => { - const intent = launchIntent(worktreeId, `${agent}-session-${worktreeId}`) - return { ...intent, agent, params: { ...intent.params, agent } } - }) - mocks.retryIntent.mockImplementation((intent: StructuredAgentSessionLaunchIntent) => ({ - ...intent, - params: { - ...intent.params, - envelope: { - ...intent.params.envelope, - clientOperationId: `${intent.params.envelope.clientOperationId}-retry` - } - } - })) - mocks.callStructuredAgentSession.mockResolvedValue({ - ok: true, - page: { fence: 1 } - }) - mocks.callRuntimeRpc.mockResolvedValue({ - ok: true, - value: { submission: { dispatchState: 'accepted' } } - }) - }) - - it('cancels a close-racing unknown launch without retrying or toasting', async () => { - const worktreeId = 'wt-close-race' - const intent = launchIntent(worktreeId, 'session-close-race') - let resolveRefresh!: (snapshots: RuntimeMobileSessionTabsResult[]) => void - mocks.createIntent.mockReturnValueOnce(intent) - mocks.launch.mockRejectedValueOnce(new Error('response lost')) - vi.mocked(refreshLocalStructuredSessionTabs).mockImplementationOnce( - () => new Promise((resolve) => (resolveRefresh = resolve)) - ) - - startStructuredAgentLaunch(worktreeId, 'codex', { requestId: 'request-1' }) - await vi.waitFor(() => expect(refreshLocalStructuredSessionTabs).toHaveBeenCalledOnce()) - expect(cancelStructuredAgentLaunch(worktreeId, intent.sessionId)).toBe(true) - const persistedTombstones = - localStorage.getItem('orca:structuredAgentLaunchCancelledSessions:v1') ?? '' - if (ORCA_LAYOUT_OWNER_IS_MAIN) { - // This machine's main hears the cancel at once and fences the chat; the window keeps none. - expect( - hasStructuredAgentSessionLaunchCancellationTombstone(worktreeId, intent.sessionId) - ).toBe(false) - expect(persistedTombstones).not.toContain(JSON.stringify(intent.sessionId)) - expect(mocks.callStructuredAgentSession).toHaveBeenCalledWith( - { kind: 'local' }, - 'agentSession.close', - { sessionId: intent.sessionId } - ) - expect(mocks.callRuntimeRpc).toHaveBeenCalledWith( - { kind: 'local' }, - 'session.tabs.close', - expect.objectContaining({ tabId: `agent-session:${intent.sessionId}` }) - ) - } else { - expect( - hasStructuredAgentSessionLaunchCancellationTombstone(worktreeId, intent.sessionId) - ).toBe(true) - expect(persistedTombstones).toContain(JSON.stringify(intent.sessionId)) - expect(persistedTombstones).not.toContain(worktreeId) - } - resolveRefresh([]) - await flushLaunchSettlement() - - expect(mocks.launch).toHaveBeenCalledOnce() - expect(mocks.abandonIntent).toHaveBeenCalledWith(intent) - expect(toast.error).not.toHaveBeenCalled() - }) - - it("discards a repeated request's one staged prompt when a close cancels the launch", async () => { - const worktreeId = 'wt-close-coalesced-prompts' - const intent = launchIntent(worktreeId) - let resolveRefresh!: (snapshots: RuntimeMobileSessionTabsResult[]) => void - mocks.createIntent.mockReturnValueOnce(intent) - mocks.launch.mockRejectedValueOnce(new Error('response lost')) - vi.mocked(refreshLocalStructuredSessionTabs).mockImplementationOnce( - () => new Promise((resolve) => (resolveRefresh = resolve)) - ) - - startStructuredAgentLaunch(worktreeId, 'codex', { - requestId: 'double-click', - prompt: 'first prompt' - }) - startStructuredAgentLaunch(worktreeId, 'codex', { - requestId: 'double-click', - prompt: 'first prompt' - }) - await vi.waitFor(() => expect(refreshLocalStructuredSessionTabs).toHaveBeenCalledOnce()) - expect(hasStagedStructuredLaunchPrompt(intent.sessionId)).toBe(true) - - expect(cancelStructuredAgentLaunch(worktreeId, intent.sessionId)).toBe(true) - expect(hasStagedStructuredLaunchPrompt(intent.sessionId)).toBe(false) - resolveRefresh([]) - await flushLaunchSettlement() - - // Closed-chat text is neither sent nor returned; layout-owner cancellation only retires it on main. - expect(mocks.callRuntimeRpc.mock.calls.map(([, method]) => method)).toEqual( - ORCA_LAYOUT_OWNER_IS_MAIN ? ['session.tabs.close'] : [] - ) - expect(readNativeChatDraftCache(structuredAgentSessionDraftScopeKey(intent.sessionId))).toBe('') - }) - - it('suppresses a close that races the retry verification catch', async () => { - const worktreeId = 'wt-retry-close-race' - const intent = launchIntent(worktreeId, 'session-retry-close-race') - let resolveRetryRefresh!: (snapshots: RuntimeMobileSessionTabsResult[]) => void - mocks.createIntent.mockReturnValueOnce(intent) - mocks.launch - .mockRejectedValueOnce(new Error('first response lost')) - .mockRejectedValueOnce(new Error('retry response lost')) - vi.mocked(refreshLocalStructuredSessionTabs) - .mockResolvedValueOnce([]) - .mockImplementationOnce(() => new Promise((resolve) => (resolveRetryRefresh = resolve))) - - startStructuredAgentLaunch(worktreeId, 'codex', { requestId: 'request-4' }) - await vi.waitFor(() => expect(refreshLocalStructuredSessionTabs).toHaveBeenCalledTimes(2)) - expect(cancelStructuredAgentLaunch(worktreeId, intent.sessionId)).toBe(true) - resolveRetryRefresh([]) - await flushLaunchSettlement() - - expect(mocks.launch).toHaveBeenCalledTimes(2) - expect(mocks.abandonIntent).toHaveBeenCalledWith(intent) - expect(toast.error).not.toHaveBeenCalled() - }) -}) diff --git a/src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-create-call.ts b/src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-create-call.ts index c932fab7f80..7e8fa3e4926 100644 --- a/src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-create-call.ts +++ b/src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-create-call.ts @@ -3,10 +3,6 @@ import { AGENT_SESSION_SEND_SELECTION_RUNTIME_CAPABILITY, AGENT_SESSION_SEND_SKILLS_RUNTIME_CAPABILITY } from '../../../../../shared/agent-session/agent-session-create-capabilities' -import type { - AgentSessionAttachResult, - AgentSessionMutationResult -} from '../../../../../shared/agent-session/agent-session-wire' import { hasRuntimeRpcErrorCode } from '../../../../../shared/runtime-rpc-error-code' import { isAgentSessionCreateAdmissionRefusal, @@ -21,21 +17,17 @@ import { structuredAgentSessionHostSupports, supportsStructuredAgentSessionCreateMessage } from '@/runtime/native-chat/host-capabilities/structured-agent-session-host-support' -import type { StructuredAgentSessionCreateParams } from '../../../../../shared/agent-session/structured-agent-session-create' import { withFrameDrawnChatTabPlacement } from '../../../store/workspace-layout/frames/frame-drawn-chat-tab-placement' import { publishStructuredAgentSessionCreateHydration } from './structured-agent-session-create-hydration' import { askHostCreateSupport } from './structured-agent-session-host-admission' import { readStructuredChatHostPermissionVerdict } from '@/runtime/native-chat/host-capabilities/structured-chat-host-permission' -import type { StructuredAgentSessionLaunchIntent } from '../../launch-structured-agent-session' import { abandonStructuredAgentSessionLaunchIntent } from './structured-agent-session-launch-abandon' -import type { StructuredAgentLaunchReceipt } from './structured-agent-session-launch-recovery' import { StructuredAgentSessionCreateError, StructuredAgentSessionCreateAbandonedError, StructuredAgentSessionCreateRefusalError, StructuredAgentSessionCreateUnknownOutcomeError } from './structured-agent-session-launch-errors' - import { requireHostForkSupport, inheritedForkCreateOptions, @@ -45,6 +37,14 @@ import { RuntimeConnectionChangedBeforeSendError, RuntimeRpcCallError } from '@/runtime/rpc/calls/runtime-rpc-result' +import type { + AgentSessionAttachResult, + AgentSessionMutationResult +} from '../../../../../shared/agent-session/agent-session-wire' +import type { StructuredAgentSessionCreateParams } from '../../../../../shared/agent-session/structured-agent-session-create' +import type { StructuredAgentSessionLaunchIntent } from './structured-agent-session-launch-intent' +import type { StructuredAgentLaunchReceipt } from './structured-agent-session-launch-recovery' + export { STRUCTURED_LAUNCH_FORK_UNSUPPORTED_REFUSAL } from './structured-agent-session-launch-fork-support' type LaunchSeed = Readonly> | undefined diff --git a/src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-different-request.test.ts b/src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-different-request.test.ts index abf123e89b8..cf0af558632 100644 --- a/src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-different-request.test.ts +++ b/src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-different-request.test.ts @@ -5,12 +5,22 @@ import { readNativeChatComposerDraft, updateNativeChatComposerDraft } from '@/components/native-chat/drafts/native-chat-composer-draft-store' -// @vitest-environment happy-dom import { structuredAgentSessionDraftScopeKey } from '@/components/native-chat/drafts/native-chat-draft-scope' -import type * as LaunchErrors from '@/lib/agent-session/launch/structured-agent-session-launch-errors' import { beforeEach, describe, expect, it, vi } from 'vitest' +import { refreshLocalStructuredSessionTabs } from '@/runtime/local-structured-session-tabs-sync/inventory-refresh' +import { resetStructuredAgentSessionSendsForTests } from '@/components/native-chat/session/structured/delivery/structured-agent-session-message-sender' +import { clearNativeChatComposerDraftsForTests as clearNativeChatDraftCacheForTests } from '@/components/native-chat/drafts/native-chat-draft-reset' +import { resetStructuredAgentLaunchRegistryForTests } from './structured-agent-session-launch-registry' +import { startStructuredAgentLaunch } from './structured-agent-session-launch' +import { + discardStructuredLaunchPrompts, + hasStagedStructuredLaunchPrompt +} from './structured-agent-session-launch-prompt' +import { resetStructuredAgentLaunchPersistenceForTests } from './structured-agent-session-launch-persistence' +import type * as LaunchErrors from '@/lib/agent-session/launch/structured-agent-session-launch-errors' import type { RuntimeMobileSessionTabsResult } from '../../../../../shared/runtime-session-contracts' -import type { StructuredAgentSessionLaunchIntent } from '@/lib/launch-structured-agent-session' +import type { StructuredAgentSessionLaunchIntent } from '@/lib/agent-session/launch/structured-agent-session-launch-intent' +// @vitest-environment happy-dom const mocks = vi.hoisted(() => ({ abandonIntent: vi.fn(), @@ -41,18 +51,21 @@ vi.mock('@/lib/agent-session/launch/structured-agent-session-launch-create-call' launchStructuredAgentSession: mocks.launch })) -vi.mock('@/lib/launch-structured-agent-session', () => { +vi.mock('@/lib/agent-session/launch/structured-agent-session-launch-intent', () => { return { createStructuredAgentSessionLaunchIntent: mocks.createIntent, retryStructuredAgentSessionLaunchIntent: mocks.retryIntent, restoreStructuredAgentSessionLaunchIntent: mocks.restoreIntent, - abandonStructuredAgentSessionLaunchIntent: mocks.abandonIntent, launchStructuredAgentSession: mocks.launch, StructuredAgentSessionCreateRefusalError: launchErrorMocks.StructuredAgentSessionCreateRefusalError } }) +vi.mock('@/lib/agent-session/launch/structured-agent-session-launch-abandon', () => ({ + abandonStructuredAgentSessionLaunchIntent: mocks.abandonIntent +})) + vi.mock('@/runtime/local-structured-session-tabs-sync/inventory-refresh', () => ({ refreshLocalStructuredSessionTabs: vi.fn() })) @@ -90,17 +103,6 @@ vi.mock('@/lib/agent-catalog/agent-catalog', () => ({ getAgentCatalog: () => [{ id: 'codex', label: 'Codex' }] })) -import { refreshLocalStructuredSessionTabs } from '@/runtime/local-structured-session-tabs-sync/inventory-refresh' -import { resetStructuredAgentSessionSendsForTests } from '@/components/native-chat/session/structured/delivery/structured-agent-session-message-sender' -import { clearNativeChatComposerDraftsForTests as clearNativeChatDraftCacheForTests } from '@/components/native-chat/drafts/native-chat-draft-reset' -import { resetStructuredAgentLaunchRegistryForTests } from './structured-agent-session-launch-registry' -import { startStructuredAgentLaunch } from './structured-agent-session-launch' -import { - discardStructuredLaunchPrompts, - hasStagedStructuredLaunchPrompt -} from './structured-agent-session-launch-prompt' -import { resetStructuredAgentLaunchPersistenceForTests } from './structured-agent-session-launch-persistence' - const WORKTREE_ID = 'wt-different-request' function launchIntent(sessionId: string): StructuredAgentSessionLaunchIntent { @@ -424,14 +426,4 @@ describe('an action with text beside an empty chat still starting', () => { } expect(sends()).toEqual([[second.sessionId, 'review notes']]) }) - - it('leaves the empty chat to its own pick, whose re-delivery still joins it', () => { - const blank = startStructuredAgentLaunch(WORKTREE_ID, 'codex', { requestId: 'plus-pick' }) - startStructuredAgentLaunch(WORKTREE_ID, 'codex', notesSend) - - const again = startStructuredAgentLaunch(WORKTREE_ID, 'codex', { requestId: 'plus-pick' }) - - expect(again.sessionId).toBe(blank.sessionId) - expect(mocks.createIntent).toHaveBeenCalledTimes(2) - }) }) diff --git a/src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-fork-support.ts b/src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-fork-support.ts index a1178a0b925..3640b32bf47 100644 --- a/src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-fork-support.ts +++ b/src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-fork-support.ts @@ -6,21 +6,21 @@ import { AGENT_SESSION_AGENTS_METHOD, decodeAgentSessionAgentsResult } from '../../../../../shared/agent-session/agent-session-registered-agents' -import type { - AgentSessionHistoryPage, - AgentSessionHistoryResult -} from '../../../../../shared/agent-session/agent-session-wire' -import type { AgentJournalRenderItem } from '../../../../../shared/agent-session/journal/agent-session-journal-types' import { nativeChatForkRequiresInheritedOriginal } from '../../../../../shared/native-chat/native-chat-fork-offer' import { runtimeEnvironmentCapabilityProof } from '@/runtime/rpc/compatibility/runtime-capability-proof' import { callStructuredAgentSession } from '@/runtime/native-chat/requests/structured-agent-session-call' import { structuredAgentSessionHostCapabilityState } from '@/runtime/native-chat/host-capabilities/structured-agent-session-host-support' -import type { StructuredAgentSessionLaunchIntent } from '../../launch-structured-agent-session' import { abandonStructuredAgentSessionLaunchIntent } from './structured-agent-session-launch-abandon' import { StructuredAgentSessionCreateRefusalError, StructuredAgentSessionCreateUnknownOutcomeError } from './structured-agent-session-launch-errors' +import type { + AgentSessionHistoryPage, + AgentSessionHistoryResult +} from '../../../../../shared/agent-session/agent-session-wire' +import type { AgentJournalRenderItem } from '../../../../../shared/agent-session/journal/agent-session-journal-types' +import type { StructuredAgentSessionLaunchIntent } from './structured-agent-session-launch-intent' /** The refusal a fork gets from a host that does not advertise forks; nothing was sent to it. */ export const STRUCTURED_LAUNCH_FORK_UNSUPPORTED_REFUSAL = diff --git a/src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-fork.test.ts b/src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-fork.test.ts index d4b06325f99..8d4ac8d9da2 100644 --- a/src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-fork.test.ts +++ b/src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-fork.test.ts @@ -1,15 +1,22 @@ // @vitest-environment happy-dom -import { CreateIntentParams } from '../../../../../shared/rpc-contract/structured-agent-session-params' -import type { AgentSessionWireRefusal } from '../../../../../shared/agent-session/failures/agent-session-wire-refusals' +import '../../../../../shared/rpc-contract/structured-agent-session-params' import { getStructuredAgentSessionLaunchLifecycle } from './structured-agent-session-launch-registry' import { afterEach, beforeEach, expect, it, vi } from 'vitest' import { mocks, resetCreateMessageFixture, - cleanupCreateMessageFixture, - created + cleanupCreateMessageFixture } from './structured-agent-session-launch-create-message.test-fixture' import { startStructuredAgentLaunch } from './structured-agent-session-launch' +import '@/web/preload-api/web-runtime-calls' +import { clearRuntimeCompatibilityCache } from '@/runtime/rpc/compatibility/runtime-compatibility-cache' +import '@/runtime/rpc/environment-revisions/runtime-environment-revision' +import '../../../../../shared/agent-session/agent-session-create-capabilities' +import './structured-agent-session-launch-recovery' +import '@/lib/agent-session/launch/structured-agent-session-launch-intent' +import type { AgentSessionWireRefusal } from '../../../../../shared/agent-session/failures/agent-session-wire-refusals' +import type { callStructuredAgentSession as StructuredCall } from '@/runtime/native-chat/requests/structured-agent-session-call' +import type { callRuntimeRpc as RuntimeCall } from '@/runtime/rpc/calls/runtime-rpc-call' const browserSession = vi.hoisted(() => ({ client: { connectionEpoch: 1, call: vi.fn() }, @@ -23,7 +30,6 @@ vi.mock('@/web/preload-api/web-runtime-session', () => ({ runtimeCallQueuePool: { enqueue: (_id: string, _method: string, run: () => unknown) => run() }, updateEnvironmentFromResponse: () => undefined })) -import { callWebRuntimeEnvironment } from '@/web/preload-api/web-runtime-calls' let restore: (() => void) | undefined beforeEach(() => { @@ -35,21 +41,7 @@ afterEach(() => { clearRuntimeCompatibilityCache() }) -const forkFrom = { sessionId: 'codex_source', throughItemId: 'item-reply-2' } - -it('sends no fork to a host that does not advertise forks', async () => { - mocks.exactSupport.mockResolvedValue(false) - const launch = startStructuredAgentLaunch('workspace-fork', 'codex', { - requestId: 'fork-action', - executionHostId: 'local', - forkFrom, - forkRequiresInheritedOriginal: false - }) - await expect(launch.launchResult).rejects.toMatchObject({ - code: 'structured_agent_session_fork_unsupported' - }) - expect(mocks.call.mock.calls.some(([, method]) => method === 'agentSession.create')).toBe(false) -}) +void { sessionId: 'codex_source', throughItemId: 'item-reply-2' } const copiedReply = { sessionId: 'copied-chat', @@ -146,85 +138,20 @@ it('keeps an earlier lost create unknown when the retry proves the original is m ) }) -import type { callStructuredAgentSession as StructuredCall } from '@/runtime/native-chat/requests/structured-agent-session-call' -import type { callRuntimeRpc as RuntimeCall } from '@/runtime/rpc/calls/runtime-rpc-call' // Real launch, capability cache, structured-call wrapper and RPC options, up to the IPC boundary. -import { - compatibilityEntry, - runtimeCompatibilityChecks, - clearRuntimeCompatibilityCache -} from '@/runtime/rpc/compatibility/runtime-compatibility-cache' -import { replaceRuntimeEnvironmentRevisions } from '@/runtime/rpc/environment-revisions/runtime-environment-revision' -import { AGENT_SESSION_CREATE_FORK_ORIGINAL_RUNTIME_CAPABILITY } from '../../../../../shared/agent-session/agent-session-create-capabilities' -import type { RuntimeClientTarget } from '../../../../../shared/runtime-client-target' -import type { RuntimeRpcResponse } from '../../../../../shared/runtime-rpc-envelope' -import type { RuntimeStatus } from '../../../../../shared/runtime-session-contracts' -import { - launchAndReconcile, - reconcileUnknownLaunch -} from './structured-agent-session-launch-recovery' -import { - createStructuredAgentSessionLaunchIntent, - retryStructuredAgentSessionLaunchIntent, - restoreStructuredAgentSessionLaunchIntent -} from '@/lib/launch-structured-agent-session' -const { callStructuredAgentSession } = await vi.importActual<{ - callStructuredAgentSession: typeof StructuredCall -}>('@/runtime/native-chat/requests/structured-agent-session-call') -const { callRuntimeRpc } = await vi.importActual<{ callRuntimeRpc: typeof RuntimeCall }>( - '@/runtime/rpc/calls/runtime-rpc-call' -) +void ( + await vi.importActual<{ + callStructuredAgentSession: typeof StructuredCall + }>('@/runtime/native-chat/requests/structured-agent-session-call') +).callStructuredAgentSession +void ( + await vi.importActual<{ callRuntimeRpc: typeof RuntimeCall }>( + '@/runtime/rpc/calls/runtime-rpc-call' + ) +).callRuntimeRpc -async function remoteForkTransport() { - vi.useRealTimers() - mocks.exactSupport.mockResolvedValue(true) - mocks.inventory.mockResolvedValue([]) - mocks.call.mockImplementation( - (target, method, params, ...options: [Parameters[3]?]) => { - // oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: the production wrapper receives the typed launch target. - return callStructuredAgentSession(target as RuntimeClientTarget, method, params, ...options) - } - ) - mocks.rpc.mockImplementation(callRuntimeRpc) - replaceRuntimeEnvironmentRevisions([{ id: 'paired', createdAt: 7, pairingRevision: 7 }]) - // oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: the positive cache entry is consumed only for capability/compatibility. - const status = { - runtimeId: 'runtime-a', - capabilities: [AGENT_SESSION_CREATE_FORK_ORIGINAL_RUNTIME_CAPABILITY] - } as RuntimeStatus - runtimeCompatibilityChecks.set('paired', compatibilityEntry(status)) - const call = vi.fn(async (request): Promise> => { - if (request.method !== 'agentSession.create') { - throw new Error('No child read expected') - } - return { id: request.method, ok: true, result: created(), _meta: { runtimeId: 'runtime-a' } } - }) - vi.stubGlobal('window', { ...window, api: { ...window.api, runtimeEnvironments: { call } } }) - return call -} -function inheritedIntent() { - const intent = createStructuredAgentSessionLaunchIntent( - 'workspace-fork', - 'opencode', - 'runtime:paired', - undefined, - undefined, - true, - { sessionId: 'copied-chat', throughItemId: 'legacy:opencode:source:reply-1' } - ) - intent.forkRequiresInheritedOriginal = true - return intent -} -function recoveryState(intent = inheritedIntent()) { - return { - intent, - promise: Promise.resolve({ sessionId: '', fence: 0 }), - visibilityUnknown: false, - cancelled: false - } -} -const restartedRuntime = { +void ({ id: 'agentSession.create', ok: false, error: { @@ -232,215 +159,4 @@ const restartedRuntime = { message: 'Runtime environment identity changed; refresh and try again' }, _meta: { runtimeId: 'runtime-b' } -} as const - -it('settles a pinned pre-dispatch runtime replacement definitively, and keeps the requirement on Retry', async () => { - const call = await remoteForkTransport() - // Recorded no-send response from the sending-socket guard, exercised in the transport suites. - call.mockResolvedValueOnce(restartedRuntime) - const launch = startStructuredAgentLaunch('workspace-fork', 'opencode', { - requestId: 'bound-fork', - executionHostId: 'runtime:paired', - forkFrom: { sessionId: 'copied-chat', throughItemId: 'legacy:opencode:source:reply-1' }, - forkRequiresInheritedOriginal: true - }) - await expect(launch.launchResult).rejects.toMatchObject({ - code: 'runtime_unavailable' - }) - expect(launch.isVisibilityUnknown()).toBe(false) - expect(getStructuredAgentSessionLaunchLifecycle('workspace-fork', launch.sessionId)).toBe( - 'failed' - ) - expect(call).toHaveBeenCalledWith( - expect.objectContaining({ - method: 'agentSession.create', - expectedEnvironmentRuntimeId: 'runtime-a', - expectedEnvironmentPairingRevision: 7 - }) - ) - - // Each retry must reacquire proof rather than retain the prior runtime tuple. - const current = runtimeCompatibilityChecks.get('paired')! - runtimeCompatibilityChecks.set( - 'paired', - compatibilityEntry({ ...current.status!, runtimeId: 'runtime-c' }) - ) - const state = recoveryState(retryStructuredAgentSessionLaunchIntent(inheritedIntent())) - await expect(launchAndReconcile(state)).resolves.toMatchObject({ fence: 1 }) - expect(call).toHaveBeenLastCalledWith( - expect.objectContaining({ - method: 'agentSession.create', - expectedEnvironmentRuntimeId: 'runtime-c', - expectedEnvironmentPairingRevision: 7, - params: expect.objectContaining({ - forkFrom: { sessionId: 'copied-chat', throughItemId: 'legacy:opencode:source:reply-1' } - }) - }) - ) - runtimeCompatibilityChecks.set( - 'paired', - compatibilityEntry({ ...current.status!, capabilities: [] }) - ) - await expect(launchAndReconcile(recoveryState(inheritedIntent()))).rejects.toMatchObject({ - code: 'structured_agent_session_fork_unsupported' - }) - const ordinary = createStructuredAgentSessionLaunchIntent( - 'workspace-fork', - 'opencode', - 'runtime:paired', - undefined, - undefined, - true, - { sessionId: 'child', throughItemId: 'legacy:opencode:child:reply-2' } - ) - ordinary.forkRequiresInheritedOriginal = false - await expect(launchAndReconcile(recoveryState(ordinary))).resolves.toMatchObject({ fence: 1 }) -}) - -it('reconciles a lost create first and retains uncertainty when a later proof cannot send', async () => { - const call = await remoteForkTransport() - const state = recoveryState() - call.mockImplementationOnce(async () => { - clearRuntimeCompatibilityCache() - throw new Error('create reply lost') - }) - await expect(launchAndReconcile(state)).rejects.toMatchObject({ code: 'runtime_unavailable' }) - expect(state.visibilityUnknown).toBe(true) - // Once publication arrives, recovery succeeds even though the capability read would still fail. - mocks.inventory.mockResolvedValue([ - { - worktree: 'workspace-fork', - tabs: [{ type: 'agent-session', sessionId: state.intent.sessionId }] - } - ]) - mocks.call.mockImplementation(async (_target, method) => { - if (method === 'agentSession.history') { - return { ok: true, page: { ...created().value.page, sessionId: state.intent.sessionId } } - } - throw new Error('No create or capability read during reconciliation') - }) - await expect(reconcileUnknownLaunch(state, true)).resolves.toMatchObject({ - sessionId: state.intent.sessionId, - fence: 1 - }) -}) - -it('rederives a restored ancestor fork requirement from the child before resubmitting', async () => { - const call = await remoteForkTransport() - const prior = inheritedIntent() - const restored = restoreStructuredAgentSessionLaunchIntent({ - worktreeId: prior.worktreeId, - executionHostId: prior.executionHostId, - agent: prior.agent, - ...prior.params.envelope, - forkFrom: prior.params.forkFrom - }) - const base = created(CreateIntentParams.parse(prior.params)).value.page - mocks.call.mockImplementation( - async (target, method, params, ...rest: [Parameters[3]?]) => { - if (method === 'agentSession.agents') { - return { agents: [{ agent: 'opencode', capabilities: { fork: 'tip' } }] } - } - if (method === 'agentSession.history') { - return { - ok: true, - page: { - ...base, - sessionId: 'copied-chat', - items: [ - { - itemId: 'source-u1', - sequence: 1, - body: { kind: 'message', role: 'user', blocks: [] } - }, - { - itemId: 'legacy:opencode:source:reply-1', - sequence: 2, - body: { kind: 'message', role: 'assistant', blocks: [] } - }, - { - itemId: 'parent-fork-u2', - sequence: 3, - body: { kind: 'message', role: 'user', blocks: [] } - }, - { - itemId: 'legacy:opencode:parent-fork:reply-2', - sequence: 4, - body: { kind: 'message', role: 'assistant', blocks: [] } - }, - { - itemId: 'orca:forked-from', - sequence: 5, - body: { kind: 'status', presentation: 'forked-from', text: 'Forked from source' } - }, - { - itemId: 'child-u3', - sequence: 6, - body: { kind: 'message', role: 'user', blocks: [] } - }, - { - itemId: 'legacy:opencode:child:reply-3', - sequence: 7, - body: { kind: 'message', role: 'assistant', blocks: [] } - } - ] - } - } - } - // oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: the production wrapper receives the typed launch target. - return callStructuredAgentSession(target as RuntimeClientTarget, method, params, ...rest) - } - ) - await expect(reconcileUnknownLaunch(recoveryState(restored), true)).resolves.toMatchObject({ - fence: 1 - }) - expect(call).toHaveBeenLastCalledWith( - expect.objectContaining({ - expectedEnvironmentRuntimeId: 'runtime-a', - expectedEnvironmentPairingRevision: 7 - }) - ) -}) - -it('settles a browser pin refusal before dispatch but keeps a lost browser reply uncertain', async () => { - const call = await remoteForkTransport() - call.mockImplementation(callWebRuntimeEnvironment) - browserSession.client.connectionEpoch = 1 - browserSession.client.call.mockReset() - browserSession.client.call.mockImplementation(async (method) => { - if (method !== 'status.get') { - throw new Error('Unexpected create dispatch') - } - return { id: 'status', ok: true, result: {}, _meta: { runtimeId: 'runtime-b' } } - }) - const state = recoveryState() - await expect(launchAndReconcile(state)).rejects.toMatchObject({ - code: 'runtime_unavailable' - }) - expect(state.visibilityUnknown).toBe(false) - expect(browserSession.client.call.mock.calls.map(([method]) => method)).not.toContain( - 'agentSession.create' - ) - - // The same words in a failed reply are not pre-dispatch evidence. - browserSession.client.connectionEpoch = 2 - browserSession.client.call.mockImplementation(async (method) => { - if (method === 'status.get') { - return { id: 'status', ok: true, result: {}, _meta: { runtimeId: 'runtime-a' } } - } - throw new Error('Runtime connection changed; try again.') - }) - const lost = recoveryState() - await expect(launchAndReconcile(lost)).rejects.toThrow() - expect(lost.visibilityUnknown).toBe(true) -}) - -it('keeps a failed capability read definitive without classifying the host as unsupported', async () => { - const call = await remoteForkTransport() - clearRuntimeCompatibilityCache() - call.mockRejectedValue(new Error('status read failed')) - const state = recoveryState() - await expect(launchAndReconcile(state)).rejects.toMatchObject({ code: 'runtime_unavailable' }) - expect(state.visibilityUnknown).toBe(false) - expect(call.mock.calls.map(([request]) => request.method)).not.toContain('agentSession.create') -}) +} as const) diff --git a/src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-host-seed.ts b/src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-host-seed.ts new file mode 100644 index 00000000000..e997d6fd522 --- /dev/null +++ b/src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-host-seed.ts @@ -0,0 +1,24 @@ +import { notifyStructuredLaunchListeners } from './structured-agent-session-launch-registry' +import type { StructuredLaunchState } from './structured-agent-session-launch-registry' + +/** Each attempt's probe names the seed the paired server's create will use; the picker shows it. */ +export function adoptPairedHostSeed( + state: StructuredLaunchState, + seedOptions: StructuredLaunchState['selection']['seed'] +): void { + // The support answer is a fresh seed; continuation baseline belongs to actual host create. + if (state.intent.params.resumeFrom || state.intent.params.forkFrom) { + seedOptions = undefined + } + const { seedPending, ...selection } = state.selection + if (!seedPending && JSON.stringify(seedOptions) === JSON.stringify(state.intent.seedOptions)) { + return + } + if (seedOptions) { + state.intent.seedOptions = seedOptions + } else { + delete state.intent.seedOptions + } + state.selection = { ...selection, seed: seedOptions } + notifyStructuredLaunchListeners(state.intent.sessionId) +} diff --git a/src/renderer/src/lib/launch-structured-agent-session.ts b/src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-intent.ts similarity index 82% rename from src/renderer/src/lib/launch-structured-agent-session.ts rename to src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-intent.ts index fb9f078ca45..d3d38a4e754 100644 --- a/src/renderer/src/lib/launch-structured-agent-session.ts +++ b/src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-intent.ts @@ -1,17 +1,17 @@ -import type { StructuredLaunchSurfaceAddress } from './agent-session/launch/structured-agent-session-launch-record' -import type { TuiAgent } from '../../../shared/agent-launch/catalog/tui-agent' import { createStructuredAgentSessionId, - structuredAgentSessionCreateParams, - type StructuredAgentSessionCreateParams, - type StructuredAgentSessionFirstMessage, - type StructuredAgentSessionForkSource, - type StructuredAgentSessionResumeSource -} from '../../../shared/agent-session/structured-agent-session-create' -import { createStructuredAgentSessionOperationId } from '../../../shared/agent-session/lifecycle/structured-agent-session-mutation' -import { structuredLaunchSeedOptions } from '../../../shared/native-chat/input/native-chat-session-option-defaults' + structuredAgentSessionCreateParams +} from '../../../../../shared/agent-session/structured-agent-session-create' +import type { + StructuredAgentSessionCreateParams, + StructuredAgentSessionFirstMessage, + StructuredAgentSessionForkSource, + StructuredAgentSessionResumeSource +} from '../../../../../shared/agent-session/structured-agent-session-create' +import { createStructuredAgentSessionOperationId } from '../../../../../shared/agent-session/lifecycle/structured-agent-session-mutation' +import { structuredLaunchSeedOptions } from '../../../../../shared/native-chat/input/native-chat-session-option-defaults' import { toRuntimeWorktreeSelector } from '@/runtime/rpc/targets/runtime-worktree-selector' -import { useAppStore } from '@/store' +import { useAppStore } from '@/store/index' import { recordWebSessionFocusIntent, resolveWebSessionVisibleTabId @@ -21,21 +21,15 @@ import { structuredAgentSessionFocusOwner, structuredAgentSessionTargetForHost } from '@/runtime/native-chat/session-ownership/structured-agent-session-owner' -import type { RuntimeClientTarget } from '../../../shared/runtime-client-target' -import type { ExecutionHostId } from '../../../shared/execution-host' -import { createNonSecureContextUuid as createBrowserUuid } from '../../../shared/non-secure-context-uuid' -import { - StructuredAgentSessionCreateRefusalError, - StructuredAgentSessionCreateUnknownOutcomeError, - StructuredAgentSessionOwnerUnresolvedError, - type StructuredAgentSessionCreateGate -} from '@/lib/agent-session/launch/structured-agent-session-launch-errors' - -export { - StructuredAgentSessionCreateRefusalError, - StructuredAgentSessionCreateUnknownOutcomeError, - StructuredAgentSessionOwnerUnresolvedError -} +import { createNonSecureContextUuid } from '../../../../../shared/non-secure-context-uuid' +import { StructuredAgentSessionOwnerUnresolvedError } from '@/lib/agent-session/launch/structured-agent-session-launch-errors' +import type { StructuredAgentSessionCreateGate } from '@/lib/agent-session/launch/structured-agent-session-launch-errors' +import './structured-agent-session-launch-abandon' +import './structured-agent-session-launch-create-call' +import type { StructuredLaunchSurfaceAddress } from './structured-agent-session-launch-record' +import type { TuiAgent } from '../../../../../shared/agent-launch/catalog/tui-agent' +import type { RuntimeClientTarget } from '../../../../../shared/runtime-client-target' +import type { ExecutionHostId } from '../../../../../shared/execution-host' export type StructuredAgentSessionLaunchIntent = { sessionId: string @@ -107,7 +101,7 @@ export function createStructuredAgentSessionLaunchIntent( worktreeId, executionHostId ?? resolveStructuredAgentSessionOwner(useAppStore.getState(), worktreeId) ) - const sessionId = createStructuredAgentSessionId(agent, createBrowserUuid) + const sessionId = createStructuredAgentSessionId(agent, createNonSecureContextUuid) if (activate) { recordWebSessionFocusIntent( structuredAgentSessionFocusOwner(owner.target), @@ -150,7 +144,7 @@ function buildStructuredAgentSessionLaunchIntent( agent, ...(resumeFrom ? { resumeFrom } : {}), ...(forkFrom ? { forkFrom } : {}), - randomUuid: createBrowserUuid + randomUuid: createNonSecureContextUuid }), ...(forkFrom ? {} : launchSeedOptions(state, owner, agent, hostSeedOptions, resumeFrom)) } @@ -171,7 +165,7 @@ export function retryStructuredAgentSessionLaunchIntent( ...intent.params, envelope: { ...intent.params.envelope, - clientOperationId: createStructuredAgentSessionOperationId(createBrowserUuid) + clientOperationId: createStructuredAgentSessionOperationId(createNonSecureContextUuid) } } } @@ -247,10 +241,3 @@ export function restoreStructuredAgentSessionLaunchIntent(args: { : launchSeedOptions(state, { target }, args.agent, args.seedOptions, args.resumeFrom)) } } - -export { abandonStructuredAgentSessionLaunchIntent } from './agent-session/launch/structured-agent-session-launch-abandon' - -export { - launchStructuredAgentSession, - type StructuredLaunchHostSeedListener -} from './agent-session/launch/structured-agent-session-launch-create-call' diff --git a/src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-join-delivery.test.ts b/src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-join-delivery.test.ts index 90b6e41dfe5..a69fb0143e6 100644 --- a/src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-join-delivery.test.ts +++ b/src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-join-delivery.test.ts @@ -1,13 +1,17 @@ // @vitest-environment happy-dom // @vitest-environment happy-dom import { readNativeChatComposerDraft } from '@/components/native-chat/drafts/native-chat-composer-draft-store' -// @vitest-environment happy-dom import { structuredAgentSessionDraftScopeKey } from '@/components/native-chat/drafts/native-chat-draft-scope' - -import type * as LaunchErrors from '@/lib/agent-session/launch/structured-agent-session-launch-errors' import { beforeEach, describe, expect, it, vi } from 'vitest' +import { refreshLocalStructuredSessionTabs } from '@/runtime/local-structured-session-tabs-sync/inventory-refresh' +import { startStructuredAgentLaunch } from './structured-agent-session-launch' +import { hasStagedStructuredLaunchPrompt } from './structured-agent-session-launch-prompt' +import type * as LaunchErrors from '@/lib/agent-session/launch/structured-agent-session-launch-errors' import type { RuntimeMobileSessionTabsResult } from '../../../../../shared/runtime-session-contracts' import type * as RecoveryModule from '@/lib/agent-session/launch/structured-agent-session-launch-recovery' +import type { StructuredAgentSessionLaunchIntent } from '@/lib/agent-session/launch/structured-agent-session-launch-intent' +import type { StructuredAgentLaunchOptions } from './structured-agent-session-launch-callers' +// @vitest-environment happy-dom const mocks = vi.hoisted(() => ({ abandonIntent: vi.fn(), @@ -39,16 +43,19 @@ vi.mock('@/lib/agent-session/launch/structured-agent-session-launch-create-call' launchStructuredAgentSession: mocks.launch })) -vi.mock('@/lib/launch-structured-agent-session', () => { +vi.mock('@/lib/agent-session/launch/structured-agent-session-launch-intent', () => { return { createStructuredAgentSessionLaunchIntent: mocks.createIntent, - abandonStructuredAgentSessionLaunchIntent: mocks.abandonIntent, launchStructuredAgentSession: mocks.launch, StructuredAgentSessionCreateRefusalError: launchErrorMocks.StructuredAgentSessionCreateRefusalError } }) +vi.mock('@/lib/agent-session/launch/structured-agent-session-launch-abandon', () => ({ + abandonStructuredAgentSessionLaunchIntent: mocks.abandonIntent +})) + vi.mock('@/lib/agent-session/launch/structured-agent-session-launch-recovery', async () => { const actual = await vi.importActual( '@/lib/agent-session/launch/structured-agent-session-launch-recovery' @@ -96,12 +103,6 @@ vi.mock('@/lib/agent-catalog/agent-catalog', () => ({ getAgentCatalog: () => [{ id: 'codex', label: 'Codex' }] })) -import type { StructuredAgentSessionLaunchIntent } from '@/lib/launch-structured-agent-session' -import { refreshLocalStructuredSessionTabs } from '@/runtime/local-structured-session-tabs-sync/inventory-refresh' -import { startStructuredAgentLaunch } from './structured-agent-session-launch' -import type { StructuredAgentLaunchOptions } from './structured-agent-session-launch-callers' -import { hasStagedStructuredLaunchPrompt } from './structured-agent-session-launch-prompt' - function launchIntent(worktreeId: string, sessionId: string): StructuredAgentSessionLaunchIntent { return { worktreeId, diff --git a/src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-options.test.ts b/src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-options.test.ts index 2759c14d142..5d4d9e82e59 100644 --- a/src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-options.test.ts +++ b/src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-options.test.ts @@ -1,11 +1,23 @@ import { useAppStore } from '@/store/index' -// @vitest-environment happy-dom - -import type * as LaunchErrors from '@/lib/agent-session/launch/structured-agent-session-launch-errors' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' -import type { RuntimeMobileSessionTabsResult } from '../../../../../shared/runtime-session-contracts' -import type { StructuredAgentSessionLaunchIntent } from '@/lib/launch-structured-agent-session' import { RuntimeRpcCallError } from '@/runtime/rpc/calls/runtime-rpc-result' +import '@/lib/agent-session/launch/structured-agent-session-launch-errors' +import type * as LaunchErrors from '@/lib/agent-session/launch/structured-agent-session-launch-errors' +import { refreshLocalStructuredSessionTabs } from '@/runtime/local-structured-session-tabs-sync/inventory-refresh' +import { startStructuredAgentLaunch } from './structured-agent-session-launch' +import { resetStructuredAgentLaunchRegistryForTests } from './structured-agent-session-launch-registry' +import { holdStructuredAgentSessionLaunchOption } from './structured-agent-session-launch-options' +import { resetStructuredAgentLaunchPersistenceForTests } from './structured-agent-session-launch-persistence' +import './structured-agent-session-launch-publication' +import { + registerStructuredSelectionCatalogStore, + forgetStructuredSessionSelection +} from '../options/structured-agent-session-selection-controller' +import '../../../../../shared/agent-session/options/agent-session-option-catalog-claude-codex' +import '../../../../../shared/agent-session/options/structured-agent-session-options' +import type { RuntimeMobileSessionTabsResult } from '../../../../../shared/runtime-session-contracts' +import type { StructuredAgentSessionLaunchIntent } from '@/lib/agent-session/launch/structured-agent-session-launch-intent' +// @vitest-environment happy-dom type CallParams = { envelope?: { expectedRuntimeFence?: number | null } @@ -46,18 +58,21 @@ vi.mock('@/lib/agent-session/launch/structured-agent-session-launch-create-call' launchStructuredAgentSession: mocks.launch })) -vi.mock('@/lib/launch-structured-agent-session', () => { +vi.mock('@/lib/agent-session/launch/structured-agent-session-launch-intent', () => { return { createStructuredAgentSessionLaunchIntent: mocks.createIntent, retryStructuredAgentSessionLaunchIntent: mocks.retryIntent, restoreStructuredAgentSessionLaunchIntent: vi.fn(), - abandonStructuredAgentSessionLaunchIntent: vi.fn(), launchStructuredAgentSession: mocks.launch, StructuredAgentSessionCreateRefusalError: launchErrorMocks.StructuredAgentSessionCreateRefusalError } }) +vi.mock('@/lib/agent-session/launch/structured-agent-session-launch-abandon', () => ({ + abandonStructuredAgentSessionLaunchIntent: vi.fn() +})) + vi.mock('@/runtime/local-structured-session-tabs-sync/inventory-refresh', () => ({ refreshLocalStructuredSessionTabs: vi.fn() })) @@ -87,36 +102,6 @@ vi.mock('@/lib/agent-catalog/agent-catalog', () => ({ getAgentCatalog: () => [{ id: 'codex', label: 'Codex' }] })) -import { StructuredAgentSessionCreateRefusalError } from '@/lib/agent-session/launch/structured-agent-session-launch-errors' -import { refreshLocalStructuredSessionTabs } from '@/runtime/local-structured-session-tabs-sync/inventory-refresh' -import { - cancelStructuredAgentLaunch, - retryStructuredAgentSessionLaunch, - startStructuredAgentLaunch -} from './structured-agent-session-launch' -import { - getStructuredAgentSessionLaunchLifecycle, - resetStructuredAgentLaunchRegistryForTests -} from './structured-agent-session-launch-registry' -import { - getStructuredAgentSessionLaunchSelection, - holdStructuredAgentSessionLaunchOption -} from './structured-agent-session-launch-options' -import { resetStructuredAgentLaunchPersistenceForTests } from './structured-agent-session-launch-persistence' -import { markStructuredAgentSessionLaunchPublished } from './structured-agent-session-launch-publication' -import { - registerStructuredSelectionCatalogStore, - structuredSessionSelectionController, - forgetStructuredSessionSelection -} from '../options/structured-agent-session-selection-controller' - -import { CLAUDE_SESSION_OPTION_CATALOG } from '../../../../../shared/agent-session/options/agent-session-option-catalog-claude-codex' -import { - applyStructuredAgentSessionModelCatalog, - applyStructuredAgentSessionOptions, - createStructuredAgentSessionOptionState -} from '../../../../../shared/agent-session/options/structured-agent-session-options' - const WORKTREE_ID = 'wt-1' const SESSION_ID = 'session-1' @@ -168,7 +153,7 @@ function deferred(): Deferred { return { promise, resolve } } -const ACCEPTED = { ok: true, value: { key: 'model', value: 'x' } } +void { ok: true, value: { key: 'model', value: 'x' } } function mutations(): { method: string; fence?: unknown; key?: unknown; value?: unknown }[] { return mocks.call.mock.calls @@ -185,10 +170,6 @@ function mutations(): { method: string; fence?: unknown; key?: unknown; value?: ) } -function lifecycle() { - return getStructuredAgentSessionLaunchLifecycle(WORKTREE_ID, SESSION_ID) -} - async function settle(): Promise { for (let i = 0; i < 20; i += 1) { await Promise.resolve() @@ -234,146 +215,6 @@ describe('picks made while a chat launches', () => { }) }) - it('applies them against the receipt fence before the first turn and before publishing', async () => { - const created = deferred<{ sessionId: string; fence: number }>() - mocks.launch.mockReturnValue(created.promise) - const launch = startStructuredAgentLaunch(WORKTREE_ID, 'codex', { - requestId: 'request-1', - prompt: 'first turn' - }) - - const modelPick = holdStructuredAgentSessionLaunchOption(SESSION_ID, 'model', 'gpt-picked') - holdStructuredAgentSessionLaunchOption(SESSION_ID, 'effort', 'high') - created.resolve({ sessionId: SESSION_ID, fence: 7 }) - await settle() - - // The host published the tab, but the launch is not published until its picks land. - markStructuredAgentSessionLaunchPublished(WORKTREE_ID, SESSION_ID, 'local') - expect(lifecycle()).toBe('pending') - expect(mutations()).toEqual([ - { method: 'agentSession.setOption', fence: 7, key: 'model', value: 'gpt-picked' }, - { method: 'agentSession.setOption', fence: 7, key: 'effort', value: 'high' } - ]) - setOptionReplies[0]!.resolve({ - ok: true, - value: { key: 'model', value: 'gpt-picked', options: { model: 'gpt-picked' } } - }) - await expect(modelPick).resolves.toEqual({ - kind: 'accepted', - options: { model: 'gpt-picked' } - }) - await settle() - expect(lifecycle()).toBe('pending') - setOptionReplies[1]!.resolve(ACCEPTED) - await launch.promptDeliveryResult - - expect(mutations()).toEqual([ - { method: 'agentSession.setOption', fence: 7, key: 'model', value: 'gpt-picked' }, - { method: 'agentSession.setOption', fence: 7, key: 'effort', value: 'high' }, - { method: 'agentSession.send' } - ]) - expect(lifecycle()).toBeNull() - }) - - it.each([ - { chat: 'a resumed conversation', resumed: true, adopts: { adoptModelAsLaunchDefault: false } }, - { chat: 'a new chat', resumed: false, adopts: {} } - ])('remembers a held effort in $chat under its versioned model', async ({ resumed, adopts }) => { - const created = deferred<{ sessionId: string; fence: number }>() - mocks.launch.mockReturnValue(created.promise) - const intent = launchIntent() - mocks.createIntent.mockReturnValueOnce({ - ...intent, - agent: 'claude', - params: { - ...intent.params, - ...(resumed ? { resumeFrom: { providerSessionId: 'claude-session-1' } } : {}) - } - }) - startStructuredAgentLaunch(WORKTREE_ID, 'claude', { requestId: 'request-1', prompt: 'first' }) - // The listing keys the row by the id Claude runs, the same id a chat saves; `opus` is its alias. - const efforts = [ - { value: 'low', label: 'Low' }, - { value: 'high', label: 'High' } - ] - const rows = [ - { - id: 'claude-opus-5-5', - label: 'Claude Opus 5.5', - resolvedModel: 'claude-opus-5-5', - isDefault: false, - efforts - }, - { - id: 'opus', - label: 'Opus alias', - resolvedModel: 'claude-opus-5-5', - isDefault: false, - efforts - } - ] - const picker = applyStructuredAgentSessionOptions( - applyStructuredAgentSessionModelCatalog( - createStructuredAgentSessionOptionState('claude', CLAUDE_SESSION_OPTION_CATALOG), - CLAUDE_SESSION_OPTION_CATALOG, - { origin: 'probe', fetchedAt: 1, models: rows }, - { newLaunch: !resumed, coherentCatalog: true } - ), - CLAUDE_SESSION_OPTION_CATALOG, - { models: rows, current: { model: 'claude-opus-5-5', effort: 'low' } }, - { newLaunch: !resumed, coherentCatalog: true } - ) - const pick = holdStructuredAgentSessionLaunchOption(SESSION_ID, 'effort', 'high', picker) - created.resolve({ sessionId: SESSION_ID, fence: 7 }) - await settle() - setOptionReplies[0]!.resolve({ ok: true, value: { key: 'effort', value: 'high' } }) - await expect(pick).resolves.toMatchObject({ kind: 'accepted' }) - await settle() - expect(mocks.settingsWrite).toHaveBeenLastCalledWith(expect.anything(), { - type: 'apply-picks', - agent: 'claude', - picks: [{ modelId: 'claude-opus-5-5', optionId: 'effort', value: 'high', ...adopts }] - }) - }) - - it('applies a pick made while the earlier ones are being applied', async () => { - mocks.launch.mockResolvedValue({ sessionId: SESSION_ID, fence: 1 }) - const launch = startStructuredAgentLaunch(WORKTREE_ID, 'codex', { requestId: 'request-2' }) - holdStructuredAgentSessionLaunchOption(SESSION_ID, 'model', 'gpt-picked') - await settle() - expect(setOptionReplies).toHaveLength(1) - - holdStructuredAgentSessionLaunchOption(SESSION_ID, 'model', 'gpt-repicked') - setOptionReplies[0]!.resolve(ACCEPTED) - await settle() - expect(lifecycle()).toBe('pending') - setOptionReplies[1]!.resolve(ACCEPTED) - await launch.launchResult - - expect(mutations().map((mutation) => mutation.value)).toEqual(['gpt-picked', 'gpt-repicked']) - }) - - it('keeps a held tier across a model pick whose catalog does not offer it', async () => { - const created = deferred<{ sessionId: string; fence: number }>() - mocks.launch.mockReturnValue(created.promise) - const launch = startStructuredAgentLaunch(WORKTREE_ID, 'codex', { requestId: 'request-tier' }) - const tierPick = holdStructuredAgentSessionLaunchOption(SESSION_ID, 'serviceTier', 'priority') - holdStructuredAgentSessionLaunchOption(SESSION_ID, 'model', 'gpt-nofast') - created.resolve({ sessionId: SESSION_ID, fence: 3 }) - await settle() - expect(setOptionReplies).toHaveLength(2) - for (const reply of setOptionReplies) { - reply.resolve(ACCEPTED) - } - await expect(tierPick).resolves.toMatchObject({ kind: 'accepted' }) - await launch.launchResult - - expect(mutations().map(({ key, value }) => [key, value])).toEqual([ - ['model', 'gpt-nofast'], - ['serviceTier', 'priority'] - ]) - }) - it('reports a refused pick to its picker and publishes all the same', async () => { mocks.launch.mockResolvedValue({ sessionId: SESSION_ID, fence: 1 }) const launch = startStructuredAgentLaunch(WORKTREE_ID, 'codex', { @@ -439,44 +280,4 @@ describe('picks made while a chat launches', () => { } }) }) - - it('keeps picks held through a failed start and applies them to the retry', async () => { - mocks.launch - .mockRejectedValueOnce(new StructuredAgentSessionCreateRefusalError('unsupported')) - .mockResolvedValueOnce({ sessionId: SESSION_ID, fence: 2 }) - startStructuredAgentLaunch(WORKTREE_ID, 'codex', { requestId: 'request-5' }) - holdStructuredAgentSessionLaunchOption(SESSION_ID, 'model', 'gpt-picked') - await settle() - expect(lifecycle()).toBe('failed') - expect(mutations()).toEqual([]) - - expect(retryStructuredAgentSessionLaunch(WORKTREE_ID, SESSION_ID)).toBe(true) - expect(getStructuredAgentSessionLaunchSelection(SESSION_ID)).toEqual({ - seed: { model: 'gpt-saved-since' } - }) - await settle() - expect(mutations()).toEqual([ - { method: 'agentSession.setOption', fence: 2, key: 'model', value: 'gpt-picked' } - ]) - }) - - it('discards them when the tab closes before the launch publishes', async () => { - const created = deferred<{ sessionId: string; fence: number }>() - mocks.launch.mockReturnValue(created.promise) - startStructuredAgentLaunch(WORKTREE_ID, 'codex', { requestId: 'request-6' }) - holdStructuredAgentSessionLaunchOption(SESSION_ID, 'model', 'gpt-picked') - - const otherHost = { kind: 'environment', environmentId: 'surviving-held-chat' } as const - const survivor = structuredSessionSelectionController(otherHost, SESSION_ID, 'codex') - survivor.issue('model', 'other-host-model', null) - cancelStructuredAgentLaunch(WORKTREE_ID, SESSION_ID) - expect(structuredSessionSelectionController(otherHost, SESSION_ID, 'codex')).toBe(survivor) - expect(survivor.overlay()).toEqual({ model: 'other-host-model' }) - forgetStructuredSessionSelection(SESSION_ID, otherHost) - created.resolve({ sessionId: SESSION_ID, fence: 1 }) - await settle() - - expect(mutations()).toEqual([]) - expect(holdStructuredAgentSessionLaunchOption(SESSION_ID, 'model', 'gpt-late')).toBeNull() - }) }) diff --git a/src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-options.ts b/src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-options.ts index 26e9728a8ed..d216f881807 100644 --- a/src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-options.ts +++ b/src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-options.ts @@ -1,22 +1,10 @@ -import { - createLegacyPrerequisites, - type LegacyPrerequisites -} from './structured-agent-session-launch-prerequisites' +import { createLegacyPrerequisites } from './structured-agent-session-launch-prerequisites' +import type { LegacyPrerequisites } from './structured-agent-session-launch-prerequisites' import { useSyncExternalStore } from 'react' import { acceptedStructuredSessionSelectionOutcome } from '../../../../../shared/agent-session/options/structured-agent-session-options-write-owner' import { structuredSessionSelectionController } from '../options/structured-agent-session-selection-controller' -import type { - SelectionOperation, - SelectionOutcome -} from '../../../../../shared/agent-session/options/structured-agent-session-selection-operations' -import { - structuredAgentSessionOptionPicks, - type StructuredAgentSessionOptionState -} from '../../../../../shared/agent-session/options/structured-agent-session-options' -import type { - AgentSessionMutationResult, - AgentSessionOptionResult -} from '../../../../../shared/agent-session/agent-session-wire' +import { structuredAgentSessionOptionPicks } from '../../../../../shared/agent-session/options/structured-agent-session-options' +import type { StructuredAgentSessionOptionState } from '../../../../../shared/agent-session/options/structured-agent-session-options' import { createStructuredAgentSessionOperationId, structuredAgentSessionPayloadFingerprint @@ -24,19 +12,27 @@ import { import { callStructuredAgentSession } from '@/runtime/native-chat/requests/structured-agent-session-call' import { RuntimeRpcCallError } from '@/runtime/rpc/calls/runtime-rpc-result' import { createNonSecureContextUuid as createBrowserUuid } from '../../../../../shared/non-secure-context-uuid' -import type { StructuredAgentLaunchReceipt } from './structured-agent-session-launch-recovery' import { getStructuredLaunchStateBySessionId, - subscribeStructuredAgentLaunchStatus, - type StructuredLaunchState + subscribeStructuredAgentLaunchStatus } from './structured-agent-session-launch-registry' +import type { StructuredLaunchState } from './structured-agent-session-launch-registry' import { agentSessionRefusalFailure, - agentSessionThrownFailure, - type AgentSessionWriteFailure + agentSessionThrownFailure } from '../../../../../shared/agent-session/failures/agent-session-write-failure' +import type { AgentSessionWriteFailure } from '../../../../../shared/agent-session/failures/agent-session-write-failure' +import type { + SelectionOperation, + SelectionOutcome +} from '../../../../../shared/agent-session/options/structured-agent-session-selection-operations' +import type { + AgentSessionMutationResult, + AgentSessionOptionResult +} from '../../../../../shared/agent-session/agent-session-wire' +import type { StructuredAgentLaunchReceipt } from './structured-agent-session-launch-recovery' import type { RuntimeClientTarget } from '../../../../../shared/runtime-client-target' -import type { StructuredAgentSessionLaunchIntent } from '../../launch-structured-agent-session' +import type { StructuredAgentSessionLaunchIntent } from './structured-agent-session-launch-intent' /** The options a launch starts with, replaced whole so readers can compare by identity. */ export type StructuredLaunchSelection = { diff --git a/src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-persistence.test.ts b/src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-persistence.test.ts index da802e7ddbc..e03065204f4 100644 --- a/src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-persistence.test.ts +++ b/src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-persistence.test.ts @@ -10,9 +10,7 @@ import { writeStructuredAgentLaunchRecord, markStructuredAgentLaunchCancelledPersisted } from './structured-agent-session-launch-persistence' - -import { structuredAgentLaunchRecordFor } from './structured-agent-session-launch-record' -import type { StructuredAgentSessionLaunchIntent } from '../../launch-structured-agent-session' +import './structured-agent-session-launch-record' const SERVER = 'runtime:server-1' function reload(): void { @@ -59,45 +57,6 @@ describe('structured agent launch persistence', () => { }) // This machine cannot re-derive a paired server's seed, so a reload must show the same one. - it("keeps a paired server's reported seed across a reload, and no local one", () => { - const intent = ( - executionHostId: 'local' | typeof SERVER, - sessionId: string - ): StructuredAgentSessionLaunchIntent => ({ - sessionId, - worktreeId: 'workspace-1', - executionHostId, - target: - executionHostId === 'local' - ? { kind: 'local' } - : { kind: 'environment', environmentId: 'server-1' }, - agent: 'claude', - params: { - envelope: { - sessionId, - clientOperationId: 'operation-9', - expectedRuntimeFence: null, - payloadFingerprint: 'fingerprint-9' - }, - worktree: 'id:workspace-1', - agent: 'claude' - }, - seedOptions: { model: 'opus', fastMode: 'true' } - }) - writeStructuredAgentLaunchRecord( - structuredAgentLaunchRecordFor(intent(SERVER, 'claude_paired'), 'pending') - ) - writeStructuredAgentLaunchRecord( - structuredAgentLaunchRecordFor(intent('local', 'claude_local'), 'pending') - ) - reload() - - expect(readStructuredAgentLaunchRecord('claude_paired')?.seedOptions).toEqual({ - model: 'opus', - fastMode: 'true' - }) - expect(readStructuredAgentLaunchRecord('claude_local')?.seedOptions).toBeUndefined() - }) it('keeps when a failed launch failed across a reload, and still loads records without it', () => { writeStructuredAgentLaunchRecord({ diff --git a/src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-probe-outage.test.ts b/src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-probe-outage.test.ts index 171c7ef9fba..27ea0796491 100644 --- a/src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-probe-outage.test.ts +++ b/src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-probe-outage.test.ts @@ -2,6 +2,9 @@ import { beforeEach, describe, expect, it, vi } from 'vitest' import { RuntimeRpcCallError } from '@/runtime/rpc/calls/runtime-rpc-result' +import { createStructuredAgentSessionLaunchIntent } from '@/lib/agent-session/launch/structured-agent-session-launch-intent' +import { StructuredAgentSessionCreateUnknownOutcomeError } from '@/lib/agent-session/launch/structured-agent-session-launch-errors' +import { launchAndReconcile } from '@/lib/agent-session/launch/structured-agent-session-launch-recovery' const calls = vi.hoisted(() => ({ log: new Array(), @@ -39,10 +42,6 @@ vi.mock('@/runtime/native-chat/tab-inventory/structured-session-tab-inventory', }) })) -import { createStructuredAgentSessionLaunchIntent } from '@/lib/launch-structured-agent-session' -import { StructuredAgentSessionCreateUnknownOutcomeError } from '@/lib/agent-session/launch/structured-agent-session-launch-errors' -import { launchAndReconcile } from '@/lib/agent-session/launch/structured-agent-session-launch-recovery' - function launchState(executionHostId: 'local' | 'runtime:server-1') { return { intent: createStructuredAgentSessionLaunchIntent('wt-1', 'claude', executionHostId), diff --git a/src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-record.ts b/src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-record.ts index 420aaa85836..8d8cbb310f0 100644 --- a/src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-record.ts +++ b/src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-record.ts @@ -1,14 +1,15 @@ import { isTuiAgent } from '../../../../../shared/agent-launch/catalog/tui-agent-config' +import { isAgentSessionOptions } from '../../../../../shared/agent-session/lifecycle/agent-session-record' +import { SendBodyStructure } from '../../../../../shared/rpc-contract/structured-agent-session-message-params' +import { parseExecutionHostId } from '../../../../../shared/execution-host' +import type { ExecutionHostId } from '../../../../../shared/execution-host' import type { TuiAgent } from '../../../../../shared/agent-launch/catalog/tui-agent' import type { StructuredAgentSessionFirstMessage, StructuredAgentSessionForkSource, StructuredAgentSessionResumeSource } from '../../../../../shared/agent-session/structured-agent-session-create' -import { isAgentSessionOptions } from '../../../../../shared/agent-session/lifecycle/agent-session-record' -import { SendBodyStructure } from '../../../../../shared/rpc-contract/structured-agent-session-message-params' -import { parseExecutionHostId, type ExecutionHostId } from '../../../../../shared/execution-host' -import type { StructuredAgentSessionLaunchIntent } from '../../launch-structured-agent-session' +import type { StructuredAgentSessionLaunchIntent } from './structured-agent-session-launch-intent' export type StructuredAgentLaunchPersistedLifecycle = 'pending' | 'visibility-unknown' | 'failed' diff --git a/src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-recovery.ts b/src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-recovery.ts index 66b477ad617..b28f705bdd9 100644 --- a/src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-recovery.ts +++ b/src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-recovery.ts @@ -1,20 +1,18 @@ import { structuredAgentSessionSettledSends } from '../../../../../shared/agent-session/requests/structured-agent-session-send-settlement' -import type { AgentSessionWriteFailure } from '../../../../../shared/agent-session/failures/agent-session-write-failure' -import type { AgentSessionHistoryResult } from '../../../../../shared/agent-session/agent-session-wire' -import type { AgentJournalCursor } from '../../../../../shared/agent-session/journal/agent-session-journal-identity' -import type { AgentJournalSubmission } from '../../../../../shared/agent-session/journal/agent-session-journal-types' -import { - launchStructuredAgentSession, - type StructuredLaunchHostSeedListener -} from './structured-agent-session-launch-create-call' +import { launchStructuredAgentSession } from './structured-agent-session-launch-create-call' +import type { StructuredLaunchHostSeedListener } from './structured-agent-session-launch-create-call' import { StructuredAgentSessionCreateRefusalError, StructuredAgentSessionCreateUnknownOutcomeError } from './structured-agent-session-launch-errors' -import type { StructuredAgentSessionLaunchIntent } from '@/lib/launch-structured-agent-session' import { callStructuredAgentSession } from '@/runtime/native-chat/requests/structured-agent-session-call' import { readStructuredSessionTabInventory } from '@/runtime/native-chat/tab-inventory/structured-session-tab-inventory' import { publishStructuredAgentSessionCreateHydration } from './structured-agent-session-create-hydration' +import type { AgentSessionWriteFailure } from '../../../../../shared/agent-session/failures/agent-session-write-failure' +import type { AgentSessionHistoryResult } from '../../../../../shared/agent-session/agent-session-wire' +import type { AgentJournalCursor } from '../../../../../shared/agent-session/journal/agent-session-journal-identity' +import type { AgentJournalSubmission } from '../../../../../shared/agent-session/journal/agent-session-journal-types' +import type { StructuredAgentSessionLaunchIntent } from '@/lib/agent-session/launch/structured-agent-session-launch-intent' export type StructuredAgentLaunchReceipt = { sessionId: string diff --git a/src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-reload.ts b/src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-reload.ts index bd3862158c2..15168a59a2c 100644 --- a/src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-reload.ts +++ b/src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-reload.ts @@ -3,21 +3,17 @@ import { getStructuredAgentSessionPendingSends, publishStructuredAgentSessionSends } from '@/components/native-chat/session/structured/delivery/structured-agent-session-pending-sends' -import { - restoreStructuredAgentSessionLaunchIntent, - type StructuredAgentSessionLaunchIntent -} from '../../launch-structured-agent-session' +import { restoreStructuredAgentSessionLaunchIntent } from './structured-agent-session-launch-intent' +import type { StructuredAgentSessionLaunchIntent } from './structured-agent-session-launch-intent' import { StructuredAgentSessionOwnerUnresolvedError } from './structured-agent-session-launch-errors' -import { - createStructuredLaunchCallerGroup, - type StructuredLaunchCallerGroup -} from './structured-agent-session-launch-callers' +import { createStructuredLaunchCallerGroup } from './structured-agent-session-launch-callers' +import type { StructuredLaunchCallerGroup } from './structured-agent-session-launch-callers' import { getPersistedStructuredAgentLaunchRecord, setStructuredLaunchState, - structuredLaunchIdentity, - type StructuredLaunchState + structuredLaunchIdentity } from './structured-agent-session-launch-registry' +import type { StructuredLaunchState } from './structured-agent-session-launch-registry' import { initialStructuredLaunchSelection, structuredLaunchSelectionController diff --git a/src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-unconfirmed-or-retried.test.ts b/src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-unconfirmed-or-retried.test.ts deleted file mode 100644 index 69930954e0b..00000000000 --- a/src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-unconfirmed-or-retried.test.ts +++ /dev/null @@ -1,318 +0,0 @@ -// @vitest-environment happy-dom - -import { sourceControlActionRecipeEntry } from '../../../../../shared/source-control/ai/recipes/source-control-action-selection' -import type * as LaunchErrors from '@/lib/agent-session/launch/structured-agent-session-launch-errors' -import { beforeEach, describe, expect, it, vi } from 'vitest' -import type { RuntimeMobileSessionTabsResult } from '../../../../../shared/runtime-session-contracts' -import type { StructuredAgentSessionLaunchIntent } from '@/lib/launch-structured-agent-session' - -const mocks = vi.hoisted(() => ({ - abandonIntent: vi.fn(), - callStructuredAgentSession: vi.fn(), - createIntent: vi.fn(), - retryIntent: vi.fn(), - restoreIntent: vi.fn(), - launch: vi.fn(), - seedDraft: vi.fn(), - clearDraft: vi.fn(), - toastError: vi.fn() -})) - -vi.mock('sonner', () => ({ toast: { error: mocks.toastError, message: vi.fn() } })) - -const launchErrorMocks = vi.hoisted(() => { - class StructuredAgentSessionCreateRefusalError extends Error {} - return { StructuredAgentSessionCreateRefusalError } -}) - -vi.mock('@/lib/agent-session/launch/structured-agent-session-launch-errors', async () => ({ - ...(await vi.importActual( - '@/lib/agent-session/launch/structured-agent-session-launch-errors' - )), - ...launchErrorMocks -})) - -vi.mock('@/lib/agent-session/launch/structured-agent-session-launch-create-call', () => ({ - launchStructuredAgentSession: mocks.launch -})) - -vi.mock('@/lib/launch-structured-agent-session', () => { - return { - createStructuredAgentSessionLaunchIntent: mocks.createIntent, - retryStructuredAgentSessionLaunchIntent: mocks.retryIntent, - restoreStructuredAgentSessionLaunchIntent: mocks.restoreIntent, - abandonStructuredAgentSessionLaunchIntent: mocks.abandonIntent, - launchStructuredAgentSession: mocks.launch, - StructuredAgentSessionCreateRefusalError: - launchErrorMocks.StructuredAgentSessionCreateRefusalError - } -}) - -vi.mock('@/runtime/local-structured-session-tabs-sync/inventory-refresh', () => ({ - refreshLocalStructuredSessionTabs: vi.fn() -})) - -vi.mock('../../../runtime/native-chat/requests/structured-agent-session-call', () => ({ - callStructuredAgentSession: mocks.callStructuredAgentSession -})) - -vi.mock('@/store', () => ({ - useAppStore: { - getState: () => ({ - unifiedTabsByWorktree: {}, - seedNativeChatLaunchDraft: mocks.seedDraft, - clearNativeChatLaunchDraft: mocks.clearDraft - }), - subscribe: () => () => undefined - } -})) - -vi.mock('@/i18n/i18n', () => ({ - translate: (_key: string, fallback: string) => fallback -})) - -vi.mock('@/lib/agent-catalog/agent-catalog', () => ({ - getAgentLabel: () => 'Codex', - getAgentCatalog: () => [{ id: 'codex', label: 'Codex' }] -})) - -vi.mock('@/components/terminal-pane/input/focus/focus-terminal-tab-surface', () => ({ - focusTerminalTabSurface: vi.fn() -})) - -// The structured route hands the launch's own delivery result back unchanged. -vi.mock('@/lib/agent-session/launch/new-tab/launch-agent-in-new-tab', async () => { - const launch = await import('./structured-agent-session-launch') - return { - launchAgentInNewTab: (args: { - requestId: string - worktreeId: string - prompt: string - promptDelivery: 'auto-submit' | 'draft' | 'submit-after-ready' - }) => { - const started = launch.startStructuredAgentLaunch(args.worktreeId, 'codex', { - requestId: args.requestId, - prompt: args.prompt, - promptDelivery: args.promptDelivery - }) - return { - surface: { kind: 'agent-session', sessionId: started.sessionId }, - ...(started.promptDeliveryResult - ? { promptDeliveryResult: started.promptDeliveryResult } - : {}) - } - } - } -}) - -import { StructuredAgentSessionCreateRefusalError } from '@/lib/agent-session/launch/structured-agent-session-launch-errors' -import { refreshLocalStructuredSessionTabs } from '@/runtime/local-structured-session-tabs-sync/inventory-refresh' -import { runSourceControlAgentActionStart } from '@/components/right-sidebar/source-control/ai/runSourceControlAgentActionStart' -import { - getStructuredAgentSessionLaunchLifecycle, - resetStructuredAgentLaunchRegistryForTests -} from './structured-agent-session-launch-registry' -import { - retryStructuredAgentSessionLaunch, - startStructuredAgentLaunch -} from './structured-agent-session-launch' -import { resetStructuredAgentLaunchPersistenceForTests } from './structured-agent-session-launch-persistence' - -const WORKTREE_ID = 'wt-unconfirmed-or-retried' - -function launchIntent(sessionId: string): StructuredAgentSessionLaunchIntent { - return { - worktreeId: WORKTREE_ID, - sessionId, - executionHostId: 'local', - target: { kind: 'local' }, - agent: 'codex', - params: { - envelope: { - sessionId, - clientOperationId: `operation-${sessionId}`, - expectedRuntimeFence: null, - payloadFingerprint: `fingerprint-${sessionId}` - }, - worktree: `id:${WORKTREE_ID}`, - agent: 'codex' - } - } -} - -function publishedSnapshot(sessionId: string): RuntimeMobileSessionTabsResult { - return { - worktree: WORKTREE_ID, - publicationEpoch: 'epoch-1', - snapshotVersion: 1, - activeGroupId: null, - activeTabId: null, - activeTabType: null, - tabs: [ - { - type: 'agent-session', - id: `tab-${sessionId}`, - title: 'Codex', - sessionId, - agent: 'codex', - isActive: false - } - ] - } -} - -async function flushLaunchSettlement(): Promise { - for (let i = 0; i < 20; i += 1) { - await Promise.resolve() - } -} - -const unconfirmed = launchIntent('session-unconfirmed') -const fresh = launchIntent('session-new') -const resumeFrom = { providerSessionId: 'provider-1' } - -/** The create's answer is lost and inventory never shows the chat: it stays unconfirmed. */ -async function leaveFirstLaunchUnconfirmed(options: { resume?: boolean } = {}): Promise { - mocks.createIntent - .mockReturnValueOnce( - options.resume - ? { ...unconfirmed, params: { ...unconfirmed.params, resumeFrom } } - : unconfirmed - ) - .mockReturnValueOnce(fresh) - startStructuredAgentLaunch(WORKTREE_ID, 'codex', { - requestId: 'request-1', - prompt: 'first task', - ...(options.resume ? { resumeFrom } : {}) - }) - await flushLaunchSettlement() - expect(getStructuredAgentSessionLaunchLifecycle(WORKTREE_ID, unconfirmed.sessionId)).toBe( - 'visibility-unknown' - ) -} - -function expectSentTo(sessionId: string, text: string): void { - expect(mocks.callStructuredAgentSession).toHaveBeenCalledWith( - { kind: 'local' }, - 'agentSession.send', - expect.objectContaining({ - envelope: expect.objectContaining({ sessionId }), - body: expect.objectContaining({ blocks: [{ type: 'text', text }] }) - }) - ) -} - -describe('a new start beside an unconfirmed or retried chat', () => { - beforeEach(() => { - vi.resetAllMocks() - localStorage.clear() - resetStructuredAgentLaunchPersistenceForTests() - resetStructuredAgentLaunchRegistryForTests() - mocks.retryIntent.mockImplementation((intent: StructuredAgentSessionLaunchIntent) => intent) - mocks.restoreIntent.mockImplementation((args: { sessionId: string }) => - launchIntent(args.sessionId) - ) - mocks.launch.mockImplementation((intent: StructuredAgentSessionLaunchIntent) => - intent.sessionId === fresh.sessionId - ? Promise.resolve({ sessionId: fresh.sessionId, fence: 1 }) - : Promise.reject(new Error('response lost')) - ) - vi.mocked(refreshLocalStructuredSessionTabs).mockResolvedValue([ - publishedSnapshot(fresh.sessionId) - ]) - mocks.callStructuredAgentSession.mockResolvedValue({ - ok: true, - page: { fence: 1 }, - value: { submission: { dispatchState: 'accepted' } } - }) - }) - - it('starts a source-control agent in a new chat and reports success only once its text is sent', async () => { - await leaveFirstLaunchUnconfirmed() - const onLaunched = vi.fn() - - const started = await runSourceControlAgentActionStart({ - selectedAgent: 'codex', - trimmedCommandInput: 'Fix the failing check', - recipe: sourceControlActionRecipeEntry({ commandInputTemplate: '{basePrompt}' }), - saveTargetValue: 'none', - actionId: 'resolveComments', - repo: null, - worktreeId: WORKTREE_ID, - promptDelivery: 'submit-after-ready', - launchSource: 'source_control_recovery', - onLaunched, - onClose: vi.fn() - }) - - expect(started).toBe(true) - expect(onLaunched).toHaveBeenCalledOnce() - expect(mocks.createIntent).toHaveBeenCalledTimes(2) - expectSentTo(fresh.sessionId, 'Fix the failing check') - expect(mocks.toastError).not.toHaveBeenCalled() - }) - - it('sends notes to a new chat while another chat is unconfirmed', async () => { - await leaveFirstLaunchUnconfirmed() - - const notes = startStructuredAgentLaunch(WORKTREE_ID, 'codex', { - requestId: 'request-2', - prompt: 'review notes', - promptDelivery: 'submit-after-ready' - }) - - expect(notes.sessionId).toBe(fresh.sessionId) - await expect(notes.promptDeliveryResult).resolves.toEqual({ - delivered: true, - failureNotified: false - }) - expectSentTo(fresh.sessionId, 'review notes') - // The unconfirmed chat is left for its own re-check. - expect(getStructuredAgentSessionLaunchLifecycle(WORKTREE_ID, unconfirmed.sessionId)).toBe( - 'visibility-unknown' - ) - }) - - it("opens a new chat with its text, not a draft, while a restored chat's Retry is in flight", async () => { - const failed = launchIntent('session-failed') - mocks.createIntent.mockReturnValueOnce(failed).mockReturnValueOnce(fresh) - mocks.launch.mockRejectedValueOnce(new StructuredAgentSessionCreateRefusalError('unsupported')) - startStructuredAgentLaunch(WORKTREE_ID, 'codex', { - requestId: 'request-3', - prompt: 'first task' - }) - await flushLaunchSettlement() - // Reload: the registry is memory; the failed record is what survives. - resetStructuredAgentLaunchRegistryForTests() - mocks.launch.mockImplementationOnce(() => new Promise(() => undefined)) - expect(retryStructuredAgentSessionLaunch(WORKTREE_ID, failed.sessionId)).toBe(true) - mocks.seedDraft.mockClear() - - const next = startStructuredAgentLaunch(WORKTREE_ID, 'codex', { - requestId: 'request-4', - prompt: 'fix it', - promptDelivery: 'submit-after-ready' - }) - - expect(next.sessionId).toBe(fresh.sessionId) - await expect(next.promptDeliveryResult).resolves.toEqual({ - delivered: true, - failureNotified: false - }) - expectSentTo(fresh.sessionId, 'fix it') - expect(mocks.seedDraft).not.toHaveBeenCalled() - }) - - it('never joins a resume of the same conversation id running on another host', async () => { - await leaveFirstLaunchUnconfirmed({ resume: true }) - - const remote = startStructuredAgentLaunch(WORKTREE_ID, 'codex', { - requestId: 'request-9', - resumeFrom, - executionHostId: 'runtime:server-1' - }) - - expect(remote.sessionId).not.toBe(unconfirmed.sessionId) - expect(mocks.createIntent).toHaveBeenCalledTimes(2) - }) -}) diff --git a/src/renderer/src/lib/agent-session/launch/structured-agent-session-launch.test-fixture.ts b/src/renderer/src/lib/agent-session/launch/structured-agent-session-launch.test-fixture.ts index 1fbf4fe56ad..e7d8074ad3e 100644 --- a/src/renderer/src/lib/agent-session/launch/structured-agent-session-launch.test-fixture.ts +++ b/src/renderer/src/lib/agent-session/launch/structured-agent-session-launch.test-fixture.ts @@ -1,10 +1,21 @@ // @vitest-environment happy-dom +import { afterEach, beforeEach, vi } from 'vitest' +import type { Mock } from 'vitest' +import { resetStructuredAgentSessionSendsForTests } from '@/components/native-chat/session/structured/delivery/structured-agent-session-message-sender' +import { refreshLocalStructuredSessionTabs } from '@/runtime/local-structured-session-tabs-sync/inventory-refresh' +import { clearNativeChatComposerDraftsForTests as clearNativeChatDraftCacheForTests } from '@/components/native-chat/drafts/native-chat-draft-reset' +import { readNativeChatDraftCache } from '@/components/native-chat/drafts/native-chat-draft-views' +import { structuredAgentSessionDraftScopeKey } from '@/components/native-chat/drafts/native-chat-draft-scope' +import { resetStructuredAgentLaunchPersistenceForTests } from './structured-agent-session-launch-persistence' +import { resetStructuredAgentLaunchRegistryForTests } from './structured-agent-session-launch-registry' +import { useAppStore } from '@/store/index' +import { registerStructuredSelectionCatalogStore } from '../options/structured-agent-session-selection-controller' +import { replaceRuntimeEnvironmentRevisions } from '@/runtime/rpc/environment-revisions/runtime-environment-revision' import type * as LaunchErrors from '@/lib/agent-session/launch/structured-agent-session-launch-errors' -import { afterEach, beforeEach, vi, type Mock } from 'vitest' import type { RuntimeMobileSessionTabsResult } from '../../../../../shared/runtime-session-contracts' import type * as RecoveryModule from '@/lib/agent-session/launch/structured-agent-session-launch-recovery' -import type { StructuredAgentSessionLaunchIntent } from '@/lib/launch-structured-agent-session' +import type { StructuredAgentSessionLaunchIntent } from '@/lib/agent-session/launch/structured-agent-session-launch-intent' type LaunchMocks = Record< | 'abandonIntent' @@ -59,18 +70,21 @@ vi.mock('@/lib/agent-session/launch/structured-agent-session-launch-create-call' launchStructuredAgentSession: mocks.launch })) -vi.mock('@/lib/launch-structured-agent-session', () => { +vi.mock('@/lib/agent-session/launch/structured-agent-session-launch-intent', () => { return { createStructuredAgentSessionLaunchIntent: mocks.createIntent, retryStructuredAgentSessionLaunchIntent: mocks.retryIntent, restoreStructuredAgentSessionLaunchIntent: mocks.restoreIntent, - abandonStructuredAgentSessionLaunchIntent: mocks.abandonIntent, launchStructuredAgentSession: mocks.launch, StructuredAgentSessionCreateRefusalError: launchErrorMocks.StructuredAgentSessionCreateRefusalError } }) +vi.mock('@/lib/agent-session/launch/structured-agent-session-launch-abandon', () => ({ + abandonStructuredAgentSessionLaunchIntent: mocks.abandonIntent +})) + vi.mock('@/lib/agent-session/launch/structured-agent-session-launch-recovery', async () => { const actual = await vi.importActual( '@/lib/agent-session/launch/structured-agent-session-launch-recovery' @@ -127,16 +141,6 @@ vi.mock('@/lib/agent-catalog/agent-catalog', () => ({ ] })) -import { resetStructuredAgentSessionSendsForTests } from '@/components/native-chat/session/structured/delivery/structured-agent-session-message-sender' -import { refreshLocalStructuredSessionTabs } from '@/runtime/local-structured-session-tabs-sync/inventory-refresh' -import { clearNativeChatComposerDraftsForTests as clearNativeChatDraftCacheForTests } from '@/components/native-chat/drafts/native-chat-draft-reset' -import { readNativeChatDraftCache } from '@/components/native-chat/drafts/native-chat-draft-views' -import { structuredAgentSessionDraftScopeKey } from '@/components/native-chat/drafts/native-chat-draft-scope' -import { resetStructuredAgentLaunchPersistenceForTests } from './structured-agent-session-launch-persistence' -import { resetStructuredAgentLaunchRegistryForTests } from './structured-agent-session-launch-registry' -import { useAppStore } from '@/store/index' -import { registerStructuredSelectionCatalogStore } from '../options/structured-agent-session-selection-controller' -import { replaceRuntimeEnvironmentRevisions } from '@/runtime/rpc/environment-revisions/runtime-environment-revision' vi.mock('@/components/native-chat/telemetry/native-chat-telemetry', () => ({ emitNativeChatMessageSent: vi.fn() })) diff --git a/src/renderer/src/lib/agent-session/launch/structured-agent-session-launch.test.ts b/src/renderer/src/lib/agent-session/launch/structured-agent-session-launch.test.ts deleted file mode 100644 index bd0f89f4a48..00000000000 --- a/src/renderer/src/lib/agent-session/launch/structured-agent-session-launch.test.ts +++ /dev/null @@ -1,416 +0,0 @@ -// @vitest-environment happy-dom -import { - mocks, - launchIntent, - publishedSnapshot, - publishIntent, - sends, - composerDraft, - flushLaunchSettlement -} from './structured-agent-session-launch.test-fixture' -import { describe, expect, it, vi } from 'vitest' -import { toast } from 'sonner' -import type { StructuredAgentSessionLaunchIntent } from '@/lib/launch-structured-agent-session' -import { StructuredAgentSessionCreateRefusalError } from '@/lib/agent-session/launch/structured-agent-session-launch-errors' -import { refreshLocalStructuredSessionTabs } from '@/runtime/local-structured-session-tabs-sync/inventory-refresh' -import { - retryStructuredAgentSessionLaunch, - startStructuredAgentLaunch -} from './structured-agent-session-launch' -import { getStructuredAgentSessionLaunchLifecycle } from './structured-agent-session-launch-registry' -import { hasStagedStructuredLaunchPrompt } from './structured-agent-session-launch-prompt' -import { getStructuredAgentSessionLaunchSelection } from './structured-agent-session-launch-options' - -describe('startStructuredAgentLaunch', () => { - it('keeps a Claude and a Codex launch in the same worktree apart', async () => { - const worktreeId = 'wt-two-agents' - mocks.launch.mockImplementation(async (intent: StructuredAgentSessionLaunchIntent) => ({ - sessionId: intent.sessionId, - fence: 1 - })) - vi.mocked(refreshLocalStructuredSessionTabs).mockResolvedValue([ - publishedSnapshot(worktreeId, `claude-session-${worktreeId}`), - publishedSnapshot(worktreeId, `codex-session-${worktreeId}`) - ]) - - const claude = startStructuredAgentLaunch(worktreeId, 'claude', { requestId: 'request-7' }) - const codex = startStructuredAgentLaunch(worktreeId, 'codex', { requestId: 'request-8' }) - await flushLaunchSettlement() - - expect(mocks.createIntent).toHaveBeenNthCalledWith( - 1, - worktreeId, - 'claude', - undefined, - undefined, - undefined, - undefined, - undefined - ) - expect(mocks.createIntent).toHaveBeenNthCalledWith( - 2, - worktreeId, - 'codex', - undefined, - undefined, - undefined, - undefined, - undefined - ) - expect(mocks.launch).toHaveBeenCalledTimes(2) - expect(vi.mocked(mocks.launch).mock.calls.map(([intent]) => intent.params.agent)).toEqual([ - 'claude', - 'codex' - ]) - expect(claude.sessionId).not.toBe(codex.sessionId) - expect(toast.error).not.toHaveBeenCalled() - }) - - it.each(['late', 'missing', 'unavailable'] as const)( - 'uses an older host’s receipt to send while tab inventory is %s', - async (inventory) => { - const worktreeId = 'wt-host-frame' - const intent = launchIntent(worktreeId, 'session-host-frame') - intent.createMessageSupport = false - mocks.createIntent.mockReturnValueOnce(intent) - mocks.launch.mockResolvedValueOnce({ sessionId: intent.sessionId, fence: 1 }) - let reads = 0 - vi.mocked(refreshLocalStructuredSessionTabs).mockImplementation(async () => { - reads += 1 - if (inventory === 'unavailable') { - throw new Error('inventory unavailable') - } - return inventory === 'late' && reads > 1 - ? [publishedSnapshot(worktreeId, intent.sessionId)] - : [] - }) - - const launch = startStructuredAgentLaunch(worktreeId, 'codex', { - requestId: 'request-10', - prompt: 'first task', - promptDelivery: 'submit-after-ready' - }) - await expect(launch.promptDeliveryResult).resolves.toMatchObject({ delivered: true }) - - expect(mocks.launch).toHaveBeenCalledOnce() - expect(refreshLocalStructuredSessionTabs).not.toHaveBeenCalled() - expect(sends()).toHaveLength(1) - expect(sends()[0]?.[2]).toMatchObject({ envelope: { sessionId: intent.sessionId } }) - } - ) - - it("delivers a repeated request's prompt once, to both callers, after the shared launch settles", async () => { - const worktreeId = 'wt-coalesced-prompt' - const intent = launchIntent(worktreeId) - let resolveLaunch: (receipt: { sessionId: string; fence: number }) => void = () => {} - mocks.createIntent.mockReturnValueOnce(intent) - mocks.launch.mockImplementation( - () => - new Promise<{ sessionId: string; fence: number }>((resolve) => (resolveLaunch = resolve)) - ) - publishIntent(intent) - - const first = startStructuredAgentLaunch(worktreeId, 'codex', { - requestId: 'double-click', - prompt: 'second prompt' - }) - const second = startStructuredAgentLaunch(worktreeId, 'codex', { - requestId: 'double-click', - prompt: 'second prompt' - }) - - resolveLaunch({ sessionId: intent.sessionId, fence: 1 }) - for (const caller of [first, second]) { - await expect(caller.promptDeliveryResult).resolves.toEqual({ - delivered: true, - failureNotified: false - }) - } - await flushLaunchSettlement() - - expect(second.sessionId).toBe(first.sessionId) - expect(sends()).toHaveLength(1) - - expect(mocks.callRuntimeRpc).toHaveBeenCalledWith( - { kind: 'local' }, - 'agentSession.send', - expect.objectContaining({ - body: expect.objectContaining({ - blocks: [{ type: 'text', text: 'second prompt' }] - }) - }) - ) - }) - - it('keeps the launch reserved until every coalesced prompt delivery settles', async () => { - const worktreeId = 'wt-coalesced-prompt-reservation' - const intent = launchIntent(worktreeId) - let resolveLaunch!: (receipt: { sessionId: string; fence: number }) => void - const pendingSends: ((result: unknown) => void)[] = [] - mocks.createIntent.mockReturnValue(intent) - mocks.launch.mockImplementationOnce(() => new Promise((resolve) => (resolveLaunch = resolve))) - publishIntent(intent) - mocks.callRuntimeRpc.mockImplementation( - () => new Promise((resolve) => pendingSends.push(resolve)) - ) - - startStructuredAgentLaunch(worktreeId, 'codex', { - requestId: 'double-click', - prompt: 'second prompt' - }) - const coalesced = startStructuredAgentLaunch(worktreeId, 'codex', { - requestId: 'double-click', - prompt: 'second prompt' - }) - resolveLaunch({ sessionId: intent.sessionId, fence: 1 }) - await vi.waitFor(() => expect(mocks.callRuntimeRpc).toHaveBeenCalledOnce()) - - const whileSending = startStructuredAgentLaunch(worktreeId, 'codex', { - requestId: 'double-click', - prompt: 'second prompt' - }) - expect(mocks.createIntent).toHaveBeenCalledOnce() - expect(mocks.launch).toHaveBeenCalledOnce() - - await flushLaunchSettlement() - for (const resolve of pendingSends) { - resolve({ ok: true, value: { submission: { dispatchState: 'accepted' } } }) - } - for (const caller of [coalesced, whileSending]) { - await expect(caller.promptDeliveryResult).resolves.toEqual({ - delivered: true, - failureNotified: false - }) - } - expect(mocks.callRuntimeRpc).toHaveBeenCalledOnce() - }) - - it('opens a new chat for a new start while an earlier outcome is unknown', async () => { - const worktreeId = 'wt-unknown-different-prompts' - const intent = launchIntent(worktreeId) - mocks.createIntent.mockReturnValueOnce(intent) - mocks.launch.mockRejectedValue(new Error('offline')) - vi.mocked(refreshLocalStructuredSessionTabs).mockResolvedValue([]) - - startStructuredAgentLaunch(worktreeId, 'codex', { - requestId: 'request-18', - prompt: 'first prompt' - }) - await flushLaunchSettlement() - const second = startStructuredAgentLaunch(worktreeId, 'codex', { - requestId: 'request-19', - prompt: 'second prompt' - }) - await flushLaunchSettlement() - - expect(mocks.createIntent).toHaveBeenCalledTimes(2) - expect(second.sessionId).not.toBe(intent.sessionId) - await expect(second.launchResult).rejects.toThrow('offline') - expect(composerDraft(second.sessionId)).toBe('second prompt') - expect(composerDraft(intent.sessionId)).toBe('first prompt') - }) - - it('retries an absent unknown outcome with the exact same intent', async () => { - const worktreeId = 'wt-same-envelope-retry' - const intent = launchIntent(worktreeId) - mocks.createIntent.mockReturnValueOnce(intent) - mocks.launch - .mockRejectedValueOnce(new Error('response lost')) - .mockResolvedValueOnce({ sessionId: intent.sessionId, fence: 1 }) - vi.mocked(refreshLocalStructuredSessionTabs) - .mockResolvedValueOnce([]) - .mockResolvedValueOnce([publishedSnapshot(worktreeId, intent.sessionId)]) - - startStructuredAgentLaunch(worktreeId, 'codex', { requestId: 'request-22' }) - await flushLaunchSettlement() - - expect(mocks.launch).toHaveBeenCalledTimes(2) - expect(mocks.launch.mock.calls[0]?.[0]).toBe(intent) - expect(mocks.launch.mock.calls[1]?.[0]).toBe(intent) - expect(mocks.createIntent).toHaveBeenCalledOnce() - expect(toast.error).not.toHaveBeenCalled() - }) - - // Why a resume: the host refuses a second adoption of the conversation, so a new resume re-checks. - it('keeps an unresolved resume identity reserved until inventory reconciles it', async () => { - const worktreeId = 'wt-still-unknown' - const resumeFrom = { providerSessionId: 'provider-still-unknown' } - const intent = launchIntent(worktreeId) - mocks.createIntent.mockReturnValueOnce({ ...intent, params: { ...intent.params, resumeFrom } }) - mocks.launch.mockRejectedValue(new Error('offline')) - vi.mocked(refreshLocalStructuredSessionTabs).mockResolvedValue([]) - - startStructuredAgentLaunch(worktreeId, 'codex', { requestId: 'request-23', resumeFrom }) - await flushLaunchSettlement() - - publishIntent(intent) - startStructuredAgentLaunch(worktreeId, 'codex', { requestId: 'request-24', resumeFrom }) - await flushLaunchSettlement() - - expect(mocks.createIntent).toHaveBeenCalledOnce() - expect(mocks.launch).toHaveBeenCalledTimes(2) - expect(toast.error).not.toHaveBeenCalled() - }) - - it("keeps the prompt in the chat's composer, unsent, through an unknown outcome's recovery", async () => { - const worktreeId = 'wt-unknown-prompt-retry' - const intent = launchIntent(worktreeId) - mocks.createIntent.mockReturnValueOnce(intent) - mocks.launch.mockRejectedValue(new Error('offline')) - vi.mocked(refreshLocalStructuredSessionTabs).mockResolvedValue([]) - - const first = startStructuredAgentLaunch(worktreeId, 'codex', { - requestId: 'request-25', - prompt: 'only once' - }) - await expect(first.launchResult).rejects.toThrow('offline') - expect(first.releaseCallerAfterUnknownOutcome()).toBe(true) - - publishIntent(intent) - // The chat's own Retry re-checks it; a new start would open a new chat instead. - expect(retryStructuredAgentSessionLaunch(worktreeId, intent.sessionId)).toBe(true) - await flushLaunchSettlement() - expect(getStructuredAgentSessionLaunchLifecycle(worktreeId, intent.sessionId)).toBeNull() - - expect(composerDraft(intent.sessionId)).toBe('only once') - expect(sends()).toHaveLength(0) - }) - - it('repairs failed tab publication on Retry with the original chat and operation', async () => { - const worktreeId = 'wt-post-attach-unknown' - const intent = launchIntent(worktreeId) - intent.createMessageSupport = false - mocks.createIntent.mockReturnValueOnce(intent) - mocks.launch.mockRejectedValue( - Object.assign(new Error('The chat may already exist.'), { - code: 'agent_session_operation_unknown' - }) - ) - vi.mocked(refreshLocalStructuredSessionTabs).mockResolvedValue([]) - - const launch = startStructuredAgentLaunch(worktreeId, 'codex', { requestId: 'request-26' }) - - await expect(launch.launchResult).rejects.toMatchObject({ - code: 'agent_session_operation_unknown' - }) - expect(launch.isVisibilityUnknown()).toBe(true) - expect(launch.releaseCallerAfterUnknownOutcome()).toBe(true) - - mocks.launch.mockResolvedValueOnce({ sessionId: intent.sessionId, fence: 1 }) - expect(retryStructuredAgentSessionLaunch(worktreeId, intent.sessionId)).toBe(true) - await flushLaunchSettlement() - - expect(getStructuredAgentSessionLaunchLifecycle(worktreeId, intent.sessionId)).toBeNull() - expect(mocks.launch).toHaveBeenCalledTimes(3) - for (const [retried] of mocks.launch.mock.calls) { - expect(retried).toBe(intent) - } - expect(mocks.createIntent).toHaveBeenCalledOnce() - }) - - // A paired server's create seeds from its settings at create time, which its probe reports. - it("shows the seed a paired server's probe reports on a retry, not the first admission's", async () => { - const worktreeId = 'wt-paired-retry-seed' - const intent: StructuredAgentSessionLaunchIntent = { - ...launchIntent(worktreeId, 'session-paired-retry-seed'), - executionHostId: 'runtime:server-1', - target: { kind: 'environment', environmentId: 'server-1' }, - seedOptions: { model: 'gpt-5.5' } - } - mocks.createIntent.mockReturnValueOnce(intent) - mocks.launch - .mockRejectedValueOnce(new StructuredAgentSessionCreateRefusalError('unsupported')) - .mockImplementationOnce( - (_intent: StructuredAgentSessionLaunchIntent, onHostSeed?: (seed: unknown) => void) => { - onHostSeed?.({ model: 'gpt-5.6-luna' }) - return new Promise(() => undefined) - } - ) - - startStructuredAgentLaunch(worktreeId, 'codex', { requestId: 'request-28' }) - await flushLaunchSettlement() - expect(getStructuredAgentSessionLaunchSelection(intent.sessionId)?.seed).toEqual({ - model: 'gpt-5.5' - }) - - expect(retryStructuredAgentSessionLaunch(worktreeId, intent.sessionId)).toBe(true) - await flushLaunchSettlement() - expect(getStructuredAgentSessionLaunchSelection(intent.sessionId)?.seed).toEqual({ - model: 'gpt-5.6-luna' - }) - }) - - it("reports a repeated request's prompt as undelivered to both callers after refusal", async () => { - const worktreeId = 'wt-refused-coalesced-prompts' - const intent = launchIntent(worktreeId) - let rejectLaunch!: (error: unknown) => void - mocks.createIntent.mockReturnValueOnce(intent) - mocks.launch.mockImplementationOnce( - () => new Promise((_resolve, reject) => (rejectLaunch = reject)) - ) - - const first = startStructuredAgentLaunch(worktreeId, 'codex', { - requestId: 'double-click', - prompt: 'first prompt' - }) - const second = startStructuredAgentLaunch(worktreeId, 'codex', { - requestId: 'double-click', - prompt: 'first prompt' - }) - expect(hasStagedStructuredLaunchPrompt(intent.sessionId)).toBe(true) - - rejectLaunch(new StructuredAgentSessionCreateRefusalError('unsupported')) - await expect(first.launchResult).rejects.toBeInstanceOf( - StructuredAgentSessionCreateRefusalError - ) - // Neither caller delivered; the first's prompt was handed back into the failed chat's composer. - await expect(first.promptDeliveryResult).resolves.toEqual({ - delivered: false, - failureNotified: true, - inComposer: true - }) - await expect(second.promptDeliveryResult).resolves.toEqual({ - delivered: false, - failureNotified: true - }) - expect(composerDraft(intent.sessionId)).toBe('first prompt') - expect(hasStagedStructuredLaunchPrompt(intent.sessionId)).toBe(false) - }) - - it('keeps a drafted chat out of a second action that sends the same text', async () => { - const worktreeId = 'wt-coalesced-delivery-mode' - const drafted = launchIntent(worktreeId, 'coalesced-delivery-session') - const sent = launchIntent(worktreeId, 'sent-delivery-session') - mocks.createIntent.mockReturnValueOnce(drafted).mockReturnValueOnce(sent) - mocks.launch.mockImplementation((intent: StructuredAgentSessionLaunchIntent) => - Promise.resolve({ sessionId: intent.sessionId, fence: 1 }) - ) - vi.mocked(refreshLocalStructuredSessionTabs).mockResolvedValue([ - publishedSnapshot(worktreeId, drafted.sessionId), - publishedSnapshot(worktreeId, sent.sessionId) - ]) - - startStructuredAgentLaunch(worktreeId, 'codex', { - requestId: 'continue-click', - prompt: 'PR #1 context', - promptDelivery: 'draft' - }) - const other = startStructuredAgentLaunch(worktreeId, 'codex', { - requestId: 'fix-click', - prompt: 'PR #1 context', - promptDelivery: 'auto-submit' - }) - - // Why: two actions are two chats, whatever their text; neither lands in the other's chat. - expect(other.sessionId).toBe(sent.sessionId) - await expect(other.promptDeliveryResult).resolves.toEqual({ - delivered: true, - failureNotified: false - }) - expect(hasStagedStructuredLaunchPrompt(drafted.sessionId)).toBe(false) - expect(sends().map((call) => call[2])).toEqual([ - expect.objectContaining({ envelope: expect.objectContaining({ sessionId: sent.sessionId }) }) - ]) - expect(composerDraft(drafted.sessionId)).toBe('PR #1 context') - }) -}) diff --git a/src/renderer/src/lib/agent-session/launch/structured-agent-session-launch.ts b/src/renderer/src/lib/agent-session/launch/structured-agent-session-launch.ts index 9571ccf1f6a..607ab389810 100644 --- a/src/renderer/src/lib/agent-session/launch/structured-agent-session-launch.ts +++ b/src/renderer/src/lib/agent-session/launch/structured-agent-session-launch.ts @@ -1,40 +1,39 @@ import { useAppStore } from '@/store/index' import { reserveStructuredLaunchSlot } from './structured-agent-session-launch-surface' -import type { TuiAgent } from '../../../../../shared/agent-launch/catalog/tui-agent' -import type { ExecutionHostId } from '../../../../../shared/execution-host' import { - abandonStructuredAgentSessionLaunchIntent, createStructuredAgentSessionLaunchIntent, retryStructuredAgentSessionLaunchIntent -} from '@/lib/launch-structured-agent-session' +} from '@/lib/agent-session/launch/structured-agent-session-launch-intent' import { discardStructuredAgentSessionChatSends, - stageStructuredLaunchPrompt, - type StructuredPromptDeliveryResult + stageStructuredLaunchPrompt } from '@/lib/agent-session/launch/structured-agent-session-launch-prompt' +import type { StructuredPromptDeliveryResult } from '@/lib/agent-session/launch/structured-agent-session-launch-prompt' import { launchAndReconcile, - reconcileUnknownLaunch, - type StructuredAgentLaunchReceipt + reconcileUnknownLaunch } from '@/lib/agent-session/launch/structured-agent-session-launch-recovery' +import type { StructuredAgentLaunchReceipt } from '@/lib/agent-session/launch/structured-agent-session-launch-recovery' import { addStructuredLaunchCaller, launchPromptText, joinLaunchDelivery, promptOwner, createStructuredLaunchCallerGroup, - releaseStructuredLaunchCallerAfterUnknownOutcome, - type StructuredAgentLaunchOptions, - type StructuredLaunchCaller + releaseStructuredLaunchCallerAfterUnknownOutcome +} from '@/lib/agent-session/launch/structured-agent-session-launch-callers' +import type { + StructuredAgentLaunchOptions, + StructuredLaunchCaller } from '@/lib/agent-session/launch/structured-agent-session-launch-callers' import { getStructuredAgentSessionLaunchLifecycle, getStructuredLaunchStateBySessionId, notifyStructuredLaunchListeners, setStructuredLaunchState, - structuredLaunchIdentity, - type StructuredLaunchState + structuredLaunchIdentity } from './structured-agent-session-launch-registry' +import type { StructuredLaunchState } from './structured-agent-session-launch-registry' import { markStructuredAgentSessionLaunchCancelled } from './structured-agent-session-launch-cancel' import { restorePersistedStructuredLaunchState } from './structured-agent-session-launch-reload' import { getJoinableStructuredLaunchState } from './structured-agent-session-launch-holders' @@ -55,6 +54,10 @@ import { } from './structured-agent-session-launch-options' import { releaseStructuredLaunchSource } from './structured-agent-session-launch-source-handoff' import * as launchDraft from './structured-agent-session-launch-draft' +import type { TuiAgent } from '../../../../../shared/agent-launch/catalog/tui-agent' +import type { ExecutionHostId } from '../../../../../shared/execution-host' +import { abandonStructuredAgentSessionLaunchIntent } from './structured-agent-session-launch-abandon' +import { adoptPairedHostSeed } from './structured-agent-session-launch-host-seed' type StructuredLaunchStateResult = { state: StructuredLaunchState @@ -72,28 +75,6 @@ export type StructuredAgentLaunchResult = { releaseCallerAfterUnknownOutcome: () => boolean } -/** Each attempt's probe names the seed the paired server's create will use; the picker shows it. */ -function adoptPairedHostSeed( - state: StructuredLaunchState, - seedOptions: StructuredLaunchState['selection']['seed'] -): void { - // The support answer is a fresh seed; continuation baseline belongs to actual host create. - if (state.intent.params.resumeFrom || state.intent.params.forkFrom) { - seedOptions = undefined - } - const { seedPending, ...selection } = state.selection - if (!seedPending && JSON.stringify(seedOptions) === JSON.stringify(state.intent.seedOptions)) { - return - } - if (seedOptions) { - state.intent.seedOptions = seedOptions - } else { - delete state.intent.seedOptions - } - state.selection = { ...selection, seed: seedOptions } - notifyStructuredLaunchListeners(state.intent.sessionId) -} - function resetStructuredLaunchCallers( state: StructuredLaunchState, retainedOpening: boolean diff --git a/src/renderer/src/lib/agent-session/launch/structured-agent-session-new-chat-own-launch.test.ts b/src/renderer/src/lib/agent-session/launch/structured-agent-session-new-chat-own-launch.test.ts deleted file mode 100644 index e532d4a7685..00000000000 --- a/src/renderer/src/lib/agent-session/launch/structured-agent-session-new-chat-own-launch.test.ts +++ /dev/null @@ -1,466 +0,0 @@ -import type * as RuntimeRpcCallModule from '@/runtime/rpc/calls/runtime-rpc-call' -// @vitest-environment happy-dom - -import type * as LaunchErrors from '@/lib/agent-session/launch/structured-agent-session-launch-errors' -import { afterEach, beforeEach, describe, expect, it, vi, type MockInstance } from 'vitest' -import type { RuntimeMobileSessionTabsResult } from '../../../../../shared/runtime-session-contracts' -import type { Tab, TabGroup, TabGroupLayoutNode } from '../../../../../shared/tab-types' -import type { AgentSessionStatusSummary } from '../../../../../shared/agent-session/agent-session-wire' -import type { StructuredAgentSessionLaunchIntent } from '@/lib/launch-structured-agent-session' -import type * as LaunchAdmissionModule from './structured-agent-session-launch-admission' - -const mocks = vi.hoisted(() => ({ - createIntent: vi.fn(), - launch: vi.fn(), - callRuntimeRpc: vi.fn(), - refreshTabs: vi.fn(), - activateTab: vi.fn(), - focusGroup: vi.fn(), - statusBySession: new Map(), - liveSessions: new Set() -})) - -type StoreState = { - unifiedTabsByWorktree: Record - groupsByWorktree: Record - layoutByWorktree: Record - activeGroupIdByWorktree: Record - nativeChatLaunchDraftByTabId: Record -} -/** A workspace split into a left (active) and a right tab group. */ -function emptyStoreState(): StoreState { - const group = (id: string): TabGroup => ({ - id, - worktreeId: 'wt-new-chat', - activeTabId: null, - tabOrder: [] - }) - return { - unifiedTabsByWorktree: {}, - groupsByWorktree: { 'wt-new-chat': [group('group-left'), group('group-right')] }, - layoutByWorktree: { - 'wt-new-chat': { - type: 'split', - direction: 'horizontal', - first: { type: 'leaf', groupId: 'group-left' }, - second: { type: 'leaf', groupId: 'group-right' } - } - }, - activeGroupIdByWorktree: { 'wt-new-chat': 'group-left' }, - nativeChatLaunchDraftByTabId: {} - } -} -const owner = vi.hoisted((): { store: ReturnType | null } => ({ - store: null -})) - -vi.mock('sonner', () => ({ toast: { error: vi.fn(), info: vi.fn(), message: vi.fn() } })) -vi.mock('@/i18n/i18n', () => ({ translate: (_key: string, fallback: string) => fallback })) -vi.mock('@/lib/agent-catalog/agent-catalog', () => ({ - getAgentLabel: () => 'Codex', - getAgentCatalog: () => [{ id: 'codex', label: 'Codex' }] -})) -const launchErrorMocks = vi.hoisted(() => { - class StructuredAgentSessionCreateRefusalError extends Error {} - class StructuredAgentSessionOwnerUnresolvedError extends Error {} - return { StructuredAgentSessionCreateRefusalError, StructuredAgentSessionOwnerUnresolvedError } -}) - -vi.mock('@/lib/agent-session/launch/structured-agent-session-launch-errors', async () => ({ - ...(await vi.importActual( - '@/lib/agent-session/launch/structured-agent-session-launch-errors' - )), - ...launchErrorMocks -})) - -vi.mock('@/lib/agent-session/launch/structured-agent-session-launch-create-call', () => ({ - launchStructuredAgentSession: mocks.launch -})) - -vi.mock('@/lib/launch-structured-agent-session', () => { - return { - createStructuredAgentSessionLaunchIntent: mocks.createIntent, - retryStructuredAgentSessionLaunchIntent: vi.fn(), - abandonStructuredAgentSessionLaunchIntent: vi.fn(), - launchStructuredAgentSession: mocks.launch, - StructuredAgentSessionCreateRefusalError: - launchErrorMocks.StructuredAgentSessionCreateRefusalError, - StructuredAgentSessionOwnerUnresolvedError: - launchErrorMocks.StructuredAgentSessionOwnerUnresolvedError - } -}) -// Each pick opens its chat once its host admits it; here this machine admits at once. -vi.mock( - '@/lib/agent-session/launch/structured-agent-session-launch-admission', - async (importOriginal) => ({ - ...(await importOriginal()), - beginHostAdmittedStructuredLaunch: (args: { openAdmitted: () => unknown }) => - args.openAdmitted() - }) -) -vi.mock('@/runtime/local-structured-session-tabs-sync/inventory-refresh', () => ({ - refreshLocalStructuredSessionTabs: mocks.refreshTabs -})) -vi.mock('../../../runtime/native-chat/requests/structured-agent-session-call', () => ({ - // Sends reach the runtime RPC through this wrapper, as in the app. - callStructuredAgentSession: (target: unknown, method: string, params?: unknown) => - mocks.callRuntimeRpc(target, method, params) -})) -// Switch-on, main answers the window's chat opens and its frames draw them. -vi.mock('@/runtime/rpc/calls/runtime-rpc-call', async (importOriginal) => - ( - await import('@/runtime/workspace-layout/testing/layout-apply-test-transport.test-fixture') - ).runtimeRpcClientWithLayoutApply({ - ...(await importOriginal()), - callRuntimeRpc: mocks.callRuntimeRpc - }) -) -vi.mock('@/runtime/rpc/compatibility/runtime-compatibility-probe', () => ({ - ensureRuntimeEnvironmentCompatible: vi.fn(async () => null) -})) -vi.mock('@/runtime/workspace-layout/frames/runtime-layout-client', async (importOriginal) => - ( - await import('@/runtime/workspace-layout/testing/layout-apply-test-transport.test-fixture') - ).runtimeLayoutClientWithTestFrames(await importOriginal()) -) -vi.mock('@/runtime/native-chat/status/structured-agent-session-status-feed', () => ({ - getStructuredAgentSessionStatusFeed: () => ({ - getSessionObservation: (sessionId: string) => - mocks.liveSessions.has(sessionId) ? 'live' : 'unverifiable', - getSnapshot: () => - new Map( - [...mocks.statusBySession].map(([sessionId, status]) => [sessionId, { sessionId, status }]) - ) - }) -})) -vi.mock('@/store/index', async () => - (await import('../../launch-parity-renderer.test-fixture')).launchStoreModuleMock(owner) -) - -import { resetStructuredAgentSessionSendsForTests } from '@/components/native-chat/session/structured/delivery/structured-agent-session-message-sender' -import { clearNativeChatComposerDraftsForTests as clearNativeChatDraftCacheForTests } from '@/components/native-chat/drafts/native-chat-draft-reset' -import { adoptAgentSessionLaunchVerdict } from './routing/agent-session-launch-plan' -import { - beginStructuredAgentSessionProvisionalLaunch, - type StructuredAgentSessionProvisionalLaunch -} from '../structured-agent-session-provisional-tab' -import { - getStructuredAgentSessionLaunchLifecycle, - resetStructuredAgentLaunchRegistryForTests -} from './structured-agent-session-launch-registry' -import { - discardStructuredLaunchPrompts, - hasStagedStructuredLaunchPrompt -} from './structured-agent-session-launch-prompt' -import { resetStructuredAgentLaunchPersistenceForTests } from './structured-agent-session-launch-persistence' -import { layoutApplyTestTransport } from '@/runtime/workspace-layout/testing/layout-apply-test-transport.test-fixture' -import { isPendingTab } from '@/runtime/workspace-layout/intents/layout-owner-pending-tabs' -import { ORCA_LAYOUT_OWNER_IS_MAIN } from '../../../../../shared/layout-owner-switch' -import { createTestStore, seedStore } from '@/store/testing/app-store-test-fixture' -import { makeWorktree } from '@/store/slices/worktrees/worktree.test-fixture' -import { - drawTabsFromMain, - type TabsDrawnFromMain -} from '@/store/slices/tabs/tabs-drawn-from-main.test-fixture' - -const WORKTREE_ID = 'wt-new-chat' - -function launchIntent( - sessionId: string, - worktreeId = WORKTREE_ID -): StructuredAgentSessionLaunchIntent { - return { - worktreeId, - sessionId, - executionHostId: 'local', - target: { kind: 'local' }, - agent: 'codex', - params: { - envelope: { - sessionId, - clientOperationId: `operation-${sessionId}`, - expectedRuntimeFence: null, - payloadFingerprint: `fingerprint-${sessionId}` - }, - worktree: `id:${worktreeId}`, - agent: 'codex' - } - } -} - -function published(...sessionIds: string[]): RuntimeMobileSessionTabsResult[] { - return [WORKTREE_ID, 'wt-other'].map((worktree) => ({ - worktree, - publicationEpoch: 'epoch-1', - snapshotVersion: 1, - activeGroupId: null, - activeTabId: null, - activeTabType: null, - tabs: sessionIds.map((sessionId) => ({ - type: 'agent-session', - id: `tab-${sessionId}`, - title: 'Codex', - sessionId, - agent: 'codex', - isActive: false - })) - })) -} - -let main: TabsDrawnFromMain | null = null -let warnings: MockInstance - -// Frame-drawn split workspace: each side needs a terminal because main drops empty groups. -async function seedSplit(): Promise { - const real = createTestStore() - const side = (groupId: string): Tab => ({ - id: `terminal-${groupId}`, - entityId: `terminal-${groupId}`, - groupId, - worktreeId: WORKTREE_ID, - contentType: 'terminal', - label: 'Terminal', - customLabel: null, - color: null, - sortOrder: 0, - createdAt: 1 - }) - const seeded = emptyStoreState() - seedStore(real, { - worktreesByRepo: { repo: [makeWorktree({ id: WORKTREE_ID, repoId: 'repo' })] }, - activeWorktreeId: WORKTREE_ID, - tabsByWorktree: { - [WORKTREE_ID]: (ORCA_LAYOUT_OWNER_IS_MAIN ? ['group-left', 'group-right'] : []).map( - (groupId, index) => ({ - id: `terminal-${groupId}`, - ptyId: null, - worktreeId: WORKTREE_ID, - title: 'Terminal', - customTitle: null, - color: null, - sortOrder: index, - createdAt: 1 - }) - ) - }, - unifiedTabsByWorktree: { - [WORKTREE_ID]: ORCA_LAYOUT_OWNER_IS_MAIN ? [side('group-left'), side('group-right')] : [] - }, - groupsByWorktree: { - [WORKTREE_ID]: seeded.groupsByWorktree[WORKTREE_ID]!.map((group) => ({ - ...group, - activeTabId: ORCA_LAYOUT_OWNER_IS_MAIN ? `terminal-${group.id}` : null, - tabOrder: ORCA_LAYOUT_OWNER_IS_MAIN ? [`terminal-${group.id}`] : [] - })) - }, - layoutByWorktree: seeded.layoutByWorktree, - activeGroupIdByWorktree: seeded.activeGroupIdByWorktree - }) - owner.store = real - const { activateTab, focusGroup } = real.getState() - real.setState({ - activateTab: mocks.activateTab.mockImplementation(activateTab), - focusGroup: mocks.focusGroup.mockImplementation(focusGroup) - }) - main = await drawTabsFromMain(real) -} - -/** The chat tabs the workspace shows: switch-on, as main's frames drew them. */ -async function openedChats(): Promise { - await main?.settle() - const tabs = owner.store!.getState().unifiedTabsByWorktree[WORKTREE_ID] ?? [] - const chats = tabs.filter((tab) => tab.contentType === 'agent-session') - for (const tab of chats) { - expect(owner.store!.getState().getTab(tab.id)).toBe(tab) - } - return chats -} - -const owned: { - handle: Exclude - done: boolean -}[] = [] -const heldCreates: { - intent: StructuredAgentSessionLaunchIntent - resolve: (receipt: { sessionId: string; fence: number }) => void -}[] = [] -function holdCreates(): void { - mocks.launch.mockImplementation( - (intent: StructuredAgentSessionLaunchIntent) => - new Promise<{ sessionId: string; fence: number }>((resolve) => - heldCreates.push({ intent, resolve }) - ) - ) -} - -const first = launchIntent('session-first') -const second = launchIntent('session-second') - -function pick( - requestId: string, - overrides: { - agent?: 'claude' | 'codex' - worktreeId?: string - prompt?: string - /** The split the pick was made in; none means the workspace's active group. */ - group?: string - } = {} -): Exclude { - const launch = beginStructuredAgentSessionProvisionalLaunch({ - plan: adoptAgentSessionLaunchVerdict({ - route: 'structured-native-chat', - requestId, - agent: overrides.agent ?? 'codex', - worktreeId: overrides.worktreeId ?? WORKTREE_ID, - executionHostId: 'local', - ...(overrides.prompt - ? { prompt: overrides.prompt, promptDelivery: 'submit-after-ready' as const } - : {}) - }), - hooks: {}, - ...(overrides.group ? { targetGroupId: overrides.group } : {}) - }) - if (!launch || launch.sessionId === null) { - throw new Error('expected a local chat') - } - const pending = { handle: launch, done: false } - owned.push(pending) - void launch.settlement.then(() => { - pending.done = true - }) - return launch -} - -async function flush(): Promise { - for (let i = 0; i < 20; i += 1) { - await Promise.resolve() - } -} - -/** The first chat published and its host's journal holds no request. */ -async function publishIdle(sessionId: string): Promise { - await flush() - expect(getStructuredAgentSessionLaunchLifecycle(WORKTREE_ID, sessionId)).toBeNull() - mocks.liveSessions.add(sessionId) - mocks.statusBySession.set(sessionId, null) -} - -beforeEach(() => { - vi.resetAllMocks() - localStorage.clear() - clearNativeChatDraftCacheForTests() - resetStructuredAgentLaunchPersistenceForTests() - resetStructuredAgentLaunchRegistryForTests() - resetStructuredAgentSessionSendsForTests() - for (const sessionId of ['session-first', 'session-second', 'session-third']) { - discardStructuredLaunchPrompts(sessionId) - } - mocks.statusBySession.clear() - mocks.liveSessions.clear() - mocks.createIntent - .mockReturnValueOnce(first) - .mockReturnValueOnce(second) - .mockReturnValueOnce(launchIntent('session-third')) - mocks.launch.mockImplementation((intent: StructuredAgentSessionLaunchIntent) => - Promise.resolve({ sessionId: intent.sessionId, fence: 1 }) - ) - mocks.refreshTabs.mockResolvedValue(published(first.sessionId, second.sessionId)) - mocks.callRuntimeRpc.mockResolvedValue({ - ok: true, - value: { submission: { dispatchState: 'accepted' } } - }) -}) - -beforeEach(async () => { - await seedSplit() - warnings = vi.spyOn(console, 'warn') - expect(owner.store!.getState().getTab('structured-agent-session-session-first')).toBeNull() -}) - -afterEach(async () => { - for (const pending of owned) { - if (!pending.done) { - pending.handle.cancel() - } - } - for (const { intent, resolve } of heldCreates.splice(0)) { - resolve({ sessionId: intent.sessionId, fence: 1 }) - } - await Promise.all(owned.splice(0).map(({ handle }) => handle.settlement)) - await main?.settle() - expect(heldCreates).toEqual([]) - expect(layoutApplyTestTransport.pendingCount).toBe(0) - for (const tab of owner.store!.getState().unifiedTabsByWorktree[WORKTREE_ID] ?? []) { - expect(isPendingTab(tab.id)).toBe(false) - } - expect( - warnings.mock.calls.filter( - ([message]) => message === '[layout-owner] pending tab waiter threw:' - ) - ).toEqual([]) - main?.close() - vi.restoreAllMocks() - main = null - owner.store = null -}) - -describe('a second "new chat" with no text', () => { - it('opens a second chat while the first empty one is still starting', async () => { - holdCreates() - const firstPick = pick('plus-pick-1') - const secondPick = pick('plus-pick-2') - - expect(firstPick.sessionId).toBe(first.sessionId) - expect(secondPick.sessionId).toBe(second.sessionId) - expect(await openedChats()).toHaveLength(2) - }) - - it('opens a second chat beside an empty one that published and sits idle', async () => { - pick('plus-pick-1') - await publishIdle(first.sessionId) - - const secondPick = pick('plus-pick-2') - - expect(secondPick.sessionId).toBe(second.sessionId) - expect(await openedChats()).toHaveLength(2) - await expect(secondPick.settlement).resolves.toEqual({ - kind: 'structured', - sessionId: second.sessionId - }) - }) - - it('opens one chat when the same pick is delivered twice', () => { - holdCreates() - const firstPick = pick('plus-pick-1') - - expect(pick('plus-pick-1').sessionId).toBe(firstPick.sessionId) - expect(mocks.createIntent).toHaveBeenCalledOnce() - }) -}) - -describe('a "new chat" with text', () => { - it('opens its own chat beside an empty one still starting', async () => { - holdCreates() - const blank = pick('plus-pick-1') - - const notes = pick('notes-send', { prompt: 'review notes' }) - - expect(notes.sessionId).toBe(second.sessionId) - expect(await openedChats()).toHaveLength(2) - expect(hasStagedStructuredLaunchPrompt(blank.sessionId)).toBe(false) - expect(hasStagedStructuredLaunchPrompt(second.sessionId)).toBe(true) - }) - - it('opens its own chat in the split it was sent from', async () => { - holdCreates() - pick('plus-pick-1', { group: 'group-left' }) - - const notes = pick('notes-send', { prompt: 'review notes', group: 'group-right' }) - - expect(notes.sessionId).toBe(second.sessionId) - expect((await openedChats()).find((tab) => tab.entityId === second.sessionId)?.groupId).toBe( - 'group-right' - ) - expect(mocks.focusGroup).not.toHaveBeenCalled() - }) -}) diff --git a/src/renderer/src/lib/agent-session/messaging/notes-send-agent-targets.ts b/src/renderer/src/lib/agent-session/messaging/notes-send-agent-targets.ts index f3e1ba270a6..8cdfd5c380e 100644 --- a/src/renderer/src/lib/agent-session/messaging/notes-send-agent-targets.ts +++ b/src/renderer/src/lib/agent-session/messaging/notes-send-agent-targets.ts @@ -1,28 +1,23 @@ -import { - projectedStructuredChatTabName, - type StructuredChatTabNames -} from '@/runtime/native-chat/naming/structured-chat-tab-name' -import { structuredChatTabById } from '../../structured-chat-tab-index' -import type { AgentType } from '../../../../../shared/agent-status/contracts/agent-status-types' -import type { AppState } from '@/store/types' +import { projectedStructuredChatTabName } from '@/runtime/native-chat/naming/structured-chat-tab-name' +import type { StructuredChatTabNames } from '@/runtime/native-chat/naming/structured-chat-tab-name' +import { structuredChatTabById } from '../tab-identity/structured-chat-tab-index' import { isTerminalLeafId, makePaneKey } from '../../../../../shared/workspace-layout/stable-pane-id' import { resolveTerminalTitleAgentType } from '../../../../../shared/agent-status/title/terminal-title-agent-type' -import type { TerminalTab } from '../../../../../shared/workspace-layout/terminal-tab-types' import { detectAgentSendTitleStatus } from './agent-send-title-status' -import { - resolveRuntimePaneTitleLeafResolution, - type RuntimePaneTitleLeafResolution -} from '../../../../../shared/runtime-pane-title-leaf-id' +import { resolveRuntimePaneTitleLeafResolution } from '../../../../../shared/runtime-pane-title-leaf-id' +import type { RuntimePaneTitleLeafResolution } from '../../../../../shared/runtime-pane-title-leaf-id' import { deriveRunningAgentSendTargets, deriveStatuslessStructuredAgentSendTargets, - runningAgentMessageTarget, - type RunningAgentSendTarget, - type RunningAgentTargetState + runningAgentMessageTarget } from './running-agent-targets' +import type { RunningAgentSendTarget, RunningAgentTargetState } from './running-agent-targets' +import type { AgentType } from '../../../../../shared/agent-status/contracts/agent-status-types' +import type { AppState } from '@/store/types' +import type { TerminalTab } from '../../../../../shared/workspace-layout/terminal-tab-types' import type { AgentMessageTarget } from './agent-message-target' export type NotesSendAgentTargetState = RunningAgentTargetState & diff --git a/src/renderer/src/lib/agent-session/open/activate-ai-vault-structured-session-reveal.test.ts b/src/renderer/src/lib/agent-session/open/activate-ai-vault-structured-session-reveal.test.ts new file mode 100644 index 00000000000..bb9797df5d7 --- /dev/null +++ b/src/renderer/src/lib/agent-session/open/activate-ai-vault-structured-session-reveal.test.ts @@ -0,0 +1,50 @@ +/** Negotiate reveal against the workspace’s answering host; local build capabilities say nothing about a paired host’s version. */ + +import { beforeEach, describe, expect, it, vi } from 'vitest' +import './activate-ai-vault-structured-session' +import '../../../../../shared/agent-session/structured-agent-session-surface-capabilities' +import { revealStructuredSession } from './open-existing-structured-session' + +const mocks = vi.hoisted(() => ({ + call: vi.fn(), + supports: vi.fn(), + environmentIdFor: vi.fn() +})) + +// The real target resolution is the thing under test; only the transport is stubbed. +vi.mock('@/runtime/rpc/calls/runtime-rpc-call', () => ({ + callRuntimeRpc: mocks.call +})) +vi.mock('@/runtime/rpc/compatibility/runtime-capability-proof', () => ({ + runtimeEnvironmentSupportsCapability: mocks.supports +})) + +vi.mock('../../workspace/ownership/worktree-runtime-owner', () => ({ + runtimeEnvironmentIdOrLocalUnlessTwin: mocks.environmentIdFor +})) + +const target = { worktreeId: 'workspace-1', sessionId: 'session-1' } + +beforeEach(() => { + vi.clearAllMocks() + mocks.call.mockResolvedValue({ + ok: true, + sessionId: target.sessionId, + workspaceId: target.worktreeId, + agent: 'codex' + }) + mocks.supports.mockResolvedValue(true) + mocks.environmentIdFor.mockReturnValue(null) +}) + +describe('revealStructuredSession', () => { + it('reports a paired host that cannot open it rather than sending an unknown method', async () => { + // An old host’s method_not_found must request an update rather than claim the chat is gone. + mocks.environmentIdFor.mockReturnValue('legacy-env') + mocks.supports.mockResolvedValue(false) + + await expect(revealStructuredSession(target)).resolves.toBe('host-cannot-open') + + expect(mocks.call).not.toHaveBeenCalled() + }) +}) diff --git a/src/renderer/src/lib/activate-ai-vault-structured-session.ts b/src/renderer/src/lib/agent-session/open/activate-ai-vault-structured-session.ts similarity index 85% rename from src/renderer/src/lib/activate-ai-vault-structured-session.ts rename to src/renderer/src/lib/agent-session/open/activate-ai-vault-structured-session.ts index bf3820bafd0..e3dfa231285 100644 --- a/src/renderer/src/lib/activate-ai-vault-structured-session.ts +++ b/src/renderer/src/lib/agent-session/open/activate-ai-vault-structured-session.ts @@ -1,24 +1,18 @@ -import type { AiVaultSession } from '../../../shared/ai-vault/contracts/ai-vault-types' +import { openDesktopStructuredSessionInteraction } from './open-existing-structured-session' +import type { StructuredSessionOpenAdapterDeps } from './open-existing-structured-session' +import { showAgentPaneUnavailable } from '@/components/terminal-pane/agent-status/stale-agent-row' +import { translate } from '@/i18n/i18n' +import { toast } from 'sonner' +import { activateAndRevealWorktree } from '../../workspace/activation/worktree-activation' +import { activateWslMovedWorkspace } from '../../workspace/activation/wsl-moved-chat-activation' +import { useAppStore } from '@/store/index' +import type { AiVaultSession } from '../../../../../shared/ai-vault/contracts/ai-vault-types' import type { StructuredSessionOpenSource, StructuredSessionOpenResult, StructuredSessionOpenDeps -} from '../../../shared/open-structured-agent-session' -import type { RuntimeClientTarget } from '../../../shared/runtime-client-target' -import { - openDesktopStructuredSessionInteraction, - type StructuredSessionOpenAdapterDeps -} from './open-existing-structured-session' -import { showAgentPaneUnavailable } from '@/components/terminal-pane/agent-status/stale-agent-row' -import { translate } from '@/i18n/i18n' -import { toast } from 'sonner' -import { activateAndRevealWorktree } from './workspace/activation/worktree-activation' -import { activateWslMovedWorkspace } from './workspace/activation/wsl-moved-chat-activation' -import { useAppStore } from '@/store' -export { - revealStructuredSession, - type StructuredSessionRevealOutcome -} from './open-existing-structured-session' +} from '../../../../../shared/open-structured-agent-session' +import type { RuntimeClientTarget } from '../../../../../shared/runtime-client-target' type StructuredSessionActivationDeps = StructuredSessionOpenAdapterDeps & { unavailable: (agent?: string) => void diff --git a/src/renderer/src/lib/open-agent-message-sender.ts b/src/renderer/src/lib/agent-session/open/open-agent-message-sender.ts similarity index 93% rename from src/renderer/src/lib/open-agent-message-sender.ts rename to src/renderer/src/lib/agent-session/open/open-agent-message-sender.ts index ed2094ebf20..7df9506b3b5 100644 --- a/src/renderer/src/lib/open-agent-message-sender.ts +++ b/src/renderer/src/lib/agent-session/open/open-agent-message-sender.ts @@ -3,21 +3,18 @@ import { toast } from 'sonner' import { translate } from '@/i18n/i18n' import { isRuntimeCompatBlockError } from '@/runtime/rpc/compatibility/runtime-protocol-compat' -import type { OrchestrationCrewRow } from '../../../shared/orchestration/orchestration-crew' -import type { AgentMessageSource } from '../../../shared/agent-session/agent-session-message-source' import { openDesktopStructuredSession, - structuredSessionOpenFeedbackText, - type StructuredSessionOpenFeedback + structuredSessionOpenFeedbackText } from './activate-ai-vault-structured-session' -import { useAppStore } from '@/store' -import type { RuntimeClientTarget } from '../../../shared/runtime-client-target' +import type { StructuredSessionOpenFeedback } from './activate-ai-vault-structured-session' +import { useAppStore } from '@/store/index' import { focusTerminal, openLocatedAgentMessageSender, - showLookupFailure, - type LookupFailure + showLookupFailure } from './open-located-agent-message-sender' +import type { LookupFailure } from './open-located-agent-message-sender' import { unnamedSenderLabel } from '@/components/native-chat/messages/agent-senders/native-chat-agent-message-sender-label' import { agentMessageSenderOpens, @@ -25,13 +22,16 @@ import { agentMessageSenderUnavailableText, resolveAgentMessageSenderTarget } from '@/components/native-chat/messages/agent-senders/native-chat-agent-message-sender-target' -import { getKnownExecutionHostIdForWorktree } from './workspace/ownership/worktree-runtime-owner' +import { getKnownExecutionHostIdForWorktree } from '../../workspace/ownership/worktree-runtime-owner' import { executionHostIdForStructuredTarget, resolveStructuredAgentSessionOwner, structuredAgentSessionOwnerForTab, structuredAgentSessionTargetForHost } from '@/runtime/native-chat/session-ownership/structured-agent-session-owner' +import type { OrchestrationCrewRow } from '../../../../../shared/orchestration/orchestration-crew' +import type { AgentMessageSource } from '../../../../../shared/agent-session/agent-session-message-source' +import type { RuntimeClientTarget } from '../../../../../shared/runtime-client-target' type Sender = AgentMessageSource['senders'][number] const opensInFlight = new Map>() diff --git a/src/renderer/src/lib/open-existing-structured-session.ts b/src/renderer/src/lib/agent-session/open/open-existing-structured-session.ts similarity index 93% rename from src/renderer/src/lib/open-existing-structured-session.ts rename to src/renderer/src/lib/agent-session/open/open-existing-structured-session.ts index d4206ebd480..8bdddf8d8a7 100644 --- a/src/renderer/src/lib/open-existing-structured-session.ts +++ b/src/renderer/src/lib/agent-session/open/open-existing-structured-session.ts @@ -1,29 +1,31 @@ import { openStructuredAgentSession, - structuredSessionOpenFailure, - type StructuredSessionOpenSource, - type StructuredSessionOpenResult, - type StructuredSessionOpenDeps, - type StructuredSessionOpenTarget, - type StructuredSessionOpenTab, - type StructuredSessionOpenFailure -} from '../../../shared/open-structured-agent-session' -import type { OrchestrationPartyLocationResult } from '../../../shared/orchestration/orchestration-caller-status' + structuredSessionOpenFailure +} from '../../../../../shared/open-structured-agent-session' +import type { + StructuredSessionOpenSource, + StructuredSessionOpenResult, + StructuredSessionOpenDeps, + StructuredSessionOpenTarget, + StructuredSessionOpenTab, + StructuredSessionOpenFailure +} from '../../../../../shared/open-structured-agent-session' import { findStructuredAgentSessionTab, activateStructuredAgentSessionById -} from './agent-session/structured-agent-session-tab-activation' -import { useAppStore } from '@/store' -import { runtimeEnvironmentIdOrLocalUnlessTwin } from './workspace/ownership/worktree-runtime-owner' +} from '../structured-agent-session-tab-activation' +import { useAppStore } from '@/store/index' +import { runtimeEnvironmentIdOrLocalUnlessTwin } from '../../workspace/ownership/worktree-runtime-owner' import { callRuntimeRpc } from '@/runtime/rpc/calls/runtime-rpc-call' import { runtimeEnvironmentSupportsCapability } from '@/runtime/rpc/compatibility/runtime-capability-proof' -import type { RuntimeClientTarget } from '../../../shared/runtime-client-target' import { runtimeTargetForOwnerEnvironment } from '@/runtime/rpc/targets/runtime-client-target' import { toRuntimeWorktreeSelector } from '@/runtime/rpc/targets/runtime-worktree-selector' import { refreshLocalStructuredSessionWorktreeTabs } from '@/runtime/local-structured-session-tabs-sync/inventory-refresh' -import { STRUCTURED_AGENT_SESSION_REVEAL_RUNTIME_CAPABILITY } from '../../../shared/agent-session/structured-agent-session-surface-capabilities' +import { STRUCTURED_AGENT_SESSION_REVEAL_RUNTIME_CAPABILITY } from '../../../../../shared/agent-session/structured-agent-session-surface-capabilities' import { isRuntimeCompatBlockError } from '@/runtime/rpc/compatibility/runtime-protocol-compat' import { executionHostIdForStructuredTarget } from '@/runtime/native-chat/session-ownership/structured-agent-session-owner' +import type { OrchestrationPartyLocationResult } from '../../../../../shared/orchestration/orchestration-caller-status' +import type { RuntimeClientTarget } from '../../../../../shared/runtime-client-target' const STRUCTURED_SESSION_RESTORE_TIMEOUT_MS = 5_000 diff --git a/src/renderer/src/lib/open-located-agent-message-sender.ts b/src/renderer/src/lib/agent-session/open/open-located-agent-message-sender.ts similarity index 90% rename from src/renderer/src/lib/open-located-agent-message-sender.ts rename to src/renderer/src/lib/agent-session/open/open-located-agent-message-sender.ts index ad5c448d1cd..35888a1df31 100644 --- a/src/renderer/src/lib/open-located-agent-message-sender.ts +++ b/src/renderer/src/lib/agent-session/open/open-located-agent-message-sender.ts @@ -2,11 +2,9 @@ // tab, else that same pane through its host. Never whatever the card's saved address names now. import { toast } from 'sonner' -import { useAppStore } from '@/store' -import type { AppState } from '@/store/types' +import { useAppStore } from '@/store/index' import { callRuntimeRpc } from '@/runtime/rpc/calls/runtime-rpc-call' import { RuntimeRpcCallError } from '@/runtime/rpc/calls/runtime-rpc-result' -import type { RuntimeTerminalResolvePane } from '../../../shared/runtime-terminal-contracts' import { isRuntimeCompatBlockError } from '@/runtime/rpc/compatibility/runtime-protocol-compat' import { focusRendererTerminalHandle, @@ -15,17 +13,17 @@ import { import { showAgentPaneUnavailable } from '@/components/terminal-pane/agent-status/stale-agent-row' import { activateAiVaultStructuredSession, - structuredSessionOpenFeedback, - type StructuredSessionOpenFeedback + structuredSessionOpenFeedback } from './activate-ai-vault-structured-session' -import type { LocatedAgentSender } from '@/runtime/native-chat/agent-senders/agent-sender-associations' -import { - agentMessageSenderUnavailableText, - type AgentMessageSenderTarget -} from '@/components/native-chat/messages/agent-senders/native-chat-agent-message-sender-target' +import type { StructuredSessionOpenFeedback } from './activate-ai-vault-structured-session' +import { agentMessageSenderUnavailableText } from '@/components/native-chat/messages/agent-senders/native-chat-agent-message-sender-target' +import type { AgentMessageSenderTarget } from '@/components/native-chat/messages/agent-senders/native-chat-agent-message-sender-target' import { activateWorktreeAgentPane } from '@/components/sidebar/workspace-card/activity/use-worktree-agent-activation' -import { parsePaneKey } from '../../../shared/workspace-layout/stable-pane-id' +import { parsePaneKey } from '../../../../../shared/workspace-layout/stable-pane-id' import { structuredAgentSessionTargetForHost } from '@/runtime/native-chat/session-ownership/structured-agent-session-owner' +import type { AppState } from '@/store/types' +import type { RuntimeTerminalResolvePane } from '../../../../../shared/runtime-terminal-contracts' +import type { LocatedAgentSender } from '@/runtime/native-chat/agent-senders/agent-sender-associations' /** older-host identifies the chat host; update may mean either side, and unreachable proves nothing. */ export type LookupFailure = 'older-host' | 'update' | 'unreachable' diff --git a/src/renderer/src/lib/agent-session/options/structured-agent-session-selection-lifetime.test.tsx b/src/renderer/src/lib/agent-session/options/structured-agent-session-selection-lifetime.test.tsx deleted file mode 100644 index fadc83b3b5e..00000000000 --- a/src/renderer/src/lib/agent-session/options/structured-agent-session-selection-lifetime.test.tsx +++ /dev/null @@ -1,550 +0,0 @@ -import { resetHostModelCatalogSnapshotsForTests } from '../../../runtime/native-chat/model-catalogs/host-model-catalog-snapshots' -import type { StructuredAgentSessionMutate } from '../../../components/native-chat/session/structured/writes/use-structured-agent-session-mutate' -import type { AgentSessionOptionsResult } from '../../../../../shared/agent-session/options/agent-session-options-result' -// @vitest-environment happy-dom -import { act, cleanup, renderHook, waitFor } from '@testing-library/react' -import { afterEach, expect, it, vi } from 'vitest' -import type { StructuredAgentSessionLaunchIntent } from '../../launch-structured-agent-session' -import type { RuntimeStatus } from '../../../../../shared/runtime-session-contracts' -import { useAppStore } from '../../../store/index' -import { useStructuredAgentSessionOptionState } from '../../../components/native-chat/session/options/structured/use-structured-agent-session-option-state' -import { structuredAgentSessionSeedCatalog } from '../../../../../shared/agent-session/options/structured-agent-session-seed-catalog' -import { structuredAgentSessionMessageSelection } from '../../../../../shared/agent-session/options/structured-agent-session-option-view' -import { structuredAgentSessionModelId } from '../../../../../shared/agent-session/options/structured-agent-session-option-state' -import { startStructuredAgentLaunch } from '../launch/structured-agent-session-launch' -import { - holdStructuredAgentSessionLaunchOption, - structuredLaunchSelectionController -} from '../launch/structured-agent-session-launch-options' -import { - getStructuredLaunchStateBySessionId, - resetStructuredAgentLaunchRegistryForTests -} from '../launch/structured-agent-session-launch-registry' -import { useStructuredAgentSessionOptions } from '../../../components/native-chat/session/options/structured/use-structured-agent-session-options' -import { listRuntimeSessionHostsForStartup } from '../../../app-shell/startup-runtime-session-hosts' -import { structuredAgentSessionTargetForTab } from '../../../runtime/native-chat/session-ownership/structured-agent-session-owner' -import type { PublicKnownRuntimeEnvironment } from '../../../../../shared/remote-runtime/host-catalog/runtime-environments' -import { - registerStructuredSelectionCatalogStore, - forgetStructuredSessionSelection, - structuredSessionSelectionController -} from './structured-agent-session-selection-controller' - -const unavailableMutation: StructuredAgentSessionMutate = async () => null - -const transport = vi.hoisted(() => ({ - create: vi.fn(), - intent: vi.fn(), - call: vi.fn(), - remember: vi.fn() -})) -vi.mock('../../launch-structured-agent-session', () => ({ - createStructuredAgentSessionLaunchIntent: transport.intent, - abandonStructuredAgentSessionLaunchIntent: vi.fn() -})) -vi.mock('../launch/structured-agent-session-launch-create-call', () => ({ - launchStructuredAgentSession: transport.create -})) -vi.mock('../../../runtime/native-chat/requests/structured-agent-session-call', () => ({ - callStructuredAgentSession: transport.call -})) -vi.mock( - '../../../components/native-chat/session/status/structured-agent-session-status-hooks', - () => ({ - useStructuredAgentSessionPermissionStatus: () => ({ permissionReport: false, observation: 0 }) - }) -) -vi.mock( - '../../../runtime/native-chat/host-capabilities/structured-agent-session-host-capability', - () => ({ - useStructuredAgentSessionHostCapability: () => true, - useStructuredAgentSessionOwnPermissionState: () => 'supported', - useStructuredAgentSessionHostCapabilityState: () => 'unknown', - structuredAgentSessionHostKey: () => 'paired-host' - }) -) -vi.mock( - '../../../components/native-chat/session/options/native-chat-session-option-settings-write', - () => ({ - enqueueSessionOptionSettingsWrite: transport.remember - }) -) -vi.mock('sonner', () => ({ toast: { error: vi.fn(), warning: vi.fn(), dismiss: vi.fn() } })) - -const target = { kind: 'environment', environmentId: 'paired-host' } as const -const sessionId = 'codex_reconnect' -const initial = useAppStore.getState() -const catalog = structuredAgentSessionSeedCatalog('codex') -const seed = { model: 'gpt-5.5' } -function publish(runtimeId: string, sequence: number) { - // oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: the production status slice reads runtime identity and protocol fields here. - const status = { - runtimeId, - runtimeProtocolVersion: 3, - minCompatibleRuntimeClientVersion: 3 - } as RuntimeStatus - useAppStore.getState().setRuntimeEnvironmentStatus( - target.environmentId, - { - status, - checkedAt: sequence, - snapshot: { - environmentId: target.environmentId, - pairingRevision: 1, - sequence, - checkedAt: sequence, - status, - verification: 'verified', - transport: 'ready' - } - }, - { suppressDisconnectToast: true } - ) -} -afterEach(() => { - cleanup() - forgetStructuredSessionSelection(sessionId) - resetStructuredAgentLaunchRegistryForTests() - useAppStore.setState(initial, true) - vi.clearAllMocks() -}) - -it.each([false, true])( - 'keeps launch, hook, drawn and captured operations through the real runtime transition (newer pick=%s)', - async (newer) => { - const intent: StructuredAgentSessionLaunchIntent = { - worktreeId: 'wt-lifetime', - executionHostId: 'runtime:paired-host', - target, - sessionId, - agent: 'codex', - seedOptions: seed, - params: { - agent: 'codex', - worktree: 'id:wt-lifetime', - envelope: { - sessionId, - clientOperationId: 'original-create', - payloadFingerprint: 'frozen', - expectedRuntimeFence: null - } - } - } - transport.intent.mockReturnValue(intent) - const create = Promise.withResolvers<{ sessionId: string; fence: number }>() - transport.create.mockReturnValue(create.promise) - const replies = [Promise.withResolvers(), Promise.withResolvers()] - const reads: ReturnType>[] = [] - let sends = 0 - transport.call.mockImplementation((_target, method) => { - if (method === 'agentSession.options') { - const read = Promise.withResolvers() - reads.push(read) - return read.promise - } - if (method === 'agentSession.setOption') { - return replies[sends++].promise - } - return Promise.resolve({}) - }) - useAppStore.getState().setRuntimeEnvironments([environment(1)]) - publish('runtime-A', 1) - const launch = startStructuredAgentLaunch('wt-lifetime', 'codex', { - requestId: 'lifetime', - executionHostId: 'runtime:paired-host' - }) - const state = getStructuredLaunchStateBySessionId(sessionId)! - const owner = structuredLaunchSelectionController(state) - let original: ReturnType - act(() => { - original = holdStructuredAgentSessionLaunchOption(sessionId, 'model', 'gpt-5.4') - }) - const hook = renderHook( - ({ visible }) => - useStructuredAgentSessionOptions({ - agent: 'codex', - sessionId, - target, - fence: visible ? 7 : null, - launch: { kind: 'new', seedOptions: seed }, - isVisible: false, - transportEnabled: true, - providerVisible: visible, - turnId: null, - unloadedTurnRevisions: undefined, - mutate: unavailableMutation - }), - { initialProps: { visible: false } } - ) - const readHook = renderHook(() => - useStructuredAgentSessionOptionState({ - transportEnabled: true, - agent: 'codex', - optionCatalog: catalog, - identity: `codex:${sessionId}`, - fence: 1, - sessionId, - target, - newLaunch: true, - seedsModel: true, - providerVisible: true, - providerStarting: false, - hostOptionStamp: '', - readsBeforeStart: true, - turnId: null, - unloadedTurnRevisions: undefined - }) - ) - // The read starts one microtask after its attach, from the shared queue. - await waitFor(() => expect(reads).toHaveLength(1)) - const capture = () => { - const source = hook.result.current.sendSource - const view = source.optionView(source.optionStateRef.current, seed) - return { - drawn: structuredAgentSessionModelId(view.record, 'own'), - selection: structuredAgentSessionMessageSelection(view) - } - } - let settled = false - void original!.then(() => { - settled = true - }) - const retainedOwners = new Set([owner]) - for (let generation = 2; generation <= (newer ? 100 : 10); generation++) { - act(() => publish(`runtime-${generation}`, generation)) - retainedOwners.add(structuredSessionSelectionController(target, sessionId, 'codex')) - retainedOwners.add(structuredLaunchSelectionController(state)) - } - expect(retainedOwners.size).toBe(1) - await act(async () => reads[0].resolve({ models: [], current: { model: 'stale-generation' } })) - expect(readHook.result.current.optionState.optionsAnswerPresent).not.toBe(true) - readHook.unmount() - reads.length = 0 - expect(structuredSessionSelectionController(target, sessionId, 'codex')).toBe(owner) - expect(structuredLaunchSelectionController(state)).toBe(owner) - expect(settled).toBe(false) - expect(capture()).toMatchObject({ drawn: 'gpt-5.4', selection: { model: 'gpt-5.4' } }) - let chosen = original! - if (newer) { - act(() => { - chosen = holdStructuredAgentSessionLaunchOption(sessionId, 'model', 'gpt-5.3-codex')! - }) - await expect(original!).resolves.toEqual({ kind: 'superseded' }) - } - const model = newer ? 'gpt-5.3-codex' : 'gpt-5.4' - expect(capture()).toMatchObject({ drawn: model, selection: { model } }) - await act(async () => create.resolve({ sessionId, fence: 7 })) - expect(sends).toBe(1) - hook.rerender({ visible: true }) - await waitFor(() => expect(reads).toHaveLength(1)) - let attached: Promise | undefined - if (newer) { - act(() => { - attached = hook.result.current.setStructuredOption('effort', 'high') - }) - expect(sends).toBe(2) - expect(capture().selection).toMatchObject({ model, effort: 'high' }) - await act(async () => - replies[1].resolve({ ok: true, value: { options: { model, effort: 'high' } } }) - ) - await expect(attached).resolves.toBe(true) - expect(transport.remember.mock.calls[0][1]).toMatchObject({ - picks: [{ modelId: model, optionId: 'effort', value: 'high' }] - }) - } - // This query predates acceptance and cannot acknowledge its later terminal identity. - await act(async () => replies[0].resolve({ ok: true, value: { options: { model } } })) - await expect(chosen).resolves.toMatchObject({ kind: 'accepted' }) - await launch.launchResult - const completed = owner.captureRead() - expect(completed).toHaveLength(newer ? 2 : 1) - expect(transport.remember).toHaveBeenCalledTimes(newer ? 2 : 1) - if (newer) { - expect(transport.remember.mock.calls[1][1]).toMatchObject({ - picks: [ - { modelId: model, optionId: 'model', value: model, adoptModelAsLaunchDefault: false } - ] - }) - } - expect(hook.result.current.sendSource.optionStateRef.current.optionsAnswerPresent).not.toBe( - true - ) - await act(async () => reads[0].resolve({ models: [], current: { model: 'other-client' } })) - await waitFor(() => expect(reads).toHaveLength(2)) - expect(owner.captureRead()).toEqual(completed) - await act(async () => reads[1].resolve({ models: [], current: { model: 'other-client' } })) - await waitFor(() => expect(owner.captureRead()).toEqual([])) - expect(owner.overlay()).toEqual({}) - expect(capture().drawn).toBe('other-client') - } -) - -const environment = (revision: number): PublicKnownRuntimeEnvironment => ({ - id: target.environmentId, - name: 'restored', - createdAt: 1, - updatedAt: revision, - pairingRevision: revision, - lastUsedAt: null, - runtimeId: null, - endpoints: [], - preferredEndpointId: 'loopback' -}) - -it.each(['present', 'initially-absent', 'already-hydrated'] as const)( - 'initializes restored hook affinity only at the first authoritative publication (%s)', - async (mode) => { - useAppStore.getState().setRuntimeEnvironments([]) - useAppStore.setState({ - runtimeEnvironmentCatalogHydrated: mode === 'already-hydrated', - runtimeEnvironmentCatalogSettled: false - }) - const list = vi - .fn() - .mockRejectedValueOnce(new Error('first list failed')) - .mockResolvedValue([environment(1)]) - const previousApi = window.api - Object.defineProperty(window, 'api', { - value: { runtimeEnvironments: { list } }, - configurable: true, - writable: true - }) - const error = vi.spyOn(console, 'error').mockImplementation(() => {}) - try { - if (mode !== 'already-hydrated') { - await useAppStore.getState().hydrateRuntimeEnvironmentStatuses() - expect(useAppStore.getState().runtimeEnvironmentCatalogHydrated).toBe(false) - expect(useAppStore.getState().runtimeEnvironmentCatalogSettled).toBe(true) - expect((await listRuntimeSessionHostsForStartup()).hostIds).toEqual(['runtime:paired-host']) - } - const restored = structuredAgentSessionTargetForTab(useAppStore.getState(), { - worktreeId: 'restored', - executionHostId: 'runtime:paired-host' - })! - transport.call.mockResolvedValue({ models: [], current: { model: 'gpt-5.5' } }) - const hook = renderHook( - ({ visible }) => - useStructuredAgentSessionOptionState({ - transportEnabled: true, - agent: 'codex', - optionCatalog: catalog, - identity: `codex:${sessionId}`, - fence: 7, - sessionId, - target: restored, - newLaunch: false, - seedsModel: false, - providerVisible: visible, - providerStarting: false, - hostOptionStamp: '', - readsBeforeStart: false, - turnId: null, - unloadedTurnRevisions: undefined - }), - { initialProps: { visible: false } } - ) - const owner = hook.result.current.controller - const held = owner.issue('model', 'gpt-5.4', null) - const unqualified = vi.fn() - await expect(owner.request(unqualified)).rejects.toThrow('unavailable') - expect(unqualified).not.toHaveBeenCalled() - act(() => - useAppStore.getState().setRuntimeEnvironments(mode === 'present' ? [environment(1)] : []) - ) - expect(hook.result.current.controller).toBe(owner) - if (mode === 'present') { - hook.rerender({ visible: true }) - await waitFor(() => - expect(transport.call).toHaveBeenCalledWith( - restored, - 'agentSession.options', - expect.anything(), - { expectedEnvironmentPairingRevision: 1 } - ) - ) - expect(held.outcome).toBeUndefined() - act(() => useAppStore.getState().setRuntimeEnvironments([environment(2)])) - expect(held.outcome).toEqual({ kind: 'superseded' }) - await expect(owner.request(async () => 'unsafe')).rejects.toThrow('retired') - } else { - act(() => useAppStore.getState().setRuntimeEnvironments([environment(2)])) - const send = vi.fn() - await expect(owner.request(send)).rejects.toThrow('unavailable') - expect(send).not.toHaveBeenCalled() - } - } finally { - error.mockRestore() - Object.defineProperty(window, 'api', { - value: previousApi, - configurable: true, - writable: true - }) - } - } -) - -it.each([false, true])( - 'retains the answered desktop descriptor and capture across contact, not true end (pending=%s)', - async (pending) => { - resetHostModelCatalogSnapshotsForTests() - useAppStore.getState().setRuntimeEnvironments([environment(1)]) - publish('answered-runtime-1', 1) - const answer: AgentSessionOptionsResult = { - models: ['gpt-5.5', 'gpt-5.4'].map((id) => ({ - id, - label: id, - isDefault: false, - efforts: [] - })), - current: { - model: 'gpt-5.5', - permissionMode: 'own', - reportedPermissionMode: 'full-access', - acceptedInputSources: { model: 'saved' } - } - } - const reads: ReturnType>[] = [] - const write = Promise.withResolvers() - transport.call.mockImplementation((_target, method) => { - if (method === 'agentSession.setOption') { - return write.promise - } - if (method === 'agentSession.modelCatalog') { - return Promise.resolve({ origin: 'probe', models: answer.models, fetchedAt: 1 }) - } - if (method !== 'agentSession.options') { - return new Promise(() => {}) - } - const read = Promise.withResolvers() - reads.push(read) - return read.promise - }) - const hook = renderHook( - ({ stamp, fence }) => - useStructuredAgentSessionOptions({ - agent: 'codex', - sessionId, - target, - fence, - transportEnabled: true, - isVisible: true, - providerVisible: true, - turnId: null, - unloadedTurnRevisions: undefined, - hostOptionStamp: stamp, - mutate: unavailableMutation - }), - { initialProps: { stamp: 'initial', fence: 1 } } - ) - const owner = structuredSessionSelectionController(target, sessionId, 'codex') - await waitFor(() => expect(reads).toHaveLength(1)) - await act(async () => reads[0].resolve(answer)) - const descriptor = (id: string) => - hook.result.current.optionSnapshot.find((row) => row.id === id) - const capture = () => { - const source = hook.result.current.sendSource - return structuredAgentSessionMessageSelection( - source.optionView(source.optionStateRef.current, undefined) - ) - } - expect(descriptor('model')?.kind).toMatchObject({ currentValue: 'gpt-5.5' }) - expect(descriptor('permissionMode')).toMatchObject({ - settable: true - }) - let picked: Promise | undefined - if (pending) { - act(() => { - picked = hook.result.current.setStructuredOption('model', 'gpt-5.4') - }) - } - hook.rerender({ stamp: 'old-read', fence: 1 }) - await waitFor(() => expect(reads).toHaveLength(2)) - act(() => publish('answered-runtime-2', 2)) - await waitFor(() => expect(reads.length).toBeGreaterThanOrEqual(3)) - expect(structuredSessionSelectionController(target, sessionId, 'codex')).toBe(owner) - const model = pending ? 'gpt-5.4' : 'gpt-5.5' - expect(descriptor('model')?.kind).toMatchObject({ currentValue: model }) - expect(capture()).toEqual({ model }) - expect(hook.result.current.sendSource.optionStateRef.current.acceptedInputSources).toEqual({ - model: 'saved' - }) - expect(descriptor('permissionMode')).toMatchObject({ - settable: true - }) - await act(async () => - reads[1].resolve({ - ...answer, - conversationCommands: ['compact'], - current: { model: 'stale' } - }) - ) - expect(hook.result.current.conversationCommands).toEqual([]) - if (pending) { - await act(async () => write.resolve({ ok: true, value: { options: { model } } })) - await expect(picked).resolves.toBe(true) - expect(owner.captureRead()).toHaveLength(1) - } - await act(async () => - reads[2].resolve({ ...answer, current: { model: 'gpt-5.5', acceptedInputSources: {} } }) - ) - if (pending) { - await waitFor(() => expect(reads).toHaveLength(4)) - expect(owner.captureRead()).toHaveLength(1) - } - if (reads[3]) { - await act(async () => - reads[3].resolve({ ...answer, current: { model: 'gpt-5.5', acceptedInputSources: {} } }) - ) - } - await waitFor(() => - expect(hook.result.current.sendSource.optionStateRef.current.acceptedInputSources).toEqual({}) - ) - expect(owner.captureRead()).toEqual([]) - expect(descriptor('model')?.kind).toMatchObject({ currentValue: 'gpt-5.5' }) - expect(capture()).toEqual({}) - act(() => forgetStructuredSessionSelection(sessionId, target)) - hook.rerender({ stamp: 'new-owner', fence: 2 }) - expect(structuredSessionSelectionController(target, sessionId, 'codex')).not.toBe(owner) - await waitFor(() => - expect(hook.result.current.sendSource.optionStateRef.current.optionsAnswerPresent).not.toBe( - true - ) - ) - expect(capture()).toEqual({}) - await expect(owner.request(async () => 'unsafe')).rejects.toThrow('retired') - } -) - -it('releases the actual first-publication observer when its owner ends before publication', async () => { - useAppStore.getState().setRuntimeEnvironments([]) - useAppStore.setState({ runtimeEnvironmentCatalogHydrated: false }) - const released = vi.fn() - const restore = registerStructuredSelectionCatalogStore({ - read: useAppStore.getState, - subscribe(listener) { - const stop = useAppStore.subscribe(listener) - return () => { - released() - stop() - } - } - }) - try { - const owner = structuredSessionSelectionController(target, sessionId, 'codex') - const pick = owner.issue('model', 'gpt-5.4', null) - forgetStructuredSessionSelection(sessionId, target) - await expect(pick.result).resolves.toEqual({ kind: 'superseded' }) - expect(released).toHaveBeenCalledTimes(1) - useAppStore.getState().setRuntimeEnvironments([environment(1)]) - expect(released).toHaveBeenCalledTimes(1) - await expect(owner.request(async () => 'unsafe')).rejects.toThrow('retired') - const replacement = structuredSessionSelectionController(target, sessionId, 'codex') - expect(replacement).not.toBe(owner) - await expect(replacement.request(async (options) => options)).resolves.toEqual({ - expectedEnvironmentPairingRevision: 1 - }) - } finally { - forgetStructuredSessionSelection(sessionId, target) - restore() - } -}) diff --git a/src/renderer/src/lib/finished-agent-resume-resurrection.test.ts b/src/renderer/src/lib/agent-session/resume/finished-agent-resume-resurrection.test.ts similarity index 91% rename from src/renderer/src/lib/finished-agent-resume-resurrection.test.ts rename to src/renderer/src/lib/agent-session/resume/finished-agent-resume-resurrection.test.ts index 7279fc15b4b..51ab24ab234 100644 --- a/src/renderer/src/lib/finished-agent-resume-resurrection.test.ts +++ b/src/renderer/src/lib/agent-session/resume/finished-agent-resume-resurrection.test.ts @@ -1,9 +1,9 @@ /** Completed local agents retain cold-restore identity (#9454) without posing as unfinished work or resurrecting after pane removal. This path does not use paired-runtime web-tab recovery. */ import { afterEach, describe, expect, it } from 'vitest' -import { makePaneKey } from '../../../shared/workspace-layout/stable-pane-id' -import { useAppStore } from '@/store' -import { activationTreatsNoteAsFinished } from './agent-session/resume/sleeping-agent-pane-ownership' -import { resumeSleepingAgentSessionsForWorktree } from './agent-session/resume/resume-sleeping-agent-session' +import { makePaneKey } from '../../../../../shared/workspace-layout/stable-pane-id' +import { useAppStore } from '@/store/index' +import { activationTreatsNoteAsFinished } from './sleeping-agent-pane-ownership' +import { resumeSleepingAgentSessionsForWorktree } from './resume-sleeping-agent-session' const initialAppStoreState = useAppStore.getState() const LEAF_ID = '11111111-1111-4111-8111-111111111111' diff --git a/src/renderer/src/lib/forget-refused-pane-resume.ts b/src/renderer/src/lib/agent-session/resume/forget-refused-pane-resume.ts similarity index 84% rename from src/renderer/src/lib/forget-refused-pane-resume.ts rename to src/renderer/src/lib/agent-session/resume/forget-refused-pane-resume.ts index 000e12a74e1..a520cada95e 100644 --- a/src/renderer/src/lib/forget-refused-pane-resume.ts +++ b/src/renderer/src/lib/agent-session/resume/forget-refused-pane-resume.ts @@ -1,10 +1,8 @@ -import { useAppStore } from '@/store' +import { useAppStore } from '@/store/index' +import { agentProviderSessionsEqual } from '../../../../../shared/agent-session/lifecycle/agent-session-resume' +import type { AgentProviderSessionMetadata } from '../../../../../shared/agent-session/lifecycle/agent-session-resume' import type { AppState } from '@/store/types' -import type { RefusedPaneResume } from '../../../shared/agent-status/contracts/agent-status-ipc-payload' -import { - agentProviderSessionsEqual, - type AgentProviderSessionMetadata -} from '../../../shared/agent-session/lifecycle/agent-session-resume' +import type { RefusedPaneResume } from '../../../../../shared/agent-status/contracts/agent-status-ipc-payload' /** Whether a saved claim names the refused conversation. Only local claims can: the host judged * its own chats, and a remote host's same id is a different conversation. */ diff --git a/src/renderer/src/lib/agent-session/resume/history/ai-vault-resume-platform.ts b/src/renderer/src/lib/agent-session/resume/history/ai-vault-resume-platform.ts index 1a81a95eeff..1a92f1c5ee9 100644 --- a/src/renderer/src/lib/agent-session/resume/history/ai-vault-resume-platform.ts +++ b/src/renderer/src/lib/agent-session/resume/history/ai-vault-resume-platform.ts @@ -1,4 +1,4 @@ -import { getLocalProjectExecutionRuntimeContext } from '@/lib/local-preflight-context' +import { getLocalProjectExecutionRuntimeContext } from '@/runtime/hosts/preflight/local-preflight-context' import { CLIENT_PLATFORM } from '@/lib/workspace/creation/new-workspace' import { getExecutionHostIdForWorktree } from '@/lib/workspace/ownership/worktree-runtime-owner' import { getAiVaultResumeWorkspacePath } from '@/lib/agent-session/resume/history/ai-vault-resume-shell' diff --git a/src/renderer/src/lib/agent-session/resume/history/ai-vault-resume-shell.ts b/src/renderer/src/lib/agent-session/resume/history/ai-vault-resume-shell.ts index 58ad749f9d9..756576064a9 100644 --- a/src/renderer/src/lib/agent-session/resume/history/ai-vault-resume-shell.ts +++ b/src/renderer/src/lib/agent-session/resume/history/ai-vault-resume-shell.ts @@ -1,5 +1,4 @@ -import type { AppState } from '@/store/types' -import { getLocalProjectExecutionRuntimeContext } from '@/lib/local-preflight-context' +import { getLocalProjectExecutionRuntimeContext } from '@/runtime/hosts/preflight/local-preflight-context' import '../../../workspace/ownership/folder-workspace-connection' import { findFolderWorkspaceCandidateRepos } from '../../../../../../shared/folder-workspaces/folder-workspace-execution-host' import { getAiVaultResumeWorkspaceExecutionHostId } from './ai-vault-resume-target' @@ -7,16 +6,15 @@ import { LOCAL_EXECUTION_HOST_ID } from '../../../../../../shared/execution-host import { CLIENT_PLATFORM } from '@/lib/workspace/creation/new-workspace' import { resolveLocalWindowsTerminalShellOverrideForTab } from '../../../../../../shared/local-windows-terminal-runtime' import { resolveWindowsShellStartupFamily } from '../../../../../../shared/windows-terminal-shell' -import { - resolveStartupShell, - type AgentStartupShell -} from '../../../../../../shared/agent-launch/startup/tui-agent-startup-shell' +import { resolveStartupShell } from '../../../../../../shared/agent-launch/startup/tui-agent-startup-shell' +import type { AgentStartupShell } from '../../../../../../shared/agent-launch/startup/tui-agent-startup-shell' import { parseWorkspaceKey } from '../../../../../../shared/workspace-scope' import { parseWslUncPath } from '../../../../../../shared/wsl-paths' import { selectFolderWorkspaces, selectWorktreesByRepo } from '@/store/workspaces/catalog/workspace-record-fields' +import type { AppState } from '@/store/types' type AiVaultResumeShellState = Pick< AppState, diff --git a/src/renderer/src/lib/cli-conversation-exit-guidance.ts b/src/renderer/src/lib/agent-session/resume/history/cli-conversation-exit-guidance.ts similarity index 76% rename from src/renderer/src/lib/cli-conversation-exit-guidance.ts rename to src/renderer/src/lib/agent-session/resume/history/cli-conversation-exit-guidance.ts index d053c844594..64ce51b9ca5 100644 --- a/src/renderer/src/lib/cli-conversation-exit-guidance.ts +++ b/src/renderer/src/lib/agent-session/resume/history/cli-conversation-exit-guidance.ts @@ -1,6 +1,6 @@ import { translate } from '@/i18n/i18n' -import { agentLabel } from '../../../shared/ai-vault/session-display/ai-vault-session-filters' -import type { CliConversationRowAgent } from '../../../shared/structured-agent-cli-conversation-adoption' +import { agentLabel } from '../../../../../../shared/ai-vault/session-display/ai-vault-session-filters' +import type { CliConversationRowAgent } from '../../../../../../shared/structured-agent-cli-conversation-adoption' export function cliConversationExitGuidance( agent: CliConversationRowAgent, diff --git a/src/renderer/src/lib/launch-ai-vault-session-and-reveal.ts b/src/renderer/src/lib/agent-session/resume/history/launch-ai-vault-session-and-reveal.ts similarity index 90% rename from src/renderer/src/lib/launch-ai-vault-session-and-reveal.ts rename to src/renderer/src/lib/agent-session/resume/history/launch-ai-vault-session-and-reveal.ts index 490a657b30a..98cac66ddb3 100644 --- a/src/renderer/src/lib/launch-ai-vault-session-and-reveal.ts +++ b/src/renderer/src/lib/agent-session/resume/history/launch-ai-vault-session-and-reveal.ts @@ -1,11 +1,11 @@ import { toast } from 'sonner' -import { useAppStore } from '@/store' +import { useAppStore } from '@/store/index' import { translate } from '@/i18n/i18n' import { launchAiVaultSessionInNewTab } from './launch-ai-vault-session' import { activateAiVaultResumeWorkspace } from '@/components/right-sidebar/ai-vault/session-actions/ai-vault-session-resume-in-chat-launch' import { notifyAiVaultSessionQueued } from '@/components/right-sidebar/ai-vault/session-actions/ai-vault-session-launch-feedback' import '@/components/right-sidebar/ai-vault/session-list/ai-vault-session-filters' -import { agentLabel } from '../../../shared/ai-vault/session-display/ai-vault-session-filters' +import { agentLabel } from '../../../../../../shared/ai-vault/session-display/ai-vault-session-filters' /** Resolves to the new terminal tab's id when this client created it, else null. */ export async function launchAiVaultSessionAndReveal( diff --git a/src/renderer/src/lib/launch-ai-vault-session.ts b/src/renderer/src/lib/agent-session/resume/history/launch-ai-vault-session.ts similarity index 94% rename from src/renderer/src/lib/launch-ai-vault-session.ts rename to src/renderer/src/lib/agent-session/resume/history/launch-ai-vault-session.ts index dd48256dd75..03ab483286f 100644 --- a/src/renderer/src/lib/launch-ai-vault-session.ts +++ b/src/renderer/src/lib/agent-session/resume/history/launch-ai-vault-session.ts @@ -1,15 +1,15 @@ import { useAppStore } from '@/store/index' import { persistAgentLaunchTabOrder } from '@/lib/agent-session/launch/pane/launch-agent-tab-order' import '@/diagnostics/telemetry/telemetry' -import { tuiAgentToAgentKind } from '../../../shared/agent-kind' +import { tuiAgentToAgentKind } from '../../../../../../shared/agent-kind' import { runtimeEnvironmentIdOrLocalUnlessTwin } from '@/lib/workspace/ownership/worktree-runtime-owner' import { createWebRuntimeSessionTerminal } from '@/runtime/hosted-terminals/creation/web-runtime-terminal-creation' import { isWebRuntimeSessionActive } from '@/runtime/web-session-tabs-sync/identity/web-runtime-session-environment' -import type { AiVaultAgent } from '../../../shared/ai-vault/contracts/ai-vault-types' +import type { AiVaultAgent } from '../../../../../../shared/ai-vault/contracts/ai-vault-types' import type { AgentProviderSessionMetadata, SleepingAgentLaunchConfig -} from '../../../shared/agent-session/lifecycle/agent-session-resume' +} from '../../../../../../shared/agent-session/lifecycle/agent-session-resume' import type { TabSplitDirection } from '@/store/slices/tabs/tabs-slice-contract' import type { WebRuntimeTerminalCreateOutcome } from '@/runtime/hosted-terminals/creation/terminal-create-contracts' diff --git a/src/renderer/src/lib/host-mirror-handle-gap-wait.ts b/src/renderer/src/lib/agent-session/resume/host-mirror-handle-gap-wait.ts similarity index 97% rename from src/renderer/src/lib/host-mirror-handle-gap-wait.ts rename to src/renderer/src/lib/agent-session/resume/host-mirror-handle-gap-wait.ts index c3123c67c85..24a74c7b210 100644 --- a/src/renderer/src/lib/host-mirror-handle-gap-wait.ts +++ b/src/renderer/src/lib/agent-session/resume/host-mirror-handle-gap-wait.ts @@ -1,14 +1,13 @@ -import { useAppStore } from '@/store' +import { useAppStore } from '@/store/index' import { getRuntimeEnvironmentConnectionGeneration } from '@/store/slices/runtime-status/runtime-status-connection-generation' import { WEB_SESSION_TAB_RPC_TIMEOUT_MS } from '@/runtime/web-session-tabs-sync/actions/web-session-tab-rpc-timeout' -import { parseRemoteRuntimePtyId } from '../../../shared/remote-runtime/remote-runtime-pty-id' +import { parseRemoteRuntimePtyId } from '../../../../../shared/remote-runtime/remote-runtime-pty-id' import { isDisconnectedRuntimeHostState, runtimeHostConnectionStateForEntry } from '@/runtime/hosts/connections/runtime-host-connection-state' /** Published rows can precede PTY handles; missing handles remain unverifiable, never exited (#19735, ssh-execution-boundary.md). Replay on handle/retraction/deadline without authorizing local replacement. Reconnects/outages invalidate the budget; sustained churn may legitimately keep recovery parked. */ -export const HOST_MIRROR_HANDLE_GAP_DEADLINE_MS = WEB_SESSION_TAB_RPC_TIMEOUT_MS type HandleGapWaiter = { worktreeId: string @@ -247,7 +246,7 @@ export function parkUntilHostMirrorHandleLands( recordExpiredWait(environmentId, key) } releaseWaiter(key) - }, HOST_MIRROR_HANDLE_GAP_DEADLINE_MS) + }, WEB_SESSION_TAB_RPC_TIMEOUT_MS) waitersByPane.set(key, { worktreeId, tabId, diff --git a/src/renderer/src/lib/agent-session/resume/host-mirrored-pane-liveness.ts b/src/renderer/src/lib/agent-session/resume/host-mirrored-pane-liveness.ts index ec1a648b4f6..4afe91c24cb 100644 --- a/src/renderer/src/lib/agent-session/resume/host-mirrored-pane-liveness.ts +++ b/src/renderer/src/lib/agent-session/resume/host-mirrored-pane-liveness.ts @@ -1,5 +1,3 @@ -import type { useAppStore } from '@/store/index' -import type { SleepingAgentSessionRecord } from '../../../../../shared/agent-session/lifecycle/agent-session-resume' import { parseRemoteRuntimePtyId } from '../../../../../shared/remote-runtime/remote-runtime-pty-id' import { parseLegacyNumericPaneKey, @@ -7,9 +5,11 @@ import { } from '../../../../../shared/workspace-layout/stable-pane-id' import { isWebTerminalSurfaceTabId } from '../../../../../shared/workspace-layout/terminal-surface-id' import { hasHostSessionMirrorHydrated } from '@/runtime/web-session-tabs-sync/hydration/host-session-mirror-hydration' -import { hasHostMirrorHandleWaitExpired } from '../../host-mirror-handle-gap-wait' +import { hasHostMirrorHandleWaitExpired } from './host-mirror-handle-gap-wait' import { runtimeEnvironmentIdForWorkspaceOwner } from '../../workspace/ownership/resolve-owner' import { warnAmbiguousOwnerOnce } from '../../workspace/ownership/ambiguous-owner-warning' +import type { useAppStore } from '@/store/index' +import type { SleepingAgentSessionRecord } from '../../../../../shared/agent-session/lifecycle/agent-session-resume' type AppStoreState = ReturnType diff --git a/src/renderer/src/lib/paired-runtime-closed-tab-resume.test.ts b/src/renderer/src/lib/agent-session/resume/paired-runtime-closed-tab-resume.test.ts similarity index 53% rename from src/renderer/src/lib/paired-runtime-closed-tab-resume.test.ts rename to src/renderer/src/lib/agent-session/resume/paired-runtime-closed-tab-resume.test.ts index ec22f692a8a..0eafb057d5e 100644 --- a/src/renderer/src/lib/paired-runtime-closed-tab-resume.test.ts +++ b/src/renderer/src/lib/agent-session/resume/paired-runtime-closed-tab-resume.test.ts @@ -1,30 +1,26 @@ import path from 'node:path' import { afterEach, beforeEach, describe, expect, it } from 'vitest' -import { applyWebSessionTabsSnapshot } from '@/runtime/web-session-tabs-sync/snapshot-api' -import { - makeSnapshot, - resetWebSessionTabsSyncTestState -} from '@/runtime/web-session-tabs-sync/testing/web-session-tabs-sync.test-fixture' +import '@/runtime/web-session-tabs-sync/snapshot-api' +import { resetWebSessionTabsSyncTestState } from '@/runtime/web-session-tabs-sync/testing/web-session-tabs-sync.test-fixture' import { markHostSessionMirrorHydrated, resetHostSessionMirrorHydrationForTests } from '@/runtime/web-session-tabs-sync/hydration/host-session-mirror-hydration' -import { useAppStore } from '@/store' +import { useAppStore } from '@/store/index' +import { makePaneKey } from '../../../../../shared/workspace-layout/stable-pane-id' +import { toWebTerminalSurfaceTabId } from '../../../../../shared/workspace-layout/terminal-surface-id' +import { makeCreatedAgentWorktree } from '../../workspace/activation/worktree-activation-created-agent.test-fixture' +import { resumeSleepingAgentSessionsForWorktree } from './resume-sleeping-agent-session' import type { AppState } from '@/store/types' - -import type { SleepingAgentSessionRecord } from '../../../shared/agent-session/lifecycle/agent-session-resume' -import type { Worktree } from '../../../shared/worktree/types' -import { makePaneKey } from '../../../shared/workspace-layout/stable-pane-id' -import { toWebTerminalSurfaceTabId } from '../../../shared/workspace-layout/terminal-surface-id' -import { makeCreatedAgentWorktree } from './workspace/activation/worktree-activation-created-agent.test-fixture' -import { resumeSleepingAgentSessionsForWorktree } from './agent-session/resume/resume-sleeping-agent-session' +import type { SleepingAgentSessionRecord } from '../../../../../shared/agent-session/lifecycle/agent-session-resume' +import type { Worktree } from '../../../../../shared/worktree/types' // Paired clients cannot distinguish another client’s close from rekey/pending handles; local records must never authorize another host writer (#21235). const initialState = useAppStore.getState() const ENV_ID = 'env-closed-elsewhere' const LEAF_ID = '11111111-1111-4111-8111-111111111111' -const CLIENT_TAB_ID = 'client-created-tab' +void 'client-created-tab' function seedPairedWorkspace(paired = true): string { const worktree: Worktree = { @@ -83,33 +79,6 @@ function seedRecord(record: SleepingAgentSessionRecord): void { }) } -function applyHostTabs(worktreeId: string, hostTabIds: readonly string[], version: number): void { - const snapshot = makeSnapshot( - hostTabIds.map((hostTabId, index) => ({ - type: 'terminal' as const, - id: `${hostTabId}::${LEAF_ID}`, - title: 'Claude', - parentTabId: hostTabId, - leafId: LEAF_ID, - isActive: index === 0, - status: 'ready' as const, - terminal: `term-${hostTabId}` - })), - { worktree: worktreeId, snapshotVersion: version } - ) - useAppStore.setState( - applyWebSessionTabsSnapshot(useAppStore.getState(), snapshot, ENV_ID, Date.now()) - ) -} - -function expectNoAutomaticResume(worktreeId: string): void { - expect(resumeSleepingAgentSessionsForWorktree(worktreeId)).toBe(0) - const state = useAppStore.getState() - expect(state.tabsByWorktree[worktreeId] ?? []).toEqual([]) - expect(state.pendingStartupByTabId).toEqual({}) - expect(state.automaticAgentResumeClaimsByTabId).toEqual({}) -} - describe('a tab closed on another paired client', () => { beforeEach(() => { useAppStore.setState(initialState, true) @@ -123,38 +92,6 @@ describe('a tab closed on another paired client', () => { resetHostSessionMirrorHydrationForTests() }) - it('is not resumed from a record keyed by the tab id this client created it under', () => { - const worktreeId = seedPairedWorkspace() - useAppStore.setState({ - tabsByWorktree: { - [worktreeId]: [ - { - id: CLIENT_TAB_ID, - ptyId: null, - worktreeId, - title: 'Claude', - customTitle: null, - color: null, - sortOrder: 0, - createdAt: 0 - } - ] - } - }) - const record = makeRecord(worktreeId, CLIENT_TAB_ID) - seedRecord(record) - - // The host adopts the client's tab id, then another client closes it. - applyHostTabs(worktreeId, [CLIENT_TAB_ID], 1) - expect(useAppStore.getState().tabsByWorktree[worktreeId]?.map((tab) => tab.id)).toEqual([ - toWebTerminalSurfaceTabId(CLIENT_TAB_ID) - ]) - applyHostTabs(worktreeId, [], 2) - - expectNoAutomaticResume(worktreeId) - expectNoAutomaticResume(worktreeId) - }) - it('still recovers a local native record when the mirror names another execution host', () => { const worktreeId = seedPairedWorkspace(false) seedRecord({ diff --git a/src/renderer/src/lib/agent-session/resume/resume-sleeping-agent-session.ts b/src/renderer/src/lib/agent-session/resume/resume-sleeping-agent-session.ts index 3549489d6d7..8e8ac43ff18 100644 --- a/src/renderer/src/lib/agent-session/resume/resume-sleeping-agent-session.ts +++ b/src/renderer/src/lib/agent-session/resume/resume-sleeping-agent-session.ts @@ -1,10 +1,8 @@ import { sleepingAgentRecordIndex } from '@/store/terminals/sleeping-agent-record-index' import { useAppStore } from '@/store/index' import { isWorkspaceSleepRecord } from '../../../../../shared/workspace-sleep' -import { - agentProviderSessionsEqual, - type SleepingAgentSessionRecord -} from '../../../../../shared/agent-session/lifecycle/agent-session-resume' +import { agentProviderSessionsEqual } from '../../../../../shared/agent-session/lifecycle/agent-session-resume' +import type { SleepingAgentSessionRecord } from '../../../../../shared/agent-session/lifecycle/agent-session-resume' import { AGENT_STATUS_STALE_AFTER_MS } from '../../../../../shared/agent-status/contracts/agent-status-freshness' import { parsePaneKey } from '../../../../../shared/workspace-layout/stable-pane-id' import { getProviderSessionClaimKey } from '../../../../../shared/sleeping-record-legacy-pane-key' @@ -16,17 +14,15 @@ import { } from './sleeping-agent-pane-ownership' import { isPaneSpawnDeferred } from '../../../components/terminal-pane/session-restore/spawn-deferral/pane-spawn-deferral-registry' import { settleSweptRecord, sweepTreatsAsFinished } from './swept-sleep-record-settlement' -import { - launchSleepingAgentSession, - type ResumeSleepingAgentSessionsOptions -} from './sleeping-agent-session-launch' +import { launchSleepingAgentSession } from './sleeping-agent-session-launch' +import type { ResumeSleepingAgentSessionsOptions } from './sleeping-agent-session-launch' import { isStructuredAgentSyntheticSleepingRecord } from './structured-agent-synthetic-sleeping-record' import { findUnhydratedHostMirrorForPane, - isHostMirroredSleepingRecord, - type UnhydratedHostMirror + isHostMirroredSleepingRecord } from './host-mirrored-pane-liveness' -import { parkUntilHostMirrorHandleLands } from '../../host-mirror-handle-gap-wait' +import type { UnhydratedHostMirror } from './host-mirrored-pane-liveness' +import { parkUntilHostMirrorHandleLands } from './host-mirror-handle-gap-wait' import { getClaimRepresentativeRecords } from './sleeping-record-claim-representative' import { sleepingRecordHostAllowsSessionClaim, diff --git a/src/renderer/src/lib/retracted-host-pane-resume.test.ts b/src/renderer/src/lib/agent-session/resume/retracted-host-pane-resume.test.ts similarity index 87% rename from src/renderer/src/lib/retracted-host-pane-resume.test.ts rename to src/renderer/src/lib/agent-session/resume/retracted-host-pane-resume.test.ts index b0398dc9ba3..6274afd8fcc 100644 --- a/src/renderer/src/lib/retracted-host-pane-resume.test.ts +++ b/src/renderer/src/lib/agent-session/resume/retracted-host-pane-resume.test.ts @@ -1,8 +1,8 @@ import { afterEach, describe, expect, it, vi } from 'vitest' -import { useAppStore } from '@/store' -import type { SleepingAgentSessionRecord } from '../../../shared/agent-session/lifecycle/agent-session-resume' -import { makePaneKey } from '../../../shared/workspace-layout/stable-pane-id' -import { resumeSleepingAgentSessionsForWorktree } from './agent-session/resume/resume-sleeping-agent-session' +import { useAppStore } from '@/store/index' +import { makePaneKey } from '../../../../../shared/workspace-layout/stable-pane-id' +import { resumeSleepingAgentSessionsForWorktree } from './resume-sleeping-agent-session' +import type { SleepingAgentSessionRecord } from '../../../../../shared/agent-session/lifecycle/agent-session-resume' // Main's answer to the window's layout commands, as a switch-on build sends them. vi.mock('@/runtime/rpc/calls/runtime-rpc-call', async (importOriginal) => diff --git a/src/renderer/src/lib/agent-session/resume/sleeping-agent-session-launch.ts b/src/renderer/src/lib/agent-session/resume/sleeping-agent-session-launch.ts index ca765a10bd2..7e8c8625f27 100644 --- a/src/renderer/src/lib/agent-session/resume/sleeping-agent-session-launch.ts +++ b/src/renderer/src/lib/agent-session/resume/sleeping-agent-session-launch.ts @@ -9,15 +9,15 @@ import { resolveRuntimeHostReportedPlatform, resolveRuntimeHostTerminalWindowsShell, resolveSshHostReportedPlatform, - resolveAgentResumeLaunchTarget, - type AgentResumeLaunchTarget + resolveAgentResumeLaunchTarget } from '@/lib/agent-session/resume/agent-resume-launch-target' +import type { AgentResumeLaunchTarget } from '@/lib/agent-session/resume/agent-resume-launch-target' import { getExecutionHostIdForWorktree } from '@/lib/workspace/ownership/worktree-runtime-owner' import { runtimeEnvironmentIdUnlessTwin } from '@/lib/workspace/ownership/resolve-owner' -import { getLocalProjectExecutionRuntimeContext } from '@/lib/local-preflight-context' +import { getLocalProjectExecutionRuntimeContext } from '@/runtime/hosts/preflight/local-preflight-context' import { resolveResumeLaunchRecipe } from '../../../../../shared/agent-launch/choices/resume-launch-recipe' -import type { SleepingAgentSessionRecord } from '../../../../../shared/agent-session/lifecycle/agent-session-resume' import { translate } from '@/i18n/i18n' +import type { SleepingAgentSessionRecord } from '../../../../../shared/agent-session/lifecycle/agent-session-resume' export type ResumeSleepingAgentSessionsOptions = { suppressNavigation?: boolean diff --git a/src/renderer/src/lib/sleeping-agent-wake-requests.ts b/src/renderer/src/lib/agent-session/resume/sleeping-agent-wake-requests.ts similarity index 84% rename from src/renderer/src/lib/sleeping-agent-wake-requests.ts rename to src/renderer/src/lib/agent-session/resume/sleeping-agent-wake-requests.ts index add89cd1d80..84725e394a1 100644 --- a/src/renderer/src/lib/sleeping-agent-wake-requests.ts +++ b/src/renderer/src/lib/agent-session/resume/sleeping-agent-wake-requests.ts @@ -1,10 +1,10 @@ -import { useAppStore } from '@/store' +import { useAppStore } from '@/store/index' import { sleepingAgentRecordIndex } from '@/store/terminals/sleeping-agent-record-index' -import type { SleepingAgentSessionRecord } from '../../../shared/agent-session/lifecycle/agent-session-resume' import { parseLegacyNumericPaneKey, parsePaneKey -} from '../../../shared/workspace-layout/stable-pane-id' +} from '../../../../../shared/workspace-layout/stable-pane-id' +import type { SleepingAgentSessionRecord } from '../../../../../shared/agent-session/lifecycle/agent-session-resume' // Why record identity: a replaced or cleared record drops its request, so a stale ask never wakes a later sleep. const requestedRecords = new WeakSet() diff --git a/src/renderer/src/lib/agent-session/resume/wake-sleeping-agents-in-background.ts b/src/renderer/src/lib/agent-session/resume/wake-sleeping-agents-in-background.ts index cf0e7f56c78..b75a8fc1f34 100644 --- a/src/renderer/src/lib/agent-session/resume/wake-sleeping-agents-in-background.ts +++ b/src/renderer/src/lib/agent-session/resume/wake-sleeping-agents-in-background.ts @@ -1,13 +1,10 @@ -import { - WAKE_HIBERNATED_AGENTS_WORKTREE_EVENT, - type WakeHibernatedAgentsWorktreeDetail -} from '@/constants/terminal' +import { WAKE_HIBERNATED_AGENTS_WORKTREE_EVENT } from '@/constants/terminal' +import type { WakeHibernatedAgentsWorktreeDetail } from '@/constants/terminal' import { requestBackgroundTerminalWorktreeMount } from '@/components/terminal/background-terminal-worktree-mount' import { useAppStore } from '@/store/index' -import type { SleepingAgentSessionRecord } from '../../../../../shared/agent-session/lifecycle/agent-session-resume' import { isWorkspaceSleepRecord } from '../../../../../shared/workspace-sleep' import { resumeSleepingAgentSessionsForWorktree } from './resume-sleeping-agent-session' -import { getSleepingRecordTabId } from '../../sleeping-agent-wake-requests' +import { getSleepingRecordTabId } from './sleeping-agent-wake-requests' import { resolveActivationPtyListScope } from '../../workspace/activation/worktree-activation-pty-inventory' import { gateWorktreeAgentActivation } from '../../workspace/activation/worktree-agent-activation-gate' import { getProviderSessionClaimKey } from '../../../../../shared/sleeping-record-legacy-pane-key' @@ -16,6 +13,8 @@ import { isStrandedWorkspaceSleepRecord, recordPaneIsOwnedByPreservedPane } from './sleeping-agent-pane-ownership' +import { sleepingAgentRecordIndex } from '@/store/terminals/sleeping-agent-record-index' +import type { SleepingAgentSessionRecord } from '../../../../../shared/agent-session/lifecycle/agent-session-resume' type BackgroundSleepingAgentWakeDispatcherOptions = { isWorkspaceSessionReady?: () => boolean @@ -190,4 +189,3 @@ export function wakeSleepingAgentsForWorktreeInBackground(worktreeId: string): v } resumeSleepingAgentSessionsForWorktree(worktreeId, resumeOptions) } -import { sleepingAgentRecordIndex } from '@/store/terminals/sleeping-agent-record-index' diff --git a/src/renderer/src/lib/open-tab-occupant-agent.ts b/src/renderer/src/lib/agent-session/tab-identity/open-tab-occupant-agent.ts similarity index 79% rename from src/renderer/src/lib/open-tab-occupant-agent.ts rename to src/renderer/src/lib/agent-session/tab-identity/open-tab-occupant-agent.ts index 4f6eaf02b74..e929d29b0a7 100644 --- a/src/renderer/src/lib/open-tab-occupant-agent.ts +++ b/src/renderer/src/lib/agent-session/tab-identity/open-tab-occupant-agent.ts @@ -1,11 +1,7 @@ -import type { RetainedAgentEntry } from '@/store/slices/agent-status/agent-status-contract' -import type { PaneForegroundAgentEntry } from '@/store/slices/agent-status/pane-foreground-agent' -import type { SleepingAgentSessionRecord } from '../../../shared/agent-session/lifecycle/agent-session-resume' -import type { AgentStatusEntry } from '../../../shared/agent-status/contracts/agent-status-types' -import { isTerminalLeafId, makePaneKey } from '../../../shared/workspace-layout/stable-pane-id' -import type { TerminalLayoutSnapshot } from '../../../shared/workspace-layout/terminal-tab-types' -import type { TerminalAgent } from '../../../shared/agent-status/identity/terminal-agent' -import type { TuiAgent } from '../../../shared/agent-launch/catalog/tui-agent' +import { + isTerminalLeafId, + makePaneKey +} from '../../../../../shared/workspace-layout/stable-pane-id' import { resolveFocusedCompletedTabAgent, resolveFocusedRetainedTabAgent, @@ -14,7 +10,14 @@ import { resolveSiblingRetainedTabAgent, resolveSiblingTabAgent } from './tab-agent' -import { resolveTabAgentFromSignalSnapshot } from '../../../shared/tab-agent-from-signals' +import { resolveTabAgentFromSignalSnapshot } from '../../../../../shared/tab-agent-from-signals' +import type { RetainedAgentEntry } from '@/store/slices/agent-status/agent-status-contract' +import type { PaneForegroundAgentEntry } from '@/store/slices/agent-status/pane-foreground-agent' +import type { SleepingAgentSessionRecord } from '../../../../../shared/agent-session/lifecycle/agent-session-resume' +import type { AgentStatusEntry } from '../../../../../shared/agent-status/contracts/agent-status-types' +import type { TerminalLayoutSnapshot } from '../../../../../shared/workspace-layout/terminal-tab-types' +import type { TerminalAgent } from '../../../../../shared/agent-status/identity/terminal-agent' +import type { TuiAgent } from '../../../../../shared/agent-launch/catalog/tui-agent' export type OpenTabOccupantAgentInput = { tabId: string diff --git a/src/renderer/src/lib/structured-chat-tab-index.ts b/src/renderer/src/lib/agent-session/tab-identity/structured-chat-tab-index.ts similarity index 96% rename from src/renderer/src/lib/structured-chat-tab-index.ts rename to src/renderer/src/lib/agent-session/tab-identity/structured-chat-tab-index.ts index 54c28bcb824..2ae758e8870 100644 --- a/src/renderer/src/lib/structured-chat-tab-index.ts +++ b/src/renderer/src/lib/agent-session/tab-identity/structured-chat-tab-index.ts @@ -1,5 +1,5 @@ -import type { Tab } from '../../../shared/tab-types' -import { isStructuredTab } from '../../../shared/agent-session/view/structured-agent-session-tab' +import { isStructuredTab } from '../../../../../shared/agent-session/view/structured-agent-session-tab' +import type { Tab } from '../../../../../shared/tab-types' type DirectoryTab = { id: string diff --git a/src/renderer/src/lib/tab-agent-remote-pty-selector.ts b/src/renderer/src/lib/agent-session/tab-identity/tab-agent-remote-pty-selector.ts similarity index 85% rename from src/renderer/src/lib/tab-agent-remote-pty-selector.ts rename to src/renderer/src/lib/agent-session/tab-identity/tab-agent-remote-pty-selector.ts index 60e637c4593..7da58e008a5 100644 --- a/src/renderer/src/lib/tab-agent-remote-pty-selector.ts +++ b/src/renderer/src/lib/agent-session/tab-identity/tab-agent-remote-pty-selector.ts @@ -1,4 +1,4 @@ -import { parseRemoteRuntimePtyId } from '../../../shared/remote-runtime/remote-runtime-pty-id' +import { parseRemoteRuntimePtyId } from '../../../../../shared/remote-runtime/remote-runtime-pty-id' /** Checks both PTY projections without allocating a dedupe set on each store notification. */ export function hasRemoteRuntimePtyForTab( diff --git a/src/renderer/src/lib/tab-agent-status-index.ts b/src/renderer/src/lib/agent-session/tab-identity/tab-agent-status-index.ts similarity index 89% rename from src/renderer/src/lib/tab-agent-status-index.ts rename to src/renderer/src/lib/agent-session/tab-identity/tab-agent-status-index.ts index 8cf013dfd2b..046dc50bfba 100644 --- a/src/renderer/src/lib/tab-agent-status-index.ts +++ b/src/renderer/src/lib/agent-session/tab-identity/tab-agent-status-index.ts @@ -1,8 +1,8 @@ -import type { AgentStatusEntry } from '../../../shared/agent-status/contracts/agent-status-types' -import type { TerminalAgent } from '../../../shared/agent-status/identity/terminal-agent' -import { parsePaneKey } from '../../../shared/workspace-layout/stable-pane-id' +import { parsePaneKey } from '../../../../../shared/workspace-layout/stable-pane-id' +import { agentTypeToIconAgent } from '../../../../../shared/agent-status/presentation/agent-type-icon-agent' +import type { AgentStatusEntry } from '../../../../../shared/agent-status/contracts/agent-status-types' +import type { TerminalAgent } from '../../../../../shared/agent-status/identity/terminal-agent' import type { RetainedAgentEntry } from '@/store/slices/agent-status/agent-status-contract' -import { agentTypeToIconAgent } from '../../../shared/agent-status/presentation/agent-type-icon-agent' /** Index iconable panes once per status-map identity instead of scanning globally per mounted tab. Preserve insertion order: first-match resolution decides split-tab icons. */ export type TabAgentPane = { readonly leafId: string; readonly agent: TerminalAgent } diff --git a/src/renderer/src/lib/tab-agent.ts b/src/renderer/src/lib/agent-session/tab-identity/tab-agent.ts similarity index 89% rename from src/renderer/src/lib/tab-agent.ts rename to src/renderer/src/lib/agent-session/tab-identity/tab-agent.ts index bb3b6afaab8..a0e3e6db763 100644 --- a/src/renderer/src/lib/tab-agent.ts +++ b/src/renderer/src/lib/agent-session/tab-identity/tab-agent.ts @@ -1,15 +1,18 @@ -import type { AgentStatusEntry } from '../../../shared/agent-status/contracts/agent-status-types' -import type { TerminalLayoutSnapshot } from '../../../shared/workspace-layout/terminal-tab-types' -import type { TerminalAgent } from '../../../shared/agent-status/identity/terminal-agent' -import { isTerminalLeafId, makePaneKey } from '../../../shared/workspace-layout/stable-pane-id' -import type { RetainedAgentEntry } from '@/store/slices/agent-status/agent-status-contract' -import { agentTypeToIconAgent } from '../../../shared/agent-status/presentation/agent-type-icon-agent' +import { + isTerminalLeafId, + makePaneKey +} from '../../../../../shared/workspace-layout/stable-pane-id' +import { agentTypeToIconAgent } from '../../../../../shared/agent-status/presentation/agent-type-icon-agent' import { firstTabAgentExcludingLeaf, selectCompletedTabAgentPanes, selectLiveTabAgentPanes, selectRetainedTabAgentPanes } from './tab-agent-status-index' +import type { AgentStatusEntry } from '../../../../../shared/agent-status/contracts/agent-status-types' +import type { TerminalLayoutSnapshot } from '../../../../../shared/workspace-layout/terminal-tab-types' +import type { TerminalAgent } from '../../../../../shared/agent-status/identity/terminal-agent' +import type { RetainedAgentEntry } from '@/store/slices/agent-status/agent-status-contract' /** Hook status is primary tab-icon identity, matching sidebar rows and OSC 133 exit cleanup. Resolve focused leaf first, then sibling split panes. */ export function resolveFocusedTabAgent( diff --git a/src/renderer/src/lib/use-tab-agent-observed-signal-dispatch.test.tsx b/src/renderer/src/lib/agent-session/tab-identity/use-tab-agent-observed-signal-dispatch.test.tsx similarity index 86% rename from src/renderer/src/lib/use-tab-agent-observed-signal-dispatch.test.tsx rename to src/renderer/src/lib/agent-session/tab-identity/use-tab-agent-observed-signal-dispatch.test.tsx index 6ba897f7c05..69f67b79a14 100644 --- a/src/renderer/src/lib/use-tab-agent-observed-signal-dispatch.test.tsx +++ b/src/renderer/src/lib/agent-session/tab-identity/use-tab-agent-observed-signal-dispatch.test.tsx @@ -1,17 +1,18 @@ /** @vitest-environment happy-dom */ import { act } from 'react' -import { createRoot, type Root } from 'react-dom/client' +import { createRoot } from 'react-dom/client' +import type { Root } from 'react-dom/client' import { afterEach, beforeEach, describe, expect, it } from 'vitest' -import { useAppStore } from '@/store' -import type { AgentStatusEntry } from '../../../shared/agent-status/contracts/agent-status-types' -import { makePaneKey } from '../../../shared/workspace-layout/stable-pane-id' +import { useAppStore } from '@/store/index' +import { makePaneKey } from '../../../../../shared/workspace-layout/stable-pane-id' +import { useTabAgent } from './use-tab-agent' +import type { AgentStatusEntry } from '../../../../../shared/agent-status/contracts/agent-status-types' import type { TerminalLayoutSnapshot, TerminalTab -} from '../../../shared/workspace-layout/terminal-tab-types' -import type { TerminalAgent } from '../../../shared/agent-status/identity/terminal-agent' -import { useTabAgent } from './use-tab-agent' +} from '../../../../../shared/workspace-layout/terminal-tab-types' +import type { TerminalAgent } from '../../../../../shared/agent-status/identity/terminal-agent' ;(globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }).IS_REACT_ACT_ENVIRONMENT = true diff --git a/src/renderer/src/lib/agent-session/tab-identity/use-tab-agent.test.ts b/src/renderer/src/lib/agent-session/tab-identity/use-tab-agent.test.ts new file mode 100644 index 00000000000..eeed77f1e7b --- /dev/null +++ b/src/renderer/src/lib/agent-session/tab-identity/use-tab-agent.test.ts @@ -0,0 +1,143 @@ +// @vitest-environment happy-dom + +import { act, createElement } from 'react' +import { createRoot } from 'react-dom/client' +import type { Root } from 'react-dom/client' +import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' +import { useAppStore } from '@/store/index' +import { makePaneKey } from '../../../../../shared/workspace-layout/stable-pane-id' +import '../../../../../shared/tab-agent-from-signals' +import { useTabAgent } from './use-tab-agent' +import type { AgentStatusEntry } from '../../../../../shared/agent-status/contracts/agent-status-types' +import type { TerminalTab } from '../../../../../shared/workspace-layout/terminal-tab-types' +import type { TerminalAgent } from '../../../../../shared/agent-status/identity/terminal-agent' + +const initialAppState = useAppStore.getInitialState() +const LEAF_ID = '11111111-1111-4111-8111-111111111111' +void '22222222-2222-4222-8222-222222222222' +let latestHookAgent: TerminalAgent | null | undefined +const hookRoots: Root[] = [] + +function HookProbe({ tab }: { tab: TerminalTab }): null { + latestHookAgent = useTabAgent(tab) + return null +} + +async function renderHookProbe(tab: TerminalTab): Promise { + const container = document.createElement('div') + document.body.appendChild(container) + const root = createRoot(container) + hookRoots.push(root) + await act(async () => { + root.render(createElement(HookProbe, { tab })) + }) + await flushHookEffects() + return root +} + +async function rerenderHookProbe(root: Root, tab: TerminalTab): Promise { + await act(async () => { + root.render(createElement(HookProbe, { tab })) + }) + await flushHookEffects() +} + +async function flushHookEffects(): Promise { + await act(async () => { + await Promise.resolve() + await Promise.resolve() + }) +} + +function agentStatus(paneKey: string, state: AgentStatusEntry['state']): AgentStatusEntry { + return { + state, + prompt: '', + updatedAt: 1, + stateStartedAt: 1, + agentType: 'codex', + paneKey, + stateHistory: [] + } +} + +function workingAgentStatus(paneKey: string): AgentStatusEntry { + return agentStatus(paneKey, 'working') +} + +describe('useTabAgent', () => { + const originalApi = window.api + const getForegroundProcess = vi.fn() + const clearTabLaunchAgent = vi.fn() + const baseTab: TerminalTab = { + id: 'tab-1', + ptyId: 'pty-1', + worktreeId: 'wt-1', + title: 'Terminal 1', + customTitle: null, + color: null, + sortOrder: 0, + createdAt: 1, + launchAgent: 'codex' + } + + beforeEach(() => { + latestHookAgent = undefined + getForegroundProcess.mockReset() + clearTabLaunchAgent.mockReset() + useAppStore.setState(initialAppState, true) + useAppStore.setState({ + ptyIdsByTabId: { 'tab-1': ['pty-1'] }, + agentStatusByPaneKey: {}, + terminalLayoutsByTabId: {}, + clearTabLaunchAgent + }) + window.api = { + ...originalApi, + pty: { + ...originalApi?.pty, + getForegroundProcess + } + } as typeof window.api + }) + + afterEach(() => { + hookRoots.splice(0).forEach((root) => { + act(() => root.unmount()) + }) + document.body.replaceChildren() + useAppStore.setState(initialAppState, true) + window.api = originalApi + }) + + it('does not clear remote launch identity when the hook row drops at a shell title', async () => { + const remotePtyId = 'remote:web-env-1@@terminal-1' + const paneKey = makePaneKey('tab-1', LEAF_ID) + useAppStore.setState({ + ptyIdsByTabId: { 'tab-1': [remotePtyId] }, + terminalLayoutsByTabId: { + 'tab-1': { + root: { type: 'leaf', leafId: LEAF_ID }, + activeLeafId: LEAF_ID, + expandedLeafId: null, + ptyIdsByLeafId: { [LEAF_ID]: remotePtyId } + } + }, + agentStatusByPaneKey: { + [paneKey]: workingAgentStatus(paneKey) + } + }) + const remoteTab = { ...baseTab, ptyId: remotePtyId, launchAgent: 'claude' as const } + + const root = await renderHookProbe(remoteTab) + + // Remote transport gaps do not prove exit; require completion evidence to clear identity. + await act(async () => { + useAppStore.setState({ agentStatusByPaneKey: {} }) + }) + await rerenderHookProbe(root, { ...remoteTab, title: 'zsh' }) + + expect(clearTabLaunchAgent).not.toHaveBeenCalled() + expect(latestHookAgent).toBe('claude') + }) +}) diff --git a/src/renderer/src/lib/use-tab-agent.ts b/src/renderer/src/lib/agent-session/tab-identity/use-tab-agent.ts similarity index 95% rename from src/renderer/src/lib/use-tab-agent.ts rename to src/renderer/src/lib/agent-session/tab-identity/use-tab-agent.ts index 09e2a51098a..690e4e0930a 100644 --- a/src/renderer/src/lib/use-tab-agent.ts +++ b/src/renderer/src/lib/agent-session/tab-identity/use-tab-agent.ts @@ -1,9 +1,11 @@ import { useEffect, useRef, useState } from 'react' -import { useAppStore } from '@/store' -import type { AppState } from '@/store/types' +import { useAppStore } from '@/store/index' import { worktreeUsesRemoteConnection } from '@/store/terminals/terminal-workspace-routing' import { hasRemoteRuntimePtyForTab } from './tab-agent-remote-pty-selector' -import { isTerminalLeafId, makePaneKey } from '../../../shared/workspace-layout/stable-pane-id' +import { + isTerminalLeafId, + makePaneKey +} from '../../../../../shared/workspace-layout/stable-pane-id' import { resolveFocusedCompletedTabAgent, resolveFocusedRetainedTabAgent, @@ -16,9 +18,10 @@ import { hasObservedTabAgentSignal, resolveLaunchedAgentExitEvidence, resolveTabAgentFromSignals -} from '../../../shared/tab-agent-from-signals' -import type { TerminalTab } from '../../../shared/workspace-layout/terminal-tab-types' -import type { TerminalAgent } from '../../../shared/agent-status/identity/terminal-agent' +} from '../../../../../shared/tab-agent-from-signals' +import type { AppState } from '@/store/types' +import type { TerminalTab } from '../../../../../shared/workspace-layout/terminal-tab-types' +import type { TerminalAgent } from '../../../../../shared/agent-status/identity/terminal-agent' type TabHookAgents = { focused: TerminalAgent | null diff --git a/src/renderer/src/lib/browser/documents/file-preview.ts b/src/renderer/src/lib/browser/documents/file-preview.ts index 195146eed69..8c7be8d24c6 100644 --- a/src/renderer/src/lib/browser/documents/file-preview.ts +++ b/src/renderer/src/lib/browser/documents/file-preview.ts @@ -1,12 +1,9 @@ import { browserPageDocLocationsEqual } from '../../../../../shared/browser-page-doc-location' -import { openPlannedFileBrowserLink, type FileBrowserLinkTarget } from './file-preview-link-open' -import type { - BrowserLinkOpenContext, - BrowserOpenOutcome -} from '../navigation/browser-link-destination' +import { openPlannedFileBrowserLink } from './file-preview-link-open' +import type { FileBrowserLinkTarget } from './file-preview-link-open' import { toast } from 'sonner' import { absolutePathToFileUri } from '@/components/editor/markdown/link-routing/markdown-internal-links' -import { getWorkspaceClientCreationActionPolicy } from '@/lib/client-creation-action-policy' +import { getWorkspaceClientCreationActionPolicy } from '@/lib/workspace/creation/surface-policy/client-creation-action-policy' import { webClientDocPreviewRefusal } from '@/lib/browser/documents/doc-preview-web-client' import { useCallback } from 'react' import { useShallow } from 'zustand/react/shallow' @@ -20,9 +17,7 @@ import { TWIN_FILE_BROWSER_UNSUPPORTED_MESSAGE } from '@/lib/browser/documents/workspace-file-browser-open-target' import { useAppStore } from '@/store/index' -import type { AppState } from '@/store/types' import { findSiblingGroupId } from '../../../../../shared/workspace-layout/tab-group-layout-tree' -import type { CreateBrowserTabOptions } from '@/store/slices/browser/browser-slice-contract' import '../../../../../shared/constants' import { ORCA_BROWSER_BLANK_URL } from '../../../../../shared/browser/browser-blank-page' import { @@ -30,6 +25,12 @@ import { selectWorktreesByRepo } from '@/store/workspaces/catalog/workspace-record-fields' import { findWorkspaceShowingDoc } from './workspace-doc-tab-lookup' +import type { + BrowserLinkOpenContext, + BrowserOpenOutcome +} from '../navigation/browser-link-destination' +import type { AppState } from '@/store/types' +import type { CreateBrowserTabOptions } from '@/store/slices/browser/browser-slice-contract' export type PreviewableLanguage = 'html' diff --git a/src/renderer/src/lib/browser/navigation/app-http-link-open.ts b/src/renderer/src/lib/browser/navigation/app-http-link-open.ts index c006539ab89..abda7709b1f 100644 --- a/src/renderer/src/lib/browser/navigation/app-http-link-open.ts +++ b/src/renderer/src/lib/browser/navigation/app-http-link-open.ts @@ -1,15 +1,12 @@ -import type { AppState } from '@/store/types' import { canNativeChatOpenOwnedBrowser, resolveNativeChatHttpLinkSourceOwner } from '@/components/native-chat/links/actions/native-chat-http-link-source-owner' -import { getWorkspaceClientCreationActionPolicy } from '../../client-creation-action-policy' -import { - openOwnedHttpLink, - type HttpLinkDestination, - type HttpLinkSourceOwner -} from './http-link-routing' +import { getWorkspaceClientCreationActionPolicy } from '../../workspace/creation/surface-policy/client-creation-action-policy' +import { openOwnedHttpLink } from './http-link-routing' +import type { HttpLinkDestination, HttpLinkSourceOwner } from './http-link-routing' import { getShortcutPlatform } from '../../keyboard/shortcut-platform' +import type { AppState } from '@/store/types' // The store registers itself so link buttons need not import it. let appStateAccessor: (() => AppState) | null = null diff --git a/src/renderer/src/lib/browser/navigation/browser-link-destination.test.ts b/src/renderer/src/lib/browser/navigation/browser-link-destination.test.ts index 3147241a2cf..4a694b3980c 100644 --- a/src/renderer/src/lib/browser/navigation/browser-link-destination.test.ts +++ b/src/renderer/src/lib/browser/navigation/browser-link-destination.test.ts @@ -3,24 +3,20 @@ import { buildBrowserPage, buildWorkspaceFromPage } from '@/store/slices/browser/pages/browser-page-records' -import { - browserLinkPageMatches, - browserOpenResultForPage, - selectBrowserLinkDestination -} from './browser-link-destination' +import { browserLinkPageMatches, selectBrowserLinkDestination } from './browser-link-destination' import { browserLinkTestDestination, createBrowserLinkTestStore, WORKSPACE, - URL_TO_OPEN, - type BrowserLinkTestStore + URL_TO_OPEN } from './browser-link-open.test-fixture' -import { captureLinkOpenIntent } from '../../link-open-intent' +import type { BrowserLinkTestStore } from './browser-link-open.test-fixture' +import { captureLinkOpenIntent } from '../../links/placement/link-open-intent' import '@/store/testing/app-store-test-fixture' import { makeUnifiedTab } from '@/store/slices/tabs/tab-group.test-fixture' -import { makeWorktree } from '@/store/slices/worktrees/worktree.test-fixture' +import '@/store/slices/worktrees/worktree.test-fixture' import { makeFolderWorkspace } from '@/store/folder-workspaces/folder-workspace.test-fixture' -import { canOfferHttpLinkGroupAction } from './http-link-in-group-availability' +import './http-link-in-group-availability' let store: BrowserLinkTestStore beforeEach(() => { @@ -28,80 +24,6 @@ beforeEach(() => { }) describe('browser destination scope', () => { - it.each(['listed', 'detected'] as const)( - 'refuses hostless ownership for %s twins even when the active workspace names one host', - (catalog) => { - const existing = store.getState().createBrowserTab(WORKSPACE, URL_TO_OPEN, { - targetGroupId: 'b', - executionHostId: 'local', - browserRuntimeEnvironmentId: null, - sessionProfileId: null, - activate: false - }) - store.setState((state) => ({ - ...(catalog === 'listed' - ? { - worktreesByRepo: { - repo1: [ - ...state.worktreesByRepo.repo1!, - makeWorktree({ id: WORKSPACE, repoId: 'repo1', hostId: 'runtime:other' }) - ] - } - } - : { - detectedWorktreesByRepo: { - repo1: { - repoId: 'repo1', - authoritative: true, - source: 'git' as const, - worktrees: [ - { - ...makeWorktree({ id: WORKSPACE, repoId: 'repo1', hostId: 'runtime:other' }), - ownership: 'external' as const, - selectedCheckout: false, - visible: true - } - ] - } - } - }), - unifiedTabsByWorktree: { - [WORKSPACE]: state.unifiedTabsByWorktree[WORKSPACE]!.map((tab) => ({ - ...tab, - executionHostId: undefined - })) - } - })) - const state = store.getState() - const destination = browserLinkTestDestination() - expect( - selectBrowserLinkDestination( - state, - destination, - captureLinkOpenIntent(state, WORKSPACE, 'source') - ) - ).toMatchObject({ status: 'ready', groupId: 'b', match: null }) - expect( - browserOpenResultForPage(state, destination, existing.id, existing.activePageId!) - ).toBeNull() - expect( - canOfferHttpLinkGroupAction(state, { - workspaceId: WORKSPACE, - sourceTabId: 'source', - sourceOwner: { kind: 'local' }, - url: URL_TO_OPEN - }) - ).toBe(false) - expect( - selectBrowserLinkDestination( - state, - browserLinkTestDestination(), - captureLinkOpenIntent(state, WORKSPACE, 'source', { explicitSourceGroup: true }) - ) - ).toEqual({ status: 'refused' }) - } - ) - it('refuses hostless folder twins despite an active host selection', () => { const workspaceId = 'folder:legacy' store.setState((state) => ({ diff --git a/src/renderer/src/lib/browser/navigation/browser-link-destination.ts b/src/renderer/src/lib/browser/navigation/browser-link-destination.ts index 3dadc8a3fdd..c7766967005 100644 --- a/src/renderer/src/lib/browser/navigation/browser-link-destination.ts +++ b/src/renderer/src/lib/browser/navigation/browser-link-destination.ts @@ -1,6 +1,16 @@ -import type { Tab } from '../../../../../shared/tab-types' import { createBrowserLinkHostMatcher } from './browser-link-owner' import { createBrowserLinkSessionMatcher } from './browser-link-session' +import { + normalizeBrowserNavigationUrl, + redactKagiSessionToken +} from '../../../../../shared/browser-url' +import { browserPageDocLocationsEqual } from '../../../../../shared/browser-page-doc-location' +import { findVisibleBrowserLinkTarget } from './visible-browser-link-target' +import { isLiveLinkOpenGroup, liveLinkOpenGroupIds } from '../../links/placement/link-open-intent' +import type { LinkOpenIntent } from '../../links/placement/link-open-intent' +import { runtimeEnvironmentIdOrLocalUnlessTwin } from '../../workspace/ownership/worktree-runtime-owner' +import { resolveLinkOpenSidePlacement } from '../../links/placement/adjacent-link-open-group' +import type { Tab } from '../../../../../shared/tab-types' import type { AppState } from '@/store/types' import type { BrowserPage, @@ -8,17 +18,7 @@ import type { BrowserWorkspace } from '../../../../../shared/browser-workspace-types' import type { ExecutionHostId } from '../../../../../shared/execution-host' -import { - normalizeBrowserNavigationUrl, - redactKagiSessionToken -} from '../../../../../shared/browser-url' -import { browserPageDocLocationsEqual } from '../../../../../shared/browser-page-doc-location' -import { findVisibleBrowserLinkTarget } from './visible-browser-link-target' import type { TabSplitTarget } from '@/store/slices/tabs/tabs-slice-contract' -import { isLiveLinkOpenGroup, liveLinkOpenGroupIds } from '../../link-open-intent' -import type { LinkOpenIntent } from '../../link-open-intent' -import { runtimeEnvironmentIdOrLocalUnlessTwin } from '../../workspace/ownership/worktree-runtime-owner' -import { resolveLinkOpenSidePlacement } from '../../adjacent-link-open-group' export type BrowserLinkDestination = { worktreeId: string diff --git a/src/renderer/src/lib/browser/navigation/browser-link-open-layout-owner.test.ts b/src/renderer/src/lib/browser/navigation/browser-link-open-layout-owner.test.ts deleted file mode 100644 index 0475aaaff8a..00000000000 --- a/src/renderer/src/lib/browser/navigation/browser-link-open-layout-owner.test.ts +++ /dev/null @@ -1,386 +0,0 @@ -import type * as BrowserFocusModule from '@/components/browser-pane/host-guest/browser-focus' -import { requestBrowserFocus } from '@/components/browser-pane/host-guest/browser-focus' -import { isBrowserPageMountAdmitted } from '@/components/browser-pane/host-guest/browser-page-mount-admission' -import { afterEach, beforeEach, expect, it, vi } from 'vitest' -import { createStoreCascadesMockApi } from '@/store/testing/app-store-cascade-api.test-fixture' -import { makeWorktree } from '@/store/slices/worktrees/worktree.test-fixture' -import { - drawTabsFromMain, - type TabsDrawnFromMain -} from '@/store/slices/tabs/tabs-drawn-from-main.test-fixture' -import { layoutApplyTestTransport } from '@/runtime/workspace-layout/testing/layout-apply-test-transport.test-fixture' -import { - createBrowserLinkTestStore, - WORKSPACE, - URL_TO_OPEN, - type BrowserLinkTestStore -} from './browser-link-open.test-fixture' -import { captureLinkOpenIntent } from '../../link-open-intent' -import { beginLinkOpenRequest } from '../../link-open-request' -import { openWorkspaceBrowserTabForLink } from '../workspace/workspace-browser-tab-open' -import { openFileInBrowserTab } from '../documents/file-preview' -import { openEditorHtmlPreview } from '@/components/editor/open-editor-html-preview' -import type { BrowserOpenOutcome } from './browser-link-destination' - -vi.mock('../../../../../shared/layout-owner-switch', () => ({ ORCA_LAYOUT_OWNER_IS_MAIN: true })) -const mocks = vi.hoisted(() => ({ getState: vi.fn(), subscribe: vi.fn() })) -vi.mock('@/store/index', () => ({ - useAppStore: { getState: () => mocks.getState(), subscribe: mocks.subscribe } -})) -vi.mock('@/runtime/rpc/calls/runtime-rpc-call', async (importOriginal) => - ( - await import('@/runtime/workspace-layout/testing/layout-apply-test-transport.test-fixture') - ).runtimeRpcClientWithLayoutApply(await importOriginal()) -) -vi.mock('@/runtime/workspace-layout/frames/runtime-layout-client', async (importOriginal) => - ( - await import('@/runtime/workspace-layout/testing/layout-apply-test-transport.test-fixture') - ).runtimeLayoutClientWithTestFrames(await importOriginal()) -) -vi.mock('@/components/browser-pane/host-guest/browser-focus', async (importOriginal) => ({ - ...(await importOriginal()), - requestBrowserFocus: vi.fn() -})) -vi.mock('sonner', () => ({ - toast: { error: vi.fn(), info: vi.fn(), success: vi.fn(), warning: vi.fn() } -})) -createStoreCascadesMockApi() -let store: BrowserLinkTestStore -let main: TabsDrawnFromMain - -beforeEach(async () => { - store = createBrowserLinkTestStore() - store.setState({ - tabsByWorktree: { - [WORKSPACE]: store.getState().unifiedTabsByWorktree[WORKSPACE]!.map((tab) => ({ - id: tab.entityId, - ptyId: null, - worktreeId: WORKSPACE, - title: 'Terminal', - customTitle: null, - color: null, - sortOrder: tab.sortOrder, - createdAt: tab.createdAt - })) - } - }) - mocks.getState.mockImplementation(() => store.getState()) - mocks.subscribe.mockImplementation(store.subscribe) - vi.mocked(requestBrowserFocus).mockClear() - main = await drawTabsFromMain(store) - layoutApplyTestTransport.answerWith('pending') -}) -afterEach(() => main.close()) - -function open(surface: 'http' | 'html', explicit = true, background = false) { - const linkContext = { - linkIntent: captureLinkOpenIntent(store.getState(), WORKSPACE, 'source', { - explicitSourceGroup: explicit - }), - isCurrentRequest: beginLinkOpenRequest() - } - if (surface === 'http') { - return openWorkspaceBrowserTabForLink({ - workspaceId: WORKSPACE, - url: URL_TO_OPEN, - intent: { kind: 'url' }, - ...(background ? { focusOnCreate: false, selectWorktree: false } : {}), - linkContext - }) - } - return new Promise((resolve) => - openFileInBrowserTab({ - worktreeId: WORKSPACE, - filePath: '/repo/index.html', - linkContext, - onLinkOutcome: resolve - }) - ) -} - -function pendingBrowserPageId(): string { - const pageId = layoutApplyTestTransport.sentOfType('openBrowserTab')[0]?.pageId - if (!pageId) { - throw new Error('Expected a pending browser page') - } - return pageId -} - -it.each([ - ['http', false], - ['http', true], - ['html', false], - ['html', true] -] as const)( - 'waits for main to draw a %s link before reporting and activating its exact page (explicit: %s)', - async (surface, explicit) => { - const groupCount = store.getState().groupsByWorktree[WORKSPACE]!.length - const reported = vi.fn() - const opening = open(surface, explicit).then((outcome) => { - reported(outcome) - return outcome - }) - await Promise.resolve() - expect(reported).not.toHaveBeenCalled() - expect(store.getState().browserPagesByWorkspace).toEqual({}) - expect(store.getState().activeGroupIdByWorktree[WORKSPACE]).toBe('c') - expect(requestBrowserFocus).not.toHaveBeenCalled() - - const pending = layoutApplyTestTransport.sentOfType('openBrowserTab')[0]! - const targetGroupId = pending.groupId - expect(targetGroupId).toBe(explicit ? 'a' : 'b') - expect(pending.split).toBeUndefined() - layoutApplyTestTransport.answerWith('apply') - layoutApplyTestTransport.answerPending() - await main.settle() - const outcome = await opening - expect(outcome).toMatchObject({ - status: 'opened', - result: { worktreeId: WORKSPACE, groupId: targetGroupId } - }) - if (outcome.status !== 'opened') { - throw new Error('Expected a materialized browser link') - } - const { result } = outcome - const state = store.getState() - expect(state.groupsByWorktree[WORKSPACE]).toHaveLength(groupCount) - expect( - state.groupsByWorktree[WORKSPACE]?.find((group) => group.id === targetGroupId)?.activeTabId - ).toBe(result.unifiedTabId) - expect(state.activeGroupIdByWorktree[WORKSPACE]).toBe(targetGroupId) - expect(state.activeBrowserTabId).toBe(result.browserWorkspaceId) - expect( - state.browserTabsByWorktree[WORKSPACE]?.find((tab) => tab.id === result.browserWorkspaceId) - ?.activePageId - ).toBe(result.browserPageId) - expect(requestBrowserFocus).toHaveBeenCalledExactlyOnceWith({ - pageId: result.browserPageId, - target: 'webview' - }) - } -) - -it('admits a background HTTP page only after main materializes it without activating it', async () => { - const opening = open('http', false, true) - const pageId = pendingBrowserPageId() - expect(isBrowserPageMountAdmitted(pageId)).toBe(false) - - layoutApplyTestTransport.answerWith('apply') - layoutApplyTestTransport.answerPending() - await main.settle() - - expect(await opening).toMatchObject({ status: 'opened' }) - expect(isBrowserPageMountAdmitted(pageId)).toBe(true) - expect(store.getState().activeGroupIdByWorktree[WORKSPACE]).toBe('c') - expect(requestBrowserFocus).not.toHaveBeenCalled() -}) - -it('does not activate a link superseded while main was opening its tab', async () => { - const opening = open('http') - const pageId = pendingBrowserPageId() - beginLinkOpenRequest() - layoutApplyTestTransport.answerWith('apply') - layoutApplyTestTransport.answerPending() - await main.settle() - - expect(await opening).toEqual({ status: 'superseded' }) - await main.settle() - expect(store.getState().browserTabsByWorktree[WORKSPACE] ?? []).toEqual([]) - expect(store.getState().browserPagesByWorkspace).toEqual({}) - expect( - store.getState().unifiedTabsByWorktree[WORKSPACE]?.some((tab) => tab.contentType === 'browser') - ).toBe(false) - expect(store.getState().recentlyClosedBrowserTabsByWorktree[WORKSPACE] ?? []).toEqual([]) - expect(store.getState().activeGroupIdByWorktree[WORKSPACE]).toBe('c') - expect(isBrowserPageMountAdmitted(pageId)).toBe(false) - expect(requestBrowserFocus).not.toHaveBeenCalled() -}) - -it.each(['workspace', 'view', 'view-return'] as const)( - 'retains a tab without revealing or focusing it after navigation during layout acknowledgement: %s', - async (navigation) => { - const opening = open('http', false) - const pageId = pendingBrowserPageId() - if (navigation === 'workspace') { - store.getState().setActiveWorktree(null) - } else { - const previousView = store.getState().activeView - store.getState().setActiveView('skills') - if (navigation === 'view-return') { - store.getState().setActiveView(previousView) - } - } - const selected = store.getState() - layoutApplyTestTransport.answerWith('apply') - layoutApplyTestTransport.answerPending() - await main.settle() - - expect(await opening).toMatchObject({ status: 'opened' }) - const state = store.getState() - expect(state.browserTabsByWorktree[WORKSPACE]).toHaveLength(1) - expect(state.activeWorktreeId).toBe(selected.activeWorktreeId) - expect(state.activeView).toBe(selected.activeView) - expect(state.activeGroupIdByWorktree[WORKSPACE]).toBe('c') - expect(state.groupsByWorktree[WORKSPACE]?.find((group) => group.id === 'b')?.activeTabId).toBe( - 'terminal-b' - ) - expect(isBrowserPageMountAdmitted(pageId)).toBe(true) - expect(requestBrowserFocus).not.toHaveBeenCalled() - } -) - -it('does not activate a link whose owner changed while main was opening its tab', async () => { - const opening = open('http') - const pageId = pendingBrowserPageId() - store.setState((state) => ({ - worktreesByRepo: { - repo1: state.worktreesByRepo.repo1!.map((worktree) => ({ - ...worktree, - hostId: 'ssh:changed' - })) - } - })) - layoutApplyTestTransport.answerWith('apply') - layoutApplyTestTransport.answerPending() - await main.settle() - - expect(await opening).toEqual({ status: 'refused' }) - await main.settle() - expect(store.getState().browserTabsByWorktree[WORKSPACE] ?? []).toEqual([]) - expect(store.getState().browserPagesByWorkspace).toEqual({}) - expect( - store.getState().unifiedTabsByWorktree[WORKSPACE]?.some((tab) => tab.contentType === 'browser') - ).toBe(false) - expect(store.getState().recentlyClosedBrowserTabsByWorktree[WORKSPACE] ?? []).toEqual([]) - expect(store.getState().activeGroupIdByWorktree[WORKSPACE]).toBe('c') - expect(isBrowserPageMountAdmitted(pageId)).toBe(false) - expect(requestBrowserFocus).not.toHaveBeenCalled() -}) - -it('reports failure when main refuses the browser creation', async () => { - const opening = open('http') - const pageId = pendingBrowserPageId() - layoutApplyTestTransport.answerWith({ refuse: 'workspace_not_found' }) - layoutApplyTestTransport.answerPending() - await main.settle() - - expect(await opening).toEqual({ status: 'failed' }) - expect(store.getState().browserPagesByWorkspace).toEqual({}) - expect(isBrowserPageMountAdmitted(pageId)).toBe(false) - expect(requestBrowserFocus).not.toHaveBeenCalled() -}) - -it('opens a remote document in the requested group without moving an existing mixed browser workspace', async () => { - const owner = 'repo2::/remote' - store.setState((state) => ({ - repos: [ - ...state.repos, - { - ...state.repos[0]!, - id: 'repo2', - connectionId: 'preview-owner', - executionHostId: 'ssh:preview-owner' - } - ], - worktreesByRepo: { - ...state.worktreesByRepo, - repo2: [ - makeWorktree({ id: owner, repoId: 'repo2', path: '/remote', hostId: 'ssh:preview-owner' }) - ] - } - })) - const openPreview = () => - new Promise((resolve) => - openFileInBrowserTab({ - filePath: '/remote/index.html', - worktreeId: owner, - placementWorkspaceId: WORKSPACE, - linkContext: { - linkIntent: captureLinkOpenIntent(store.getState(), WORKSPACE, 'source', { - explicitSourceGroup: true - }), - isCurrentRequest: beginLinkOpenRequest() - }, - onLinkOutcome: resolve - }) - ) - layoutApplyTestTransport.answerWith('apply') - const existing = store.getState().createBrowserTab(WORKSPACE, '', { - targetGroupId: 'b', - browserRuntimeEnvironmentId: null, - docLocation: { kind: 'workspace-doc', worktreeId: owner, filePath: '/remote/index.html' }, - activate: false - }) - await main.settle() - const unrelated = store - .getState() - .createBrowserPage(existing.id, 'https://example.com/unrelated')! - await main.settle() - layoutApplyTestTransport.answerWith('pending') - - const opening = openPreview() - layoutApplyTestTransport.answerWith('apply') - layoutApplyTestTransport.answerPending() - await main.settle() - expect(await opening).toMatchObject({ status: 'opened', result: { groupId: 'a' } }) - const state = store.getState() - expect( - state.unifiedTabsByWorktree[WORKSPACE]?.find((tab) => tab.entityId === existing.id) - ).toMatchObject({ groupId: 'b' }) - expect( - state.browserTabsByWorktree[WORKSPACE]?.find((tab) => tab.id === existing.id)?.activePageId - ).toBe(unrelated.id) - expect(state.browserPagesByWorkspace[existing.id]).toHaveLength(2) - expect(state.groupsByWorktree[WORKSPACE]?.map((group) => group.id)).toEqual(['a', 'b', 'c']) - const preview = state.activeBrowserTabId - expect(preview).not.toBe(existing.id) - expect(state.browserPagesByWorkspace[preview!]?.[0]?.docLocation).toEqual({ - kind: 'workspace-doc', - worktreeId: owner, - filePath: '/remote/index.html' - }) - expect(await openPreview()).toMatchObject({ - status: 'opened', - result: { browserWorkspaceId: preview, groupId: 'a' } - }) - expect(store.getState().browserTabsByWorktree[WORKSPACE]).toHaveLength(2) -}) - -it('keeps the editor selected after navigating away and back while main creates its preview', async () => { - store.setState((state) => ({ - openFiles: [ - { - id: 'report', - filePath: '/repo/report.html', - relativePath: 'report.html', - worktreeId: WORKSPACE, - language: 'html', - mode: 'edit', - isDirty: false - } - ], - unifiedTabsByWorktree: { - [WORKSPACE]: state.unifiedTabsByWorktree[WORKSPACE]!.map((tab) => - tab.id === 'source' ? { ...tab, contentType: 'editor', entityId: 'report' } : tab - ) - } - })) - store.getState().focusGroup(WORKSPACE, 'a') - const opening = openEditorHtmlPreview('report', 'source') - await Promise.resolve() - store.getState().focusGroup(WORKSPACE, 'b') - store.getState().focusGroup(WORKSPACE, 'a') - layoutApplyTestTransport.answerWith('apply') - layoutApplyTestTransport.answerPending() - await main.settle() - await opening - const state = store.getState() - expect(state.groupsByWorktree[WORKSPACE]?.find((group) => group.id === 'a')?.activeTabId).toBe( - 'source' - ) - expect(state.activeGroupIdByWorktree[WORKSPACE]).toBe('a') - expect( - state.unifiedTabsByWorktree[WORKSPACE]?.find((tab) => tab.contentType === 'browser') - ).toMatchObject({ groupId: 'a' }) - expect(requestBrowserFocus).not.toHaveBeenCalled() -}) diff --git a/src/renderer/src/lib/browser/navigation/browser-link-open.test.ts b/src/renderer/src/lib/browser/navigation/browser-link-open.test.ts index c8caf3bd2a6..2851cd2c8d7 100644 --- a/src/renderer/src/lib/browser/navigation/browser-link-open.test.ts +++ b/src/renderer/src/lib/browser/navigation/browser-link-open.test.ts @@ -1,23 +1,22 @@ -import type * as BrowserFocusModule from '@/components/browser-pane/host-guest/browser-focus' import { beforeEach, describe, expect, it, vi } from 'vitest' import { createStoreCascadesMockApi } from '@/store/testing/app-store-cascade-api.test-fixture' import '@/store/testing/app-store-test-fixture' import { makeTabGroup, makeUnifiedTab } from '@/store/slices/tabs/tab-group.test-fixture' import { buildBrowserPage } from '@/store/slices/browser/pages/browser-page-records' -import { captureLinkOpenIntent } from '../../link-open-intent' -import { beginLinkOpenRequest } from '../../link-open-request' +import { captureLinkOpenIntent } from '../../links/placement/link-open-intent' +import { beginLinkOpenRequest } from '../../links/link-open-request' import { openLocalBrowserLink } from './browser-link-open' import { selectBrowserLinkDestination } from './browser-link-destination' import { browserLinkTestDestination, createBrowserLinkTestStore, WORKSPACE, - URL_TO_OPEN, - type BrowserLinkTestStore + URL_TO_OPEN } from './browser-link-open.test-fixture' - +import type { BrowserLinkTestStore } from './browser-link-open.test-fixture' import { openWorkspaceBrowserTabForLink } from '../workspace/workspace-browser-tab-open' import { FLOATING_TERMINAL_WORKTREE_ID } from '../../../../../shared/constants' +import type * as BrowserFocusModule from '@/components/browser-pane/host-guest/browser-focus' const mocks = vi.hoisted(() => ({ getState: vi.fn() })) vi.mock('@/store/index', () => ({ useAppStore: { getState: () => mocks.getState() } })) @@ -65,27 +64,6 @@ function browser(groupId: string, url = URL_TO_OPEN) { } describe('browser link placement and exact page activation', () => { - it('removes a newly created tab after an activation error while preserving existing tabs', async () => { - const existing = browser('c', 'https://unrelated.example/') - const before = store.getState() - const outcome = await openLocalBrowserLink({ - destination: browserLinkTestDestination(), - context: context(), - url: URL_TO_OPEN, - ownsRoute: () => true, - reveal: () => { - throw new Error('Workspace activation failed') - } - }) - - expect(outcome).toEqual({ status: 'failed' }) - const state = store.getState() - expect(state.browserTabsByWorktree[WORKSPACE]?.map((tab) => tab.id)).toEqual([existing.id]) - expect(state.browserPagesByWorkspace).toEqual(before.browserPagesByWorkspace) - expect(state.unifiedTabsByWorktree[WORKSPACE]).toEqual(before.unifiedTabsByWorktree[WORKSPACE]) - expect(state.recentlyClosedBrowserTabsByWorktree[WORKSPACE] ?? []).toEqual([]) - }) - it('refuses an expired explicit group before creating records or activating a destination', async () => { const captured = context(true) store.setState({ diff --git a/src/renderer/src/lib/browser/navigation/browser-link-open.ts b/src/renderer/src/lib/browser/navigation/browser-link-open.ts index 9d40e379f6e..541f99bd064 100644 --- a/src/renderer/src/lib/browser/navigation/browser-link-open.ts +++ b/src/renderer/src/lib/browser/navigation/browser-link-open.ts @@ -2,24 +2,26 @@ import { focusOpenedBrowserLink } from './browser-link-focus' import { releaseBrowserPageMount } from '@/components/browser-pane/host-guest/browser-page-mount-admission' import { createBrowserLinkHostMatcher } from './browser-link-owner' import { useAppStore } from '@/store/index' -import type { AppState } from '@/store/types' -import type { CreateBrowserTabOptions } from '@/store/slices/browser/browser-slice-contract' import { activateBrowserWorkspaceTab } from '../workspace/browser-workspace-tab-activation' import { browserLinkPageMatches, currentBrowserLinkMatch, browserOpenResultForPage, - selectBrowserLinkDestination, - type BrowserLinkDestination, - type BrowserLinkOpenContext, - type BrowserOpenOutcome + selectBrowserLinkDestination } from './browser-link-destination' -import { isLiveLinkOpenGroup } from '../../link-open-intent' +import type { + BrowserLinkDestination, + BrowserLinkOpenContext, + BrowserOpenOutcome +} from './browser-link-destination' +import { isLiveLinkOpenGroup } from '../../links/placement/link-open-intent' import { afterPendingEntityTabs, hasPendingEntityTab } from '@/runtime/workspace-layout/intents/layout-owner-pending-tabs' import { captureBrowserLinkReveal } from './browser-link-reveal' +import type { AppState } from '@/store/types' +import type { CreateBrowserTabOptions } from '@/store/slices/browser/browser-slice-contract' export class BrowserLinkPlacementRefused extends Error {} diff --git a/src/renderer/src/lib/browser/navigation/http-link-browser-placement.ts b/src/renderer/src/lib/browser/navigation/http-link-browser-placement.ts index 56f9add4df7..114f0fbeb68 100644 --- a/src/renderer/src/lib/browser/navigation/http-link-browser-placement.ts +++ b/src/renderer/src/lib/browser/navigation/http-link-browser-placement.ts @@ -1,14 +1,14 @@ +import { requestBrowserFocus } from '@/components/browser-pane/host-guest/browser-focus' +import { findVisibleBrowserLinkTarget } from './visible-browser-link-target' +import { isFloatingWorkspaceId } from '../../../../../shared/floating-workspace-worktree' +import { resolveLinkOpenSidePlacement } from '../../links/placement/adjacent-link-open-group' import type { AppState } from '@/store/types' import type { CreateBrowserTabOptions } from '@/store/slices/browser/browser-slice-contract' import type { TabSplitTarget } from '@/store/slices/tabs/tabs-slice-contract' import type { Tab, TabGroup } from '../../../../../shared/tab-types' -import { requestBrowserFocus } from '@/components/browser-pane/host-guest/browser-focus' import type { OpenWorkspaceBrowserTabRequest } from '../workspace/workspace-browser-tab-open' import type { BrowserWorkspace } from '../../../../../shared/browser-workspace-types' import type { GlobalSettings } from '../../../../../shared/global-settings-types' -import { findVisibleBrowserLinkTarget } from './visible-browser-link-target' -import { isFloatingWorkspaceId } from '../../../../../shared/floating-workspace-worktree' -import { resolveLinkOpenSidePlacement } from '../../adjacent-link-open-group' export type HttpLinkBrowserPlacement = { targetGroupId: string } | { split: TabSplitTarget } diff --git a/src/renderer/src/lib/browser/navigation/http-link-completion.test.ts b/src/renderer/src/lib/browser/navigation/http-link-completion.test.ts deleted file mode 100644 index 0694da60371..00000000000 --- a/src/renderer/src/lib/browser/navigation/http-link-completion.test.ts +++ /dev/null @@ -1,140 +0,0 @@ -import type * as BrowserFocusModule from '@/components/browser-pane/host-guest/browser-focus' -import { requestBrowserFocus } from '@/components/browser-pane/host-guest/browser-focus' -import { afterEach, beforeEach, expect, it, vi, type Mock } from 'vitest' -import { createStoreCascadesMockApi } from '@/store/testing/app-store-cascade-api.test-fixture' -import { - createBrowserLinkTestStore, - WORKSPACE, - URL_TO_OPEN -} from './browser-link-open.test-fixture' -import { - registerHttpLinkStoreAccessor, - registerWorkspaceHttpLinkBrowserOpener -} from './http-link-routing' -import { - type HttpLinkBrowserCompletion, - openRoutedHttpLink, - type WorkspaceHttpLinkBrowserOpener -} from './http-link-destinations' -import { openWorkspaceBrowserTabForLink } from '../workspace/workspace-browser-tab-open' -import { beginLinkOpenRequest } from '../../link-open-request' -const mocks = vi.hoisted(() => ({ getState: vi.fn() })) -vi.mock('@/store/index', () => ({ useAppStore: { getState: () => mocks.getState() } })) -vi.mock('@/components/browser-pane/host-guest/browser-focus', async (importOriginal) => ({ - ...(await importOriginal()), - requestBrowserFocus: vi.fn() -})) -vi.mock('sonner', () => ({ - toast: { error: vi.fn(), info: vi.fn(), success: vi.fn(), warning: vi.fn() } -})) -createStoreCascadesMockApi() -let store: ReturnType -let cleanups: number -let resume: () => void -let completed: Promise -let finish: () => void -let released: Promise -let opening: Mock -beforeEach(() => { - store = createBrowserLinkTestStore() - mocks.getState.mockImplementation(() => store.getState()) - cleanups = 0 - released = new Promise((resolve) => { - resume = resolve - }) - completed = new Promise((resolve) => { - finish = resolve - }) - registerHttpLinkStoreAccessor( - () => store.getState(), - (listener) => { - const off = store.subscribe(listener) - return () => { - off() - cleanups++ - finish() - } - } - ) - opening = vi.fn( - async ( - request: Parameters< - NonNullable[0]> - >[0] - ) => { - await released - if (!request.linkContext) { - throw new Error('Missing real link context') - } - const result = await openWorkspaceBrowserTabForLink({ - ...request, - linkContext: request.linkContext - }) - return result.status === 'opened' ? result.result.browserPageId : null - } - ) - registerWorkspaceHttpLinkBrowserOpener(opening) -}) -afterEach(() => { - registerWorkspaceHttpLinkBrowserOpener(null) - vi.restoreAllMocks() - vi.clearAllMocks() -}) - -it.each([false, true])( - 'reports actual materialization with its background setting (%s) and discharges the captured reveal observer', - async (background) => { - store.setState((state) => ({ - settings: { ...state.settings!, openLinksInAppInBackground: background } - })) - const results: HttpLinkBrowserCompletion[] = [] - openRoutedHttpLink(URL_TO_OPEN, { - worktreeId: WORKSPACE, - sourceTabId: 'source', - sourceOwner: { kind: 'local' }, - forceDestination: 'orca', - onBrowserOpenComplete: (result) => results.push(result) - }) - expect(results).toEqual([]) - expect(cleanups).toBe(0) - resume() - await completed - expect(results).toEqual([{ pageId: expect.any(String), background }]) - const pageId = results[0]!.pageId - if (background) { - expect(requestBrowserFocus).not.toHaveBeenCalled() - } else { - expect(requestBrowserFocus).toHaveBeenCalledExactlyOnceWith({ pageId, target: 'webview' }) - } - expect( - Object.values(store.getState().browserPagesByWorkspace) - .flat() - .some((page) => page.id === pageId && page.url === URL_TO_OPEN) - ).toBe(true) - expect(cleanups).toBe(1) - } -) - -it.each(['refused', 'superseded'] as const)( - 'does not invent success when the actual browser route is %s', - async (outcome) => { - const complete = vi.fn() - openRoutedHttpLink(URL_TO_OPEN, { - worktreeId: WORKSPACE, - sourceTabId: 'source', - forceDestination: 'orca', - openInSourceGroup: true, - onBrowserOpenComplete: complete - }) - if (outcome === 'superseded') { - beginLinkOpenRequest() - } else { - store.setState({ groupsByWorktree: { [WORKSPACE]: [] }, layoutByWorktree: {} }) - } - resume() - await completed - expect(complete).toHaveBeenCalledExactlyOnceWith({ pageId: null, background: false }) - expect(store.getState().browserPagesByWorkspace).toEqual({}) - expect(cleanups).toBe(1) - } -) diff --git a/src/renderer/src/lib/browser/navigation/http-link-destinations.ts b/src/renderer/src/lib/browser/navigation/http-link-destinations.ts index bc69d5a4cf4..bd78ed0f245 100644 --- a/src/renderer/src/lib/browser/navigation/http-link-destinations.ts +++ b/src/renderer/src/lib/browser/navigation/http-link-destinations.ts @@ -1,15 +1,15 @@ -import type { BrowserLinkOpenContext } from './browser-link-destination' -import type { HttpLinkBrowserRequestFields } from './http-link-browser-placement' import { showOpenInGroupRefusedToast } from '@/components/terminal-pane/links/files/terminal-file-open-in-group-toast' -import { beginLinkOpenRequest } from '../../link-open-request' +import { beginLinkOpenRequest } from '../../links/link-open-request' import { translate } from '@/i18n/i18n' -import type { Translate } from '@/i18n/use-translate' import { openHttpLink, captureHttpLinkIntent, - canHttpLinkOpenInSourceGroup, - type HttpLinkSourceOwner + canHttpLinkOpenInSourceGroup } from '@/lib/browser/navigation/http-link-routing' +import type { HttpLinkSourceOwner } from '@/lib/browser/navigation/http-link-routing' +import type { BrowserLinkOpenContext } from './browser-link-destination' +import type { HttpLinkBrowserRequestFields } from './http-link-browser-placement' +import type { Translate } from '@/i18n/use-translate' export type OpenHttpLinkOptions = { worktreeId?: string | null diff --git a/src/renderer/src/lib/browser/navigation/http-link-in-group-availability.ts b/src/renderer/src/lib/browser/navigation/http-link-in-group-availability.ts index 882bd117110..e553ad6d11d 100644 --- a/src/renderer/src/lib/browser/navigation/http-link-in-group-availability.ts +++ b/src/renderer/src/lib/browser/navigation/http-link-in-group-availability.ts @@ -1,9 +1,7 @@ import { resolveBrowserLinkSession } from './browser-link-session' import { createBrowserLinkHostMatcher } from './browser-link-owner' -import type { AppState } from '@/store/types' -import type { HttpLinkGroupActionRequest } from './http-link-routing' -import { captureLinkOpenIntent } from '../../link-open-intent' -import { getWorkspaceClientCreationActionPolicy } from '../../client-creation-action-policy' +import { captureLinkOpenIntent } from '../../links/placement/link-open-intent' +import { getWorkspaceClientCreationActionPolicy } from '../../workspace/creation/surface-policy/client-creation-action-policy' import { getFloatingWorkspaceOperationRoute, resolveWorktreeOperationRoute @@ -18,6 +16,8 @@ import { parseExecutionHostId, toRuntimeExecutionHostId } from '../../../../../shared/execution-host' +import type { AppState } from '@/store/types' +import type { HttpLinkGroupActionRequest } from './http-link-routing' /** Strict local creation is supported; an unproven runtime route can only reuse a pinned match. */ export function canOfferHttpLinkGroupAction( diff --git a/src/renderer/src/lib/browser/navigation/http-link-routing-store.test.ts b/src/renderer/src/lib/browser/navigation/http-link-routing-store.test.ts index 9e80fd084e0..0287d46a01c 100644 --- a/src/renderer/src/lib/browser/navigation/http-link-routing-store.test.ts +++ b/src/renderer/src/lib/browser/navigation/http-link-routing-store.test.ts @@ -1,16 +1,16 @@ import { afterEach, beforeEach, expect, it, vi } from 'vitest' -import type * as BrowserFocusModule from '@/components/browser-pane/host-guest/browser-focus' import { requestBrowserFocus } from '@/components/browser-pane/host-guest/browser-focus' +import type * as BrowserFocusModule from '@/components/browser-pane/host-guest/browser-focus' import { useAppStore } from '@/store/index' import { createStoreCascadesMockApi } from '@/store/testing/app-store-cascade-api.test-fixture' import '@/store/testing/app-store-test-fixture' import { makeWorktree } from '@/store/slices/worktrees/worktree.test-fixture' -import { FLOATING_TERMINAL_WORKTREE_ID, getDefaultSettings } from '../../../../../shared/constants' +import { getDefaultSettings } from '../../../../../shared/constants' import { seedBrowserLinkTestStore, WORKSPACE, URL_TO_OPEN } from './browser-link-open.test-fixture' -import { captureLinkOpenIntent } from '../../link-open-intent' +import '../../links/placement/link-open-intent' import { openHttpLink } from './http-link-routing' -import { openRoutedHttpLink } from './http-link-destinations' -import * as workspaceBrowserTabOpen from '../workspace/workspace-browser-tab-open' +import './http-link-destinations' +import '../workspace/workspace-browser-tab-open' const OTHER_WORKSPACE = 'repo1::/other' @@ -53,262 +53,6 @@ afterEach(() => { vi.unstubAllGlobals() }) -function deferLocalhostRegistration() { - const registration = Promise.withResolvers<{ url: string }>() - const register = vi.fn(() => registration.promise) - vi.stubGlobal('window', { - ...window, - api: { ...window.api, localhostWorktreeLabels: { register } } - }) - useAppStore.setState((state) => ({ - settings: { - ...(state.settings ?? getDefaultSettings('/home/test')), - localhostWorktreeLabelsEnabled: true - }, - workspacePortScansByKey: { - 'local:all': { - platform: 'darwin', - scannedAt: 1, - ports: [ - { - id: 'tcp:5180', - kind: 'workspace', - port: 5180, - protocol: 'http', - bindHost: '127.0.0.1', - connectHost: 'localhost', - owner: { - repoId: 'repo1', - worktreeId: WORKSPACE, - displayName: 'main', - path: '/repo', - confidence: 'cwd' - } - } - ] - } - } - })) - return { registration, register } -} - -function observeBrowserLinkOpen() { - const completed = - Promise.withResolvers< - Awaited> - >() - const open = workspaceBrowserTabOpen.openWorkspaceBrowserTabForLink - vi.spyOn(workspaceBrowserTabOpen, 'openWorkspaceBrowserTabForLink').mockImplementation( - (request) => { - const opening = open(request) - void opening.then(completed.resolve, completed.reject) - return opening - } - ) - return completed.promise -} - -it.each([ - 'unchanged', - 'workspace', - 'view', - 'host-return', - 'workspace-return', - 'view-return' -] as const)( - 'keeps a registered localhost tab but relinquishes foreground after navigation: %s', - async (navigation) => { - const { registration, register } = deferLocalhostRegistration() - const completed = observeBrowserLinkOpen() - openRoutedHttpLink('http://localhost:5180/', { - worktreeId: WORKSPACE, - sourceTabId: 'source', - forceDestination: 'orca' - }) - expect(register).toHaveBeenCalledOnce() - expect(useAppStore.getState().browserPagesByWorkspace).toEqual({}) - - if (navigation.startsWith('workspace')) { - useAppStore.getState().setActiveWorktree(OTHER_WORKSPACE, 'local') - if (navigation === 'workspace-return') { - useAppStore.getState().setActiveWorktree(WORKSPACE, 'local') - } - } else if (navigation.startsWith('view')) { - useAppStore.getState().setActiveView('skills') - if (navigation === 'view-return') { - useAppStore.getState().setActiveView('activity') - } - } else if (navigation === 'host-return') { - useAppStore.setState({ activeWorkspaceExecutionHostId: 'ssh:other' }) - useAppStore.setState({ activeWorkspaceExecutionHostId: 'local' }) - } - const selected = useAppStore.getState() - const labeledUrl = 'http://main.orca.localhost:60016/' - registration.resolve({ url: labeledUrl }) - const outcome = await completed - - expect(outcome).toMatchObject({ status: 'opened' }) - if (outcome.status !== 'opened') { - throw new Error('Expected the registered browser tab to be retained') - } - const state = useAppStore.getState() - expect(state.browserPagesByWorkspace[outcome.result.browserWorkspaceId]?.[0]?.url).toBe( - labeledUrl - ) - expect(state.browserTabsByWorktree[WORKSPACE]).toHaveLength(1) - expect(state.groupsByWorktree[WORKSPACE]?.find((group) => group.id === 'a')?.activeTabId).toBe( - 'source' - ) - expect(state.groupsByWorktree[WORKSPACE]?.find((group) => group.id === 'b')?.activeTabId).toBe( - navigation === 'unchanged' ? outcome.result.unifiedTabId : 'terminal-b' - ) - if (navigation === 'unchanged') { - expect(state.activeView).toBe('terminal') - expect(state.activeGroupIdByWorktree[WORKSPACE]).toBe(outcome.result.groupId) - expect(requestBrowserFocus).toHaveBeenCalledExactlyOnceWith({ - pageId: outcome.result.browserPageId, - target: 'webview' - }) - } else { - expect(state.activeWorktreeId).toBe(selected.activeWorktreeId) - expect(state.activeWorkspaceExecutionHostId).toBe(selected.activeWorkspaceExecutionHostId) - expect(state.activeView).toBe(selected.activeView) - expect(state.activeGroupIdByWorktree[WORKSPACE]).toBe( - selected.activeGroupIdByWorktree[WORKSPACE] - ) - expect( - state.groupsByWorktree[WORKSPACE]?.find((group) => group.id === 'b')?.activeTabId - ).toBe('terminal-b') - expect(requestBrowserFocus).not.toHaveBeenCalled() - } - } -) - -it('lets a newer link open normally while an older localhost registration completes', async () => { - const { registration, register } = deferLocalhostRegistration() - const completed = observeBrowserLinkOpen() - const options = { - worktreeId: WORKSPACE, - sourceTabId: 'source', - forceDestination: 'orca' as const - } - openRoutedHttpLink('http://localhost:5180/', options) - expect(register).toHaveBeenCalledOnce() - openRoutedHttpLink(URL_TO_OPEN, options) - const outcome = await completed - expect(outcome).toMatchObject({ status: 'opened' }) - registration.resolve({ url: 'http://main.orca.localhost:60016/' }) - await registration.promise - - const state = useAppStore.getState() - expect(state.browserTabsByWorktree[WORKSPACE]).toHaveLength(1) - expect( - Object.values(state.browserPagesByWorkspace) - .flat() - .map((page) => page.url) - ).toEqual([URL_TO_OPEN]) - expect(state.activeView).toBe('terminal') - expect(requestBrowserFocus).toHaveBeenCalledOnce() -}) - -it.each(['workspace', 'view'] as const)( - 'retains a legacy localhost tab in the background after navigating to another %s', - async (navigation) => { - const { registration, register } = deferLocalhostRegistration() - const completed = observeBrowserLinkOpen() - openHttpLink('http://localhost:5180/', { - worktreeId: WORKSPACE, - sourceOwner: { kind: 'local' } - }) - expect(register).toHaveBeenCalledOnce() - if (navigation === 'workspace') { - useAppStore.getState().setActiveWorktree(OTHER_WORKSPACE, 'local') - } else { - useAppStore.getState().setActiveView('skills') - } - const selected = useAppStore.getState() - const labeledUrl = 'http://main.orca.localhost:60016/' - registration.resolve({ url: labeledUrl }) - await completed - - const state = useAppStore.getState() - expect(state.browserTabsByWorktree[WORKSPACE]).toHaveLength(1) - expect( - Object.values(state.browserPagesByWorkspace) - .flat() - .map((page) => page.url) - ).toEqual([labeledUrl]) - expect(state.activeWorktreeId).toBe(selected.activeWorktreeId) - expect(state.activeView).toBe(selected.activeView) - expect(state.activeGroupIdByWorktree[WORKSPACE]).toBe( - selected.activeGroupIdByWorktree[WORKSPACE] - ) - expect(requestBrowserFocus).not.toHaveBeenCalled() - } -) - -it('keeps the Activity view and current pane selected for background source-aware HTTP links', async () => { - useAppStore.setState({ - settings: { - ...getDefaultSettings('/home/test'), - openLinksInApp: true, - openLinksInAppInBackground: true - } - }) - const opening = vi.spyOn(workspaceBrowserTabOpen, 'openWorkspaceBrowserTabForLink') - openHttpLink(URL_TO_OPEN, { - worktreeId: WORKSPACE, - sourceOwner: { kind: 'local' }, - linkContext: { linkIntent: captureLinkOpenIntent(useAppStore.getState(), WORKSPACE, 'source') } - }) - await vi.waitFor(() => expect(opening).toHaveBeenCalledOnce()) - expect(await opening.mock.results[0]!.value).toMatchObject({ status: 'opened' }) - expect(useAppStore.getState().activeView).toBe('activity') - expect(useAppStore.getState().activeWorktreeId).toBe(WORKSPACE) - expect(useAppStore.getState().activeGroupIdByWorktree[WORKSPACE]).toBe('c') - expect(requestBrowserFocus).not.toHaveBeenCalled() -}) - -it('keeps the main view and workspace selected when revealing a floating HTTP link', async () => { - const floating = FLOATING_TERMINAL_WORKTREE_ID - const state = useAppStore.getState() - useAppStore.setState({ - settings: { - ...getDefaultSettings('/home/test'), - openLinksInApp: true, - floatingTerminalEnabled: true - }, - floatingWorkspacePanelOpen: true, - groupsByWorktree: { - ...state.groupsByWorktree, - [floating]: state.groupsByWorktree[WORKSPACE]!.map((group) => ({ - ...group, - worktreeId: floating - })) - }, - unifiedTabsByWorktree: { - ...state.unifiedTabsByWorktree, - [floating]: state.unifiedTabsByWorktree[WORKSPACE]!.map((tab) => ({ - ...tab, - worktreeId: floating - })) - }, - layoutByWorktree: { ...state.layoutByWorktree, [floating]: state.layoutByWorktree[WORKSPACE]! } - }) - const opening = vi.spyOn(workspaceBrowserTabOpen, 'openWorkspaceBrowserTabForLink') - openHttpLink(URL_TO_OPEN, { - worktreeId: floating, - sourceOwner: { kind: 'local' }, - linkContext: { linkIntent: captureLinkOpenIntent(useAppStore.getState(), floating, 'source') } - }) - await vi.waitFor(() => expect(opening).toHaveBeenCalledOnce()) - expect(await opening.mock.results[0]!.value).toMatchObject({ status: 'opened' }) - expect(useAppStore.getState().activeView).toBe('activity') - expect(useAppStore.getState().activeWorktreeId).toBe(WORKSPACE) - expect(useAppStore.getState().activeGroupIdByWorktree[floating]).toBe('b') - expect(useAppStore.getState().groupsByWorktree[floating]).toHaveLength(3) -}) - it('reports where an opened link went', () => { const openUrl = vi.fn(async () => undefined) vi.stubGlobal('window', { ...window, api: { ...window.api, shell: { openUrl } } }) diff --git a/src/renderer/src/lib/browser/navigation/http-link-routing.ts b/src/renderer/src/lib/browser/navigation/http-link-routing.ts index 2d63dbea0ab..5ef5716696c 100644 --- a/src/renderer/src/lib/browser/navigation/http-link-routing.ts +++ b/src/renderer/src/lib/browser/navigation/http-link-routing.ts @@ -1,34 +1,35 @@ import { localhostLabelRouteForHttpLink, - openLabeledLocalhostLink, - type LocalhostLinkRepo, - type LocalhostLinkProject, - type LocalhostLinkWorktree + openLabeledLocalhostLink } from './http-link-localhost-route' -import type { WorkspacePortScanResult } from '../../../../../shared/workspace-ports' - -import type { LinkOpenIntent, LinkSourceState } from '../../link-open-intent' -import { captureLinkOpenIntent, canOpenLinkInSourceGroup } from '../../link-open-intent' -import type { AppState } from '@/store/types' +import type { + LocalhostLinkRepo, + LocalhostLinkProject, + LocalhostLinkWorktree +} from './http-link-localhost-route' +import { + captureLinkOpenIntent, + canOpenLinkInSourceGroup +} from '../../links/placement/link-open-intent' +import type { LinkOpenIntent, LinkSourceState } from '../../links/placement/link-open-intent' import { translate } from '@/i18n/i18n' import { isFloatingWorkspaceId } from '../../../../../shared/floating-workspace-worktree' -import type { GlobalSettings } from '../../../../../shared/global-settings-types' import { toast } from 'sonner' -import type { ExecutionHostId } from '../../../../../shared/execution-host' import { reselectWorkspaceKeepingHost } from '../../workspace/ownership/active-workspace-host' -import { - captureBrowserLinkReveal, - type BrowserLinkSelectionSubscriber -} from './browser-link-reveal' +import { captureBrowserLinkReveal } from './browser-link-reveal' +import type { BrowserLinkSelectionSubscriber } from './browser-link-reveal' import { isHttpLinkBackgroundOpen, openLocalHttpLinkTab, - prepareRemoteHttpLinkTab, - type HttpLinkBrowserTabState + prepareRemoteHttpLinkTab } from './http-link-browser-placement' - -import type { OpenHttpLinkOptions, WorkspaceHttpLinkBrowserOpener } from './http-link-destinations' +import type { HttpLinkBrowserTabState } from './http-link-browser-placement' import { resolveModifierRouting } from './http-link-modifier-routing' +import type { WorkspacePortScanResult } from '../../../../../shared/workspace-ports' +import type { AppState } from '@/store/types' +import type { GlobalSettings } from '../../../../../shared/global-settings-types' +import type { ExecutionHostId } from '../../../../../shared/execution-host' +import type { OpenHttpLinkOptions, WorkspaceHttpLinkBrowserOpener } from './http-link-destinations' function settleHttpLinkBrowserOpen( opening: Promise, diff --git a/src/renderer/src/lib/duplicate-browser-tab-options.ts b/src/renderer/src/lib/browser/workspace/duplicate-browser-tab-options.ts similarity index 81% rename from src/renderer/src/lib/duplicate-browser-tab-options.ts rename to src/renderer/src/lib/browser/workspace/duplicate-browser-tab-options.ts index b279b8d6aa2..a2014fcebfa 100644 --- a/src/renderer/src/lib/duplicate-browser-tab-options.ts +++ b/src/renderer/src/lib/browser/workspace/duplicate-browser-tab-options.ts @@ -1,4 +1,4 @@ -import type { BrowserWorkspace } from '../../../shared/browser-workspace-types' +import type { BrowserWorkspace } from '../../../../../shared/browser-workspace-types' export function buildDuplicatedBrowserTabOptions( source: Pick diff --git a/src/renderer/src/lib/browser/workspace/workspace-browser-link-open.ts b/src/renderer/src/lib/browser/workspace/workspace-browser-link-open.ts index 4582f7d0e76..858ee8df701 100644 --- a/src/renderer/src/lib/browser/workspace/workspace-browser-link-open.ts +++ b/src/renderer/src/lib/browser/workspace/workspace-browser-link-open.ts @@ -2,27 +2,29 @@ import { focusOpenedBrowserLink } from '../navigation/browser-link-focus' import { createBrowserLinkHostMatcher } from '../navigation/browser-link-owner' import { resolveBrowserLinkSession } from '../navigation/browser-link-session' import { useAppStore } from '@/store/index' -import type { AppState } from '@/store/types' -import type { TabSplitTarget } from '@/store/slices/tabs/tabs-slice-contract' -import type { ExecutionHostId } from '../../../../../shared/execution-host' import { toRuntimeExecutionHostId } from '../../../../../shared/execution-host' -import type { OpenWorkspaceBrowserTabRequest } from './workspace-browser-tab-open' +import type { ExecutionHostId } from '../../../../../shared/execution-host' import { openLocalBrowserLink, browserLinkCommitIsValid } from '../navigation/browser-link-open' import { selectBrowserLinkDestination, browserOpenResultForPage, - currentBrowserLinkMatch, - type BrowserLinkDestination, - type BrowserOpenOutcome + currentBrowserLinkMatch +} from '../navigation/browser-link-destination' +import type { + BrowserLinkDestination, + BrowserOpenOutcome } from '../navigation/browser-link-destination' import { activateBrowserWorkspaceTab } from './browser-workspace-tab-activation' import { getFloatingWorkspaceOperationRoute, resolveWorktreeOperationRoute } from '../../workspace/ownership/worktree-operation-route' -import { getWorkspaceClientCreationActionPolicy } from '../../client-creation-action-policy' +import { getWorkspaceClientCreationActionPolicy } from '../../workspace/creation/surface-policy/client-creation-action-policy' import { selectWorkspaceSurface } from '../../workspace/activation/workspace-surface-reveal' import { showWorkspaceTabs } from '../navigation/http-link-browser-placement' +import type { AppState } from '@/store/types' +import type { TabSplitTarget } from '@/store/slices/tabs/tabs-slice-contract' +import type { OpenWorkspaceBrowserTabRequest } from './workspace-browser-tab-open' function ownsBrowserRoute( state: AppState, diff --git a/src/renderer/src/lib/browser/workspace/workspace-browser-route-eligibility.ts b/src/renderer/src/lib/browser/workspace/workspace-browser-route-eligibility.ts index ff73704d4e4..756a3aece0a 100644 --- a/src/renderer/src/lib/browser/workspace/workspace-browser-route-eligibility.ts +++ b/src/renderer/src/lib/browser/workspace/workspace-browser-route-eligibility.ts @@ -1,16 +1,16 @@ -import type { AppState } from '@/store/types' import { parseExecutionHostId } from '../../../../../shared/execution-host' import { FLOATING_TERMINAL_WORKTREE_ID } from '../../../../../shared/constants' import '../../../../../shared/protocol-version' import { BROWSER_SCREENCAST_RUNTIME_CAPABILITY } from '../../../../../shared/browser/runtime/browser-runtime-capabilities' import { getWorkspaceClientCreationActionPolicy, - runtimeHostsPagesOnThisDesktop, - type ClientCreationActionAvailability -} from '../../client-creation-action-policy' + runtimeHostsPagesOnThisDesktop +} from '../../workspace/creation/surface-policy/client-creation-action-policy' +import type { ClientCreationActionAvailability } from '../../workspace/creation/surface-policy/client-creation-action-policy' import { resolveWorktreeOperationRoute } from '../../workspace/ownership/worktree-operation-route' import { getExecutionHostIdForWorktree } from '../../workspace/ownership/worktree-runtime-owner' import { resolveSshWorkspaceBrowserRouteEligibility } from './ssh-workspace-browser-route-eligibility' +import type { AppState } from '@/store/types' export function isExpectedRuntimeBrowserRoute( state: AppState, diff --git a/src/renderer/src/lib/browser/workspace/workspace-browser-tab-open.ts b/src/renderer/src/lib/browser/workspace/workspace-browser-tab-open.ts index 8ce6f88565a..437acac77ff 100644 --- a/src/renderer/src/lib/browser/workspace/workspace-browser-tab-open.ts +++ b/src/renderer/src/lib/browser/workspace/workspace-browser-tab-open.ts @@ -1,14 +1,9 @@ import { createBrowserLinkHostMatcher } from '../navigation/browser-link-owner' - import { isExpectedRuntimeBrowserRoute, isSshDeploymentClientBrowserRoute, isExpectedSshBrowserRoute } from './workspace-browser-route-eligibility' -import type { - BrowserLinkOpenContext, - BrowserOpenOutcome -} from '../navigation/browser-link-destination' import { workspaceBrowserLinkDestination, openClientWorkspaceBrowserLink, @@ -18,20 +13,11 @@ import { import { createWebRuntimeSessionBrowserTab } from '@/runtime/browser/creation/web-runtime-browser-creation' import { resolveWebRuntimeBrowserClientTargetGroup } from '@/runtime/browser/creation/web-runtime-browser-client-target-group' import { useAppStore } from '@/store/index' -import type { AppState } from '@/store/types' import { resolveNewBrowserTabProfile } from '@/store/slices/browser/profiles/browser-new-tab-profile' -import { - LOCAL_EXECUTION_HOST_ID, - parseExecutionHostId, - type ExecutionHostId -} from '../../../../../shared/execution-host' -import type { SearchEngine } from '../../../../../shared/browser-url' -import type { BrowserClientHostPlacementPreference } from '../../../../../shared/browser/client-hosting/browser-client-host-placement' -import type { TabSplitTarget } from '@/store/slices/tabs/tabs-slice-contract' -import { - getClientCreationActionPolicy, - type ClientCreationActionAvailability -} from '../../client-creation-action-policy' +import { LOCAL_EXECUTION_HOST_ID, parseExecutionHostId } from '../../../../../shared/execution-host' +import type { ExecutionHostId } from '../../../../../shared/execution-host' +import { getClientCreationActionPolicy } from '../../workspace/creation/surface-policy/client-creation-action-policy' +import type { ClientCreationActionAvailability } from '../../workspace/creation/surface-policy/client-creation-action-policy' import { getFloatingWorkspaceOperationRoute, resolveWorktreeOperationRoute @@ -41,6 +27,14 @@ import { openFailure, validateTarget } from './workspace-browser-tab-presentation' +import type { + BrowserLinkOpenContext, + BrowserOpenOutcome +} from '../navigation/browser-link-destination' +import type { AppState } from '@/store/types' +import type { SearchEngine } from '../../../../../shared/browser-url' +import type { BrowserClientHostPlacementPreference } from '../../../../../shared/browser/client-hosting/browser-client-host-placement' +import type { TabSplitTarget } from '@/store/slices/tabs/tabs-slice-contract' export type WorkspaceBrowserTabIntent = { kind: 'url' } | { kind: 'search'; engine: SearchEngine } diff --git a/src/renderer/src/lib/editor/file-operations/editor-file-operation-provenance.ts b/src/renderer/src/lib/editor/file-operations/editor-file-operation-provenance.ts index a9ef6e018ad..47607bd0b99 100644 --- a/src/renderer/src/lib/editor/file-operations/editor-file-operation-provenance.ts +++ b/src/renderer/src/lib/editor/file-operations/editor-file-operation-provenance.ts @@ -1,23 +1,24 @@ -import { parseExecutionHostId, type ExecutionHostId } from '../../../../../shared/execution-host' +import { parseExecutionHostId } from '../../../../../shared/execution-host' +import type { ExecutionHostId } from '../../../../../shared/execution-host' import { FLOATING_TERMINAL_WORKTREE_ID } from '../../../../../shared/constants' import { parseWorkspaceKey } from '../../../../../shared/workspace-scope' -import type { AppState } from '@/store/types' -import type { HostAuthority } from '../../../../../shared/host-authority' import { findFolderWorkspaceOwner } from '../../workspace/ownership/folder-workspace-runtime-owner' import { resolveOwner } from '../../workspace/ownership/resolve-owner' -import { captureDirectSshMutationExpectation } from '../../ssh-mutation-expectation' +import { captureDirectSshMutationExpectation } from '../../../runtime/hosts/ssh/ssh-mutation-expectation' import { assertWorktreeOperationGenerationSnapshotCurrent, - captureWorktreeOperationGenerationSnapshot, - type WorktreeOperationGenerationSnapshot + captureWorktreeOperationGenerationSnapshot } from '../../workspace/ownership/worktree-operation-generation' +import type { WorktreeOperationGenerationSnapshot } from '../../workspace/ownership/worktree-operation-generation' import { getFloatingWorkspaceOperationRoute, resolveWorktreeOperationRoute, - resolveWorktreeOperationRouteResultForHost, - type WorktreeOperationRoute, - type WorktreeOperationRouteResolution, - type WorktreeOperationRouteState + resolveWorktreeOperationRouteResultForHost +} from '../../workspace/ownership/worktree-operation-route' +import type { + WorktreeOperationRoute, + WorktreeOperationRouteResolution, + WorktreeOperationRouteState } from '../../workspace/ownership/worktree-operation-route' import { resolveExplicitWorktreeOperationRouteResult } from '../../workspace/ownership/worktree-operation-catalog-route' import { resolveQualifiedIndexedFolderWorkspace } from '@/store/folder-workspaces/folder-workspace-record-index' @@ -26,6 +27,8 @@ import { selectDetectedWorktreesByRepo, selectWorktreesByRepo } from '@/store/workspaces/catalog/workspace-record-fields' +import type { AppState } from '@/store/types' +import type { HostAuthority } from '../../../../../shared/host-authority' export type EditorFileOperationProvenance = { generation: WorktreeOperationGenerationSnapshot diff --git a/src/renderer/src/lib/host-mirror-handle-gap-drain.test.ts b/src/renderer/src/lib/host-mirror-handle-gap-drain.test.ts deleted file mode 100644 index 826fc13becb..00000000000 --- a/src/renderer/src/lib/host-mirror-handle-gap-drain.test.ts +++ /dev/null @@ -1,167 +0,0 @@ -import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' -import { useAppStore } from '@/store' -import { clearRuntimeEnvironmentConnectionGenerations as clearRuntimeEnvironmentConnectionGenerationsForTests } from '@/store/slices/runtime-status/runtime-status-connection-generation' -import { - HOST_MIRROR_HANDLE_GAP_DEADLINE_MS, - countParkedHostMirrorHandleGapPanesForTests, - hasHostMirrorHandleWaitExpired, - parkUntilHostMirrorHandleLands, - resetHostMirrorHandleGapWaitsForTests -} from './host-mirror-handle-gap-wait' -import { makeTerminalTab } from '../store/terminals/terminal-row.test-fixture' - -// Cover store-drain and deadline replays directly: one pane’s throw must not escape to mirror apply, sibling waiters or later subscribers; re-entry must not replay or release stale snapshots. - -const ENVIRONMENT_ID = 'env-handle-gap-drain' -const WORKTREE_ID = 'repo-1::/workspace/repo' -const FIRST_TAB_ID = 'web-terminal-host-tab-1' -const SECOND_TAB_ID = 'web-terminal-host-tab-2' - -const initialAppStoreState = useAppStore.getState() - -function seedRows(): void { - // Seed the PTY binding held at park time: production cannot park an unbound pane, whose verdict refuses to answer. - useAppStore.setState({ - ptyIdsByTabId: {}, - tabsByWorktree: { - [WORKTREE_ID]: [ - makeTerminalTab({ id: FIRST_TAB_ID, worktreeId: WORKTREE_ID, title: 'one' }), - makeTerminalTab({ id: SECOND_TAB_ID, worktreeId: WORKTREE_ID, title: 'two' }) - ] - }, - terminalLayoutsByTabId: { - [FIRST_TAB_ID]: { - root: { type: 'leaf', leafId: 'leaf-1' }, - activeLeafId: 'leaf-1', - expandedLeafId: null, - ptyIdsByLeafId: { 'leaf-1': `remote:${ENVIRONMENT_ID}@@term_1` } - }, - [SECOND_TAB_ID]: { - root: { type: 'leaf', leafId: 'leaf-2' }, - activeLeafId: 'leaf-2', - expandedLeafId: null, - ptyIdsByLeafId: { 'leaf-2': `remote:${ENVIRONMENT_ID}@@term_2` } - } - } - }) -} - -/** The host publishes both panes' PTY handles on one frame: both waiters come due together. */ -function publishBothHandles(): void { - useAppStore.setState({ - ptyIdsByTabId: { - [FIRST_TAB_ID]: [`remote:${ENVIRONMENT_ID}@@term_1`], - [SECOND_TAB_ID]: [`remote:${ENVIRONMENT_ID}@@term_2`] - } - }) -} - -describe('host-mirror handle-gap drain', () => { - beforeEach(() => { - vi.useFakeTimers() - // Replay throws are intentional; silence the warning while testing their isolation. - vi.spyOn(console, 'warn').mockImplementation(() => {}) - resetHostMirrorHandleGapWaitsForTests() - clearRuntimeEnvironmentConnectionGenerationsForTests() - seedRows() - }) - - afterEach(() => { - vi.restoreAllMocks() - resetHostMirrorHandleGapWaitsForTests() - clearRuntimeEnvironmentConnectionGenerationsForTests() - useAppStore.setState(initialAppStoreState, true) - vi.useRealTimers() - }) - - // Zustand notifies synchronously; an unguarded replay throw would abort mirror setState, sibling replays and later subscribers. - it('does not let one pane’s replay throw reach the store write, its siblings, or later listeners', () => { - const siblingReplay = vi.fn() - parkUntilHostMirrorHandleLands(ENVIRONMENT_ID, WORKTREE_ID, FIRST_TAB_ID, () => { - throw new Error('replay blew up') - }) - parkUntilHostMirrorHandleLands(ENVIRONMENT_ID, WORKTREE_ID, SECOND_TAB_ID, siblingReplay) - expect(countParkedHostMirrorHandleGapPanesForTests()).toBe(2) - - // Registered after this module's subscription, so it is notified after the drain. - const laterListener = vi.fn() - const unsubscribe = useAppStore.subscribe(laterListener) - - expect(() => publishBothHandles()).not.toThrow() - unsubscribe() - - expect(siblingReplay).toHaveBeenCalledTimes(1) - expect(laterListener).toHaveBeenCalledTimes(1) - expect(countParkedHostMirrorHandleGapPanesForTests()).toBe(0) - // Both deadlines are cancelled, so neither pane can record an expiry it did not earn. - expect(vi.getTimerCount()).toBe(0) - vi.advanceTimersByTime(HOST_MIRROR_HANDLE_GAP_DEADLINE_MS * 2) - expect(hasHostMirrorHandleWaitExpired(ENVIRONMENT_ID, FIRST_TAB_ID)).toBe(false) - expect(hasHostMirrorHandleWaitExpired(ENVIRONMENT_ID, SECOND_TAB_ID)).toBe(false) - }) - - // A createTab replay re-enters the drain synchronously; one frame must release each pane at most once even if it re-parks. - it('replays a pane once per store write even when an earlier replay re-enters the drain', () => { - const siblingReplay = vi.fn(() => { - // What the real replay does when the sweep still finds the pane undecided. - parkUntilHostMirrorHandleLands(ENVIRONMENT_ID, WORKTREE_ID, SECOND_TAB_ID, siblingReplay) - }) - parkUntilHostMirrorHandleLands(ENVIRONMENT_ID, WORKTREE_ID, FIRST_TAB_ID, () => { - // Re-enter through subscribed tab/PTY slices; clearSleepingAgentSession alone would be filtered out. - useAppStore.setState({ tabsByWorktree: { ...useAppStore.getState().tabsByWorktree } }) - }) - parkUntilHostMirrorHandleLands(ENVIRONMENT_ID, WORKTREE_ID, SECOND_TAB_ID, siblingReplay) - - publishBothHandles() - - expect(siblingReplay).toHaveBeenCalledTimes(1) - expect(countParkedHostMirrorHandleGapPanesForTests()).toBe(1) - expect(vi.getTimerCount()).toBe(1) - }) - - // Orphan adoption can mutate a still-parked waiter’s workspace in place during another replay; identity checks alone cannot detect its obsolete retraction verdict. - it('does not release on retraction evidence a mid-drain adoption has already made stale', () => { - const adoptedReplay = vi.fn() - const ADOPTING_WORKTREE_ID = 'repo-1::/workspace/adopted' - useAppStore.setState({ - tabsByWorktree: { - [ADOPTING_WORKTREE_ID]: [ - makeTerminalTab({ id: FIRST_TAB_ID, worktreeId: ADOPTING_WORKTREE_ID, title: 'one' }), - makeTerminalTab({ id: SECOND_TAB_ID, worktreeId: ADOPTING_WORKTREE_ID, title: 'two' }) - ] - } - }) - // Map order makes adoption invalidate the next waiter’s snapshot before release; reversing order must fail the case. - parkUntilHostMirrorHandleLands(ENVIRONMENT_ID, ADOPTING_WORKTREE_ID, FIRST_TAB_ID, () => { - // The adopting workspace re-parks its newly owned pane without any launch/store write. - parkUntilHostMirrorHandleLands( - ENVIRONMENT_ID, - ADOPTING_WORKTREE_ID, - SECOND_TAB_ID, - adoptedReplay - ) - }) - parkUntilHostMirrorHandleLands(ENVIRONMENT_ID, WORKTREE_ID, SECOND_TAB_ID, adoptedReplay) - - // The absent second tab reads as retracted; adoption above invalidates that snapshot before release. - useAppStore.setState({ - ptyIdsByTabId: { [FIRST_TAB_ID]: [`remote:${ENVIRONMENT_ID}@@term_1`] } - }) - - expect(adoptedReplay).not.toHaveBeenCalled() - expect(countParkedHostMirrorHandleGapPanesForTests()).toBe(1) - }) - - // Deadline replay throws must stay isolated but retain expiry evidence, or every failure would get a fresh wait forever. - it('records the expiry of a pane whose replay throws and still frees the pane', () => { - parkUntilHostMirrorHandleLands(ENVIRONMENT_ID, WORKTREE_ID, FIRST_TAB_ID, () => { - throw new Error('replay blew up') - }) - - expect(() => vi.advanceTimersByTime(HOST_MIRROR_HANDLE_GAP_DEADLINE_MS)).not.toThrow() - - expect(hasHostMirrorHandleWaitExpired(ENVIRONMENT_ID, FIRST_TAB_ID)).toBe(true) - expect(countParkedHostMirrorHandleGapPanesForTests()).toBe(0) - expect(vi.getTimerCount()).toBe(0) - }) -}) diff --git a/src/renderer/src/lib/host-mirror-handle-gap-resume.test.ts b/src/renderer/src/lib/host-mirror-handle-gap-resume.test.ts deleted file mode 100644 index e1a93a90a01..00000000000 --- a/src/renderer/src/lib/host-mirror-handle-gap-resume.test.ts +++ /dev/null @@ -1,568 +0,0 @@ -import path from 'node:path' -import { applyWebSessionTabsSnapshot } from '@/runtime/web-session-tabs-sync/snapshot-api' -import { - makeSnapshot, - resetWebSessionTabsSyncTestState -} from '@/runtime/web-session-tabs-sync/testing/web-session-tabs-sync.test-fixture' -import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' -import { useAppStore } from '@/store' -import type { AppState } from '@/store/types' -import { resumeSleepingAgentSessionsForWorktree } from './agent-session/resume/resume-sleeping-agent-session' -import { makeCreatedAgentWorktree } from '@/lib/workspace/activation/worktree-activation-created-agent.test-fixture' -import { makePaneKey } from '../../../shared/workspace-layout/stable-pane-id' -import { - markHostSessionMirrorHydrated, - resetHostSessionMirrorHydrationForTests -} from '@/runtime/web-session-tabs-sync/hydration/host-session-mirror-hydration' -import { - clearRuntimeEnvironmentConnectionGenerations as clearRuntimeEnvironmentConnectionGenerationsForTests, - setRuntimeEnvironmentConnectionGenerationForTests -} from '@/store/slices/runtime-status/runtime-status-connection-generation' -import type { RuntimeEnvironmentStatus } from '../../../shared/remote-runtime/host-status/runtime-host-status' -import { - HOST_MIRROR_HANDLE_GAP_DEADLINE_MS, - countParkedHostMirrorHandleGapPanesForTests, - hasHostMirrorHandleWaitExpired, - resetHostMirrorHandleGapWaitsForTests -} from './host-mirror-handle-gap-wait' -import { makeTerminalTab } from '../store/terminals/terminal-row.test-fixture' - -// Published rows without handles are unverifiable, never exited (ssh-execution-boundary.md). Assert the ORIGINAL deadline: accidental release/re-park looks identical but silently restarts its budget. - -const initialAppStoreState = useAppStore.getState() - -const LEAF_ID = '22222222-2222-4222-8222-222222222222' -const WEB_TAB_ID = 'web-terminal-host-tab-1' -const SECOND_LEAF_ID = '33333333-3333-4333-8333-333333333333' -const SIBLING_LEAF_ID = '44444444-4444-4444-8444-444444444444' -const SECOND_TAB_ID = 'web-terminal-host-tab-2' -const RUNTIME_ENV_ID = 'env-handle-gap' - -function makeRuntimeOwnedWorktree(): ReturnType { - return { - ...makeCreatedAgentWorktree(), - createdWithAgent: undefined, - hostId: `runtime:${encodeURIComponent(RUNTIME_ENV_ID)}` - } -} - -function seedMirroredWorkspace(worktree: ReturnType): void { - const state: Partial = { - repos: [ - { - id: 'repo-1', - path: path.join(path.sep, 'workspace', 'repo'), - displayName: 'repo', - badgeColor: '#000000', - addedAt: 0 - } - ], - worktreesByRepo: { 'repo-1': [worktree] }, - activeRepoId: 'repo-1', - activeWorktreeId: worktree.id, - activeView: 'terminal', - tabsByWorktree: { - [worktree.id]: [makeTerminalTab({ id: WEB_TAB_ID, worktreeId: worktree.id, title: 'Claude' })] - }, - terminalLayoutsByTabId: { - [WEB_TAB_ID]: { - root: { type: 'leaf', leafId: LEAF_ID }, - activeLeafId: LEAF_ID, - expandedLeafId: null, - ptyIdsByLeafId: { [LEAF_ID]: 'remote:env-handle-gap@@term_1' } - } - }, - // The gap itself: the row is published, its handle has not arrived. - ptyIdsByTabId: {}, - sleepingAgentSessionsByPaneKey: {}, - pendingStartupByTabId: {}, - automaticAgentResumeClaimsByTabId: {}, - agentStatusByPaneKey: {} - } - useAppStore.setState(state) -} - -/** A cold split mirror whose sibling is ready before this leaf has ever held a binding. */ -function seedSplitTabWithOnlySiblingReady( - worktree: ReturnType -): void { - seedMirroredWorkspace(worktree) - useAppStore.setState({ - terminalLayoutsByTabId: { - [WEB_TAB_ID]: { - root: { - type: 'split', - direction: 'vertical', - first: { type: 'leaf', leafId: LEAF_ID }, - second: { type: 'leaf', leafId: SIBLING_LEAF_ID } - }, - activeLeafId: SIBLING_LEAF_ID, - expandedLeafId: null, - // Only the ready sibling is bound; the record's leaf has never held a handle. - ptyIdsByLeafId: { [SIBLING_LEAF_ID]: 'remote:env-handle-gap@@term_sibling' } - } - }, - ptyIdsByTabId: { [WEB_TAB_ID]: ['remote:env-handle-gap@@term_sibling'] } - }) -} - -/** A second published mirrored row in the same environment, with its own leaf binding. */ -function seedSecondMirroredPane(worktreeId: string): void { - const before = useAppStore.getState() - useAppStore.setState({ - tabsByWorktree: { - [worktreeId]: [ - ...(before.tabsByWorktree[worktreeId] ?? []), - makeTerminalTab({ id: SECOND_TAB_ID, worktreeId, title: 'Claude 2' }) - ] - }, - terminalLayoutsByTabId: { - ...before.terminalLayoutsByTabId, - [SECOND_TAB_ID]: { - root: { type: 'leaf', leafId: SECOND_LEAF_ID }, - activeLeafId: SECOND_LEAF_ID, - expandedLeafId: null, - ptyIdsByLeafId: { [SECOND_LEAF_ID]: 'remote:env-handle-gap@@term_2' } - } - } - }) -} - -/** The capture the reported flow produces: recorded mid-turn, so it is active work, not history. */ -function seedActiveSleepingRecordFor( - worktreeId: string, - tabId: string, - leafId: string, - sessionId: string -): string { - const paneKey = makePaneKey(tabId, leafId) - useAppStore.setState({ - sleepingAgentSessionsByPaneKey: { - ...useAppStore.getState().sleepingAgentSessionsByPaneKey, - [paneKey]: { - paneKey, - tabId, - worktreeId, - agent: 'claude', - providerSession: { key: 'session_id', id: sessionId }, - connectionId: null, - prompt: '', - state: 'working', - capturedAt: 1000, - updatedAt: 1000, - terminalTitle: 'Claude', - origin: 'live' - } - } - }) - return paneKey -} - -function seedActiveSleepingRecord(worktreeId: string): string { - return seedActiveSleepingRecordFor(worktreeId, WEB_TAB_ID, LEAF_ID, 'handle-gap-session') -} - -function setRuntimeEnvironmentStatusEntryForTests( - environmentId: string, - entry: RuntimeEnvironmentStatus -): void { - useAppStore.setState({ - runtimeStatusByEnvironmentId: new Map(useAppStore.getState().runtimeStatusByEnvironmentId).set( - environmentId, - entry - ) - }) -} - -function setRuntimeEnvironmentDisconnectedForTests(environmentId: string): void { - setRuntimeEnvironmentStatusEntryForTests(environmentId, { status: null, checkedAt: 0 }) -} - -function setRuntimeEnvironmentTransportDownForTests(environmentId: string): void { - setRuntimeEnvironmentStatusEntryForTests(environmentId, { - status: null, - checkedAt: 1, - snapshot: { - environmentId, - pairingRevision: 1, - sequence: 2, - checkedAt: 1, - status: null, - verification: 'unavailable', - transport: 'disconnected' - } - }) -} - -// Same-runtime contact recovery changes hostContactEpoch without changing connection generation (#19647). -function setRuntimeEnvironmentReconnectedForTests(environmentId: string): void { - setRuntimeEnvironmentStatusEntryForTests(environmentId, { - status: { - runtimeId: 'rt-1', - rendererGraphEpoch: 0, - graphStatus: 'ready', - authoritativeWindowId: null, - liveTabCount: 0, - liveLeafCount: 0, - runtimeProtocolVersion: 3, - minCompatibleRuntimeClientVersion: 3 - }, - checkedAt: 2, - hostContactEpoch: 1 - }) -} - -function clearRuntimeEnvironmentStatusEntryForTests(environmentId: string): void { - const next = new Map(useAppStore.getState().runtimeStatusByEnvironmentId) - next.delete(environmentId) - useAppStore.setState({ runtimeStatusByEnvironmentId: next }) -} - -describe('resume across the mirror handle gap', () => { - beforeEach(() => { - vi.useFakeTimers() - useAppStore.setState(initialAppStoreState, true) - resetHostSessionMirrorHydrationForTests() - resetHostMirrorHandleGapWaitsForTests() - clearRuntimeEnvironmentConnectionGenerationsForTests() - }) - - afterEach(() => { - // Cancel waits before store reset retracts rows and synchronously replays them. - resetHostMirrorHandleGapWaitsForTests() - useAppStore.setState(initialAppStoreState, true) - resetHostSessionMirrorHydrationForTests() - clearRuntimeEnvironmentConnectionGenerationsForTests() - vi.useRealTimers() - }) - - it('does not resume a published mirrored pane whose handle has not landed yet', () => { - const worktree = makeRuntimeOwnedWorktree() - seedMirroredWorkspace(worktree) - const paneKey = seedActiveSleepingRecord(worktree.id) - markHostSessionMirrorHydrated(RUNTIME_ENV_ID) - - const launched = resumeSleepingAgentSessionsForWorktree(worktree.id) - - const after = useAppStore.getState() - expect(launched).toBe(0) - expect(after.tabsByWorktree[worktree.id]).toHaveLength(1) - expect(Object.keys(after.pendingStartupByTabId)).toHaveLength(0) - expect(after.sleepingAgentSessionsByPaneKey[paneKey]).toBeDefined() - expect(countParkedHostMirrorHandleGapPanesForTests()).toBe(1) - }) - - it('holds a slept binding retained through a pending snapshot without replacing it', () => { - resetWebSessionTabsSyncTestState() - const worktree = makeRuntimeOwnedWorktree() - seedMirroredWorkspace(worktree) - const paneKey = seedActiveSleepingRecord(worktree.id) - markHostSessionMirrorHydrated(RUNTIME_ENV_ID) - const snapshot = makeSnapshot( - [ - { - type: 'terminal', - id: `host-tab-1::${LEAF_ID}`, - title: 'Claude', - parentTabId: 'host-tab-1', - leafId: LEAF_ID, - isActive: true, - status: 'pending-handle', - terminal: null - } - ], - { worktree: worktree.id } - ) - useAppStore.setState( - applyWebSessionTabsSnapshot(useAppStore.getState(), snapshot, RUNTIME_ENV_ID, Date.now()) - ) - - expect( - useAppStore.getState().terminalLayoutsByTabId[WEB_TAB_ID]?.ptyIdsByLeafId?.[LEAF_ID] - ).toBe('remote:env-handle-gap@@term_1') - expect(useAppStore.getState().ptyIdsByTabId[WEB_TAB_ID] ?? []).toEqual([]) - expect(resumeSleepingAgentSessionsForWorktree(worktree.id)).toBe(0) - expect(countParkedHostMirrorHandleGapPanesForTests()).toBe(1) - vi.advanceTimersByTime(HOST_MIRROR_HANDLE_GAP_DEADLINE_MS - 1) - expect(useAppStore.getState().sleepingAgentSessionsByPaneKey[paneKey]).toBeDefined() - expect(Object.keys(useAppStore.getState().automaticAgentResumeClaimsByTabId)).toHaveLength(0) - vi.advanceTimersByTime(1) - // The deadline ends the wait, but an unverifiable binding never authorizes a replacement. - expect(useAppStore.getState().sleepingAgentSessionsByPaneKey[paneKey]).toBeDefined() - expect(Object.keys(useAppStore.getState().automaticAgentResumeClaimsByTabId)).toHaveLength(0) - resetWebSessionTabsSyncTestState() - }) - - it('does not resume a published host row without a PTY binding', () => { - const worktree = makeRuntimeOwnedWorktree() - seedMirroredWorkspace(worktree) - seedActiveSleepingRecord(worktree.id) - useAppStore.setState({ - terminalLayoutsByTabId: { - [WEB_TAB_ID]: { - root: { type: 'leaf', leafId: LEAF_ID }, - activeLeafId: LEAF_ID, - expandedLeafId: null, - ptyIdsByLeafId: {} - } - } - }) - markHostSessionMirrorHydrated(RUNTIME_ENV_ID) - - expect(resumeSleepingAgentSessionsForWorktree(worktree.id)).toBe(0) - expect(countParkedHostMirrorHandleGapPanesForTests()).toBe(0) - }) - - // Every release path must replay the sweep; a bounded wait with no replay strands recovery. - - it("releases when the pane's own handle lands and keeps the pane it now owns", () => { - const worktree = makeRuntimeOwnedWorktree() - seedMirroredWorkspace(worktree) - const paneKey = seedActiveSleepingRecord(worktree.id) - markHostSessionMirrorHydrated(RUNTIME_ENV_ID) - expect(resumeSleepingAgentSessionsForWorktree(worktree.id)).toBe(0) - - useAppStore.setState({ ptyIdsByTabId: { [WEB_TAB_ID]: ['remote:env-handle-gap@@term_1'] } }) - expect(countParkedHostMirrorHandleGapPanesForTests()).toBe(0) - vi.advanceTimersByTime(HOST_MIRROR_HANDLE_GAP_DEADLINE_MS) - - const after = useAppStore.getState() - expect(after.tabsByWorktree[worktree.id]).toHaveLength(1) - expect(Object.keys(after.automaticAgentResumeClaimsByTabId)).toHaveLength(0) - expect(after.sleepingAgentSessionsByPaneKey[paneKey]).toBeDefined() - }) - - it('does not resume a pending leaf merely because its sibling holds a handle', () => { - const worktree = makeRuntimeOwnedWorktree() - seedSplitTabWithOnlySiblingReady(worktree) - const paneKey = seedActiveSleepingRecord(worktree.id) - markHostSessionMirrorHydrated(RUNTIME_ENV_ID) - - expect(resumeSleepingAgentSessionsForWorktree(worktree.id)).toBe(0) - // A sibling handle does not authorize a second writer for this leaf. - expect(countParkedHostMirrorHandleGapPanesForTests()).toBe(0) - - const after = useAppStore.getState() - const resumeTabIds = (after.tabsByWorktree[worktree.id] ?? []) - .map((tab) => tab.id) - .filter((id) => id !== WEB_TAB_ID) - expect(resumeTabIds).toHaveLength(0) - expect(Object.keys(after.automaticAgentResumeClaimsByTabId)).toHaveLength(0) - expect(after.sleepingAgentSessionsByPaneKey[paneKey]).toBeDefined() - }) - - it.each([true, false])('does not resume a retracted host row (parked=%s)', (parked) => { - const worktree = makeRuntimeOwnedWorktree() - seedMirroredWorkspace(worktree) - const paneKey = seedActiveSleepingRecord(worktree.id) - markHostSessionMirrorHydrated(RUNTIME_ENV_ID) - if (parked) { - expect(resumeSleepingAgentSessionsForWorktree(worktree.id)).toBe(0) - } - - useAppStore.setState({ tabsByWorktree: { [worktree.id]: [] } }) - expect(resumeSleepingAgentSessionsForWorktree(worktree.id)).toBe(0) - vi.advanceTimersByTime(HOST_MIRROR_HANDLE_GAP_DEADLINE_MS * 2) - - const after = useAppStore.getState() - expect(after.tabsByWorktree[worktree.id]).toEqual([]) - expect(Object.keys(after.automaticAgentResumeClaimsByTabId)).toHaveLength(0) - expect(after.sleepingAgentSessionsByPaneKey[paneKey]).toBeDefined() - expect(countParkedHostMirrorHandleGapPanesForTests()).toBe(0) - expect(vi.getTimerCount()).toBe(0) - }) - - it('releases the handle wait at its deadline without authorizing a resume', () => { - const worktree = makeRuntimeOwnedWorktree() - seedMirroredWorkspace(worktree) - const paneKey = seedActiveSleepingRecord(worktree.id) - markHostSessionMirrorHydrated(RUNTIME_ENV_ID) - expect(resumeSleepingAgentSessionsForWorktree(worktree.id)).toBe(0) - - vi.advanceTimersByTime(HOST_MIRROR_HANDLE_GAP_DEADLINE_MS - 1) - expect(useAppStore.getState().sleepingAgentSessionsByPaneKey[paneKey]).toBeDefined() - vi.advanceTimersByTime(1) - - const after = useAppStore.getState() - const resumeTabIds = (after.tabsByWorktree[worktree.id] ?? []) - .map((tab) => tab.id) - .filter((id) => id !== WEB_TAB_ID) - expect(resumeTabIds).toHaveLength(0) - expect(Object.keys(after.automaticAgentResumeClaimsByTabId)).toHaveLength(0) - expect(after.sleepingAgentSessionsByPaneKey[paneKey]).toBeDefined() - expect(hasHostMirrorHandleWaitExpired(RUNTIME_ENV_ID, WEB_TAB_ID)).toBe(true) - expect(countParkedHostMirrorHandleGapPanesForTests()).toBe(0) - }) - - it('keeps the original deadline when a second sweep re-parks the same pane', () => { - const worktree = makeRuntimeOwnedWorktree() - seedMirroredWorkspace(worktree) - const paneKey = seedActiveSleepingRecord(worktree.id) - markHostSessionMirrorHydrated(RUNTIME_ENV_ID) - expect(resumeSleepingAgentSessionsForWorktree(worktree.id)).toBe(0) - - vi.advanceTimersByTime(HOST_MIRROR_HANDLE_GAP_DEADLINE_MS / 2) - expect(resumeSleepingAgentSessionsForWorktree(worktree.id)).toBe(0) - expect(countParkedHostMirrorHandleGapPanesForTests()).toBe(1) - vi.advanceTimersByTime(HOST_MIRROR_HANDLE_GAP_DEADLINE_MS / 2) - - expect(hasHostMirrorHandleWaitExpired(RUNTIME_ENV_ID, WEB_TAB_ID)).toBe(true) - expect(useAppStore.getState().sleepingAgentSessionsByPaneKey[paneKey]).toBeDefined() - expect(Object.keys(useAppStore.getState().automaticAgentResumeClaimsByTabId)).toHaveLength(0) - }) - - // Reconnect during an armed wait must invalidate its pending deadline, independently of already-recorded verdicts. - it('does not let a wait armed on the previous connection decide the new one', () => { - const worktree = makeRuntimeOwnedWorktree() - seedMirroredWorkspace(worktree) - const paneKey = seedActiveSleepingRecord(worktree.id) - markHostSessionMirrorHydrated(RUNTIME_ENV_ID) - expect(resumeSleepingAgentSessionsForWorktree(worktree.id)).toBe(0) - - vi.advanceTimersByTime(HOST_MIRROR_HANDLE_GAP_DEADLINE_MS - 1) - setRuntimeEnvironmentConnectionGenerationForTests(RUNTIME_ENV_ID, 1) - markHostSessionMirrorHydrated(RUNTIME_ENV_ID) - vi.advanceTimersByTime(1) - - expect(useAppStore.getState().sleepingAgentSessionsByPaneKey[paneKey]).toBeDefined() - expect(Object.keys(useAppStore.getState().automaticAgentResumeClaimsByTabId)).toHaveLength(0) - expect(countParkedHostMirrorHandleGapPanesForTests()).toBe(1) - vi.advanceTimersByTime(HOST_MIRROR_HANDLE_GAP_DEADLINE_MS) - expect(useAppStore.getState().sleepingAgentSessionsByPaneKey[paneKey]).toBeDefined() - expect(Object.keys(useAppStore.getState().automaticAgentResumeClaimsByTabId)).toHaveLength(0) - }) - - // Disconnect alone preserves generation; silence during an outage cannot prove remote exit or authorize a duplicate launch (#19735, ssh-execution-boundary.md). - it('does not turn an outage into a verdict when the environment dropped mid-park', () => { - const worktree = makeRuntimeOwnedWorktree() - seedMirroredWorkspace(worktree) - const paneKey = seedActiveSleepingRecord(worktree.id) - markHostSessionMirrorHydrated(RUNTIME_ENV_ID) - expect(resumeSleepingAgentSessionsForWorktree(worktree.id)).toBe(0) - - vi.advanceTimersByTime(HOST_MIRROR_HANDLE_GAP_DEADLINE_MS / 2) - setRuntimeEnvironmentDisconnectedForTests(RUNTIME_ENV_ID) - vi.advanceTimersByTime(HOST_MIRROR_HANDLE_GAP_DEADLINE_MS) - - const during = useAppStore.getState() - expect(during.sleepingAgentSessionsByPaneKey[paneKey]).toBeDefined() - expect(Object.keys(during.automaticAgentResumeClaimsByTabId)).toHaveLength(0) - expect((during.tabsByWorktree[worktree.id] ?? []).map((tab) => tab.id)).toEqual([WEB_TAB_ID]) - expect(countParkedHostMirrorHandleGapPanesForTests()).toBe(1) - - // Once contact returns, a full healthy budget must decide; retaining the old outage hold forever would strand recovery. - clearRuntimeEnvironmentStatusEntryForTests(RUNTIME_ENV_ID) - vi.advanceTimersByTime(HOST_MIRROR_HANDLE_GAP_DEADLINE_MS) - - const after = useAppStore.getState() - expect(after.sleepingAgentSessionsByPaneKey[paneKey]).toBeDefined() - expect(Object.keys(after.automaticAgentResumeClaimsByTabId)).toHaveLength(0) - }) - - // Main reports transport outages as reconnecting too; guard both production outage states. - it('does not turn a transport-down snapshot into a verdict either', () => { - const worktree = makeRuntimeOwnedWorktree() - seedMirroredWorkspace(worktree) - const paneKey = seedActiveSleepingRecord(worktree.id) - markHostSessionMirrorHydrated(RUNTIME_ENV_ID) - expect(resumeSleepingAgentSessionsForWorktree(worktree.id)).toBe(0) - - vi.advanceTimersByTime(HOST_MIRROR_HANDLE_GAP_DEADLINE_MS / 2) - setRuntimeEnvironmentTransportDownForTests(RUNTIME_ENV_ID) - vi.advanceTimersByTime(HOST_MIRROR_HANDLE_GAP_DEADLINE_MS) - - const during = useAppStore.getState() - expect(during.sleepingAgentSessionsByPaneKey[paneKey]).toBeDefined() - expect(Object.keys(during.automaticAgentResumeClaimsByTabId)).toHaveLength(0) - expect(countParkedHostMirrorHandleGapPanesForTests()).toBe(1) - }) - - // An outage can start/end within one unchanged generation; contact epoch proves the budget lacked continuous host contact. - it('does not record a verdict when contact was lost and regained inside the budget', () => { - const worktree = makeRuntimeOwnedWorktree() - seedMirroredWorkspace(worktree) - const paneKey = seedActiveSleepingRecord(worktree.id) - markHostSessionMirrorHydrated(RUNTIME_ENV_ID) - expect(resumeSleepingAgentSessionsForWorktree(worktree.id)).toBe(0) - - vi.advanceTimersByTime(1000) - setRuntimeEnvironmentDisconnectedForTests(RUNTIME_ENV_ID) - vi.advanceTimersByTime(HOST_MIRROR_HANDLE_GAP_DEADLINE_MS - 1001) - setRuntimeEnvironmentReconnectedForTests(RUNTIME_ENV_ID) - vi.advanceTimersByTime(1) - - const during = useAppStore.getState() - expect(during.sleepingAgentSessionsByPaneKey[paneKey]).toBeDefined() - expect(Object.keys(during.automaticAgentResumeClaimsByTabId)).toHaveLength(0) - expect(countParkedHostMirrorHandleGapPanesForTests()).toBe(1) - vi.advanceTimersByTime(HOST_MIRROR_HANDLE_GAP_DEADLINE_MS) - - const after = useAppStore.getState() - expect(after.sleepingAgentSessionsByPaneKey[paneKey]).toBeDefined() - expect(Object.keys(after.automaticAgentResumeClaimsByTabId)).toHaveLength(0) - }) - - it('releases only the pane whose handle landed when two panes share the environment', () => { - const worktree = makeRuntimeOwnedWorktree() - seedMirroredWorkspace(worktree) - seedSecondMirroredPane(worktree.id) - const firstPaneKey = seedActiveSleepingRecordFor(worktree.id, WEB_TAB_ID, LEAF_ID, 'session-1') - const secondPaneKey = seedActiveSleepingRecordFor( - worktree.id, - SECOND_TAB_ID, - SECOND_LEAF_ID, - 'session-2' - ) - markHostSessionMirrorHydrated(RUNTIME_ENV_ID) - expect(resumeSleepingAgentSessionsForWorktree(worktree.id)).toBe(0) - expect(countParkedHostMirrorHandleGapPanesForTests()).toBe(2) - - vi.advanceTimersByTime(HOST_MIRROR_HANDLE_GAP_DEADLINE_MS / 2) - useAppStore.setState({ ptyIdsByTabId: { [WEB_TAB_ID]: ['remote:env-handle-gap@@term_1'] } }) - - expect(countParkedHostMirrorHandleGapPanesForTests()).toBe(1) - const after = useAppStore.getState() - expect(after.sleepingAgentSessionsByPaneKey[firstPaneKey]).toBeDefined() - expect(after.sleepingAgentSessionsByPaneKey[secondPaneKey]).toBeDefined() - expect(Object.keys(after.automaticAgentResumeClaimsByTabId)).toHaveLength(0) - - // Use the clock: a spurious release/re-park looks unchanged immediately but would restart this pane’s original deadline. - vi.advanceTimersByTime(HOST_MIRROR_HANDLE_GAP_DEADLINE_MS / 2) - expect(countParkedHostMirrorHandleGapPanesForTests()).toBe(0) - expect(useAppStore.getState().sleepingAgentSessionsByPaneKey[secondPaneKey]).toBeDefined() - }) - - it('does not release or reschedule a park because another environment published a handle', () => { - const worktree = makeRuntimeOwnedWorktree() - seedMirroredWorkspace(worktree) - const paneKey = seedActiveSleepingRecord(worktree.id) - markHostSessionMirrorHydrated(RUNTIME_ENV_ID) - expect(resumeSleepingAgentSessionsForWorktree(worktree.id)).toBe(0) - - vi.advanceTimersByTime(HOST_MIRROR_HANDLE_GAP_DEADLINE_MS / 2) - useAppStore.setState({ - ptyIdsByTabId: { 'web-terminal-other-env-tab': ['remote:env-other@@term_1'] } - }) - - expect(countParkedHostMirrorHandleGapPanesForTests()).toBe(1) - expect(useAppStore.getState().sleepingAgentSessionsByPaneKey[paneKey]).toBeDefined() - vi.advanceTimersByTime(HOST_MIRROR_HANDLE_GAP_DEADLINE_MS / 2) - expect(useAppStore.getState().sleepingAgentSessionsByPaneKey[paneKey]).toBeDefined() - expect(hasHostMirrorHandleWaitExpired(RUNTIME_ENV_ID, WEB_TAB_ID)).toBe(true) - expect(countParkedHostMirrorHandleGapPanesForTests()).toBe(0) - }) - - it('leaves no waiter or timer behind when the environment tears its rows down mid-park', () => { - const worktree = makeRuntimeOwnedWorktree() - seedMirroredWorkspace(worktree) - seedActiveSleepingRecord(worktree.id) - markHostSessionMirrorHydrated(RUNTIME_ENV_ID) - expect(resumeSleepingAgentSessionsForWorktree(worktree.id)).toBe(0) - - // Teardown drops every row the environment owned. - useAppStore.setState({ tabsByWorktree: {}, terminalLayoutsByTabId: {} }) - - expect(countParkedHostMirrorHandleGapPanesForTests()).toBe(0) - expect(vi.getTimerCount()).toBe(0) - }) -}) diff --git a/src/renderer/src/lib/host-mirrored-pane-resume-replay.test.ts b/src/renderer/src/lib/host-mirrored-pane-resume-replay.test.ts deleted file mode 100644 index 79badec2959..00000000000 --- a/src/renderer/src/lib/host-mirrored-pane-resume-replay.test.ts +++ /dev/null @@ -1,169 +0,0 @@ -import { getDefaultSettings } from '../../../shared/constants' -import path from 'node:path' -import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' -import { useAppStore } from '@/store' -import type { AppState } from '@/store/types' -import { resumeSleepingAgentSessionsForWorktree } from './agent-session/resume/resume-sleeping-agent-session' -import { makeCreatedAgentWorktree } from '@/lib/workspace/activation/worktree-activation-created-agent.test-fixture' -import { makePaneKey } from '../../../shared/workspace-layout/stable-pane-id' -import { - hasHostSessionMirrorHydrated, - markHostSessionMirrorHydrated, - resetHostSessionMirrorHydrationForTests -} from '@/runtime/web-session-tabs-sync/hydration/host-session-mirror-hydration' -import { clearRuntimeEnvironmentConnectionGenerations as clearRuntimeEnvironmentConnectionGenerationsForTests } from '@/store/slices/runtime-status/runtime-status-connection-generation' - -// Mirror settlement must replay deferred recovery and reset per connection, or duplicate-launch prevention would strand resumes. - -const initialAppStoreState = useAppStore.getState() - -const LEAF_ID = '22222222-2222-4222-8222-222222222222' -const WEB_TAB_ID = 'web-terminal-host-tab-1' -const RUNTIME_ENV_ID = 'env-abfee683' -const WORKTREE_ID = makeCreatedAgentWorktree().id - -function makeRuntimeOwnedWorktree(): ReturnType { - return { - ...makeCreatedAgentWorktree(), - createdWithAgent: undefined, - hostId: `runtime:${encodeURIComponent(RUNTIME_ENV_ID)}` - } -} - -function seedState(worktree: ReturnType): void { - const state: Partial = { - repos: [ - { - id: 'repo-1', - path: path.join(path.sep, 'workspace', 'repo'), - displayName: 'repo', - badgeColor: '#000000', - addedAt: 0 - } - ], - worktreesByRepo: { 'repo-1': [worktree] }, - activeRepoId: 'repo-1', - activeWorktreeId: worktree.id, - activeView: 'terminal', - tabsByWorktree: { - [worktree.id]: [{ id: WEB_TAB_ID, title: 'Codex', ptyId: null } as never] - }, - unifiedTabsByWorktree: { - [worktree.id]: [ - { - id: `unified-${WEB_TAB_ID}`, - contentType: 'terminal', - entityId: WEB_TAB_ID, - groupId: 'group-1' - } as never - ] - }, - groupsByWorktree: { - [worktree.id]: [ - { - id: 'group-1', - activeTabId: `unified-${WEB_TAB_ID}`, - tabOrder: [`unified-${WEB_TAB_ID}`], - recentTabIds: [] - } as never - ] - }, - activeGroupIdByWorktree: { [worktree.id]: 'group-1' }, - layoutByWorktree: {}, - openFiles: [], - browserTabsByWorktree: {}, - activeFileIdByWorktree: {}, - activeBrowserTabIdByWorktree: {}, - activeTabTypeByWorktree: {}, - activeTabIdByWorktree: {}, - tabBarOrderByWorktree: {}, - pendingStartupByTabId: {}, - automaticAgentResumeClaimsByTabId: {}, - agentStatusByPaneKey: {}, - sleepingAgentSessionsByPaneKey: {}, - ptyIdsByTabId: {}, - terminalLayoutsByTabId: { - [WEB_TAB_ID]: { - root: { type: 'leaf', leafId: LEAF_ID }, - activeLeafId: LEAF_ID, - ptyIdsByLeafId: { [LEAF_ID]: 'pty-host-old-1' } - } as never - }, - settings: { - ...getDefaultSettings(''), - agentCmdOverrides: {} - }, - markWorktreeVisited: vi.fn(), - recordWorktreeVisit: vi.fn(), - refreshGitHubForWorktreeIfStale: vi.fn(), - revealWorktreeInSidebar: vi.fn() - } - useAppStore.setState(state) -} - -function seedSleepingRecord(worktreeId: string, sessionId: string): string { - const paneKey = makePaneKey(WEB_TAB_ID, LEAF_ID) - useAppStore.setState((s) => ({ - sleepingAgentSessionsByPaneKey: { - ...s.sleepingAgentSessionsByPaneKey, - [paneKey]: { - paneKey, - tabId: WEB_TAB_ID, - worktreeId, - agent: 'codex' as const, - providerSession: { key: 'session_id' as const, id: sessionId }, - prompt: 'keep working', - state: 'working' as const, - origin: 'live' as const, - capturedAt: 1000, - updatedAt: 1000, - terminalTitle: 'Codex' - } - } - })) - return paneKey -} - -function connectRuntime(runtimeId: string): void { - useAppStore.getState().setRuntimeEnvironmentStatus(RUNTIME_ENV_ID, { - status: { - runtimeId, - rendererGraphEpoch: 1, - graphStatus: 'live', - authoritativeWindowId: 1, - liveTabCount: 1, - liveLeafCount: 1 - } as never, - checkedAt: 1 - }) -} - -beforeEach(() => { - resetHostSessionMirrorHydrationForTests() - clearRuntimeEnvironmentConnectionGenerationsForTests() -}) - -afterEach(() => { - useAppStore.setState(initialAppStoreState, true) - resetHostSessionMirrorHydrationForTests() - clearRuntimeEnvironmentConnectionGenerationsForTests() -}) - -describe('parked mirrored-pane resume replay', () => { - it('drops the hydrated verdict when the host reconnects under a new runtime id', () => { - connectRuntime('runtime-a') - markHostSessionMirrorHydrated(RUNTIME_ENV_ID) - expect(hasHostSessionMirrorHydrated(RUNTIME_ENV_ID, WORKTREE_ID)).toBe(true) - - // A host app restart: same environment, new connection, unknown PTYs again. - connectRuntime('runtime-b') - expect(hasHostSessionMirrorHydrated(RUNTIME_ENV_ID, WORKTREE_ID)).toBe(false) - - const worktree = makeRuntimeOwnedWorktree() - seedState(worktree) - const paneKey = seedSleepingRecord(worktree.id, 'codex-session-replay-3') - - expect(resumeSleepingAgentSessionsForWorktree(worktree.id)).toBe(0) - expect(useAppStore.getState().sleepingAgentSessionsByPaneKey[paneKey]).toBeDefined() - }) -}) diff --git a/src/renderer/src/lib/launch-agent-hosted-prompt.test.ts b/src/renderer/src/lib/launch-agent-hosted-prompt.test.ts deleted file mode 100644 index 2519190d235..00000000000 --- a/src/renderer/src/lib/launch-agent-hosted-prompt.test.ts +++ /dev/null @@ -1,83 +0,0 @@ -import type * as CreateRequest from '@/runtime/hosted-terminals/creation/agent-launch/agent-session-create-request' -import type * as HostSettings from '@/runtime/agent-launch-settings/agent-launch-settings-transport' -// @vitest-environment happy-dom -import { beforeEach, expect, it, vi } from 'vitest' -import type { createWebRuntimeSessionTerminalResult } from '@/runtime/hosted-terminals/creation/web-runtime-terminal-create-operation' -import type { readHostAgentStartupSettings } from '@/runtime/agent-launch-settings/agent-launch-settings-transport' -import { launchAgentInWebHostTab } from '@/lib/agent-session/launch/new-tab/launch-agent-web-host-tab' - -const mocks = vi.hoisted(() => ({ - create: vi.fn(), - settings: vi.fn(), - paste: vi.fn(async () => true), - error: vi.fn() -})) -vi.mock('@/store', () => ({ - useAppStore: { - getState: () => ({ - runtimeStatusByEnvironmentId: new Map(), - setActiveTabType: vi.fn(), - seedNativeChatLaunchDraft: vi.fn(), - seedNativeChatLaunchPrompt: vi.fn(), - markNativeChatLaunchPromptFailed: vi.fn() - }) - } -})) -vi.mock('sonner', () => ({ toast: { error: mocks.error } })) -vi.mock( - '@/runtime/hosted-terminals/creation/agent-launch/agent-session-create-request', - async (original) => ({ - ...(await original()), - agentSessionCreateCapabilities: async () => ({ capable: false, complete: false }) - }) -) -vi.mock('@/runtime/agent-launch-settings/agent-launch-settings-transport', async (original) => ({ - ...(await original()), - readHostAgentStartupSettings: mocks.settings -})) -vi.mock('@/runtime/hosted-terminals/creation/web-runtime-terminal-create-operation', () => ({ - createWebRuntimeSessionTerminalResult: mocks.create -})) -vi.mock('@/lib/agent-session/messaging/paste/agent-paste-draft', () => ({ - pasteDraftWhenAgentReady: mocks.paste -})) - -beforeEach(() => { - vi.clearAllMocks() - mocks.create.mockResolvedValue({ outcome: { status: 'created' }, hostTabId: 'actual-host-tab' }) -}) - -it('cancels after asynchronous compatibility preparation without dispatching or reporting failure', async () => { - const settings = Promise.withResolvers>>() - mocks.settings.mockReturnValue(settings.promise) - const dispatch = vi.fn() - mocks.create.mockImplementation(async (args) => { - try { - const prepared = await args.legacyAgentLaunch?.() - dispatch(prepared) - return { outcome: { status: 'created' }, hostTabId: 'unexpected' } - } catch { - return { outcome: { status: 'failed', message: 'cancelled' } } - } - }) - let cancelled = false - const launch = launchAgentInWebHostTab({ - agent: 'goose', - worktreeId: 'wt', - environmentId: 'host', - prompt: 'held message', - promptDelivery: 'draft', - sessionOptions: { permissionMode: 'full-access' }, - isCancelled: () => cancelled, - buildStartup: () => { - throw new Error('cancelled preparation must stop') - } - }) - await vi.waitFor(() => expect(mocks.settings).toHaveBeenCalledOnce()) - cancelled = true - settings.resolve({ agentCmdOverrides: {}, agentDefaultArgs: {} }) - await expect(launch).resolves.toMatchObject({ delivered: false, failureNotified: false }) - expect(dispatch).not.toHaveBeenCalled() - expect(mocks.paste).not.toHaveBeenCalled() - expect(mocks.error).not.toHaveBeenCalled() -}) diff --git a/src/renderer/src/lib/launch-parity-workspace-start.test-fixture.ts b/src/renderer/src/lib/launch-parity-workspace-start.test-fixture.ts deleted file mode 100644 index df21a8cfdf0..00000000000 --- a/src/renderer/src/lib/launch-parity-workspace-start.test-fixture.ts +++ /dev/null @@ -1,100 +0,0 @@ -// Run workspace-seeded launch producers against the real parity store; stub only setup/trust/detection/workspace creation. -import type { LaunchTestStore } from './launch-parity-renderer.test-fixture' -import type * as WorkItemLaunch from '@/lib/workspace/creation/work-item/launch-work-item-direct' -import type * as FolderComposerSubmit from '@/components/sidebar/workspace-creation/folder/folder-workspace-composer-submit' -import { - resolveTuiAgentLaunchArgs, - resolveTuiAgentLaunchEnv -} from '../../../shared/agent-launch/choices/tui-agent-launch-defaults' -import { - LAUNCH_FOLDER_ID, - type WindowLaunchCase -} from '../../../shared/agent-launch/fixtures/launch-parity-window-request.test-fixture' - -type WorkspaceStartProducer = Extract< - WindowLaunchCase['producer'], - { kind: 'work-item' | 'folder-composer' } -> - -export type WorkspaceStartModules = { - workItem: typeof WorkItemLaunch - folder: typeof FolderComposerSubmit -} - -export const loadWorkspaceStartModules = async (): Promise => ({ - workItem: await import('@/lib/workspace/creation/work-item/launch-work-item-direct'), - folder: - await import('@/components/sidebar/workspace-creation/folder/folder-workspace-composer-submit') -}) - -export async function startWorkspaceAgent( - modules: WorkspaceStartModules, - store: LaunchTestStore, - c: WindowLaunchCase & { producer: WorkspaceStartProducer } -): Promise { - const { producer } = c - const state = store.getState() - // Stub PR refresh without a bridge and let timers drive post-start paste. - Object.assign(window.api, { gh: {} }) - Object.assign(window, { setTimeout, clearTimeout }) - store.setState({ - ensureDetectedAgents: async () => [producer.agent], - updateWorktreeMeta: async () => ({ ok: true }) - }) - if (producer.kind === 'work-item') { - const worktree = state.worktreesByRepo['repo-1']?.[0] - store.setState({ createWorktree: async () => ({ worktree }) }) - const started = await modules.workItem.launchWorkItemDirect({ - item: { - title: 'Fix the bug', - url: 'https://github.com/acme/repo/issues/7', - type: 'issue', - number: 7, - pasteContent: producer.text - }, - repoId: 'repo-1', - launchSource: 'task_page', - telemetrySource: 'sidebar', - agentOverride: producer.agent, - promptDelivery: producer.delivery, - openModalFallback: () => { - throw new Error(`${c.name}: fell back to the modal`) - } - }) - if (!started) { - throw new Error(`${c.name}: the work item started no agent`) - } - return - } - const folderWorkspace = state.folderWorkspaces.find( - (workspace) => `folder:${workspace.id}` === LAUNCH_FOLDER_ID - ) - const settings = state.settings - await modules.folder.submitFolderWorkspaceCreate({ - projectGroup: { - id: 'pg-1', - name: 'group', - parentPath: c.workspace.path, - parentGroupId: null, - createdFrom: 'manual', - tabOrder: 0, - isCollapsed: false, - color: null, - createdAt: 0, - updatedAt: 0 - }, - name: 'folder', - lastAutoName: '', - linkedWorkItem: null, - note: producer.note, - quickAgent: producer.agent, - autoRenameBranchFromWork: false, - agentCmdOverrides: settings?.agentCmdOverrides, - agentArgs: resolveTuiAgentLaunchArgs(producer.agent, settings), - agentEnv: resolveTuiAgentLaunchEnv(producer.agent, settings), - terminalWindowsShell: settings?.terminalWindowsShell, - launchSource: 'new_workspace_composer', - createFolderWorkspace: async () => folderWorkspace ?? null, - onOpenChange: () => {} - }) -} diff --git a/src/renderer/src/lib/link-source-local-open-owner.test.ts b/src/renderer/src/lib/link-source-local-open-owner.test.ts deleted file mode 100644 index 7a174a64eb2..00000000000 --- a/src/renderer/src/lib/link-source-local-open-owner.test.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { getLinkSourceLocalOpenOwner } from './link-source-local-open-owner' -import { isLocalPathOpenBlocked } from './files/os-open/local-path-open-guard' - -const WORKTREE_ID = 'repo-1::/srv/worktree' - -function stateWithWorktreeHost(hostId: 'local' | 'runtime:env-1') { - return { - // A focused server must not decide where a document lives. - settings: { activeRuntimeEnvironmentId: 'env-1' }, - worktreesByRepo: { 'repo-1': [{ id: WORKTREE_ID, repoId: 'repo-1', hostId }] } - } -} - -describe('getLinkSourceLocalOpenOwner', () => { - it('allows a local worktree document while a server is focused', () => { - const owner = getLinkSourceLocalOpenOwner( - stateWithWorktreeHost('local'), - { kind: 'local' }, - WORKTREE_ID - ) - expect(owner).toBe('local') - expect(isLocalPathOpenBlocked(owner)).toBe(false) - }) - - it('refuses a runtime-owned document that reports no connection', () => { - const state = { ...stateWithWorktreeHost('runtime:env-1'), settings: null } - const owner = getLinkSourceLocalOpenOwner(state, { kind: 'local' }, WORKTREE_ID) - expect(owner).toBe('runtime:env-1') - expect(isLocalPathOpenBlocked(owner)).toBe(true) - }) -}) diff --git a/src/renderer/src/lib/link-open-request.ts b/src/renderer/src/lib/links/link-open-request.ts similarity index 100% rename from src/renderer/src/lib/link-open-request.ts rename to src/renderer/src/lib/links/link-open-request.ts diff --git a/src/renderer/src/lib/link-source-local-open-owner.ts b/src/renderer/src/lib/links/ownership/link-source-local-open-owner.ts similarity index 64% rename from src/renderer/src/lib/link-source-local-open-owner.ts rename to src/renderer/src/lib/links/ownership/link-source-local-open-owner.ts index b708d7c3699..a4fefa7438e 100644 --- a/src/renderer/src/lib/link-source-local-open-owner.ts +++ b/src/renderer/src/lib/links/ownership/link-source-local-open-owner.ts @@ -1,11 +1,11 @@ import { toRuntimeExecutionHostId, - toSshExecutionHostId, - type ExecutionHostId -} from '../../../shared/execution-host' -import type { HttpLinkSourceOwner } from './browser/navigation/http-link-routing' -import { getResolvedExecutionHostIdForWorktree } from './workspace/ownership/resolved-worktree-execution-host' -import type { WorktreeRuntimeOwnerState } from './workspace/ownership/worktree-runtime-owner-state' + toSshExecutionHostId +} from '../../../../../shared/execution-host' +import type { ExecutionHostId } from '../../../../../shared/execution-host' +import { getResolvedExecutionHostIdForWorktree } from '../../workspace/ownership/resolved-worktree-execution-host' +import type { HttpLinkSourceOwner } from '../../browser/navigation/http-link-routing' +import type { WorktreeRuntimeOwnerState } from '../../workspace/ownership/worktree-runtime-owner-state' /** The host that owns a link's source document, for the local-open guard. */ export function getLinkSourceLocalOpenOwner( diff --git a/src/renderer/src/lib/adjacent-link-open-group.ts b/src/renderer/src/lib/links/placement/adjacent-link-open-group.ts similarity index 98% rename from src/renderer/src/lib/adjacent-link-open-group.ts rename to src/renderer/src/lib/links/placement/adjacent-link-open-group.ts index 330119bc847..ae4c5c8e3e1 100644 --- a/src/renderer/src/lib/adjacent-link-open-group.ts +++ b/src/renderer/src/lib/links/placement/adjacent-link-open-group.ts @@ -1,4 +1,4 @@ -import type { TabGroup, TabGroupLayoutNode } from '../../../shared/tab-types' +import type { TabGroup, TabGroupLayoutNode } from '../../../../../shared/tab-types' import type { TabSplitTarget } from '@/store/slices/tabs/tabs-slice-contract' type LayoutRect = { left: number; top: number; right: number; bottom: number } diff --git a/src/renderer/src/lib/link-open-intent.ts b/src/renderer/src/lib/links/placement/link-open-intent.ts similarity index 95% rename from src/renderer/src/lib/link-open-intent.ts rename to src/renderer/src/lib/links/placement/link-open-intent.ts index 8584c4309aa..739eb7313c0 100644 --- a/src/renderer/src/lib/link-open-intent.ts +++ b/src/renderer/src/lib/links/placement/link-open-intent.ts @@ -1,8 +1,8 @@ -import type { AppState } from '@/store/types' -import type { Tab } from '../../../shared/tab-types' -import type { EditorOpenLinkIntent } from '@/store/slices/editor/types/editor-open-link-intent' -import { collectTabGroupLayoutGroupIds } from '../../../shared/workspace-layout/tab-group-moves' +import { collectTabGroupLayoutGroupIds } from '../../../../../shared/workspace-layout/tab-group-moves' import { resolveLinkOpenSidePlacement } from './adjacent-link-open-group' +import type { AppState } from '@/store/types' +import type { Tab } from '../../../../../shared/tab-types' +import type { EditorOpenLinkIntent } from '@/store/slices/editor/types/editor-open-link-intent' export type LinkOpenIntent = EditorOpenLinkIntent & { initialGroupId?: string } export type LinkSourceTab = Pick & diff --git a/src/renderer/src/lib/open-agent-message-sender.test.ts b/src/renderer/src/lib/open-agent-message-sender.test.ts deleted file mode 100644 index 49f95f052f8..00000000000 --- a/src/renderer/src/lib/open-agent-message-sender.test.ts +++ /dev/null @@ -1,175 +0,0 @@ -import { beforeEach, expect, it, vi } from 'vitest' -import type { Tab } from '../../../shared/tab-types' -import type { - AgentMessageSource, - AgentMessageSender -} from '../../../shared/agent-session/agent-session-message-source' - -const mocks = vi.hoisted(() => { - const unifiedTabsByWorktree: Record = {} - return { - rpc: vi.fn(), - focus: vi.fn(), - remoteFocus: vi.fn(), - info: vi.fn(), - toast: vi.fn(), - reveal: vi.fn(), - activate: vi.fn(), - group: vi.fn(), - type: vi.fn(), - state: { - agentStatusByPaneKey: {}, - retainedAgentsByPaneKey: {}, - activeWorktreeId: 'wt-chat', - activeWorkspaceExecutionHostId: 'local' as const, - unifiedTabsByWorktree - } - } -}) -vi.mock('sonner', () => ({ toast: { error: mocks.toast, info: mocks.info } })) -vi.mock('@/store', () => ({ - useAppStore: { - getState: () => ({ - ...mocks.state, - activateTab: mocks.activate, - focusGroup: mocks.group, - setActiveTabType: mocks.type - }) - } -})) -vi.mock('@/runtime/rpc/calls/runtime-rpc-call', async (original) => ({ - ...(await original>()), - callRuntimeRpc: mocks.rpc -})) -vi.mock('@/runtime/rpc/compatibility/runtime-capability-proof', async (original) => ({ - ...(await original>()), - runtimeEnvironmentSupportsCapability: async () => true -})) -vi.mock('@/components/terminal-pane/links/handles/terminal-handle-links', () => ({ - focusRendererTerminalHandle: mocks.focus, - focusRuntimeTerminalHandle: mocks.remoteFocus -})) -vi.mock('./workspace/activation/worktree-activation', () => ({ - activateAndRevealWorktree: mocks.reveal -})) -vi.mock('./workspace/activation/wsl-moved-chat-activation', () => ({ - activateWslMovedWorkspace: () => false -})) -import { openAgentMessageSender } from './open-agent-message-sender' -import { RuntimeRpcCallError } from '@/runtime/rpc/calls/runtime-rpc-result' -const host = { kind: 'environment', environmentId: 'remote-2' } as const -const party: AgentMessageSender['party'] = { - address: 'term_worker', - terminalHandle: 'term_worker', - orcaSessionId: null -} -function source(p = party): AgentMessageSource { - return { - kind: 'agent', - senders: [{ party: p, name: 'Worker with spaces' }], - orchestration: { - message: 'mail-notice', - mailbox: 'run:r', - dispatchId: null, - messages: [ - { messageId: 'm1', runId: 'r', from: p.address }, - { messageId: 'other', runId: 'r', from: 'other' } - ] - } - } -} -function open(p = party) { - const s = source(p) - return openAgentMessageSender(s, s.senders[0]!, 'wt-chat', host) -} -beforeEach(() => { - vi.clearAllMocks() - mocks.state.unifiedTabsByWorktree = {} - mocks.focus.mockReturnValue(true) - mocks.rpc.mockResolvedValue({ ok: true }) -}) -it.each([ - ['success', null], - ...['terminal_exited', 'terminal_gone', 'terminal_handle_stale', 'terminal_not_found'].map( - (code) => [code, 'gone'] as const - ), - ['request_timeout', 'retry'], - ['runtime_compat_block', 'update'] -] as const)( - 'settles runtime terminal focus for %s and permits a genuine next click', - async (code, feedback) => { - mocks.focus.mockReturnValue(false) - mocks.rpc.mockResolvedValue({ location: { kind: 'terminal', handle: 'current' } }) - const focus = Promise.withResolvers() - mocks.remoteFocus.mockReturnValueOnce(focus.promise).mockResolvedValue(undefined) - let settled = false - const opening = open().then(() => { - settled = true - }) - await vi.waitFor(() => - expect(mocks.remoteFocus).toHaveBeenCalledExactlyOnceWith('current', 'remote-2') - ) - expect(settled).toBe(false) - if (feedback === null) { - focus.resolve() - } else if (feedback === 'update') { - focus.reject(Object.assign(new Error('Version blocked'), { code })) - } else { - focus.reject( - new RuntimeRpcCallError({ - id: 'focus', - ok: false, - error: { code, message: 'Focus failed' } - }) - ) - } - await opening - expect(settled).toBe(true) - if (feedback === 'gone') { - expect(mocks.info).toHaveBeenCalledExactlyOnceWith( - "Agent's pane is no longer available.", - undefined - ) - } else { - expect(mocks.info).not.toHaveBeenCalled() - } - if (feedback === 'retry' || feedback === 'update') { - expect(mocks.toast).toHaveBeenCalledExactlyOnceWith( - feedback === 'retry' - ? 'The structured agent session is not available yet. Retry in a moment.' - : "This chat can't be reopened until Orca is updated." - ) - } else { - expect(mocks.toast).not.toHaveBeenCalled() - } - expect(mocks.rpc).toHaveBeenCalledExactlyOnceWith( - host, - 'orchestration.partyOpen', - { address: 'term_worker', messageIds: ['m1'] }, - { timeoutMs: 5000 } - ) - expect(mocks.focus).toHaveBeenCalledExactlyOnceWith('current', 'remote-2') - for (const mutation of [mocks.activate, mocks.group, mocks.type, mocks.reveal]) { - expect(mutation).not.toHaveBeenCalled() - } - const errors = mocks.toast.mock.calls.length - const infos = mocks.info.mock.calls.length - await open() - expect(mocks.rpc).toHaveBeenCalledTimes(2) - expect(mocks.remoteFocus).toHaveBeenNthCalledWith(2, 'current', 'remote-2') - expect(mocks.toast).toHaveBeenCalledTimes(errors) - expect(mocks.info).toHaveBeenCalledTimes(infos) - } -) -it('coalesces one sender but keeps selected hosts independent', async () => { - const wait = Promise.withResolvers() - mocks.rpc.mockReturnValue(wait.promise) - const a = open(), - b = open() - const s = source() - const c = openAgentMessageSender(s, s.senders[0]!, 'wt-chat', { kind: 'local' }) - expect(mocks.rpc).toHaveBeenCalledTimes(2) - wait.resolve({ location: null }) - await Promise.all([a, b, c]) - expect(mocks.toast).toHaveBeenCalledTimes(2) -}) diff --git a/src/renderer/src/lib/rename-user-named-tab-access.test.ts b/src/renderer/src/lib/rename-user-named-tab-access.test.ts deleted file mode 100644 index b08ecc4391e..00000000000 --- a/src/renderer/src/lib/rename-user-named-tab-access.test.ts +++ /dev/null @@ -1,197 +0,0 @@ -import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' -import type * as RuntimeFileMutationClient from '@/runtime/files/mutations/runtime-file-mutation-client' -import type * as EditorAutosave from '@/components/editor/autosave/editor-autosave' - -const mocks = vi.hoisted(() => ({ renameRuntimePath: vi.fn(), writeRuntimeFile: vi.fn() })) -vi.mock('@/runtime/files/mutations/runtime-file-mutation-client', async (importOriginal) => { - const actual = await importOriginal() - return { - ...actual, - renameRuntimePath: mocks.renameRuntimePath, - writeRuntimeFile: mocks.writeRuntimeFile - } -}) -// Switch on: main renames the tabs, and its frame rekeys the content (T1 transport, apply mode). -vi.mock('@/runtime/rpc/calls/runtime-rpc-call', async (importOriginal) => - ( - await import('@/runtime/workspace-layout/testing/layout-apply-test-transport.test-fixture') - ).runtimeRpcClientWithLayoutApply(await importOriginal()) -) -vi.mock('@/runtime/workspace-layout/frames/runtime-layout-client', async (importOriginal) => - ( - await import('@/runtime/workspace-layout/testing/layout-apply-test-transport.test-fixture') - ).runtimeLayoutClientWithTestFrames(await importOriginal()) -) -vi.mock('@/components/editor/autosave/editor-autosave', async (importOriginal) => { - const actual = await importOriginal() - return { ...actual, requestEditorSaveQuiesce: vi.fn().mockResolvedValue(undefined) } -}) - -import { useAppStore } from '@/store' -import { FLOATING_TERMINAL_WORKTREE_ID } from '../../../shared/constants' -import type { Repo } from '../../../shared/repo-types' -import type { Worktree } from '../../../shared/worktree/types' -import { - clearFileExplorerUndoHistory, - redoFileExplorer, - undoFileExplorer -} from '@/components/right-sidebar/file-explorer/mutations/fileExplorerUndoRedo' -import { createEditorSaveQueue } from '@/components/editor/save/queue/editor-save-queue' -import { - editorTabDocumentFolderAccess, - editorTabFileAccess -} from './files/access/local-file-access' -import { renameFileOnDisk } from './editor/file-operations/rename-file' -import { withLoadedBaselines } from '@/components/editor/autosave/editor-autosave-controller-test-fixture' -import { - drawTabsFromMain, - type TabsDrawnFromMain -} from '@/store/slices/tabs/tabs-drawn-from-main.test-fixture' - -let main: TabsDrawnFromMain - -const PROJECT = '/Users/me/project' -const WT = `repo-local::${PROJECT}` -const repo: Repo = { - id: 'repo-local', - path: PROJECT, - displayName: 'project', - badgeColor: '#000', - addedAt: 0 -} -const worktree: Worktree = { - id: WT, - repoId: 'repo-local', - path: PROJECT, - head: 'a', - branch: 'refs/heads/main', - isBare: false, - isMainWorktree: true, - displayName: 'project', - comment: '', - linkedIssue: null, - linkedPR: null, - linkedLinearIssue: null, - isArchived: false, - isUnread: false, - isPinned: false, - sortOrder: 0, - lastActivityAt: 0 -} - -const documentFolder = (documentPath: string) => ({ kind: 'document-folder', documentPath }) - -function openUserNamedTab(filePath: string, worktreeId: string): void { - useAppStore.getState().openFile( - { - filePath, - relativePath: filePath, - worktreeId, - runtimeEnvironmentId: null, - language: 'markdown', - mode: 'edit' - }, - { suppressActiveRuntimeFallback: true } - ) -} - -async function onlyTab() { - // Main draws each open and answers each rename before the tab shows it. - await main.settle() - const tabs = useAppStore.getState().openFiles - expect(tabs).toHaveLength(1) - return tabs[0]! -} - -// Reads/rename/image insert derive access from stored tab fields; restart restores only filePath/relativePath, so those must retain access. -async function expectUserNamedAt(filePath: string): Promise { - const tab = await onlyTab() - expect(tab.filePath).toBe(filePath) - expect(tab.relativePath).toBe(filePath) - const state = useAppStore.getState() - expect(editorTabFileAccess(state, tab)).toEqual({ kind: 'user-file' }) - expect(editorTabDocumentFolderAccess(state, tab)).toEqual(documentFolder(filePath)) - const restored = { - filePath: tab.filePath, - relativePath: tab.relativePath, - worktreeId: tab.worktreeId, - runtimeEnvironmentId: tab.runtimeEnvironmentId - } - expect(editorTabFileAccess(state, restored)).toEqual({ kind: 'user-file' }) - - mocks.writeRuntimeFile.mockClear() - await createEditorSaveQueue(withLoadedBaselines(useAppStore)).queueSave(tab, 'edited', 'user') - expect(mocks.writeRuntimeFile).toHaveBeenCalledWith( - expect.anything(), - filePath, - 'edited', - { kind: 'user-file' }, - expect.anything(), - expect.any(Function) - ) -} - -async function renameTab(newName: string, worktreePath: string): Promise { - const tab = await onlyTab() - await renameFileOnDisk({ - oldPath: tab.filePath, - newName, - worktreeId: tab.worktreeId, - worktreePath, - operationOwner: { kind: 'local' }, - documentScoped: editorTabDocumentFolderAccess(useAppStore.getState(), tab) !== undefined - }) -} - -function renameCalls(): unknown[][] { - return mocks.renameRuntimePath.mock.calls.map((call) => call.slice(1)) -} - -beforeEach(async () => { - useAppStore.setState(useAppStore.getInitialState(), true) - useAppStore.setState({ repos: [repo], worktreesByRepo: { 'repo-local': [worktree] } }) - clearFileExplorerUndoHistory() - mocks.renameRuntimePath.mockReset().mockResolvedValue(undefined) - mocks.writeRuntimeFile.mockReset().mockResolvedValue({ ok: true }) - vi.stubGlobal('window', { - setTimeout, - clearTimeout, - dispatchEvent: vi.fn() - }) - main = await drawTabsFromMain(useAppStore) -}) - -afterEach(() => { - main.close() - vi.unstubAllGlobals() -}) - -describe('renaming a floating-workspace document, then Undo and Redo', () => { - const NOTE = '/home/me/notes/note.md' - - // Why the moved file is the document on Undo: main widens a rename only from the opened document. - it.each([ - ['another outside folder', '../other/note.md', '/home/me/notes/../other/note.md'], - [ - 'a project', - '../../../Users/me/project/note.md', - '/home/me/notes/../../../Users/me/project/note.md' - ], - ['a subfolder', 'archive/note.md', '/home/me/notes/archive/note.md'] - ])('moves it into %s and keeps it user-named', async (_, newName, moved) => { - openUserNamedTab(NOTE, FLOATING_TERMINAL_WORKTREE_ID) - - await renameTab(newName, '/home/me/notes') - await expectUserNamedAt(moved) - expect(await undoFileExplorer()).toBe(true) - await expectUserNamedAt(NOTE) - expect(await redoFileExplorer()).toBe(true) - await expectUserNamedAt(moved) - - expect(renameCalls()).toEqual([ - [NOTE, moved, documentFolder(NOTE)], - [moved, NOTE, documentFolder(moved)], - [NOTE, moved, documentFolder(NOTE)] - ]) - }) -}) diff --git a/src/renderer/src/lib/simulator/launch/open-mobile-emulator-tab.ts b/src/renderer/src/lib/simulator/launch/open-mobile-emulator-tab.ts index 4d5ce16a621..670a009e9ea 100644 --- a/src/renderer/src/lib/simulator/launch/open-mobile-emulator-tab.ts +++ b/src/renderer/src/lib/simulator/launch/open-mobile-emulator-tab.ts @@ -2,7 +2,6 @@ import { readLocalRuntimeCapabilitiesOrUnknown } from '@/runtime/hosts/capabilit import { EMULATOR_OPENING_PREFERENCES_CAPABILITY } from '../../../../../shared/emulator-runtime-capabilities' import { supportsEmulatorOpeningPreferences } from './emulator-opening-preferences-capability' import { toast } from 'sonner' -import type { EmulatorStreamInfo } from '@/components/emulator-pane/emulator-pane-types' import { callRuntimeRpc } from '@/runtime/rpc/calls/runtime-rpc-call' import { useAppStore } from '@/store/index' import { translate } from '@/i18n/i18n' @@ -20,8 +19,9 @@ import { cancelPendingSimulatorPaneShutdown, shutdownManagedSimulatorIfNoPane } from '../tabs/simulator-pane-shutdown-scheduler' -import { assertClientCreationActionAvailable } from '../../client-creation-action-policy' +import { assertClientCreationActionAvailable } from '../../workspace/creation/surface-policy/client-creation-action-policy' import { LOCAL_EXECUTION_HOST_ID } from '../../../../../shared/execution-host' +import type { EmulatorStreamInfo } from '@/components/emulator-pane/emulator-pane-types' type OpenMobileEmulatorTabOptions = { targetGroupId?: string diff --git a/src/renderer/src/lib/review-owner.ts b/src/renderer/src/lib/source-control/review/review-owner.ts similarity index 89% rename from src/renderer/src/lib/review-owner.ts rename to src/renderer/src/lib/source-control/review/review-owner.ts index 81e81eb9c84..876c570a7b0 100644 --- a/src/renderer/src/lib/review-owner.ts +++ b/src/renderer/src/lib/source-control/review/review-owner.ts @@ -1,5 +1,3 @@ -import type { Repo } from '../../../shared/repo-types' -import type { Worktree } from '../../../shared/worktree/types' import { getRepoExecutionHostId, getRepoSshConnectionId, @@ -8,11 +6,13 @@ import { parseExecutionHostId, toRuntimeExecutionHostId, toSshExecutionHostId -} from '../../../shared/execution-host' +} from '../../../../../shared/execution-host' import { findIndexedReviewRepository, hasIndexedRepository -} from './workspace/ownership/repository-owner-index' +} from '../../workspace/ownership/repository-owner-index' +import type { Repo } from '../../../../../shared/repo-types' +import type { Worktree } from '../../../../../shared/worktree/types' type ReviewWorkspaceOwner = Pick diff --git a/src/renderer/src/lib/structured-chat-tab-index.test.ts b/src/renderer/src/lib/structured-chat-tab-index.test.ts deleted file mode 100644 index ab0284b8979..00000000000 --- a/src/renderer/src/lib/structured-chat-tab-index.test.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { describe, expect, it } from 'vitest' -import type { Tab } from '../../../shared/tab-types' -import { structuredChatTabById, structuredChatTabBySessionId } from './structured-chat-tab-index' - -function tab(id: string, contentType: Tab['contentType'] = 'agent-session'): Tab { - return { - id, - entityId: `session-${id}`, - contentType, - groupId: 'group', - worktreeId: 'workspace', - label: 'Chat name', - customLabel: null, - color: null, - sortOrder: 0, - createdAt: 0 - } -} - -describe('structured chat tab index', () => { - it('indexes an immutable snapshot once across rows and lookup kinds', () => { - let reads = 0 - const structured = tab('chat') - const tabs = new Proxy([tab('terminal', 'terminal'), structured], { - get: (target, property) => { - if (property === '0' || property === '1') { - reads += 1 - } - // oxlint-disable-next-line anti-slop/no-reflect-get -- The test proxy counts array reads without changing iteration. - return Reflect.get(target, property) - } - }) - expect(structuredChatTabById({ workspace: tabs }, 'workspace', 'chat')).toBe(structured) - const initialReads = reads - expect(initialReads).toBeGreaterThan(0) - expect(structuredChatTabBySessionId({ workspace: tabs }, 'workspace', 'session-chat')).toBe( - structured - ) - expect(structuredChatTabById({ workspace: tabs }, 'workspace', 'terminal')).toBeUndefined() - expect(structuredChatTabById({ workspace: tabs }, 'workspace', 'missing')).toBeUndefined() - expect(reads).toBe(initialReads) - const renamed = { ...structured, customLabel: 'Manual name' } - expect( - structuredChatTabBySessionId({ workspace: [renamed] }, 'workspace', 'session-chat') - ).toBe(renamed) - expect(structuredChatTabById(undefined, 'workspace', 'chat')).toBeUndefined() - }) -}) diff --git a/src/renderer/src/lib/structured-session-open-consumers.test.tsx b/src/renderer/src/lib/structured-session-open-consumers.test.tsx deleted file mode 100644 index d677725c502..00000000000 --- a/src/renderer/src/lib/structured-session-open-consumers.test.tsx +++ /dev/null @@ -1,163 +0,0 @@ -// @vitest-environment happy-dom -import { act, cleanup, fireEvent, render, renderHook, waitFor } from '@testing-library/react' -import { afterEach, beforeEach, expect, it, vi } from 'vitest' -import { useAppStore } from '@/store' -import type { AiVaultSession } from '../../../shared/ai-vault/contracts/ai-vault-types' -import type { Tab } from '../../../shared/tab-types' -import { useAiVaultSessionLaunchActions } from '@/components/right-sidebar/ai-vault/session-actions/ai-vault-session-launch-actions' -import { useAiVaultOriginalPaneActions } from '@/components/right-sidebar/ai-vault/session-actions/ai-vault-original-pane-actions' -import { reportCliChatResumeFailure } from '@/components/tab-bar/cli-chat-resume-feedback' -import AiVaultSessionDropLayer from '@/components/tab-group/AiVaultSessionDropLayer' -import { writeAiVaultSessionDragData } from './agent-session/resume/history/ai-vault-session-drag' -const transport = vi.hoisted(() => ({ rpc: vi.fn(), toast: vi.fn() })) -vi.mock('sonner', () => ({ toast: { error: transport.toast, success: vi.fn() } })) -vi.mock('@/runtime/rpc/calls/runtime-rpc-call', async (original) => ({ - ...(await original>()), - callRuntimeRpc: transport.rpc -})) -vi.mock('@/runtime/local-structured-session-tabs-sync/inventory-refresh', () => ({ - refreshLocalStructuredSessionWorktreeTabs: async () => undefined -})) -const workspace = 'workspace' -const session: AiVaultSession = { - id: 'row', - executionHostId: 'local', - agent: 'codex', - sessionId: 'provider', - structuredSession: { workspaceId: workspace, sessionId: 'R' }, - title: 'History', - cwd: '/repo', - branch: null, - model: null, - filePath: '/fixture', - codexHome: null, - createdAt: null, - updatedAt: null, - modifiedAt: '2026-10-30', - messageCount: 1, - totalTokens: 0, - previewMessages: [], - queuedMessageCount: 0, - subagentTranscriptCount: 0, - resumeCommand: '', - subagent: null -} -function row(id: string, entityId: string): Tab { - return { - id, - entityId, - worktreeId: workspace, - executionHostId: 'local', - groupId: 'g', - contentType: 'agent-session', - agentSessionAgent: 'codex', - label: 'Chat', - customLabel: null, - color: null, - sortOrder: 0, - createdAt: 0 - } -} -function publish(tabs: Tab[]) { - useAppStore.setState({ - unifiedTabsByWorktree: { [workspace]: tabs }, - groupsByWorktree: { - [workspace]: [ - { id: 'g', worktreeId: workspace, activeTabId: null, tabOrder: tabs.map((tab) => tab.id) } - ] - }, - activeGroupIdByWorktree: { [workspace]: 'g' } - }) -} -beforeEach(() => { - vi.clearAllMocks() - useAppStore.setState(useAppStore.getInitialState(), true) - useAppStore.setState({ activeWorktreeId: workspace, activeWorkspaceExecutionHostId: 'local' }) - publish([row('actual-S', 'S')]) - transport.rpc.mockImplementation(async (_host, method) => - method === 'orchestration.partyLocation' - ? { location: { kind: 'chat', sessionId: 'S', worktreeId: workspace } } - : { ok: true } - ) -}) -afterEach(() => { - cleanup() - vi.restoreAllMocks() -}) -const selected = () => useAppStore.getState().groupsByWorktree[workspace]?.[0]?.activeTabId -it.each(['history', 'jump', 'drop', 'cli-conflict'] as const)( - 'the real %s consumer reaches the common default adapter and actual selected row', - async (consumer) => { - if (consumer === 'history') { - const hook = renderHook(() => - useAiVaultSessionLaunchActions({ - activeWorktree: null, - activeWorktreeId: workspace, - targetState: useAppStore.getState() - }) - ) - act(() => hook.result.current.handleResume(session)) - } else if (consumer === 'jump') { - publish([row('actual-R', 'R'), row('actual-S', 'S')]) - const hook = renderHook(() => useAiVaultOriginalPaneActions()) - await act(async () => { - await hook.result.current.jumpToOriginalPane(session) - }) - } else if (consumer === 'cli-conflict') { - await reportCliChatResumeFailure( - { - tabId: 'cli', - workspaceId: workspace, - paneKey: 'cli:leaf', - agent: 'codex', - providerSessionId: 'provider', - executionHostId: 'local' - }, - Object.assign(new Error('conflict'), { - refusal: { - code: 'agent_session_conflict', - details: { - reason: 'conversationHeldElsewhere', - owner: { sessionId: 'R', workspaceId: workspace } - } - } - }), - true, - { kind: 'local' } - ) - } else { - vi.spyOn(HTMLElement.prototype, 'getBoundingClientRect').mockReturnValue( - new DOMRect(0, 0, 400, 400) - ) - const view = render( - <> -
- - - ) - const data = new DataTransfer() - writeAiVaultSessionDragData(data, { - agent: 'codex', - sessionId: 'provider', - structuredSession: session.structuredSession, - title: 'History', - command: '' - }) - const event = new MouseEvent('drop', { bubbles: true, clientX: 200, clientY: 200 }) - Object.defineProperty(event, 'dataTransfer', { value: data }) - fireEvent(view.container.querySelector('[data-ai-vault-session-drop-layer]')!, event) - } - await waitFor(() => expect(selected()).toBe(consumer === 'jump' ? 'actual-R' : 'actual-S')) - expect(transport.rpc.mock.calls.map((call) => call[1])).toEqual( - consumer === 'jump' - ? ['session.tabs.activate'] - : ['orchestration.partyLocation', 'session.tabs.activate'] - ) - expect( - transport.rpc.mock.calls.every( - (call) => JSON.stringify(call[0]) === JSON.stringify({ kind: 'local' }) - ) - ).toBe(true) - expect(transport.toast).not.toHaveBeenCalled() - } -) diff --git a/src/renderer/src/lib/tab-agent-status-index.test.ts b/src/renderer/src/lib/tab-agent-status-index.test.ts deleted file mode 100644 index a97ada10892..00000000000 --- a/src/renderer/src/lib/tab-agent-status-index.test.ts +++ /dev/null @@ -1,299 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { - resolveFocusedCompletedTabAgent, - resolveFocusedRetainedTabAgent, - resolveFocusedTabAgent, - resolveSiblingCompletedTabAgent, - resolveSiblingRetainedTabAgent, - resolveSiblingTabAgent -} from './tab-agent' -import { agentTypeToIconAgent } from '../../../shared/agent-status/presentation/agent-type-icon-agent' -import { isTerminalLeafId, parsePaneKey } from '../../../shared/workspace-layout/stable-pane-id' -import type { - AgentStatusEntry, - AgentStatusState, - AgentType -} from '../../../shared/agent-status/contracts/agent-status-types' -import type { - TerminalLayoutSnapshot, - TerminalTab -} from '../../../shared/workspace-layout/terminal-tab-types' -import type { TerminalAgent } from '../../../shared/agent-status/identity/terminal-agent' -import type { RetainedAgentEntry } from '@/store/slices/agent-status/agent-status-contract' - -// Keep pre-index scans as the randomized differential oracle for exact resolver behavior. - -function oracleAnyTabAgent( - map: Record, - tabId: string, - excludedLeafId?: string -): TerminalAgent | null { - for (const [paneKey, entry] of Object.entries(map)) { - const parsed = parsePaneKey(paneKey) - if (parsed?.tabId === tabId && parsed.leafId !== excludedLeafId) { - const agent = entry.state === 'done' ? null : agentTypeToIconAgent(entry.agentType) - if (agent) { - return agent - } - } - } - return null -} - -function oracleAnyCompletedTabAgent( - map: Record, - tabId: string, - excludedLeafId?: string -): TerminalAgent | null { - for (const [paneKey, entry] of Object.entries(map)) { - const parsed = parsePaneKey(paneKey) - if (parsed?.tabId === tabId && parsed.leafId !== excludedLeafId) { - const agent = entry.state === 'done' ? agentTypeToIconAgent(entry.agentType) : null - if (agent) { - return agent - } - } - } - return null -} - -function oracleAnyRetainedTabAgent( - map: Record, - tabId: string, - excludedLeafId?: string -): TerminalAgent | null { - for (const [paneKey, retained] of Object.entries(map)) { - const parsed = parsePaneKey(paneKey) - if (parsed?.tabId === tabId && parsed.leafId !== excludedLeafId) { - const agent = agentTypeToIconAgent(retained.agentType) - if (agent) { - return agent - } - } - } - return null -} - -function activeLeafOf(layout: TerminalLayoutSnapshot | undefined): string | null { - const activeLeafId = layout?.activeLeafId - return activeLeafId && isTerminalLeafId(activeLeafId) ? activeLeafId : null -} - -const ORACLES = { - focused: ( - map: Record, - layout: TerminalLayoutSnapshot | undefined, - tabId: string - ): TerminalAgent | null => { - const activeLeafId = activeLeafOf(layout) - if (activeLeafId) { - const entry = map[`${tabId}:${activeLeafId}`] - return !entry || entry.state === 'done' ? null : agentTypeToIconAgent(entry.agentType) - } - return oracleAnyTabAgent(map, tabId) - }, - sibling: ( - map: Record, - layout: TerminalLayoutSnapshot | undefined, - tabId: string - ): TerminalAgent | null => { - const activeLeafId = activeLeafOf(layout) - return activeLeafId ? oracleAnyTabAgent(map, tabId, activeLeafId) : null - }, - focusedCompleted: ( - map: Record, - layout: TerminalLayoutSnapshot | undefined, - tabId: string - ): TerminalAgent | null => { - const activeLeafId = activeLeafOf(layout) - if (activeLeafId) { - const entry = map[`${tabId}:${activeLeafId}`] - return !entry || entry.state !== 'done' ? null : agentTypeToIconAgent(entry.agentType) - } - return oracleAnyCompletedTabAgent(map, tabId) - }, - siblingCompleted: ( - map: Record, - layout: TerminalLayoutSnapshot | undefined, - tabId: string - ): TerminalAgent | null => { - const activeLeafId = activeLeafOf(layout) - return activeLeafId ? oracleAnyCompletedTabAgent(map, tabId, activeLeafId) : null - }, - focusedRetained: ( - map: Record, - layout: TerminalLayoutSnapshot | undefined, - tabId: string - ): TerminalAgent | null => { - const activeLeafId = activeLeafOf(layout) - if (activeLeafId) { - return agentTypeToIconAgent(map[`${tabId}:${activeLeafId}`]?.agentType) - } - return oracleAnyRetainedTabAgent(map, tabId) - }, - siblingRetained: ( - map: Record, - layout: TerminalLayoutSnapshot | undefined, - tabId: string - ): TerminalAgent | null => { - const activeLeafId = activeLeafOf(layout) - return activeLeafId ? oracleAnyRetainedTabAgent(map, tabId, activeLeafId) : null - } -} - -function mulberry32(seed: number): () => number { - let a = seed >>> 0 - return () => { - a = (a + 0x6d2b79f5) >>> 0 - let t = Math.imul(a ^ (a >>> 15), 1 | a) - t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t - return ((t ^ (t >>> 14)) >>> 0) / 4294967296 - } -} - -function leafId(n: number): string { - const hex = n.toString(16).padStart(12, '0') - return `11111111-1111-4111-8111-${hex}` -} - -const STATES: readonly AgentStatusState[] = ['working', 'blocked', 'waiting', 'done'] -// Mixes iconable agents with ones agentTypeToIconAgent rejects. -const AGENT_TYPES: readonly (AgentType | undefined)[] = [ - 'claude', - 'codex', - 'gemini', - 'pi', - 'omp', - 'unknown', - 'some-custom-agent', - undefined -] - -function statusEntry( - paneKey: string, - state: AgentStatusState, - agentType?: AgentType -): AgentStatusEntry { - return { - state, - prompt: '', - updatedAt: 0, - stateStartedAt: 0, - paneKey, - stateHistory: [], - ...(agentType ? { agentType } : {}) - } -} - -function retainedEntry(paneKey: string, agentType: AgentType): RetainedAgentEntry { - const tabId = paneKey.slice(0, paneKey.indexOf(':')) - const tab: TerminalTab = { - id: tabId, - ptyId: null, - worktreeId: 'wt-1', - title: 'Terminal 1', - customTitle: null, - color: null, - sortOrder: 0, - createdAt: 0 - } - return { - entry: { ...statusEntry(paneKey, 'done', agentType), state: 'done' }, - worktreeId: tab.worktreeId, - tab, - agentType, - startedAt: 0 - } -} - -function layoutOf(activeLeafId: string | null): TerminalLayoutSnapshot { - return { root: null, activeLeafId, expandedLeafId: null } -} - -type RandomCase = { - statusMap: Record - retainedMap: Record - probes: { tabId: string; layout: TerminalLayoutSnapshot | undefined }[] -} - -function generateCase(random: () => number): RandomCase { - const tabCount = 1 + Math.floor(random() * 6) - const tabIds = Array.from({ length: tabCount }, (_, i) => `tab-${i}`) - const paneKeys: string[] = [] - for (const tabId of tabIds) { - const leafCount = 1 + Math.floor(random() * 4) - for (let leaf = 0; leaf < leafCount; leaf += 1) { - paneKeys.push(`${tabId}:${leafId(leaf)}`) - } - } - // Malformed keys the resolvers must skip, plus a shuffle so insertion order varies. - paneKeys.push('tab-0:not-a-uuid', 'no-colon-key', `:${leafId(0)}`, `tab-0:${leafId(0)}:extra`) - for (let i = paneKeys.length - 1; i > 0; i -= 1) { - const j = Math.floor(random() * (i + 1)) - ;[paneKeys[i], paneKeys[j]] = [paneKeys[j]!, paneKeys[i]!] - } - - const statusMap: Record = {} - const retainedMap: Record = {} - for (const paneKey of paneKeys) { - if (random() < 0.8) { - const state = STATES[Math.floor(random() * STATES.length)]! - statusMap[paneKey] = statusEntry( - paneKey, - state, - AGENT_TYPES[Math.floor(random() * AGENT_TYPES.length)] - ) - } - if (random() < 0.5) { - const agentType = AGENT_TYPES[Math.floor(random() * AGENT_TYPES.length)] ?? 'claude' - retainedMap[paneKey] = retainedEntry(paneKey, agentType) - } - } - - const probes = tabIds.concat('tab-absent').map((tabId) => { - const roll = random() - const layout = - roll < 0.2 - ? undefined - : roll < 0.35 - ? layoutOf(null) - : roll < 0.45 - ? layoutOf('not-a-uuid') - : layoutOf(leafId(Math.floor(random() * 5))) - return { tabId, layout } - }) - return { statusMap, retainedMap, probes } -} - -function expectParity(testCase: RandomCase): void { - for (const { tabId, layout } of testCase.probes) { - const { statusMap, retainedMap } = testCase - expect(resolveFocusedTabAgent(statusMap, layout, tabId)).toBe( - ORACLES.focused(statusMap, layout, tabId) - ) - expect(resolveSiblingTabAgent(statusMap, layout, tabId)).toBe( - ORACLES.sibling(statusMap, layout, tabId) - ) - expect(resolveFocusedCompletedTabAgent(statusMap, layout, tabId)).toBe( - ORACLES.focusedCompleted(statusMap, layout, tabId) - ) - expect(resolveSiblingCompletedTabAgent(statusMap, layout, tabId)).toBe( - ORACLES.siblingCompleted(statusMap, layout, tabId) - ) - expect(resolveFocusedRetainedTabAgent(retainedMap, layout, tabId)).toBe( - ORACLES.focusedRetained(retainedMap, layout, tabId) - ) - expect(resolveSiblingRetainedTabAgent(retainedMap, layout, tabId)).toBe( - ORACLES.siblingRetained(retainedMap, layout, tabId) - ) - } -} - -describe('tab agent status index parity with the pre-index full-map scan', () => { - it('matches the oracle across 250 randomized status maps', () => { - const random = mulberry32(0xc0ffee) - for (let caseIndex = 0; caseIndex < 250; caseIndex += 1) { - expectParity(generateCase(random)) - } - }) -}) diff --git a/src/renderer/src/lib/terminal-input-activity-coalescing.test.ts b/src/renderer/src/lib/terminal-input-activity-coalescing.test.ts deleted file mode 100644 index 7a93c89801b..00000000000 --- a/src/renderer/src/lib/terminal-input-activity-coalescing.test.ts +++ /dev/null @@ -1,100 +0,0 @@ -import { beforeEach, describe, expect, it, vi } from 'vitest' -import { - TERMINAL_INPUT_ACTIVITY_WRITE_INTERVAL_MS, - getPendingTerminalInputActivityCountForTests, - mergePendingTerminalInputActivity, - readLastTerminalInputAt, - recordTerminalInputActivity, - resetTerminalInputActivityCoalescingForTests -} from './terminal-input-activity-coalescing' - -const PANE = 'tab-1:leaf-1' - -// Minimal stand-in for the store slot the real commit writes into. -function createStore(initial: Record = {}) { - const stored: Record = { ...initial } - const writes: string[] = [] - return { - stored, - writes, - commit: { - insert: (paneKey: string, timestamp: number) => { - writes.push(`insert:${paneKey}`) - stored[paneKey] = timestamp - }, - refreshExisting: (entries: readonly (readonly [string, number])[]) => { - writes.push('flush') - for (const [paneKey, timestamp] of entries) { - const current = stored[paneKey] - if (current === undefined || current >= timestamp) { - continue - } - stored[paneKey] = timestamp - } - } - } - } -} - -function type(store: ReturnType, paneKey: string, timestamp: number): void { - recordTerminalInputActivity({ - paneKey, - timestamp, - forceWrite: store.stored[paneKey] === undefined, - commit: store.commit - }) -} - -describe('terminal input activity coalescing', () => { - beforeEach(() => { - vi.useFakeTimers() - resetTerminalInputActivityCoalescingForTests() - }) - - it('writes the first keystroke immediately and coalesces the burst', () => { - const store = createStore() - - // 40 keystrokes at 20ms apart = one 800ms burst. - for (let i = 0; i < 40; i++) { - type(store, PANE, 1_000 + i * 20) - } - - // Leading edge + one interval boundary crossing; no per-keystroke writes. - expect(store.writes.filter((w) => w.startsWith('insert')).length).toBeLessThanOrEqual(2) - expect(store.writes.length).toBeLessThan(5) - expect(store.stored[PANE]).toBeDefined() - }) - - it('keeps imperative reads fresh while a write is pending', () => { - const store = createStore() - - type(store, PANE, 1_000) - type(store, PANE, 1_100) - - expect(store.stored[PANE]).toBe(1_000) - expect(getPendingTerminalInputActivityCountForTests()).toBe(1) - expect(readLastTerminalInputAt(store.stored, PANE)).toBe(1_100) - expect(mergePendingTerminalInputActivity(store.stored)[PANE]).toBe(1_100) - }) - - it('flushes pending stamps into the store on the timer', () => { - const store = createStore() - - type(store, PANE, 1_000) - type(store, PANE, 1_100) - vi.advanceTimersByTime(TERMINAL_INPUT_ACTIVITY_WRITE_INTERVAL_MS + 1) - - expect(store.stored[PANE]).toBe(1_100) - expect(getPendingTerminalInputActivityCountForTests()).toBe(0) - }) - - it('writes immediately again once the coalescing window has passed', () => { - const store = createStore() - - type(store, PANE, 1_000) - type(store, PANE, 1_000 + TERMINAL_INPUT_ACTIVITY_WRITE_INTERVAL_MS) - - expect(store.writes).toEqual([`insert:${PANE}`, `insert:${PANE}`]) - expect(store.stored[PANE]).toBe(1_000 + TERMINAL_INPUT_ACTIVITY_WRITE_INTERVAL_MS) - }) -}) diff --git a/src/renderer/src/lib/terminal-themes-data.ts b/src/renderer/src/lib/terminal-themes-data.ts deleted file mode 100644 index c5babeb7698..00000000000 --- a/src/renderer/src/lib/terminal-themes-data.ts +++ /dev/null @@ -1,11 +0,0 @@ -import type { ITheme } from '@xterm/xterm' - -import { TERMINAL_THEME_CATALOG as TERMINAL_THEMES } from '../../../shared/terminal-themes/terminal-theme-catalog' - -export function getThemeNames(): string[] { - return Object.keys(TERMINAL_THEMES).sort() -} - -export function getTheme(name: string): ITheme | null { - return TERMINAL_THEMES[name] ?? null -} diff --git a/src/renderer/src/lib/terminal-theme.ts b/src/renderer/src/lib/terminal/appearance/terminal-theme.ts similarity index 85% rename from src/renderer/src/lib/terminal-theme.ts rename to src/renderer/src/lib/terminal/appearance/terminal-theme.ts index b4aa2b6f2db..557d31bf3b0 100644 --- a/src/renderer/src/lib/terminal-theme.ts +++ b/src/renderer/src/lib/terminal/appearance/terminal-theme.ts @@ -1,22 +1,20 @@ -import type { ITheme } from '@xterm/xterm' import { getTheme, getThemeNames } from './terminal-themes-data' -import type { GlobalSettings } from '../../../shared/global-settings-types' -import type { PluginTerminalThemeRegistration } from '../../../shared/plugins/artifacts/plugin-terminal-theme-artifact' import { makeCustomTerminalThemeSelection, normalizeTerminalCustomThemes, - terminalCustomThemeToXtermTheme, - type TerminalCustomTheme -} from '../../../shared/terminal-themes/terminal-custom-themes' -import { - resolveTerminalPalette, - type TerminalPaletteSettings -} from '../../../shared/terminal-themes/terminal-theme-selection' + terminalCustomThemeToXtermTheme +} from '../../../../../shared/terminal-themes/terminal-custom-themes' +import type { TerminalCustomTheme } from '../../../../../shared/terminal-themes/terminal-custom-themes' +import { resolveTerminalPalette } from '../../../../../shared/terminal-themes/terminal-theme-selection' +import type { TerminalPaletteSettings } from '../../../../../shared/terminal-themes/terminal-theme-selection' import { disambiguatedContentPluginNames, disambiguatedPluginContentLabels -} from '../components/plugins/presentation/plugin-name-disambiguation' -import type { Translate } from '../i18n/use-translate' +} from '../../../components/plugins/presentation/plugin-name-disambiguation' +import type { ITheme } from '@xterm/xterm' +import type { GlobalSettings } from '../../../../../shared/global-settings-types' +import type { PluginTerminalThemeRegistration } from '../../../../../shared/plugins/artifacts/plugin-terminal-theme-artifact' +import type { Translate } from '../../../i18n/use-translate' export const BUILTIN_TERMINAL_THEME_NAMES = getThemeNames() diff --git a/src/renderer/src/lib/terminal/appearance/terminal-themes-data.ts b/src/renderer/src/lib/terminal/appearance/terminal-themes-data.ts new file mode 100644 index 00000000000..0a786a27116 --- /dev/null +++ b/src/renderer/src/lib/terminal/appearance/terminal-themes-data.ts @@ -0,0 +1,10 @@ +import { TERMINAL_THEME_CATALOG } from '../../../../../shared/terminal-themes/terminal-theme-catalog' +import type { ITheme } from '@xterm/xterm' + +export function getThemeNames(): string[] { + return Object.keys(TERMINAL_THEME_CATALOG).sort() +} + +export function getTheme(name: string): ITheme | null { + return TERMINAL_THEME_CATALOG[name] ?? null +} diff --git a/src/renderer/src/lib/terminal-input-activity-coalescing.ts b/src/renderer/src/lib/terminal/input/terminal-input-activity-coalescing.ts similarity index 100% rename from src/renderer/src/lib/terminal-input-activity-coalescing.ts rename to src/renderer/src/lib/terminal/input/terminal-input-activity-coalescing.ts diff --git a/src/renderer/src/lib/use-tab-agent-opencode-native-title.test.ts b/src/renderer/src/lib/use-tab-agent-opencode-native-title.test.ts deleted file mode 100644 index 0439af65ad3..00000000000 --- a/src/renderer/src/lib/use-tab-agent-opencode-native-title.test.ts +++ /dev/null @@ -1,138 +0,0 @@ -// @vitest-environment happy-dom - -import { act, createElement } from 'react' -import { createRoot, type Root } from 'react-dom/client' -import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' -import { useAppStore } from '@/store' -import type { SleepingAgentSessionRecord } from '../../../shared/agent-session/lifecycle/agent-session-resume' -import { makePaneKey } from '../../../shared/workspace-layout/stable-pane-id' -import type { - TerminalLayoutSnapshot, - TerminalTab -} from '../../../shared/workspace-layout/terminal-tab-types' -import type { TerminalAgent } from '../../../shared/agent-status/identity/terminal-agent' -import '../../../shared/workspace-session/workspace-session-schema' -import '../../../shared/tab-agent-from-signals' -import { useTabAgent } from './use-tab-agent' - -globalThis.IS_REACT_ACT_ENVIRONMENT = true - -const initialAppState = useAppStore.getInitialState() -const FOCUSED_LEAF_ID = '11111111-1111-4111-8111-111111111111' -const SIBLING_LEAF_ID = '22222222-2222-4222-8222-222222222222' -let latestAgent: TerminalAgent | null | undefined -let root: Root | null = null - -function HookProbe({ tab }: { tab: TerminalTab }): null { - latestAgent = useTabAgent(tab) - return null -} - -function splitLayout(): TerminalLayoutSnapshot { - return { - root: null, - activeLeafId: FOCUSED_LEAF_ID, - expandedLeafId: null, - ptyIdsByLeafId: { - [FOCUSED_LEAF_ID]: 'pty-opencode', - [SIBLING_LEAF_ID]: 'pty-sibling' - } - } -} - -function sleepingClaudeRecord(paneKey: string): SleepingAgentSessionRecord { - return { - paneKey, - tabId: 'opencode-tab', - worktreeId: 'worktree-1', - agent: 'claude', - providerSession: { key: 'session_id', id: 'claude-session' }, - prompt: '', - state: 'working', - capturedAt: 1, - updatedAt: 1, - origin: 'live' - } -} - -describe('OpenCode native title tab identity', () => { - const originalApi = window.api - const getForegroundProcess = vi.fn() - const clearTabLaunchAgent = vi.fn() - const staleClaudeTab: TerminalTab = { - id: 'opencode-tab', - ptyId: 'pty-opencode', - worktreeId: 'worktree-1', - title: 'OC | Greeting', - customTitle: null, - color: null, - sortOrder: 0, - createdAt: 1, - launchAgent: 'claude' - } - - beforeEach(() => { - latestAgent = undefined - getForegroundProcess.mockReset() - clearTabLaunchAgent.mockReset() - useAppStore.setState(initialAppState, true) - useAppStore.setState({ - activeTabId: 'other-tab', - ptyIdsByTabId: { 'opencode-tab': ['pty-opencode'] }, - agentStatusByPaneKey: {}, - terminalLayoutsByTabId: {}, - clearTabLaunchAgent - }) - window.api = { - ...originalApi, - pty: { - ...originalApi?.pty, - getForegroundProcess - } - } as typeof window.api - }) - - afterEach(() => { - if (root) { - act(() => root?.unmount()) - root = null - } - document.body.replaceChildren() - useAppStore.setState(initialAppState, true) - window.api = originalApi - }) - - it('updates a mounted inactive/restored split without provider probes', async () => { - const container = document.createElement('div') - document.body.appendChild(container) - root = createRoot(container) - - await act(async () => { - root?.render(createElement(HookProbe, { tab: staleClaudeTab })) - await Promise.resolve() - }) - - expect(latestAgent).toBe('opencode') - expect(clearTabLaunchAgent).not.toHaveBeenCalled() - expect(getForegroundProcess).not.toHaveBeenCalled() - const paneKey = makePaneKey('opencode-tab', FOCUSED_LEAF_ID) - - await act(async () => { - useAppStore.setState({ - ptyIdsByTabId: { 'opencode-tab': ['pty-opencode', 'pty-sibling'] }, - terminalLayoutsByTabId: { 'opencode-tab': splitLayout() }, - sleepingAgentSessionsByPaneKey: { [paneKey]: sleepingClaudeRecord(paneKey) } - }) - root?.render( - createElement(HookProbe, { - tab: { ...staleClaudeTab, title: 'tmux | OC | Previous task' } - }) - ) - await Promise.resolve() - }) - - expect(latestAgent).toBe('claude') - expect(clearTabLaunchAgent).not.toHaveBeenCalled() - expect(getForegroundProcess).not.toHaveBeenCalled() - }) -}) diff --git a/src/renderer/src/lib/use-tab-agent.test.ts b/src/renderer/src/lib/use-tab-agent.test.ts deleted file mode 100644 index 2d809865687..00000000000 --- a/src/renderer/src/lib/use-tab-agent.test.ts +++ /dev/null @@ -1,247 +0,0 @@ -// @vitest-environment happy-dom - -import { act, createElement } from 'react' -import { createRoot, type Root } from 'react-dom/client' -import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' -import { useAppStore } from '@/store' -import type { AgentStatusEntry } from '../../../shared/agent-status/contracts/agent-status-types' -import { makePaneKey } from '../../../shared/workspace-layout/stable-pane-id' -import type { - TerminalLayoutSnapshot, - TerminalTab -} from '../../../shared/workspace-layout/terminal-tab-types' -import type { TerminalAgent } from '../../../shared/agent-status/identity/terminal-agent' -import '../../../shared/tab-agent-from-signals' -import { useTabAgent } from './use-tab-agent' - -const initialAppState = useAppStore.getInitialState() -const LEAF_ID = '11111111-1111-4111-8111-111111111111' -const SECOND_LEAF_ID = '22222222-2222-4222-8222-222222222222' -let latestHookAgent: TerminalAgent | null | undefined -const hookRoots: Root[] = [] - -function HookProbe({ tab }: { tab: TerminalTab }): null { - latestHookAgent = useTabAgent(tab) - return null -} - -async function renderHookProbe(tab: TerminalTab): Promise { - const container = document.createElement('div') - document.body.appendChild(container) - const root = createRoot(container) - hookRoots.push(root) - await act(async () => { - root.render(createElement(HookProbe, { tab })) - }) - await flushHookEffects() - return root -} - -async function rerenderHookProbe(root: Root, tab: TerminalTab): Promise { - await act(async () => { - root.render(createElement(HookProbe, { tab })) - }) - await flushHookEffects() -} - -async function flushHookEffects(): Promise { - await act(async () => { - await Promise.resolve() - await Promise.resolve() - }) -} - -function agentStatus(paneKey: string, state: AgentStatusEntry['state']): AgentStatusEntry { - return { - state, - prompt: '', - updatedAt: 1, - stateStartedAt: 1, - agentType: 'codex', - paneKey, - stateHistory: [] - } -} - -function workingAgentStatus(paneKey: string): AgentStatusEntry { - return agentStatus(paneKey, 'working') -} - -function twoPaneLayout(): TerminalLayoutSnapshot { - return { - root: null, - activeLeafId: LEAF_ID, - expandedLeafId: null, - ptyIdsByLeafId: { - [LEAF_ID]: 'pty-focus', - [SECOND_LEAF_ID]: 'pty-sibling' - } - } -} - -describe('useTabAgent', () => { - const originalApi = window.api - const getForegroundProcess = vi.fn() - const clearTabLaunchAgent = vi.fn() - const baseTab: TerminalTab = { - id: 'tab-1', - ptyId: 'pty-1', - worktreeId: 'wt-1', - title: 'Terminal 1', - customTitle: null, - color: null, - sortOrder: 0, - createdAt: 1, - launchAgent: 'codex' - } - - beforeEach(() => { - latestHookAgent = undefined - getForegroundProcess.mockReset() - clearTabLaunchAgent.mockReset() - useAppStore.setState(initialAppState, true) - useAppStore.setState({ - ptyIdsByTabId: { 'tab-1': ['pty-1'] }, - agentStatusByPaneKey: {}, - terminalLayoutsByTabId: {}, - clearTabLaunchAgent - }) - window.api = { - ...originalApi, - pty: { - ...originalApi?.pty, - getForegroundProcess - } - } as typeof window.api - }) - - afterEach(() => { - hookRoots.splice(0).forEach((root) => { - act(() => root.unmount()) - }) - document.body.replaceChildren() - useAppStore.setState(initialAppState, true) - window.api = originalApi - }) - - it('clears launch identity when a previously observed hook row drops at a shell title', async () => { - const paneKey = makePaneKey('tab-1', LEAF_ID) - useAppStore.setState({ - terminalLayoutsByTabId: { - 'tab-1': { - root: { type: 'leaf', leafId: LEAF_ID }, - activeLeafId: LEAF_ID, - expandedLeafId: null, - ptyIdsByLeafId: { [LEAF_ID]: 'pty-1' } - } - }, - agentStatusByPaneKey: { - [paneKey]: workingAgentStatus(paneKey) - } - }) - - const root = await renderHookProbe(baseTab) - - expect(latestHookAgent).toBe('codex') - expect(clearTabLaunchAgent).not.toHaveBeenCalled() - - // Why: crash/kill exits drop the live row without a completed hook. - await act(async () => { - useAppStore.setState({ agentStatusByPaneKey: {} }) - }) - await rerenderHookProbe(root, { ...baseTab, title: 'zsh' }) - - expect(clearTabLaunchAgent).toHaveBeenCalledWith('tab-1') - }) - - it('does not clear remote launch identity when the hook row drops at a shell title', async () => { - const remotePtyId = 'remote:web-env-1@@terminal-1' - const paneKey = makePaneKey('tab-1', LEAF_ID) - useAppStore.setState({ - ptyIdsByTabId: { 'tab-1': [remotePtyId] }, - terminalLayoutsByTabId: { - 'tab-1': { - root: { type: 'leaf', leafId: LEAF_ID }, - activeLeafId: LEAF_ID, - expandedLeafId: null, - ptyIdsByLeafId: { [LEAF_ID]: remotePtyId } - } - }, - agentStatusByPaneKey: { - [paneKey]: workingAgentStatus(paneKey) - } - }) - const remoteTab = { ...baseTab, ptyId: remotePtyId, launchAgent: 'claude' as const } - - const root = await renderHookProbe(remoteTab) - - // Remote transport gaps do not prove exit; require completion evidence to clear identity. - await act(async () => { - useAppStore.setState({ agentStatusByPaneKey: {} }) - }) - await rerenderHookProbe(root, { ...remoteTab, title: 'zsh' }) - - expect(clearTabLaunchAgent).not.toHaveBeenCalled() - expect(latestHookAgent).toBe('claude') - }) - - it('does not clear launch identity while a sibling hook row is still live', async () => { - const focusedPaneKey = makePaneKey('tab-1', LEAF_ID) - const siblingPaneKey = makePaneKey('tab-1', SECOND_LEAF_ID) - useAppStore.setState({ - ptyIdsByTabId: { 'tab-1': ['pty-focus', 'pty-sibling'] }, - terminalLayoutsByTabId: { 'tab-1': twoPaneLayout() }, - agentStatusByPaneKey: { - [focusedPaneKey]: workingAgentStatus(focusedPaneKey), - [siblingPaneKey]: workingAgentStatus(siblingPaneKey) - } - }) - const splitTab = { ...baseTab, ptyId: 'pty-focus', launchAgent: 'claude' as const } - - const root = await renderHookProbe(splitTab) - - await act(async () => { - useAppStore.setState({ - agentStatusByPaneKey: { [siblingPaneKey]: workingAgentStatus(siblingPaneKey) } - }) - }) - await rerenderHookProbe(root, { ...splitTab, title: 'zsh' }) - expect(clearTabLaunchAgent).not.toHaveBeenCalled() - - await act(async () => { - useAppStore.setState({ agentStatusByPaneKey: {} }) - }) - await rerenderHookProbe(root, { ...splitTab, title: 'zsh' }) - expect(clearTabLaunchAgent).toHaveBeenCalledWith('tab-1') - }) - - it('does not clear launch identity on the commit that switches pane generations', async () => { - const paneKey = makePaneKey('tab-1', LEAF_ID) - const boundLayout = { - root: { type: 'leaf', leafId: LEAF_ID } as const, - activeLeafId: LEAF_ID, - expandedLeafId: null, - ptyIdsByLeafId: { [LEAF_ID]: 'pty-1' } - } - useAppStore.setState({ - terminalLayoutsByTabId: { 'tab-1': boundLayout }, - agentStatusByPaneKey: { [paneKey]: workingAgentStatus(paneKey) } - }) - - const root = await renderHookProbe(baseTab) - expect(latestHookAgent).toBe('codex') - - // Respawn can replace PTY, drop hook and show shell in one commit; old-generation observations must not clear new launch intent. - await act(async () => { - useAppStore.setState({ - terminalLayoutsByTabId: { - 'tab-1': { ...boundLayout, ptyIdsByLeafId: { [LEAF_ID]: 'pty-2' } } - }, - agentStatusByPaneKey: {} - }) - }) - await rerenderHookProbe(root, { ...baseTab, title: 'zsh' }) - - expect(clearTabLaunchAgent).not.toHaveBeenCalled() - }) -}) diff --git a/src/renderer/src/lib/wake-sleeping-agents-live-unmounted-pane.test.ts b/src/renderer/src/lib/wake-sleeping-agents-live-unmounted-pane.test.ts deleted file mode 100644 index 85fa9c6fcc6..00000000000 --- a/src/renderer/src/lib/wake-sleeping-agents-live-unmounted-pane.test.ts +++ /dev/null @@ -1,202 +0,0 @@ -// @vitest-environment happy-dom - -import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' -import type { SleepingAgentSessionRecord } from '../../../shared/agent-session/lifecycle/agent-session-resume' -import type { PtyListedSession } from '../../../shared/terminal/pty/lifecycle/pty-listed-session' -import { makePaneKey } from '../../../shared/workspace-layout/stable-pane-id' -import { useAppStore } from '@/store' -import type { AppState } from '@/store/types' -import { wakeSleepingAgentsForWorktreeInBackground } from './agent-session/resume/wake-sleeping-agents-in-background' -import { waitForWorktreeAgentActivationGateForTests } from './workspace/activation/worktree-agent-activation-gate' - -// Main's answer to the window's layout commands, as a switch-on build sends them. -vi.mock('@/runtime/rpc/calls/runtime-rpc-call', async (importOriginal) => - ( - await import('@/runtime/workspace-layout/testing/layout-apply-test-transport.test-fixture') - ).runtimeRpcClientWithLayoutApply(await importOriginal()) -) - -const initialAppStoreState = useAppStore.getState() -const WT = 'repo-1::/repo' -const LEAF_ID = '11111111-1111-4111-8111-111111111111' -const PANE_KEY = makePaneKey('tab-live', LEAF_ID) -const LIVE_PTY_ID = `${WT}@@66acae23` -const SESSION = { - key: 'session_id', - id: '720b368a-0168-4083-9f8c-862cd559ac51' -} as const - -let listedSessions: PtyListedSession[] = [] -let listSessions: ReturnType - -function liveRecord(): SleepingAgentSessionRecord { - return { - paneKey: PANE_KEY, - tabId: 'tab-live', - worktreeId: WT, - agent: 'claude', - providerSession: SESSION, - prompt: '', - state: 'working', - origin: 'live', - capturedAt: Date.now(), - updatedAt: Date.now() - } -} - -// After renderer restart, daemon PTYs can survive behind persisted layouts while another workspace is active and no pane reattached. -function unmountedLivePaneState(): Partial { - return { - workspaceSessionReady: true, - terminalStartupRestorationReady: true, - activeWorktreeId: 'repo-1::/other', - repos: [ - { - id: 'repo-1', - path: '/repo', - displayName: 'repo', - badgeColor: '#000', - addedAt: 1 - } - ], - tabsByWorktree: { - [WT]: [ - { - id: 'tab-live', - ptyId: null, - worktreeId: WT, - title: 'Terminal 1', - customTitle: null, - color: null, - sortOrder: 0, - createdAt: 1 - } - ] - }, - ptyIdsByTabId: {}, - terminalLayoutsByTabId: { - 'tab-live': { - root: { type: 'leaf', leafId: LEAF_ID }, - activeLeafId: LEAF_ID, - expandedLeafId: null, - ptyIdsByLeafId: { [LEAF_ID]: LIVE_PTY_ID } - } - }, - sleepingAgentSessionsByPaneKey: { [PANE_KEY]: liveRecord() } - } -} - -async function wakeAndSettle(): Promise { - wakeSleepingAgentsForWorktreeInBackground(WT) - return waitForWorktreeAgentActivationGateForTests(WT) -} - -function queuedResumes(): unknown[] { - return Object.values(useAppStore.getState().pendingStartupByTabId).map( - (startup) => startup.resumeProviderSession - ) -} - -beforeEach(() => { - listedSessions = [] - listSessions = vi.fn(async () => listedSessions) - // oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: the wake path reads only these preload methods. - ;(window as unknown as { api: unknown }).api = { - pty: { listSessions }, - runtimeEnvironments: {}, - runtime: { - call: vi.fn(async ({ method }: { method: string }) => - method === 'session.tabs.list' - ? { ok: true, result: { worktree: WT, tabs: [] } } - : { ok: false } - ) - } - } -}) - -afterEach(() => { - useAppStore.setState(initialAppStoreState, true) -}) - -describe('background wake of a pane whose PTY the host still holds', () => { - it('does not resume a second writer onto the live conversation', async () => { - useAppStore.setState(unmountedLivePaneState()) - listedSessions = [ - { - id: LIVE_PTY_ID, - cwd: '/repo', - title: 'claude', - agentOwnership: 'present' - } - ] - - await wakeAndSettle() - - expect(listSessions).toHaveBeenCalledWith({ connectionId: null }) - expect(queuedResumes()).toEqual([]) - expect(Object.keys(useAppStore.getState().automaticAgentResumeClaimsByTabId)).toEqual([]) - }) - - it('declines the resume and keeps the record when the host inventory cannot be read', async () => { - useAppStore.setState(unmountedLivePaneState()) - listSessions.mockRejectedValue(new Error('daemon unreachable')) - - expect(await wakeAndSettle()).toBe('blocked') - - expect(queuedResumes()).toEqual([]) - expect(useAppStore.getState().sleepingAgentSessionsByPaneKey[PANE_KEY]).toBeDefined() - }) - - it('still resumes once the host inventory shows the PTY exited', async () => { - useAppStore.setState(unmountedLivePaneState()) - - expect(await wakeAndSettle()).toBe('resumed') - - expect(queuedResumes()).toEqual([SESSION]) - }) - - // #21235: the host re-keyed the live PTY onto a new tab, so the record's pane has no layout. - it('does not resume an agent whose PTY the host moved to another tab', async () => { - const state = unmountedLivePaneState() - useAppStore.setState({ - ...state, - tabsByWorktree: { - [WT]: [{ ...state.tabsByWorktree![WT]![0]!, id: 'tab-rekeyed', ptyId: LIVE_PTY_ID }] - }, - ptyIdsByTabId: { 'tab-rekeyed': [LIVE_PTY_ID] }, - terminalLayoutsByTabId: {} - }) - // A fresh `claude` launch registers no owner claim; only its spawn pane key ties it to the record. - listedSessions = [ - { - id: LIVE_PTY_ID, - cwd: '/repo', - title: 'claude', - agentOwnership: 'absent', - paneKey: PANE_KEY - } - ] - - await wakeAndSettle() - - expect(queuedResumes()).toEqual([]) - expect(useAppStore.getState().sleepingAgentSessionsByPaneKey[PANE_KEY]).toBeDefined() - }) - - it('still resumes a dead agent next to a shell spawned for another pane', async () => { - useAppStore.setState({ ...unmountedLivePaneState(), terminalLayoutsByTabId: {} }) - listedSessions = [ - { - id: `${WT}@@sibling-shell`, - cwd: '/repo', - title: 'zsh', - agentOwnership: 'absent', - paneKey: makePaneKey('tab-live', '22222222-2222-4222-8222-222222222222') - } - ] - - expect(await wakeAndSettle()).toBe('resumed') - - expect(queuedResumes()).toEqual([SESSION]) - }) -}) diff --git a/src/renderer/src/lib/workspace-ports/workspace-port-actions.ts b/src/renderer/src/lib/workspace-ports/workspace-port-actions.ts index 4e11843d2a8..520942ca831 100644 --- a/src/renderer/src/lib/workspace-ports/workspace-port-actions.ts +++ b/src/renderer/src/lib/workspace-ports/workspace-port-actions.ts @@ -1,22 +1,22 @@ import { translate } from '@/i18n/i18n' import { activateAndRevealWorktree } from '@/lib/workspace/activation/worktree-activation' -import type { useAppStore } from '@/store/index' import { assertRuntimeEnvironmentCapability } from '@/runtime/rpc/compatibility/runtime-capability-proof' import { callRuntimeRpc } from '@/runtime/rpc/calls/runtime-rpc-call' import { RuntimeRpcCallError } from '@/runtime/rpc/calls/runtime-rpc-result' -import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target' import { toRuntimeWorktreeSelector } from '@/runtime/rpc/targets/runtime-worktree-selector' +import { runWorkspacePortScanForTarget } from './workspace-port-scan-client' +import { browserUrlForPort } from './workspace-port-urls' +import { createNonSecureContextUuid as createBrowserUuid } from '../../../../shared/non-secure-context-uuid' +import { BROWSER_SCREENCAST_RUNTIME_CAPABILITY } from '../../../../shared/browser/runtime/browser-runtime-capabilities' +import { RUNTIME_BROWSER_UNAVAILABLE_MESSAGE } from '../workspace/creation/surface-policy/client-creation-action-policy' +import type { useAppStore } from '@/store/index' +import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target' import type { WorkspacePort, WorkspacePortKillResult, WorkspacePortScanResult } from '../../../../shared/workspace-ports' import type { LocalhostWorktreeLabelRoute } from '../../../../shared/localhost-worktree-labels' -import { runWorkspacePortScanForTarget } from './workspace-port-scan-client' -import { browserUrlForPort } from './workspace-port-urls' -import { createNonSecureContextUuid as createBrowserUuid } from '../../../../shared/non-secure-context-uuid' -import { BROWSER_SCREENCAST_RUNTIME_CAPABILITY } from '../../../../shared/browser/runtime/browser-runtime-capabilities' -import { RUNTIME_BROWSER_UNAVAILABLE_MESSAGE } from '../client-creation-action-policy' const WORKSPACE_PORT_STOP_SETTLE_MS = 500 const WORKSPACE_PORT_TARGET_UNAVAILABLE_REASON = diff --git a/src/renderer/src/lib/client-creation-action-error.ts b/src/renderer/src/lib/workspace/creation/surface-policy/client-creation-action-error.ts similarity index 75% rename from src/renderer/src/lib/client-creation-action-error.ts rename to src/renderer/src/lib/workspace/creation/surface-policy/client-creation-action-error.ts index b61b358382b..1ec40797871 100644 --- a/src/renderer/src/lib/client-creation-action-error.ts +++ b/src/renderer/src/lib/workspace/creation/surface-policy/client-creation-action-error.ts @@ -1,9 +1,7 @@ import { toast } from 'sonner' -import { useAppStore } from '@/store' -import { - getClientCreationActionPolicy, - type ClientCreationAction -} from './client-creation-action-policy' +import { useAppStore } from '@/store/index' +import { getClientCreationActionPolicy } from './client-creation-action-policy' +import type { ClientCreationAction } from './client-creation-action-policy' export function showClientCreationActionError(error: unknown): void { toast.error(error instanceof Error ? error.message : String(error)) diff --git a/src/renderer/src/lib/client-creation-action-policy.ts b/src/renderer/src/lib/workspace/creation/surface-policy/client-creation-action-policy.ts similarity index 87% rename from src/renderer/src/lib/client-creation-action-policy.ts rename to src/renderer/src/lib/workspace/creation/surface-policy/client-creation-action-policy.ts index 2bb969d5a61..db67e602f4c 100644 --- a/src/renderer/src/lib/client-creation-action-policy.ts +++ b/src/renderer/src/lib/workspace/creation/surface-policy/client-creation-action-policy.ts @@ -1,16 +1,14 @@ -import { FLOATING_TERMINAL_WORKTREE_ID } from '../../../shared/constants' -import '../../../shared/protocol-version' -import { BROWSER_SCREENCAST_RUNTIME_CAPABILITY } from '../../../shared/browser/runtime/browser-runtime-capabilities' -import type { RuntimeStatus } from '../../../shared/runtime-session-contracts' +import { FLOATING_TERMINAL_WORKTREE_ID } from '../../../../../../shared/constants' +import '../../../../../../shared/protocol-version' +import { BROWSER_SCREENCAST_RUNTIME_CAPABILITY } from '../../../../../../shared/browser/runtime/browser-runtime-capabilities' +import { isPairedWebClientWindow } from '../../../../app-shell/chrome/desktop-window-chrome' +import { runtimeEnvironmentIdOrLocalUnlessTwin } from '../../ownership/worktree-runtime-owner' +import { expectsBrowserClientHosting } from '../../../../../../shared/browser/client-hosting/browser-client-hosting-eligibility' +import { getOrcadSshDeployment } from '../../../../../../shared/remote-runtime/host-catalog/runtime-environments' +import type { PublicKnownRuntimeEnvironment } from '../../../../../../shared/remote-runtime/host-catalog/runtime-environments' +import type { RuntimeStatus } from '../../../../../../shared/runtime-session-contracts' import type { AppState } from '@/store/types' -import { isPairedWebClientWindow } from '../app-shell/chrome/desktop-window-chrome' -import { runtimeEnvironmentIdOrLocalUnlessTwin } from './workspace/ownership/worktree-runtime-owner' -import { expectsBrowserClientHosting } from '../../../shared/browser/client-hosting/browser-client-hosting-eligibility' -import { - getOrcadSshDeployment, - type PublicKnownRuntimeEnvironment -} from '../../../shared/remote-runtime/host-catalog/runtime-environments' -import type { GlobalSettings } from '../../../shared/global-settings-types' +import type { GlobalSettings } from '../../../../../../shared/global-settings-types' export const MANAGED_BROWSER_UNAVAILABLE_MESSAGE = "Managed browser tabs are unavailable because this web client's paired runtime does not support browser streaming." diff --git a/src/renderer/src/lib/workspace/creation/work-item/launch-work-item-direct-preflight.ts b/src/renderer/src/lib/workspace/creation/work-item/launch-work-item-direct-preflight.ts index f28b5b52b58..9c47f41f1ec 100644 --- a/src/renderer/src/lib/workspace/creation/work-item/launch-work-item-direct-preflight.ts +++ b/src/renderer/src/lib/workspace/creation/work-item/launch-work-item-direct-preflight.ts @@ -1,18 +1,14 @@ import { invalidTerminalArgsMessage } from './launch-work-item-direct-messages' -import { - planAgentCliArgsSuffix, - type AgentStartupShell -} from '../../../../../../shared/agent-launch/startup/tui-agent-startup-shell' - +import { planAgentCliArgsSuffix } from '../../../../../../shared/agent-launch/startup/tui-agent-startup-shell' +import type { AgentStartupShell } from '../../../../../../shared/agent-launch/startup/tui-agent-startup-shell' import { readAgentLaunchPreferencesForWorkspace } from '@/runtime/agent-launch-settings/use-host-agent-launch-preferences' import { useAppStore } from '@/store/index' -import type { AppState } from '@/store/types' import { ensureDetectedAgentsForRepo, loadProjectLaunchContext } from '../../../agent-session/launch/inventory/agent-detection-target-inventory' import { CLIENT_PLATFORM } from '../new-workspace' -import { getLocalRepoProjectExecutionRuntimeContext } from '../../../local-preflight-context' +import { getLocalRepoProjectExecutionRuntimeContext } from '../../../../runtime/hosts/preflight/local-preflight-context' import { refineLocalLaunchPlatform, resolveRepoExecutionHostPlatform @@ -20,21 +16,21 @@ import { import { isTuiAgentEnabled } from '../../../../../../shared/agent-launch/catalog/tui-agent-selection' import { resolveDefaultAgentForWorkspace } from '../../../agent-session/launch/shortcuts/agent-tab-shortcuts' import { isTuiAgent } from '../../../../../../shared/agent-launch/catalog/tui-agent-config' +import { + awaitStructuredRouteHostAnswer, + planAgentSessionLaunch +} from '../../../agent-session/launch/routing/agent-session-launch-plan' +import type { AgentSessionLaunchRequest } from '../../../agent-session/launch/routing/agent-session-launch-plan' +import { resolveGitHubPrStartPointForRepo } from '@/lib/source-control/review/github-pr-start-point' +import { getRepoExecutionHostId } from '../../../../../../shared/execution-host' +import type { ExecutionHostId } from '../../../../../../shared/execution-host' +import { ipcOrRuntimeTargetForHostId } from '@/runtime/rpc/targets/runtime-client-target' +import '../setup/workspace-setup-preparation' +import type { AppState } from '@/store/types' import type { TuiAgent } from '../../../../../../shared/agent-launch/catalog/tui-agent' import type { ProjectLaunchContext } from '../../../../../../shared/rpc-contract/preflight-params' import type { AgentLaunchRequestId } from '../../../agent-session/launch/routing/agent-launch-request-id' -import { - awaitStructuredRouteHostAnswer, - planAgentSessionLaunch, - type AgentSessionLaunchRequest -} from '../../../agent-session/launch/routing/agent-session-launch-plan' -import { resolveGitHubPrStartPointForRepo } from '@/lib/source-control/review/github-pr-start-point' import type { RuntimeClientTarget } from '../../../../../../shared/runtime-client-target' -import { - getRepoExecutionHostId, - type ExecutionHostId -} from '../../../../../../shared/execution-host' -import { ipcOrRuntimeTargetForHostId } from '@/runtime/rpc/targets/runtime-client-target' import type { Repo } from '../../../../../../shared/repo-types' import type { GitHubPrStartPoint } from '../../../../../../shared/worktree/types' import type { @@ -63,8 +59,6 @@ export async function resolveDirectPrStartPoint( }) } -import '../setup/workspace-setup-preparation' - export type DirectLaunchOwnerRow = { repo: Repo executionHostId: ExecutionHostId diff --git a/src/renderer/src/lib/workspace/creation/work-item/launch-work-item-direct-route-preparation.ts b/src/renderer/src/lib/workspace/creation/work-item/launch-work-item-direct-route-preparation.ts index 4960b1df65c..6999850654e 100644 --- a/src/renderer/src/lib/workspace/creation/work-item/launch-work-item-direct-route-preparation.ts +++ b/src/renderer/src/lib/workspace/creation/work-item/launch-work-item-direct-route-preparation.ts @@ -1,33 +1,33 @@ import { ensureAgentLaunchPreferences } from '@/runtime/agent-launch-settings/use-host-agent-launch-preferences' -import type { TuiAgent } from '../../../../../../shared/agent-launch/catalog/tui-agent' -import type { AppState } from '@/store/types' import { getConnectionIdFromState } from '@/lib/workspace/ownership/connection-owner-resolution' -import type { RepoHostFields } from '@/lib/agent-session/launch/inventory/agent-detection-target-inventory' -import type { ProjectExecutionRuntimeResolution } from '../../../../../../shared/execution-host/project-execution-runtime' import { refineLocalLaunchPlatform, - resolveRepoExecutionHostPlatform, - type KnownExecutionHostPlatform + resolveRepoExecutionHostPlatform } from '@/runtime/hosts/platform/execution-host-facts' +import type { KnownExecutionHostPlatform } from '@/runtime/hosts/platform/execution-host-facts' import { CLIENT_PLATFORM } from '@/lib/workspace/creation/new-workspace' -import { getLocalProjectExecutionRuntimeContext } from '@/lib/local-preflight-context' +import { getLocalProjectExecutionRuntimeContext } from '@/runtime/hosts/preflight/local-preflight-context' import { resolveLocalWindowsTerminalShellOverrideForTab } from '../../../../../../shared/local-windows-terminal-runtime' import { isWslUncPath } from '../../../../../../shared/wsl-paths' +import { adoptAgentSessionLaunchVerdict } from '@/lib/agent-session/launch/routing/agent-session-launch-plan' import type { AgentSessionLaunchPlan, planAgentSessionLaunch } from '@/lib/agent-session/launch/routing/agent-session-launch-plan' -import { adoptAgentSessionLaunchVerdict } from '../../../agent-session/launch/routing/agent-session-launch-plan' import { directLaunchSurfaceRequest } from './launch-work-item-direct-preflight' +import { + buildDirectWorkItemStartup, + resolveDirectWorkItemAgent +} from '@/lib/workspace/creation/work-item/launch-work-item-direct-agent-routing' +import type { TuiAgent } from '../../../../../../shared/agent-launch/catalog/tui-agent' +import type { AppState } from '@/store/types' +import type { RepoHostFields } from '@/lib/agent-session/launch/inventory/agent-detection-target-inventory' +import type { ProjectExecutionRuntimeResolution } from '../../../../../../shared/execution-host/project-execution-runtime' import type { DirectWorkItemLaunchInputs, LaunchWorkItemDirectArgs } from './launch-work-item-direct-types' import type { AgentLaunchRequestId } from '@/lib/agent-session/launch/routing/agent-launch-request-id' -import { - buildDirectWorkItemStartup, - resolveDirectWorkItemAgent -} from '@/lib/workspace/creation/work-item/launch-work-item-direct-agent-routing' export type DirectWorkItemAgentLaunchPreparation = { launchConnectionId: string | null diff --git a/src/renderer/src/lib/workspace/search/tabs/workspace-tab-palette-entry-builder.ts b/src/renderer/src/lib/workspace/search/tabs/workspace-tab-palette-entry-builder.ts index e76a46298f2..e832aed2aa8 100644 --- a/src/renderer/src/lib/workspace/search/tabs/workspace-tab-palette-entry-builder.ts +++ b/src/renderer/src/lib/workspace/search/tabs/workspace-tab-palette-entry-builder.ts @@ -2,7 +2,6 @@ import { resolveTerminalTabTitle, resolveUnifiedTabLabel } from '../../../../../../shared/tab-title-resolution' -import type { Tab } from '../../../../../../shared/tab-types' import { getEditorDisplayLabel } from '@/components/editor/editor-labels' import { buildPaletteTabDocument } from '../../../../../../shared/palette-match/tab-document' import { @@ -10,7 +9,7 @@ import { isPaletteCurrentWorktree, resolvePaletteRepoForWorktree } from '../palette-repo-resolution' -import { resolveOpenTabOccupantAgent } from '../../../open-tab-occupant-agent' +import { resolveOpenTabOccupantAgent } from '../../../agent-session/tab-identity/open-tab-occupant-agent' import { resolveWorktreeBranchLabel, resolveWorktreeDisplayName @@ -19,11 +18,6 @@ import { buildAgentMetadataTabIndex, collectAgentMetadataFromIndex } from './workspace-tab-agent-metadata' -import type { - BuildSearchableWorkspaceTabsOptions, - SearchableWorkspaceTab, - WorkspaceTabContentType -} from './workspace-tab-search-types' import { findAmbiguousWorktreeIds, findDuplicateIds, @@ -32,12 +26,18 @@ import { isOpenFileOwnedByWorktree, isUnifiedTabOwnedByWorktree } from '../../ownership/unified-tab-host-ownership' -import type { OpenFile } from '@/store/slices/editor/types/open-file' -import type { TerminalTab } from '../../../../../../shared/workspace-layout/terminal-tab-types' import { isWorkspaceTabContentType } from './workspace-tab-palette-content-type' import { getActiveUnifiedTabId, isCurrentWorkspaceTab } from './workspace-tab-palette-current-tab' import { projectedStructuredChatTabName } from '@/runtime/native-chat/naming/structured-chat-tab-name' import { agentTypeToIconAgent } from '../../../../../../shared/agent-status/presentation/agent-type-icon-agent' +import type { Tab } from '../../../../../../shared/tab-types' +import type { + BuildSearchableWorkspaceTabsOptions, + SearchableWorkspaceTab, + WorkspaceTabContentType +} from './workspace-tab-search-types' +import type { OpenFile } from '@/store/slices/editor/types/open-file' +import type { TerminalTab } from '../../../../../../shared/workspace-layout/terminal-tab-types' export function buildSearchableWorkspaceTabEntries({ worktrees, diff --git a/src/renderer/src/lib/worktree-sleep-intent.ts b/src/renderer/src/lib/workspace/sleep/worktree-sleep-intent.ts similarity index 100% rename from src/renderer/src/lib/worktree-sleep-intent.ts rename to src/renderer/src/lib/workspace/sleep/worktree-sleep-intent.ts diff --git a/src/renderer/src/lib/unified-tab-anchor-insertion.ts b/src/renderer/src/lib/workspace/tabs/unified-tab-anchor-insertion.ts similarity index 88% rename from src/renderer/src/lib/unified-tab-anchor-insertion.ts rename to src/renderer/src/lib/workspace/tabs/unified-tab-anchor-insertion.ts index 7192bf7c165..ea1126de250 100644 --- a/src/renderer/src/lib/unified-tab-anchor-insertion.ts +++ b/src/renderer/src/lib/workspace/tabs/unified-tab-anchor-insertion.ts @@ -1,5 +1,5 @@ -import { useAppStore } from '../store' -import { insertTabIdIntoOrder } from '../../../shared/workspace-layout/tab-order' +import { useAppStore } from '../../../store/index' +import { insertTabIdIntoOrder } from '../../../../../shared/workspace-layout/tab-order' /** Move `tabId` to sit immediately after `anchorTabId`; no-op unless both share a live group. */ export function insertUnifiedTabAfterAnchor( diff --git a/src/renderer/src/lib/worktree-creation-host-inputs.test.ts b/src/renderer/src/lib/worktree-creation-host-inputs.test.ts deleted file mode 100644 index 7ebe35faa79..00000000000 --- a/src/renderer/src/lib/worktree-creation-host-inputs.test.ts +++ /dev/null @@ -1,58 +0,0 @@ -// @vitest-environment happy-dom -import { beforeEach, expect, it, vi } from 'vitest' -import { getDefaultSettings } from '../../../shared/constants' -import { WORKTREE_CREATE_AGENT_OPTIONS_RUNTIME_CAPABILITY as CREATE_OPTIONS } from '../../../shared/worktree-runtime-capabilities' -import { prepareQuickComposerStartup } from '@/hooks/composer-state/quick-startup-plan' - -const mocks = vi.hoisted(() => ({ call: vi.fn(), supports: vi.fn(), cached: vi.fn() })) -vi.mock('@/runtime/rpc/calls/runtime-rpc-call', () => ({ callRuntimeRpc: mocks.call })) -vi.mock('@/runtime/rpc/compatibility/runtime-capability-proof', () => ({ - runtimeEnvironmentSupportsCapability: mocks.supports -})) -vi.mock('@/runtime/rpc/compatibility/runtime-compatibility-cache', () => ({ - readCachedRuntimeEnvironmentCapability: mocks.cached -})) -vi.mock('@/store', () => ({ useAppStore: { getState: () => ({}) } })) -vi.mock('@/runtime/agent-launch-settings/use-host-agent-launch-preferences', () => ({ - ensureAgentLaunchPreferences: async () => ({ - agentLaunchChoices: { claude: { model: 'sonnet', options: { effort: 'low' } } } - }) -})) -const input = { - agent: 'claude' as const, - repoId: 'repo', - executionHostId: 'runtime:host' as const, - linkedWorkItem: null, - note: '', - settings: { - ...getDefaultSettings('/tmp'), - agentCmdOverrides: { claude: '/desktop/claude' }, - agentDefaultEnv: { claude: { DESKTOP_ONLY: 'yes' } } - }, - launchHost: { kind: 'known' as const, hostKind: 'runtime' as const, platform: 'linux' as const }, - shell: 'posix' as const, - isRemote: true, - telemetrySource: undefined -} -beforeEach(() => { - vi.clearAllMocks() - mocks.call.mockResolvedValue({ worktree: { id: 'created' } }) - mocks.supports.mockImplementation( - async (_host: string, capability: string) => capability === CREATE_OPTIONS - ) - mocks.cached.mockReturnValue(true) -}) - -it.each([false, null])( - 'validates desktop Arguments at submit while cached capability is %s', - async (cached) => { - mocks.cached.mockReturnValue(cached) - await expect( - prepareQuickComposerStartup({ - ...input, - launchInputs: { sessionOptions: { model: 'opus' } }, - legacyLaunchInputs: { agentArgs: "'unterminated" } - }) - ).rejects.toThrow() - } -) diff --git a/src/renderer/src/lib/worktree-creation-recovery-inputs.test.ts b/src/renderer/src/lib/worktree-creation-recovery-inputs.test.ts deleted file mode 100644 index 15cbc628d01..00000000000 --- a/src/renderer/src/lib/worktree-creation-recovery-inputs.test.ts +++ /dev/null @@ -1,99 +0,0 @@ -// @vitest-environment happy-dom -import { afterEach, expect, it, vi } from 'vitest' -import type { WorktreeCreationRequest } from '@/lib/workspace/creation/pending-worktree-creation' -import { buildWorktreeCreationStartupOpt } from '@/lib/workspace/creation/worktree-creation-flow-startup' -import { ensureWebRuntimeWorktreeTerminalAfterWake } from '@/runtime/hosted-terminals/restoration/web-runtime-worktree-terminal-after-wake' -import { resetWebRuntimeWakeTerminalRespawnForTests } from '@/runtime/hosted-terminals/restoration/web-runtime-wake-terminal-respawn' - -const mocks = vi.hoisted( - (): { - launch: ReturnType - seedOptions: ReturnType - seedDraft: ReturnType - agent: 'claude' | 'codex' - } => ({ - launch: vi.fn(), - seedOptions: vi.fn(), - seedDraft: vi.fn(), - agent: 'claude' - }) -) -vi.mock('@/lib/agent-session/launch/new-tab/launch-agent-web-host-tab', () => ({ - launchAgentInWebHostTab: mocks.launch -})) -vi.mock('@/lib/workspace/ownership/worktree-runtime-owner', () => ({ - runtimeEnvironmentIdOrLocalUnlessTwin: () => 'host' -})) -vi.mock('@/runtime/web-session-tabs-sync/identity/web-runtime-session-environment', () => ({ - isWebRuntimeSessionActive: () => true -})) -vi.mock('../../../shared/native-chat/input/native-chat-session-option-cache', () => ({ - seedNativeChatAppliedSessionOptions: mocks.seedOptions -})) -vi.mock('@/lib/agent-session/launch/prompt/agent-launch-prompt-delivery', () => ({ - seedNativeChatLaunchDraftForAgentTab: mocks.seedDraft -})) -vi.mock('@/store', () => ({ - useAppStore: { - getState: () => ({ - getKnownWorktreeById: () => ({ id: 'wt' }), - tabsByWorktree: { wt: [{ id: 'agent-tab', launchAgent: mocks.agent }] }, - ptyIdsByTabId: {} - }) - } -})) - -const request: WorktreeCreationRequest = { - repoId: 'repo', - name: 'created', - agent: 'claude', - setupDecision: 'skip', - pendingFirstAgentMessageRename: false, - note: '', - startupPlan: null, - quickPrompt: '', - quickTelemetry: null, - launchDraftPrompt: 'ship it', - launchInputs: { agentArgs: '', sessionOptions: { model: 'opus', effort: 'high' } }, - creationStartup: { - legacy: () => { - throw new Error('desktop parser reached') - }, - sessionOptions: { model: 'opus', effort: 'high' } - } -} -afterEach(() => { - vi.clearAllMocks() - resetWebRuntimeWakeTerminalRespawnForTests() -}) - -it('retains a null-plan recovery payload and serializes concurrent after-wake attempts', async () => { - const pending = Promise.withResolvers<{ outcome: { status: 'created' } }>() - mocks.launch.mockReturnValue(pending.promise) - const startup = buildWorktreeCreationStartupOpt(request, false) - expect(startup).toMatchObject({ - launchAgent: 'claude', - launchToken: expect.any(String), - freshAgentLaunch: { - agentArgs: '', - sessionOptions: { model: 'opus', effort: 'high' }, - prompt: 'ship it', - promptDelivery: 'draft' - } - }) - ensureWebRuntimeWorktreeTerminalAfterWake('wt', { startup, agent: 'claude', activate: false }) - ensureWebRuntimeWorktreeTerminalAfterWake('wt', { startup, agent: 'claude', activate: false }) - expect(mocks.launch).toHaveBeenCalledExactlyOnceWith( - expect.objectContaining({ - agentArgs: '', - sessionOptions: { model: 'opus', effort: 'high' }, - prompt: 'ship it', - promptDelivery: 'draft', - environmentId: 'host', - activate: false, - selectWorktree: false - }) - ) - pending.resolve({ outcome: { status: 'created' } }) - await pending.promise -}) diff --git a/src/renderer/src/lib/staged-browser-frame-handover.ts b/src/renderer/src/runtime/browser/creation/staged-browser-frame-handover.ts similarity index 100% rename from src/renderer/src/lib/staged-browser-frame-handover.ts rename to src/renderer/src/runtime/browser/creation/staged-browser-frame-handover.ts diff --git a/src/renderer/src/runtime/browser/creation/web-runtime-browser-creation-context.ts b/src/renderer/src/runtime/browser/creation/web-runtime-browser-creation-context.ts index d4ae21ae5cd..c21b2d65bf4 100644 --- a/src/renderer/src/runtime/browser/creation/web-runtime-browser-creation-context.ts +++ b/src/renderer/src/runtime/browser/creation/web-runtime-browser-creation-context.ts @@ -1,7 +1,6 @@ -import { subscribeLinkOpenRequests } from '../../../lib/link-open-request' -import type { BrowserClientHostPlacementPreference } from '../../../../../shared/browser/client-hosting/browser-client-host-placement' +import { subscribeLinkOpenRequests } from '../../../lib/links/link-open-request' import { BROWSER_TAB_CREATE_KNOWN_ID_RUNTIME_CAPABILITY } from '../../../../../shared/browser/runtime/browser-runtime-capabilities' -import { assertRuntimeManagedBrowserCreationAvailable } from '../../../lib/client-creation-action-policy' +import { assertRuntimeManagedBrowserCreationAvailable } from '../../../lib/workspace/creation/surface-policy/client-creation-action-policy' import { createNonSecureContextUuid as createBrowserUuid } from '../../../../../shared/non-secure-context-uuid' import { useAppStore } from '../../../store/index' import { @@ -19,9 +18,9 @@ import { import { rehomeStagedWebRuntimeBrowserTab, restageWebRuntimeBrowserTabHostingIntent, - stageWebRuntimeBrowserTab, - type StagedWebRuntimeBrowserTab + stageWebRuntimeBrowserTab } from './web-runtime-browser-tab-staging' +import type { StagedWebRuntimeBrowserTab } from './web-runtime-browser-tab-staging' import { throwIfE2eWebRuntimeBrowserCapabilityUnavailable } from './testing/web-runtime-browser-creation-e2e-fault' import { expectsBrowserClientHosting } from '../../../../../shared/browser/client-hosting/browser-client-hosting-eligibility' import { @@ -30,6 +29,7 @@ import { matchesWebSessionIntentOwner } from '../../web-session-tabs-sync/identity/web-runtime-session-environment' import { selectWebRuntimeSessionBrowserWorktree } from '../../web-session-tabs-sync/workspace-selection/web-runtime-session-workspace-selection' +import type { BrowserClientHostPlacementPreference } from '../../../../../shared/browser/client-hosting/browser-client-host-placement' export type CreateWebRuntimeSessionBrowserTabArgs = { worktreeId: string diff --git a/src/renderer/src/runtime/browser/creation/web-runtime-browser-creation.ts b/src/renderer/src/runtime/browser/creation/web-runtime-browser-creation.ts index 31bfcebb212..767c9680917 100644 --- a/src/renderer/src/runtime/browser/creation/web-runtime-browser-creation.ts +++ b/src/renderer/src/runtime/browser/creation/web-runtime-browser-creation.ts @@ -1,6 +1,3 @@ -import type { BrowserPageCreationPlacement } from '../../../../../shared/browser/client-hosting/browser-client-host-placement' -import type { RuntimeRpcResponse } from '../../../../../shared/runtime-rpc-envelope' -import type { BrowserTabCreateResult } from '../../../../../shared/browser/runtime/runtime-browser-contracts' import { translate } from '../../../i18n/i18n' import { useAppStore } from '../../../store/index' import { hasRuntimeRpcErrorCode } from '../../../../../shared/runtime-rpc-error-code' @@ -19,9 +16,9 @@ import { rehomeWebRuntimeBrowserCreation, resolveWebRuntimeBrowserClientTargetGroupId, restageWebRuntimeBrowserCreation, - stageWebRuntimeBrowserCreation, - type CreateWebRuntimeSessionBrowserTabArgs + stageWebRuntimeBrowserCreation } from './web-runtime-browser-creation-context' +import type { CreateWebRuntimeSessionBrowserTabArgs } from './web-runtime-browser-creation-context' import { finishWebRuntimeBrowserCreationFailure, prepareWebRuntimeBrowserCreationFailure @@ -36,7 +33,10 @@ import { registerPairedBrowserTabCreator } from '../../../store/slices/browser/t import { forgetStagedBrowserTabHandover, wasStagedBrowserTabHandedToFrames -} from '@/lib/staged-browser-frame-handover' +} from '@/runtime/browser/creation/staged-browser-frame-handover' +import type { BrowserPageCreationPlacement } from '../../../../../shared/browser/client-hosting/browser-client-host-placement' +import type { RuntimeRpcResponse } from '../../../../../shared/runtime-rpc-envelope' +import type { BrowserTabCreateResult } from '../../../../../shared/browser/runtime/runtime-browser-contracts' export async function createWebRuntimeSessionBrowserTab( args: CreateWebRuntimeSessionBrowserTabArgs diff --git a/src/renderer/src/runtime/browser/creation/web-runtime-browser-link-open.test.ts b/src/renderer/src/runtime/browser/creation/web-runtime-browser-link-open.test.ts index ea6cf567c39..17ac7018ad4 100644 --- a/src/renderer/src/runtime/browser/creation/web-runtime-browser-link-open.test.ts +++ b/src/renderer/src/runtime/browser/creation/web-runtime-browser-link-open.test.ts @@ -1,6 +1,5 @@ -import type * as BrowserFocusModule from '@/components/browser-pane/host-guest/browser-focus' import { requestBrowserFocus } from '@/components/browser-pane/host-guest/browser-focus' -import type { BrowserSessionProfile } from '../../../../../shared/browser-workspace-types' +import type * as BrowserFocusModule from '@/components/browser-pane/host-guest/browser-focus' import '../../../store/testing/app-store-test-fixture' import { getDefaultSettings } from '../../../../../shared/constants' import '../../../../../shared/session-tabs-runtime-capabilities' @@ -8,13 +7,12 @@ import '../../../../../shared/protocol-version' import { canOfferHttpLinkGroupAction } from '../../../lib/browser/navigation/http-link-in-group-availability' import { createWebRuntimeSessionBrowserTab } from './web-runtime-browser-creation' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' -import type * as SnapshotModule from '../../web-session-tabs-sync/inventory/web-runtime-session-snapshot' import { useAppStore } from '../../../store/index' -import { openWorkspaceBrowserTabForLink } from '../../../lib/browser/workspace/workspace-browser-tab-open' import * as workspaceBrowserTabOpen from '../../../lib/browser/workspace/workspace-browser-tab-open' +import { openWorkspaceBrowserTabForLink } from '../../../lib/browser/workspace/workspace-browser-tab-open' import { openHttpLink } from '../../../lib/browser/navigation/http-link-routing' -import { captureLinkOpenIntent } from '../../../lib/link-open-intent' -import { beginLinkOpenRequest } from '../../../lib/link-open-request' +import { captureLinkOpenIntent } from '../../../lib/links/placement/link-open-intent' +import { beginLinkOpenRequest } from '../../../lib/links/link-open-request' import { makeWorktree } from '../../../store/slices/worktrees/worktree.test-fixture' import { TEST_REPO } from '../../../store/repos/repo.test-fixture' import { resetWebSessionBrowserPlacementsForTests } from '../placement/web-session-browser-placement' @@ -37,6 +35,8 @@ import { } from './testing/web-runtime-browser-creation-placement-test-rig' import { captureWebSessionIntentOwner } from '../../web-session-tabs-sync/identity/web-runtime-session-environment' import { peekWebSessionFocusIntent } from '../../web-session-tabs-sync/navigation/web-session-focus-intent' +import type { BrowserSessionProfile } from '../../../../../shared/browser-workspace-types' +import type * as SnapshotModule from '../../web-session-tabs-sync/inventory/web-runtime-session-snapshot' vi.mock('@/components/browser-pane/host-guest/browser-focus', async (importOriginal) => ({ ...(await importOriginal()), @@ -129,27 +129,6 @@ describe('runtime link opens through staging and materialization', () => { expect(requestBrowserFocus).not.toHaveBeenCalled() }) - it('stages in the visible browser group and returns the reconciled host page identity', async () => { - const creating = open() - expect(pendingCreates).toHaveLength(1) - const provisional = pendingCreates[0]!.params.page - expect(pendingCreates[0]!.params.targetGroupId).toBe(G2) - expect(wrapperForRemotePage(provisional!)?.groupId).toBe(G2) - pendingCreates[0]!.resolve('actual-host-page') - const outcome = await creating - expect(outcome).toMatchObject({ - status: 'opened', - result: { groupId: G2, executionHostId: HOST, worktreeId: WT } - }) - if (outcome.status !== 'opened') { - throw new Error('Expected open') - } - expect(outcome.result.unifiedTabId).toBe(wrapperForRemotePage('actual-host-page')?.id) - expect( - useAppStore.getState().remoteBrowserPageHandlesByPageId[outcome.result.browserPageId] - ).toMatchObject({ remotePageId: 'actual-host-page', environmentId: ENV }) - }) - it('offers explicit runtime reuse only when a matching pinned page proves the route and session', async () => { const state = useAppStore.getState() const profile: BrowserSessionProfile = { diff --git a/src/renderer/src/runtime/browser/creation/web-runtime-browser-link-session.test.ts b/src/renderer/src/runtime/browser/creation/web-runtime-browser-link-session.test.ts deleted file mode 100644 index 3e193b641ff..00000000000 --- a/src/renderer/src/runtime/browser/creation/web-runtime-browser-link-session.test.ts +++ /dev/null @@ -1,262 +0,0 @@ -import { afterEach, beforeEach, expect, it, vi } from 'vitest' -import type * as BrowserFocusModule from '@/components/browser-pane/host-guest/browser-focus' -import type { RuntimeMobileSessionBrowserTab } from '../../../../../shared/runtime-mobile-session-tab-contracts' -import type { ExecutionHostId } from '../../../../../shared/execution-host' -import { getDefaultSettings } from '../../../../../shared/constants' -import { useAppStore } from '../../../store/index' -import { openWorkspaceBrowserTabForLink } from '../../../lib/browser/workspace/workspace-browser-tab-open' -import { selectBrowserLinkDestination } from '../../../lib/browser/navigation/browser-link-destination' -import { workspaceBrowserLinkDestination } from '../../../lib/browser/workspace/workspace-browser-link-open' -import { captureLinkOpenIntent } from '../../../lib/link-open-intent' -import { makeWorktree } from '../../../store/slices/worktrees/worktree.test-fixture' -import { TEST_REPO } from '../../../store/repos/repo.test-fixture' -import { applyWebSessionTabsSnapshot } from '../../web-session-tabs-sync/snapshot-api' -import type * as SnapshotModule from '../../web-session-tabs-sync/inventory/web-runtime-session-snapshot' -import { - resetWebSessionTabsSyncTestState, - ENV, - WT, - NOW, - makeSnapshot -} from '../../web-session-tabs-sync/testing/web-session-tabs-sync.test-fixture' -import { - seedPairedWorktree, - installRuntimeTransport, - pendingCreates, - resetHostPages, - publishHostSnapshot, - wrapperForRemotePage, - HOST, - SOURCE, - AFTER, - OTHER -} from './testing/web-runtime-browser-creation-placement-test-rig' - -vi.mock('@/components/browser-pane/host-guest/browser-focus', async (importOriginal) => ({ - ...(await importOriginal()), - requestBrowserFocus: vi.fn() -})) -vi.mock( - '../../web-session-tabs-sync/inventory/web-runtime-session-snapshot', - async (importOriginal) => ({ - ...(await importOriginal()), - refreshWebRuntimeSessionTabsSnapshot: vi.fn(async () => publishHostSnapshot()) - }) -) - -let snapshotVersion = 1 -const URL_TO_OPEN = 'https://example.com/link' - -beforeEach(() => { - resetWebSessionTabsSyncTestState() - resetHostPages() - seedPairedWorktree() - snapshotVersion = 1 - useAppStore.setState({ - repos: [{ ...TEST_REPO, id: 'repo', executionHostId: HOST }], - worktreesByRepo: { - repo: [ - makeWorktree({ - id: WT, - repoId: 'repo', - path: '/worktree', - hostId: HOST, - runtimeOwnerEnvironmentId: ENV - }) - ] - }, - browserSessionHostIdOverride: 'local', - settings: getDefaultSettings('/home/test'), - browserSessionProfilesByHostId: { - [HOST]: [ - { - id: 'default', - scope: 'default' as const, - partition: 'persist:remote-default', - label: 'Default', - source: null - } - ] - } - }) - installRuntimeTransport() -}) -afterEach(() => { - vi.restoreAllMocks() - vi.unstubAllGlobals() -}) - -function setDefaultProfiles( - browserDefaultProfileIdByHostId: Partial> -): void { - const settings = useAppStore.getState().settings! - useAppStore.setState({ settings: { ...settings, browserDefaultProfileIdByHostId } }) -} - -function open(explicit = false) { - return openWorkspaceBrowserTabForLink({ - workspaceId: WT, - url: URL_TO_OPEN, - intent: { kind: 'url' }, - expectedRuntimeEnvironmentId: ENV, - placementPreference: 'server', - selectWorktree: false, - linkContext: { - linkIntent: captureLinkOpenIntent(useAppStore.getState(), WT, OTHER.unifiedTabId, { - explicitSourceGroup: explicit - }) - } - }) -} - -function publishProfileSnapshot(profileId: string | undefined): void { - const tabs: RuntimeMobileSessionBrowserTab[] = [SOURCE, AFTER, OTHER].map((row) => ({ - type: 'browser', - id: `host-${row.unifiedTabId}`, - browserPageId: row.pageId, - browserWorkspaceId: row.workspaceId, - ...(row === OTHER && profileId ? { browserProfileId: profileId } : {}), - title: 'Example', - url: row === OTHER ? URL_TO_OPEN : 'https://example.com/', - loading: false, - canGoBack: false, - canGoForward: false, - isActive: false - })) - const snapshot = makeSnapshot(tabs, { - snapshotVersion: ++snapshotVersion, - activeTabType: 'browser', - activeTabId: null - }) - useAppStore.setState((state) => - applyWebSessionTabsSnapshot(state, snapshot, ENV, NOW + snapshotVersion) - ) -} - -function selectDestination() { - const state = useAppStore.getState() - return selectBrowserLinkDestination( - state, - workspaceBrowserLinkDestination( - { workspaceId: WT, url: URL_TO_OPEN, intent: { kind: 'url' } }, - HOST, - ENV, - HOST - ), - captureLinkOpenIntent(state, WT, OTHER.unifiedTabId, { explicitSourceGroup: true }) - ) -} - -it.each([ - { profileId: null, explicit: false }, - { profileId: 'remote-profile', explicit: false }, - { profileId: null, explicit: true }, - { profileId: 'remote-profile', explicit: true } -])( - 'opens with the host-confirmed profile ($profileId, explicit target: $explicit)', - async ({ profileId, explicit }) => { - setDefaultProfiles(profileId ? { [HOST]: profileId } : {}) - publishProfileSnapshot(profileId ?? 'default') - const creating = open(explicit) - pendingCreates[0]?.resolve('new-host-page') - const outcome = await creating - if (explicit) { - expect(outcome).toMatchObject({ - status: 'opened', - result: { browserPageId: OTHER.pageId } - }) - return - } - expect(outcome.status).toBe('opened') - if (outcome.status !== 'opened') { - throw new Error('Expected opened link') - } - expect(outcome.result.browserPageId).not.toBe(OTHER.pageId) - expect( - useAppStore.getState().remoteBrowserPageHandlesByPageId[outcome.result.browserPageId] - ).toMatchObject({ remotePageId: 'new-host-page', environmentId: ENV }) - } -) - -it('updates and clears published profile evidence even when page content stays identical', () => { - publishProfileSnapshot('default') - expect(selectDestination()).toMatchObject({ match: { browserPageId: OTHER.pageId } }) - const handles = useAppStore.getState().remoteBrowserPageHandlesByPageId - publishProfileSnapshot('default') - expect(useAppStore.getState().remoteBrowserPageHandlesByPageId).toBe(handles) - publishProfileSnapshot('other-profile') - expect(selectDestination()).toMatchObject({ match: null }) - publishProfileSnapshot('default') - expect(selectDestination()).toMatchObject({ match: { browserPageId: OTHER.pageId } }) - publishProfileSnapshot(undefined) - expect(selectDestination()).toMatchObject({ match: null }) -}) - -it.each(['unchanged', 'different-host', 'different-runtime'] as const)( - 'validates the captured SSH owner after foreground runtime selection (%s)', - async (ownerChange) => { - const sshHost = 'ssh:ssh-target' - useAppStore.setState((state) => ({ - activeWorkspaceExecutionHostId: sshHost, - repos: state.repos.map((repo) => ({ ...repo, executionHostId: sshHost })), - worktreesByRepo: { - repo: state.worktreesByRepo.repo!.map((worktree) => ({ ...worktree, hostId: sshHost })) - }, - unifiedTabsByWorktree: { - [WT]: state.unifiedTabsByWorktree[WT]!.map((tab) => ({ - ...tab, - executionHostId: sshHost - })) - } - })) - vi.spyOn(useAppStore.getState(), 'refreshGitHubForWorktreeIfStale').mockImplementation( - () => undefined - ) - const creating = openWorkspaceBrowserTabForLink({ - workspaceId: WT, - url: URL_TO_OPEN, - intent: { kind: 'url' }, - expectedRuntimeEnvironmentId: ENV, - placementPreference: 'server', - linkContext: { - linkIntent: captureLinkOpenIntent(useAppStore.getState(), WT, SOURCE.unifiedTabId) - } - }) - expect(pendingCreates).toHaveLength(1) - expect(useAppStore.getState().activeWorkspaceExecutionHostId).toBe(HOST) - if (ownerChange === 'different-host') { - useAppStore.setState((state) => ({ - activeWorkspaceExecutionHostId: 'ssh:other-target', - worktreesByRepo: { - repo: [ - ...state.worktreesByRepo.repo!, - ...state.worktreesByRepo.repo!.map((worktree) => ({ - ...worktree, - hostId: 'ssh:other-target' as const - })) - ] - } - })) - } else if (ownerChange === 'different-runtime') { - useAppStore.setState((state) => ({ - activeWorkspaceExecutionHostId: sshHost, - worktreesByRepo: { - repo: state.worktreesByRepo.repo!.map((worktree) => ({ - ...worktree, - runtimeOwnerEnvironmentId: 'other-environment' - })) - } - })) - } - const remotePageId = `foreground-ssh-${ownerChange}` - pendingCreates[0]!.resolve(remotePageId) - const outcome = await creating - expect(wrapperForRemotePage(remotePageId)).toBeDefined() - expect(outcome).toMatchObject({ - status: ownerChange === 'unchanged' ? 'opened' : 'refused' - }) - if (outcome.status === 'opened') { - expect(outcome.result).toMatchObject({ worktreeId: WT, executionHostId: sshHost }) - } - } -) diff --git a/src/renderer/src/runtime/hosted-terminals/placement/web-runtime-terminal-placement-settlement.ts b/src/renderer/src/runtime/hosted-terminals/placement/web-runtime-terminal-placement-settlement.ts index 1e0fb1f1bce..a3e340517a1 100644 --- a/src/renderer/src/runtime/hosted-terminals/placement/web-runtime-terminal-placement-settlement.ts +++ b/src/renderer/src/runtime/hosted-terminals/placement/web-runtime-terminal-placement-settlement.ts @@ -1,4 +1,4 @@ -import { insertUnifiedTabAfterAnchor } from '../../../lib/unified-tab-anchor-insertion' +import { insertUnifiedTabAfterAnchor } from '../../../lib/workspace/tabs/unified-tab-anchor-insertion' import { useAppStore } from '../../../store/index' import { forgetWebSessionTerminalPlacement, diff --git a/src/renderer/src/runtime/hosted-terminals/recovery/web-session-terminal-orphan-recovery-sleep.test.ts b/src/renderer/src/runtime/hosted-terminals/recovery/web-session-terminal-orphan-recovery-sleep.test.ts index e9f43a34f95..d6a841800ec 100644 --- a/src/renderer/src/runtime/hosted-terminals/recovery/web-session-terminal-orphan-recovery-sleep.test.ts +++ b/src/renderer/src/runtime/hosted-terminals/recovery/web-session-terminal-orphan-recovery-sleep.test.ts @@ -4,7 +4,7 @@ import { toWebTerminalSurfaceTabId } from '../../../../../shared/workspace-layou import { clearWorktreeSleepIntent, markWorktreeSleepIntent -} from '../../../lib/worktree-sleep-intent' +} from '../../../lib/workspace/sleep/worktree-sleep-intent' import { clearWebSessionTerminalOrphanRecoveryForTests } from './web-session-terminal-orphan-recovery' import { applyWebSessionTabsSnapshot } from '../../web-session-tabs-sync/snapshot-api' import { diff --git a/src/renderer/src/runtime/hosts/platform/execution-host-facts.ts b/src/renderer/src/runtime/hosts/platform/execution-host-facts.ts index bf2f6717ead..8f878fc8403 100644 --- a/src/renderer/src/runtime/hosts/platform/execution-host-facts.ts +++ b/src/renderer/src/runtime/hosts/platform/execution-host-facts.ts @@ -1,28 +1,23 @@ -import { - getRepoExecutionHostId, - parseExecutionHostId, - type ParsedExecutionHost, - type ExecutionHostId -} from '../../../../../shared/execution-host' -import type { ProjectExecutionRuntimeResolution } from '../../../../../shared/execution-host/project-execution-runtime' +import { getRepoExecutionHostId, parseExecutionHostId } from '../../../../../shared/execution-host' +import type { ParsedExecutionHost, ExecutionHostId } from '../../../../../shared/execution-host' import { lastVerifiedRuntimeStatus } from '../../../../../shared/remote-runtime/host-status/runtime-host-status' import { runtimeHostContactForEntry } from '../../../../../shared/remote-runtime/host-status/runtime-host-contact' -import type { AgentStartupShell } from '../../../../../shared/agent-launch/startup/tui-agent-startup-shell' import { resolveHostAgentStartupShell } from '../../../../../shared/windows-terminal-shell' import { isWslUncPath } from '../../../../../shared/wsl-paths' -import type { AppState } from '@/store/types' import { getConnectionIdForWorktreeCopy, getConnectionIdFromState } from '../../../lib/workspace/ownership/connection-owner-resolution' -import { getLocalProjectExecutionRuntimeContext } from '../../../lib/local-preflight-context' +import { getLocalProjectExecutionRuntimeContext } from '../preflight/local-preflight-context' import { CLIENT_PLATFORM } from '../../../lib/workspace/creation/new-workspace' import { getExecutionHostIdForWorktree, getResourceExecutionHostIdForWorktree, runtimeEnvironmentIdOrLocalUnlessTwin } from '../../../lib/workspace/ownership/worktree-runtime-owner' - +import type { ProjectExecutionRuntimeResolution } from '../../../../../shared/execution-host/project-execution-runtime' +import type { AgentStartupShell } from '../../../../../shared/agent-launch/startup/tui-agent-startup-shell' +import type { AppState } from '@/store/types' import type { ExecutionHostPlatformFact } from './execution-host-platform-fact' type HostFactsState = Pick< diff --git a/src/renderer/src/lib/local-preflight-context-cache.ts b/src/renderer/src/runtime/hosts/preflight/local-preflight-context-cache.ts similarity index 97% rename from src/renderer/src/lib/local-preflight-context-cache.ts rename to src/renderer/src/runtime/hosts/preflight/local-preflight-context-cache.ts index 7995d4f0b15..82d9eda3060 100644 --- a/src/renderer/src/lib/local-preflight-context-cache.ts +++ b/src/renderer/src/runtime/hosts/preflight/local-preflight-context-cache.ts @@ -1,8 +1,8 @@ import { getCachedWindowsTerminalCapabilities, hasCachedWindowsTerminalCapabilities -} from '../runtime/hosts/capabilities/windows-terminal-capabilities' -import type { ProjectExecutionRuntimeResolution } from '../../../shared/execution-host/project-execution-runtime' +} from '../capabilities/windows-terminal-capabilities' +import type { ProjectExecutionRuntimeResolution } from '../../../../../shared/execution-host/project-execution-runtime' export type LocalPreflightContext = | { diff --git a/src/renderer/src/lib/local-preflight-context-key.ts b/src/renderer/src/runtime/hosts/preflight/local-preflight-context-key.ts similarity index 95% rename from src/renderer/src/lib/local-preflight-context-key.ts rename to src/renderer/src/runtime/hosts/preflight/local-preflight-context-key.ts index 8cabe77a76f..4fff032833e 100644 --- a/src/renderer/src/lib/local-preflight-context-key.ts +++ b/src/renderer/src/runtime/hosts/preflight/local-preflight-context-key.ts @@ -1,4 +1,4 @@ -import type { ProjectExecutionRuntimeResolution } from '../../../shared/execution-host/project-execution-runtime' +import type { ProjectExecutionRuntimeResolution } from '../../../../../shared/execution-host/project-execution-runtime' type LocalPreflightContextKeyInput = | { diff --git a/src/renderer/src/lib/local-preflight-context.ts b/src/renderer/src/runtime/hosts/preflight/local-preflight-context.ts similarity index 85% rename from src/renderer/src/lib/local-preflight-context.ts rename to src/renderer/src/runtime/hosts/preflight/local-preflight-context.ts index 5e757b915d0..7cd8cb60dd4 100644 --- a/src/renderer/src/lib/local-preflight-context.ts +++ b/src/renderer/src/runtime/hosts/preflight/local-preflight-context.ts @@ -1,40 +1,34 @@ -import type { AppState } from '@/store/types' -import { FLOATING_TERMINAL_WORKTREE_ID } from '../../../shared/constants' -import { parseWslUncPath } from '../../../shared/wsl-paths' -import { deriveGlobalWindowsRuntimeDefaultFromLegacySettings } from '../../../shared/execution-host/project-runtime-legacy-migration' -import { getWorkspaceRuntimePreference } from '../../../shared/execution-host/project-runtime-preference' +import { FLOATING_TERMINAL_WORKTREE_ID } from '../../../../../shared/constants' +import { parseWslUncPath } from '../../../../../shared/wsl-paths' +import { deriveGlobalWindowsRuntimeDefaultFromLegacySettings } from '../../../../../shared/execution-host/project-runtime-legacy-migration' +import { getWorkspaceRuntimePreference } from '../../../../../shared/execution-host/project-runtime-preference' +import { resolveProjectExecutionRuntime } from '../../../../../shared/execution-host/project-execution-runtime' +import type { ProjectExecutionRuntimeResolution } from '../../../../../shared/execution-host/project-execution-runtime' import { - resolveProjectExecutionRuntime, - type ProjectExecutionRuntimeResolution -} from '../../../shared/execution-host/project-execution-runtime' -import { getRepoExecutionHostId, LOCAL_EXECUTION_HOST_ID } from '../../../shared/execution-host' -import type { Repo } from '../../../shared/repo-types' -import type { Worktree } from '../../../shared/worktree/types' -import { parseWorkspaceKey } from '../../../shared/workspace-scope' -import { projectMatchesRepo } from '../../../shared/project-repo-match' + getRepoExecutionHostId, + LOCAL_EXECUTION_HOST_ID +} from '../../../../../shared/execution-host' +import { parseWorkspaceKey } from '../../../../../shared/workspace-scope' +import { projectMatchesRepo } from '../../../../../shared/project-repo-match' import { getIndexedRepoMap, getIndexedReposById } from '@/store/repos/repository-catalog-index' -import { defaultScopeHost } from '../runtime/hosts/selection/default-creation-host' -import { getLocalProjectRuntimeWorkspace } from '../runtime/hosts/wsl/local-project-runtime-workspace' -import { getActiveWorkspaceOwnerTarget } from './workspace/ownership/resolved-worktree-execution-host' -import { getEnvironmentRuntimeContextKey } from '../runtime/hosts/observations/provider-runtime-context' -import { getRendererAppPlatform } from '../app-shell/platform/renderer-app-platform' +import { defaultScopeHost } from '../selection/default-creation-host' +import { getLocalProjectRuntimeWorkspace } from '../wsl/local-project-runtime-workspace' +import { getActiveWorkspaceOwnerTarget } from '../../../lib/workspace/ownership/resolved-worktree-execution-host' +import { getEnvironmentRuntimeContextKey } from '../observations/provider-runtime-context' +import { getRendererAppPlatform } from '../../../app-shell/platform/renderer-app-platform' import { getProjectRuntimePreflightContext, getCachedLocalProjectRuntimeWslContext, - type LocalProjectRuntimeWslContext, - getWslPreflightContext, - type LocalPreflightContext + getWslPreflightContext } from './local-preflight-context-cache' - -export { localPreflightContextKey } from './local-preflight-context-key' -export type { LocalPreflightContext } from './local-preflight-context-cache' -export { - _getProjectRuntimePreflightContextCacheSizeForTest, - _getWslPreflightContextCacheSizeForTest, - _hasProjectRuntimePreflightContextCacheEntryForTest, - _hasWslPreflightContextCacheEntryForTest, - resetLocalPreflightContextCachesForTests +import type { + LocalProjectRuntimeWslContext, + LocalPreflightContext } from './local-preflight-context-cache' +import './local-preflight-context-key' +import type { AppState } from '@/store/types' +import type { Repo } from '../../../../../shared/repo-types' +import type { Worktree } from '../../../../../shared/worktree/types' type LocalProjectRuntimeState = Pick< AppState, diff --git a/src/renderer/src/lib/ssh-config-passive-sync.test.ts b/src/renderer/src/runtime/hosts/ssh/ssh-config-passive-sync.test.ts similarity index 96% rename from src/renderer/src/lib/ssh-config-passive-sync.test.ts rename to src/renderer/src/runtime/hosts/ssh/ssh-config-passive-sync.test.ts index 2ef18914ffa..999b43d5007 100644 --- a/src/renderer/src/lib/ssh-config-passive-sync.test.ts +++ b/src/renderer/src/runtime/hosts/ssh/ssh-config-passive-sync.test.ts @@ -1,5 +1,5 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' -import { useAppStore } from '../store' +import { useAppStore } from '../../../store/index' import { resetSshConfigPassiveSyncForTests, syncSshConfigTargetsPassively diff --git a/src/renderer/src/lib/ssh-config-passive-sync.ts b/src/renderer/src/runtime/hosts/ssh/ssh-config-passive-sync.ts similarity index 96% rename from src/renderer/src/lib/ssh-config-passive-sync.ts rename to src/renderer/src/runtime/hosts/ssh/ssh-config-passive-sync.ts index a761c44a48c..64025c7a125 100644 --- a/src/renderer/src/lib/ssh-config-passive-sync.ts +++ b/src/renderer/src/runtime/hosts/ssh/ssh-config-passive-sync.ts @@ -1,4 +1,4 @@ -import { useAppStore } from '../store' +import { useAppStore } from '../../../store/index' // Why: launch, the hosts menu and Settings → SSH can all ask within a second; one sync covers them. const SSH_CONFIG_SYNC_MIN_INTERVAL_MS = 10_000 diff --git a/src/renderer/src/lib/ssh-mutation-expectation.ts b/src/renderer/src/runtime/hosts/ssh/ssh-mutation-expectation.ts similarity index 91% rename from src/renderer/src/lib/ssh-mutation-expectation.ts rename to src/renderer/src/runtime/hosts/ssh/ssh-mutation-expectation.ts index c29bb9160b1..20c9a67d83c 100644 --- a/src/renderer/src/lib/ssh-mutation-expectation.ts +++ b/src/renderer/src/runtime/hosts/ssh/ssh-mutation-expectation.ts @@ -1,7 +1,7 @@ -import type { SshMutationExpectation } from '../../../shared/ssh-types' +import { parseExecutionHostId, toSshExecutionHostId } from '../../../../../shared/execution-host' +import { resolveOwner } from '../../../lib/workspace/ownership/resolve-owner' +import type { SshMutationExpectation } from '../../../../../shared/ssh-types' import type { AppState } from '@/store/types' -import { parseExecutionHostId, toSshExecutionHostId } from '../../../shared/execution-host' -import { resolveOwner } from './workspace/ownership/resolve-owner' const SSH_OWNER_CHANGED_MESSAGE = "Couldn't verify the SSH connection. Reconnect the host and try again." diff --git a/src/renderer/src/runtime/source-control/forge/forge-credential-target.ts b/src/renderer/src/runtime/source-control/forge/forge-credential-target.ts index abcd94743b6..0c3943d5bc0 100644 --- a/src/renderer/src/runtime/source-control/forge/forge-credential-target.ts +++ b/src/renderer/src/runtime/source-control/forge/forge-credential-target.ts @@ -1,10 +1,10 @@ import { getRepoExecutionHostId } from '../../../../../shared/execution-host' import { parseHostAuthorityKey } from '../../../../../shared/host-authority' -import { reviewRepositoryMatchesWorkspace } from '@/lib/review-owner' +import { reviewRepositoryMatchesWorkspace } from '@/lib/source-control/review/review-owner' +import { translate } from '@/i18n/i18n' import type { Repo } from '../../../../../shared/repo-types' import type { Worktree } from '../../../../../shared/worktree/types' import type { TaskSourceContext } from '../../../../../shared/work-items/task-source-context' -import { translate } from '@/i18n/i18n' import type { RuntimeClientTarget } from '../../../../../shared/runtime-client-target' export type ForgeRepoSelector = { diff --git a/src/renderer/src/runtime/sync-runtime-graph/graph-publication.ts b/src/renderer/src/runtime/sync-runtime-graph/graph-publication.ts index c39a8539766..77c7c9899d2 100644 --- a/src/renderer/src/runtime/sync-runtime-graph/graph-publication.ts +++ b/src/renderer/src/runtime/sync-runtime-graph/graph-publication.ts @@ -5,13 +5,8 @@ import { getParkedTerminalWatcherPaneIdsByPtyId } from '@/components/terminal-pane/parking/output-watchers/terminal-parked-watcher-registry' import { serializePaneTree } from '@/components/terminal-pane/layout/terminal-layout-dom-serialization' -import { getSystemPrefersDark } from '@/lib/terminal-theme' -import type { - RuntimeMobileSessionTabsSnapshot, - RuntimeRendererSyncWindowGraph -} from '../../../../shared/runtime-session-contracts' +import { getSystemPrefersDark } from '@/lib/terminal/appearance/terminal-theme' import { isTerminalLeafId } from '../../../../shared/workspace-layout/stable-pane-id' -import type { TerminalTab } from '../../../../shared/workspace-layout/terminal-tab-types' import { applyNativeChatLaunchDraftResolved } from '../native-chat/launch-drafts/native-chat-launch-draft-runtime-resolution' import { resolveTerminalLayoutRoot } from '../hosted-terminals/actions/remote-terminal-layout-resolution' import { buildMobileSessionTabSnapshots } from './mobile-session-snapshots' @@ -38,6 +33,11 @@ import { import { ORCA_SIDEBAR_INPUTS_IS_MAIN } from '../../../../shared/sidebar-inputs-switch' import { ORCA_LAYOUT_OWNER_IS_MAIN } from '../../../../shared/layout-owner-switch' import { changedActiveGroups } from './active-group-publication' +import type { + RuntimeMobileSessionTabsSnapshot, + RuntimeRendererSyncWindowGraph +} from '../../../../shared/runtime-session-contracts' +import type { TerminalTab } from '../../../../shared/workspace-layout/terminal-tab-types' export async function syncRuntimeGraph(): Promise { if (!graphState.syncEnabled || !graphState.getStoreState) { diff --git a/src/renderer/src/runtime/sync-runtime-graph/mobile-session-snapshots.ts b/src/renderer/src/runtime/sync-runtime-graph/mobile-session-snapshots.ts index 44243754905..935bb51d37e 100644 --- a/src/renderer/src/runtime/sync-runtime-graph/mobile-session-snapshots.ts +++ b/src/renderer/src/runtime/sync-runtime-graph/mobile-session-snapshots.ts @@ -1,7 +1,4 @@ -import { getSystemPrefersDark } from '@/lib/terminal-theme' -import type { AppState } from '@/store/types' -import type { RuntimeMobileSessionTabsSnapshot } from '../../../../shared/runtime-types' -import type { RuntimeMobileSessionSnapshotTab } from '../../../../shared/runtime-mobile-session-tab-contracts' +import { getSystemPrefersDark } from '@/lib/terminal/appearance/terminal-theme' import { parseWorkspaceKey } from '../../../../shared/workspace-scope' import { collectAmbiguousTerminalTabIds, @@ -30,10 +27,13 @@ import { import { buildMobileTerminalSurfaceTabs } from './mobile-session-terminal-tabs' import { buildMobileMarkdownTab, buildMobileFileTab } from './mobile-session-editor-tabs' import { buildMobileBrowserTab } from './mobile-session-browser-tabs' -import type { MobileSessionPublicationInputs } from './types' import { canReuseMobileSessionSnapshot } from './mobile-session-capture' import { selectFolderWorkspaces } from '@/store/workspaces/catalog/workspace-record-fields' import { ORCA_LAYOUT_OWNER_IS_MAIN } from '../../../../shared/layout-owner-switch' +import type { AppState } from '@/store/types' +import type { RuntimeMobileSessionTabsSnapshot } from '../../../../shared/runtime-types' +import type { RuntimeMobileSessionSnapshotTab } from '../../../../shared/runtime-mobile-session-tab-contracts' +import type { MobileSessionPublicationInputs } from './types' export function buildMobileSessionTabSnapshots( state: AppState, diff --git a/src/renderer/src/runtime/sync-runtime-graph/mobile-terminal-theme.ts b/src/renderer/src/runtime/sync-runtime-graph/mobile-terminal-theme.ts index 5f435055320..1733bf78d32 100644 --- a/src/renderer/src/runtime/sync-runtime-graph/mobile-terminal-theme.ts +++ b/src/renderer/src/runtime/sync-runtime-graph/mobile-terminal-theme.ts @@ -1,8 +1,11 @@ -import { getSystemPrefersDark, resolveEffectiveTerminalAppearance } from '@/lib/terminal-theme' -import type { AppState } from '@/store/types' -import type { RuntimeMobileTerminalTheme } from '../../../../shared/runtime-mobile-session-tab-contracts' +import { + getSystemPrefersDark, + resolveEffectiveTerminalAppearance +} from '@/lib/terminal/appearance/terminal-theme' import '../../../../shared/terminal-themes/terminal-contrast-correction' import { normalizeTerminalMinimumContrastRatio } from '../../../../shared/terminal-themes/terminal-minimum-contrast-settings' +import type { AppState } from '@/store/types' +import type { RuntimeMobileTerminalTheme } from '../../../../shared/runtime-mobile-session-tab-contracts' function hexToRgba(hex: string, alpha: number): string { let clean = hex.replace('#', '') diff --git a/src/renderer/src/runtime/sync-runtime-graph/sync-key.ts b/src/renderer/src/runtime/sync-runtime-graph/sync-key.ts index 4cbf6585c44..f1d8bdb95ba 100644 --- a/src/renderer/src/runtime/sync-runtime-graph/sync-key.ts +++ b/src/renderer/src/runtime/sync-runtime-graph/sync-key.ts @@ -1,5 +1,4 @@ -import { getSystemPrefersDark } from '@/lib/terminal-theme' -import type { AppState } from '@/store/types' +import { getSystemPrefersDark } from '@/lib/terminal/appearance/terminal-theme' import { EMPTY_ACTIVE_BROWSER_TAB_ID_BY_WORKTREE, EMPTY_AGENT_STATUS_BY_PANE_KEY, @@ -17,8 +16,9 @@ import { getBrowserTabsByWorktree } from './sync-projections' import { resolveMobileTerminalTheme } from './mobile-terminal-theme' -import type { RuntimeMobileSessionSyncKey } from './types' import { selectFolderWorkspaces } from '@/store/workspaces/catalog/workspace-record-fields' +import type { AppState } from '@/store/types' +import type { RuntimeMobileSessionSyncKey } from './types' function getTerminalThemeSystemPrefersDark( state: Pick, diff --git a/src/renderer/src/lib/runtime-session-mirror-targets.ts b/src/renderer/src/runtime/web-session-tabs-sync/subscriptions/runtime-session-mirror-targets.ts similarity index 80% rename from src/renderer/src/lib/runtime-session-mirror-targets.ts rename to src/renderer/src/runtime/web-session-tabs-sync/subscriptions/runtime-session-mirror-targets.ts index 274d95c7d80..a915b272149 100644 --- a/src/renderer/src/lib/runtime-session-mirror-targets.ts +++ b/src/renderer/src/runtime/web-session-tabs-sync/subscriptions/runtime-session-mirror-targets.ts @@ -1,14 +1,12 @@ -import { - lastVerifiedRuntimeStatus, - type RuntimeHostStatusSnapshot -} from '../../../shared/remote-runtime/host-status/runtime-host-status' -import type { RuntimeStatus } from '../../../shared/runtime-session-contracts' +import { lastVerifiedRuntimeStatus } from '../../../../../shared/remote-runtime/host-status/runtime-host-status' +import type { RuntimeHostStatusSnapshot } from '../../../../../shared/remote-runtime/host-status/runtime-host-status' import { isDisconnectedRuntimeHostState, runtimeHostConnectionStateForEntry } from '@/runtime/hosts/connections/runtime-host-connection-state' -import type { WorktreeRuntimeOwnerState } from './workspace/ownership/worktree-runtime-owner-state' -import { getRuntimeSessionMirrorEnvironmentIds } from './workspace/ownership/runtime-session-mirror-owners' +import { getRuntimeSessionMirrorEnvironmentIds } from '../../../lib/workspace/ownership/runtime-session-mirror-owners' +import type { RuntimeStatus } from '../../../../../shared/runtime-session-contracts' +import type { WorktreeRuntimeOwnerState } from '../../../lib/workspace/ownership/worktree-runtime-owner-state' type RuntimeMirrorStatus = { status: RuntimeStatus | null diff --git a/src/renderer/src/runtime/web-session-tabs-sync/subscriptions/use-runtime-session-mirror-environment-key.ts b/src/renderer/src/runtime/web-session-tabs-sync/subscriptions/use-runtime-session-mirror-environment-key.ts index eeead3c030a..a9d0505de56 100644 --- a/src/renderer/src/runtime/web-session-tabs-sync/subscriptions/use-runtime-session-mirror-environment-key.ts +++ b/src/renderer/src/runtime/web-session-tabs-sync/subscriptions/use-runtime-session-mirror-environment-key.ts @@ -1,12 +1,12 @@ import { useMemo } from 'react' import { useShallow } from 'zustand/react/shallow' -import { getReachableRuntimeSessionMirrorTargets } from '@/lib/runtime-session-mirror-targets' +import { getReachableRuntimeSessionMirrorTargets } from '@/runtime/web-session-tabs-sync/subscriptions/runtime-session-mirror-targets' import { useAppStore } from '@/store/index' -import type { AppState } from '@/store/types' import { selectDetectedWorktreesByRepo, selectWorktreesByRepo } from '@/store/workspaces/catalog/workspace-record-fields' +import type { AppState } from '@/store/types' export type RuntimeSessionMirrorTargetInputs = Pick< AppState, diff --git a/src/renderer/src/runtime/web-session-tabs-sync/tracking-lifecycle.ts b/src/renderer/src/runtime/web-session-tabs-sync/tracking-lifecycle.ts index 77d32b453c6..5a707fb3d5c 100644 --- a/src/renderer/src/runtime/web-session-tabs-sync/tracking-lifecycle.ts +++ b/src/renderer/src/runtime/web-session-tabs-sync/tracking-lifecycle.ts @@ -53,10 +53,9 @@ import { clearWebSessionTerminalPlacementsForEnvironment } from '../hosted-terminals/placement/web-session-terminal-placement' import { clearHostSessionMirrorHydration } from './hydration/host-session-mirror-hydration' -import { clearHostMirrorHandleGapVerdictsForEnvironment } from '@/lib/host-mirror-handle-gap-wait' +import { clearHostMirrorHandleGapVerdictsForEnvironment } from '@/lib/agent-session/resume/host-mirror-handle-gap-wait' import { createBoundedGenerationMap } from '@/lib/bounded-generation-map' import { clearHostSessionTabIdMappings } from './tracking-mappings' - import { untrackWebSessionTabsWorktree, removeWebSessionTabsEnvironment } from './tracking' const sessionTabsTrackingGenerations = createBoundedGenerationMap(512) diff --git a/src/renderer/src/store/github/pull-requests/linked-review-clear.ts b/src/renderer/src/store/github/pull-requests/linked-review-clear.ts index a00707dbbfb..2e60229f851 100644 --- a/src/renderer/src/store/github/pull-requests/linked-review-clear.ts +++ b/src/renderer/src/store/github/pull-requests/linked-review-clear.ts @@ -1,6 +1,3 @@ -import type { AppState } from '../../types' -import type { Worktree } from '../../../../../shared/worktree/types' -import type { Repo } from '../../../../../shared/repo-types' import { getRepoExecutionHostId } from '../../../../../shared/execution-host' import { CLEARED_HOSTED_REVIEW_SELECTION_UPDATES } from '../../../../../shared/worktree/hosted-review-links' import { @@ -10,8 +7,11 @@ import { import { getHostedReviewLinkMutationGeneration } from '../../slices/worktrees/metadata/hosted-review-link-mutation' import { tryRuntimeTargetForWorktreeOwner } from '../../slices/worktrees/listing/worktree-owner-target' import { hasUniqueIndexedRepositoryHost } from '@/lib/workspace/ownership/repository-owner-index' -import { resolveReviewRepository } from '@/lib/review-owner' +import { resolveReviewRepository } from '@/lib/source-control/review/review-owner' import { findWorktreeById, getWorktreeLookupIndex } from '../refresh/worktree-refresh' +import type { AppState } from '../../types' +import type { Worktree } from '../../../../../shared/worktree/types' +import type { Repo } from '../../../../../shared/repo-types' export type LinkedReviewClearScope = { repository: Repo diff --git a/src/renderer/src/store/github/refresh/worktree-refresh.ts b/src/renderer/src/store/github/refresh/worktree-refresh.ts index 79b2069fa23..faa2c76f9a5 100644 --- a/src/renderer/src/store/github/refresh/worktree-refresh.ts +++ b/src/renderer/src/store/github/refresh/worktree-refresh.ts @@ -1,17 +1,16 @@ -import type { AppState } from '../../types' -import type { GitHubPRRefreshCandidate } from '../../../../../shared/github/pull-request-refresh-types' -import type { Repo } from '../../../../../shared/repo-types' -import type { Worktree } from '../../../../../shared/worktree/types' import { getRepoExecutionHostId, LOCAL_EXECUTION_HOST_ID, normalizeExecutionHostId, parseExecutionHostId, - toRuntimeExecutionHostId, - type ExecutionHostId + toRuntimeExecutionHostId } from '../../../../../shared/execution-host' +import type { ExecutionHostId } from '../../../../../shared/execution-host' import { isMacAppDataPath } from '@/app-shell/platform/passive-macos-app-data-access' -import { resolveReviewRepository, reviewRepositoryMatchesWorkspace } from '@/lib/review-owner' +import { + resolveReviewRepository, + reviewRepositoryMatchesWorkspace +} from '@/lib/source-control/review/review-owner' import { findIndexedReviewRepository, hasUniqueIndexedRepositoryHost @@ -23,6 +22,10 @@ import { settingsForGitHubRepoOwner } from '../work-items/work-item-routing' import { githubHostedReviewFallbackPRNumber } from '../pull-requests/pr-result-routing' import { resolvePRBranchFallback } from '../../../../../shared/github/pr-branch-fallback-rule' import { selectWorktreesByRepo } from '../../workspaces/catalog/workspace-record-fields' +import type { AppState } from '../../types' +import type { GitHubPRRefreshCandidate } from '../../../../../shared/github/pull-request-refresh-types' +import type { Repo } from '../../../../../shared/repo-types' +import type { Worktree } from '../../../../../shared/worktree/types' export function findWorktreeById( state: AppState, diff --git a/src/renderer/src/store/slices/agent-inventory/local-agent-inventory-outcome.ts b/src/renderer/src/store/slices/agent-inventory/local-agent-inventory-outcome.ts index 46188ab60c8..4b3653f93ba 100644 --- a/src/renderer/src/store/slices/agent-inventory/local-agent-inventory-outcome.ts +++ b/src/renderer/src/store/slices/agent-inventory/local-agent-inventory-outcome.ts @@ -1,7 +1,7 @@ +import { getLocalAgentPreflightContext } from '@/runtime/hosts/preflight/local-preflight-context' +import { localAgentInventoryContextKey } from '@/runtime/hosts/preflight/local-preflight-context-key' import type { AppState } from '../../types' import type { TuiAgent } from '../../../../../shared/agent-launch/catalog/tui-agent' -import { getLocalAgentPreflightContext } from '@/lib/local-preflight-context' -import { localAgentInventoryContextKey } from '@/lib/local-preflight-context-key' /** A context's list and latest attempt outcome; a list kept through a failed refresh is failed. */ export function readLocalAgentInventoryOutcome( diff --git a/src/renderer/src/store/slices/agent-inventory/local-agent-inventory-refresh.ts b/src/renderer/src/store/slices/agent-inventory/local-agent-inventory-refresh.ts index 56d844d3946..9f07f888350 100644 --- a/src/renderer/src/store/slices/agent-inventory/local-agent-inventory-refresh.ts +++ b/src/renderer/src/store/slices/agent-inventory/local-agent-inventory-refresh.ts @@ -1,15 +1,15 @@ -import type { StoreApi } from 'zustand' -import type { AppState } from '../../types' -import type { TuiAgent } from '../../../../../shared/agent-launch/catalog/tui-agent' import { isTuiAgent } from '../../../../../shared/agent-launch/catalog/tui-agent-config' import { FLOATING_TERMINAL_WORKTREE_ID } from '../../../../../shared/constants' import { filterEnabledTuiAgents } from '../../../../../shared/agent-launch/catalog/tui-agent-selection' -import { getLocalAgentPreflightContext } from '@/lib/local-preflight-context' -import { localAgentInventoryContextKey } from '@/lib/local-preflight-context-key' +import { getLocalAgentPreflightContext } from '@/runtime/hosts/preflight/local-preflight-context' +import { localAgentInventoryContextKey } from '@/runtime/hosts/preflight/local-preflight-context-key' import * as contextEviction from './local-agent-context-eviction' import { getLegacyLoadingPatch, getSupersededDetectPatch } from './local-agent-legacy-loading' -import type { LocalAgentRefreshOptions } from './local-detected-agent-store-state' import { isWslDistroNotRunningRefusal } from '../../../../../shared/wsl-distro-not-running-refusal' +import type { StoreApi } from 'zustand' +import type { AppState } from '../../types' +import type { TuiAgent } from '../../../../../shared/agent-launch/catalog/tui-agent' +import type { LocalAgentRefreshOptions } from './local-detected-agent-store-state' export type LocalAgentInventoryLifecycle = { detectPromises: Map> diff --git a/src/renderer/src/store/slices/agent-inventory/local-detected-agent-state.ts b/src/renderer/src/store/slices/agent-inventory/local-detected-agent-state.ts index af79fb5d1c5..1b1d85f6215 100644 --- a/src/renderer/src/store/slices/agent-inventory/local-detected-agent-state.ts +++ b/src/renderer/src/store/slices/agent-inventory/local-detected-agent-state.ts @@ -1,24 +1,21 @@ -import type { StateCreator } from 'zustand' -import type { AppState } from '../../types' import { haveSameDisabledTuiAgents } from '../../../../../shared/agent-launch/catalog/tui-agent-selection' -import type { TuiAgent } from '../../../../../shared/agent-launch/catalog/tui-agent' import { isTuiAgent } from '../../../../../shared/agent-launch/catalog/tui-agent-config' import { FLOATING_TERMINAL_WORKTREE_ID } from '../../../../../shared/constants' -import { getLocalAgentPreflightContext } from '@/lib/local-preflight-context' -import { localAgentInventoryContextKey } from '@/lib/local-preflight-context-key' +import { getLocalAgentPreflightContext } from '@/runtime/hosts/preflight/local-preflight-context' +import { localAgentInventoryContextKey } from '@/runtime/hosts/preflight/local-preflight-context-key' import * as contextEviction from './local-agent-context-eviction' import { getLegacyLoadingPatch } from './local-agent-legacy-loading' -import { - markLocalAgentRefusal, - refreshLocalAgentInventory, - type LocalAgentInventoryLifecycle -} from './local-agent-inventory-refresh' -import { - createEmptyLocalDetectedAgentState, - type LocalAgentRefreshOptions, - type LocalDetectedAgentState +import { markLocalAgentRefusal, refreshLocalAgentInventory } from './local-agent-inventory-refresh' +import type { LocalAgentInventoryLifecycle } from './local-agent-inventory-refresh' +import { createEmptyLocalDetectedAgentState } from './local-detected-agent-store-state' +import type { + LocalAgentRefreshOptions, + LocalDetectedAgentState } from './local-detected-agent-store-state' import { readLocalAgentInventoryOutcome } from './local-agent-inventory-outcome' +import type { StateCreator } from 'zustand' +import type { AppState } from '../../types' +import type { TuiAgent } from '../../../../../shared/agent-launch/catalog/tui-agent' function haveSameCommandOverrides( a: Partial> | undefined, diff --git a/src/renderer/src/store/slices/browser/pages/browser-page-conversion-actions.ts b/src/renderer/src/store/slices/browser/pages/browser-page-conversion-actions.ts index 917e58c6122..c10a040e1ff 100644 --- a/src/renderer/src/store/slices/browser/pages/browser-page-conversion-actions.ts +++ b/src/renderer/src/store/slices/browser/pages/browser-page-conversion-actions.ts @@ -1,3 +1,12 @@ +import { planBrowserPageConversion } from './browser-page-conversion' +import { findPage, findWorkspace, mirrorWorkspaceFromActivePage } from './browser-page-records' +import { assertManagedBrowserMaterializationAllowed } from '@/lib/workspace/creation/surface-policy/client-creation-action-policy' +import { runtimeEnvironmentIdOrLocalUnlessTwin } from '@/lib/workspace/ownership/worktree-runtime-owner' +import { closeRemoteBrowserPageInOwningEnvironment } from '../hosts/browser-remote-close' +import { releaseDocPreviewGrant } from '@/lib/browser/documents/doc-preview-grants' +import { isLocalBrowserPageOwner } from '../hosts/browser-host-state' +import { ORCA_LAYOUT_OWNER_IS_MAIN } from '../../../../../../shared/layout-owner-switch' +import { sendBrowserLayoutCommand } from '../tabs/browser-layout-owner-commands' import type { BrowserSlice, BrowserSliceGet, @@ -5,15 +14,6 @@ import type { RemoteBrowserPageHandle } from '../browser-slice-contract' import type { BrowserPage } from '../../../../../../shared/browser-workspace-types' -import { planBrowserPageConversion } from './browser-page-conversion' -import { findPage, findWorkspace, mirrorWorkspaceFromActivePage } from './browser-page-records' -import { assertManagedBrowserMaterializationAllowed } from '@/lib/client-creation-action-policy' -import { runtimeEnvironmentIdOrLocalUnlessTwin } from '@/lib/workspace/ownership/worktree-runtime-owner' -import { closeRemoteBrowserPageInOwningEnvironment } from '../hosts/browser-remote-close' -import { releaseDocPreviewGrant } from '@/lib/browser/documents/doc-preview-grants' -import { isLocalBrowserPageOwner } from '../hosts/browser-host-state' -import { ORCA_LAYOUT_OWNER_IS_MAIN } from '../../../../../../shared/layout-owner-switch' -import { sendBrowserLayoutCommand } from '../tabs/browser-layout-owner-commands' export function createBrowserPageConversionActions( set: BrowserSliceSet, diff --git a/src/renderer/src/store/slices/browser/tabs/browser-tab-actions.ts b/src/renderer/src/store/slices/browser/tabs/browser-tab-actions.ts index 043ff04a4e3..dd4eb3154a2 100644 --- a/src/renderer/src/store/slices/browser/tabs/browser-tab-actions.ts +++ b/src/renderer/src/store/slices/browser/tabs/browser-tab-actions.ts @@ -1,10 +1,9 @@ import { createNonSecureContextUuid as createBrowserUuid } from '../../../../../../shared/non-secure-context-uuid' import { translate } from '@/i18n/i18n' -import type { BrowserSlice, BrowserSliceGet, BrowserSliceSet } from '../browser-slice-contract' import { assertManagedBrowserMaterializationAllowed, getClientCreationActionPolicy -} from '@/lib/client-creation-action-policy' +} from '@/lib/workspace/creation/surface-policy/client-creation-action-policy' import { buildBrowserPage, buildWorkspaceFromPage, @@ -24,6 +23,7 @@ import { ORCA_LAYOUT_OWNER_IS_MAIN } from '../../../../../../shared/layout-owner import { openBrowserTabThroughLayoutOwner } from './browser-tab-open-through-layout-owner' import { browserTabOpenView } from './browser-tab-open-view' import { resolveWebRuntimeBrowserClientTargetGroup } from '@/runtime/browser/creation/web-runtime-browser-client-target-group' +import type { BrowserSlice, BrowserSliceGet, BrowserSliceSet } from '../browser-slice-contract' export function createBrowserTabActions( set: BrowserSliceSet, diff --git a/src/renderer/src/store/slices/editor/checks/check-run-details-owner.ts b/src/renderer/src/store/slices/editor/checks/check-run-details-owner.ts index b221c57c702..376d332ec72 100644 --- a/src/renderer/src/store/slices/editor/checks/check-run-details-owner.ts +++ b/src/renderer/src/store/slices/editor/checks/check-run-details-owner.ts @@ -1,8 +1,4 @@ -import type { Repo } from '../../../../../../shared/repo-types' -import { resolveReviewRepository } from '@/lib/review-owner' -import type { AppState } from '../../../types' -import type { OpenFile } from '../types/open-file' -import type { OpenCheckRunDetailsState } from '../../../../../../shared/editor-tab-view-types' +import { resolveReviewRepository } from '@/lib/source-control/review/review-owner' import { getCheckRunTabIdentity } from '@/components/editor/check-details/actions/check-run-details-tab' import { LOCAL_EXECUTION_HOST_ID, @@ -22,9 +18,11 @@ import { import { layoutFrameWorkspace } from '@/runtime/workspace-layout/frames/layout-frame-workspaces' import { resolveWorktreeOperationRoute, - resolveWorktreeOperationRouteForHost, - type WorktreeOperationOwnerRecord, - type WorktreeOperationRoute + resolveWorktreeOperationRouteForHost +} from '@/lib/workspace/ownership/worktree-operation-route' +import type { + WorktreeOperationOwnerRecord, + WorktreeOperationRoute } from '@/lib/workspace/ownership/worktree-operation-route' import { resolveExactWorktreeRoute } from '@/lib/workspace/ownership/worktree-owner-route' import { onPairedWebClientHost } from '@/app-shell/platform/paired-web-client-host' @@ -34,6 +32,10 @@ import { selectDetectedWorktreesByRepo, selectWorktreesByRepo } from '../../../workspaces/catalog/workspace-record-fields' +import type { Repo } from '../../../../../../shared/repo-types' +import type { AppState } from '../../../types' +import type { OpenFile } from '../types/open-file' +import type { OpenCheckRunDetailsState } from '../../../../../../shared/editor-tab-view-types' export type CheckRunDetailsOwnership = Pick< OpenFile, diff --git a/src/renderer/src/store/slices/editor/markdown/markdown-link-action.ts b/src/renderer/src/store/slices/editor/markdown/markdown-link-action.ts index 2236118130d..c4677b1b4a2 100644 --- a/src/renderer/src/store/slices/editor/markdown/markdown-link-action.ts +++ b/src/renderer/src/store/slices/editor/markdown/markdown-link-action.ts @@ -1,20 +1,21 @@ -import type { EditorGet, EditorSet } from '../types/editor-set-get' -import type { EditorSlice } from '../types/editor-slice' import { toast } from 'sonner' import { translate } from '@/i18n/i18n' import { detectLanguage } from '../../../../../../shared/editor-language/editor-language-detect' -import { openHttpLink, type HttpLinkSourceOwner } from '@/lib/browser/navigation/http-link-routing' +import { openHttpLink } from '@/lib/browser/navigation/http-link-routing' +import type { HttpLinkSourceOwner } from '@/lib/browser/navigation/http-link-routing' import { getConnectionIdForFileFromState } from '@/lib/workspace/ownership/connection-owner-resolution' import { isLocalPathOpenBlocked, showLocalPathOpenBlockedToast } from '@/lib/files/os-open/local-path-open-guard' -import { getLinkSourceLocalOpenOwner } from '@/lib/link-source-local-open-owner' +import { getLinkSourceLocalOpenOwner } from '@/lib/links/ownership/link-source-local-open-owner' import { resolveMarkdownLinkTarget } from '@/components/editor/markdown/link-routing/markdown-internal-links' import { runtimeTargetForOwnerEnvironment } from '@/runtime/rpc/targets/runtime-client-target' import { statRuntimePath } from '@/runtime/files/metadata/runtime-file-metadata-client' import { getOpenedEditFileIdAfterOpen } from '../file-ids/editor-file-ids' import { scheduleEditorLineReveal } from '../focus/editor-focus-reveal' +import type { EditorGet, EditorSet } from '../types/editor-set-get' +import type { EditorSlice } from '../types/editor-slice' export function createMarkdownLinkAction( _set: EditorSet, diff --git a/src/renderer/src/store/slices/editor/opening/open-file-action.ts b/src/renderer/src/store/slices/editor/opening/open-file-action.ts index 0dc9ab60870..209527ed441 100644 --- a/src/renderer/src/store/slices/editor/opening/open-file-action.ts +++ b/src/renderer/src/store/slices/editor/opening/open-file-action.ts @@ -1,19 +1,20 @@ import { editorPlacementIntent } from '../tabs/editor-placement-intent' +import { openWorkspaceEditorItem } from '../tabs/workspace-editor-item' +import { editorTabContentTypeForMode } from '../tabs/editor-tab-content-type' +import { isLiveLinkOpenGroup as isLiveEditorOpenGroup } from '../../../../lib/links/placement/link-open-intent' +import { EDITOR_FOCUS_REQUEST_TTL_MS } from '../types/pending-editor-reveal' +import { takeNextEditorFocusRequestToken } from '../focus/editor-focus-reveal' +import { applyOpenFileToState } from './open-file-apply' +import type { OpenFileApplyScratch } from './open-file-apply' +import { + afterPendingTab, + pendingTabGroupId +} from '@/runtime/workspace-layout/intents/layout-owner-pending-tabs' import type { EditorGet, EditorSet } from '../types/editor-set-get' import type { EditorSlice } from '../types/editor-slice' import type { OpenFile } from '../types/open-file' import type { OpenFileOptions } from '../types/editor-files-slice' import type { EditorOpenLinkIntent, EditorOpenResult } from '../types/editor-open-link-intent' -import { openWorkspaceEditorItem } from '../tabs/workspace-editor-item' -import { editorTabContentTypeForMode } from '../tabs/editor-tab-content-type' -import { isLiveLinkOpenGroup as isLiveEditorOpenGroup } from '../../../../lib/link-open-intent' -import { EDITOR_FOCUS_REQUEST_TTL_MS } from '../types/pending-editor-reveal' -import { takeNextEditorFocusRequestToken } from '../focus/editor-focus-reveal' -import { applyOpenFileToState, type OpenFileApplyScratch } from './open-file-apply' -import { - afterPendingTab, - pendingTabGroupId -} from '@/runtime/workspace-layout/intents/layout-owner-pending-tabs' export function createOpenFileAction( set: EditorSet, diff --git a/src/renderer/src/store/slices/editor/tabs/editor-open-adjacent-group.ts b/src/renderer/src/store/slices/editor/tabs/editor-open-adjacent-group.ts index bd4e8faff0b..903e3b9d963 100644 --- a/src/renderer/src/store/slices/editor/tabs/editor-open-adjacent-group.ts +++ b/src/renderer/src/store/slices/editor/tabs/editor-open-adjacent-group.ts @@ -1,6 +1,7 @@ -import { pickAdjacentLinkOpenGroupId } from '@/lib/adjacent-link-open-group' +import { pickAdjacentLinkOpenGroupId } from '@/lib/links/placement/adjacent-link-open-group' +import { isEditorTabContentType } from './editor-tab-content-type' +import type { EditorTabContentType } from './editor-tab-content-type' import type { Tab, TabGroup, TabGroupLayoutNode } from '../../../../../../shared/tab-types' -import { isEditorTabContentType, type EditorTabContentType } from './editor-tab-content-type' type AdjacentEditorOpenInput = { layout: TabGroupLayoutNode diff --git a/src/renderer/src/store/slices/editor/tabs/editor-open-target-group.ts b/src/renderer/src/store/slices/editor/tabs/editor-open-target-group.ts index e51bf73a12d..09683763b2f 100644 --- a/src/renderer/src/store/slices/editor/tabs/editor-open-target-group.ts +++ b/src/renderer/src/store/slices/editor/tabs/editor-open-target-group.ts @@ -1,14 +1,14 @@ +import { editorTabContentTypeForMode, isEditorTabContentType } from './editor-tab-content-type' +import { ownsGlobalSelection } from '../../../workspaces/selection/global-selection-owner' +import { pickAdjacentEditorOpenGroupId } from './editor-open-adjacent-group' +import { captureLinkOpenIntent, isLiveLinkOpenGroup } from '@/lib/links/placement/link-open-intent' +import type { LinkPlacementState } from '@/lib/links/placement/link-open-intent' +import { collectTabGroupLayoutGroupIds } from '../../../../../../shared/workspace-layout/tab-group-moves' +import { resolveLinkOpenSidePlacement } from '@/lib/links/placement/adjacent-link-open-group' import type { AppState } from '../../../types' import type { Tab, TabGroup, WorkspaceVisibleTabType } from '../../../../../../shared/tab-types' -import { editorTabContentTypeForMode, isEditorTabContentType } from './editor-tab-content-type' import type { OpenFile } from '../types/open-file' -import { ownsGlobalSelection } from '../../../workspaces/selection/global-selection-owner' import type { EditorOpenLinkIntent } from '../types/editor-open-link-intent' -import { pickAdjacentEditorOpenGroupId } from './editor-open-adjacent-group' -import { captureLinkOpenIntent, isLiveLinkOpenGroup } from '@/lib/link-open-intent' -import type { LinkPlacementState } from '@/lib/link-open-intent' -import { collectTabGroupLayoutGroupIds } from '../../../../../../shared/workspace-layout/tab-group-moves' -import { resolveLinkOpenSidePlacement } from '@/lib/adjacent-link-open-group' import type { TabSplitTarget } from '../../tabs/tabs-slice-contract' export function captureEditorOpenLinkIntent( diff --git a/src/renderer/src/store/slices/hosted-review/workspace-review-repository.ts b/src/renderer/src/store/slices/hosted-review/workspace-review-repository.ts index 9747229fd07..de698b61799 100644 --- a/src/renderer/src/store/slices/hosted-review/workspace-review-repository.ts +++ b/src/renderer/src/store/slices/hosted-review/workspace-review-repository.ts @@ -1,11 +1,11 @@ -import type { Repo } from '../../../../../shared/repo-types' -import type { Worktree } from '../../../../../shared/worktree/types' import { resolveReviewRepository, reviewRepositoryMatchesWorkspace -} from '../../../lib/review-owner' +} from '../../../lib/source-control/review/review-owner' import { selectRepoByIdForActiveWorkspace } from '../../repos/active-workspace-repository' import type { ActiveWorkspaceRepoState } from '../../repos/active-workspace-repository' +import type { Repo } from '../../../../../shared/repo-types' +import type { Worktree } from '../../../../../shared/worktree/types' export function selectReviewRepositoryForWorkspace( state: ActiveWorkspaceRepoState, diff --git a/src/renderer/src/store/slices/preflight/preflight.ts b/src/renderer/src/store/slices/preflight/preflight.ts index 39874460378..231ccd48f00 100644 --- a/src/renderer/src/store/slices/preflight/preflight.ts +++ b/src/renderer/src/store/slices/preflight/preflight.ts @@ -1,15 +1,15 @@ +import { callRuntimeRpc } from '@/runtime/rpc/calls/runtime-rpc-call' +import { defaultScopeHost } from '@/runtime/hosts/selection/default-creation-host' +import { getActiveWorkspaceOwnerTarget } from '@/lib/workspace/ownership/resolved-worktree-execution-host' +import { getLocalPreflightContext } from '@/runtime/hosts/preflight/local-preflight-context' +import { localPreflightContextKey } from '@/runtime/hosts/preflight/local-preflight-context-key' import type { StateCreator } from 'zustand' import type { PreflightRuntimeContext, PreflightStatus } from '../../../../../preload/api/preflight-api' import type { AppState } from '../../types' -import { callRuntimeRpc } from '@/runtime/rpc/calls/runtime-rpc-call' -import { defaultScopeHost } from '@/runtime/hosts/selection/default-creation-host' -import { getActiveWorkspaceOwnerTarget } from '@/lib/workspace/ownership/resolved-worktree-execution-host' -import { getLocalPreflightContext } from '@/lib/local-preflight-context' -import { localPreflightContextKey } from '@/lib/local-preflight-context-key' -import type { LocalPreflightContext } from '@/lib/local-preflight-context-cache' +import type { LocalPreflightContext } from '@/runtime/hosts/preflight/local-preflight-context-cache' export type PreflightSlice = { preflightStatus: PreflightStatus | null diff --git a/src/renderer/src/store/slices/worktrees/create/worktree-create-parent-pick.ts b/src/renderer/src/store/slices/worktrees/create/worktree-create-parent-pick.ts index 8f8776d15b7..66bdf6fdaf6 100644 --- a/src/renderer/src/store/slices/worktrees/create/worktree-create-parent-pick.ts +++ b/src/renderer/src/store/slices/worktrees/create/worktree-create-parent-pick.ts @@ -1,14 +1,12 @@ -import type { AppState } from '../../../types' - import { toast } from 'sonner' import { translate } from '@/i18n/i18n' import { resolveWorktreeDisplayName } from '@/lib/workspace/display/worktree-default-display-name' import { - type WorkspaceKey, folderWorkspaceKey, parseWorkspaceKey, worktreeWorkspaceKey } from '../../../../../../shared/workspace-scope' +import type { WorkspaceKey } from '../../../../../../shared/workspace-scope' import { getIndexedAllWorktrees, getIndexedWorktreesById @@ -17,14 +15,9 @@ import { getWorktreeHostIdentity, isWorktreeHostIdentity } from '../../../../../../shared/worktree/host-qualified-identity' -import type { Worktree } from '../../../../../../shared/worktree/types' -import type { RuntimeClientTarget } from '../../../../../../shared/runtime-client-target' -import type { CreatedWorktreeResult } from './worktree-create-payload' -import { resolveReviewRepository } from '@/lib/review-owner' -import { - getRepoExecutionHostId, - type ExecutionHostId -} from '../../../../../../shared/execution-host' +import { resolveReviewRepository } from '@/lib/source-control/review/review-owner' +import { getRepoExecutionHostId } from '../../../../../../shared/execution-host' +import type { ExecutionHostId } from '../../../../../../shared/execution-host' import { findFolderWorkspaceRecord } from '../../../folder-workspaces/folder-workspace-record-index' import { selectFolderWorkspaces, @@ -32,6 +25,10 @@ import { } from '../../../workspaces/catalog/workspace-record-fields' import { getFolderWorkspaceWorktree } from '../../../../../../shared/folder-workspaces/folder-workspace-worktree' import { lineageStoreKeyOfRow } from '../../../../../../shared/worktree/cross-store-lineage-resolution' +import type { AppState } from '../../../types' +import type { Worktree } from '../../../../../../shared/worktree/types' +import type { RuntimeClientTarget } from '../../../../../../shared/runtime-client-target' +import type { CreatedWorktreeResult } from './worktree-create-payload' export type CreateAttemptOutcome = { result: CreatedWorktreeResult diff --git a/src/renderer/src/store/slices/worktrees/metadata/update-worktree-meta.ts b/src/renderer/src/store/slices/worktrees/metadata/update-worktree-meta.ts index a14bd10e8a0..77d3c6969e9 100644 --- a/src/renderer/src/store/slices/worktrees/metadata/update-worktree-meta.ts +++ b/src/renderer/src/store/slices/worktrees/metadata/update-worktree-meta.ts @@ -8,14 +8,11 @@ import { normalizeWorkspaceAttachmentUpdate } from '../../../../../../shared/workspace-attachments/workspace-attachments' import { normalizeGitHubPRSuppressionUpdate } from '../../../../../../shared/worktree/github-pr-suppression' - -import type { WorktreeSliceGet, WorktreeSliceSet } from '../listing/worktree-slice-types' import { translate } from '@/i18n/i18n' import { isPositiveHostedReviewNumber } from '../../../../../../shared/source-control/hosted-review/hosted-review-contracts' import { displayNameUpdatePinsLabel } from '../../../../../../shared/worktree/display-name-provenance' import { parseWorkspaceKey } from '../../../../../../shared/workspace-scope' import { ORCA_SIDEBAR_INPUTS_IS_MAIN } from '../../../../../../shared/sidebar-inputs-switch' -import type { WorktreeSlice } from '../worktree-slice-contract' import { getRepoIdFromWorktreeId } from '../../../../../../shared/worktree/id' import { findKnownWorktreeById, @@ -36,10 +33,12 @@ import { withPendingSidebarRowWrites } from '@/components/sidebar/sidebar-feed/s import { isRuntimeSelectorNotFoundError } from '../listing/runtime-worktree-rpc-errors' import { runtimeTargetForWorktreeOwner } from '../listing/worktree-owner-target' import { runtimeTargetForWorkspaceOwner } from '@/lib/workspace/ownership/resolve-owner' - import { hasUniqueIndexedRepositoryHost } from '@/lib/workspace/ownership/repository-owner-index' -import { resolveReviewRepository } from '@/lib/review-owner' +import { resolveReviewRepository } from '@/lib/source-control/review/review-owner' import { getRepoExecutionHostId } from '../../../../../../shared/execution-host' +import type { WorktreeSliceGet, WorktreeSliceSet } from '../listing/worktree-slice-types' +import type { WorktreeSlice } from '../worktree-slice-contract' + export function createUpdateWorktreeMeta( set: WorktreeSliceSet, get: WorktreeSliceGet diff --git a/src/renderer/src/store/slices/worktrees/session/set-active-worktree.ts b/src/renderer/src/store/slices/worktrees/session/set-active-worktree.ts index 6ea7be84063..28b034ae4ce 100644 --- a/src/renderer/src/store/slices/worktrees/session/set-active-worktree.ts +++ b/src/renderer/src/store/slices/worktrees/session/set-active-worktree.ts @@ -1,6 +1,4 @@ import { cancelActiveWorktreeRemoval } from '@/store/workspaces/selection/active-worktree-deselection-intent' -import type { WorktreeSlice } from '../worktree-slice-contract' -import type { WorktreeSliceGet, WorktreeSliceSet } from '../listing/worktree-slice-types' import { projectWorktreeTabModelReconciliation } from '../../tabs/tabs-reconciliation' import { moveFocusToRendererBeforeFocusedWebviewHidden } from '../../../../components/browser-pane/host-guest/webview-registry' import { tabHasLivePty } from '../../../../../../shared/tab-has-live-pty' @@ -21,11 +19,13 @@ import { } from '../../../../../../shared/workspace-scope' import { findKnownWorktreeById } from '../listing/detected-worktree-meta' import { resolveActivatedWorktreeSurface } from './active-worktree-surface' -import { clearWorktreeSleepIntent } from '@/lib/worktree-sleep-intent' +import { clearWorktreeSleepIntent } from '@/lib/workspace/sleep/worktree-sleep-intent' import { pendingActivationTerminalPrepCancels, shouldDeferActivationTerminalPrep } from './activation-terminal-prep' +import type { WorktreeSlice } from '../worktree-slice-contract' +import type { WorktreeSliceGet, WorktreeSliceSet } from '../listing/worktree-slice-types' export function createSetActiveWorktree( set: WorktreeSliceSet, diff --git a/src/renderer/src/store/slices/worktrees/session/workspace-activation-preparation.test.ts b/src/renderer/src/store/slices/worktrees/session/workspace-activation-preparation.test.ts index 2198d1faa0e..9b827510808 100644 --- a/src/renderer/src/store/slices/worktrees/session/workspace-activation-preparation.test.ts +++ b/src/renderer/src/store/slices/worktrees/session/workspace-activation-preparation.test.ts @@ -1,16 +1,16 @@ import { afterEach, expect, it, vi } from 'vitest' import { installAttentionScreen } from '../../workspace-attention/workspace-unread-characterization-fixture' import { folderWorkspaceKey } from '../../../../../../shared/workspace-scope' -import type { ExecutionHostId } from '../../../../../../shared/execution-host' import { markWorktreeSleepIntent, onWorktreeSleepIntentCleared, forgetWorktreeSleepIntent -} from '@/lib/worktree-sleep-intent' +} from '@/lib/workspace/sleep/worktree-sleep-intent' import { createTestStore } from '../../../testing/app-store-test-fixture' import { makeTab } from '../../../terminals/terminal-tab.test-fixture' import { makeWorktree } from '../worktree.test-fixture' import { makeFolderWorkspace } from '../../../folder-workspaces/folder-workspace.test-fixture' +import type { ExecutionHostId } from '../../../../../../shared/execution-host' const FOLDER_ID = 'folder-activation' const FOLDER_KEY = folderWorkspaceKey(FOLDER_ID) diff --git a/src/renderer/src/store/slices/worktrees/teardown/remove-worktree.ts b/src/renderer/src/store/slices/worktrees/teardown/remove-worktree.ts index d914bea13c5..898760bd9eb 100644 --- a/src/renderer/src/store/slices/worktrees/teardown/remove-worktree.ts +++ b/src/renderer/src/store/slices/worktrees/teardown/remove-worktree.ts @@ -1,12 +1,9 @@ import { getRepoIdFromWorktreeId } from '../../../../../../shared/worktree/id' -import type { WorktreeSlice } from '../worktree-slice-contract' -import type { WorktreeSliceGet, WorktreeSliceSet } from '../listing/worktree-slice-types' -import type { RemoveWorktreeResult } from '../../../../../../shared/worktree/create-types' import { parseExecutionHostId } from '../../../../../../shared/execution-host' import { ensureHooksConfirmed } from '@/runtime/repo-hooks/ensure-hooks-confirmed' import { runtimeTargetForOwnerEnvironment } from '../../../../runtime/rpc/targets/runtime-client-target' import { forgetHugeRepoWarningDismissalsForWorktrees } from '@/lib/source-control/warnings/source-control-huge-repo-warning-dismissals' -import { forgetWorktreeSleepIntent } from '@/lib/worktree-sleep-intent' +import { forgetWorktreeSleepIntent } from '@/lib/workspace/sleep/worktree-sleep-intent' import { readIpcErrorDetail } from '@/runtime/errors/ipc-error' import { isArchiveHookRemovalError } from '../../../../../../shared/worktree/archive-hook-removal-gate' import { @@ -47,6 +44,9 @@ import { } from './worktree-state-before-removal' import { resolveWorktreeRemovalPreference } from './worktree-removal-preference' import { completePreservedBranchCleanup } from './complete-preserved-branch-cleanup' +import type { WorktreeSlice } from '../worktree-slice-contract' +import type { WorktreeSliceGet, WorktreeSliceSet } from '../listing/worktree-slice-types' +import type { RemoveWorktreeResult } from '../../../../../../shared/worktree/create-types' export function createRemoveWorktree( set: WorktreeSliceSet, diff --git a/src/renderer/src/store/slices/worktrees/teardown/worktree-purge-state.ts b/src/renderer/src/store/slices/worktrees/teardown/worktree-purge-state.ts index 6f352b264a9..e48a9fc9883 100644 --- a/src/renderer/src/store/slices/worktrees/teardown/worktree-purge-state.ts +++ b/src/renderer/src/store/slices/worktrees/teardown/worktree-purge-state.ts @@ -1,7 +1,5 @@ import { retireRemovedWorktreeCommitDrafts } from '@/lib/source-control/drafts/source-control-commit-draft-session' -import type { AppState } from '../../../types' import { forgetCombinedDiffViewsForWorktrees } from '@/components/editor/combined-diff/remember-view/combined-diff-view-cache' -import type { WorktreePurgeTarget, WorktreePurgeTargets } from './worktree-purge-target' import { forgetHugeRepoWarningDismissalsForWorktrees } from '@/lib/source-control/warnings/source-control-huge-repo-warning-dismissals' import { parseWorkspaceKey } from '../../../../../../shared/workspace-scope' import { pruneHostedReviewLinkMutationGenerations } from '../metadata/hosted-review-link-mutation' @@ -12,7 +10,7 @@ import { removeDeleteStatesForWorktreeIds } from './worktree-delete-state' import { omitRecordKeys } from './record-key-omission' import { removeWorktreeVisitEntriesForTargets } from '@/lib/workspace/activation/worktree-visit-recency' import { forgetAmbiguousOwnerWarnings } from '@/lib/workspace/ownership/ambiguous-owner-warning' -import { forgetWorktreeSleepIntent } from '@/lib/worktree-sleep-intent' +import { forgetWorktreeSleepIntent } from '@/lib/workspace/sleep/worktree-sleep-intent' import { removeWorktreeLayout } from '../../tabs/worktree-layout-lifecycle' import { cancelStructuredLaunchesForWorktrees, @@ -24,6 +22,8 @@ import { mergeEditorBufferKeepRequests } from '../../editor/buffers/editor-buffe import { buildHostTwinPurgeState } from './host-twin-worktree-purge' import { collectHostTwinPurgeScopes } from './host-twin-purge-scopes' import { composeWorktreeHostIdentity } from '../../../../../../shared/worktree/host-qualified-identity' +import type { AppState } from '../../../types' +import type { WorktreePurgeTarget, WorktreePurgeTargets } from './worktree-purge-target' /** * Builds a bulk cleanup patch and clears auxiliary warning records without requiring individual diff --git a/src/renderer/src/store/terminals/terminal-created-shell.ts b/src/renderer/src/store/terminals/terminal-created-shell.ts index 332ff6654e5..29af824167a 100644 --- a/src/renderer/src/store/terminals/terminal-created-shell.ts +++ b/src/renderer/src/store/terminals/terminal-created-shell.ts @@ -1,4 +1,4 @@ -import { getLocalProjectExecutionRuntimeContext } from '@/lib/local-preflight-context' +import { getLocalProjectExecutionRuntimeContext } from '@/runtime/hosts/preflight/local-preflight-context' import { getProjectRuntimeFolder } from '@/runtime/hosts/wsl/local-project-runtime-workspace' import { findLocalFolderWorkspaceRuntimeRepo } from '../../../../shared/folder-workspaces/folder-workspace-execution-host' import { folderWorkspaceToWorktree } from '../../../../shared/folder-workspaces/folder-workspace-worktree' diff --git a/src/renderer/src/store/terminals/terminal-ephemeral-state.ts b/src/renderer/src/store/terminals/terminal-ephemeral-state.ts index 92e0bdac894..25135453aea 100644 --- a/src/renderer/src/store/terminals/terminal-ephemeral-state.ts +++ b/src/renderer/src/store/terminals/terminal-ephemeral-state.ts @@ -1,5 +1,5 @@ import { isClaudeAgent as isClaudeAgentDefault } from '../../../../shared/agent-status/title/agent-title-identity' -import { recordTerminalInputActivity } from '@/lib/terminal-input-activity-coalescing' +import { recordTerminalInputActivity } from '@/lib/terminal/input/terminal-input-activity-coalescing' import { detectAgentStatusFromTitle } from '../../../../shared/agent-status/title/agent-title-status' import type { TerminalSlice, TerminalStoreGet, TerminalStoreSet } from './terminal-state' diff --git a/src/renderer/src/store/terminals/terminal-pty-bindings.ts b/src/renderer/src/store/terminals/terminal-pty-bindings.ts index d8c8b684a83..3a78952fa45 100644 --- a/src/renderer/src/store/terminals/terminal-pty-bindings.ts +++ b/src/renderer/src/store/terminals/terminal-pty-bindings.ts @@ -6,14 +6,14 @@ import { toRemoteRuntimePtyId } from '../../../../shared/remote-runtime/remote-runtime-pty-id' import { isTerminalTabPresent } from './terminal-tab-retirement' -import type { TerminalSlice, TerminalStoreGet, TerminalStoreSet } from './terminal-state' import { consumePendingActivationSpawn, getPendingActivationSpawnCount } from './terminal-pty-identities' import { omitUnverifiedPtyLossTabIds } from './terminal-unverified-pty-loss' -import { clearWorktreeSleepIntent } from '@/lib/worktree-sleep-intent' +import { clearWorktreeSleepIntent } from '@/lib/workspace/sleep/worktree-sleep-intent' import { omitDisownedPtyIds } from './terminal-disowned-pty-sources' +import type { TerminalSlice, TerminalStoreGet, TerminalStoreSet } from './terminal-state' export function createTerminalPtyBindingActions( set: TerminalStoreSet, diff --git a/src/renderer/src/store/terminals/terminal-pty-release.ts b/src/renderer/src/store/terminals/terminal-pty-release.ts index ec3caf8c47e..06fe7c9dda9 100644 --- a/src/renderer/src/store/terminals/terminal-pty-release.ts +++ b/src/renderer/src/store/terminals/terminal-pty-release.ts @@ -1,12 +1,12 @@ import { replaceTabBuckets, replaceRecordEntries } from '@/store/keyed-record-transitions' import { getFirstTerminalTabOwnerWorktreeId } from './terminal-tab-owner-index' import { isRemoteRuntimePtyId } from '../../../../shared/remote-runtime/remote-runtime-pty-id' -import { hasWorktreeSleepIntent } from '@/lib/worktree-sleep-intent' -import type { TerminalSlice, TerminalStoreGet, TerminalStoreSet } from './terminal-state' +import { hasWorktreeSleepIntent } from '@/lib/workspace/sleep/worktree-sleep-intent' import { consumePendingActivationSpawn, getPendingActivationSpawnCount } from './terminal-pty-identities' +import type { TerminalSlice, TerminalStoreGet, TerminalStoreSet } from './terminal-state' export function createTerminalPtyReleaseActions( set: TerminalStoreSet, diff --git a/src/renderer/src/store/terminals/terminal-tab-creation.ts b/src/renderer/src/store/terminals/terminal-tab-creation.ts index 0a6fbefaaf9..92e7e84f477 100644 --- a/src/renderer/src/store/terminals/terminal-tab-creation.ts +++ b/src/renderer/src/store/terminals/terminal-tab-creation.ts @@ -1,7 +1,6 @@ import { resolveTerminalCreatedShell } from './terminal-created-shell' import { warnIfZCodeCannotOpenSession } from '@/components/terminal-pane/provider-notices/zcode-capability/zcode-missing-tui-notice' -import { clearWorktreeSleepIntent } from '@/lib/worktree-sleep-intent' -import type { TerminalTab } from '../../../../shared/workspace-layout/terminal-tab-types' +import { clearWorktreeSleepIntent } from '@/lib/workspace/sleep/worktree-sleep-intent' import { isValidHostTerminalTabId, isValidMirroredHostTerminalTabId @@ -23,17 +22,18 @@ import { dedupeTabOrder } from '../../../../shared/workspace-layout/tab-order' import { createNonSecureContextUuid as createBrowserUuid } from '../../../../shared/non-secure-context-uuid' import { emptySplitGroup, splitGroupEntries } from '../slices/tabs/tabs-group-actions' import { ownsGlobalSelection } from '../workspaces/selection/global-selection-owner' -import type { TerminalSlice, TerminalStoreGet, TerminalStoreSet } from './terminal-state' import { ORCA_LAYOUT_OWNER_IS_MAIN } from '../../../../shared/layout-owner-switch' import { recordCreatedTerminalTabInLayoutOwner, terminalTabCreateCommand, withMainTerminalFacts } from './terminal-tab-create-through-layout-owner' -import type { AppState } from '../types' import { normalizeTabStartupCommand } from './terminal-startup-queues' import { replaceRecordEntries, replaceTabBuckets } from '../keyed-record-transitions' import { applyRecordOperations } from './terminal-companion-record-operations' +import type { TerminalTab } from '../../../../shared/workspace-layout/terminal-tab-types' +import type { TerminalSlice, TerminalStoreGet, TerminalStoreSet } from './terminal-state' +import type { AppState } from '../types' export function createTerminalTabCreationActions( set: TerminalStoreSet, diff --git a/src/renderer/src/store/workspace-layout/frames/workspace-layout-frame-browser-handover.ts b/src/renderer/src/store/workspace-layout/frames/workspace-layout-frame-browser-handover.ts index 4861d4d95b8..d6c030d8945 100644 --- a/src/renderer/src/store/workspace-layout/frames/workspace-layout-frame-browser-handover.ts +++ b/src/renderer/src/store/workspace-layout/frames/workspace-layout-frame-browser-handover.ts @@ -1,4 +1,4 @@ -import { noteStagedBrowserTabHandedToFrames } from '@/lib/staged-browser-frame-handover' +import { noteStagedBrowserTabHandedToFrames } from '@/runtime/browser/creation/staged-browser-frame-handover' /** Only what the handover reads of the store's browser pages and their handles. */ type BrowserPages = { diff --git a/src/renderer/src/store/workspaces/host-isolation/host-twin-isolation.test.ts b/src/renderer/src/store/workspaces/host-isolation/host-twin-isolation.test.ts deleted file mode 100644 index 2c1fd2ae546..00000000000 --- a/src/renderer/src/store/workspaces/host-isolation/host-twin-isolation.test.ts +++ /dev/null @@ -1,257 +0,0 @@ -/** Twin-targeted actions must isolate survivors. Keep the hand-declared action table current; KNOWN_TWIN_LEAKS pins Stage 1 failures, so fixes require removing their entries. */ -import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' - -import { hostWorktreeTarget } from '../../../../../shared/worktree/host-qualified-identity' -import { - createCompatibleRuntimeStatusResponseIfNeeded, - type RuntimeEnvironmentCallRequest -} from '../../../runtime/rpc/testing/runtime-compatibility-test-fixture' -import { clearRuntimeCompatibilityCache as clearRuntimeCompatibilityCacheForTests } from '../../../runtime/rpc/compatibility/runtime-compatibility-cache' -import { hasWorktreeSleepIntent } from '@/lib/worktree-sleep-intent' -import { - changedHostTwinState, - projectHostTwinState, - resetHostTwinModuleStores -} from './host-twin-state-projection.test-fixture' -import { - createHostTwinFixture, - TWIN_RUNTIME_ENV, - type HostTwinFixture, - type HostTwinKind, - type HostTwinSide -} from './host-twin.test-fixture' - -const appStore = vi.hoisted((): { current: HostTwinFixture['store'] | null } => ({ - current: null -})) - -// Why: the sleep flow reads the app singleton; route it to this test's store. -vi.mock('@/store', () => ({ - useAppStore: { - getState: () => { - if (!appStore.current) { - throw new Error('no twin fixture store bound') - } - return appStore.current.getState() - }, - subscribe: (listener: Parameters[0]) => - appStore.current?.subscribe(listener) ?? (() => {}) - } -})) - -vi.mock('sonner', () => ({ - toast: { info: vi.fn(), success: vi.fn(), error: vi.fn(), warning: vi.fn() } -})) - -const { sleepWorktreesReportingFailures } = - await import('@/components/sidebar/workspace-actions/sleep/sleep-worktree-flow') -const { fakeMainSleep } = - await import('@/components/sidebar/workspace-actions/sleep/sleep-worktree-test-main') - -const ptyKill = vi.fn() - -function answerLikeHost(args: RuntimeEnvironmentCallRequest): unknown { - const compatible = createCompatibleRuntimeStatusResponseIfNeeded(args) - if (compatible) { - return compatible - } - const result = - args.method === 'terminal.sleep' - ? { - stopped: 1, - stoppedPtyIds: [], - livePtyIds: [], - postStopVerified: true - } - : {} - return { - id: args.method, - ok: true, - result, - _meta: { runtimeId: 'runtime-b' } - } -} - -beforeEach(() => { - clearRuntimeCompatibilityCacheForTests() - ptyKill.mockReset() - vi.stubGlobal('window', { - api: { - repos: { remove: vi.fn(), removeForHost: vi.fn() }, - folderWorkspaces: { delete: vi.fn().mockResolvedValue(true) }, - pty: { kill: ptyKill }, - gh: { enqueuePRRefresh: vi.fn().mockResolvedValue(undefined) }, - runtimeEnvironments: { - call: vi.fn(answerLikeHost), - list: vi.fn().mockResolvedValue([{ id: TWIN_RUNTIME_ENV }]) - }, - ui: { set: vi.fn().mockResolvedValue(undefined) }, - // Main runs the sleep; the window follows its notices as in the app. - worktrees: { sleep: fakeMainSleep().sleep, sleepReopened: vi.fn() } - } - }) -}) - -let current: HostTwinFixture | null = null - -afterEach(() => { - if (current) { - resetHostTwinModuleStores(current) - } - current = null - appStore.current = null - vi.unstubAllGlobals() -}) - -type TwinAction = { - id: string - /** The entry point under test; review this table when one is added or moved. */ - source: string - appliesTo: (kind: HostTwinKind) => boolean - run: (fixture: HostTwinFixture, target: HostTwinSide) => Promise - /** Proves the action reached its target, so an isolated no-op can't pass. */ - applied: (fixture: HostTwinFixture, target: HostTwinSide) => void - // Workspace-wide by design (user decision 2026-10-17): assert survivor was acted on too. - wholeWorkspace?: (fixture: HostTwinFixture, survivor: HostTwinSide) => void -} - -const survivorStopped = (f: HostTwinFixture, survivor: HostTwinSide) => - expect(f.store.getState().ptyIdsByTabId[survivor.terminalTabId] ?? []).toEqual([]) - -const isFolderKind = (kind: HostTwinKind) => - kind === 'folder local+ssh' || kind === 'folder group local+ssh' -const settle = async (run: () => unknown) => { - try { - await run() - } catch { - // A refusal is an acceptable outcome; the isolation assertion is what matters. - } -} - -const TWIN_ACTIONS: readonly TwinAction[] = [ - { - id: 'remove project', - source: 'store/repos/repo-removal.ts removeProject', - appliesTo: (kind) => !isFolderKind(kind), - run: (f, target) => f.store.getState().removeProject(f.projectId, { hostId: target.hostId }), - applied: (f, target) => - expect(f.store.getState().repos.map((repo) => repo.executionHostId)).not.toContain( - target.hostId - ) - }, - { - id: 'delete folder workspace', - source: 'store/folder-workspaces/folder-workspace-mutations.ts deleteFolderWorkspace', - // Why: one unstamped row can't be deleted on one host only; the no-host case is below. - appliesTo: (kind) => kind === 'folder local+ssh', - run: (f, target) => - f.store.getState().deleteFolderWorkspace(f.projectId, { executionHostId: target.hostId }), - applied: (f, target) => - expect( - (f.store.getState().folderWorkspaces ?? []).map((folder) => folder.executionHostId) - ).not.toContain(target.hostId) - }, - { - id: 'purge terminal state', - source: 'store/slices/worktrees.ts purgeWorktreeTerminalState', - appliesTo: () => true, - run: async (f, target) => - f.store - .getState() - .purgeWorktreeTerminalState([ - hostWorktreeTarget({ id: f.workspaceKey, hostId: target.hostId }) - ]), - applied: (f, target) => - expect(f.store.getState().ptyIdsByTabId[target.terminalTabId]).toBeUndefined() - }, - { - id: 'kill terminals', - source: 'store/terminals/terminal-shutdown.ts shutdownWorktreeTerminals', - appliesTo: () => true, - // Why raw id: a twin's copies share one workspace, so killing one kills both. - run: (f) => settle(() => f.store.getState().shutdownWorktreeTerminals(f.workspaceKey)), - applied: (f, target) => - expect(f.store.getState().ptyIdsByTabId[target.terminalTabId] ?? []).toEqual([]), - wholeWorkspace: survivorStopped - }, - { - id: 'sleep', - source: 'components/sidebar/sleep-worktree-flow.ts sleepWorktreesReportingFailures', - appliesTo: () => true, - run: (f) => settle(() => sleepWorktreesReportingFailures([f.workspaceKey])), - applied: (f, target) => - expect(f.store.getState().ptyIdsByTabId[target.terminalTabId] ?? []).toEqual([]), - wholeWorkspace: survivorStopped - }, - { - id: 'select', - source: 'store/slices/worktrees.ts setActiveWorktree / setActiveFolderWorkspace', - // Why: a single unstamped folder row has no SSH copy to select. - appliesTo: (kind) => kind !== 'folder group local+ssh', - run: async (f, target) => - isFolderKind(f.kind) - ? f.store.getState().setActiveFolderWorkspace(f.projectId, target.hostId) - : f.store.getState().setActiveWorktree(f.workspaceKey, target.hostId), - applied: (f, target) => - expect(f.store.getState().activeWorkspaceExecutionHostId).toBe(target.hostId), - // Why: opening either copy wakes the shared workspace marker for both. - wholeWorkspace: (f) => expect(hasWorktreeSleepIntent(f.workspaceKey)).toBe(false) - } -] - -const TWIN_KINDS: readonly HostTwinKind[] = [ - 'local+ssh', - 'local+runtime', - 'folder local+ssh', - 'folder group local+ssh' -] - -/** ` | | ` → why the survivor is touched today (tracker Stage 1 worklist). */ -const KNOWN_TWIN_LEAKS: Readonly> = Object.fromEntries([]) - -function cellId(action: TwinAction, kind: HostTwinKind, target: 'local' | 'remote'): string { - return `${action.id} | ${kind} | ${target}` -} - -describe('an action on one twin leaves the other twin alone', () => { - for (const kind of TWIN_KINDS) { - for (const action of TWIN_ACTIONS.filter((a) => a.appliesTo(kind))) { - for (const targetName of ['remote', 'local'] as const) { - const id = cellId(action, kind, targetName) - const knownLeak = KNOWN_TWIN_LEAKS[id] - const label = action.wholeWorkspace - ? `${id} (whole workspace by design)` - : knownLeak - ? `${id} (known leak: ${knownLeak})` - : id - it(label, async () => { - const fixture = createHostTwinFixture(kind) - current = fixture - appStore.current = fixture.store - const target = fixture[targetName] - const survivor = targetName === 'remote' ? fixture.local : fixture.remote - const before = projectHostTwinState(fixture, survivor) - - await action.run(fixture, target) - - const after = projectHostTwinState(fixture, survivor) - const changed = changedHostTwinState(before, after) - action.applied(fixture, target) - if (action.wholeWorkspace) { - action.wholeWorkspace(fixture, survivor) - return - } - if (knownLeak) { - // Fixed? Delete this cell's KNOWN_TWIN_LEAKS entry. - expect(changed).not.toEqual([]) - return - } - expect(changed).toEqual([]) - if (survivor.hostId === 'local') { - expect(ptyKill).not.toHaveBeenCalledWith(survivor.ptyId) - } - }) - } - } - } -}) diff --git a/src/renderer/src/store/workspaces/host-isolation/host-twin-state-projection.test-fixture.ts b/src/renderer/src/store/workspaces/host-isolation/host-twin-state-projection.test-fixture.ts index 71ab74ac987..977159ff3ac 100644 --- a/src/renderer/src/store/workspaces/host-isolation/host-twin-state-projection.test-fixture.ts +++ b/src/renderer/src/store/workspaces/host-isolation/host-twin-state-projection.test-fixture.ts @@ -1,15 +1,18 @@ /** What one twin owns, read back out of a host-twin fixture's store and module stores. */ import { getRepoExecutionHostId } from '../../../../../shared/execution-host' -import type { AppState } from '../../types' import { readNativeChatComposerDraft, updateNativeChatComposerDraft } from '@/components/native-chat/drafts/native-chat-composer-draft-store' -import { forgetWorktreeSleepIntent, hasWorktreeSleepIntent } from '@/lib/worktree-sleep-intent' +import { + forgetWorktreeSleepIntent, + hasWorktreeSleepIntent +} from '@/lib/workspace/sleep/worktree-sleep-intent' import { clearHugeRepoWarningDismissalsForTests, hasDismissedHugeRepoWarning } from '@/lib/source-control/warnings/source-control-huge-repo-warning-dismissals' +import type { AppState } from '../../types' import type { HostTwinFixture, HostTwinSide } from './host-twin.test-fixture' export function resetHostTwinModuleStores(fixture: HostTwinFixture): void { diff --git a/src/renderer/src/store/workspaces/host-isolation/host-twin-worktree-purge.test.ts b/src/renderer/src/store/workspaces/host-isolation/host-twin-worktree-purge.test.ts index 5de283dc67a..b1e0c1113c2 100644 --- a/src/renderer/src/store/workspaces/host-isolation/host-twin-worktree-purge.test.ts +++ b/src/renderer/src/store/workspaces/host-isolation/host-twin-worktree-purge.test.ts @@ -1,13 +1,10 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import { hostWorktreeTarget } from '../../../../../shared/worktree/host-qualified-identity' import { getWorktreeVisitKey } from '@/lib/workspace/activation/worktree-visit-recency' -import { hasWorktreeSleepIntent } from '@/lib/worktree-sleep-intent' +import '@/lib/workspace/sleep/worktree-sleep-intent' import { resetHostTwinModuleStores } from './host-twin-state-projection.test-fixture' -import { - createHostTwinFixture, - TWIN_RUNTIME_ENV, - type HostTwinFixture -} from './host-twin.test-fixture' +import { createHostTwinFixture } from './host-twin.test-fixture' +import type { HostTwinFixture } from './host-twin.test-fixture' vi.mock('sonner', () => ({ toast: { info: vi.fn(), success: vi.fn(), error: vi.fn(), warning: vi.fn() } @@ -43,70 +40,7 @@ function twin(kind: Parameters[0] = 'local+ssh'): return fixture } -function keepOnlyRemoteRow(fixture: HostTwinFixture): void { - fixture.store.setState((s) => ({ - worktreesByRepo: { - [fixture.projectId]: (s.worktreesByRepo[fixture.projectId] ?? []).filter( - (row) => row.hostId === fixture.remote.hostId - ) - } - })) -} - describe('purgeWorktreeTerminalState with a surviving twin', () => { - it("purges only the target host's attributable state", () => { - const f = twin() - const key = f.workspaceKey - - const previous = { - paneKey: f.remote.paneKey, - state: 'done' as const, - prompt: '', - updatedAt: 1, - stateStartedAt: 1, - stateHistory: [], - terminalResumeEligible: false as const - } - f.store.setState({ agentStatusByPaneKey: { [f.remote.paneKey]: previous } }) - const accepted = vi.fn() - const dispose = f.store.getState().subscribeAgentStatusChanges(accepted) - f.store.getState().purgeWorktreeTerminalState([hostWorktreeTarget({ id: key, ...f.remote })]) - expect(accepted).toHaveBeenCalledExactlyOnceWith([ - { paneKey: f.remote.paneKey, previous, current: undefined } - ]) - dispose() - - const s = f.store.getState() - expect(s.tabsByWorktree[key]?.map((tab) => tab.id)).toEqual([ - f.local.terminalTabId, - f.dormantTabId - ]) - expect(s.ptyIdsByTabId[f.remote.terminalTabId]).toBeUndefined() - expect(s.terminalLayoutsByTabId[f.remote.terminalTabId]).toBeUndefined() - expect(s.ptyIdsByTabId[f.local.terminalTabId]).toEqual([f.local.ptyId]) - expect(s.unifiedTabsByWorktree[key]?.map((tab) => tab.id)).toEqual([ - f.local.terminalTabId, - f.local.fileId, - f.dormantTabId - ]) - expect(s.groupsByWorktree[key]?.[0]?.tabOrder).toEqual([ - f.local.terminalTabId, - f.local.fileId, - f.dormantTabId - ]) - expect(s.openFiles.map((file) => file.id)).toEqual([f.local.fileId]) - expect(Object.keys(s.editorDrafts)).toEqual([f.local.fileId]) - expect(Object.keys(s.sleepingAgentSessionsByPaneKey)).toEqual([f.local.paneKey]) - // Shared buckets and raw-id module stores cannot name a host, so the twin keeps them. - expect(s.gitStatusByWorktree[key]).toEqual([]) - expect(hasWorktreeSleepIntent(key)).toBe(true) - expect(Object.keys(s.lastVisitedAtByWorktreeId)).toEqual([ - getWorktreeVisitKey(key, f.local.hostId) - ]) - expect(s.activeWorktreeId).toBe(key) - expect(s.activeWorkspaceExecutionHostId).toBe(f.local.hostId) - }) - it('keeps PTY-keyed state for a purged PTY that a kept tab still binds', () => { const f = twin() const shared = f.remote.ptyId @@ -127,67 +61,6 @@ describe('purgeWorktreeTerminalState with a surviving twin', () => { expect(s.pendingPaneAccountRestarts).toEqual({ [shared]: 'codex' }) }) - it('collapses a split the purged copy emptied, handing selection to the survivor', () => { - const f = twin() - const key = f.workspaceKey - f.store.setState((s) => { - const [group] = s.groupsByWorktree[key] ?? [] - if (!group) { - throw new Error('fixture has no tab group') - } - const remoteIds = [f.remote.terminalTabId, f.remote.fileId] - return { - groupsByWorktree: { - [key]: [ - { ...group, tabOrder: group.tabOrder.filter((id) => !remoteIds.includes(id)) }, - { ...group, id: 'remote-group', tabOrder: remoteIds, activeTabId: remoteIds[0] } - ] - }, - unifiedTabsByWorktree: { - [key]: (s.unifiedTabsByWorktree[key] ?? []).map((tab) => - remoteIds.includes(tab.id) ? { ...tab, groupId: 'remote-group' } : tab - ) - }, - layoutByWorktree: { - [key]: { - type: 'split', - direction: 'horizontal', - first: { type: 'leaf', groupId: group.id }, - second: { type: 'leaf', groupId: 'remote-group' } - } - }, - activeGroupIdByWorktree: { [key]: 'remote-group' } - } - }) - - f.store.getState().purgeWorktreeTerminalState([hostWorktreeTarget({ id: key, ...f.remote })]) - - const s = f.store.getState() - const survivingGroupIds = (s.groupsByWorktree[key] ?? []).map((group) => group.id) - expect(survivingGroupIds).not.toContain('remote-group') - expect(survivingGroupIds).toHaveLength(1) - expect(s.layoutByWorktree[key]).not.toEqual(expect.objectContaining({ type: 'split' })) - expect(s.activeGroupIdByWorktree[key]).toBe(survivingGroupIds[0]) - }) - - it('purges everything when no other host publishes the id', () => { - const f = twin() - const key = f.workspaceKey - keepOnlyRemoteRow(f) - - f.store.getState().purgeWorktreeTerminalState([hostWorktreeTarget({ id: key, ...f.remote })]) - - const s = f.store.getState() - expect(s.tabsByWorktree[key]).toBeUndefined() - expect(s.openFiles).toEqual([]) - expect(s.gitStatusByWorktree[key]).toBeUndefined() - expect(hasWorktreeSleepIntent(key)).toBe(false) - // Recency stays host-scoped, as before. - expect(Object.keys(s.lastVisitedAtByWorktreeId)).toEqual([ - getWorktreeVisitKey(key, f.local.hostId) - ]) - }) - it('selects a surviving tab when the purged terminal was active', () => { const f = twin() const key = f.workspaceKey @@ -211,40 +84,6 @@ describe('purgeWorktreeTerminalState with a surviving twin', () => { expect(s.activeFileId).toBe(f.local.fileId) }) - it("attributes a paired runtime's purge to the SSH copy it reaches", () => { - const f = twin() - const key = f.workspaceKey - const runtimeHostId = `runtime:${TWIN_RUNTIME_ENV}` as const - f.store.setState((s) => ({ - worktreesByRepo: { - [f.projectId]: (s.worktreesByRepo[f.projectId] ?? []).map((row) => - row.hostId === f.remote.hostId - ? { ...row, runtimeOwnerEnvironmentId: TWIN_RUNTIME_ENV } - : row - ) - }, - lastVisitedAtByWorktreeId: { - ...s.lastVisitedAtByWorktreeId, - [getWorktreeVisitKey(key, runtimeHostId)]: 3 - } - })) - - f.store - .getState() - .purgeWorktreeTerminalState([hostWorktreeTarget({ id: key, hostId: runtimeHostId })]) - - const s = f.store.getState() - expect(s.tabsByWorktree[key]?.map((tab) => tab.id)).toEqual([ - f.local.terminalTabId, - f.dormantTabId - ]) - expect(s.openFiles.map((file) => file.id)).toEqual([f.local.fileId]) - // Recency written under either identity of the purged copy goes; the twin's stays. - expect(Object.keys(s.lastVisitedAtByWorktreeId)).toEqual([ - getWorktreeVisitKey(key, f.local.hostId) - ]) - }) - it.each([ ['drops', 'remote-source.md', 'local-source.md', false], ['keeps', 'shared-source.md', 'shared-source.md', true] diff --git a/src/renderer/src/store/workspaces/host-isolation/host-twin.test-fixture.ts b/src/renderer/src/store/workspaces/host-isolation/host-twin.test-fixture.ts index 257df898714..7fa3f9fdcfb 100644 --- a/src/renderer/src/store/workspaces/host-isolation/host-twin.test-fixture.ts +++ b/src/renderer/src/store/workspaces/host-isolation/host-twin.test-fixture.ts @@ -1,8 +1,4 @@ /** Seed same-ID repo/folder twins on two hosts with live/dormant shells, dirty drafts and sleeping agents. Raw-ID buckets are shared; host-twin-state-projection.test-fixture.ts attributes survivors. */ -import type { ExecutionHostId } from '../../../../../shared/execution-host' -import type { Repo } from '../../../../../shared/repo-types' -import type { ProjectGroup } from '../../../../../shared/project-group-types' -import type { SleepingAgentSessionRecord } from '../../../../../shared/agent-session/lifecycle/agent-session-resume' import { toRemoteRuntimePtyId } from '../../../../../shared/remote-runtime/remote-runtime-pty-id' import { toAppSshPtyId } from '../../../../../shared/ssh-pty-id' import { folderWorkspaceKey } from '../../../../../shared/workspace-scope' @@ -13,12 +9,16 @@ import { makeTabGroup, makeUnifiedTab } from '../../slices/tabs/tab-group.test-f import { makeWorktree } from '../../slices/worktrees/worktree.test-fixture' import { makeFolderWorkspace } from '../../folder-workspaces/folder-workspace.test-fixture' import { updateNativeChatComposerDraft } from '@/components/native-chat/drafts/native-chat-composer-draft-store' -import { markWorktreeSleepIntent } from '@/lib/worktree-sleep-intent' +import { markWorktreeSleepIntent } from '@/lib/workspace/sleep/worktree-sleep-intent' import { beginHugeRepoWarningProbe, - markHugeRepoWarningDismissed, - type HugeRepoWarningProbe + markHugeRepoWarningDismissed } from '@/lib/source-control/warnings/source-control-huge-repo-warning-dismissals' +import type { HugeRepoWarningProbe } from '@/lib/source-control/warnings/source-control-huge-repo-warning-dismissals' +import type { ExecutionHostId } from '../../../../../shared/execution-host' +import type { Repo } from '../../../../../shared/repo-types' +import type { ProjectGroup } from '../../../../../shared/project-group-types' +import type { SleepingAgentSessionRecord } from '../../../../../shared/agent-session/lifecycle/agent-session-resume' export type HostTwinKind = | 'local+ssh' diff --git a/tests/e2e/agent-sender-open-unheld.unit.test.ts b/tests/e2e/agent-sender-open-unheld.unit.test.ts deleted file mode 100644 index b4ec4889cd9..00000000000 --- a/tests/e2e/agent-sender-open-unheld.unit.test.ts +++ /dev/null @@ -1,382 +0,0 @@ -// @vitest-environment happy-dom -// A card's located terminal that this window holds no tab for opens that same pane, through the -// host's own pane resolver; the card's saved address is never looked up again. -import { cleanup, renderHook } from '@testing-library/react' -import { afterEach, beforeEach, expect, it, vi } from 'vitest' - -const mocks = vi.hoisted(() => ({ - callRuntimeRpc: vi.fn(), - focusRenderer: vi.fn((_handle: string, _environmentId?: string | null) => false), - focusRuntime: vi.fn(async (_handle: string, _environmentId: string | null) => undefined), - toastInfo: vi.fn(), - toastError: vi.fn() -})) -vi.mock('@/components/terminal-pane/links/handles/terminal-handle-links', () => ({ - focusRendererTerminalHandle: mocks.focusRenderer, - focusRuntimeTerminalHandle: mocks.focusRuntime -})) -vi.mock('@/runtime/rpc/calls/runtime-rpc-call', async (original) => ({ - ...(await original>()), - callRuntimeRpc: mocks.callRuntimeRpc -})) -vi.mock('sonner', async (original) => ({ - ...(await original>()), - toast: { info: mocks.toastInfo, error: mocks.toastError } -})) - -import { useAppStore } from '@/store' -import { makeTab } from '@/store/terminals/terminal-tab.test-fixture' -import { openAgentMessageSender } from '@/lib/open-agent-message-sender' -import { RuntimeRpcCallError } from '@/runtime/rpc/calls/runtime-rpc-result' -import { useAgentMessageSenderView } from '@/components/native-chat/messages/agent-senders/native-chat-agent-message-sender-view' -import { - agentMessageSenderOpens, - resolveAgentMessageSenderTarget -} from '@/components/native-chat/messages/agent-senders/native-chat-agent-message-sender-target' -import { - initialStore, - LEAF, - resetSenderStore, - status -} from '@/components/native-chat/messages/agent-senders/native-chat-agent-sender.test-fixture' -import { OrcaRuntimeService } from '../../src/main/runtime/orca-runtime' -import { RpcDispatcher } from '../../src/main/runtime/rpc/dispatcher' -import { TERMINAL_QUERY_METHODS } from '../../src/main/runtime/rpc/methods/terminal/terminal-query-methods' -import { MIRROR_LEAVES_STEP_1 } from '../../src/main/runtime/terminal/records/runtime-leaf-record-projection.test-fixture' -import type { AgentSenderAssociation } from '../../src/shared/agent-sender-associations' -import type { AgentMessageSender } from '../../src/shared/agent-session/agent-session-message-source' -import type { RuntimeClientTarget } from '../../src/shared/runtime-client-target' -import { toRemoteRuntimePtyId } from '../../src/shared/remote-runtime/remote-runtime-pty-id' -import { toWebTerminalSurfaceTabId } from '../../src/shared/workspace-layout/terminal-surface-id' - -const LOCAL: RuntimeClientTarget = { kind: 'local' } -const PAIRED: RuntimeClientTarget = { kind: 'environment', environmentId: 'paired' } -const pane = (tab: string) => `${tab}:${LEAF}` - -/** A real host runtime whose terminals are leaves; its RPC server answers the window. */ -function hostRuntime() { - const runtime = new OrcaRuntimeService(null) - const dispatcher = new RpcDispatcher({ runtime, methods: TERMINAL_QUERY_METHODS }) - const open = (tabId: string, worktreeId: string): string => { - const leaf = { - ...MIRROR_LEAVES_STEP_1[0], - tabId, - leafId: LEAF, - worktreeId, - ptyId: `pty-${tabId}`, - connected: true - } - runtime['terminalIdentity'].replaceLeaves( - new Map(runtime['leaves']).set(runtime['getLeafKey'](tabId, LEAF), leaf) - ) - return runtime['issueHandle'](leaf) - } - const close = (tabId: string) => { - const leaves = new Map(runtime['leaves']) - const removed = leaves.delete(runtime['getLeafKey'](tabId, LEAF)) - runtime['terminalIdentity'].replaceLeaves(leaves) - return removed - } - const answer = async (method: string, params: unknown) => { - const response = await dispatcher.dispatch({ - id: `rpc_${method}`, - authToken: 'test-token', - method, - params - }) - if (!response.ok) { - throw new RuntimeRpcCallError(response) - } - return response.result - } - return { open, close, answer } -} - -let host: ReturnType -let calls: { target: unknown; method: string; params: unknown }[] = [] -let duringLookup = () => {} - -const worker = (address: string): AgentMessageSender => ({ - party: { address, terminalHandle: address, orcaSessionId: null }, - name: 'Worker', - agent: 'claude' -}) -const publish = (hostId: string, associations: AgentSenderAssociation[], revision = 1) => - useAppStore.getState().setAgentSenderPublication(hostId, { - associations, - principals: [], - attachments: [], - revision: { epoch: 'host', revision } - }) -const open = (sender: AgentMessageSender, target: RuntimeClientTarget = LOCAL) => - openAgentMessageSender( - { kind: 'agent', senders: [sender], orchestration: null }, - sender, - 'workspace', - target, - 'first', - 'Worker' - ) -const asked = (method: string) => calls.filter((call) => call.method === method) - -beforeEach(() => { - vi.useFakeTimers({ toFake: ['Date'] }) - vi.setSystemTime(2_000_000) - resetSenderStore() - host = hostRuntime() - calls = [] - duringLookup = () => {} - mocks.callRuntimeRpc.mockImplementation( - async (target: unknown, method: string, params: unknown) => { - calls.push({ target, method, params }) - if (method !== 'terminal.resolvePane') { - throw new Error(`the click asked the host ${method}`) - } - duringLookup() - return host.answer(method, params) - } - ) - for (const mock of [mocks.focusRenderer, mocks.focusRuntime, mocks.toastInfo, mocks.toastError]) { - mock.mockClear() - } -}) -afterEach(() => { - cleanup() - useAppStore.setState(initialStore, true) - vi.useRealTimers() -}) - -/** A worker that first ran in tab-0, which this window holds, and was reopened by a follow-up - * in tab-1, which this window has no tab for yet. */ -function reopenedWorker(first: 'live' | 'gone') { - const firstHandle = first === 'live' ? host.open('tab-0', 'workspace') : 'term_before' - const reopened = host.open('tab-1', 'workspace') - publish('local', [ - { - identity: 'dispatch:first', - dispatchActor: true, - paneKey: pane('tab-1'), - worktreeId: 'workspace' - }, - ...(first === 'live' - ? [{ identity: firstHandle, paneKey: pane('tab-0'), worktreeId: 'workspace' }] - : [{ identity: firstHandle, paneKey: pane('tab-1'), worktreeId: 'workspace' }]) - ]) - return { sender: worker(firstHandle), reopened } -} - -it('focuses the handle the reopened pane’s own status row holds, asking the host nothing', async () => { - const { sender, reopened } = reopenedWorker('live') - useAppStore.setState({ - agentStatusByPaneKey: { - [status(0).paneKey]: status(0), - [status(1).paneKey]: { ...status(1), terminalHandle: reopened } - } - }) - await open(sender) - expect(calls).toEqual([]) - expect(mocks.focusRuntime).toHaveBeenCalledWith(reopened, null) -}) - -it('asks the host for the reopened pane when its status row has no handle, while the first terminal still runs', async () => { - const { sender, reopened } = reopenedWorker('live') - const { terminalHandle: _none, ...unhandled } = status(1) - useAppStore.setState({ - agentStatusByPaneKey: { [status(0).paneKey]: status(0), [status(1).paneKey]: unhandled } - }) - const resolved = resolveAgentMessageSenderTarget( - useAppStore.getState(), - sender, - 'workspace', - LOCAL, - 'first' - ) - expect(resolved.kind === 'located' && resolved.location.paneKey).toBe(pane('tab-1')) - expect(agentMessageSenderOpens(resolved, sender)).toBe(true) - const avatar = renderHook(() => useAgentMessageSenderView(sender, 'workspace', LOCAL, 'first')) - expect(avatar.result.current.dot).toBe('working') - await open(sender) - expect(calls).toEqual([ - { - target: LOCAL, - method: 'terminal.resolvePane', - params: { paneKey: pane('tab-1'), worktreeId: 'workspace' } - } - ]) - expect(mocks.focusRuntime).toHaveBeenCalledWith(reopened, null) -}) - -it('opens the reopened pane when the first terminal is gone and no status has arrived', async () => { - const { sender, reopened } = reopenedWorker('gone') - useAppStore.setState({ agentStatusByPaneKey: {} }) - await open(sender) - expect(asked('orchestration.partyLocation')).toEqual([]) - expect(asked('terminal.resolvePane')).toHaveLength(1) - expect(mocks.focusRuntime).toHaveBeenCalledWith(reopened, null) - expect(mocks.toastInfo).not.toHaveBeenCalled() -}) - -it('says the worker stopped when its pane closed on the host, and opens no other terminal', async () => { - const { sender } = reopenedWorker('live') - useAppStore.setState({ agentStatusByPaneKey: {} }) - host.close('tab-1') - await open(sender) - expect(asked('terminal.resolvePane')).toHaveLength(1) - expect(mocks.focusRuntime).not.toHaveBeenCalled() - expect(mocks.focusRenderer).not.toHaveBeenCalled() - expect(mocks.toastInfo).toHaveBeenCalledWith( - 'Worker is no longer running. Start a new agent from the sidebar to continue its work.' - ) - expect(mocks.toastError).not.toHaveBeenCalled() -}) - -it('acts on what the card names after the host answers, not on what it named at the click', async () => { - const { sender, reopened } = reopenedWorker('live') - useAppStore.setState({ agentStatusByPaneKey: {} }) - // While the host answers, the worker's follow-up ends: the card names its first terminal again. - duringLookup = () => - publish( - 'local', - [ - { - identity: sender.party.address, - dispatchActor: true, - paneKey: pane('tab-0'), - worktreeId: 'workspace' - } - ], - 2 - ) - await open(sender) - expect(mocks.focusRuntime).not.toHaveBeenCalledWith(reopened, null) - expect(useAppStore.getState().activeTabId).toBe('tab-0') -}) - -it('opens a held tab itself, without asking the host', async () => { - const { sender } = reopenedWorker('live') - useAppStore.setState({ - tabsByWorktree: { - workspace: [ - makeTab({ id: 'tab-0', worktreeId: 'workspace' }), - makeTab({ id: 'tab-1', worktreeId: 'workspace' }) - ] - } - }) - await open(sender) - expect(useAppStore.getState().activeTabId).toBe('tab-1') - expect(calls).toEqual([]) -}) - -it('asks a paired host for the pane by its own coordinates, not this window’s alias for it', async () => { - const reopened = host.open('tab-1', 'host-workspace') - // This window mirrors the host's tab-1 under its own tab id, in another worktree bucket. - const mirrored = toWebTerminalSurfaceTabId(`tab-1::${LEAF}`) - useAppStore.setState({ - agentStatusByPaneKey: {}, - tabsByWorktree: { - workspace: [ - makeTab({ - id: mirrored, - worktreeId: 'workspace', - ptyId: toRemoteRuntimePtyId(reopened, 'paired') - }) - ] - } - }) - publish('runtime:paired', [ - { - identity: 'dispatch:first', - dispatchActor: true, - paneKey: pane('tab-1'), - worktreeId: 'host-workspace' - } - ]) - const sender = worker('term_before') - const resolved = resolveAgentMessageSenderTarget( - useAppStore.getState(), - sender, - 'workspace', - PAIRED, - 'first' - ) - expect(resolved.kind === 'located' && resolved.location.paneKey).toBe(`${mirrored}:${LEAF}`) - await open(sender, PAIRED) - expect(calls).toEqual([ - { - target: PAIRED, - method: 'terminal.resolvePane', - params: { paneKey: pane('tab-1'), worktreeId: 'host-workspace' } - } - ]) - expect(mocks.focusRuntime).toHaveBeenCalledWith(reopened, 'paired') -}) - -it('shows and opens a paired host’s pane under the window’s whole-tab mirror of it', async () => { - const reopened = host.open('tab-2', 'workspace') - // This window mirrors the host's whole tab-2, keeping its leaf ids, as its status rows name it. - const mirrored = toWebTerminalSurfaceTabId('tab-2') - const mirroredPane = `${mirrored}:${LEAF}` - useAppStore.setState({ - agentStatusByPaneKey: { - [mirroredPane]: { - ...status(2), - paneKey: mirroredPane, - terminalHandle: reopened, - connectionId: 'paired' - } - }, - tabsByWorktree: { - workspace: [ - makeTab({ - id: mirrored, - worktreeId: 'workspace', - ptyId: toRemoteRuntimePtyId(reopened, 'paired') - }) - ] - } - }) - publish('runtime:paired', [ - { - identity: 'dispatch:first', - dispatchActor: true, - paneKey: pane('tab-2'), - worktreeId: 'workspace' - } - ]) - const sender = worker('term_before') - const resolved = resolveAgentMessageSenderTarget( - useAppStore.getState(), - sender, - 'workspace', - PAIRED, - 'first' - ) - expect(resolved.kind === 'located' && resolved.location).toMatchObject({ - paneKey: mirroredPane, - hostPaneKey: pane('tab-2') - }) - expect(agentMessageSenderOpens(resolved, sender)).toBe(true) - const avatar = renderHook(() => useAgentMessageSenderView(sender, 'workspace', PAIRED, 'first')) - expect(avatar.result.current.dot).toBe('working') - await open(sender, PAIRED) - expect(calls).toEqual([]) - expect(useAppStore.getState().activeTabId).toBe(mirrored) - - // Another bucket mirrors that pane on its own: this window names it two ways, so the card - // locates neither, as with two per-pane mirrors. - useAppStore.setState({ - tabsByWorktree: { - ...useAppStore.getState().tabsByWorktree, - other: [ - makeTab({ - id: toWebTerminalSurfaceTabId(`tab-2::${LEAF}`), - worktreeId: 'other', - ptyId: toRemoteRuntimePtyId(reopened, 'paired') - }) - ] - } - }) - expect( - resolveAgentMessageSenderTarget(useAppStore.getState(), sender, 'workspace', PAIRED, 'first') - ).toEqual({ kind: 'gone', sender: 'terminal' }) -}) diff --git a/tests/e2e/native-chat-image-runtime-context.unit.test.ts b/tests/e2e/native-chat-image-runtime-context.unit.test.ts deleted file mode 100644 index 42f260eeee8..00000000000 --- a/tests/e2e/native-chat-image-runtime-context.unit.test.ts +++ /dev/null @@ -1,474 +0,0 @@ -// @vitest-environment happy-dom - -import { createElement } from 'react' -import { act, cleanup, render } from '@testing-library/react' -import { afterEach, describe, expect, it } from 'vitest' -import type { AppState } from '@/store/types' -import type { RuntimeFileOperationArgs } from '../../src/renderer/src/runtime/files/runtime-file-client-types' -import { useAppStore } from '@/store' -import type { TerminalTab } from '../../src/shared/workspace-layout/terminal-tab-types' - -import { FLOATING_TERMINAL_WORKTREE_ID, getDefaultSettings } from '../../src/shared/constants' -import { - resolveNativeChatImageRuntimeContext, - resolveNativeChatImageRuntimeContextForOwner, - selectNativeChatImageOwnerState, - useNativeChatImageRuntimeContext -} from '../../src/renderer/src/components/native-chat/media/images/native-chat-image-runtime-context' -import { - makeFolderWorkspace, - makeProjectGroup -} from '../../src/renderer/src/components/sidebar/workspace-creation/folder/folder-workspace-composer-submit-fixtures' -import { resolveNativeChatFileLinkContext } from '../../src/renderer/src/components/native-chat/links/actions/native-chat-file-link-context' -import { - resolveNativeChatSkillDiscoveryContext, - selectNativeChatSkillStateInputs -} from '../../src/renderer/src/components/native-chat/composer/pickers/native-chat-skill-discovery-context' -import { getEditorFileOperationContext } from '@/lib/editor/file-operations/editor-file-operation-owner' -import { captureWorktreeSshMutationExpectation } from '@/lib/ssh-mutation-expectation' -import { adoptFromEndpoint } from '@/store/host-catalog/endpoint-catalog-adoption' -import { assertRuntimeFileMutationExpectation } from '../../src/main/runtime/files/file-mutation-expectation' -import { - resetSshConnectionGenerations, - setSshConnectionGeneration -} from '../../src/main/ssh/connection/authority/ssh-connection-generation' -import { - agentSessionTabFixture, - nativeChatFanoutFixture, - nativeChatFanoutWorkspace, - repoFixture, - terminalTabFixture, - worktreeFixture -} from '../../src/renderer/src/components/native-chat/surfaces/integration/native-chat-workspace-test-fixtures' - -const originalState = useAppStore.getState() -afterEach(() => { - cleanup() - useAppStore.setState(originalState, true) -}) - -function state(overrides: Partial = {}): AppState { - const tab: TerminalTab = { - id: 'tab-1', - ptyId: null, - worktreeId: 'wt-1', - title: 'Terminal 1', - customTitle: null, - color: null, - sortOrder: 0, - createdAt: 0 - } - const worktree = worktreeFixture('wt-1', '/repo/worktree', { hostId: 'local' }) - return { - ...useAppStore.getInitialState(), - activeWorkspaceExecutionHostId: 'local', - activeWorktreeId: 'wt-1', - detectedWorktreesByRepo: {}, - folderWorkspaces: [], - getKnownWorktreeById: () => worktree, - projectGroups: [], - removedRuntimeEnvironmentIds: new Set(), - repos: [repoFixture()], - restoredRuntimeHostIdByWorkspaceSessionKey: {}, - runtimeEnvironmentCatalogHydrated: true, - runtimeEnvironments: [], - settings: { ...getDefaultSettings('/home/me'), activeRuntimeEnvironmentId: null }, - sshConnectionStates: new Map(), - sshStateByEnvironment: new Map(), - tabsByWorktree: { 'wt-1': [tab] }, - unifiedTabsByWorktree: {}, - worktreesByRepo: { repo: [worktree] }, - ...overrides - } -} - -describe('resolveNativeChatImageRuntimeContext', () => { - it.each(['inherited', 'adopted'] as const)( - 'retains a paired folder target through real file, image, skill and write contexts: %s', - (shape) => { - const target = { kind: 'environment', environmentId: 'owner-a' } as const - const original = makeFolderWorkspace({ - id: 'paired-folder', - projectGroupId: 'paired-project', - folderPath: '/remote/folder', - connectionId: 'box' - }) - const folder = - shape === 'adopted' - ? adoptFromEndpoint(target, { - kind: 'folderWorkspace', - row: original, - resolveOwnHostId: () => 'ssh:box' as const - }) - : { ...original, connectionId: null } - const workspaceId = `folder:${folder.id}` - const snapshot = state({ - activeWorktreeId: workspaceId, - activeWorkspaceExecutionHostId: 'runtime:owner-a', - folderWorkspaces: [folder], - projectGroups: [ - adoptFromEndpoint(target, { - kind: 'projectGroup', - row: { - ...makeProjectGroup(), - id: 'paired-project', - executionHostId: 'ssh:box', - connectionId: 'box' - } - }) - ], - repos: [], - worktreesByRepo: {}, - tabsByWorktree: { - [workspaceId]: [{ ...state().tabsByWorktree['wt-1'][0], worktreeId: workspaceId }] - }, - runtimeEnvironments: [], - sshStateByEnvironment: new Map([ - [ - 'owner-a', - { - targetsHydrated: true, - targetLabels: new Map([['box', 'Server box']]), - targetGenerations: new Map([['box', 7]]), - removedTargetLabels: new Map(), - connectionStates: new Map([ - [ - 'box', - { - targetId: 'box', - status: 'connected', - error: null, - reconnectAttempt: 0, - connectionGeneration: 7 - } - ] - ]) - } - ] - ]) - }) - expect.soft(resolveNativeChatFileLinkContext(snapshot, 'tab-1')).toMatchObject({ - worktreeId: workspaceId, - worktreePath: '/remote/folder', - runtimeEnvironmentId: 'owner-a' - }) - expect - .soft( - resolveNativeChatImageRuntimeContext(selectNativeChatImageOwnerState(snapshot), 'tab-1') - ) - .toMatchObject({ - target: { kind: 'environment', environmentId: 'owner-a' }, - worktreePath: '/remote/folder', - expectedExecutionHostId: 'ssh:box', - expectedSshConnectionGeneration: 7 - }) - expect - .soft( - resolveNativeChatSkillDiscoveryContext( - selectNativeChatSkillStateInputs(snapshot), - 'tab-1' - ) - ) - .toMatchObject({ - cwd: '/remote/folder', - runtimeTarget: { kind: 'environment', environmentId: 'owner-a' }, - discoveryTarget: { worktreeId: workspaceId } - }) - const editor = getEditorFileOperationContext( - snapshot, - { worktreeId: workspaceId }, - '/remote/folder' - ) - expect.soft(editor).toMatchObject({ - target: { kind: 'environment', environmentId: 'owner-a' }, - expectedExecutionHostId: 'ssh:box', - expectedSshConnectionGeneration: 7 - }) - resetSshConnectionGenerations() - setSshConnectionGeneration('box', 7) - expect - .soft(() => - assertRuntimeFileMutationExpectation( - 'ssh:box', - editor.expectedExecutionHostId, - editor.expectedSshTargetId, - editor.expectedSshConnectionGeneration - ) - ) - .not.toThrow() - resetSshConnectionGenerations() - expect.soft(captureWorktreeSshMutationExpectation(snapshot, workspaceId)).toEqual({ - expectedExecutionHostId: 'ssh:box', - expectedSshTargetId: 'box', - expectedSshConnectionGeneration: 7 - }) - } - ) - - it('keeps selected-hook results equivalent to full-state resolution through ownership, pin and host transitions', () => { - const base = state({ - worktreesByRepo: { - repo: [ - worktreeFixture('wt-1', '/repo/worktree', { hostId: 'local' }), - worktreeFixture('wt-2', '/repo/second', { hostId: 'local' }) - ] - } - }) - const duplicate = { - ...base, - tabsByWorktree: { - 'wt-1': [terminalTabFixture('tab-1', 'wt-1')], - 'wt-2': [terminalTabFixture('tab-1', 'wt-2')] - }, - unifiedTabsByWorktree: { - 'wt-2': [agentSessionTabFixture('tab-1', 'wt-2')], - 'wt-1': [agentSessionTabFixture('tab-1', 'wt-1')] - } - } - const fallback = { ...duplicate, tabsByWorktree: {} } - const moved = { - ...fallback, - unifiedTabsByWorktree: { 'wt-1': [agentSessionTabFixture('tab-1', 'wt-1')] } - } - const floatingTab = agentSessionTabFixture('tab-1', FLOATING_TERMINAL_WORKTREE_ID) - const floating = { - ...base, - tabsByWorktree: {}, - unifiedTabsByWorktree: { [FLOATING_TERMINAL_WORKTREE_ID]: [floatingTab] }, - structuredSessionLaunchDirectoryByTabId: {}, - floatingWorkspacePath: '/floating-setting' - } - const pinned = { - ...floating, - structuredSessionLaunchDirectoryByTabId: { - 'tab-1': { sessionId: floatingTab.entityId, launchDirectory: '/pinned' } - } - } - const replaced = { - ...pinned, - unifiedTabsByWorktree: { - [FLOATING_TERMINAL_WORKTREE_ID]: [{ ...floatingTab, entityId: 'replacement' }] - } - } - const folder = nativeChatFanoutFixture(0, 1, 0) - const folderState = { - ...base, - ...folder, - unifiedTabsByWorktree: { - [nativeChatFanoutWorkspace(0)]: [ - agentSessionTabFixture('tab-1', nativeChatFanoutWorkspace(0)) - ] - } - } - const environment = (id: string): AppState['runtimeEnvironments'][number] => ({ - id, - name: id, - createdAt: 0, - updatedAt: 0, - lastUsedAt: null, - runtimeId: null, - preferredEndpointId: 'endpoint', - endpoints: [] - }) - const remote = (id: string): AppState => ({ - ...base, - activeWorkspaceExecutionHostId: `runtime:${id}`, - runtimeEnvironments: [environment(id)], - repos: [repoFixture({ executionHostId: `runtime:${id}` })], - worktreesByRepo: { - repo: [worktreeFixture('wt-1', '/remote', { hostId: `runtime:${id}` })] - } - }) - const ssh = (generation?: number): AppState => ({ - ...remote('owner-a'), - activeWorkspaceExecutionHostId: 'ssh:ssh-1', - worktreesByRepo: { - repo: [ - worktreeFixture('wt-1', '/ssh', { - hostId: 'ssh:ssh-1', - runtimeOwnerEnvironmentId: 'owner-a' - }) - ] - }, - sshStateByEnvironment: new Map([ - [ - 'owner-a', - { - targets: [], - targetGenerations: new Map(), - targetLabels: new Map(), - removedTargetLabels: new Map(), - targetsHydrated: true, - connectionStates: new Map([ - [ - 'ssh-1', - { - targetId: 'ssh-1', - status: 'connected', - error: null, - reconnectAttempt: 0, - connectionGeneration: generation - } - ] - ]) - } - ] - ]) - }) - const local = (worktreeId: string, worktreePath: string) => ({ - worktreeId, - worktreePath, - target: { kind: 'local' as const } - }) - const paired = ssh(3) - const cases: [ - name: string, - snapshot: AppState, - expected: Partial | null - ][] = [ - ['terminal-first and first duplicate', duplicate, local('wt-1', '/repo/worktree')], - ['unified fallback', fallback, local('wt-2', '/repo/second')], - ['move', moved, local('wt-1', '/repo/worktree')], - ['remove', { ...moved, unifiedTabsByWorktree: {} }, null], - ['return', fallback, local('wt-2', '/repo/second')], - ['missing pin', floating, null], - [ - 'wrong pin', - { - ...pinned, - structuredSessionLaunchDirectoryByTabId: { - 'tab-1': { sessionId: 'wrong', launchDirectory: '/wrong' } - } - }, - null - ], - ['correct pin', pinned, local(FLOATING_TERMINAL_WORKTREE_ID, '/pinned')], - ['replaced session', replaced, null], - [ - 'replaced pin', - { - ...replaced, - structuredSessionLaunchDirectoryByTabId: { - 'tab-1': { sessionId: 'replacement', launchDirectory: '/replacement' } - } - }, - local(FLOATING_TERMINAL_WORKTREE_ID, '/replacement') - ], - [ - 'floating directory predicate skips unregistered duplicate', - { - ...pinned, - unifiedTabsByWorktree: { - [FLOATING_TERMINAL_WORKTREE_ID]: [ - { ...floatingTab, entityId: 'unregistered', agentSessionAgent: undefined }, - floatingTab - ] - } - }, - local(FLOATING_TERMINAL_WORKTREE_ID, '/pinned') - ], - [ - 'floating terminal fallback', - { - ...floating, - tabsByWorktree: { - [FLOATING_TERMINAL_WORKTREE_ID]: [ - terminalTabFixture('tab-1', FLOATING_TERMINAL_WORKTREE_ID) - ] - }, - unifiedTabsByWorktree: {} - }, - local(FLOATING_TERMINAL_WORKTREE_ID, '/floating-setting') - ], - [ - 'floating first registered duplicate wins', - { - ...pinned, - unifiedTabsByWorktree: { - [FLOATING_TERMINAL_WORKTREE_ID]: [floatingTab, { ...floatingTab, entityId: 'second' }] - }, - structuredSessionLaunchDirectoryByTabId: { - 'tab-1': { sessionId: 'second', launchDirectory: '/wrong-second' } - } - }, - null - ], - ['folder', folderState, local(nativeChatFanoutWorkspace(0), '/repo/0')], - [ - 'runtime', - remote('owner-a'), - { worktreePath: '/remote', target: { kind: 'environment', environmentId: 'owner-a' } } - ], - [ - 'runtime replacement', - remote('owner-b'), - { target: { kind: 'environment', environmentId: 'owner-b' } } - ], - [ - 'owner-only runtime hydration', - { - ...remote('owner-a'), - activeWorktreeId: null, - activeWorkspaceExecutionHostId: null, - worktreesByRepo: { - repo: [ - worktreeFixture('wt-1', '/remote', { - hostId: undefined, - runtimeOwnerEnvironmentId: 'owner-a' - }) - ] - } - }, - { worktreePath: '/remote', target: { kind: 'environment', environmentId: 'owner-a' } } - ], - [ - 'paired SSH', - paired, - { - worktreePath: '/ssh', - expectedExecutionHostId: 'ssh:ssh-1', - expectedSshConnectionGeneration: 3, - target: { kind: 'environment', environmentId: 'owner-a' } - } - ], - [ - 'SSH generation-only change', - { ...paired, sshStateByEnvironment: ssh(4).sshStateByEnvironment }, - { expectedSshConnectionGeneration: 4 } - ], - [ - 'SSH generation absent', - { ...paired, sshStateByEnvironment: ssh().sshStateByEnvironment }, - null - ], - [ - 'unpaired SSH', - { - ...paired, - repos: [repoFixture({ connectionId: 'ssh-1' })], - worktreesByRepo: { - repo: [worktreeFixture('wt-1', '/ssh', { hostId: 'ssh:ssh-1' })] - } - }, - null - ] - ] - let observed: RuntimeFileOperationArgs | null = null - function Probe() { - observed = useNativeChatImageRuntimeContext('tab-1') - return null - } - useAppStore.setState(base) - render(createElement(Probe)) - for (const [name, snapshot, expected] of cases) { - act(() => useAppStore.setState(snapshot)) - expect(observed, name).toEqual(resolveNativeChatImageRuntimeContext(snapshot, 'tab-1')) - if (expected === null) { - expect(observed, name).toBeNull() - } else { - expect(observed, name).toMatchObject(expected) - } - } - expect(resolveNativeChatImageRuntimeContextForOwner(base, 'tab-1', null)).toBeNull() - }) -}) diff --git a/tests/e2e/native-chat-transcript-reasoning.unit.test.ts b/tests/e2e/native-chat-transcript-reasoning.unit.test.ts deleted file mode 100644 index d31a97bf877..00000000000 --- a/tests/e2e/native-chat-transcript-reasoning.unit.test.ts +++ /dev/null @@ -1,99 +0,0 @@ -// @vitest-environment happy-dom - -import '@testing-library/jest-dom/vitest' - -import { cleanup, fireEvent, screen } from '@testing-library/react' -import { afterAll, afterEach, beforeAll, expect, it, vi } from 'vitest' - -// Why: these fixtures have neither inline visual owners nor sender navigation. -const unusedChatLeaves = vi.hoisted(() => ({ - inlineVisual: vi.fn(() => { - throw new Error('Unexpected inline visual in transcript fixture') - }), - openSender: vi.fn(() => { - throw new Error('Unexpected sender navigation in transcript fixture') - }) -})) -vi.mock( - '../../src/renderer/src/components/native-chat/media/visuals/NativeChatInlineVisual', - () => ({ - NativeChatInlineVisual: unusedChatLeaves.inlineVisual - }) -) -vi.mock('@/lib/open-agent-message-sender', () => ({ - openAgentMessageSender: unusedChatLeaves.openSender -})) -afterEach(() => { - expect(unusedChatLeaves.inlineVisual).not.toHaveBeenCalled() - expect(unusedChatLeaves.openSender).not.toHaveBeenCalled() -}) -import { createElement } from 'react' -import { NativeChatMessageList } from '../../src/renderer/src/components/native-chat/NativeChatMessageList' -import { installNativeChatMessageListTestViewport } from '../../src/renderer/src/components/native-chat/viewport/virtualization/native-chat-message-list-test-viewport' -import { render } from '../../src/renderer/src/components/native-chat/messages/actions/native-chat-tooltip-test-harness' - -let restoreViewport = (): void => {} -beforeAll(() => { - restoreViewport = installNativeChatMessageListTestViewport() -}) -afterAll(() => restoreViewport()) -afterEach(cleanup) - -it('renders terminal file reasoning before its equal-clock answer without journal authority', async () => { - const { Readable } = await import('node:stream') - const { decodeTranscriptStream } = - await import('../../src/main/native-chat/transcript-stream-lines') - const { decodeClaudeTranscriptLine } = - await import('../../src/main/native-chat/transcript-line-decoders') - const records = [ - { type: 'user', uuid: 'prompt', message: { role: 'user', content: 'Explain the result' } }, - { - type: 'assistant', - uuid: 'z-thinking', - message: { - role: 'assistant', - content: [{ type: 'thinking', thinking: 'File reasoning before final answer' }] - } - }, - { - type: 'assistant', - uuid: 'a-answer', - message: { role: 'assistant', content: 'The final file answer' } - } - ] - .map((row) => `${JSON.stringify({ ...row, timestamp: '2026-06-01T10:00:00Z' })}\n`) - .join('') - const { messages } = await decodeTranscriptStream( - Readable.from([records]), - 'terminal.jsonl', - 0, - decodeClaudeTranscriptLine, - true, - Infinity, - true - ) - render( - createElement(NativeChatMessageList, { - session: { - messages, - status: 'ready', - sessionId: 'session-1', - agent: 'claude', - hasMore: false, - loadingEarlier: false, - olderHistoryGeneration: 0, - loadEarlier: vi.fn(), - readPhase: 'ready' - }, - isWorking: false, - expandSignal: true - }) - ) - const disclosure = screen.getByRole('button', { name: /^Reasoning/ }) - if (disclosure.getAttribute('aria-expanded') === 'false') { - fireEvent.click(disclosure) - } - const thought = screen.getByText('File reasoning before final answer') - const answer = screen.getByText('The final file answer') - expect(thought.compareDocumentPosition(answer) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy() -}) diff --git a/tests/e2e/smart-workspace-linear-read-test-fixtures.tsx b/tests/e2e/smart-workspace-linear-read-test-fixtures.tsx index dd72c2a0a04..4d2fdbb1936 100644 --- a/tests/e2e/smart-workspace-linear-read-test-fixtures.tsx +++ b/tests/e2e/smart-workspace-linear-read-test-fixtures.tsx @@ -1,20 +1,11 @@ import { useStore } from 'zustand' import { createTestStore } from '@/store/slices/linear/linear-slice-test-harness' import { clearLinearRequestMaps } from '@/store/slices/linear/linear-slice-request-state' -// @vitest-environment happy-dom - import React from 'react' import type * as ReactModule from 'react' -import type * as MainLinearClient from '../../src/main/linear/client' -import type * as RuntimeLinearClient from '@/runtime/linear/runtime-linear-client' -import type * as RuntimeLinearIssueMutations from '@/runtime/linear/runtime-linear-issue-client' import { registerRuntimeClientIpcBridge } from '@/hooks/ipc-events/runtime-client-ipc-bridge' -import type { RuntimeClientEvent } from '../../src/shared/runtime-client-events' import { cleanup } from '@testing-library/react' import { afterEach, vi } from 'vitest' -import type { LinearIssue } from '../../src/shared/linear/issue-types' -import type { LinearConnectionStatus } from '../../src/shared/linear/workspace-types' -import type { Repo } from '../../src/shared/repo-types' import { WorkspaceAttachmentSourceStatus } from '../../src/renderer/src/components/sidebar/workspace-card/review/WorkspaceAttachmentSourceStatus' import { Command } from '@/components/ui/command' import { @@ -23,6 +14,15 @@ import { } from '../../src/renderer/src/components/sidebar/workspace-card/review/workspace-reference-fixtures.test-support' import { SmartWorkspaceSourceResultList } from '../../src/renderer/src/components/new-workspace/SmartWorkspaceSourceResultList' import { useWorkItemSourceSearch } from '../../src/renderer/src/components/new-workspace/use-work-item-source-search' +import type * as MainLinearClient from '../../src/main/linear/client' +import type * as RuntimeLinearClient from '@/runtime/linear/runtime-linear-client' +import type * as RuntimeLinearIssueMutations from '@/runtime/linear/runtime-linear-issue-client' +import type { RuntimeClientEvent } from '../../src/shared/runtime-client-events' +import type { LinearIssue } from '../../src/shared/linear/issue-types' +import type { LinearConnectionStatus } from '../../src/shared/linear/workspace-types' +import type { Repo } from '../../src/shared/repo-types' + +// @vitest-environment happy-dom const queued = vi.hoisted(() => { const updates: VoidFunction[] = [] @@ -182,7 +182,7 @@ export const actualSearch = await vi.importActual( let stopBridge = () => {} let restoreApi = () => {} export let pickerStore: ReturnType -vi.mock('@/store', () => ({ +vi.mock('@/store/index', () => ({ useAppStore: Object.assign( (selector: Parameters[0]) => useStore(pickerStore, selector), { @@ -208,8 +208,11 @@ vi.mock('@/runtime/linear/runtime-linear-issue-client', async (original) => ({ ...(await original>()), linearGetIssue: (...args: unknown[]) => mocks.state.detail(...args) })) -vi.mock('@/lib/local-preflight-context', () => ({ - getLocalPreflightContext: () => ({}), +vi.mock('@/runtime/hosts/preflight/local-preflight-context', () => ({ + getLocalPreflightContext: () => ({}) +})) + +vi.mock('@/runtime/hosts/preflight/local-preflight-context-key', () => ({ localPreflightContextKey: () => 'test' })) vi.mock('@/i18n/i18n', () => ({ translate: (_key: string, fallback: string) => fallback })) diff --git a/tests/e2e/structured-agent-session-launch-continuation.unit.test.ts b/tests/e2e/structured-agent-session-launch-continuation.unit.test.ts deleted file mode 100644 index ae29c2f3335..00000000000 --- a/tests/e2e/structured-agent-session-launch-continuation.unit.test.ts +++ /dev/null @@ -1,235 +0,0 @@ -// @vitest-environment happy-dom -import { - mocks, - resetCreateMessageFixture, - cleanupCreateMessageFixture, - created, - createParams -} from '../../src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-create-message.test-fixture' -import type { AgentSessionModelCatalogResult } from '../../src/shared/agent-session/agent-session-wire' -import { afterEach, beforeEach, expect, it, vi } from 'vitest' -import { act, renderHook } from '@testing-library/react' -import type * as HostCapability from '@/runtime/native-chat/host-capabilities/structured-agent-session-host-capability' -import { createNonSecureContextUuid as createBrowserUuid } from '../../src/shared/non-secure-context-uuid' -import { mkdtemp, rm, realpath } from 'node:fs/promises' -import { tmpdir } from 'node:os' -import { join } from 'node:path' -import '../../src/main/runtime/orca-runtime' -import '../../src/main/runtime/rpc/methods/structured-sessions/creation/structured-agent-session-create' - -import { setStructuredAgentSessionHost } from '../../src/main/native-chat/agent-session-wire/host/structured-agent-session-registry' -import '../../src/main/runtime/agent-session/installation/structured-agent-runtime-metadata' -import '../../src/main/claude/structured/launch/claude-structured-spawn-options' -import '../../src/main/codex/structured/threads/codex-structured-thread-open' -import '../../src/main/codex/structured/turns/codex-structured-message-options' -import '../../src/main/codex/structured/catalog/codex-structured-option-session.test-fixture' -import { startStructuredAgentLaunch } from '../../src/renderer/src/lib/agent-session/launch/structured-agent-session-launch' -import { getStructuredAgentSessionLaunchSelection } from '../../src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-options' -import { replaceRuntimeEnvironmentRevisions } from '@/runtime/rpc/environment-revisions/runtime-environment-revision' -import { recordHostModelCatalogSnapshot } from '@/runtime/native-chat/model-catalogs/host-model-catalog-snapshots' -import { useStructuredAgentSessionOptions } from '@/components/native-chat/session/options/structured/use-structured-agent-session-options' -import { useNativeChatProvisionalLaunch } from '@/components/native-chat/host-access/use-native-chat-provisional-launch' -import { structuredAgentSessionMessageSelection } from '../../src/shared/agent-session/options/structured-agent-session-option-view' -import { structuredAgentSessionModelId } from '../../src/shared/agent-session/options/structured-agent-session-option-state' -import '../../src/shared/global-settings-test-fixture' -import '../../src/shared/rpc-contract/structured-agent-session-params' -import { structuredAgentSessionCreateFingerprint } from '../../src/shared/agent-session/lifecycle/structured-agent-session-mutation' -import { - retryStructuredAgentSessionLaunchIntent, - restoreStructuredAgentSessionLaunchIntent -} from '../../src/renderer/src/lib/launch-structured-agent-session' -import { getStructuredLaunchStateBySessionId } from '../../src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-registry' - -vi.mock( - '@/runtime/native-chat/host-capabilities/structured-agent-session-host-capability', - async (original) => ({ - ...(await original()), - useStructuredAgentSessionHostCapability: () => false, - useStructuredAgentSessionOwnPermissionState: () => 'supported' - }) -) -vi.mock('@/components/native-chat/session/status/structured-agent-session-status-hooks', () => ({ - useStructuredAgentSessionPermissionStatus: () => ({ - permissionReport: false, - observation: 'live' - }) -})) -vi.mock('../../src/main/agent-launch/trust/agent-workspace-trust', () => ({ - applyAgentWorkspaceTrust: vi.fn(async () => ({})) -})) -let restore: (() => void) | undefined -let root: string -beforeEach(async () => { - restore = resetCreateMessageFixture() - mocks.exactSupport.mockResolvedValue(true) - root = await mkdtemp(join(await realpath(tmpdir()), 'orca-36210-continuation-')) - vi.stubEnv('ORCA_USER_DATA_PATH', join(root, 'profile')) -}) -afterEach(async () => { - vi.unstubAllEnvs() - setStructuredAgentSessionHost(null) - cleanupCreateMessageFixture(restore) - for (const key of Object.keys(mocks.settings)) { - delete mocks.settings[key] - } - await rm(root, { recursive: true, force: true }) -}) - -it('admits paired continuation picks after support, keeps unknown display unsent, and freezes prepared replay', async () => { - const admission = Promise.withResolvers>>() - const capability = Promise.withResolvers() - const create = Promise.withResolvers() - const hydration = Promise.withResolvers() - const target = { kind: 'environment', environmentId: 'alpha' } as const - const catalog: AgentSessionModelCatalogResult = { - origin: 'probe', - fetchedAt: 1, - defaultHoldsInEveryWorkspace: true, - models: [ - { - id: 'fresh-map', - label: 'Fresh map', - isDefault: true, - efforts: [{ value: 'low', label: 'Low' }] - }, - { - id: 'literal-held', - label: 'Held choice', - isDefault: false, - efforts: [{ value: 'high', label: 'High' }] - } - ] - } - replaceRuntimeEnvironmentRevisions([{ id: 'alpha', createdAt: 1 }]) - recordHostModelCatalogSnapshot(target, 'claude', null, catalog) - mocks.admit.mockReturnValue(admission.promise) - mocks.exactSupport.mockReturnValue(capability.promise) - mocks.call.mockImplementation(async (_target, method) => { - if (method === 'agentSession.modelCatalog') { - return catalog - } - if (method === 'agentSession.options') { - return hydration.promise - } - if (method === 'agentSession.create') { - return create.promise - } - throw new Error(`unexpected ${method}`) - }) - const launch = startStructuredAgentLaunch('workspace-1', 'claude', { - requestId: createBrowserUuid(), - executionHostId: 'runtime:alpha', - resumeFrom: { providerSessionId: 'existing' }, - prompt: 'next' - }) - const view = renderHook( - ({ attached }) => { - const provisional = useNativeChatProvisionalLaunch('workspace-1', launch.sessionId) - return useStructuredAgentSessionOptions({ - agent: 'claude', - sessionId: launch.sessionId, - target, - launch: provisional.launch, - transportEnabled: attached, - isVisible: true, - providerVisible: attached, - fence: attached ? 1 : null, - turnId: null, - unloadedTurnRevisions: undefined, - mutate: vi.fn() - }) - }, - { initialProps: { attached: false } } - ) - expect(getStructuredAgentSessionLaunchSelection(launch.sessionId)?.seedPending).toBe(true) - expect(view.result.current.optionSnapshot.find((row) => row.id === 'model')?.settable).toBe(false) - await act(async () => - admission.resolve({ kind: 'admitted', seedOptions: { model: 'fresh-map', effort: 'low' } }) - ) - await vi.waitFor(() => - expect(getStructuredAgentSessionLaunchSelection(launch.sessionId)?.seedPending).toBeUndefined() - ) - const selection = getStructuredAgentSessionLaunchSelection(launch.sessionId) - expect(selection?.seed).toBeUndefined() - const provisional = view.result.current.sendSource.optionView( - view.result.current.sendSource.optionStateRef.current, - selection?.seed - ) - expect(structuredAgentSessionModelId(provisional.record, 'own')).toBeNull() - expect(structuredAgentSessionMessageSelection(provisional)).toEqual({}) - await act(async () => { - expect(await view.result.current.setStructuredOption('model', 'literal-held')).toBe(true) - }) - await act(async () => { - expect(await view.result.current.setStructuredOption('effort', 'high')).toBe(true) - expect(await view.result.current.setStructuredOption('fastMode', false)).toBe(true) - }) - capability.resolve(true) - await vi.waitFor(() => - expect( - mocks.call.mock.calls.filter(([, method]) => method === 'agentSession.create') - ).toHaveLength(1) - ) - const params = createParams() - expect(params.options).toEqual({ model: 'literal-held', effort: 'high', fastMode: 'false' }) - expect(params.firstMessage?.selection).toEqual(params.options) - expect(params.envelope.payloadFingerprint).toBe( - structuredAgentSessionCreateFingerprint({ sessionId: launch.sessionId, ...params }) - ) - const state = getStructuredLaunchStateBySessionId(launch.sessionId) - if (!state) { - throw new Error('missing continuing launch') - } - Object.assign(mocks.settings, { agentLaunchChoices: { claude: { model: 'later' } } }) - const restored = restoreStructuredAgentSessionLaunchIntent({ - worktreeId: 'workspace-1', - executionHostId: 'runtime:alpha', - sessionId: launch.sessionId, - clientOperationId: params.envelope.clientOperationId, - payloadFingerprint: params.envelope.payloadFingerprint, - expectedRuntimeFence: params.envelope.expectedRuntimeFence, - agent: 'claude', - resumeFrom: params.resumeFrom, - options: params.options, - firstMessage: params.firstMessage, - createMessageSupport: true - }) - expect(restored.params).toEqual(params) - expect(restored.seedOptions).toBeUndefined() - expect(retryStructuredAgentSessionLaunchIntent(state.intent).seedOptions).toBeUndefined() - expect( - restoreStructuredAgentSessionLaunchIntent({ - worktreeId: 'workspace-1', - executionHostId: 'local', - sessionId: launch.sessionId, - agent: 'claude', - clientOperationId: 'new', - payloadFingerprint: '', - expectedRuntimeFence: null, - resumeFrom: params.resumeFrom - }).seedOptions?.model - ).not.toBe('later') - await act(async () => { - create.resolve(created()) - await launch.launchResult - }) - view.rerender({ attached: true }) - await act(async () => - hydration.resolve({ - models: catalog.models, - current: { - model: 'literal-held', - effort: 'high', - fastMode: false, - permissionMode: 'own', - defaulted: [] - } - }) - ) - await vi.waitFor(() => - expect(view.result.current.sendSource.optionStateRef.current.optionsAnswerPresent).toBe(true) - ) - const hydrated = view.result.current.optionSnapshot.find((row) => row.id === 'model') - expect(hydrated).toMatchObject({ settable: true, kind: { currentValue: 'literal-held' } }) - view.unmount() -})