mirror of
https://github.com/stablyai/orca.git
synced 2026-11-03 02:27:43 +00:00
* fix(remote): reconcile stale paired agent status and pane titles Adapt the remote completion repair from #25205 while preserving sparse runtime pane slots through existing PTY bindings. Co-authored-by: Manan Chataut <mananchataut@gmail.com> * fix(remote): preserve pane identity when reconciling moved titles Use mounted manager identities and retained PTY bindings ahead of replay order; keep fresh byte-stream ownership on the correct moved pane. * fix(remote): release byte status fence after host approval * fix(remote): tighten paired title removal and test the timing fence - Share the byte-write timing decision (resolveRendererOwnedAgentStatusTiming) between pty-connection and the flap test so reverting it fails a test. - Only delete a saved pane title when its durable leaf is absent from both the host layout and local panes; unresolved or surface-less slots are kept. - Share the client-fence predicate (clientAgentStatusFencesHost) between status and title reconciliation. - Cover removed-leaf spinner fallback in worktree status and a client split absent from a pre-split host snapshot. * fix(remote): correct fence predicate and title test types --------- Co-authored-by: Manan Chataut <mananchataut@gmail.com>
77 lines
2.4 KiB
TypeScript
77 lines
2.4 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import type { TerminalLayoutSnapshot } from './terminal-tab-types'
|
|
import {
|
|
isRuntimePaneTitleOrphan,
|
|
resolveRuntimePaneTitleForLeaf,
|
|
resolveRuntimePaneTitleLeafResolution
|
|
} from './runtime-pane-title-leaf-id'
|
|
|
|
const LEAF_A = '11111111-1111-4111-8111-111111111111'
|
|
const LEAF_B = '22222222-2222-4222-8222-222222222222'
|
|
|
|
const leafLayout: Pick<TerminalLayoutSnapshot, 'root'> = {
|
|
root: { type: 'leaf', leafId: LEAF_A }
|
|
}
|
|
|
|
const splitLayout: Pick<TerminalLayoutSnapshot, 'root'> = {
|
|
root: {
|
|
type: 'split',
|
|
direction: 'horizontal',
|
|
first: { type: 'leaf', leafId: LEAF_A },
|
|
second: { type: 'leaf', leafId: LEAF_B }
|
|
}
|
|
}
|
|
|
|
describe('resolveRuntimePaneTitleForLeaf', () => {
|
|
it('resolves split-pane titles to the matching leaf by replay order', () => {
|
|
expect(resolveRuntimePaneTitleForLeaf(splitLayout, { 1: 'zsh', 2: 'Codex' }, LEAF_A)).toBe(
|
|
'zsh'
|
|
)
|
|
expect(resolveRuntimePaneTitleForLeaf(splitLayout, { 1: 'zsh', 2: 'Codex' }, LEAF_B)).toBe(
|
|
'Codex'
|
|
)
|
|
})
|
|
|
|
it('uses a lone title when the tab has no resolved layout root', () => {
|
|
expect(resolveRuntimePaneTitleForLeaf(undefined, { 7: 'Codex' }, LEAF_A)).toBe('Codex')
|
|
})
|
|
})
|
|
|
|
describe('resolveRuntimePaneTitleLeafResolution', () => {
|
|
it('reports when no pane titles are present', () => {
|
|
expect(resolveRuntimePaneTitleLeafResolution(leafLayout, {}, LEAF_A)).toEqual({
|
|
title: null,
|
|
hasAnyPaneTitle: false
|
|
})
|
|
})
|
|
|
|
it('reports an unrelated sparse split title without attributing it to the leaf', () => {
|
|
expect(resolveRuntimePaneTitleLeafResolution(splitLayout, { 2: 'Codex' }, LEAF_A)).toEqual({
|
|
title: null,
|
|
hasAnyPaneTitle: true
|
|
})
|
|
})
|
|
|
|
it('reports the matching leaf title when one resolves', () => {
|
|
expect(
|
|
resolveRuntimePaneTitleLeafResolution(splitLayout, { 1: 'zsh', 2: 'Codex' }, LEAF_B)
|
|
).toEqual({
|
|
title: 'Codex',
|
|
hasAnyPaneTitle: true
|
|
})
|
|
})
|
|
})
|
|
|
|
describe('isRuntimePaneTitleOrphan', () => {
|
|
it('never treats numeric slots as removed panes', () => {
|
|
for (const runtimePaneId of ['0', '-1', '2', '3']) {
|
|
expect(isRuntimePaneTitleOrphan(runtimePaneId, new Set([LEAF_A]))).toBe(false)
|
|
}
|
|
})
|
|
|
|
it('flags only a durable leaf id the layout no longer has', () => {
|
|
expect(isRuntimePaneTitleOrphan(LEAF_B, new Set([LEAF_A, LEAF_B]))).toBe(false)
|
|
expect(isRuntimePaneTitleOrphan(LEAF_B, new Set([LEAF_A]))).toBe(true)
|
|
})
|
|
})
|