Merge origin/main and preserve conversation selector changes

This commit is contained in:
Brennan Benson
2026-11-11 01:29:57 -08:00
1025 changed files with 14433 additions and 52659 deletions
-2
View File
@@ -27,7 +27,6 @@ on:
- 'src/main/runtime/agent-session/agent-session-account-*.ts'
- 'src/main/runtime/agent-session/agent-session-acquisition-*.ts'
- 'src/main/runtime/agent-session/agent-session-conversation-*.ts'
- 'src/main/runtime/agent-session/agent-session-death-*.ts'
- 'src/main/runtime/agent-session/agent-session-launch-*.ts'
- 'src/main/runtime/agent-session/agent-session-operation-*.ts'
- 'src/main/runtime/agent-session/agent-session-rewind-*.ts'
@@ -116,7 +115,6 @@ on:
- 'src/main/runtime/agent-session/agent-session-account-*.ts'
- 'src/main/runtime/agent-session/agent-session-acquisition-*.ts'
- 'src/main/runtime/agent-session/agent-session-conversation-*.ts'
- 'src/main/runtime/agent-session/agent-session-death-*.ts'
- 'src/main/runtime/agent-session/agent-session-launch-*.ts'
- 'src/main/runtime/agent-session/agent-session-operation-*.ts'
- 'src/main/runtime/agent-session/agent-session-rewind-*.ts'
+1 -4
View File
@@ -21,16 +21,13 @@ on:
- 'src/main/runtime/session-tabs/session-tabs-phone-layout-moves.test.ts'
- 'src/main/native-chat/agent-session-wire/host/testing/structured-agent-session-terminal-writer-acquire.test.ts'
- 'src/shared/agent-launch/permissions/tui-agent-permission-choice.test.ts'
- 'src/main/runtime/rpc/methods/projects/repo.test.ts'
- 'src/renderer/src/components/tab-bar/use-new-tab-agent-menu-host-preferences.test.tsx'
- 'src/main/sqlite/sync-database.test.ts'
- 'src/main/runtime/orchestration/db/row-column-lists.test.ts'
- 'src/main/codex-usage/codex-rollout-file-lifetime.test.ts'
- 'src/main/codex-usage/scanner-incremental-append.test.ts'
- 'src/main/usage/jsonl-file-reader.test.ts'
- 'src/main/usage/jsonl-file-snapshot.test.ts'
- 'src/main/usage/source-input/jsonl/jsonl-file-reader.test.ts'
- 'src/main/claude-usage/scanner-incremental-append.test.ts'
- 'src/main/claude-usage/store-checkpoint-persistence.test.ts'
permissions:
contents: read
@@ -77,6 +77,9 @@ export const NO_DEADLINE = Number.MAX_SAFE_INTEGER
// How long a silent keepalive control has to answer the relay ping before it is closed.
export const KEEPALIVE_PROBE_MS = 10_000
export const SWEEP_AT_KEY = 'sweepAt'
// Diagnostics only: the host's last control close, read once by the next activation.
export const LAST_CONTROL_CLOSE_KEY = 'lastControlClose'
export type LastControlClose = { goneAt: number; closedAt: number; code: number }
// 6 h ± 30 min, as the cells: desktops re-ask the director at least this often.
export const LEASE_BASE_MS = 6 * 60 * 60 * 1000
export const LEASE_JITTER_MS = 30 * 60 * 1000
@@ -181,6 +184,7 @@ export abstract class HostRelayBase extends DurableObject<Env> {
this.attach(ws, null)
if (a.k === 'control' && a.phase === 'active') { metric(this.env, 'control_close', 1, String(code), [], '', a.place) }
if (a.k === 'control' && a.phase === 'active' && !this.activeControl()) {
await this.ctx.storage.put<LastControlClose>(LAST_CONTROL_CLOSE_KEY, { goneAt, closedAt: Date.now(), code })
const session = await this.ctx.storage.get<Session>('session')
if (session && session.generation === a.generation) {
const hostReason = relayHostCloseReasonFrom(reason)
@@ -7,7 +7,7 @@ import { RELAY_CLOSE_CODE } from '../../../packages/relay-contract/src/close-cod
import { metric } from './metrics'
import type { EdgeClaims } from './env'
import { b64, b64url, fromB64, hmacSha256, sha256B64url, timingSafeEqualStr } from './bytes'
import { HostRelayBase, ASSIGNMENT_CHECK_DEADLINE_MS, NO_DEADLINE, LEASE_BASE_MS, LEASE_JITTER_MS, type ControlAttachment, type Session } from './host-relay-base'
import { HostRelayBase, ASSIGNMENT_CHECK_DEADLINE_MS, NO_DEADLINE, LEASE_BASE_MS, LEASE_JITTER_MS, type ControlAttachment, type Session, LAST_CONTROL_CLOSE_KEY, type LastControlClose } from './host-relay-base'
export abstract class HostRelayHandshake extends HostRelayBase {
protected async onHostHello(ws: WebSocket, a: ControlAttachment, type: unknown, body: Record<string, unknown>): Promise<void> {
@@ -193,6 +193,11 @@ export abstract class HostRelayHandshake extends HostRelayBase {
// After the ack, which strict shipped parsers must see unchanged; only hosts that asked get it.
if (a.clientKeepalive) { this.send(ws, { type: 'keepalive-offer', v: 1, intervalMs: this.config.pingIntervalMs }) }
metric(this.env, 'control_active', 1, rebind ? 'rebind' : 'new', [a.openedAt === undefined ? -1 : now - a.openedAt], a.clientKeepalive ? 'keepalive' : 'legacy', a.place)
const last = await this.ctx.storage.get<LastControlClose>(LAST_CONTROL_CLOSE_KEY)
if (last) {
await this.ctx.storage.delete(LAST_CONTROL_CLOSE_KEY)
metric(this.env, 'reconnect_gap', Math.round((now - last.goneAt) / 1000), String(last.code), [Math.round((last.closedAt - last.goneAt) / 1000)], a.clientKeepalive ? 'keepalive' : 'legacy', a.place)
}
await this.reschedule()
}
}
+5
View File
@@ -33,6 +33,11 @@ export type MetricEvent =
| 'auth_expired_close'
// Control closed for silence (deadControlMetric, host-relay-control.ts).
| 'silence_close'
// A host's control came back after its last control closed: value = seconds from when that
// control was last known alive (silence closes) or closed (others) to this activation; label =
// that close code; double2 = seconds between last-known-alive and the actual close.
// reason 'keepalive' | 'legacy' of the new control.
| 'reconnect_gap'
// Pre-auth socket refused by the per-source limiter: label 'phone' | 'data' | 'health'. Unpushed-host phones: 'not_on_edge'.
| 'preauth_limited'
| 'not_on_edge'
@@ -46,462 +46,7 @@ async function setup(
return { database, store }
}
async function setupHeadroomReassignment(): Promise<{
database: RelayDatabase
store: RelayAssignmentStore
source: RelayCellConfig
target: RelayCellConfig
}> {
const database = await openInMemoryRelayDatabase()
databases.push(database)
const store = new RelayAssignmentStore(database, () => 100, {
requireLiveCells: true,
heartbeatTtlMs: 45_000
})
const source = {
...LIMITED_CELL,
id: 'saturated-source',
url: 'https://saturated-source.example.com'
}
const target = {
...LIMITED_CELL,
id: 'available-target',
url: 'https://available-target.example.com'
}
await store.reconcileCells([source, target], true)
await store.recordCellHeartbeat({
cellId: source.id,
cellUrl: source.url,
cellIncarnation: '11111111-1111-4111-8111-111111111111',
startedAt: 50,
ready: true,
observedRequests: 0,
totalConnections: 450,
inFlightConnections: 0,
reservedConnectionUnits: 0,
enforcedConnectionUnits: 450,
connectionHardCap: 600,
connectionUnobservedBound: 50
})
await store.recordCellHeartbeat({
cellId: target.id,
cellUrl: target.url,
cellIncarnation: '22222222-2222-4222-8222-222222222222',
startedAt: 50,
ready: true,
observedRequests: 0,
totalConnections: 0,
inFlightConnections: 0,
reservedConnectionUnits: 0,
enforcedConnectionUnits: 0,
connectionHardCap: 600,
connectionUnobservedBound: 50
})
return { database, store, source, target }
}
describe('relay assignment connection headroom', () => {
it('requires exact, internally consistent telemetry from limited cells', async () => {
const database = await openInMemoryRelayDatabase()
databases.push(database)
const store = new RelayAssignmentStore(database, () => 100)
await store.reconcileCells([LIMITED_CELL], true)
const heartbeat = {
cellId: LIMITED_CELL.id,
cellUrl: LIMITED_CELL.url,
cellIncarnation: '11111111-1111-4111-8111-111111111111',
startedAt: 50,
ready: true,
observedRequests: 0
}
await expect(store.recordCellHeartbeat(heartbeat)).rejects.toThrow(
'cell_connection_telemetry_mismatch'
)
await expect(
store.recordCellHeartbeat({
...heartbeat,
totalConnections: 550,
inFlightConnections: 2,
reservedConnectionUnits: 3,
enforcedConnectionUnits: 554,
connectionHardCap: 600,
connectionUnobservedBound: 50
})
).rejects.toThrow('cell_connection_telemetry_mismatch')
await expect(
store.recordCellHeartbeat({
...heartbeat,
totalConnections: 601,
inFlightConnections: 0,
reservedConnectionUnits: 0,
enforcedConnectionUnits: 601,
connectionHardCap: 600,
connectionUnobservedBound: 50
})
).resolves.toBeUndefined()
})
it('keeps placing against the old cap until the cell reports a raised one', async () => {
const { store } = await setup(449)
const expanded = {
...LIMITED_CELL,
connectionHardCap: 1_000 as const
}
await store.reconcileCells([expanded], true)
await expect(store.cellDeploymentStatus(expanded.id)).resolves.toMatchObject({
connectionCapacity: { hardCap: 1_000, effectiveHardCap: 600, heartbeatFresh: true }
})
await expect(
store.assign({ userId: 'transition-user', relayHostId: 'host000000000099' })
).resolves.toMatchObject({ cellId: expanded.id })
await expect(
store.assign({ userId: 'transition-user-2', relayHostId: 'host000000000096' })
).rejects.toThrow('relay_capacity_exhausted')
await store.recordCellHeartbeat({
cellId: expanded.id,
cellUrl: expanded.url,
cellIncarnation: '22222222-2222-4222-8222-222222222222',
startedAt: 200,
ready: true,
observedRequests: 0,
totalConnections: 449,
inFlightConnections: 0,
reservedConnectionUnits: 0,
enforcedConnectionUnits: 449,
connectionHardCap: 1_000,
connectionUnobservedBound: 50
})
await expect(store.cellDeploymentStatus(expanded.id)).resolves.toMatchObject({
connectionCapacity: {
hardCap: 1_000,
ordinaryConnectionLimit: 900,
normalAdmissionPause: 850,
heartbeatFresh: true
}
})
})
it('fails placement closed while the admin path changes the unobserved bound', async () => {
const { store } = await setup(0)
const lowered = {
...LIMITED_CELL,
connectionUnobservedBound: 49
}
await store.configureCell(lowered, 'general')
await expect(
store.assign({ userId: 'admin-transition', relayHostId: 'host000000000098' })
).rejects.toThrow('relay_capacity_exhausted')
await expect(store.cellDeploymentStatus(lowered.id)).resolves.toMatchObject({
connectionCapacity: { hardCap: 600, heartbeatFresh: false }
})
await store.recordCellHeartbeat({
cellId: lowered.id,
cellUrl: lowered.url,
cellIncarnation: '22222222-2222-4222-8222-222222222222',
startedAt: 200,
ready: true,
observedRequests: 0,
totalConnections: 0,
inFlightConnections: 0,
reservedConnectionUnits: 0,
enforcedConnectionUnits: 0,
connectionHardCap: 600,
connectionUnobservedBound: 49
})
await expect(
store.assign({ userId: 'admin-restored', relayHostId: 'host000000000097' })
).resolves.toMatchObject({ cellId: lowered.id })
})
it('admits exactly one reservation at the admission boundary', async () => {
const { database, store } = await setup(449)
const results = await Promise.allSettled([
store.assign({ userId: 'user-1', relayHostId: 'host000000000001' }),
store.assign({ userId: 'user-2', relayHostId: 'host000000000002' })
])
expect(results.filter(({ status }) => status === 'fulfilled')).toHaveLength(1)
expect(
results
.filter(({ status }) => status === 'rejected')
.map((result) => (result.status === 'rejected' ? result.reason : null))
).toEqual([expect.objectContaining({ message: 'relay_capacity_exhausted' })])
expect(
await database.query(
`SELECT activity_id FROM relay_assignment_activity_leases
WHERE activity_kind = 'control' AND activity_id LIKE 'control-pending:%'`
)
).toHaveLength(1)
})
it('rejects at the boundary before mutating durable assignment state', async () => {
const { database, store } = await setup(450)
await expect(
store.assign({ userId: 'user-1', relayHostId: 'host000000000001' })
).rejects.toThrow('relay_capacity_exhausted')
expect(await database.query(`SELECT * FROM relay_assignments`)).toEqual([])
expect(await database.query(`SELECT * FROM relay_assignment_activity_leases`)).toEqual([])
})
it('charges every active reservation state at the admission boundary', async () => {
const { database, store } = await setup(447)
await database.query(
`INSERT INTO relay_control_connection_reservations
(reservation_id, idempotency_key, user_id, relay_host_id,
assignment_epoch, cell_id, state, created_at, timeout_at, updated_at)
VALUES
('active-reserved', 'active-reserved', 'state-user', 'state-host-1',
1, ?, 'reserved', 1, 2, 1),
('active-debt', 'active-debt', 'state-user', 'state-host-2',
1, ?, 'late-arrival-debt', 1, 2, 1),
('active-claimed', 'active-claimed', 'state-user', 'state-host-3',
1, ?, 'claimed', 1, 2, 1)`,
[LIMITED_CELL.id, LIMITED_CELL.id, LIMITED_CELL.id]
)
await expect(
store.assign({ userId: 'blocked-user', relayHostId: 'blockedhost00001' })
).rejects.toThrow('relay_capacity_exhausted')
expect(await database.query(`SELECT * FROM relay_assignment_activity_leases`)).toEqual([])
})
it('does not charge released reservation history', async () => {
const { database, store } = await setup(449)
await database.query(
`INSERT INTO relay_control_connection_reservations
(reservation_id, idempotency_key, user_id, relay_host_id,
assignment_epoch, cell_id, state, created_at, timeout_at, updated_at)
VALUES ('released-history', 'released-history', 'state-user', 'state-host',
1, ?, 'released', 1, 2, 1)`,
[LIMITED_CELL.id]
)
await expect(
store.assign({ userId: 'admitted-user', relayHostId: 'admittedhost0001' })
).resolves.toMatchObject({ cellId: LIMITED_CELL.id })
})
it('rejects sticky control restoration before mutating assignment state', async () => {
const { database, store } = await setup(450)
const identity = { userId: 'sticky-user', relayHostId: 'stickyhost000001' }
await database.query(
`INSERT INTO relay_assignments
(user_id, relay_host_id, cell_id, assignment_epoch, lease_expires_at,
last_activity_at, reserved_controls, reserved_splices, reserved_invites,
pending_installs, pending_confirmations, migration_leases)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
[identity.userId, identity.relayHostId, LIMITED_CELL.id, 1, 10_000, 100, 0, 0, 1, 0, 0, 0]
)
await expect(store.assign(identity)).rejects.toThrow('relay_connection_headroom_exhausted')
expect(
await database.query(
`SELECT cell_id, assignment_epoch, reserved_controls, reserved_invites
FROM relay_assignments WHERE user_id = ? AND relay_host_id = ?`,
[identity.userId, identity.relayHostId]
)
).toEqual([
{
cell_id: LIMITED_CELL.id,
assignment_epoch: 1,
reserved_controls: 0,
reserved_invites: 1
}
])
expect(await database.query(`SELECT * FROM relay_assignment_activity_leases`)).toEqual([])
})
it('moves a zero-activity assignment off a general cell without connection headroom', async () => {
const { database, store, source, target } = await setupHeadroomReassignment()
const identity = { userId: 'movable-user', relayHostId: 'movablehost000001' }
await database.query(
`INSERT INTO relay_assignments
(user_id, relay_host_id, cell_id, assignment_epoch, lease_expires_at,
last_activity_at, reserved_controls, reserved_splices, reserved_invites,
pending_installs, pending_confirmations, migration_leases)
VALUES (?, ?, ?, ?, ?, ?, 0, 0, 0, 0, 0, 0)`,
[identity.userId, identity.relayHostId, source.id, 7, 10_000, 100]
)
await database.query(
`INSERT INTO relay_control_connection_reservations
(reservation_id, idempotency_key, user_id, relay_host_id,
assignment_epoch, cell_id, state, inclusion_watermark,
claim_activity_id, created_at, timeout_at, claimed_at, released_at,
updated_at)
VALUES (?, ?, ?, ?, ?, ?, 'late-arrival-debt', NULL, NULL, ?, ?, NULL, NULL, ?)`,
[
'superseded-reservation',
'superseded-reservation',
identity.userId,
identity.relayHostId,
7,
source.id,
50,
99,
100
]
)
await expect(store.assign(identity)).resolves.toMatchObject({
cellId: target.id,
assignmentEpoch: 8
})
expect(
await database.query(
`SELECT cell_id, assignment_epoch, reserved_controls
FROM relay_assignments WHERE user_id = ? AND relay_host_id = ?`,
[identity.userId, identity.relayHostId]
)
).toEqual([{ cell_id: target.id, assignment_epoch: 8, reserved_controls: 1 }])
expect(
await database.query(
`SELECT cell_id, activity_kind FROM relay_assignment_activity_leases
WHERE user_id = ? AND relay_host_id = ?`,
[identity.userId, identity.relayHostId]
)
).toEqual([{ cell_id: target.id, activity_kind: 'control' }])
expect(
await database.query(
`SELECT cell_id, assignment_epoch, state
FROM relay_control_connection_reservations
WHERE user_id = ? AND relay_host_id = ?
ORDER BY assignment_epoch`,
[identity.userId, identity.relayHostId]
)
).toEqual([
{ cell_id: source.id, assignment_epoch: 7, state: 'released' },
{ cell_id: target.id, assignment_epoch: 8, state: 'reserved' }
])
})
it('keeps non-control activity pinned when its cell has no connection headroom', async () => {
const { database, store, source } = await setupHeadroomReassignment()
const identity = { userId: 'pinned-user', relayHostId: 'pinnedhost0000001' }
await database.query(
`INSERT INTO relay_assignments
(user_id, relay_host_id, cell_id, assignment_epoch, lease_expires_at,
last_activity_at, reserved_controls, reserved_splices, reserved_invites,
pending_installs, pending_confirmations, migration_leases)
VALUES (?, ?, ?, ?, ?, ?, 0, 0, 1, 0, 0, 0)`,
[identity.userId, identity.relayHostId, source.id, 7, 10_000, 100]
)
await expect(store.assign(identity)).rejects.toThrow('relay_connection_headroom_exhausted')
expect(await store.resolve(identity)).toMatchObject({
cellId: source.id,
assignmentEpoch: 7
})
})
it('keeps a zero-activity assignment pinned on an existing-only cell', async () => {
const { database, store, source } = await setupHeadroomReassignment()
const identity = { userId: 'pinned-existing-only-user', relayHostId: 'pinnedexistingonl' }
await store.setCellAdmissionState(source.id, 'existing-only')
await database.query(
`INSERT INTO relay_assignments
(user_id, relay_host_id, cell_id, assignment_epoch, lease_expires_at,
last_activity_at, reserved_controls, reserved_splices, reserved_invites,
pending_installs, pending_confirmations, migration_leases)
VALUES (?, ?, ?, ?, ?, ?, 0, 0, 0, 0, 0, 0)`,
[identity.userId, identity.relayHostId, source.id, 7, 10_000, 100]
)
await expect(store.assign(identity)).rejects.toThrow('relay_connection_headroom_exhausted')
expect(await store.resolve(identity)).toMatchObject({
cellId: source.id,
assignmentEpoch: 7
})
expect(await database.query(`SELECT * FROM relay_assignment_activity_leases`)).toEqual([])
})
it('keeps a zero-activity assignment pinned on an unstamped migration-only cell', async () => {
// Why: an evacuation target is deliberately migration-only and deliberately
// full. Without the roll's isolate stamp it must keep the hosts it holds.
const { database, store, source } = await setupHeadroomReassignment()
const identity = { userId: 'pinned-migration-only-user', relayHostId: 'pinnedmigrationonly' }
await store.setCellAdmissionState(source.id, 'migration-only')
await database.query(
`INSERT INTO relay_assignments
(user_id, relay_host_id, cell_id, assignment_epoch, lease_expires_at,
last_activity_at, reserved_controls, reserved_splices, reserved_invites,
pending_installs, pending_confirmations, migration_leases)
VALUES (?, ?, ?, ?, ?, ?, 0, 0, 0, 0, 0, 0)`,
[identity.userId, identity.relayHostId, source.id, 7, 10_000, 100]
)
await expect(store.assign(identity)).rejects.toThrow('relay_connection_headroom_exhausted')
expect(await store.resolve(identity)).toMatchObject({
cellId: source.id,
assignmentEpoch: 7
})
})
it('renames a pending reservation exactly once on control activation', async () => {
const { database, store } = await setup(449)
const identity = { userId: 'user-1', relayHostId: 'host000000000001' }
const assignment = await store.assign(identity)
await store.activateControl(identity, {
cellId: LIMITED_CELL.id,
assignmentEpoch: assignment.assignmentEpoch,
generation: 1
})
await store.activateControl(identity, {
cellId: LIMITED_CELL.id,
assignmentEpoch: assignment.assignmentEpoch,
generation: 1
})
expect(
await database.query(
`SELECT activity_id, request_units FROM relay_assignment_activity_leases
WHERE user_id = ? AND relay_host_id = ?`,
[identity.userId, identity.relayHostId]
)
).toEqual([{ activity_id: 'control:limited:1', request_units: 1 }])
})
it('keeps expired pending reservations charged as late-arrival debt', async () => {
let now = 100
const { database, store } = await setup(449, () => now)
await store.assign({ userId: 'user-1', relayHostId: 'host000000000001' })
now += ASSIGNMENT_LIMITS.activityLeaseMs + 1
await store.releaseExpiredActivityLeases()
await store.recordCellHeartbeat({
cellId: LIMITED_CELL.id,
cellUrl: LIMITED_CELL.url,
cellIncarnation: '11111111-1111-4111-8111-111111111111',
startedAt: 50,
ready: true,
observedRequests: 0,
totalConnections: 449,
inFlightConnections: 0,
reservedConnectionUnits: 0,
enforcedConnectionUnits: 449,
connectionHardCap: 600,
connectionUnobservedBound: 50
})
await expect(
store.assign({ userId: 'user-2', relayHostId: 'host000000000002' })
).rejects.toThrow('relay_capacity_exhausted')
expect(
await database.query(
`SELECT activity_id FROM relay_assignment_activity_leases
WHERE activity_kind = 'control' AND activity_id LIKE 'control-pending:%'`
)
).toHaveLength(0)
expect(await database.query(`SELECT state FROM relay_control_connection_reservations`)).toEqual(
[{ state: 'late-arrival-debt' }]
)
})
it('reconciles late-arrival debt only after a covering absolute snapshot', async () => {
let now = 100
const { database, store } = await setup(449, () => now)
@@ -559,386 +104,4 @@ describe('relay assignment connection headroom', () => {
store.assign({ userId: 'blocked-user', relayHostId: 'blockedhost00001' })
).rejects.toThrow('relay_capacity_exhausted')
})
it('rejects duplicate and out-of-order absolute snapshots', async () => {
const { database, store } = await setup(0)
const heartbeat = {
cellId: LIMITED_CELL.id,
cellUrl: LIMITED_CELL.url,
cellIncarnation: '11111111-1111-4111-8111-111111111111',
startedAt: 50,
ready: true,
observedRequests: 0,
totalConnections: 10,
inFlightConnections: 0,
reservedConnectionUnits: 0,
enforcedConnectionUnits: 10,
connectionInclusionWatermark: 10,
connectionHardCap: 600 as const,
connectionUnobservedBound: 50
}
await store.recordCellHeartbeat(heartbeat)
await expect(store.recordCellHeartbeat(heartbeat)).rejects.toThrow('stale_connection_snapshot')
await expect(
store.recordCellHeartbeat({
...heartbeat,
totalConnections: 9,
enforcedConnectionUnits: 9,
connectionInclusionWatermark: 9
})
).rejects.toThrow('stale_connection_snapshot')
expect(
await database.query(
`SELECT inclusion_watermark, enforced_connection_units
FROM relay_cell_connection_snapshots`
)
).toEqual([{ inclusion_watermark: 10, enforced_connection_units: 10 }])
})
it('keeps crash retries bound to one reservation claim', async () => {
let now = 100
const { database, store } = await setup(448, () => now)
const identity = { userId: 'retry-user', relayHostId: 'retryhost0000001' }
const assignment = await store.assign(identity)
await new RelayAssignmentStore(database, () => now, {
requireLiveCells: true,
heartbeatTtlMs: 45_000
}).assign(identity)
expect(await database.query(`SELECT state FROM relay_control_connection_reservations`)).toEqual(
[{ state: 'reserved' }]
)
now += ASSIGNMENT_LIMITS.activityLeaseMs + 1
await store.releaseExpiredActivityLeases()
await store.recordCellHeartbeat({
cellId: LIMITED_CELL.id,
cellUrl: LIMITED_CELL.url,
cellIncarnation: '11111111-1111-4111-8111-111111111111',
startedAt: 50,
ready: true,
observedRequests: 0,
totalConnections: 448,
inFlightConnections: 0,
reservedConnectionUnits: 0,
enforcedConnectionUnits: 448,
connectionHardCap: 600,
connectionUnobservedBound: 50
})
await store.assign(identity)
const restarted = new RelayAssignmentStore(database, () => now, {
requireLiveCells: true,
heartbeatTtlMs: 45_000
})
const activation = {
cellId: LIMITED_CELL.id,
assignmentEpoch: assignment.assignmentEpoch,
generation: 1,
connectionInclusionWatermark: 5
}
await restarted.activateControl(identity, activation)
await restarted.activateControl(identity, activation)
expect(
await database.query(
`SELECT state, claim_activity_id
FROM relay_control_connection_reservations
ORDER BY created_at ASC, reservation_id ASC`
)
).toEqual([{ state: 'claimed', claim_activity_id: 'control:limited:1' }])
})
it('releases only redundant expired debt after a fresh absolute snapshot', async () => {
let now = 100
const { database, store } = await setup(449, () => now)
const identity = { userId: 'debt-user', relayHostId: 'debthost000000001' }
const assignment = await store.assign(identity)
now += ASSIGNMENT_LIMITS.activityLeaseMs + 1
await store.releaseExpiredActivityLeases()
await database.query(
`INSERT INTO relay_control_connection_reservations
(reservation_id, idempotency_key, user_id, relay_host_id,
assignment_epoch, cell_id, state, inclusion_watermark,
claim_activity_id, created_at, timeout_at, claimed_at, released_at,
updated_at)
VALUES (?, ?, ?, ?, ?, ?, 'late-arrival-debt', NULL, NULL, ?, ?, NULL, NULL, ?)`,
[
'duplicate-reservation',
'duplicate-reservation',
identity.userId,
identity.relayHostId,
assignment.assignmentEpoch,
LIMITED_CELL.id,
101,
now - 1,
now
]
)
await store.recordCellHeartbeat({
cellId: LIMITED_CELL.id,
cellUrl: LIMITED_CELL.url,
cellIncarnation: '11111111-1111-4111-8111-111111111111',
startedAt: 50,
ready: true,
observedRequests: 0,
totalConnections: 449,
inFlightConnections: 0,
reservedConnectionUnits: 0,
enforcedConnectionUnits: 449,
connectionInclusionWatermark: 5,
connectionHardCap: 600,
connectionUnobservedBound: 50
})
expect(
await database.query(
`SELECT state, COUNT(*) AS count
FROM relay_control_connection_reservations
GROUP BY state ORDER BY state`
)
).toEqual([
{ state: 'late-arrival-debt', count: 1 },
{ state: 'released', count: 1 }
])
})
it('releases expired debt for a snapshot-proven aborted older epoch', async () => {
const now = 1_000
const { database, store } = await setup(0, () => now)
const identity = { userId: 'aborted-user', relayHostId: 'abortedhost00001' }
await database.query(
`INSERT INTO relay_assignments
(user_id, relay_host_id, cell_id, assignment_epoch, lease_expires_at,
last_activity_at, reserved_controls, reserved_splices, reserved_invites,
pending_installs, pending_confirmations, migration_leases)
VALUES (?, ?, ?, ?, ?, ?, 0, 0, 0, 0, 0, 0)`,
[identity.userId, identity.relayHostId, LIMITED_CELL.id, 3, now, now]
)
await database.query(
`INSERT INTO relay_assignment_migrations
(user_id, relay_host_id, source_cell_id, target_cell_id,
previous_epoch, assignment_epoch, source_request_units,
target_reserved_units, expires_at, target_registered_at,
completed_at, aborted_at, created_at, updated_at)
VALUES (?, ?, ?, ?, 1, 2, 0, 1, ?, ?, NULL, ?, ?, ?)`,
[
identity.userId,
identity.relayHostId,
'source',
LIMITED_CELL.id,
now - 2,
now - 3,
now - 1,
now - 4,
now - 1
]
)
await database.query(
`INSERT INTO relay_control_connection_reservations
(reservation_id, idempotency_key, user_id, relay_host_id,
assignment_epoch, cell_id, state, inclusion_watermark,
claim_activity_id, created_at, timeout_at, claimed_at, released_at,
updated_at)
VALUES (?, ?, ?, ?, 2, ?, 'late-arrival-debt', NULL, NULL, ?, ?, NULL, NULL, ?)`,
[
'aborted-reservation',
'aborted-reservation',
identity.userId,
identity.relayHostId,
LIMITED_CELL.id,
now - 4,
now - 2,
now - 1
]
)
await store.recordCellHeartbeat({
cellId: LIMITED_CELL.id,
cellUrl: LIMITED_CELL.url,
cellIncarnation: '11111111-1111-4111-8111-111111111111',
startedAt: 50,
ready: true,
observedRequests: 0,
totalConnections: 0,
inFlightConnections: 0,
reservedConnectionUnits: 0,
enforcedConnectionUnits: 0,
connectionInclusionWatermark: 5,
connectionHardCap: 600,
connectionUnobservedBound: 50
})
expect(
await database.query(
`SELECT state FROM relay_control_connection_reservations
WHERE reservation_id = ?`,
['aborted-reservation']
)
).toEqual([{ state: 'released' }])
})
it('fails a limited cell closed on stale telemetry while leaving legacy cells unchanged', async () => {
let now = 100
const { store } = await setup(0, () => now)
now += 45_001
await expect(
store.assign({ userId: 'user-1', relayHostId: 'host000000000001' })
).rejects.toThrow('relay_capacity_exhausted')
const legacyDatabase = await openInMemoryRelayDatabase()
databases.push(legacyDatabase)
const legacyStore = new RelayAssignmentStore(legacyDatabase, () => now, {
requireLiveCells: true,
heartbeatTtlMs: 45_000
})
const legacy = {
id: 'legacy',
url: 'https://legacy.example.com',
capacityRequests: 10
}
await legacyStore.reconcileCells([legacy], true)
await legacyStore.recordCellHeartbeat({
cellId: legacy.id,
cellUrl: legacy.url,
cellIncarnation: '22222222-2222-4222-8222-222222222222',
startedAt: now,
ready: true,
observedRequests: 0
})
await expect(
legacyStore.assign({ userId: 'user-2', relayHostId: 'host000000000002' })
).resolves.toMatchObject({ cellId: 'legacy' })
})
it('does not create connection debt for mixed-version uncapped cells', async () => {
let now = 100
const legacy = {
id: 'legacy',
url: 'https://legacy.example.com',
capacityRequests: 10
}
const { database, store } = await setup(0, () => now)
await store.reconcileCells([legacy], true)
await store.recordCellHeartbeat({
cellId: legacy.id,
cellUrl: legacy.url,
cellIncarnation: '22222222-2222-4222-8222-222222222222',
startedAt: 50,
ready: true,
observedRequests: 0
})
await store.assign({ userId: 'legacy-user', relayHostId: 'legacyhost000001' })
expect(await database.query(`SELECT * FROM relay_control_connection_reservations`)).toEqual([])
expect(await store.releaseExpiredActivityLeases()).toBe(0)
now += ASSIGNMENT_LIMITS.activityLeaseMs + 1
expect(await store.releaseExpiredActivityLeases()).toBe(1)
expect(await database.query(`SELECT * FROM relay_control_connection_reservations`)).toEqual([])
})
it('rejects dormant rebalance before changing the assignment epoch', async () => {
const now = ASSIGNMENT_LIMITS.dormantTtlMs + 100
const database = await openInMemoryRelayDatabase()
databases.push(database)
const store = new RelayAssignmentStore(database, () => now, {
requireLiveCells: true,
heartbeatTtlMs: 45_000
})
const source = {
id: 'source',
url: 'https://source.example.com',
capacityRequests: 10
}
await store.reconcileCells([source, LIMITED_CELL], true)
await store.recordCellHeartbeat({
cellId: source.id,
cellUrl: source.url,
cellIncarnation: '22222222-2222-4222-8222-222222222222',
startedAt: now - 50,
ready: true,
observedRequests: 0
})
await store.recordCellHeartbeat({
cellId: LIMITED_CELL.id,
cellUrl: LIMITED_CELL.url,
cellIncarnation: '11111111-1111-4111-8111-111111111111',
startedAt: now - 50,
ready: true,
observedRequests: 0,
totalConnections: 450,
inFlightConnections: 0,
reservedConnectionUnits: 0,
enforcedConnectionUnits: 450,
connectionHardCap: 600,
connectionUnobservedBound: 50
})
const identity = { userId: 'dormant-user', relayHostId: 'dormanthost00001' }
await database.query(
`INSERT INTO relay_assignments
(user_id, relay_host_id, cell_id, assignment_epoch, lease_expires_at,
last_activity_at, reserved_controls, reserved_splices, reserved_invites,
pending_installs, pending_confirmations, migration_leases)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
[identity.userId, identity.relayHostId, source.id, 7, 0, 0, 0, 0, 0, 0, 0, 0]
)
await expect(store.rebalanceDormant(identity, LIMITED_CELL.id)).rejects.toThrow(
'relay_connection_headroom_exhausted'
)
expect(await store.resolve(identity)).toMatchObject({
cellId: source.id,
assignmentEpoch: 7
})
expect(await database.query(`SELECT * FROM relay_assignment_activity_leases`)).toEqual([])
})
it('rejects an evacuation target at its pause before migration mutation', async () => {
const database = await openInMemoryRelayDatabase()
databases.push(database)
const store = new RelayAssignmentStore(database, () => 100, {
requireLiveCells: true,
heartbeatTtlMs: 45_000
})
const source = {
id: 'source',
url: 'https://source.example.com',
capacityRequests: 10
}
await store.reconcileCells([source, { ...LIMITED_CELL, initiallyEnabled: false }], true)
await store.recordCellHeartbeat({
cellId: source.id,
cellUrl: source.url,
cellIncarnation: '22222222-2222-4222-8222-222222222222',
startedAt: 50,
ready: true,
observedRequests: 0
})
await store.recordCellHeartbeat({
cellId: LIMITED_CELL.id,
cellUrl: LIMITED_CELL.url,
cellIncarnation: '11111111-1111-4111-8111-111111111111',
startedAt: 50,
ready: true,
observedRequests: 0,
totalConnections: 450,
inFlightConnections: 0,
reservedConnectionUnits: 0,
enforcedConnectionUnits: 450,
connectionHardCap: 600,
connectionUnobservedBound: 50
})
const identity = { userId: 'user-1', relayHostId: 'host000000000001' }
const assignment = await store.assign(identity)
expect(assignment.cellId).toBe(source.id)
await store.setCellEnabled(LIMITED_CELL.id, true)
await expect(store.startEvacuation(identity, LIMITED_CELL.id)).rejects.toThrow(
'relay_connection_headroom_exhausted'
)
expect(await database.query(`SELECT * FROM relay_assignment_migrations`)).toEqual([])
expect(await store.resolve(identity)).toMatchObject({
cellId: source.id,
assignmentEpoch: assignment.assignmentEpoch
})
})
})
@@ -1,4 +1,3 @@
import { ASSIGNMENT_LIMITS } from '@orca-cloud/relay-contract/assignment-invariants'
import { createHash } from 'node:crypto'
import { afterAll, beforeAll, describe, expect, it, vi } from 'vitest'
import { RelayAssignmentRowBusyError, RelayAssignmentStore } from './assignment-store.js'
@@ -52,7 +51,6 @@ const OTHER_REGION: RelayCellConfig = {
...CAPPED
}
const CELLS = [ISOLATED, ...TARGETS, OTHER_REGION]
const HOST_COUNT = 50
function hostIdentity(index: number): { userId: string; relayHostId: string } {
return {
@@ -74,48 +72,6 @@ describePostgres('PostgreSQL re-placement off a cell isolated for a roll', () =>
return Number(rows[0]!['reserved_requests'])
}
// The accounting invariant the migration paths assert: a cell's counter is
// exactly the units of the leases held on it.
async function expectReservationAccounting(): Promise<void> {
for (const cell of CELLS) {
const leased = await databases[0]!.query(
`SELECT COALESCE(SUM(request_units), 0) AS units
FROM relay_assignment_activity_leases WHERE cell_id = ?`,
[cell.id]
)
expect({ cell: cell.id, reserved: await reservedRequests(cell.id) }).toEqual({
cell: cell.id,
reserved: Number(leased[0]!['units'])
})
}
}
async function expectReservationAccountingExcept(cellId: string): Promise<void> {
for (const cell of CELLS.filter(({ id }) => id !== cellId)) {
const leased = await databases[0]!.query(
`SELECT COALESCE(SUM(request_units), 0) AS units
FROM relay_assignment_activity_leases WHERE cell_id = ?`,
[cell.id]
)
expect(await reservedRequests(cell.id)).toBe(Number(leased[0]!['units']))
}
}
async function counters(identity: {
userId: string
relayHostId: string
}): Promise<{ controls: number; splices: number }> {
const rows = await databases[0]!.query(
`SELECT reserved_controls, reserved_splices FROM relay_assignments
WHERE user_id = ? AND relay_host_id = ?`,
[identity.userId, identity.relayHostId]
)
return {
controls: Number(rows[0]!['reserved_controls']),
splices: Number(rows[0]!['reserved_splices'])
}
}
// Holds the named relay_cells rows in another session until released, the
// way a release from a far cell holds its row across a round trip.
async function holdCellRows(cellIds: string[]): Promise<() => Promise<void>> {
@@ -144,40 +100,18 @@ describePostgres('PostgreSQL re-placement off a cell isolated for a roll', () =>
}
async function waitForLock(table: 'relay_cells' | 'relay_assignments'): Promise<void> {
await vi.waitFor(async () => {
const rows = await databases[0]!.query(
`SELECT COUNT(*) AS waiting FROM pg_stat_activity
await vi.waitFor(
async () => {
const rows = await databases[0]!.query(
`SELECT COUNT(*) AS waiting FROM pg_stat_activity
WHERE datname = current_database() AND wait_event_type = 'Lock'
AND application_name = ? AND query LIKE ? AND query LIKE '%FOR UPDATE%'`,
[databaseApplicationName(1), `%${table}%`]
)
expect(Number(rows[0]?.['waiting'])).toBeGreaterThan(0)
}, { timeout: 4_000, interval: 10 })
}
// Puts a host on the source with a live control and a splice, then isolates
// the source for a roll with both targets open.
async function seedActiveHostOnIsolatedSource(index: number): Promise<{
identity: { userId: string; relayHostId: string }
first: { cellId: string; assignmentEpoch: number }
}> {
const identity = hostIdentity(index)
await applySelector({ [TARGETS[0]!.id]: 'migration-only', [TARGETS[1]!.id]: 'migration-only' })
const first = await stores[0]!.assign(identity, 'us-central1')
expect(first.cellId).toBe(ISOLATED.id)
await stores[0]!.activateControl(identity, {
cellId: ISOLATED.id,
assignmentEpoch: first.assignmentEpoch,
generation: 1
})
await stores[0]!.acquireActivity(identity, {
activityId: 'splice:keep-1',
kind: 'splice',
cellId: ISOLATED.id
})
await applySelector({ [TARGETS[0]!.id]: 'general', [TARGETS[1]!.id]: 'general' })
await applySelector({ [ISOLATED.id]: 'migration-only' }, [ISOLATED.id])
return { identity, first }
[databaseApplicationName(1), `%${table}%`]
)
expect(Number(rows[0]?.['waiting'])).toBeGreaterThan(0)
},
{ timeout: 4_000, interval: 10 }
)
}
// `enforced` puts a cell at its connection cap, which leaves it no headroom.
@@ -211,9 +145,7 @@ describePostgres('PostgreSQL re-placement off a cell isolated for a roll', () =>
const current = await stores[0]!.inspectCellAdmissionSelector()
// Built from relay_cells, not from the selector's own membership: the apply
// requires exact coverage of the fleet, and this database is shared.
const fleet = await databases[0]!.query(
`SELECT cell_id FROM relay_cells ORDER BY cell_id ASC`
)
const fleet = await databases[0]!.query(`SELECT cell_id FROM relay_cells ORDER BY cell_id ASC`)
const membership: CellAdmissionMembership = {
existingOnly: [],
migrationOnly: [],
@@ -251,15 +183,6 @@ describePostgres('PostgreSQL re-placement off a cell isolated for a roll', () =>
})
}
async function rollIsolatedAt(cellId: string): Promise<number | null> {
const rows = await databases[0]!.query(
`SELECT roll_isolated_at FROM relay_cell_admission WHERE cell_id = ?`,
[cellId]
)
const value = rows[0]?.['roll_isolated_at']
return value === undefined || value === null ? null : Number(value)
}
// Every case starts from the whole fleet general; a case that leaves a cell
// isolated would otherwise starve the next one of placement candidates.
async function resetFleet(): Promise<void> {
@@ -301,11 +224,13 @@ describePostgres('PostgreSQL re-placement off a cell isolated for a roll', () =>
// Four connections so the concurrent dials below really contend on the
// fleet-wide relay_cells lock rather than queueing in one client.
for (let index = 0; index < 4; index += 1) {
databases.push(await openRelayDatabase({
databaseUrl,
dataDir: '',
applicationName: databaseApplicationName(index)
}))
databases.push(
await openRelayDatabase({
databaseUrl,
dataDir: '',
applicationName: databaseApplicationName(index)
})
)
}
stores = databases.map(
(database) =>
@@ -344,129 +269,6 @@ describePostgres('PostgreSQL re-placement off a cell isolated for a roll', () =>
for (const connection of databases) await connection.close()
})
it('stamps only the named cell on isolate and clears it on restore', async () => {
await resetFleet()
expect(await rollIsolatedAt(ISOLATED.id)).toBeNull()
await applySelector({ [ISOLATED.id]: 'migration-only' }, [ISOLATED.id])
const stamped = await rollIsolatedAt(ISOLATED.id)
expect(stamped).toBe(NOW)
// Cells the isolate did not name stay unmarked even when parked in the same
// apply: that is every non-roll flow, and its hosts must keep their pin.
await applySelector({ [TARGETS[0]!.id]: 'migration-only' })
expect(await rollIsolatedAt(TARGETS[0]!.id)).toBeNull()
// A failed wave re-isolates rather than restoring; the stamp survives, and
// does not move, so the hosts left behind stay eligible.
await applySelector({ [ISOLATED.id]: 'migration-only' }, [ISOLATED.id])
expect(await rollIsolatedAt(ISOLATED.id)).toBe(stamped)
// Restore writes 'general', and the same statement clears the stamp.
await applySelector({ [ISOLATED.id]: 'general' })
expect(await rollIsolatedAt(ISOLATED.id)).toBeNull()
}, 30_000)
it('classifies a reconnect by its home cell’s stamp in the verification read', async () => {
await resetFleet()
const identity = hostIdentity(903)
const classify = { classifyHomeRollIsolation: true }
await applySelector({ [TARGETS[0]!.id]: 'migration-only', [TARGETS[1]!.id]: 'migration-only' })
const first = await stores[0]!.assign(identity, 'us-central1')
await applySelector({ [TARGETS[0]!.id]: 'general', [TARGETS[1]!.id]: 'general' })
expect(first.cellId).toBe(ISOLATED.id)
expect(await stores[0]!.resolve(identity, classify)).not.toHaveProperty('homeCellRollIsolated')
await applySelector({ [ISOLATED.id]: 'migration-only' }, [ISOLATED.id])
expect(await stores[0]!.resolve(identity, classify)).toMatchObject({
cellId: ISOLATED.id,
homeCellRollIsolated: true
})
await applySelector({ [ISOLATED.id]: 'general' })
expect(await stores[0]!.resolve(identity, classify)).not.toHaveProperty('homeCellRollIsolated')
}, 30_000)
it('ignores a stamp older than the roll it is supposed to describe', async () => {
// A failed wave keeps its stamp on purpose and can sit for hours; past the
// bound the cell stops shedding hosts one dial at a time.
await resetFleet()
const identity = hostIdentity(902)
const first = await stores[0]!.assign(identity, 'us-central1')
await applySelector({ [ISOLATED.id]: 'migration-only' }, [ISOLATED.id])
await databases[0]!.query(
`UPDATE relay_cell_admission SET roll_isolated_at = ? WHERE cell_id = ?`,
[NOW - (2 * 60 * 60_000 + 1), ISOLATED.id]
)
expect(await stores[0]!.assign(identity, 'us-central1')).toMatchObject({
cellId: first.cellId,
assignmentEpoch: first.assignmentEpoch
})
}, 30_000)
it('re-places every host off an isolated cell without leaking a reservation', async () => {
await resetFleet()
const identities = Array.from({ length: HOST_COUNT }, (_, index) => hostIdentity(index))
const sourceBaseline = await reservedRequests(ISOLATED.id)
const targetBaseline =
(await reservedRequests(TARGETS[0]!.id)) + (await reservedRequests(TARGETS[1]!.id))
// Everyone lands on the cell about to be isolated.
await applySelector({ [TARGETS[0]!.id]: 'migration-only', [TARGETS[1]!.id]: 'migration-only' })
const first = new Map<string, { cellId: string; assignmentEpoch: number }>()
for (const identity of identities) {
const grant = await stores[0]!.assign(identity, 'us-central1')
expect(grant.cellId).toBe(ISOLATED.id)
first.set(identity.relayHostId, grant)
}
await applySelector({ [TARGETS[0]!.id]: 'general', [TARGETS[1]!.id]: 'general' })
// The isolate step. The state and the stamp are written by one UPDATE under
// the fleet-wide relay_cells lock, so there is no torn state to race against.
await applySelector({ [ISOLATED.id]: 'migration-only' }, [ISOLATED.id])
expect(await rollIsolatedAt(ISOLATED.id)).not.toBeNull()
const grants = await Promise.all(
identities.map(
async (identity, index) =>
await stores[1 + (index % (stores.length - 1))]!.assign(identity, 'us-central1')
)
)
for (const [index, grant] of grants.entries()) {
const identity = identities[index]!
expect(grant.cellId).not.toBe(ISOLATED.id)
expect(TARGETS.map(({ id }) => id)).toContain(grant.cellId)
// Exactly once: a double bump would mean two transactions both moved it.
expect(grant.assignmentEpoch).toBe(first.get(identity.relayHostId)!.assignmentEpoch + 1)
}
// The placement leaves the source row alone: each host's pending control
// there still counts until the source releases it.
expect(await reservedRequests(ISOLATED.id)).toBe(sourceBaseline + HOST_COUNT)
expect(
(await reservedRequests(TARGETS[0]!.id)) + (await reservedRequests(TARGETS[1]!.id))
).toBe(targetBaseline + HOST_COUNT)
await expectReservationAccounting()
for (const identity of identities) {
expect(
await stores[0]!.releaseActivity(
identity,
`control-pending:${first.get(identity.relayHostId)!.assignmentEpoch}`
)
).toBe(true)
}
expect(await reservedRequests(ISOLATED.id)).toBe(sourceBaseline)
await expectReservationAccounting()
const rows = await databases[0]!.query(
`SELECT COUNT(*) AS count FROM relay_assignments
WHERE user_id LIKE '${USER_PREFIX}-%' AND cell_id = ?`,
[ISOLATED.id]
)
expect(Number(rows[0]!['count'])).toBe(0)
}, 60_000)
it('lets exactly one of a host’s racing dials win the re-placement', async () => {
await resetFleet()
const identity = hostIdentity(900)
@@ -486,9 +288,7 @@ describePostgres('PostgreSQL re-placement off a cell isolated for a roll', () =>
stores[1]!.assign(identity, 'us-central1'),
stores[2]!.assign(identity, 'us-central1')
])
const granted = raced.flatMap((result) =>
result.status === 'fulfilled' ? [result.value] : []
)
const granted = raced.flatMap((result) => (result.status === 'fulfilled' ? [result.value] : []))
expect(granted.length).toBeGreaterThan(0)
// Concurrent dials may grant repeatedly but commit one move: one epoch/unit on target, preserving source leases until release.
@@ -502,399 +302,6 @@ describePostgres('PostgreSQL re-placement off a cell isolated for a roll', () =>
).toBe(targetBaseline + 1)
}, 30_000)
it('grants no host the isolated cell after the admission flip commits', async () => {
await resetFleet()
const identity = hostIdentity(901)
const first = await stores[0]!.assign(identity, 'us-central1')
await applySelector({ [ISOLATED.id]: 'migration-only' }, [ISOLATED.id])
for (let dial = 0; dial < 5; dial += 1) {
const grant = await stores[1 + (dial % (stores.length - 1))]!.assign(
identity,
'us-central1'
)
expect(grant.cellId).not.toBe(ISOLATED.id)
}
// Only the first dial re-places; the rest are ordinary sticky re-grants.
expect((await stores[0]!.resolve(identity))?.assignmentEpoch).toBe(
first.assignmentEpoch + 1
)
}, 30_000)
it('leaves the source row to the source’s own releases and keeps the host’s counters', async () => {
await resetFleet()
const { identity, first } = await seedActiveHostOnIsolatedSource(910)
const sourceBefore = await reservedRequests(ISOLATED.id)
const targetsBefore =
(await reservedRequests(TARGETS[0]!.id)) + (await reservedRequests(TARGETS[1]!.id))
expect(sourceBefore).toBe(3)
expect(await counters(identity)).toEqual({ controls: 1, splices: 1 })
const moved = await stores[1]!.assign(identity, 'us-central1')
expect(TARGETS.map(({ id }) => id)).toContain(moved.cellId)
expect(moved.assignmentEpoch).toBe(first.assignmentEpoch + 1)
expect(await reservedRequests(ISOLATED.id)).toBe(sourceBefore)
expect(
(await reservedRequests(TARGETS[0]!.id)) + (await reservedRequests(TARGETS[1]!.id))
).toBe(targetsBefore + 1)
// One control added on the target; the source's control and splice kept.
expect(await counters(identity)).toEqual({ controls: 2, splices: 1 })
await expectReservationAccounting()
// The source closes the host's sockets: each release takes its own units.
expect(await stores[0]!.releaseActivity(identity, `control:${ISOLATED.id}:1`)).toBe(true)
expect(await reservedRequests(ISOLATED.id)).toBe(sourceBefore - 1)
expect(await counters(identity)).toEqual({ controls: 1, splices: 1 })
expect(await stores[0]!.releaseActivity(identity, 'splice:keep-1')).toBe(true)
expect(await reservedRequests(ISOLATED.id)).toBe(0)
// The target's control survives the source's releases.
expect(await counters(identity)).toEqual({ controls: 1, splices: 0 })
await expectReservationAccounting()
}, 30_000)
it('re-places an isolated incumbent while the source row is held', async () => {
await resetFleet()
const { identity, first } = await seedActiveHostOnIsolatedSource(911)
const sourceBefore = await reservedRequests(ISOLATED.id)
const release = await holdCellRows([ISOLATED.id])
try {
// Held far past the 500ms bounded wait: a placement that asked for the
// source row could not finish inside this window.
const moved = await Promise.race([
stores[1]!.assign(identity, 'us-central1'),
new Promise<'blocked'>((resolve) => setTimeout(() => resolve('blocked'), 3_000))
])
expect(moved).not.toBe('blocked')
expect(moved).toMatchObject({ assignmentEpoch: first.assignmentEpoch + 1 })
} finally {
await release()
}
expect(await reservedRequests(ISOLATED.id)).toBe(sourceBefore)
await expectReservationAccounting()
}, 30_000)
it('waits for the target rows it increments', async () => {
await resetFleet()
const { identity, first } = await seedActiveHostOnIsolatedSource(912)
const targetsBefore =
(await reservedRequests(TARGETS[0]!.id)) + (await reservedRequests(TARGETS[1]!.id))
const release = await holdCellRows(TARGETS.map(({ id }) => id))
const placement = stores[1]!.assign(identity, 'us-central1')
try {
await waitForLock('relay_cells')
} finally {
await release()
await placement.catch(() => undefined)
}
expect(await placement).toMatchObject({ assignmentEpoch: first.assignmentEpoch + 1 })
expect(
(await reservedRequests(TARGETS[0]!.id)) + (await reservedRequests(TARGETS[1]!.id))
).toBe(targetsBefore + 1)
await expectReservationAccounting()
}, 30_000)
it('keeps the pin when no general cell in any region has headroom', async () => {
await resetFleet()
const { identity, first } = await seedActiveHostOnIsolatedSource(913)
const sourceBefore = await reservedRequests(ISOLATED.id)
await databases[0]!.query(
`UPDATE relay_cells SET reserved_requests = capacity_requests WHERE cell_id IN (?, ?, ?)`,
[...TARGETS, OTHER_REGION].map(({ id }) => id)
)
try {
expect(await stores[1]!.assign(identity, 'us-central1')).toMatchObject({
cellId: ISOLATED.id,
assignmentEpoch: first.assignmentEpoch
})
expect(await reservedRequests(ISOLATED.id)).toBe(sourceBefore)
expect(await counters(identity)).toEqual({ controls: 1, splices: 1 })
} finally {
await databases[0]!.query(
`UPDATE relay_cells SET reserved_requests = 0 WHERE cell_id IN (?, ?, ?)`,
[...TARGETS, OTHER_REGION].map(({ id }) => id)
)
}
}, 30_000)
it('moves to another region when its own is at the connection cap, without the source row', async () => {
await resetFleet()
const { identity, first } = await seedActiveHostOnIsolatedSource(917)
const sourceBefore = await reservedRequests(ISOLATED.id)
await heartbeatAll(Object.fromEntries(TARGETS.map(({ id }) => [id, 600])))
const release = await holdCellRows([ISOLATED.id])
try {
const moved = await Promise.race([
stores[1]!.assign(identity, 'us-central1'),
new Promise<'blocked'>((resolve) => setTimeout(() => resolve('blocked'), 3_000))
])
expect(moved).toMatchObject({
cellId: OTHER_REGION.id,
region: 'asia-east2',
assignmentEpoch: first.assignmentEpoch + 1
})
} finally {
await release()
await heartbeatAll()
}
expect(await reservedRequests(ISOLATED.id)).toBe(sourceBefore)
expect(await reservedRequests(OTHER_REGION.id)).toBe(1)
await expectReservationAccounting()
}, 30_000)
it('places a dormant host without asking for its old cell row', async () => {
await resetFleet()
const identity = hostIdentity(914)
await applySelector({ [TARGETS[0]!.id]: 'migration-only', [TARGETS[1]!.id]: 'migration-only' })
const first = await stores[0]!.assign(identity, 'us-central1')
expect(first.cellId).toBe(ISOLATED.id)
// Dormant: no units held and no activity inside the dormancy window.
await databases[0]!.query(
`DELETE FROM relay_assignment_activity_leases WHERE user_id = ? AND relay_host_id = ?`,
[identity.userId, identity.relayHostId]
)
await databases[0]!.query(
`UPDATE relay_assignments SET reserved_controls = 0, last_activity_at = ?
WHERE user_id = ? AND relay_host_id = ?`,
[NOW - ASSIGNMENT_LIMITS.dormantTtlMs, identity.userId, identity.relayHostId]
)
await databases[0]!.query(`UPDATE relay_cells SET reserved_requests = 0 WHERE cell_id = ?`, [
ISOLATED.id
])
await applySelector({ [TARGETS[0]!.id]: 'general', [TARGETS[1]!.id]: 'general' })
await applySelector({ [ISOLATED.id]: 'migration-only' }, [ISOLATED.id])
const release = await holdCellRows([ISOLATED.id])
try {
const moved = await Promise.race([
stores[1]!.assign(identity, 'us-central1'),
new Promise<'blocked'>((resolve) => setTimeout(() => resolve('blocked'), 3_000))
])
expect(moved).toMatchObject({ assignmentEpoch: first.assignmentEpoch + 1 })
expect(TARGETS.map(({ id }) => id)).toContain(moved === 'blocked' ? moved : moved.cellId)
} finally {
await release()
}
await expectReservationAccounting()
}, 30_000)
// Moves a seeded host onto TARGETS[0] next to another host whose splice there
// outlives the test, so an over-charge shows instead of clamping at zero.
async function seedMovedHostBesideNeighbour(index: number): Promise<{
identity: { userId: string; relayHostId: string }
neighbour: { userId: string; relayHostId: string }
}> {
const { identity } = await seedActiveHostOnIsolatedSource(index)
await applySelector({ [TARGETS[1]!.id]: 'migration-only' })
const neighbour = hostIdentity(index + 50)
expect((await stores[0]!.assign(neighbour, 'us-central1')).cellId).toBe(TARGETS[0]!.id)
await stores[0]!.acquireActivity(neighbour, {
activityId: 'splice:neighbour',
kind: 'splice',
cellId: TARGETS[0]!.id,
expiresAt: NOW + 10 * 60 * 60_000
})
expect((await stores[1]!.assign(identity, 'us-central1')).cellId).toBe(TARGETS[0]!.id)
expect(await counters(identity)).toEqual({ controls: 2, splices: 1 })
await expectReservationAccounting()
return { identity, neighbour }
}
it('leaves a host with leases on two cells to the lease sweep', async () => {
await resetFleet()
const { identity } = await seedMovedHostBesideNeighbour(915)
// Past every lease but the neighbour's splice.
const later = new RelayAssignmentStore(databases[0]!, () => NOW + 60 * 60_000, {
requireLiveCells: true,
heartbeatTtlMs: 45_000
})
try {
// Aggregate expiry first, with the source's leases still present: the
// order a lease sweep skipped on a busy row leaves behind.
await later.releaseExpiredActivity()
expect(await counters(identity)).toEqual({ controls: 2, splices: 1 })
await expectReservationAccounting()
await later.releaseExpiredActivityLeases()
await later.releaseExpiredActivity()
expect(await counters(identity)).toEqual({ controls: 0, splices: 0 })
expect(await reservedRequests(ISOLATED.id)).toBe(0)
// Only the neighbour's splice is left on the target.
expect(await reservedRequests(TARGETS[0]!.id)).toBe(2)
await expectReservationAccounting()
} finally {
await applySelector({ [TARGETS[1]!.id]: 'general' })
}
}, 30_000)
it('frees the source leases on their own cell when the target dies', async () => {
await resetFleet()
const { identity } = await seedMovedHostBesideNeighbour(916)
// The roll finishes, then the target stops heartbeating before the source
// has released the host. Uncapped, so no fence is needed to move off it.
await applySelector({ [ISOLATED.id]: 'general' })
await databases[0]!.query(`UPDATE relay_cell_runtime SET ready = 0 WHERE cell_id = ?`, [
TARGETS[0]!.id
])
await databases[0]!.query(`DELETE FROM relay_cell_connection_limits WHERE cell_id = ?`, [
TARGETS[0]!.id
])
try {
const moved = await stores[1]!.assign(identity, 'us-central1')
expect(moved.cellId).toBe(ISOLATED.id)
expect(await counters(identity)).toEqual({ controls: 1, splices: 0 })
// The deleted source leases took their units with them; a late release
// from the source finds nothing and charges nothing.
expect(await stores[0]!.releaseActivity(identity, `control:${ISOLATED.id}:1`)).toBe(false)
expect(await reservedRequests(ISOLATED.id)).toBe(1)
expect(await reservedRequests(TARGETS[0]!.id)).toBe(3)
await expectReservationAccounting()
} finally {
// Re-registers the connection limit, then the heartbeat restores ready.
await stores[0]!.reconcileCells(CELLS, false)
await heartbeatAll()
await applySelector({ [TARGETS[1]!.id]: 'general' })
}
}, 30_000)
// A host main's old placement left behind: its counters were reset while its
// source lease stayed, and the lease's release floored them at zero.
async function seedDriftedHost(
index: number,
counted: { controls: number; unbackedSourceUnits: number }
): Promise<{ identity: { userId: string; relayHostId: string }; epoch: number }> {
const identity = hostIdentity(index)
await applySelector({ [TARGETS[0]!.id]: 'migration-only', [TARGETS[1]!.id]: 'migration-only' })
const first = await stores[0]!.assign(identity, 'us-central1')
expect(first.cellId).toBe(ISOLATED.id)
await stores[0]!.activateControl(identity, {
cellId: ISOLATED.id,
assignmentEpoch: first.assignmentEpoch,
generation: 1
})
await databases[0]!.query(
`UPDATE relay_assignments SET reserved_controls = ? WHERE user_id = ? AND relay_host_id = ?`,
[counted.controls, identity.userId, identity.relayHostId]
)
// Units the source still counts with no lease behind them.
await databases[0]!.query(
`UPDATE relay_cells SET reserved_requests = reserved_requests + ? WHERE cell_id = ?`,
[counted.unbackedSourceUnits, ISOLATED.id]
)
await applySelector({ [TARGETS[0]!.id]: 'general', [TARGETS[1]!.id]: 'general' })
await applySelector({ [ISOLATED.id]: 'migration-only' }, [ISOLATED.id])
return { identity, epoch: first.assignmentEpoch }
}
it('heals counters below the leases on the narrowed path', async () => {
await resetFleet()
const { identity, epoch } = await seedDriftedHost(918, { controls: 0, unbackedSourceUnits: 0 })
expect(await counters(identity)).toEqual({ controls: 0, splices: 0 })
await expectReservationAccounting()
const release = await holdCellRows([ISOLATED.id])
try {
const moved = await Promise.race([
stores[1]!.assign(identity, 'us-central1'),
new Promise<'blocked'>((resolve) => setTimeout(() => resolve('blocked'), 3_000))
])
expect(moved).toMatchObject({ assignmentEpoch: epoch + 1 })
expect(TARGETS.map(({ id }) => id)).toContain(moved === 'blocked' ? moved : moved.cellId)
} finally {
await release()
}
// The kept source control plus the new one.
expect(await counters(identity)).toEqual({ controls: 2, splices: 0 })
await expectReservationAccounting()
expect(await stores[0]!.releaseActivity(identity, `control:${ISOLATED.id}:1`)).toBe(true)
expect(await counters(identity)).toEqual({ controls: 1, splices: 0 })
expect(await reservedRequests(ISOLATED.id)).toBe(0)
await expectReservationAccounting()
}, 30_000)
it('takes the all-rows path for units no lease backs', async () => {
await resetFleet()
const { identity, epoch } = await seedDriftedHost(919, { controls: 3, unbackedSourceUnits: 2 })
await expectReservationAccountingExcept(ISOLATED.id)
const release = await holdCellRows([ISOLATED.id])
const held = stores[1]!.assign(identity, 'us-central1').then(
() => 'placed' as const,
() => 'failed' as const
)
try {
// It needs the source row to take the unbacked units off it, so while the
// row is held it either waits or times out; it never places.
expect(
await Promise.race([
held,
new Promise<'waiting'>((resolve) => setTimeout(() => resolve('waiting'), 1_000))
])
).not.toBe('placed')
} finally {
await release()
}
await held
// Whether the held dial finished after the release or failed, the next one
// lands the single move.
expect(await stores[1]!.assign(identity, 'us-central1')).toMatchObject({
assignmentEpoch: epoch + 1
})
expect(await counters(identity)).toEqual({ controls: 2, splices: 0 })
await expectReservationAccounting()
}, 30_000)
it('refuses at once while the host’s own release holds its assignment row', async () => {
await resetFleet()
const { identity, epoch } = await seedDriftedHost(921, { controls: 1, unbackedSourceUnits: 0 })
const release = await holdRows(
`SELECT user_id FROM relay_assignments WHERE user_id = ? AND relay_host_id = ?`,
[identity.userId, identity.relayHostId]
)
try {
const startedAt = performance.now()
await expect(stores[1]!.assign(identity, 'us-central1')).rejects.toBeInstanceOf(
RelayAssignmentRowBusyError
)
// An isolated pin gets no wait: far under the 1s a release can hold it.
expect(performance.now() - startedAt).toBeLessThan(500)
} finally {
await release()
}
expect((await stores[0]!.resolve(identity))?.assignmentEpoch).toBe(epoch)
expect((await stores[1]!.assign(identity, 'us-central1')).assignmentEpoch).toBe(epoch + 1)
await expectReservationAccounting()
}, 30_000)
it('waits up to a second for the row of a host pinned to a live general cell', async () => {
await resetFleet()
const identity = hostIdentity(922)
const first = await stores[0]!.assign(identity, 'us-central1')
const holdAssignment = async (): Promise<() => Promise<void>> =>
await holdRows(
`SELECT user_id FROM relay_assignments WHERE user_id = ? AND relay_host_id = ?`,
[identity.userId, identity.relayHostId]
)
// A short hold, like a calm host's own release: the sticky re-grant waits.
const shortHold = await holdAssignment()
const regrant = stores[1]!.assign(identity, 'us-central1')
try {
await waitForLock('relay_assignments')
} finally {
await shortHold()
await regrant.catch(() => undefined)
}
expect(await regrant).toMatchObject({
cellId: first.cellId,
assignmentEpoch: first.assignmentEpoch
})
// Held past the bound: refused, after about the bound and not the pool's.
const longHold = await holdAssignment()
try {
const startedAt = performance.now()
await expect(stores[1]!.assign(identity, 'us-central1')).rejects.toBeInstanceOf(
RelayAssignmentRowBusyError
)
const waitedMs = performance.now() - startedAt
expect(waitedMs).toBeGreaterThanOrEqual(900)
expect(waitedMs).toBeLessThan(2_000)
} finally {
await longHold()
}
}, 30_000)
it('never waits on the assignment row while its retry holds the pinned cell row', async () => {
await resetFleet()
const identity = hostIdentity(923)
@@ -1,7 +1,7 @@
import { createHash } from 'node:crypto'
import { afterEach, describe, expect, it, vi } from 'vitest'
import { RelayAssignmentStore, RelayHomeCellUnavailableError } from './assignment-store.js'
import { ReservePaceError } from './reserve-placement/reserve-assignment.js'
import { RelayAssignmentStore } from './assignment-store.js'
import {
encodeMembership,
type CellAdmissionMembership,
@@ -41,16 +41,10 @@ afterEach(async () => {
for (const database of databases.splice(0)) await database.close()
})
// Counts the reads this change adds, so the general hot path can be held to a
// single admission lookup and no migration lookup at all.
class QueryCountingDatabase implements RelayDatabase {
readonly sql: string[] = []
class WriteFailureDatabase implements RelayDatabase {
// Fails the first statement containing this fragment, so a test can roll a
// transaction back at a chosen point.
failOnce: string | undefined
// Locked statements that report the row busy, in order: each fragment fires
// once, on the first locked statement containing it after the one before.
lockUnavailableSequence: string[] = []
constructor(private readonly delegate: RelayDatabase) {}
@@ -58,12 +52,7 @@ class QueryCountingDatabase implements RelayDatabase {
return this.delegate.dialect
}
count(fragment: string): number {
return this.sql.filter((statement) => statement.includes(fragment)).length
}
record(sql: string): void {
this.sql.push(sql)
if (this.failOnce !== undefined && sql.includes(this.failOnce)) {
this.failOnce = undefined
throw new Error('injected_placement_write_failure')
@@ -80,17 +69,8 @@ class QueryCountingDatabase implements RelayDatabase {
params?: unknown[],
options?: RelayLockOptions
): Promise<SqlRow[]> {
this.recordLocked(sql)
return await this.delegate.queryLocked(sql, params, options)
}
recordLocked(sql: string): void {
this.record(sql)
const next = this.lockUnavailableSequence[0]
if (next !== undefined && sql.includes(next)) {
this.lockUnavailableSequence.shift()
throw new Error('database_lock_unavailable')
}
return await this.delegate.queryLocked(sql, params, options)
}
async transaction<T>(
@@ -107,8 +87,7 @@ class QueryCountingDatabase implements RelayDatabase {
await this.delegate.close()
}
// A nested transaction shares this one's tape, so a whole assign() is
// measured as a unit.
// Inject the failure inside the transaction so the real database rolls it back.
private recording(inner: RelayDatabase): RelayDatabase {
return {
dialect: inner.dialect,
@@ -117,7 +96,7 @@ class QueryCountingDatabase implements RelayDatabase {
return await inner.query(sql, params)
},
queryLocked: async (sql, params, options) => {
this.recordLocked(sql)
this.record(sql)
return await inner.queryLocked(sql, params, options)
},
transaction: async (operation, options) => await inner.transaction(operation, options),
@@ -129,7 +108,7 @@ class QueryCountingDatabase implements RelayDatabase {
interface Harness {
store: RelayAssignmentStore
database: RelayDatabase
counter: QueryCountingDatabase
counter: WriteFailureDatabase
heartbeat: (cell: RelayCellConfig, at?: number) => Promise<void>
setNow: (value: number) => void
/** The real isolate path: one selector apply that names the cell it stamps. */
@@ -144,7 +123,7 @@ interface Harness {
async function setup(cells: RelayCellConfig[] = CELLS): Promise<Harness> {
const inner = await openInMemoryRelayDatabase()
databases.push(inner)
const counter = new QueryCountingDatabase(inner)
const counter = new WriteFailureDatabase(inner)
let now = START_MS
const store = new RelayAssignmentStore(counter, () => now, {
requireLiveCells: true,
@@ -233,43 +212,6 @@ async function setup(cells: RelayCellConfig[] = CELLS): Promise<Harness> {
}
}
async function insertMigration(
database: RelayDatabase,
input: {
sourceCellId: string
targetCellId: string
assignmentEpoch: number
leases: number
settled?: 'completed' | 'aborted'
}
): Promise<void> {
await database.query(
`INSERT INTO relay_assignment_migrations
(user_id, relay_host_id, source_cell_id, target_cell_id, previous_epoch,
assignment_epoch, source_request_units, target_reserved_units, expires_at,
target_registered_at, completed_at, aborted_at, created_at, updated_at)
VALUES (?, ?, ?, ?, ?, ?, 1, 1, ?, NULL, ?, ?, ?, ?)`,
[
IDENTITY.userId,
IDENTITY.relayHostId,
input.sourceCellId,
input.targetCellId,
input.assignmentEpoch - 1,
input.assignmentEpoch,
START_MS + 900_000,
input.settled === 'completed' ? START_MS : null,
input.settled === 'aborted' ? START_MS : null,
START_MS,
START_MS
]
)
await database.query(
`UPDATE relay_assignments SET migration_leases = ?
WHERE user_id = ? AND relay_host_id = ?`,
[input.leases, IDENTITY.userId, IDENTITY.relayHostId]
)
}
type ConsoleWarnSpy = { mock: { calls: unknown[][] } }
function jsonEvents(warn: ConsoleWarnSpy, event: string): unknown[] {
@@ -280,381 +222,6 @@ function jsonEvents(warn: ConsoleWarnSpy, event: string): unknown[] {
}
describe('re-placing a host off a cell isolated for a roll', () => {
it('leaves a host on a live general cell untouched, at one added admission read', async () => {
const { store, counter } = await setup()
const first = await store.assign(IDENTITY, 'us-central1')
counter.sql.length = 0
const second = await store.assign(IDENTITY, 'us-central1')
// Identical, not merely same-celled: the clock has not moved, so every
// field including the lease deadline must match; only the first was placed.
expect(second).toEqual({ ...first, placed: undefined })
// One row read answers both the stranded rule and the roll-stamp check.
expect(counter.count('relay_cell_admission')).toBe(1)
expect(counter.count('relay_assignment_migrations')).toBe(0)
// No placement: the sticky lane never reaches the fleet-wide inventory.
expect(counter.count('ORDER BY cell_id ASC')).toBe(0)
})
it('keeps a host pinned to a migration-only cell with no roll stamp', async () => {
// Unstamped non-roll parking must retain hosts or undo evacuation/Asia rollback/operator intent.
const { store, park, rollIsolatedAt } = await setup()
const first = await store.assign(IDENTITY, 'us-central1')
await park(first.cellId, 'migration-only')
expect(await rollIsolatedAt(first.cellId)).toBeNull()
const pinned = await store.assign(IDENTITY, 'us-central1')
expect(pinned).toMatchObject({ cellId: first.cellId, assignmentEpoch: first.assignmentEpoch })
expect(pinned.placed).toBeUndefined()
})
it('re-places a host once the roll stamp is set', async () => {
const { store, counter, isolateForRoll, rollIsolatedAt } = await setup()
const first = await store.assign(IDENTITY, 'us-central1')
await isolateForRoll(first.cellId)
expect(await rollIsolatedAt(first.cellId)).toBe(START_MS)
counter.sql.length = 0
const moved = await store.assign(IDENTITY, 'us-central1')
expect(moved.cellId).not.toBe(first.cellId)
expect(moved.assignmentEpoch).toBe(first.assignmentEpoch + 1)
expect(moved.placed).toBe(true)
expect(counter.count('relay_assignment_migrations')).toBeGreaterThan(0)
// Durable: the next dial does not bounce back to the isolated cell.
const kept = await store.assign(IDENTITY, 'us-central1')
expect(kept).toMatchObject({ cellId: moved.cellId, assignmentEpoch: moved.assignmentEpoch })
expect(kept.placed).toBeUndefined()
})
it.each([
{ label: 'just inside the bound', age: 2 * 60 * 60_000 - 1, moves: true },
{ label: 'just outside the bound', age: 2 * 60 * 60_000 + 1, moves: false }
])('treats a stamp $label as $moves', async ({ age, moves }) => {
// Past a normal ~15-minute roll, stamps may be failed-wave or old-restore orphans; keep possibly healthy hosts pinned for operator recovery.
const { store, heartbeat, isolateForRoll, setNow } = await setup()
const first = await store.assign(IDENTITY, 'us-central1')
await isolateForRoll(first.cellId)
const later = START_MS + age
setNow(later)
for (const cell of CELLS) await heartbeat(cell, later)
const grant = await store.assign(IDENTITY, 'us-central1')
if (moves) {
expect(grant.cellId).not.toBe(first.cellId)
expect(grant.assignmentEpoch).toBe(first.assignmentEpoch + 1)
} else {
expect(grant.cellId).toBe(first.cellId)
expect(grant.assignmentEpoch).toBe(first.assignmentEpoch)
}
})
it('stops re-placing once restore clears the stamp', async () => {
const { store, isolateForRoll, restore, rollIsolatedAt } = await setup()
const first = await store.assign(IDENTITY, 'us-central1')
await isolateForRoll(first.cellId)
await restore(first.cellId)
expect(await rollIsolatedAt(first.cellId)).toBeNull()
expect(await store.assign(IDENTITY, 'us-central1')).toMatchObject({
cellId: first.cellId,
assignmentEpoch: first.assignmentEpoch
})
})
it('keeps a host pinned to an existing-only cell that still serves it', async () => {
// Why: existing-only cells serve the hosts they already hold (PR #194). Only
// assignmentStrandedOnUnservedCell may release that pin, and only on proof
// the cell stopped serving this host.
const { store, database, heartbeat, park, setNow } = await setup()
const first = await store.assign(IDENTITY, 'us-central1')
await park(first.cellId, 'existing-only')
await database.query(
`INSERT INTO relay_assignment_activity_leases
(user_id, relay_host_id, activity_id, activity_kind, cell_id,
request_units, expires_at, updated_at)
VALUES (?, ?, 'control:live-1', 'control', ?, 1, ?, ?)`,
[IDENTITY.userId, IDENTITY.relayHostId, first.cellId, START_MS + 600_000, START_MS]
)
// Past the stranded rule's minimum grant age, which outlives the heartbeat TTL.
setNow(START_MS + 61_000)
for (const cell of CELLS) await heartbeat(cell, START_MS + 61_000)
expect(await store.assign(IDENTITY, 'us-central1')).toMatchObject({
cellId: first.cellId,
assignmentEpoch: first.assignmentEpoch
})
})
it('keeps a host pinned on an unstamped cell whose migration has completed', async () => {
// Completed evacuations await separate promotion in migration-only; re-placement would undo them.
const { store, database, park } = await setup()
const first = await store.assign(IDENTITY, 'us-central1')
await insertMigration(database, {
sourceCellId: 'us-c2',
targetCellId: first.cellId,
assignmentEpoch: first.assignmentEpoch,
leases: 0,
settled: 'completed'
})
await park(first.cellId, 'migration-only')
expect(await store.assign(IDENTITY, 'us-central1')).toMatchObject({
cellId: first.cellId,
assignmentEpoch: first.assignmentEpoch
})
})
it('re-places a stamped cell whose migration has completed', async () => {
const { store, database, isolateForRoll } = await setup()
const first = await store.assign(IDENTITY, 'us-central1')
await insertMigration(database, {
sourceCellId: 'us-c2',
targetCellId: first.cellId,
assignmentEpoch: first.assignmentEpoch,
leases: 0,
settled: 'completed'
})
await isolateForRoll(first.cellId)
expect((await store.assign(IDENTITY, 'us-central1')).cellId).not.toBe(first.cellId)
})
it('keeps the pin while a migration lease is outstanding', async () => {
const { store, database, isolateForRoll } = await setup()
const first = await store.assign(IDENTITY, 'us-central1')
await insertMigration(database, {
sourceCellId: first.cellId,
targetCellId: 'us-c2',
assignmentEpoch: first.assignmentEpoch,
leases: 1
})
await isolateForRoll(first.cellId)
expect(await store.assign(IDENTITY, 'us-central1')).toMatchObject({
cellId: first.cellId,
assignmentEpoch: first.assignmentEpoch
})
})
it('keeps the pin while a migration row is open but its lease has lapsed', async () => {
// Migration rows outlive their 15-minute counters and cannot roll back from non-general sources; re-placement would strand them.
const { store, database, isolateForRoll } = await setup()
const first = await store.assign(IDENTITY, 'us-central1')
await insertMigration(database, {
sourceCellId: first.cellId,
targetCellId: 'us-c2',
assignmentEpoch: first.assignmentEpoch,
leases: 0
})
await isolateForRoll(first.cellId)
expect(await store.assign(IDENTITY, 'us-central1')).toMatchObject({
cellId: first.cellId,
assignmentEpoch: first.assignmentEpoch
})
})
it('crosses a region boundary only when its own region has no room', async () => {
const warn = vi.spyOn(console, 'warn').mockImplementation(() => {})
const { store, isolateForRoll, park } = await setup()
const first = await store.assign(IDENTITY, 'us-central1')
const other = CELLS.find((cell) => cell.region === 'us-central1' && cell.id !== first.cellId)!
await park(other.id, 'migration-only')
await isolateForRoll(first.cellId)
warn.mockClear()
expect(await store.assign(IDENTITY, 'us-central1')).toMatchObject({
cellId: 'asia-c1',
assignmentEpoch: first.assignmentEpoch + 1
})
expect(jsonEvents(warn, 'orca_relay_sticky_replaced_off_isolated_cell')).toEqual([
{
event: 'orca_relay_sticky_replaced_off_isolated_cell',
fromCellId: first.cellId,
fromRegion: 'us-central1',
admissionState: 'migration-only',
toCellId: 'asia-c1',
region: 'asia-east2'
}
])
})
it('keeps the pin, and says so, when no region has a general cell with room', async () => {
const warn = vi.spyOn(console, 'warn').mockImplementation(() => {})
const { store, isolateForRoll, park } = await setup()
const first = await store.assign(IDENTITY, 'us-central1')
for (const cell of CELLS) {
if (cell.id !== first.cellId) await park(cell.id, 'migration-only')
}
await isolateForRoll(first.cellId)
warn.mockClear()
expect(await store.assign(IDENTITY, 'us-central1')).toMatchObject({
cellId: first.cellId,
assignmentEpoch: first.assignmentEpoch
})
expect(jsonEvents(warn, 'orca_relay_sticky_replacement_deferred')).toEqual([
{
event: 'orca_relay_sticky_replacement_deferred',
reason: 'no_same_region_headroom',
cellId: first.cellId,
region: 'us-central1'
}
])
expect(jsonEvents(warn, 'orca_relay_sticky_replaced_off_isolated_cell')).toEqual([])
})
it('prefers its own region over a less loaded cell elsewhere', async () => {
const { store, isolateForRoll } = await setup()
const first = await store.assign(IDENTITY, 'us-central1')
await isolateForRoll(first.cellId)
const moved = await store.assign(IDENTITY, 'us-central1')
expect(moved.region).toBe('us-central1')
expect(moved.cellId).not.toBe(first.cellId)
})
it('moves the only cell of a region to another region', async () => {
const { store, isolateForRoll } = await setup()
const first = await store.assign(IDENTITY, 'asia-east2')
expect(first.region).toBe('asia-east2')
await isolateForRoll(first.cellId)
// asia-c1 is the only Asia cell, so the only in-region candidate is gone.
const moved = await store.assign(IDENTITY, 'asia-east2')
expect(moved.region).toBe('us-central1')
expect(moved.assignmentEpoch).toBe(first.assignmentEpoch + 1)
})
describe('with a reserve cell in its own region', () => {
const onReserve = {
...IDENTITY,
cellId: 'asia-reserve',
cellUrl: 'https://asia-reserve.example.com',
assignmentEpoch: 9,
leaseExpiresAt: START_MS + 1_000_000,
region: 'asia-east2' as const
}
it('leaves the region as before when the reserve cell has no room either', async () => {
const warn = vi.spyOn(console, 'warn').mockImplementation(() => {})
const { store, isolateForRoll } = await setup()
const first = await store.assign(IDENTITY, 'asia-east2')
await isolateForRoll(first.cellId)
warn.mockClear()
const regionReserve = vi.fn(async () => null)
const moved = await store.assign(IDENTITY, 'asia-east2', 'asia-east2', undefined, {
regionReserve
})
expect(moved).toMatchObject({
region: 'us-central1',
assignmentEpoch: first.assignmentEpoch + 1
})
expect(regionReserve).toHaveBeenCalledOnce()
expect(jsonEvents(warn, 'orca_relay_sticky_replaced_off_isolated_cell')).toMatchObject([
{ fromCellId: first.cellId, region: 'us-central1' }
])
})
it('treats a throttled reserve cell as no room, so the drain does not wait on its intake', async () => {
const { store, isolateForRoll } = await setup()
const first = await store.assign(IDENTITY, 'asia-east2')
await isolateForRoll(first.cellId)
const regionReserve = vi.fn(async () => {
throw new ReservePaceError(4)
})
await expect(
store.assign(IDENTITY, 'asia-east2', 'asia-east2', undefined, { regionReserve })
).resolves.toMatchObject({
region: 'us-central1',
assignmentEpoch: first.assignmentEpoch + 1
})
expect(regionReserve).toHaveBeenCalledOnce()
})
describe('when no database cell has room anywhere', () => {
const onUsReserve = { ...onReserve, cellId: 'us-reserve', region: 'us-central1' as const }
const isolateWithNoDatabaseRoom = async () => {
const harness = await setup()
const first = await harness.store.assign(IDENTITY, 'asia-east2')
await harness.isolateForRoll(first.cellId)
for (const cell of CELLS.filter((entry) => entry.region === 'us-central1')) {
await harness.park(cell.id, 'migration-only')
}
return { ...harness, first }
}
// Today's rule: a live isolated cell keeps a host no other cell can take.
it('keeps the pin and never asks the spill', async () => {
const { store, first } = await isolateWithNoDatabaseRoom()
const reserveSpill = vi.fn(async () => onUsReserve)
const kept = await store.assign(IDENTITY, 'asia-east2', 'asia-east2', undefined, {
reserveSpill
})
expect(kept).toMatchObject({ cellId: first.cellId, assignmentEpoch: first.assignmentEpoch })
expect(reserveSpill).not.toHaveBeenCalled()
})
})
it('does not hold a host whose preferred region is elsewhere', async () => {
const { store, isolateForRoll, park } = await setup()
const first = await store.assign(IDENTITY, 'us-central1')
const other = CELLS.find((cell) => cell.region === 'us-central1' && cell.id !== first.cellId)!
await park(other.id, 'migration-only')
await isolateForRoll(first.cellId)
const regionReserve = vi.fn(async () => onReserve)
await expect(
store.assign(IDENTITY, 'asia-east2', 'asia-east2', undefined, { regionReserve })
).resolves.toMatchObject({ cellId: 'asia-c1' })
expect(regionReserve).not.toHaveBeenCalled()
})
})
it('takes the dead-cell path when a stamped cell stops heartbeating', async () => {
// Why: the fence is the only proof that a cell we cannot reach has stopped
// serving the sockets it still holds. A stamp does not make it reachable.
const { store, heartbeat, isolateForRoll, setNow } = await setup()
const first = await store.assign(IDENTITY, 'us-central1')
await isolateForRoll(first.cellId)
const stale = START_MS + HEARTBEAT_TTL_MS + 1_000
setNow(stale)
for (const cell of CELLS) {
if (cell.id !== first.cellId) await heartbeat(cell, stale)
}
await expect(store.assign(IDENTITY, 'us-central1')).rejects.toBeInstanceOf(
RelayHomeCellUnavailableError
)
})
it('leaves the source cell activity leases in place', async () => {
// Contrast with the fence and stranded paths, which delete them: an isolated
// cell is alive and still owns drainable work behind those leases.
const { store, database, isolateForRoll } = await setup()
const first = await store.assign(IDENTITY, 'us-central1')
await database.query(
`INSERT INTO relay_assignment_activity_leases
(user_id, relay_host_id, activity_id, activity_kind, cell_id,
request_units, expires_at, updated_at)
VALUES (?, ?, 'splice:keep-1', 'splice', ?, 1, ?, ?)`,
[IDENTITY.userId, IDENTITY.relayHostId, first.cellId, START_MS + 600_000, START_MS]
)
await isolateForRoll(first.cellId)
await store.assign(IDENTITY, 'us-central1')
expect(
await database.query(
`SELECT activity_id FROM relay_assignment_activity_leases
WHERE user_id = ? AND relay_host_id = ? AND activity_id = 'splice:keep-1'`,
[IDENTITY.userId, IDENTITY.relayHostId]
)
).toHaveLength(1)
})
it('emits nothing when the placement rolls back after the decision', async () => {
// Log only committed moves; stdout cannot roll back with a failed lease/reservation transaction.
const warn = vi.spyOn(console, 'warn').mockImplementation(() => {})
@@ -682,169 +249,4 @@ describe('re-placing a host off a cell isolated for a roll', () => {
expect(moved.cellId).not.toBe(first.cellId)
expect(jsonEvents(warn, 'orca_relay_sticky_replaced_off_isolated_cell')).toHaveLength(1)
})
describe('a host whose leases span two cells after the move', () => {
const NEIGHBOUR = { userId: 'user-b', relayHostId: 'host000000000002' }
async function reserved(database: RelayDatabase, cellId: string): Promise<number> {
const rows = await database.query(
`SELECT reserved_requests FROM relay_cells WHERE cell_id = ?`,
[cellId]
)
return Number(rows[0]!['reserved_requests'])
}
async function expectAccounting(database: RelayDatabase): Promise<void> {
for (const cell of CELLS) {
const leased = await database.query(
`SELECT COALESCE(SUM(request_units), 0) AS units
FROM relay_assignment_activity_leases WHERE cell_id = ?`,
[cell.id]
)
expect({ cell: cell.id, reserved: await reserved(database, cell.id) }).toEqual({
cell: cell.id,
reserved: Number(leased[0]!['units'])
})
}
}
async function counters(database: RelayDatabase): Promise<number[]> {
const rows = await database.query(
`SELECT reserved_controls, reserved_splices FROM relay_assignments
WHERE user_id = ? AND relay_host_id = ?`,
[IDENTITY.userId, IDENTITY.relayHostId]
)
return [Number(rows[0]!['reserved_controls']), Number(rows[0]!['reserved_splices'])]
}
// us-c1 is isolated with the host's control and splice on it; the host
// moves to us-c2, where a neighbour's splice outlives every other lease.
async function movedHost(): Promise<Harness> {
const harness = await setup()
const { store, isolateForRoll } = harness
const first = await store.assign(IDENTITY, 'us-central1')
expect(first.cellId).toBe('us-c1')
await store.activateControl(IDENTITY, {
cellId: 'us-c1',
assignmentEpoch: first.assignmentEpoch,
generation: 1
})
await store.acquireActivity(IDENTITY, {
activityId: 'splice:keep-1',
kind: 'splice',
cellId: 'us-c1'
})
await isolateForRoll('us-c1')
expect((await store.assign(NEIGHBOUR, 'us-central1')).cellId).toBe('us-c2')
await store.acquireActivity(NEIGHBOUR, {
activityId: 'splice:neighbour',
kind: 'splice',
cellId: 'us-c2',
expiresAt: START_MS + 10 * 60 * 60_000
})
expect((await store.assign(IDENTITY, 'us-central1')).cellId).toBe('us-c2')
expect(await counters(harness.database)).toEqual([2, 1])
await expectAccounting(harness.database)
return harness
}
it('is left to the lease sweep by aggregate expiry', async () => {
const { store, database, setNow } = await movedHost()
setNow(START_MS + 60 * 60_000)
await store.releaseExpiredActivity()
expect(await counters(database)).toEqual([2, 1])
await expectAccounting(database)
await store.releaseExpiredActivityLeases()
await store.releaseExpiredActivity()
expect(await counters(database)).toEqual([0, 0])
expect(await reserved(database, 'us-c1')).toBe(0)
expect(await reserved(database, 'us-c2')).toBe(2)
await expectAccounting(database)
})
it('frees the source leases on their own cell when the target dies', async () => {
const { store, database, setNow, heartbeat, restore } = await movedHost()
await restore('us-c1')
// Uncapped, so the dead-cell path needs no fence to move off it.
await database.query(`DELETE FROM relay_cell_connection_limits WHERE cell_id = 'us-c2'`)
setNow(START_MS + HEARTBEAT_TTL_MS + 5_000)
await heartbeat(CELLS[0]!)
await heartbeat(CELLS[2]!)
expect((await store.assign(IDENTITY, 'us-central1')).cellId).toBe('us-c1')
expect(await counters(database)).toEqual([1, 0])
expect(await store.releaseActivity(IDENTITY, 'control:us-c1:1')).toBe(false)
expect(await reserved(database, 'us-c1')).toBe(1)
expect(await reserved(database, 'us-c2')).toBe(3)
await expectAccounting(database)
})
})
it('retries a busy isolated attempt in its own tier, never under the all-rows lock', async () => {
const { store, counter, isolateForRoll } = await setup()
const first = await store.assign(IDENTITY, 'us-central1')
await isolateForRoll(first.cellId)
counter.sql.length = 0
// The first attempt finds a target row busy, then its retry finds the host's
// lease rows busy after it has already taken the tier's rows.
counter.lockUnavailableSequence = [
'SELECT * FROM relay_cells WHERE cell_id IN (',
'FROM relay_assignment_activity_leases'
]
const moved = await store.assign(IDENTITY, 'us-central1')
expect(counter.lockUnavailableSequence).toEqual([])
expect(moved).toMatchObject({
region: 'us-central1',
assignmentEpoch: first.assignmentEpoch + 1
})
expect(counter.count('SELECT * FROM relay_cells ORDER BY cell_id ASC')).toBe(0)
})
})
describe('classifying a reconnect whose home is isolated for a roll', () => {
const classify = { classifyHomeRollIsolation: true }
it('reads the classification in the verification query itself', async () => {
const { store, counter, isolateForRoll } = await setup()
const first = await store.assign(IDENTITY, 'us-central1')
await isolateForRoll(first.cellId)
counter.sql.length = 0
await store.resolve(IDENTITY, classify)
expect(counter.sql.filter((sql) => sql.includes('FROM relay_assignments'))).toHaveLength(1)
expect(counter.count('relay_cell_admission')).toBe(1)
})
it('still treats a host its draining cell already released as a drain return', async () => {
// A drain releases the host's control lease before it tells the host, so the redial
// finds no activity: the stamp, not a live lease, has to carry the classification.
const warn = vi.spyOn(console, 'warn').mockImplementation(() => {})
const { store, database, isolateForRoll } = await setup()
const first = await store.assign(IDENTITY, 'us-central1')
await store.activateControl(IDENTITY, {
cellId: first.cellId,
assignmentEpoch: first.assignmentEpoch,
generation: 1
})
await isolateForRoll(first.cellId)
expect(await store.releaseActivity(IDENTITY, `control:${first.cellId}:1`)).toBe(true)
expect(
await database.query(
`SELECT activity_id FROM relay_assignment_activity_leases WHERE user_id = ?`,
[IDENTITY.userId]
)
).toEqual([])
expect(await store.resolve(IDENTITY, classify)).toMatchObject({
cellId: first.cellId,
homeCellRollIsolated: true
})
warn.mockClear()
const moved = await store.assign(IDENTITY, 'us-central1')
expect(moved.cellId).not.toBe(first.cellId)
expect(moved.assignmentEpoch).toBe(first.assignmentEpoch + 1)
expect(jsonEvents(warn, 'orca_relay_sticky_replaced_off_isolated_cell')).toMatchObject([
{ fromCellId: first.cellId, toCellId: moved.cellId }
])
})
})
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -19,7 +19,9 @@ export const MAIN_BUILD_ENTRY_POINTS: Record<string, string> = {
),
'stt-worker': resolve('src/main/speech/stt-worker.ts'),
'warp-theme-parser-worker': resolve('src/main/warp-themes/warp-theme-parser-worker.ts'),
'session-search-worker-entry': resolve('src/main/ai-vault-search/session-search-worker-entry.ts'),
'session-search-worker-entry': resolve(
'src/main/ai-vault-search/worker/session-search-worker-entry.ts'
),
'foreign-sqlite-reader-entry': resolve(
'src/main/foreign-sqlite-readers/foreign-sqlite-reader-entry.ts'
),
@@ -39,7 +41,7 @@ export const MAIN_BUILD_ENTRY_POINTS: Record<string, string> = {
'src/main/worker-thread-child-process/worker-thread-child-process-entry.ts'
),
// Usage scans synchronously walk histories/SQLite; keep them off the main loop.
'usage-scan-worker-entry': resolve('src/main/usage/usage-scan-worker-entry.ts'),
'usage-scan-worker-entry': resolve('src/main/usage/scan-worker/usage-scan-worker-entry.ts'),
'workspace-space-scan-worker-entry': resolve(
'src/main/workspaces/space-analysis/workspace-space-scan-worker-entry.ts'
),
+4 -9
View File
@@ -291,7 +291,6 @@
1 test-no-real-time-wait:tests/e2e/codex-ctrl-c-status.spec.ts
4 test-no-real-time-wait:tests/e2e/combined-diff-scroll-restore.spec.ts
1 test-no-real-time-wait:tests/e2e/computer-windows.e2e.ts
1 test-no-real-time-wait:tests/e2e/cross-version-wire/cross-version-agent-session-wire.unit.test.ts
3 test-no-real-time-wait:tests/e2e/cross-version-wire/host-model-catalog-released-phone.unit.test.ts
1 test-no-real-time-wait:tests/e2e/cross-version-wire/legacy-relay-bridge.unit.test.ts
1 test-no-real-time-wait:tests/e2e/cross-version-wire/released-relay-daemon.ts
@@ -453,9 +452,8 @@
4 test-no-wall-clock:src/main/agent-hooks/server/testing/identity/server-launch-resume-identity.test.ts
5 test-no-wall-clock:src/main/agent-hooks/server/testing/replay/spool.test.ts
2 test-no-wall-clock:src/main/agent-hooks/installation/commands/windows-native-hook-exe-hosts.test.ts
2 test-no-wall-clock:src/main/ai-vault-search/session-search-indexer.test.ts
1 test-no-wall-clock:src/main/ai-vault-search/indexing/session-search-indexer.test.ts
1 test-no-wall-clock:src/main/ai-vault/parse-cache/session-parse-cache-preview-upgrade.test.ts
1 test-no-wall-clock:src/main/ai-vault/scanners/copilot/session-scanner-copilot-cache-upgrade.test.ts
2 test-no-wall-clock:src/main/ai-vault/scanners/copilot/session-scanner-copilot-parser.test.ts
2 test-no-wall-clock:src/main/ai-vault/scanners/cursor/session-scanner-cursor-chat-meta.test.ts
1 test-no-wall-clock:src/main/ai-vault/scanners/devin/session-scanner-devin-db.test.ts
@@ -507,7 +505,6 @@
3 test-no-wall-clock:src/main/github/pr-refresh-coordinator-active-visible-priority.test.ts
8 test-no-wall-clock:src/main/github/pr-refresh-coordinator-alias-coalescing.test.ts
5 test-no-wall-clock:src/main/github/pr-refresh-coordinator-completion-order.test.ts
1 test-no-wall-clock:src/main/github/pr-refresh-coordinator-error-cadence.test.ts
3 test-no-wall-clock:src/main/github/pr-refresh-coordinator-foreground-pacing.test.ts
3 test-no-wall-clock:src/main/github/pr-refresh-coordinator-refresh-events.test.ts
4 test-no-wall-clock:src/main/github/pr-refresh-coordinator-visibility-policy.test.ts
@@ -526,8 +523,8 @@
1 test-no-wall-clock:src/main/observability/bundle.test.ts
1 test-no-wall-clock:src/main/opencode/opencode-launch-model-context-supervision.test.ts
1 test-no-wall-clock:src/main/opencode/overlay-dir-gc.test.ts
2 test-no-wall-clock:src/main/orca-profiles/profile-cloud-service-connect-overlap.test.ts
2 test-no-wall-clock:src/main/orca-profiles/profile-cloud-service-sign-out-connect-race.test.ts
2 test-no-wall-clock:src/main/orca-profiles/cloud-auth/profile-cloud-service-connect-overlap.test.ts
2 test-no-wall-clock:src/main/orca-profiles/cloud-auth/profile-cloud-service-sign-out-connect-race.test.ts
2 test-no-wall-clock:src/main/orcad/orcad-artifact-cache-retention.test.ts
1 test-no-wall-clock:src/main/orcad/orcad-artifact-materializer.test.ts
6 test-no-wall-clock:src/main/orcad/orcad-serve-parity.integration.test.ts
@@ -614,7 +611,6 @@
3 test-no-wall-clock:src/main/windows/windows-msys-job.win32.test.ts
1 test-no-wall-clock:src/main/windows/windows-process-table-native-addon.win32.test.ts
2 test-no-wall-clock:src/main/windows/windows-pty-job.win32.test.ts
2 test-no-wall-clock:src/main/workspace-hooks/hook-archive-timeout-observation.test.ts
2 test-no-wall-clock:src/main/workspaces/removal/local-worktree-removal-recovery-live.test.ts
1 test-no-wall-clock:src/main/workspaces/removal/worktree-removal-close-records.test.ts
2 test-no-wall-clock:src/main/wsl/execution/wsl-runner.wsl.test.ts
@@ -627,7 +623,6 @@
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
2 test-no-wall-clock:src/renderer/src/components/task-page/jira/task-page-jira-cache-selectors.test.ts
2 test-no-wall-clock:src/renderer/src/components/terminal-pane/pty-connection/emulation/fish-color-scheme-child-stdin.node-pty.test.ts
2 test-no-wall-clock:src/renderer/src/components/terminal-pane/snapshots/remote-snapshot-alt-screen-host-chain.test.ts
1 test-no-wall-clock:src/renderer/src/components/terminal/initial-terminal-structured-launch.test.tsx
@@ -750,7 +745,7 @@
1 test-timeout-needs-reason:src/main/windows/windows-msys-job.win32.test.ts
2 test-timeout-needs-reason:src/main/windows/windows-pty-job.win32.test.ts
5 test-timeout-needs-reason:src/main/worker-thread-child-process/worker-thread-child-process.test.ts
2 test-timeout-needs-reason:src/main/workspace-hooks/hook-archive-timeout-observation.test.ts
1 test-timeout-needs-reason:src/main/workspace-hooks/hook-archive-timeout-observation.test.ts
2 test-timeout-needs-reason:src/main/workspace-hooks/hook-termination-real-process.test.ts
2 test-timeout-needs-reason:src/main/workspaces/removal/local-worktree-filesystem-wsl-banner.wsl.test.ts
4 test-timeout-needs-reason:src/main/wsl/execution/wsl-runner.wsl.test.ts
+1 -1
View File
@@ -41,7 +41,7 @@
"src/main/plugins/testing/plugin-test-register.ts",
"src/main/ai-vault/scan-service/session-scanner-service-entry.ts",
"src/main/native-chat/wsl-transcript-fs-process-entry.ts",
"src/main/usage/usage-scan-worker-entry.ts",
"src/main/usage/scan-worker/usage-scan-worker-entry.ts",
"src/main/workspaces/space-analysis/workspace-space-scan-worker-entry.ts",
"src/main/claude-accounts/claude-profile-setup-worker-entry.ts",
"src/main/persistence/profile-state/profile-state-backup-worker-entry.ts",
@@ -2,7 +2,6 @@
# The relay retirement (2027-01-15) deletes the folder and edits exactly these files.
# Prune: pnpm check:legacy-relay-fence-ratchet --prune
src/main/ipc/runtime-environments/orcad-delta-move-handlers.ts
src/main/ipc/pty/runtime/kill-legacy-relay-bridged.test.ts
src/main/ipc/pty/runtime/kill.ts
src/main/ipc/ssh/ssh-connect-decision-cancellation.test.ts
src/main/ipc/ssh/ssh-connect-flow.ts
+6 -6
View File
@@ -11,12 +11,12 @@
1 src/main/ipc/runtime-environments/runtime-environment-removal-cleanup.ts
1 src/main/ipc/runtime-environments/runtime-environment-session-reconcile.ts
2 src/main/ipc/session.ts
6 src/main/orca-profiles/profile-project-session-state.ts
4 src/main/orca-profiles/profile-project-source-removal.ts
2 src/main/orca-profiles/profile-project-state-file.ts
4 src/main/orca-profiles/profile-project-transfer-payload.ts
2 src/main/orca-profiles/profile-project-transfer.ts
9 src/main/orca-profiles/profile-session-owner-transfer.ts
6 src/main/orca-profiles/project-transfer/profile-project-session-state.ts
4 src/main/orca-profiles/project-transfer/profile-project-source-removal.ts
2 src/main/orca-profiles/project-transfer/profile-project-state-file.ts
4 src/main/orca-profiles/project-transfer/profile-project-transfer-payload.ts
2 src/main/orca-profiles/project-transfer/profile-project-transfer.ts
9 src/main/orca-profiles/project-transfer/profile-session-owner-transfer.ts
3 src/main/persistence/leasing-ssh-ptys/ssh-pty-binding-cleanup.ts
1 src/main/persistence/loading-store/loaded-state-parsing.ts
1 src/main/persistence/loading-store/metadata-lineage-operations.ts
+14 -14
View File
@@ -14,7 +14,7 @@
14 src/main/agent-launch/trust/agent-trust-presets.ts
2 src/main/agent-launch/trust/antigravity-workspace-trust-ownership.ts
1 src/main/agent-launch/trust/execution-host-workspace-trust.ts
1 src/main/ai-vault-search/session-search-worker-client.ts
1 src/main/ai-vault-search/worker/session-search-worker-client.ts
4 src/main/ai-vault/parse-cache/session-parse-cache-legacy-json.ts
2 src/main/ai-vault/scan-service/session-scanner-service-entry-path.ts
1 src/main/ai-vault/scan-service/session-scanner-service-spawn.ts
@@ -329,16 +329,16 @@
1 src/main/opencode/opencode-plugin-config-writer.ts
1 src/main/opencode/opencode-private-server.ts
1 src/main/opencode/opencode-wsl-text-task.ts
2 src/main/orca-profiles/new-profile-state.ts
3 src/main/orca-profiles/other-profile-workspace-catalog.ts
3 src/main/orca-profiles/profile-artifact-cloud-cleanup.ts
1 src/main/orca-profiles/profile-cloud-index.ts
4 src/main/orca-profiles/profile-cloud-session-store.ts
2 src/main/orca-profiles/storage/new-profile-state.ts
3 src/main/orca-profiles/catalog/other-profile-workspace-catalog.ts
3 src/main/orca-profiles/cloud-auth/profile-artifact-cloud-cleanup.ts
1 src/main/orca-profiles/cloud-auth/profile-cloud-index.ts
4 src/main/orca-profiles/cloud-session/profile-cloud-session-store.ts
12 src/main/orca-profiles/profile-index-store.ts
5 src/main/orca-profiles/profile-legacy-state-import.ts
4 src/main/orca-profiles/profile-project-move-intent.ts
3 src/main/orca-profiles/profile-project-move-record.ts
4 src/main/orca-profiles/profile-project-state-file.ts
5 src/main/orca-profiles/storage/profile-legacy-state-import.ts
4 src/main/orca-profiles/project-transfer/profile-project-move-intent.ts
3 src/main/orca-profiles/project-transfer/profile-project-move-record.ts
4 src/main/orca-profiles/project-transfer/profile-project-state-file.ts
2 src/main/orcad/launcher.ts
7 src/main/orcad/node-pty-prebuilt-slot.ts
2 src/main/orcad/node-pty-precondition.ts
@@ -493,9 +493,9 @@
1 src/main/runtime/workspaces/persisted-surfaces/crew-operations.ts
1 src/main/server/serve-pairing-output.ts
2 src/main/speech/model-cache-path.ts
9 src/main/speech/model-manager.ts
7 src/main/speech/model-manager.ts
10 src/main/speech/openai-api-key-store.ts
2 src/main/speech/speech-model-download-cleanup.ts
1 src/main/speech/speech-model-download-cleanup.ts
1 src/main/speech/speech-model-download-transport.ts
1 src/main/speech/speech-model-files.ts
2 src/main/speech/speech-model-http-download.ts
@@ -539,8 +539,8 @@
1 src/main/updater/linux-package/linux-package-install-command.ts
1 src/main/updater/linux-package/linux-update-package-type.ts
6 src/main/updater/serve-update-handoff.ts
2 src/main/usage/usage-provider-store-lifecycle.ts
1 src/main/usage/usage-scan-worker-spawn.ts
2 src/main/usage/provider-lifecycle/usage-provider-store-lifecycle.ts
1 src/main/usage/scan-worker/usage-scan-worker-spawn.ts
1 src/main/warp-themes/discovery.ts
1 src/main/window/desktop-integration/custom-app-icon.ts
3 src/main/window/desktop-integration/macos-press-and-hold-default.ts
+5 -5
View File
@@ -99,11 +99,11 @@
1 src/renderer/src/components/editor/combined-diff/resolve-changes/use-combined-diff-section-row-keys.ts
1 src/renderer/src/components/editor/combined-diff/review-controls/use-combined-diff-notes-actions.ts
1 src/renderer/src/components/editor/combined-diff/scroll-viewport/use-combined-diff-virtualizer.ts
1 src/renderer/src/components/editor/csv/CsvGrid.tsx
1 src/renderer/src/components/editor/csv/grid/CsvGrid.tsx
1 src/renderer/src/components/editor/csv/CsvViewer.tsx
1 src/renderer/src/components/editor/csv/useCsvClipboard.ts
1 src/renderer/src/components/editor/csv/useCsvPagedPreview.ts
3 src/renderer/src/components/editor/csv/useCsvTableEditor.ts
1 src/renderer/src/components/editor/csv/editing/clipboard/useCsvClipboard.ts
1 src/renderer/src/components/editor/csv/preview/useCsvPagedPreview.ts
3 src/renderer/src/components/editor/csv/editing/useCsvTableEditor.ts
1 src/renderer/src/components/editor/diff/large-files/useDiffViewerLargeDiffLifecycle.ts
3 src/renderer/src/components/editor/diff/monaco-view/DiffViewer.tsx
1 src/renderer/src/components/editor/diff/review/DiffNotesSendMenu.tsx
@@ -145,7 +145,7 @@
3 src/renderer/src/components/editor/useEditorPanelFileContentLoader.ts
4 src/renderer/src/components/editor/useLocalLogTail.ts
1 src/renderer/src/components/editor/usePreserveSectionDuringExternalEdit.ts
7 src/renderer/src/components/emulator-pane/emulator-screen-stream-content.tsx
1 src/renderer/src/components/emulator-pane/emulator-screen-stream-content.tsx
3 src/renderer/src/components/emulator-pane/use-emulator-pane-session.ts
1 src/renderer/src/components/emulator-pane/use-emulator-pane-shutdown.ts
1 src/renderer/src/components/emulator-pane/use-emulator-video-stream.ts
File diff suppressed because one or more lines are too long
+2 -2
View File
@@ -23,8 +23,8 @@
1 src/main/ipc/worktrees/removal/register-worktree-removal-handlers.ts
1 src/main/ipc/worktrees/removal/registered-worktree-root-owner.ts
1 src/main/ipc/worktrees/repo-host-ownership.ts
2 src/main/orca-profiles/profile-project-transfer-payload.ts
1 src/main/orca-profiles/profile-project-worktree-identity.ts
2 src/main/orca-profiles/project-transfer/profile-project-transfer-payload.ts
1 src/main/orca-profiles/project-transfer/profile-project-worktree-identity.ts
1 src/main/persistence/leasing-ssh-ptys/ssh-target-reassignment.ts
1 src/main/persistence/migrating-orcad-catalog/orcad-source-ownership.ts
2 src/main/persistence/restoring-sessions/folder-scope-migration.ts
+60 -186
View File
@@ -617,50 +617,42 @@
"src/main/agent-launch/trust/agent-trust-presets.test.ts": 377,
"src/main/agent-launch/trust/agent-workspace-trust.test.ts": 177,
"src/main/ai-vault-search/session-search-agent-compatibility.test.ts": 192,
"src/main/ai-vault-search/session-search-anonymous-write-memory.test.ts": 1570,
"src/main/ai-vault-search/session-search-content-hash.test.ts": 61,
"src/main/ai-vault-search/session-search-deleted-sources.test.ts": 675,
"src/main/ai-vault-search/session-search-dependent-transcripts.test.ts": 489,
"src/main/ai-vault-search/session-search-directory-listings.test.ts": 50,
"src/main/ai-vault-search/session-search-engine.test.ts": 2083,
"src/main/ai-vault-search/session-search-file-id.test.ts": 277,
"src/main/ai-vault-search/session-search-file-write.test.ts": 696,
"src/main/ai-vault-search/session-search-fts5-contract.test.ts": 183,
"src/main/ai-vault-search/session-search-hit-ranking.test.ts": 58,
"src/main/ai-vault-search/discovery/session-search-deleted-sources.test.ts": 675,
"src/main/ai-vault-search/indexing/session-search-dependent-transcripts.test.ts": 489,
"src/main/ai-vault-search/discovery/session-search-directory-listings.test.ts": 50,
"src/main/ai-vault-search/query/session-search-engine.test.ts": 2083,
"src/main/ai-vault-search/storage/session-search-file-write.test.ts": 696,
"src/main/ai-vault-search/query/session-search-hit-ranking.test.ts": 58,
"src/main/ai-vault-search/session-search-host-registration.test.ts": 1140,
"src/main/ai-vault-search/session-search-index-consumer.test.ts": 316,
"src/main/ai-vault-search/session-search-index-generation.test.ts": 471,
"src/main/ai-vault-search/session-search-index-writer.test.ts": 473,
"src/main/ai-vault-search/session-search-indexer.test.ts": 3307,
"src/main/ai-vault-search/storage/session-search-index-generation.test.ts": 471,
"src/main/ai-vault-search/storage/session-search-index-writer.test.ts": 473,
"src/main/ai-vault-search/indexing/session-search-indexer.test.ts": 3307,
"src/main/ai-vault-search/session-search-instance.test.ts": 1045,
"src/main/ai-vault-search/session-search-lifecycle-matrix.test.ts": 4969,
"src/main/ai-vault-search/session-search-list-reparse.test.ts": 330,
"src/main/ai-vault-search/session-search-live-transcript.test.ts": 434,
"src/main/ai-vault-search/session-search-merged-roots.test.ts": 529,
"src/main/ai-vault-search/session-search-message-rows.test.ts": 218,
"src/main/ai-vault-search/indexing/session-search-list-reparse.test.ts": 330,
"src/main/ai-vault-search/indexing/session-search-live-transcript.test.ts": 434,
"src/main/ai-vault-search/indexing/session-search-merged-roots.test.ts": 529,
"src/main/ai-vault-search/storage/session-search-message-rows.test.ts": 218,
"src/main/ai-vault-search/session-search-native-chat-indexing.test.ts": 540,
"src/main/ai-vault-search/session-search-opencode-index.test.ts": 1158,
"src/main/ai-vault-search/session-search-orphan-rows.test.ts": 324,
"src/main/ai-vault-search/session-search-paging.test.ts": 863,
"src/main/ai-vault-search/session-search-query-planner.test.ts": 65,
"src/main/ai-vault-search/session-search-read-decision.test.ts": 46,
"src/main/ai-vault-search/session-search-restart-reindex.test.ts": 915,
"src/main/ai-vault-search/session-search-retention-delete.test.ts": 224,
"src/main/ai-vault-search/session-search-root-refresh.test.ts": 573,
"src/main/ai-vault-search/session-search-row-filter.test.ts": 274,
"src/main/ai-vault-search/session-search-row-identity.test.ts": 134,
"src/main/ai-vault-search/session-search-scan-roots.test.ts": 235,
"src/main/ai-vault-search/session-search-schema.test.ts": 876,
"src/main/ai-vault-search/session-search-scope-resolution.test.ts": 117,
"src/main/ai-vault-search/indexing/session-search-opencode-index.test.ts": 1158,
"src/main/ai-vault-search/query/session-search-paging.test.ts": 863,
"src/main/ai-vault-search/query/session-search-query-planner.test.ts": 65,
"src/main/ai-vault-search/indexing/session-search-read-decision.test.ts": 46,
"src/main/ai-vault-search/storage/session-search-retention-delete.test.ts": 224,
"src/main/ai-vault-search/indexing/session-search-root-refresh.test.ts": 573,
"src/main/ai-vault-search/query/session-search-row-filter.test.ts": 274,
"src/main/ai-vault-search/storage/session-search-row-identity.test.ts": 134,
"src/main/ai-vault-search/discovery/session-search-scan-roots.test.ts": 235,
"src/main/ai-vault-search/storage/session-search-schema.test.ts": 876,
"src/main/ai-vault-search/scope/session-search-scope-resolution.test.ts": 117,
"src/main/ai-vault-search/session-search-service-registry.test.ts": 193,
"src/main/ai-vault-search/session-search-service.test.ts": 379,
"src/main/ai-vault-search/session-search-snippet-marks.test.ts": 230,
"src/main/ai-vault-search/session-search-store-scope-catalog.test.ts": 268,
"src/main/ai-vault-search/query/session-search-snippet-marks.test.ts": 230,
"src/main/ai-vault-search/scope/session-search-store-scope-catalog.test.ts": 268,
"src/main/ai-vault-search/session-search-synthetic-corpus.test.ts": 372,
"src/main/ai-vault-search/session-search-typo-policy.test.ts": 158,
"src/main/ai-vault-search/session-search-typo-scope.test.ts": 195,
"src/main/ai-vault-search/session-search-write-buffer.test.ts": 197,
"src/main/ai-vault-search/session-search-write-lifetime.test.ts": 318,
"src/main/ai-vault-search/query/session-search-typo-policy.test.ts": 158,
"src/main/ai-vault-search/query/session-search-typo-scope.test.ts": 195,
"src/main/ai-vault-search/storage/session-search-write-buffer.test.ts": 197,
"src/main/ai-vault-search/storage/session-search-write-lifetime.test.ts": 318,
"src/main/ai-vault/ai-vault-scan-cancellation.test.ts": 45,
"src/main/ai-vault/ai-vault-scan-coordinator.test.ts": 55,
"src/main/ai-vault/ai-vault-scan-progress-flow.test.ts": 835,
@@ -708,7 +700,6 @@
"src/main/ai-vault/scanners/codex/session-scanner-codex-tool-records.test.ts": 177,
"src/main/ai-vault/scanners/codex/session-scanner-codex-workers.test.ts": 543,
"src/main/ai-vault/session-scanner-conversation-name-requests.test.ts": 443,
"src/main/ai-vault/scanners/copilot/session-scanner-copilot-cache-upgrade.test.ts": 391,
"src/main/ai-vault/scanners/copilot/session-scanner-copilot-parser.test.ts": 173,
"src/main/ai-vault/session-scanner-core-parser-wsl-stall.test.ts": 344,
"src/main/ai-vault/scanners/cursor/session-scanner-cursor-chat-meta.test.ts": 745,
@@ -769,7 +760,6 @@
"src/main/ai-vault/scan-service/session-scanner-service-restart-policy.test.ts": 44,
"src/main/ai-vault/scan-service/session-scanner-service-root-request.test.ts": 44,
"src/main/ai-vault/scan-service/session-scanner-service-root-response.test.ts": 251,
"src/main/ai-vault/scan-service/session-scanner-service-search-roots.test.ts": 825,
"src/main/ai-vault/scan-service/session-scanner-service-search.test.ts": 1741,
"src/main/ai-vault/scan-service/session-scanner-service-spawn.test.ts": 312,
"src/main/ai-vault/session-scanner-timeline.test.ts": 160,
@@ -831,10 +821,8 @@
"src/main/automations/automation-zero-grace-tick-latency.test.ts": 2108,
"src/main/automations/dispatch-refusal-wsl-move.test.ts": 577,
"src/main/automations/external-automation-manager-cache.test.ts": 70,
"src/main/automations/external-automation-owner-guard.test.ts": 332,
"src/main/automations/external-automation-probe-scheduler.test.ts": 97,
"src/main/automations/external-manager-scoped.test.ts": 391,
"src/main/automations/external-manager.test.ts": 388,
"src/main/automations/run-terminal-retention.test.ts": 112,
"src/main/automations/automation-workspace-create.test.ts": 50,
"src/main/automations/hook-review-blocked-run-terminals.test.ts": 4564,
@@ -844,7 +832,6 @@
"src/main/automations/run-target-resolution.test.ts": 367,
"src/main/automations/runtime-chat-run-observer.test.ts": 6812,
"src/main/automations/runtime-terminal-run-observer-evidence.test.ts": 230,
"src/main/automations/runtime-terminal-run-observer.test.ts": 4026,
"src/main/automations/service-precheck.test.ts": 2057,
"src/main/automations/service.test.ts": 2970,
"src/main/bitbucket/credential-connection.test.ts": 156,
@@ -982,7 +969,6 @@
"src/main/browser/cookies/browser-cookie-import-partition.electron.test.ts": 2260,
"src/main/browser/cookies/browser-cookie-import-snapshot-ownership.test.ts": 1178,
"src/main/browser/cookies/browser-cookie-import-validated-partition.electron.test.ts": 2445,
"src/main/browser/cookies/browser-cookie-import-write.test.ts": 68,
"src/main/browser/cookies/browser-cookie-import.comet.test.ts": 1501,
"src/main/browser/cookies/browser-cookie-import.test.ts": 1304,
"src/main/browser/cookies/browser-cookie-samesite.electron.test.ts": 1882,
@@ -1063,7 +1049,6 @@
"src/main/browser/cdp/input/guest-focused-frame-route.test.ts": 78,
"src/main/browser/routing/local-host-partitions/local-ssh-browser-partition-identity.test.ts": 479,
"src/main/browser/routing/local-host-partitions/local-ssh-browser-profile-retirement.test.ts": 287,
"src/main/browser/routing/local-host-partitions/local-ssh-browser-route-target.test.ts": 65,
"src/main/browser/routing/local-host-partitions/local-ssh-browser-route.test.ts": 92,
"src/main/browser/backends/offscreen-browser-backend-lifecycle.test.ts": 341,
"src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-composition.test.ts": 165,
@@ -1107,7 +1092,6 @@
"src/main/claude-usage/claude-model-pricing.test.ts": 74,
"src/main/claude-usage/claude-usage-report-aggregation.test.ts": 57,
"src/main/claude-usage/persisted-source-authority.test.ts": 491,
"src/main/claude-usage/persisted-token-columns-store.test.ts": 376,
"src/main/claude-usage/scanner-incremental-append.test.ts": 235,
"src/main/claude-usage/scanner-incremental-ownership.test.ts": 545,
"src/main/claude-usage/scanner-incremental-reader.test.ts": 819,
@@ -1115,9 +1099,6 @@
"src/main/claude-usage/scanner-scan.test.ts": 295,
"src/main/claude-usage/scanner.test.ts": 80,
"src/main/claude-usage/source-cache-compression.test.ts": 74,
"src/main/claude-usage/store-checkpoint-persistence.test.ts": 545,
"src/main/claude-usage/store-source-authority.test.ts": 530,
"src/main/claude-usage/store.test.ts": 377,
"src/main/claude-usage/transcript-file-discovery-errors.test.ts": 62,
"src/main/claude-usage/transcript-reader-lifetime.test.ts": 100,
"src/main/claude-usage/transcript-tuple-append.test.ts": 435,
@@ -1172,7 +1153,6 @@
"src/main/claude/claude-stop-ack-race.test.ts": 1301,
"src/main/claude/claude-stream-json-connection-close.test.ts": 621,
"src/main/claude/claude-stream-json-connection.test.ts": 8687,
"src/main/claude/claude-stream-json-exit-error.test.ts": 170,
"src/main/claude/claude-streamed-text-checkpoints.test.ts": 59,
"src/main/claude/claude-structured-launch-home-perf.test.ts": 401,
"src/main/claude/claude-structured-result-control-overlap.test.ts": 1136,
@@ -1329,8 +1309,6 @@
"src/main/codex-usage/scanner-paths.test.ts": 493,
"src/main/codex-usage/scanner.test.ts": 247,
"src/main/codex-usage/session-file-discovery-errors.test.ts": 70,
"src/main/codex-usage/store-automation-usage.test.ts": 305,
"src/main/codex-usage/store-persistence.test.ts": 364,
"src/main/codex/app-server/codex-app-server-client.test.ts": 13839,
"src/main/codex/app-server/codex-app-server-connection-exit-order.test.ts": 264,
"src/main/codex/app-server/codex-app-server-connection-tree-unproven.test.ts": 634,
@@ -1916,7 +1894,6 @@
"src/main/git/source-control/status-read-failure-real-git.test.ts": 307,
"src/main/git/source-control/status-shared-symlinks.test.ts": 746,
"src/main/git/source-control/status-submodule.test.ts": 306,
"src/main/git/source-control/status-symlink-probe-budget.test.ts": 238,
"src/main/git/source-control/status-upstream-ref.test.ts": 52,
"src/main/git/source-control/upstream-deferred-fork-remote-real.test.ts": 319,
"src/main/git/source-control/upstream.test.ts": 406,
@@ -2014,7 +1991,6 @@
"src/main/github/pr-refresh-coordinator-active-visible-priority.test.ts": 643,
"src/main/github/pr-refresh-coordinator-alias-coalescing.test.ts": 1020,
"src/main/github/pr-refresh-coordinator-completion-order.test.ts": 914,
"src/main/github/pr-refresh-coordinator-error-cadence.test.ts": 951,
"src/main/github/pr-refresh-coordinator-foreground-pacing.test.ts": 650,
"src/main/github/pr-refresh-coordinator-refresh-events.test.ts": 617,
"src/main/github/pr-refresh-coordinator-visibility-policy.test.ts": 1371,
@@ -2157,7 +2133,6 @@
"src/main/ipc/filesystem/filesystem-search-file-paths.test.ts": 443,
"src/main/ipc/filesystem/filesystem-symlink-directory-entries.test.ts": 56,
"src/main/ipc/filesystem/filesystem-write-bytes.test.ts": 147,
"src/main/ipc/filesystem/filesystem-write-identical.test.ts": 138,
"src/main/ipc/filesystem/filesystem-wsl-stopped-distro-git.test.ts": 1163,
"src/main/ipc/filesystem/filesystem-wsl-stopped-distro-reads.test.ts": 1284,
"src/main/ipc/filesystem/filesystem.test.ts": 2043,
@@ -2238,7 +2213,6 @@
"src/main/ipc/pty/ipc/spawn-push-target-materialization-real-git.test.ts": 1316,
"src/main/ipc/pty/ipc/write-input-user-input.test.ts": 84,
"src/main/ipc/pty/managed-data-account-spawn-environment.test.ts": 1150,
"src/main/ipc/pty/pane/join-pane-spawn.test.ts": 1438,
"src/main/ipc/pty/pane/pane-owner-replacement.test.ts": 1960,
"src/main/ipc/pty/pane/serializer-document-lifetime.test.ts": 77,
"src/main/ipc/pty/pane/spawn-registration.test.ts": 935,
@@ -2257,7 +2231,6 @@
"src/main/ipc/pty/pty-spawn-cwd-fallback.test.ts": 4680,
"src/main/ipc/pty/pty-ssh-stop-verdict.test.ts": 3615,
"src/main/ipc/pty/pty-write-ipc-validation.test.ts": 5157,
"src/main/ipc/pty/runtime/kill-legacy-relay-bridged.test.ts": 3679,
"src/main/ipc/pty/runtime/kill-same-id-respawn.test.ts": 3784,
"src/main/ipc/pty/runtime/spawn-preflight-wsl-background-hold.test.ts": 1568,
"src/main/ipc/filesystem/watcher-process/rebinding-file-watch-noise.test.ts": 317,
@@ -2267,7 +2240,6 @@
"src/main/ipc/worktrees/removal/registered-worktree-root-stopped-distro.test.ts": 168,
"src/main/ipc/worktrees/removal/registered-worktree-root-wsl-runtime.test.ts": 261,
"src/main/ipc/worktrees/removal/registered-worktree-roots-scoped-invalidation.test.ts": 141,
"src/main/ipc/renderer-lifetime-abort.test.ts": 65,
"src/main/ipc/renderer-shutdown-checkpoint-sleep-records.test.ts": 1914,
"src/main/ipc/renderer-shutdown-checkpoint.test.ts": 496,
"src/main/ipc/renderer-terminal-serializer-readiness.test.ts": 45,
@@ -2308,14 +2280,12 @@
"src/main/ipc/ssh/ssh-app-shutdown.test.ts": 4455,
"src/main/ipc/ssh/ssh-connect-decision-cancellation.test.ts": 6414,
"src/main/ipc/ssh/ssh-credential-cancel.test.ts": 4604,
"src/main/ipc/ssh/ssh-disconnect-cancellation.test.ts": 6851,
"src/main/ipc/ssh/ssh-host-user-disconnect.test.ts": 4734,
"src/main/ipc/ssh/ssh-passphrase.test.ts": 135,
"src/main/ipc/ssh/ssh.test.ts": 6905,
"src/main/ipc/terminal-preview-output-stream.test.ts": 53,
"src/main/ipc/terminal-render-desync-evidence.test.ts": 78,
"src/main/ipc/terminal-startup-color-query-replies.test.ts": 265,
"src/main/ipc/usage-provider-handlers-readiness.test.ts": 506,
"src/main/ipc/filesystem/watcher-process/watcher-event-root-path-rewrite.test.ts": 48,
"src/main/workspaces/removal/watcher-removal-gate.test.ts": 384,
"src/main/ipc/workspace-cleanup/workspace-cleanup-activity.test.ts": 76,
@@ -2438,7 +2408,6 @@
"src/main/managed-server/install/orcad-remote-launch-setsid.test.ts": 342,
"src/main/managed-server/install/orcad-remote-launch.test.ts": 319,
"src/main/managed-server/install/orcad-remote-node-runtime.test.ts": 248,
"src/main/managed-server/install/orcad-remote-primitives.test.ts": 337,
"src/main/managed-server/install/orcad-remote-readiness-wait.test.ts": 9063,
"src/main/managed-server/install/orcad-remote-runtime.test.ts": 488,
"src/main/managed-server/install/orcad-remote-shell-commands.integration.test.ts": 9000,
@@ -2474,7 +2443,6 @@
"src/main/muse/hook-service.test.ts": 145,
"src/main/native-chat/agent-model-catalog/agent-model-catalog-discovery-freshness.test.ts": 390,
"src/main/native-chat/agent-model-catalog/agent-model-catalog-entry.test.ts": 75,
"src/main/native-chat/agent-model-catalog/agent-model-catalog-persistence.test.ts": 115,
"src/main/native-chat/agent-model-catalog/agent-model-catalog-probe-runner.test.ts": 4786,
"src/main/native-chat/agent-model-catalog/agent-model-catalog-store.test.ts": 611,
"src/main/native-chat/agent-model-catalog/agent-model-catalog-unavailable.test.ts": 465,
@@ -2658,20 +2626,17 @@
"src/main/opencode/overlay-dir-gc.test.ts": 141,
"src/main/opencode/overlay-source-ownership.test.ts": 60,
"src/main/opencode2/status-plugin-setup-lifetime.test.ts": 108,
"src/main/orca-profiles/other-profile-workspace-catalog.test.ts": 462,
"src/main/orca-profiles/profile-active-transfer-worker.test.ts": 2841,
"src/main/orca-profiles/profile-active-transfer.test.ts": 2243,
"src/main/orca-profiles/profile-artifact-cloud-cleanup.test.ts": 553,
"src/main/orca-profiles/profile-cloud-service-connect-overlap.test.ts": 683,
"src/main/orca-profiles/profile-cloud-service-sign-out-connect-race.test.ts": 541,
"src/main/orca-profiles/profile-cloud-session-refresh-rotation.test.ts": 523,
"src/main/orca-profiles/profile-cloud-session-store.test.ts": 133,
"src/main/orca-profiles/catalog/other-profile-workspace-catalog.test.ts": 462,
"src/main/orca-profiles/project-transfer/profile-active-transfer-worker.test.ts": 2841,
"src/main/orca-profiles/cloud-auth/profile-artifact-cloud-cleanup.test.ts": 553,
"src/main/orca-profiles/cloud-auth/profile-cloud-service-connect-overlap.test.ts": 683,
"src/main/orca-profiles/cloud-auth/profile-cloud-service-sign-out-connect-race.test.ts": 541,
"src/main/orca-profiles/cloud-session/profile-cloud-session-refresh-rotation.test.ts": 523,
"src/main/orca-profiles/profile-index-store.test.ts": 1265,
"src/main/orca-profiles/profile-project-domain-transfer.test.ts": 5088,
"src/main/orca-profiles/profile-project-session-field-disposition.test.ts": 334,
"src/main/orca-profiles/profile-project-session-state.test.ts": 300,
"src/main/orca-profiles/profile-project-transfer-migration.test.ts": 1642,
"src/main/orca-profiles/profile-project-transfer.test.ts": 1456,
"src/main/orca-profiles/project-transfer/profile-project-session-field-disposition.test.ts": 334,
"src/main/orca-profiles/project-transfer/profile-project-session-state.test.ts": 300,
"src/main/orca-profiles/project-transfer/profile-project-transfer-migration.test.ts": 1642,
"src/main/orca-profiles/project-transfer/profile-project-transfer.test.ts": 1456,
"src/main/orca-profiles/profile-telemetry-consent-seed.test.ts": 536,
"src/main/persistence/migrating-orcad-catalog/orcad-migration-export-holds.test.ts": 231,
"src/main/orcad/electron-serve-provider-selection.test.ts": 554,
@@ -2693,7 +2658,6 @@
"src/main/orcad/orcad-cli-orchestration.integration.test.ts": 214,
"src/main/orcad/orcad-forked-child-paths.test.ts": 337,
"src/main/orcad/orcad-help.integration.test.ts": 5016,
"src/main/orcad/orcad-host-account-launch-env-store.test.ts": 299,
"src/main/orcad/orcad-idle-exit-monitor.test.ts": 106,
"src/main/orcad/orcad-instance-lock.test.ts": 315,
"src/main/orcad/orcad-launcher-isolation.integration.test.ts": 617,
@@ -2740,7 +2704,6 @@
"src/main/persistence/loading-store/profile-state-maintenance-contracts.test.ts": 8856,
"src/main/persistence/loading-store/profile-state-settings-writes.test.ts": 2311,
"src/main/persistence/loading-store/profile-state-sqlite-authority.test.ts": 2840,
"src/main/persistence/loading-store/profile-state-store-backups.test.ts": 2270,
"src/main/persistence/loading-store/profile-state-temp-cleanup-lifetime.test.ts": 2582,
"src/main/persistence/loading-store/profile-state-update-quit.test.ts": 2094,
"src/main/persistence/loading-store/pty-incarnation-renderer-save.test.ts": 2182,
@@ -2791,7 +2754,6 @@
"src/main/persistence/moving-wsl-projects/wsl-move-quiesce.test.ts": 413,
"src/main/persistence/moving-wsl-projects/wsl-move-real-pause.test.ts": 1939,
"src/main/persistence/moving-wsl-projects/wsl-move-reset.test.ts": 891,
"src/main/persistence/moving-wsl-projects/wsl-move-restore-hints.test.ts": 65,
"src/main/persistence/moving-wsl-projects/wsl-move-retention.test.ts": 2285,
"src/main/persistence/moving-wsl-projects/wsl-move-rewrite-ledger.test.ts": 641,
"src/main/persistence/moving-wsl-projects/wsl-move-scope-guard.test.ts": 639,
@@ -2917,7 +2879,6 @@
"src/main/persistence/tracking-repos/persistence-folder-scan-project-groups.test.ts": 1944,
"src/main/persistence/tracking-repos/persistence-folder-workspace-notes.test.ts": 2124,
"src/main/persistence/tracking-repos/persistence-invalid-workspace-layout-purge.test.ts": 2151,
"src/main/persistence/tracking-repos/persistence-repo-lifecycle.test.ts": 3528,
"src/main/persistence/tracking-repos/persistence-update-repo.test.ts": 2213,
"src/main/persistence/tracking-repos/persistence-workspace-attachments.test.ts": 2030,
"src/main/persistence/tracking-repos/persistence-workspace-pinned-automation-fence.test.ts": 2412,
@@ -3161,7 +3122,6 @@
"src/main/ripgrep/bundled-ripgrep-real.test.ts": 242,
"src/main/ripgrep/bundled-ripgrep-text-search.test.ts": 707,
"src/main/ripgrep/ripgrep-filename-identity-real.test.ts": 274,
"src/main/ripgrep/synchronous-spawn-failure.test.ts": 54,
"src/main/ripgrep/text-search-unicode-real.test.ts": 332,
"src/main/runtime/session-tabs/acknowledged-terminal-tab-retirement-main-close.test.ts": 6833,
"src/main/runtime/session-tabs/acknowledged-terminal-tab-retirement.test.ts": 6423,
@@ -3177,7 +3137,6 @@
"src/main/runtime/agent-session/records/agent-session-store-load-scale.test.ts": 732,
"src/main/runtime/agent-session/agent-session-tab-layout-queue.test.ts": 4061,
"src/main/runtime/agent-session/agent-session-conversation-clear-commit.test.ts": 957,
"src/main/runtime/agent-session/agent-session-death-evidence-persistence.test.ts": 1113,
"src/main/runtime/agent-session/agent-session-launch-directory.test.ts": 926,
"src/main/runtime/agent-session/agent-session-tab-layout.test.ts": 275,
"src/main/runtime/agent-session/agent-session-unsaved-creation-supersession.test.ts": 726,
@@ -3393,7 +3352,6 @@
"src/main/runtime/orchestration/mailbox/terminal-pointer/orchestration-mailbox-delivery.test.ts": 7599,
"src/main/runtime/orchestration/mailbox/terminal-pointer/orchestration-mailbox-notification-consistency.test.ts": 24765,
"src/main/runtime/orchestration/mailbox/routing/orchestration-mailbox-routing.test.ts": 14953,
"src/main/runtime/orchestration/mailbox/terminal-pointer/orchestration-mailbox-titles.test.ts": 11638,
"src/main/runtime/orchestration/mailbox/notifications/orchestration-message-delivery-identity.test.ts": 25822,
"src/main/runtime/orchestration/mailbox/terminal-pointer/orchestration-messages-fake-parity.test.ts": 510,
"src/main/runtime/orchestration/mailbox/terminal-pointer/orchestration-open-dialog-delivery-hold.test.ts": 5567,
@@ -3442,7 +3400,6 @@
"src/main/runtime/orchestration/db/worker-dispatch/worker-dispatch-abandon.test.ts": 662,
"src/main/runtime/orchestration/db/schema/dispatch-consumer-generation-migration.test.ts": 640,
"src/main/runtime/orchestration/db/dispatch-context/dispatch-failure-idempotency.test.ts": 544,
"src/main/runtime/orchestration/federation/synchronization/federation-ack-checkpoints.test.ts": 38,
"src/main/runtime/orchestration/federation/synchronization/federation-acknowledgment-integrity.test.ts": 557,
"src/main/runtime/orchestration/db/federation/federation-acknowledgment-migration.test.ts": 566,
"src/main/runtime/orchestration/federation/synchronization/federation-sync.test.ts": 5264,
@@ -3571,13 +3528,11 @@
"src/main/runtime/rpc/methods/browser/browser-network-tunnel.test.ts": 1096,
"src/main/runtime/rpc/methods/client-state/client-ui-set-collapsed.test.ts": 1091,
"src/main/runtime/rpc/methods/clipboard/clipboard.test.ts": 848,
"src/main/runtime/rpc/methods/files/file-watch-event-batcher.test.ts": 69,
"src/main/runtime/rpc/methods/files/files-path-search.test.ts": 884,
"src/main/runtime/rpc/methods/files/files-read-dir-page.test.ts": 1213,
"src/main/runtime/rpc/methods/files/files-read-dir-remote-budget.test.ts": 860,
"src/main/runtime/rpc/methods/files/files-watch-cancellation.test.ts": 886,
"src/main/runtime/rpc/methods/files/files.test.ts": 1018,
"src/main/runtime/rpc/methods/source-control/gitlab/gitlab.test.ts": 4209,
"src/main/runtime/rpc/methods/integrations/jira/jira-saved-filter-state.test.ts": 937,
"src/main/runtime/rpc/methods/integrations/jira/jira.test.ts": 732,
"src/main/runtime/rpc/methods/integrations/linear/linear-agent-access.test.ts": 4648,
@@ -3623,7 +3578,6 @@
"src/main/runtime/rpc/methods/orchestration/messaging/check-worker-consumer-fencing.test.ts": 5876,
"src/main/runtime/rpc/methods/orchestration/messaging/check-worker-federated-attachment.test.ts": 4547,
"src/main/runtime/rpc/methods/orchestration/messaging/check.test.ts": 4373,
"src/main/runtime/rpc/methods/orchestration/messaging/implicit-task-run-routing.test.ts": 4876,
"src/main/runtime/rpc/methods/orchestration/messaging/recipient-routing.test.ts": 4675,
"src/main/runtime/rpc/methods/orchestration/messaging/run-bound-mailbox-history.test.ts": 4288,
"src/main/runtime/rpc/methods/orchestration/messaging/run-bound-mailbox-interleavings.test.ts": 5049,
@@ -3662,12 +3616,10 @@
"src/main/runtime/rpc/methods/orchestration/worker/worker-terminal-custody-at-creation.test.ts": 5687,
"src/main/runtime/rpc/methods/orchestration/worker/workers-new-worktree.test.ts": 6117,
"src/main/runtime/rpc/methods/orchestration/worker/workers-recovery.test.ts": 5182,
"src/main/runtime/rpc/methods/pairing/pairing.test.ts": 776,
"src/main/runtime/rpc/methods/plugins/plugin-dev-emit.test.ts": 3118,
"src/main/runtime/rpc/methods/plugins/plugin-dev-request.test.ts": 3725,
"src/main/runtime/rpc/methods/plugins/plugins.test.ts": 274,
"src/main/runtime/rpc/methods/preflight/preflight-selected-target.test.ts": 5043,
"src/main/runtime/rpc/methods/projects/repo.test.ts": 896,
"src/main/runtime/rpc/methods/session-tabs/session-tabs-inventory-census-race.test.ts": 4349,
"src/main/runtime/rpc/methods/session-tabs/session-tabs-move-validation.test.ts": 4261,
"src/main/runtime/rpc/methods/session-tabs/session-tabs-retirement-proof-delta.test.ts": 1726,
@@ -3714,7 +3666,6 @@
"src/main/runtime/rpc/mobile-socket-wiring.test.ts": 312,
"src/main/runtime/rpc/orcad-feature-readiness.test.ts": 40,
"src/main/runtime/rpc/orchestration-11745-regression-verification.test.ts": 22874,
"src/main/runtime/rpc/orchestration-caller-show.test.ts": 4209,
"src/main/runtime/rpc/orchestration-check-wait-session.test.ts": 5096,
"src/main/runtime/rpc/orchestration-commit-notify-characterization.test.ts": 5702,
"src/main/runtime/rpc/orchestration-contract-fence.test.ts": 6113,
@@ -3735,7 +3686,6 @@
"src/main/runtime/rpc/orchestration-party-agreement.test.ts": 4581,
"src/main/runtime/rpc/orchestration-run-use-invalid-takeover.test.ts": 4575,
"src/main/runtime/rpc/orchestration-runtime-update-settlement.test.ts": 5105,
"src/main/runtime/rpc/orchestration-session-caller.test.ts": 5717,
"src/main/runtime/rpc/orchestration-session-coordinator.test.ts": 4655,
"src/main/runtime/rpc/orchestration-session-recipient.test.ts": 5100,
"src/main/runtime/rpc/orchestration-session-run-binding.test.ts": 4448,
@@ -3744,7 +3694,6 @@
"src/main/runtime/rpc/remote-runtime-server-heartbeat-missed-probe-tolerance.test.ts": 59,
"src/main/runtime/rpc/remote-runtime-server-heartbeat.test.ts": 60,
"src/main/runtime/rpc/repo-add-cli.integration.test.ts": 1603,
"src/main/runtime/rpc/rpc-caller-scope.test.ts": 5071,
"src/main/runtime/rpc/runtime-client-capabilities.test.ts": 43,
"src/main/runtime/rpc/runtime-source-admission.test.ts": 909,
"src/main/runtime/rpc/shadowed-port-probe.test.ts": 99,
@@ -3758,7 +3707,6 @@
"src/main/runtime/rpc/terminal-multiplex-ack-overflow-recovery-history.test.ts": 1892,
"src/main/runtime/rpc/terminal-multiplex-ack-overflow-recovery.test.ts": 2369,
"src/main/runtime/rpc/terminal-multiplex-desktop-resize-routing.test.ts": 2160,
"src/main/runtime/rpc/terminal-multiplex-endpoint-loss-notice.test.ts": 1852,
"src/main/runtime/rpc/terminal-multiplex-initial-snapshot-buffering.test.ts": 2118,
"src/main/runtime/rpc/terminal-multiplex-input-sequence-replay.test.ts": 5709,
"src/main/runtime/rpc/terminal-multiplex-input-write-rejection.test.ts": 2423,
@@ -3771,7 +3719,6 @@
"src/main/runtime/rpc/terminal-multiplex-snapshot-query-replay.test.ts": 2715,
"src/main/runtime/rpc/terminal-multiplex-snapshot-serialization.test.ts": 2224,
"src/main/runtime/rpc/terminal-multiplex-subscribe-slot-recovery.test.ts": 1792,
"src/main/runtime/rpc/terminal-opencode-send-guard.integration.test.ts": 4512,
"src/main/runtime/rpc/terminal-output-batching.test.ts": 2087,
"src/main/runtime/rpc/terminal-output-frame-chunks.test.ts": 70,
"src/main/runtime/rpc/terminal-passive-resize-input.test.ts": 2656,
@@ -3793,7 +3740,6 @@
"src/main/runtime/rpc/unpaired-device-auth-throttle.test.ts": 42,
"src/main/runtime/rpc/web-session-pairing.test.ts": 402,
"src/main/runtime/rpc/workspace-creator-context.test.ts": 40,
"src/main/runtime/rpc/worktree-catalog-snapshot.test.ts": 46,
"src/main/runtime/rpc/worktree-removal-marker-projection.test.ts": 497,
"src/main/runtime/rpc/worktree-rm-cli.integration.test.ts": 6876,
"src/main/runtime/rpc/ws-empty-payload-frame-write.test.ts": 117,
@@ -3864,7 +3810,6 @@
"src/main/runtime/rpc/server/runtime-rpc-websocket-reply-size-limit.test.ts": 4410,
"src/main/runtime/files/search/runtime-search-line-fragments.test.ts": 624,
"src/main/runtime/files/server-browse/runtime-server-environment-commands.test.ts": 262,
"src/main/runtime/rpc/server/runtime-socket-sweep.test.ts": 47,
"src/main/runtime/client/runtime-subscription-registry.test.ts": 142,
"src/main/runtime/terminal/records/runtime-terminal-exit-contracts.test.ts": 5325,
"src/main/runtime/terminal/identity/runtime-terminal-handle-contracts.test.ts": 3983,
@@ -3872,7 +3817,6 @@
"src/main/runtime/terminal/query/runtime-terminal-inventory-contracts.test.ts": 4427,
"src/main/runtime/terminal/adoption/runtime-terminal-orphan-adoption-rollback.test.ts": 1832,
"src/main/runtime/terminal/surface/runtime-terminal-retirement-contracts.test.ts": 4505,
"src/main/runtime/terminal/title/runtime-terminal-set-pane-title.test.ts": 5216,
"src/main/runtime/terminal/input/runtime-terminal-writer.test.ts": 150,
"src/main/runtime/construction/runtime-workspace-launch-contracts.test.ts": 4059,
"src/main/runtime/workspaces/session-hosts/runtime-workspace-session-controller-twin-repo.test.ts": 298,
@@ -3891,11 +3835,9 @@
"src/main/runtime/session-tabs/session-tab-close-force.test.ts": 7089,
"src/main/runtime/session-tabs/runtime-inventory-publication-authority.test.ts": 5775,
"src/main/runtime/session-tabs/headless-mobile-session-absorbed-rows.test.ts": 4223,
"src/main/runtime/session-tabs/main-layout-agent-launch-tabs.test.ts": 4233,
"src/main/runtime/session-tabs/main-layout-session-tab-move.test.ts": 4233,
"src/main/runtime/session-tabs/session-tab-prototype-dispatch.test.ts": 4888,
"src/main/runtime/session-tabs/session-tabs-headless-main-change.test.ts": 4320,
"src/main/runtime/session-tabs/session-tabs-held-rows-commit.test.ts": 5046,
"src/main/runtime/session-tabs/session-tabs-inventory-publication.test.ts": 4166,
"src/main/runtime/session-tabs/session-tabs-main-rows-parity.test.ts": 4606,
"src/main/runtime/session-tabs/session-tabs-phone-layout-moves.test.ts": 4153,
@@ -3931,13 +3873,11 @@
"src/main/runtime/agent-session/lifecycle/structured-agent-cli-writers.test.ts": 140,
"src/main/runtime/agent-session/lifecycle/structured-agent-session-history-close-race.test.ts": 5020,
"src/main/runtime/agent-session/naming/structured-agent-session-provider-naming-shutdown.test.ts": 1987,
"src/main/runtime/agent-session/lifecycle/structured-agent-session-tab-authority.test.ts": 11047,
"src/main/runtime/agent-session/environment/structured-agent-shell-environment-catalog.test.ts": 720,
"src/main/runtime/orchestration/terminal-authority/structured-sessions/structured-chat-coordinator-mail.test.ts": 38220,
"src/main/runtime/orchestration/terminal-authority/structured-sessions/structured-chat-dispatch-worker-lifecycle.test.ts": 9312,
"src/main/runtime/orchestration/terminal-authority/structured-sessions/structured-chat-dispatch-worker-mail.test.ts": 6125,
"src/main/runtime/orchestration/terminal-authority/structured-sessions/structured-chat-dispatch-worker.test.ts": 6981,
"src/main/runtime/agent-session/naming/structured-chat-naming-runtime.test.ts": 1605,
"src/main/runtime/orchestration/terminal-authority/structured-sessions/structured-chat-worker-helpers.test.ts": 8057,
"src/main/runtime/orchestration/terminal-authority/structured-sessions/structured-chat-worker-reuse.test.ts": 6372,
"src/main/runtime/orchestration/terminal-authority/structured-sessions/structured-chat-worker-start-unknown.test.ts": 7813,
@@ -4089,7 +4029,6 @@
"src/main/ssh/host-keys/ssh-known-hosts.test.ts": 105,
"src/main/ssh/external-editors/zed-ssh-url.test.ts": 55,
"src/main/ssh/connection/ssh-connect-config.test.ts": 182,
"src/main/ssh/connection/ssh-connection-attribution.test.ts": 44,
"src/main/ssh/connection/ssh-connection-auth-fallback.test.ts": 512,
"src/main/ssh/connection/ssh-connection-channel-error.test.ts": 461,
"src/main/ssh/connection/ssh-connection-channel-open.test.ts": 1230,
@@ -4262,10 +4201,8 @@
"src/main/startup/main-process-quit-pending-writer.test.ts": 328,
"src/main/startup/main-process-quit-update-veto.test.ts": 1714,
"src/main/startup/main-process-ready-activation-failure.test.ts": 313,
"src/main/startup/main-process-ready-identity-write.test.ts": 3997,
"src/main/startup/main-process-ready-persistence-cleanup.test.ts": 164,
"src/main/startup/main-process-ready-phase-ordering.test.ts": 242,
"src/main/startup/main-process-runtime-launch-activation.test.ts": 1369,
"src/main/startup/main-window-actions-quit-and-stop-all-sessions.test.ts": 488,
"src/main/startup/os-opened-document-resolution.test.ts": 74,
"src/main/startup/os-opened-documents.test.ts": 67,
@@ -4313,7 +4250,6 @@
"src/main/telemetry/validator-warn-cache.test.ts": 187,
"src/main/telemetry/validator.test.ts": 170,
"src/main/telemetry/wsl-usage-reporter.test.ts": 407,
"src/main/pty/history/terminal-history-async-delete.test.ts": 374,
"src/main/pty/history/terminal-history-gc-fs-call-count.test.ts": 157,
"src/main/pty/history/terminal-history-gc.test.ts": 824,
"src/main/pty/history/terminal-history-tombstone-retry.test.ts": 715,
@@ -4367,22 +4303,15 @@
"src/main/updater/lifecycle/serve-supervisor-install-park.test.ts": 173,
"src/main/updater/mac-install/shipit-leftover-recovery.test.ts": 136,
"src/main/updater/lifecycle/updater-wsl-move-install-hold.test.ts": 287,
"src/main/usage/usage-cache-snapshot-writer.test.ts": 55,
"src/main/usage/usage-worktree-canonicalizer.test.ts": 43,
"src/main/usage/usage-worktree-metadata.test.ts": 61,
"src/main/usage/agent-token-usage-reporter.test.ts": 343,
"src/main/usage/analytics-session-id-store.test.ts": 195,
"src/main/usage/highest-usage-key.test.ts": 45,
"src/main/usage/jsonl-file-reader.test.ts": 112,
"src/main/usage/jsonl-file-snapshot.test.ts": 54,
"src/main/usage/jsonl-line-offsets.test.ts": 66,
"src/main/usage/usage-breakdown-scaling.test.ts": 84,
"src/main/usage/usage-calendar-range.test.ts": 53,
"src/main/usage/usage-provider-store-initialization.test.ts": 586,
"src/main/usage/usage-provider-store-lifecycle.test.ts": 769,
"src/main/usage/usage-scan-worker-cache-cleanup.test.ts": 153,
"src/main/usage/usage-source-cache-file.test.ts": 94,
"src/main/usage/usage-worktree-resolver.test.ts": 269,
"src/main/usage/cache/usage-cache-snapshot-writer.test.ts": 55,
"src/main/usage/reporting/token-usage/analytics-session-id-store.test.ts": 195,
"src/main/usage/source-input/jsonl/jsonl-file-reader.test.ts": 112,
"src/main/usage/source-input/jsonl/jsonl-line-offsets.test.ts": 66,
"src/main/usage/rollups/usage-breakdown-scaling.test.ts": 84,
"src/main/usage/reporting/range-query/usage-calendar-range.test.ts": 53,
"src/main/usage/provider-lifecycle/usage-provider-store-lifecycle.test.ts": 769,
"src/main/usage/cache/usage-source-cache-file.test.ts": 94,
"src/main/usage/worktree-attribution/usage-worktree-resolver.test.ts": 269,
"src/main/warp-themes/discovery.test.ts": 58,
"src/main/warp-themes/index.test.ts": 678,
"src/main/warp-themes/manual-warp-theme-files.test.ts": 104,
@@ -4390,11 +4319,9 @@
"src/main/warp-themes/parser.test.ts": 85,
"src/main/warp-themes/theme-file-scanner.test.ts": 56,
"src/main/windows/windows-command-paths.test.ts": 77,
"src/main/window/attach-main-window-services.test.ts": 964,
"src/main/window/clipboard-agent-session-attachment-paste.test.ts": 585,
"src/main/window/clipboard-copied-file-paths.test.ts": 58,
"src/main/window/clipboard-dashboard-popout-access.test.ts": 1361,
"src/main/window/clipboard-ipc-handlers.test.ts": 496,
"src/main/window/clipboard-macos-image-paste.test.ts": 1087,
"src/main/window/clipboard-publisher-executable.test.ts": 62,
"src/main/window/clipboard-remote-file-staging-fs.test.ts": 66,
@@ -4406,7 +4333,6 @@
"src/main/window/createMainWindow-markdown-editor-focus.test.ts": 1084,
"src/main/window/createMainWindow-recovery-reload-watchdog.test.ts": 1251,
"src/main/window/createMainWindow-renderer-crash-recovery.test.ts": 1613,
"src/main/window/createMainWindow-terminal-focus-shortcuts.test.ts": 2628,
"src/main/window/createMainWindow-user-quit-close.test.ts": 1592,
"src/main/window/createMainWindow.test.ts": 1603,
"src/main/window/darwin-user-temp-dir.test.ts": 51,
@@ -4521,7 +4447,6 @@
"src/main/wsl/execution/wsl-guest-pane-process-script-cost.test.ts": 213,
"src/main/wsl/execution/wsl-guest-pane-processes.test.ts": 48,
"src/main/wsl/execution/wsl-guest-process-identity.test.ts": 54,
"src/main/wsl/host-lifecycle/wsl-host-automation-wake.test.ts": 288,
"src/main/wsl/host-lifecycle/wsl-host-kept-for-peers.test.ts": 159,
"src/main/wsl/host-lifecycle/wsl-host-pending-removal.test.ts": 955,
"src/main/wsl/host-lifecycle/wsl-host-server-stop.test.ts": 407,
@@ -4730,12 +4655,10 @@
"src/renderer/src/components/browser-pane/host-guest/browser-page-guest-recovery.test.ts": 515,
"src/renderer/src/components/browser-pane/host-guest/browser-page-registration-ownership.test.ts": 2197,
"src/renderer/src/components/browser-pane/host-guest/browser-page-viewport.test.ts": 242,
"src/renderer/src/components/browser-pane/host-guest/browser-page-window-close.test.ts": 54,
"src/renderer/src/components/browser-pane/host-guest/browser-system-resume.test.ts": 187,
"src/renderer/src/components/browser-pane/host-guest/use-browser-page-keyboard-shortcuts.split.test.tsx": 2098,
"src/renderer/src/components/browser-pane/host-guest/use-browser-page-webview-partition.test.ts": 1985,
"src/renderer/src/components/browser-pane/host-guest/webview-registry.test.ts": 103,
"src/renderer/src/components/browser-pane/navigate/browser-file-editor-open.test.ts": 1853,
"src/renderer/src/components/browser-pane/navigate/browser-load-failure-overlay.test.tsx": 831,
"src/renderer/src/components/browser-pane/navigate/browser-page-download-activity.test.ts": 44,
"src/renderer/src/components/browser-pane/navigate/browser-webview-load-failure.test.ts": 243,
@@ -4810,19 +4733,16 @@
"src/renderer/src/components/editor/diff/monaco-view/DiffViewer.word-wrap-lifecycle.test.tsx": 2499,
"src/renderer/src/components/editor/EditorConflictReviewSurface.live-record.test.tsx": 1193,
"src/renderer/src/components/editor/EditorEditFileSurface.monaco-containment.test.tsx": 2666,
"src/renderer/src/components/editor/EditorFileLoadErrorView.test.tsx": 660,
"src/renderer/src/components/editor/EditorFileLocationMenuItems.test.tsx": 846,
"src/renderer/src/components/editor/EditorPanel.custom-editor-flush.test.tsx": 2478,
"src/renderer/src/components/editor/EditorPanel.diff-rich-owner.test.tsx": 2823,
"src/renderer/src/components/editor/notebook/cells/IpynbCellEditor.external-sync.test.tsx": 1660,
"src/renderer/src/components/editor/notebook/kernel/IpynbKernelToolbar.test.tsx": 736,
"src/renderer/src/components/editor/notebook/document/IpynbRendering.test.tsx": 2143,
"src/renderer/src/components/editor/markdown-preview/surface/MarkdownPreview.link-routing.interaction.test.tsx": 1127,
"src/renderer/src/components/editor/MediaViewer.test.tsx": 308,
"src/renderer/src/components/editor/PdfFind.test.tsx": 581,
"src/renderer/src/components/editor/PluginBytesCustomEditorSurface.test.tsx": 641,
"src/renderer/src/components/editor/PluginEditorNeedsDesktopNotice.test.tsx": 2107,
"src/renderer/src/components/editor/PluginFileTypeSuggestion.test.tsx": 2062,
"src/renderer/src/components/editor/rich-markdown/instance/RichMarkdownEditor.focus-leave.test.tsx": 4927,
"src/renderer/src/components/editor/ai-vault-session-log-content.test.tsx": 1899,
"src/renderer/src/components/editor/check-details/actions/check-annotation-path.test.ts": 53,
@@ -4842,21 +4762,19 @@
"src/renderer/src/components/editor/combined-diff/resolve-changes/combined-diff-entries.test.ts": 54,
"src/renderer/src/components/editor/combined-diff/review-controls/use-combined-diff-section-actions.disk-precondition.test.tsx": 2383,
"src/renderer/src/components/editor/conflict-review-file-tree-windowing.test.tsx": 1487,
"src/renderer/src/components/editor/csv/CsvGrid.test.tsx": 994,
"src/renderer/src/components/editor/csv/CsvViewer.delimiter.test.tsx": 2923,
"src/renderer/src/components/editor/csv/CsvViewer.editing.test.tsx": 3583,
"src/renderer/src/components/editor/csv/csv-byte-index.test.ts": 1645,
"src/renderer/src/components/editor/csv/csv-cell-links.test.tsx": 302,
"src/renderer/src/components/editor/csv/csv-column-width-preferences.test.ts": 208,
"src/renderer/src/components/editor/csv/csv-paged-preview.test.ts": 143,
"src/renderer/src/components/editor/csv/csv-parse-budget.test.ts": 102,
"src/renderer/src/components/editor/csv/csv-parse.test.ts": 148,
"src/renderer/src/components/editor/csv/csv-pending-save.test.ts": 1926,
"src/renderer/src/components/editor/csv/csv-preview-save-safety.test.ts": 1973,
"src/renderer/src/components/editor/csv/csv-table-interactions.test.ts": 310,
"src/renderer/src/components/editor/csv/csv-text-document.test.ts": 153,
"src/renderer/src/components/editor/csv/useCsvPagedPreview.test.tsx": 429,
"src/renderer/src/components/editor/csv/useCsvPendingCell.test.tsx": 714,
"src/renderer/src/components/editor/csv/document/csv-byte-index.test.ts": 1645,
"src/renderer/src/components/editor/csv/grid/csv-cell-links.test.tsx": 302,
"src/renderer/src/components/editor/csv/grid/columns/csv-column-width-preferences.test.ts": 208,
"src/renderer/src/components/editor/csv/preview/csv-paged-preview.test.ts": 143,
"src/renderer/src/components/editor/csv/document/csv-parse-budget.test.ts": 102,
"src/renderer/src/components/editor/csv/document/csv-parse.test.ts": 148,
"src/renderer/src/components/editor/save/queue/csv-pending-save.test.ts": 1926,
"src/renderer/src/components/editor/save/queue/csv-preview-save-safety.test.ts": 1973,
"src/renderer/src/components/editor/csv/editing/csv-table-interactions.test.ts": 310,
"src/renderer/src/components/editor/csv/document/csv-text-document.test.ts": 153,
"src/renderer/src/components/editor/csv/editing/useCsvPendingCell.test.tsx": 714,
"src/renderer/src/components/editor/view-mode/custom-editor-routing.test.ts": 2715,
"src/renderer/src/components/editor/rich-markdown/details/details-markdown-html.test.ts": 93,
"src/renderer/src/components/editor/save/flush/discard-editor-file-changes.save-race.test.ts": 1150,
@@ -4867,7 +4785,6 @@
"src/renderer/src/components/editor/save/bytes/editor-bytes-documents.test.ts": 690,
"src/renderer/src/components/editor/save/commands/editor-child-owner-save.test.tsx": 2480,
"src/renderer/src/components/editor/external-changes/editor-clean-tab-draft-invariant.test.ts": 1274,
"src/renderer/src/components/editor/editor-dropped-file-open.test.ts": 595,
"src/renderer/src/components/editor/external-changes/editor-external-watch-path-index.test.ts": 1754,
"src/renderer/src/components/editor/save/commands/editor-file-save-utf8-conversion.test.ts": 1915,
"src/renderer/src/components/editor/editor-git-discard-other-workspace.test.ts": 1967,
@@ -4875,7 +4792,6 @@
"src/renderer/src/components/editor/model-lifetime/identity/editor-model-host-isolation.test.ts": 5906,
"src/renderer/src/components/editor/model-lifetime/identity/editor-model-uri-labels.test.ts": 1223,
"src/renderer/src/components/editor/editor-path-move-inflight.test.ts": 50,
"src/renderer/src/components/editor/external-changes/editor-restored-tab-conflict-scan.recheck.test.ts": 1796,
"src/renderer/src/components/editor/external-changes/editor-restored-tab-conflict-scan.test.ts": 1809,
"src/renderer/src/components/editor/save/queue/editor-save-disk-precondition.races.test.ts": 1290,
"src/renderer/src/components/editor/save/queue/editor-save-disk-precondition.test.ts": 1431,
@@ -5104,7 +5020,6 @@
"src/renderer/src/components/native-chat/viewport/rail/NativeChatMessageRail.test.tsx": 1134,
"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,
@@ -5259,7 +5174,6 @@
"src/renderer/src/components/new-workspace/SmartWorkspaceNameField-repo-slug-routing.test.ts": 342,
"src/renderer/src/components/new-workspace/smart-workspace-github-direct-link.test.ts": 347,
"src/renderer/src/components/new-workspace/smart-workspace-source-results.test.ts": 136,
"src/renderer/src/components/new-workspace/use-jira-composer-project.test.tsx": 279,
"src/renderer/src/components/new-workspace/use-jira-source-connection.test.tsx": 278,
"src/renderer/src/components/new-workspace/use-jira-url-source.test.tsx": 419,
"src/renderer/src/components/new-workspace/use-linear-source-connection.test.tsx": 1335,
@@ -5286,7 +5200,6 @@
"src/renderer/src/components/plugins/view/plugin-view-data-acts.test.tsx": 3002,
"src/renderer/src/components/plugins/view/plugin-view-editor-capture.test.tsx": 1934,
"src/renderer/src/components/plugins/view/plugin-view-editor-shot-cleanup.test.ts": 59,
"src/renderer/src/components/plugins/view/plugin-view-editor-workspace.test.ts": 99,
"src/renderer/src/components/plugins/view/plugin-view-panel-settle.test.ts": 206,
"src/renderer/src/components/plugins/view/plugin-view-request-handler-workspace.test.ts": 2307,
"src/renderer/src/components/plugins/view/plugin-view-request-handler.test.ts": 2849,
@@ -5366,7 +5279,6 @@
"src/renderer/src/components/right-sidebar/source-control/review/source-control-create-pr-intent-flow.test.ts": 71,
"src/renderer/src/components/right-sidebar/source-control/review/source-control-manual-review-url.test.ts": 77,
"src/renderer/src/components/right-sidebar/source-control/listing/source-control-submodule-expansion.test.ts": 80,
"src/renderer/src/components/right-sidebar/source-control/ai/use-ai.operation-recovery.test.tsx": 13031,
"src/renderer/src/components/right-sidebar/source-control/commit/rename-mutation-paths.test.ts": 49,
"src/renderer/src/components/right-sidebar/source-control/commit/source-control-entry-failure-toast.test.ts": 486,
"src/renderer/src/components/right-sidebar/source-control/commit/use-commit-message-generation.cancel.test.ts": 1992,
@@ -5375,7 +5287,6 @@
"src/renderer/src/components/right-sidebar/source-control/review/create-pr-intent-operation-target.test.ts": 1735,
"src/renderer/src/components/right-sidebar/source-control/review/use-create-pr-intent-jira-title.test.tsx": 1956,
"src/renderer/src/components/right-sidebar/source-control/review/use-pull-request-generation.test.tsx": 2720,
"src/renderer/src/components/right-sidebar/ssh-port-forward-dialog.ime-enter.test.tsx": 585,
"src/renderer/src/components/right-sidebar/ai-vault/search/use-ai-vault-search.test.tsx": 688,
"src/renderer/src/components/right-sidebar/checks-panel/refresh/use-checks-panel-terminal-worktree.test.ts": 2116,
"src/renderer/src/components/right-sidebar/hosted-review/creation/use-create-jira-review-title.test.tsx": 1979,
@@ -5519,7 +5430,6 @@
"src/renderer/src/components/sidebar/host-path-browser/remote-file-browser-entry-actions.test.ts": 289,
"src/renderer/src/components/sidebar/worktree-list/listing/rendered-sidebar-worktree-order.test.ts": 1873,
"src/renderer/src/components/sidebar/project-admission/drop/sidebar-project-drop.test.ts": 227,
"src/renderer/src/components/sidebar/project-admission/host-selection/use-add-repo-windows-drive-refusal.test.tsx": 470,
"src/renderer/src/components/sidebar/project-admission/host-selection/use-add-repo-wsl-host-paths.test.tsx": 660,
"src/renderer/src/components/sidebar/sidebar-feedback/use-feedback-image-drop.test.tsx": 511,
"src/renderer/src/components/sidebar/workspace-board/projection/use-workspace-board-task-status-sync.queued.test.ts": 1022,
@@ -5594,7 +5504,6 @@
"src/renderer/src/components/status-bar/resource-session-kill-confirmation.test.ts": 53,
"src/renderer/src/components/status-bar/resource-session-removal-render-budget.test.tsx": 290,
"src/renderer/src/components/status-bar/resource-usage-folder-merge.test.ts": 251,
"src/renderer/src/components/status-bar/status-bar-pool-countdown.test.tsx": 654,
"src/renderer/src/components/status-bar/usage-pool-label.test.ts": 170,
"src/renderer/src/components/status-bar/use-owner-usage-rate-limits.test.tsx": 462,
"src/renderer/src/components/status-bar/use-resource-memory-snapshot.test.tsx": 321,
@@ -5609,10 +5518,8 @@
"src/renderer/src/components/tab-bar/cli-chat-resume-run-close.test.ts": 3079,
"src/renderer/src/components/tab-bar/group-tab-order.test.ts": 2091,
"src/renderer/src/components/tab-bar/host-agent-launch-preferences-source.test.tsx": 3154,
"src/renderer/src/components/tab-bar/recent-tab-switching.test.ts": 1795,
"src/renderer/src/components/tab-bar/tab-agent-launch-options.test.ts": 438,
"src/renderer/src/components/tab-bar/tab-agent-types-by-tab-id.test.ts": 206,
"src/renderer/src/components/tab-bar/tab-bar-layout-owner-props.test.ts": 174,
"src/renderer/src/components/tab-bar/tab-context-menu.test.tsx": 5620,
"src/renderer/src/components/tab-bar/tab-create-entry-classifier.test.ts": 510,
"src/renderer/src/components/tab-bar/tab-create-entry-local-path.test.ts": 2614,
@@ -5645,7 +5552,6 @@
"src/renderer/src/components/task-page/jira/task-page-jira-board-detail-integration.test.tsx": 2192,
"src/renderer/src/components/task-page/jira/task-page-jira-board-transitions.test.ts": 69,
"src/renderer/src/components/task-page/jira/task-page-jira-board-view.test.tsx": 2287,
"src/renderer/src/components/task-page/jira/task-page-jira-cache-selectors.test.ts": 54,
"src/renderer/src/components/task-page/jira/task-page-jira-favourite-selection.test.tsx": 3326,
"src/renderer/src/components/task-page/jira/task-page-jira-grouping.test.ts": 2324,
"src/renderer/src/components/task-page/jira/task-page-jira-linked-issues.test.ts": 204,
@@ -5719,14 +5625,11 @@
"src/renderer/src/components/terminal-pane/pty-connection/agent-identity/pty-connection-command-finished-late-done.test.ts": 10940,
"src/renderer/src/components/terminal-pane/pty-connection/tests/pty-connection-completion-and-notification.test.ts": 18380,
"src/renderer/src/components/terminal-pane/pty-connection/tests/pty-connection-foreground-agent.test.ts": 20118,
"src/renderer/src/components/terminal-pane/pty-connection/lifecycle/pty-connection-git-bash-console-capacity.test.ts": 5784,
"src/renderer/src/components/terminal-pane/pty-connection/lifecycle/pty-connection-hibernation-kill-shell-foreground.test.ts": 2205,
"src/renderer/src/components/terminal-pane/pty-connection/tests/pty-connection-hidden-replay.test.ts": 21687,
"src/renderer/src/components/terminal-pane/pty-connection/output-restore/pty-connection-hidden-restore-marker-handoff.test.ts": 2170,
"src/renderer/src/components/terminal-pane/pty-connection/output-restore/pty-connection-hidden-restore-unhide-coverage.test.ts": 4612,
"src/renderer/src/components/terminal-pane/pty-connection/output-restore/pty-connection-hidden-restore-unhide-retired-task.test.ts": 1947,
"src/renderer/src/components/terminal-pane/pty-connection/notifications/pty-connection-hook-idle-arbitration.test.ts": 2228,
"src/renderer/src/components/terminal-pane/pty-connection/tests/pty-connection-input-and-repaint.test.ts": 21974,
"src/renderer/src/components/terminal-pane/pty-connection/spawn/pty-connection-main-pane-restore-start.test.ts": 2430,
"src/renderer/src/components/terminal-pane/pty-connection/spawn/pty-connection-main-pane-start.test.ts": 2611,
"src/renderer/src/components/terminal-pane/pty-connection/output-restore/pty-connection-post-dispose-restore-termination.test.ts": 1215,
@@ -5736,9 +5639,7 @@
"src/renderer/src/components/terminal-pane/pty-connection/reattach/pty-connection-remote-snapshot-image-title.test.ts": 1754,
"src/renderer/src/components/terminal-pane/pty-connection/tests/pty-connection-restore-and-resume.test.ts": 19401,
"src/renderer/src/components/terminal-pane/pty-connection/output-restore/pty-connection-restored-baseline-shortfall.test.ts": 1902,
"src/renderer/src/components/terminal-pane/pty-connection/tests/pty-connection-spawn-and-startup.test.ts": 19652,
"src/renderer/src/components/terminal-pane/pty-connection/spawn/pty-connection-spawn-deferred-sleep.test.ts": 6918,
"src/renderer/src/components/terminal-pane/pty-connection/tests/pty-connection-visibility-and-exit.test.ts": 18950,
"src/renderer/src/components/terminal-pane/pty-connection/output-restore/pty-connection-visible-pane-output-pause-latch.test.ts": 1639,
"src/renderer/src/components/terminal-pane/pty-connection/reattach/deferred-session-reattach-newer-daemon-hold.test.ts": 2570,
"src/renderer/src/components/terminal-pane/pty-connection/reattach/deferred-session-reattach-startup-snapshot.test.ts": 1830,
@@ -5848,7 +5749,6 @@
"src/renderer/src/components/terminal-pane/layout/terminal-layout-pty-ownership.test.ts": 99,
"src/renderer/src/components/terminal-pane/links/terminal-link-click-fallback.test.ts": 985,
"src/renderer/src/components/terminal-pane/links/terminal-link-open-beside-source.test.ts": 947,
"src/renderer/src/components/terminal-pane/links/http/terminal-link-osc-url-routing.test.ts": 986,
"src/renderer/src/components/terminal-pane/links/terminal-link-paired-click-fallback.test.ts": 989,
"src/renderer/src/components/terminal-pane/links/gestures/terminal-link-pointer-gesture.test.ts": 550,
"src/renderer/src/components/terminal-pane/links/files/terminal-link-provider-batching.test.ts": 1051,
@@ -5867,7 +5767,6 @@
"src/renderer/src/components/terminal-pane/layout/split/terminal-pane-split-request-routing.test.ts": 2015,
"src/renderer/src/components/terminal-pane/layout/detach/terminal-pane-tab-detach-main-commit.test.ts": 2090,
"src/renderer/src/components/terminal-pane/layout/detach/terminal-pane-tab-detach-main-move.test.ts": 2147,
"src/renderer/src/components/terminal-pane/parking/verdict/terminal-park-verdict-flip-telemetry.test.ts": 123,
"src/renderer/src/components/terminal-pane/parking/output-watchers/terminal-parked-tab-watchers.test.ts": 473,
"src/renderer/src/components/terminal-pane/parking/output-watchers/terminal-parked-watcher-registry.test.ts": 245,
"src/renderer/src/components/terminal-pane/parking/output-watchers/terminal-parked-watcher-sleep-preserved-exit.test.ts": 399,
@@ -5909,7 +5808,6 @@
"src/renderer/src/components/terminal/terminal-tab-actions-unrouted-close.test.ts": 589,
"src/renderer/src/components/terminal/terminal-tab-actions.test.ts": 626,
"src/renderer/src/components/terminal/terminal-tab-close-running-confirm.test.ts": 499,
"src/renderer/src/components/terminal/terminal-tab-create.test.ts": 367,
"src/renderer/src/components/terminal/unsaved-close-queue.test.ts": 42,
"src/renderer/src/components/terminal/use-terminal-provider-snapshot-capability.test.tsx": 573,
"src/renderer/src/components/terminal/window-close-running-work.test.ts": 97,
@@ -5949,7 +5847,6 @@
"src/renderer/src/components/worktree-jump/use-worktree-jump-palette-browser-ownership.test.ts": 2096,
"src/renderer/src/components/worktree-jump/use-worktree-jump-palette-task-search.test.tsx": 2140,
"src/renderer/src/components/worktree-jump/worktree-jump-palette-browser-navigation.test.tsx": 4470,
"src/renderer/src/components/wsl-host-stopped/WslHostStoppedNotice.test.tsx": 491,
"src/renderer/src/components/wsl-move/WslMoveDialog.test.tsx": 524,
"src/renderer/src/components/wsl-move/wsl-move-dialog-store.test.ts": 2011,
"src/renderer/src/components/wsl-move/wsl-move-scope-rows.test.ts": 156,
@@ -5984,7 +5881,6 @@
"src/renderer/src/hooks/ipc-events/direct-ssh-unrestored-forward-sync.test.ts": 95,
"src/renderer/src/hooks/ipc-events/mobile-terminal-close-ipc-bridge-reveal.test.ts": 1764,
"src/renderer/src/hooks/ipc-events/mobile-terminal-close-ipc-bridge.test.ts": 2200,
"src/renderer/src/hooks/ipc-events/orca-profile-auth-ipc-bridge.test.ts": 1908,
"src/renderer/src/hooks/ipc-events/os-markdown-file-open-bridge.test.ts": 280,
"src/renderer/src/hooks/ipc-events/quit-and-stop-all-sessions-ipc-bridge.test.ts": 398,
"src/renderer/src/hooks/ipc-events/runtime-client-ipc-bridge-ownership.test.ts": 2068,
@@ -6007,7 +5903,6 @@
"src/renderer/src/hooks/runtime-client-events-sync-ownership.test.ts": 59,
"src/renderer/src/hooks/runtime-client-events-sync.test.ts": 118,
"src/renderer/src/hooks/runtime-project-refresh-scheduler.test.ts": 65,
"src/renderer/src/hooks/shortcut-label-cache.test.tsx": 2021,
"src/renderer/src/hooks/unpaired-device-auth-notification.test.ts": 41,
"src/renderer/src/hooks/use-document-dark-theme.test.tsx": 350,
"src/renderer/src/hooks/use-list-multi-selection.test.tsx": 545,
@@ -6040,7 +5935,6 @@
"src/renderer/src/hooks/useIpcEvents-agent-status-queue-ordering.test.ts": 3680,
"src/renderer/src/hooks/useIpcEvents-agent-status-snapshot-replay.test.ts": 4119,
"src/renderer/src/hooks/useIpcEvents-agent-status-ssh-authority.test.ts": 3310,
"src/renderer/src/hooks/useIpcEvents-browser-navigation.test.ts": 1511,
"src/renderer/src/hooks/useIpcEvents-close-routing-session-tabs.test.ts": 5812,
"src/renderer/src/hooks/useIpcEvents-new-workspace-shortcut.test.ts": 72,
"src/renderer/src/hooks/useIpcEvents-runtime-environment-selectors.test.ts": 530,
@@ -6085,12 +5979,10 @@
"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-exited-owner.test.ts": 1289,
"src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-join-delivery.test.ts": 862,
"src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-options.test.ts": 991,
"src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-persistence.test.ts": 386,
"src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-probe-outage.test.ts": 1891,
"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/startup/agent-startup-delayed-delivery-perf.test.ts": 1708,
"src/shared/agent-status/contracts/agent-status-evidence-clock.test.ts": 88,
"src/shared/agent-status/title/agent-title-tracker.test.ts": 172,
@@ -6102,7 +5994,6 @@
"src/renderer/src/lib/agent-session/resume/history/ai-vault-session-drag.test.ts": 68,
"src/renderer/src/lib/agent-session/resume/history/ai-vault-session-resume-preparation.test.ts": 408,
"src/renderer/src/lib/agent-session/history/title-sync/ai-vault-tab-title-sync-inputs.test.ts": 476,
"src/renderer/src/lib/agent-session/history/title-sync/ai-vault-tab-title-sync.test.ts": 925,
"src/renderer/src/lib/keyboard/app-keyboard-router.test.ts": 187,
"src/renderer/src/lib/clipboard/menu/app-menu-paste.test.ts": 229,
"src/renderer/src/lib/automation-session-reuse.test.ts": 70,
@@ -6135,12 +6026,8 @@
"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,
"src/renderer/src/lib/keyboard-layout/layout-base-character.test.ts": 48,
"src/renderer/src/lib/agent-session/launch/background/launch-agent-background-session-launch-parity.test.ts": 2792,
"src/renderer/src/lib/agent-session/launch/background/launch-agent-background-session.test.ts": 1040,
"src/renderer/src/lib/agent-session/launch/new-tab/launch-agent-in-new-tab-main-surface.test.ts": 1821,
"src/renderer/src/lib/agent-session/launch/new-tab/launch-agent-in-new-tab-windows-quoting.test.ts": 1196,
"src/renderer/src/lib/agent-session/launch/new-tab/launch-agent-in-new-tab.test.ts": 1417,
"src/renderer/src/lib/agent-session/launch/new-tab/launch-agent-new-tab-host-route-readiness.test.ts": 489,
"src/renderer/src/lib/agent-session/launch/new-tab/launch-agent-picker-contract.test.ts": 3592,
"src/renderer/src/lib/agent-session/launch/continuation/launch-agent-session-continuation-toast.test.tsx": 2347,
@@ -6162,7 +6049,6 @@
"src/renderer/src/lib/monaco-languages/register-vue.test.ts": 303,
"src/renderer/src/lib/monaco-languages/register-zig.test.ts": 4750,
"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/simulator/launch/open-mobile-emulator-tab.test.ts": 545,
"src/renderer/src/lib/pane-manager/pane-close-focus-successor.test.ts": 1123,
@@ -6347,10 +6233,8 @@
"src/renderer/src/store/plugins/catalog/plugin-panel-retry-timer-cleanup.test.ts": 5216,
"src/renderer/src/store/plugins/catalog/plugin-panels.test.ts": 2142,
"src/renderer/src/store/projects/project-catalog-null-field-ingest.test.ts": 309,
"src/renderer/src/store/diagnostics/react-commit-cascade-write-probe.test.ts": 602,
"src/renderer/src/store/repos/dropped-repo-worktree-rows.test.ts": 1738,
"src/renderer/src/store/repos/repo-removal.test.ts": 799,
"src/renderer/src/store/repos/safe-auto-fork-sync.test.ts": 446,
"src/renderer/src/store/repos/wsl-moved-local-session-rows.test.ts": 319,
"src/renderer/src/store/repos/wsl-moved-repo-ui-retention.test.ts": 2920,
"src/renderer/src/store/slices/runtime-status/views/runtime-status-subscriptions.test.ts": 182,
@@ -6414,7 +6298,6 @@
"src/renderer/src/store/slices/editor/buffers/editor-buffer-reconcile-identity.test.ts": 1775,
"src/renderer/src/store/slices/editor/buffers/editor-buffer-reconcile-joins.test.ts": 1766,
"src/renderer/src/store/slices/editor/buffers/editor-buffer-rejoin.test.ts": 1843,
"src/renderer/src/store/slices/editor/buffers/editor-buffer-views.test.ts": 2004,
"src/renderer/src/store/slices/editor/file-ids/floating-editor-file-id-layout-owner.test.ts": 933,
"src/renderer/src/store/slices/worktrees/session/folder-workspace-activation-and-activity.test.ts": 2358,
"src/renderer/src/store/slices/diff-comments/folder-workspace-diff-comments.test.ts": 1042,
@@ -6497,7 +6380,6 @@
"src/renderer/src/store/slices/tabs/tabs-hydration-group-validation.test.ts": 249,
"src/renderer/src/store/slices/tabs/tabs-hydration.test.ts": 273,
"src/renderer/src/store/slices/tabs/tabs-label-and-pin-state.test.ts": 1921,
"src/renderer/src/store/slices/tabs/tabs-model-reconciliation.test.ts": 1800,
"src/renderer/src/store/slices/tabs/tabs-open-close-lifecycle.test.ts": 2140,
"src/renderer/src/store/slices/tabs/tabs-pane-layout-operations.test.ts": 1652,
"src/renderer/src/store/slices/tabs/tabs-unread-and-focus.test.ts": 1801,
@@ -6517,7 +6399,6 @@
"src/renderer/src/store/slices/ui/ui-modal-slot-dismissal.test.ts": 662,
"src/renderer/src/store/slices/ui/ui-slice-surface-actions.test.ts": 1760,
"src/renderer/src/store/slices/worktrees/session/workspace-activation-preparation.test.ts": 1932,
"src/renderer/src/store/slices/workspace-attention/workspace-unread-characterization.test.ts": 1974,
"src/renderer/src/store/slices/workspace-attention/workspace-unread-flag-host-raises.test.ts": 1914,
"src/renderer/src/store/slices/workspace-attention/workspace-unread-on-screen-characterization.test.ts": 1780,
"src/renderer/src/store/slices/workspace-attention/workspace-unread-screen-moves-characterization.test.ts": 1884,
@@ -6575,7 +6456,6 @@
"src/renderer/src/store/terminals/terminal-no-op-subscriber.test.ts": 1763,
"src/renderer/src/store/terminals/terminal-startup-queue-restart.test.ts": 1895,
"src/renderer/src/store/terminals/terminal-tab-close-intent.test.ts": 1945,
"src/renderer/src/store/terminals/workspace-terminal-placeholders.test.ts": 302,
"src/renderer/src/store/slices/runtime-status/views/use-runtime-status-view.test.tsx": 1979,
"src/renderer/src/store/workspace-layout/workspace-layout-cache.test.ts": 63,
"src/renderer/src/store/slices/worktrees/listing/worktree-host-collision-index.test.ts": 1875,
@@ -7066,7 +6946,6 @@
"src/shared/orca-session-address.test.ts": 154,
"src/shared/orca-yaml-alias-bounds.test.ts": 425,
"src/shared/orca-yaml-bounds.test.ts": 192,
"src/shared/orcad-artifacts.test.ts": 45,
"src/shared/orcad-build-identity.test.ts": 48,
"src/shared/orcad-migration-manifest-contract.test.ts": 323,
"src/shared/orcad-migration/orcad-migration-blob-transfer.test.ts": 348,
@@ -7576,7 +7455,6 @@
"tests/e2e/host-agent-launch-settings-hook-bookkeeping.unit.test.ts": 21972,
"tests/e2e/host-cold-park-remote-subscriber.unit.test.ts": 5314,
"tests/e2e/launch-agent-background-session-remote.unit.test.ts": 1016,
"tests/e2e/launch-agent-in-new-tab-web-runtime.unit.test.ts": 14288,
"tests/e2e/linear-cli-recovery.unit.test.ts": 7592,
"tests/e2e/linear-store.unit.test.ts": 519,
"tests/e2e/linear-write-lifetime.unit.test.ts": 5214,
@@ -7699,10 +7577,6 @@
"src/main/skills/install/skill-wsl-install-transaction.integration.test.ts": 250,
"src/main/skills/filesystem/skill-wsl-posix-semantics.integration.test.ts": 254,
"src/renderer/src/lib/pane-manager/terminal-scroll/pane-scroll.test.ts": 153,
"src/renderer/src/lib/pane-manager/terminal-input/pane-terminal-mouse-wheel.test.ts": 88,
"src/renderer/src/lib/pane-manager/pane-layout/pane-tree-equalization-parity.test.ts": 182,
"src/renderer/src/lib/pane-manager/terminal-input/terminal-ime-anchor.test.ts": 51,
"src/renderer/src/lib/pane-manager/terminal-scroll/terminal-scroll-intent.test.ts": 118,
"src/renderer/src/lib/pane-manager/terminal-replay/terminal-structural-replay-coordinator.test.ts": 68,
"src/renderer/src/lib/pane-manager/terminal-protocol/windows-pty-compatibility.test.ts": 68
}
@@ -27,7 +27,6 @@ const DESKTOP_SUITE_PREFIXES = [
'src/main/runtime/agent-session/agent-session-account-',
'src/main/runtime/agent-session/agent-session-acquisition-',
'src/main/runtime/agent-session/agent-session-conversation-',
'src/main/runtime/agent-session/agent-session-death-',
'src/main/runtime/agent-session/agent-session-launch-',
'src/main/runtime/agent-session/agent-session-operation-',
'src/main/runtime/agent-session/agent-session-rewind-',
@@ -20,7 +20,7 @@ export const ORCAD_CHILD_ENTRY_POINTS = {
daemon: 'src/main/daemon/daemon-entry.ts',
writer: 'src/main/persistence/profile-state/profile-state-writer-worker-entry.ts',
backup: 'src/main/persistence/profile-state/profile-state-backup-worker-entry.ts',
sessionSearch: 'src/main/ai-vault-search/session-search-worker-entry.ts',
sessionSearch: 'src/main/ai-vault-search/worker/session-search-worker-entry.ts',
foreignSqliteReader: 'src/main/foreign-sqlite-readers/foreign-sqlite-reader-entry.ts',
portScanCommandWorker: 'src/main/ports/port-scan-command-worker-entry.ts',
commandPathDirectoryWorker: 'src/main/ipc/command-path/command-path-directory-worker-entry.ts',
@@ -27,14 +27,40 @@ export function resolveClaudeBenchmarkCommit(ref) {
}
const SNAPSHOT_MODULE_PATHS = [
'src/main/usage/cache/usage-cache-snapshot-writer.ts',
'src/main/usage/usage-cache-snapshot-writer.ts',
'src/main/usage-cache-snapshot-writer.ts'
]
const PERSISTENCE_MODULE_PATHS = {
snapshot: SNAPSHOT_MODULE_PATHS,
lifecycle: [
'src/main/usage/provider-lifecycle/usage-provider-store-lifecycle.ts',
'src/main/usage/usage-provider-store-lifecycle.ts'
],
sourceCache: [
'src/main/usage/cache/usage-source-cache-file.ts',
'src/main/usage/usage-source-cache-file.ts'
]
}
function persistenceEntry(mode) {
function listClaudeBenchmarkModulePaths(commit, modulePaths) {
const listed = runProcessSync({
program: 'git',
args: ['ls-tree', '--name-only', commit, '--', ...modulePaths],
cwd: ROOT,
timeoutMs: 10_000,
maxOutputBytes: MIB,
env: { ...process.env, ORCA_BACKGROUND_LAUNCH: '1' }
})
assert.equal(listed.code, 0, listed.stderr)
assert.equal(listed.outputTruncated, false)
return new Set(listed.stdout.trim().split('\n'))
}
function persistenceEntry(mode, modulePaths) {
const exports = [
`export { UsageCacheSnapshotWriter } from './src/main/usage/usage-cache-snapshot-writer';`,
`export { UsageProviderStoreLifecycle } from './src/main/usage/usage-provider-store-lifecycle';`
`export { UsageCacheSnapshotWriter } from './${modulePaths.snapshot.slice(0, -3)}';`,
`export { UsageProviderStoreLifecycle } from './${modulePaths.lifecycle.slice(0, -3)}';`
]
if (mode === 'published') {
exports.push(`export { validatePersistedClaudeUsageProjections }
@@ -42,7 +68,7 @@ function persistenceEntry(mode) {
} else if (mode === 'main') {
exports.push(`export { readUsageSourceCache as readSourceCache,
writeUsageSourceCache as writeSourceCache, splitUsageCacheFile as splitCacheFile }
from './src/main/usage/usage-source-cache-file';`)
from './${modulePaths.sourceCache.slice(0, -3)}';`)
} else {
exports.push(`export { readClaudeUsageSourceCache as readSourceCache,
writeClaudeUsageSourceCache as writeSourceCache, persistClaudeUsageSourceCache as persistSourceCache,
@@ -75,24 +101,25 @@ const INACTIVE_LIFECYCLE_IMPORTS = new Map([
export async function loadClaudeUsageBenchmarkPersistence(mode, commit = null, frozen = new Map()) {
const sourceFingerprints = {}
const stubFingerprints = {}
let snapshotModulePath = SNAPSHOT_MODULE_PATHS[0]
const modulePaths = Object.fromEntries(
Object.entries(PERSISTENCE_MODULE_PATHS).map(([name, paths]) => [name, paths[0]])
)
const nativeModulePaths = new Map()
if (typeof commit === 'string') {
const listed = runProcessSync({
program: 'git',
args: ['ls-tree', '--name-only', commit, '--', ...SNAPSHOT_MODULE_PATHS],
cwd: ROOT,
timeoutMs: 10_000,
maxOutputBytes: MIB,
env: { ...process.env, ORCA_BACKGROUND_LAUNCH: '1' }
})
assert.equal(listed.code, 0, listed.stderr)
assert.equal(listed.outputTruncated, false)
const paths = new Set(listed.stdout.trim().split('\n'))
snapshotModulePath = SNAPSHOT_MODULE_PATHS.find((path) => paths.has(path))
assert(snapshotModulePath, 'Pinned usage snapshot writer is absent')
const paths = listClaudeBenchmarkModulePaths(
commit,
Object.values(PERSISTENCE_MODULE_PATHS).flat()
)
for (const [name, candidates] of Object.entries(PERSISTENCE_MODULE_PATHS)) {
if (name === 'sourceCache' && mode !== 'main') {
continue
}
modulePaths[name] = candidates.find((path) => paths.has(path))
assert(modulePaths[name], `Pinned usage ${name} is absent`)
}
}
const result = await build({
stdin: { contents: persistenceEntry(mode), loader: 'ts', resolveDir: ROOT },
stdin: { contents: persistenceEntry(mode, modulePaths), loader: 'ts', resolveDir: ROOT },
platform: 'node',
format: 'esm',
bundle: true,
@@ -107,7 +134,7 @@ export async function loadClaudeUsageBenchmarkPersistence(mode, commit = null, f
.join('/')
const modulePath = resolved.endsWith('.ts') ? resolved : `${resolved}.ts`
return SNAPSHOT_MODULE_PATHS.includes(modulePath)
? { path: resolve(ROOT, snapshotModulePath) }
? { path: resolve(ROOT, modulePaths.snapshot) }
: undefined
})
bundler.onResolve(
@@ -122,6 +149,29 @@ export async function loadClaudeUsageBenchmarkPersistence(mode, commit = null, f
return match ? { path: match, namespace: 'inactive-lifecycle' } : undefined
}
)
bundler.onResolve({ filter: /^\./ }, (args) => {
if (typeof commit !== 'string') {
return undefined
}
const target = relative(ROOT, resolve(args.resolveDir, args.path)).split(sep).join('/')
if (!target.startsWith('src/')) {
return undefined
}
if (!nativeModulePaths.has(target)) {
const extensions = ['.tsx', '.ts', '.jsx', '.js', '.css', '.json']
const candidates = extname(target)
? [target]
: [
...extensions.map((extension) => target + extension),
...extensions.map((extension) => `${target}/index${extension}`)
]
const paths = listClaudeBenchmarkModulePaths(commit, candidates)
const modulePath = candidates.find((path) => paths.has(path))
assert(modulePath, `Pinned usage source is absent: ${String(commit)}:${target}`)
nativeModulePaths.set(target, modulePath)
}
return { path: resolve(ROOT, nativeModulePaths.get(target)) }
})
bundler.onLoad({ filter: /.*/, namespace: 'inactive-lifecycle' }, (args) => {
const contents = INACTIVE_LIFECYCLE_IMPORTS.get(args.path)
stubFingerprints[args.path] = claudeBenchmarkSha256(contents)
@@ -6,20 +6,20 @@ import {
} from '../../../../src/main/ai-vault/parse-cache/session-scanner-parse-cache'
import { resetSessionParseCacheForTests } from '../../../../src/main/ai-vault/parse-cache/session-parse-cache-store'
import { resetTranscriptConsumersForTests } from '../../../../src/main/ai-vault/transcripts/session-transcript-consumers'
import { SessionSearchEngine } from '../../../../src/main/ai-vault-search/session-search-engine'
import { SessionSearchEngine } from '../../../../src/main/ai-vault-search/query/session-search-engine'
import type {
SessionSearchRequest,
SessionSearchScope
} from '../../../../src/main/ai-vault-search/session-search-engine-types'
import { registerSessionSearchIndexConsumer } from '../../../../src/main/ai-vault-search/session-search-index-consumer'
import { SessionSearchStore } from '../../../../src/main/ai-vault-search/session-search-store'
} from '../../../../src/main/ai-vault-search/query/session-search-engine-types'
import { registerSessionSearchIndexConsumer } from '../../../../src/main/ai-vault-search/indexing/session-search-index-consumer'
import { SessionSearchStore } from '../../../../src/main/ai-vault-search/storage/session-search-store'
import type SyncDatabase from '../../../../src/main/sqlite/sync-database'
import {
writeSyntheticTranscriptCorpus,
type SyntheticCorpus,
type SyntheticCorpusOptions
} from '../../../../src/main/ai-vault-search/session-search-synthetic-corpus'
import { sessionCandidate } from '../../../../src/main/ai-vault-search/session-search-transcript-fixtures'
} from '../../../../src/main/ai-vault-search/indexing/session-search-synthetic-corpus'
import { sessionCandidate } from '../../../../src/main/ai-vault-search/indexing/session-search-transcript-fixtures'
// Measure real engine/store on synthetic corpus only; never use real transcripts.
@@ -6,14 +6,14 @@ import {
} from '../../../../src/main/ai-vault/parse-cache/session-scanner-parse-cache'
import { resetSessionParseCacheForTests } from '../../../../src/main/ai-vault/parse-cache/session-parse-cache-store'
import { resetTranscriptConsumersForTests } from '../../../../src/main/ai-vault/transcripts/session-transcript-consumers'
import { SessionSearchEngine } from '../../../../src/main/ai-vault-search/session-search-engine'
import { SessionSearchEngine } from '../../../../src/main/ai-vault-search/query/session-search-engine'
import type {
SessionSearchRequest,
SessionSearchScope
} from '../../../../src/main/ai-vault-search/session-search-engine-types'
import { registerSessionSearchIndexConsumer } from '../../../../src/main/ai-vault-search/session-search-index-consumer'
import { SessionSearchStore } from '../../../../src/main/ai-vault-search/session-search-store'
import { sessionCandidate } from '../../../../src/main/ai-vault-search/session-search-transcript-fixtures'
} from '../../../../src/main/ai-vault-search/query/session-search-engine-types'
import { registerSessionSearchIndexConsumer } from '../../../../src/main/ai-vault-search/indexing/session-search-index-consumer'
import { SessionSearchStore } from '../../../../src/main/ai-vault-search/storage/session-search-store'
import { sessionCandidate } from '../../../../src/main/ai-vault-search/indexing/session-search-transcript-fixtures'
import type SyncDatabase from '../../../../src/main/sqlite/sync-database'
import { writeToolHeavyCorpus, type ToolHeavyCorpus } from './session-search-tool-heavy-corpus'
@@ -9,10 +9,10 @@ import {
import { resetSessionParseCacheForTests } from '../../../../src/main/ai-vault/parse-cache/session-parse-cache-store'
import { resetTranscriptConsumersForTests } from '../../../../src/main/ai-vault/transcripts/session-transcript-consumers'
import { requestWholeTranscriptRead } from '../../../../src/main/ai-vault/transcripts/session-transcript-reader'
import { registerSessionSearchIndexConsumer } from '../../../../src/main/ai-vault-search/session-search-index-consumer'
import { SessionSearchStore } from '../../../../src/main/ai-vault-search/session-search-store'
import { writeSyntheticTranscriptCorpus } from '../../../../src/main/ai-vault-search/session-search-synthetic-corpus'
import { sessionCandidate } from '../../../../src/main/ai-vault-search/session-search-transcript-fixtures'
import { registerSessionSearchIndexConsumer } from '../../../../src/main/ai-vault-search/indexing/session-search-index-consumer'
import { SessionSearchStore } from '../../../../src/main/ai-vault-search/storage/session-search-store'
import { writeSyntheticTranscriptCorpus } from '../../../../src/main/ai-vault-search/indexing/session-search-synthetic-corpus'
import { sessionCandidate } from '../../../../src/main/ai-vault-search/indexing/session-search-transcript-fixtures'
import SyncDatabase from '../../../../src/main/sqlite/sync-database'
// Measures the real transcript reader and search store over a synthetic corpus.
@@ -12,7 +12,7 @@ const NODE_RUNTIME_INCLUDE = [
'src/packages/process-host/src/run-process.test.ts',
'tests/e2e/cursor-quota-transport.unit.test.ts',
'tests/e2e/helpers/electron-process-shutdown.unit.test.ts',
'src/main/ai-vault-search/session-search-index-writer.test.ts',
'src/main/ai-vault-search/storage/session-search-index-writer.test.ts',
'src/main/ai-vault/session-scanner-unlimited-dedup.test.ts',
// The parse cache persists through node:sqlite.
'src/main/ai-vault/parse-cache/session-parse-cache-antigravity-upgrade.test.ts',
@@ -39,8 +39,8 @@ const NODE_RUNTIME_INCLUDE = [
'src/main/claude/claude-transcript-duration.test.ts',
'tests/e2e/native-chat-startup-option-pickers.unit.test.ts',
'src/main/ai-vault/transcripts/session-document-consumer-replacement.test.ts',
'src/main/ai-vault-search/session-search-dependent-transcripts.test.ts',
'src/main/ai-vault-search/session-search-list-reparse.test.ts',
'src/main/ai-vault-search/indexing/session-search-dependent-transcripts.test.ts',
'src/main/ai-vault-search/indexing/session-search-list-reparse.test.ts',
'src/main/runtime/rpc/server/orchestration-cli-subprocess.test.ts',
'src/main/runtime/orchestration/mailbox/terminal-pointer/orchestration-mailbox-delivery.test.ts',
'src/main/runtime/orchestration/mailbox/routing/orchestration-mailbox-routing.test.ts',
@@ -104,8 +104,7 @@ const NODE_RUNTIME_INCLUDE = [
'src/main/workspaces/removal/local-worktree-removal-recovery-live.test.ts',
'src/main/rate-limits/providers/codex/codex-rpc-worker-backpressure.test.ts',
'src/main/computer/macos-native-provider-client.test.ts',
'src/main/ai-vault-search/session-search-schema.test.ts',
'src/main/ai-vault-search/session-search-fts5-contract.test.ts',
'src/main/ai-vault-search/storage/session-search-schema.test.ts',
'src/main/foreign-sqlite-readers/**/*.test.ts',
'src/main/browser/*cookie*.test.ts',
'src/main/browser/cookies/*cookie*.test.ts',
@@ -28,8 +28,8 @@ const SQLITE_HARNESSES = new Set([
])
export const SQLITE_MODULES = [
'src/main/sqlite/sync-database',
'src/main/ai-vault-search/session-search-schema',
'src/main/ai-vault-search/session-search-store',
'src/main/ai-vault-search/storage/session-search-schema',
'src/main/ai-vault-search/storage/session-search-store',
'src/main/persistence/profile-state/profile-state-sqlite-authority',
'src/main/native-chat/agent-session-journal/database/journal-host-database',
'src/main/runtime/orchestration/db',
-1
View File
@@ -1,7 +1,6 @@
{
"extends": "./tsconfig.web.json",
"exclude": [
"../src/renderer/src/lib/agent-session/launch/new-tab/launch-agent-in-new-tab-main-surface.test.ts",
"../src/renderer/src/components/task-page/linear/task-page-linear-detail-query.test.tsx",
"../src/renderer/src/runtime/provider-accounts/observations/provider-account-observation.test-fixture.ts",
"../src/shared/**/*.test.ts",
-1
View File
@@ -1,7 +1,6 @@
{
"extends": "./tsconfig.web.json",
"include": [
"../src/renderer/src/lib/agent-session/launch/new-tab/launch-agent-in-new-tab-main-surface.test.ts",
"../src/main/runtime/orchestration/terminal-authority/structured-sessions/structured-chat-coordinator-mail.test.ts",
"../src/main/runtime/rpc/methods/orchestration/orchestration-check-ambiguous-caller.test.ts",
"../src/renderer/src/components/task-page/linear/task-page-linear-detail-query.test.tsx",
-1
View File
@@ -11,7 +11,6 @@
"../src/shared/**/*"
],
"exclude": [
"../src/renderer/src/lib/agent-session/launch/new-tab/launch-agent-in-new-tab-main-surface.test.ts",
"../src/renderer/src/components/task-page/linear/task-page-linear-detail-query.test.tsx",
"../src/renderer/src/runtime/provider-accounts/observations/provider-account-observation.test-fixture.ts"
],
+2 -5
View File
@@ -8,19 +8,16 @@ const contracts = [
'src/main/runtime/session-tabs/session-tabs-phone-layout-moves.test.ts',
'src/main/native-chat/agent-session-wire/host/testing/structured-agent-session-terminal-writer-acquire.test.ts',
'src/shared/agent-launch/permissions/tui-agent-permission-choice.test.ts',
'src/main/runtime/rpc/methods/projects/repo.test.ts',
'src/renderer/src/components/tab-bar/use-new-tab-agent-menu-host-preferences.test.tsx',
'src/main/sqlite/sync-database.test.ts',
'src/main/runtime/orchestration/db/row-column-lists.test.ts',
'src/shared/native-chat/tools/native-chat-tool-pairing.performance.test.ts',
'src/main/codex-usage/codex-rollout-file-lifetime.test.ts',
'src/main/codex-usage/scanner-incremental-append.test.ts',
'src/main/usage/jsonl-file-reader.test.ts',
'src/main/usage/jsonl-file-snapshot.test.ts',
'src/main/usage/source-input/jsonl/jsonl-file-reader.test.ts',
'config/scripts/static-analysis/oxlint-contracts/app-store-performance-plugin.test.mjs',
'config/scripts/static-analysis/oxlint-contracts/quadratic-buffer-concat-plugin.test.mjs',
'src/main/claude-usage/scanner-incremental-append.test.ts',
'src/main/claude-usage/store-checkpoint-persistence.test.ts'
'src/main/claude-usage/scanner-incremental-append.test.ts'
]
for (const contract of contracts) {
if (!existsSync(resolve(contract))) {
+4 -4
View File
@@ -1,5 +1,5 @@
<svg xmlns="http://www.w3.org/2000/svg" width="113" height="20" role="img" aria-label="downloads: 169m">
<title>downloads: 169m</title>
<svg xmlns="http://www.w3.org/2000/svg" width="113" height="20" role="img" aria-label="downloads: 170m">
<title>downloads: 170m</title>
<linearGradient id="s" x2="0" y2="100%">
<stop offset="0" stop-color="#bbb" stop-opacity=".1"/>
<stop offset="1" stop-opacity=".1"/>
@@ -15,7 +15,7 @@
<g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="11">
<text x="37" y="15" fill="#010101" fill-opacity=".3">downloads</text>
<text x="37" y="14">downloads</text>
<text x="93.5" y="15" fill="#010101" fill-opacity=".3">169m</text>
<text x="93.5" y="14">169m</text>
<text x="93.5" y="15" fill="#010101" fill-opacity=".3">170m</text>
<text x="93.5" y="14">170m</text>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 943 B

After

Width:  |  Height:  |  Size: 943 B

+1 -1
View File
@@ -52,7 +52,7 @@ If an agent's CLI is installed outside `PATH`, expand its row in **Settings →
| Freebuff | Auto-setup | [Freebuff](https://freebuff.com/cli) |
| Command Code | Auto-setup, status | [Command Code](https://commandcode.ai/docs/quickstart) |
| Muse | macOS/Linux; trusts the workspace at launch | [Meta](https://dev.meta.ai/docs/muse-code) |
| DeepSeek Harness | Launched through its `dsh-tui` profile; hooks, status, questions, resume | [DeepSeek](https://deepseek-harness.github.io/deepseek-harness/) |
| DeepSeek Harness | Needs `@deepseek-ai/dsh` plus the community `@deepseek-harness-tui/dsh-tui`; hooks, status, questions, resume | [dsh-TUI](https://github.com/ccch1mneyyy/dsh-TUI#quick-start) |
| ZCode | Deep integration; needs a `zcode` CLI that ships the TUI (see note below) | [Z.ai](https://zcode.z.ai/en/docs) |
| Continue | Auto-setup | [Continue](https://docs.continue.dev/cli/quickstart) |
| Cursor CLI | Deep integration | [Cursor](https://cursor.com/cli) |
+1
View File
@@ -125,6 +125,7 @@ For a direct LAN or Tailscale connection, allow the paired desktop's listening p
- **Pairing fails** — make sure your desktop and phone are signed into the same Orca account. Pairing codes expire after a few minutes; generate a fresh one if it's been sitting on the screen.
- **Authentication failed / pairing invalid** — the desktop no longer accepts this device token (for example after desktop cleared paired devices). Try **Retry** on the banner first (transient rejections can recover without re-pairing). If it keeps failing, use **Re-pair** from desktop, or **Remove** the host and pair again.
- **Update Orca Mobile / Update Orca on your computer** — the phone and desktop speak a versioned mobile protocol. If either side is too old, mobile blocks that host and points you at the App Store (iOS), [GitHub Releases](https://github.com/stablyai/orca/releases) (Android APK or desktop), then back to hosts. After updating, refresh the connection; if the message stays, remove the host and pair again.
- **A chat tab says Update mobile** — the session was started in desktop Chat UI, and this phone's app is too old to show it (the tab opens to an empty pane). Update the mobile app, then reconnect to the host so it sees the new app. If the app is already up to date and the tab still says Update mobile after reconnecting, report it with your mobile app version and desktop Orca version.
- **Quick Commands unavailable** — update the paired desktop so it advertises the quick-commands capability.
- **Can't reach desktop** — phone and desktop must share a network path (LAN, Tailscale, or the pairing path you used). Closing the desktop app drops the connection; reopen desktop and the phone reconnects automatically.
@@ -158,11 +158,6 @@
"ordinal": 13,
"json": "{\"id\":\"frame-2\",\"deviceToken\":\"recording-device\",\"method\":\"linear.searchIssues\",\"params\":{\"query\":\"bug\",\"limit\":50,\"workspaceId\":\"linear-workspace\"}}"
},
"1a5f65e0078d": {
"name": "loading",
"ordinal": 15,
"value": false
},
"1f4eeb3dcff1": {
"name": "items",
"ordinal": 5,
@@ -452,46 +447,6 @@
"loading": false,
"refreshing": false
},
"a27078adc061": {
"name": "items",
"ordinal": 13,
"value": [
{
"key": "linear:linear-workspace:issue-2",
"provider": "linear",
"source": {
"description": "",
"id": "issue-2",
"identifier": "ENG-2",
"labels": [],
"priority": 0,
"state": {
"color": "#000",
"name": "Todo",
"type": "unstarted"
},
"team": {
"id": "team-1",
"key": "ENG",
"name": "Engineering"
},
"title": "A found issue",
"updatedAt": "2020-01-01T00:00:00.000Z",
"url": "",
"workspaceId": "linear-workspace"
},
"status": "Todo",
"subtitle": "ENG-2 · Engineering",
"title": "A found issue",
"updatedAt": "2020-01-01T00:00:00.000Z"
}
]
},
"ab9026005b36": {
"name": "refreshing",
"ordinal": 16,
"value": false
},
"b25e7c116f7e": {
"name": "items",
"ordinal": 5,
@@ -532,11 +487,6 @@
"ordinal": 9,
"value": true
},
"bf0de0571310": {
"name": "taskListSettled",
"ordinal": 17,
"value": true
},
"c6d55e6b8844": {
"name": "linear.listIssues#1",
"ordinal": 3,
@@ -634,62 +584,6 @@
"ordinal": 18,
"value": true
},
"dd5be60ee9f9": {
"name": "linear.searchIssues#1",
"ordinal": 11,
"args": [
{
"name": "method",
"value": "linear.searchIssues"
},
{
"name": "params",
"value": {
"limit": 50,
"query": "bug",
"workspaceId": "linear-workspace"
}
},
{
"name": "options",
"value": {
"$rpc": "absent"
}
}
],
"settlement": {
"status": "fulfilled",
"startedAt": 0,
"settledAt": 0,
"value": {
"id": "frame-2",
"ok": true,
"result": [
{
"description": "",
"id": "issue-2",
"identifier": "ENG-2",
"labels": [],
"priority": 0,
"state": {
"color": "#000",
"name": "Todo",
"type": "unstarted"
},
"team": {
"id": "team-1",
"key": "ENG",
"name": "Engineering"
},
"title": "A found issue",
"updatedAt": "2020-01-01T00:00:00.000Z",
"url": "",
"workspaceId": "linear-workspace"
}
]
}
}
},
"dff6398be355": {
"name": "linear.listIssues#1",
"ordinal": 3,
@@ -729,11 +623,6 @@
}
}
},
"e3642939f5f6": {
"name": "linear.searchIssues#1",
"ordinal": 12,
"json": "{\"id\":\"frame-2\",\"deviceToken\":\"recording-device\",\"method\":\"linear.searchIssues\",\"params\":{\"query\":\"bug\",\"limit\":50,\"workspaceId\":\"linear-workspace\"}}"
},
"e6b86743ee36": {
"name": "linear.listIssues#1",
"ordinal": 3,
@@ -783,11 +672,6 @@
"$rpc": "undefined"
}
},
"ef8932b03a8c": {
"name": "error",
"ordinal": 14,
"value": ""
},
"f1dcb0c02c92": {
"name": "error",
"ordinal": 6,
@@ -880,8 +764,8 @@
{
"id": "tk-list-linear.normal:load-settled",
"observation": {
"sender": ["c6d55e6b8844", "dd5be60ee9f9"],
"payloads": ["7b6df16c2cf0", "e3642939f5f6"],
"sender": ["c6d55e6b8844", "837199f7c720"],
"payloads": ["7b6df16c2cf0", "19d7ea49485f"],
"settlements": {
"mount": "eb79a9b3682a",
"load-0": "eb79a9b3682a",
@@ -898,11 +782,12 @@
"411aee2eccd9",
"ba411b67de4b",
"3aefb3006914",
"a27078adc061",
"ef8932b03a8c",
"1a5f65e0078d",
"ab9026005b36",
"bf0de0571310"
"52e364aee6ba",
"3e58b6085f7d",
"29cadc65bcbb",
"0a23a5e47479",
"e8ba61988aec",
"cbe48ad190bf"
]
}
},
File diff suppressed because it is too large Load Diff
@@ -4,11 +4,92 @@
"family": "tasks.task-list-linear",
"namedDeltas": [],
"values": {
"1a5f65e0078d": {
"029bb83f402f": {
"name": "error",
"ordinal": 21,
"value": ""
},
"0a23a5e47479": {
"name": "loading",
"ordinal": 15,
"ordinal": 16,
"value": false
},
"0bb204f7f9f1": {
"name": "refreshing",
"ordinal": 28,
"value": false
},
"0e04c147819c": {
"name": "linear.listIssues#2",
"ordinal": 23,
"args": [
{
"name": "method",
"value": "linear.listIssues"
},
{
"name": "params",
"value": {
"filter": "all",
"limit": 50,
"workspaceId": "linear-workspace"
}
},
{
"name": "options",
"value": {
"$rpc": "absent"
}
}
],
"settlement": {
"status": "pending",
"startedAt": 0
}
},
"19d7ea49485f": {
"name": "linear.searchIssues#1",
"ordinal": 13,
"json": "{\"id\":\"frame-2\",\"deviceToken\":\"recording-device\",\"method\":\"linear.searchIssues\",\"params\":{\"query\":\"bug\",\"limit\":50,\"workspaceId\":\"linear-workspace\"}}"
},
"1d85d05c4c17": {
"name": "linear.searchIssues#1",
"ordinal": 12,
"args": [
{
"name": "method",
"value": "linear.searchIssues"
},
{
"name": "params",
"value": {
"limit": 50,
"query": "bug",
"workspaceId": "linear-workspace"
}
},
{
"name": "options",
"value": {
"$rpc": "absent"
}
}
],
"settlement": {
"status": "pending",
"startedAt": 0
}
},
"29cadc65bcbb": {
"name": "error",
"ordinal": 15,
"value": ""
},
"38bcf1ed5ff9": {
"name": "taskListSettled",
"ordinal": 29,
"value": true
},
"39f99cf479f0": {
"name": "error",
"ordinal": 1,
@@ -19,6 +100,41 @@
"ordinal": 10,
"value": ""
},
"3e58b6085f7d": {
"name": "items",
"ordinal": 14,
"value": [
{
"key": "linear:linear-workspace:issue-2",
"provider": "linear",
"source": {
"description": "",
"id": "issue-2",
"identifier": "ENG-2",
"labels": [],
"priority": 0,
"state": {
"color": "#000",
"name": "Todo",
"type": "unstarted"
},
"team": {
"id": "team-1",
"key": "ENG",
"name": "Engineering"
},
"title": "A found issue",
"updatedAt": "2020-01-01T00:00:00.000Z",
"url": "",
"workspaceId": "linear-workspace"
},
"status": "Todo",
"subtitle": "ENG-2 · Engineering",
"title": "A found issue",
"updatedAt": "2020-01-01T00:00:00.000Z"
}
]
},
"3edde845aed1": {
"error": "",
"items": [
@@ -60,15 +176,10 @@
"ordinal": 8,
"value": false
},
"427b7993fe85": {
"name": "error",
"ordinal": 20,
"value": ""
},
"531ad700826e": {
"name": "refreshing",
"ordinal": 27,
"value": false
"52e364aee6ba": {
"name": "loading",
"ordinal": 11,
"value": true
},
"5ac1816a09df": {
"name": "loading",
@@ -80,19 +191,24 @@
"ordinal": 2,
"value": true
},
"687501e36688": {
"657f394da6f5": {
"name": "taskListSettled",
"ordinal": 28,
"ordinal": 22,
"value": true
},
"7b6df16c2cf0": {
"name": "linear.listIssues#1",
"ordinal": 4,
"json": "{\"id\":\"frame-1\",\"deviceToken\":\"recording-device\",\"method\":\"linear.listIssues\",\"params\":{\"filter\":\"all\",\"limit\":50,\"workspaceId\":\"linear-workspace\"}}"
"6b7ab35b43f3": {
"name": "linear.listIssues#2",
"ordinal": 24,
"json": "{\"id\":\"frame-3\",\"deviceToken\":\"recording-device\",\"method\":\"linear.listIssues\",\"params\":{\"filter\":\"all\",\"limit\":50,\"workspaceId\":\"linear-workspace\"}}"
},
"8074cf69af1b": {
"6dd330aacfa2": {
"name": "error",
"ordinal": 26,
"value": ""
},
"6ee1eb7bc043": {
"name": "items",
"ordinal": 19,
"ordinal": 20,
"value": [
{
"key": "linear:linear-workspace:issue-1",
@@ -125,9 +241,191 @@
}
]
},
"82788025d560": {
"7b6df16c2cf0": {
"name": "linear.listIssues#1",
"ordinal": 4,
"json": "{\"id\":\"frame-1\",\"deviceToken\":\"recording-device\",\"method\":\"linear.listIssues\",\"params\":{\"filter\":\"all\",\"limit\":50,\"workspaceId\":\"linear-workspace\"}}"
},
"837199f7c720": {
"name": "linear.searchIssues#1",
"ordinal": 12,
"args": [
{
"name": "method",
"value": "linear.searchIssues"
},
{
"name": "params",
"value": {
"limit": 50,
"query": "bug",
"workspaceId": "linear-workspace"
}
},
{
"name": "options",
"value": {
"$rpc": "absent"
}
}
],
"settlement": {
"status": "fulfilled",
"startedAt": 0,
"settledAt": 0,
"value": {
"id": "frame-2",
"ok": true,
"result": [
{
"description": "",
"id": "issue-2",
"identifier": "ENG-2",
"labels": [],
"priority": 0,
"state": {
"color": "#000",
"name": "Todo",
"type": "unstarted"
},
"team": {
"id": "team-1",
"key": "ENG",
"name": "Engineering"
},
"title": "A found issue",
"updatedAt": "2020-01-01T00:00:00.000Z",
"url": "",
"workspaceId": "linear-workspace"
}
]
}
}
},
"9270aeb7d9c6": {
"status": "pending",
"startedAt": 0
},
"94caa29bceef": {
"name": "error",
"ordinal": 19,
"value": ""
},
"94f44b229d7d": {
"error": "",
"items": [
{
"key": "linear:linear-workspace:issue-1",
"provider": "linear",
"source": {
"description": "",
"id": "issue-1",
"identifier": "ENG-1",
"labels": [],
"priority": 0,
"state": {
"color": "#000",
"name": "Todo",
"type": "unstarted"
},
"team": {
"id": "team-1",
"key": "ENG",
"name": "Engineering"
},
"title": "A Linear issue",
"updatedAt": "2020-01-01T00:00:00.000Z",
"url": "",
"workspaceId": "linear-workspace"
},
"status": "Todo",
"subtitle": "ENG-1 · Engineering",
"title": "A Linear issue",
"updatedAt": "2020-01-01T00:00:00.000Z"
}
],
"loading": false,
"refreshing": false
},
"99f1aeb70deb": {
"error": "",
"items": [
{
"key": "linear:linear-workspace:issue-1",
"provider": "linear",
"source": {
"description": "",
"id": "issue-1",
"identifier": "ENG-1",
"labels": [],
"priority": 0,
"state": {
"color": "#000",
"name": "Todo",
"type": "unstarted"
},
"team": {
"id": "team-1",
"key": "ENG",
"name": "Engineering"
},
"title": "A Linear issue",
"updatedAt": "2020-01-01T00:00:00.000Z",
"url": "",
"workspaceId": "linear-workspace"
},
"status": "Todo",
"subtitle": "ENG-1 · Engineering",
"title": "A Linear issue",
"updatedAt": "2020-01-01T00:00:00.000Z"
}
],
"loading": true,
"refreshing": false
},
"b25e7c116f7e": {
"name": "items",
"ordinal": 5,
"value": [
{
"key": "linear:linear-workspace:issue-1",
"provider": "linear",
"source": {
"description": "",
"id": "issue-1",
"identifier": "ENG-1",
"labels": [],
"priority": 0,
"state": {
"color": "#000",
"name": "Todo",
"type": "unstarted"
},
"team": {
"id": "team-1",
"key": "ENG",
"name": "Engineering"
},
"title": "A Linear issue",
"updatedAt": "2020-01-01T00:00:00.000Z",
"url": "",
"workspaceId": "linear-workspace"
},
"status": "Todo",
"subtitle": "ENG-1 · Engineering",
"title": "A Linear issue",
"updatedAt": "2020-01-01T00:00:00.000Z"
}
]
},
"ba411b67de4b": {
"name": "taskListSettled",
"ordinal": 9,
"value": true
},
"c68fccc93876": {
"name": "linear.listIssues#2",
"ordinal": 22,
"ordinal": 23,
"args": [
{
"name": "method",
@@ -183,146 +481,6 @@
}
}
},
"915569974be9": {
"name": "loading",
"ordinal": 26,
"value": false
},
"9270aeb7d9c6": {
"status": "pending",
"startedAt": 0
},
"94f44b229d7d": {
"error": "",
"items": [
{
"key": "linear:linear-workspace:issue-1",
"provider": "linear",
"source": {
"description": "",
"id": "issue-1",
"identifier": "ENG-1",
"labels": [],
"priority": 0,
"state": {
"color": "#000",
"name": "Todo",
"type": "unstarted"
},
"team": {
"id": "team-1",
"key": "ENG",
"name": "Engineering"
},
"title": "A Linear issue",
"updatedAt": "2020-01-01T00:00:00.000Z",
"url": "",
"workspaceId": "linear-workspace"
},
"status": "Todo",
"subtitle": "ENG-1 · Engineering",
"title": "A Linear issue",
"updatedAt": "2020-01-01T00:00:00.000Z"
}
],
"loading": false,
"refreshing": false
},
"a27078adc061": {
"name": "items",
"ordinal": 13,
"value": [
{
"key": "linear:linear-workspace:issue-2",
"provider": "linear",
"source": {
"description": "",
"id": "issue-2",
"identifier": "ENG-2",
"labels": [],
"priority": 0,
"state": {
"color": "#000",
"name": "Todo",
"type": "unstarted"
},
"team": {
"id": "team-1",
"key": "ENG",
"name": "Engineering"
},
"title": "A found issue",
"updatedAt": "2020-01-01T00:00:00.000Z",
"url": "",
"workspaceId": "linear-workspace"
},
"status": "Todo",
"subtitle": "ENG-2 · Engineering",
"title": "A found issue",
"updatedAt": "2020-01-01T00:00:00.000Z"
}
]
},
"ab9026005b36": {
"name": "refreshing",
"ordinal": 16,
"value": false
},
"b25e7c116f7e": {
"name": "items",
"ordinal": 5,
"value": [
{
"key": "linear:linear-workspace:issue-1",
"provider": "linear",
"source": {
"description": "",
"id": "issue-1",
"identifier": "ENG-1",
"labels": [],
"priority": 0,
"state": {
"color": "#000",
"name": "Todo",
"type": "unstarted"
},
"team": {
"id": "team-1",
"key": "ENG",
"name": "Engineering"
},
"title": "A Linear issue",
"updatedAt": "2020-01-01T00:00:00.000Z",
"url": "",
"workspaceId": "linear-workspace"
},
"status": "Todo",
"subtitle": "ENG-1 · Engineering",
"title": "A Linear issue",
"updatedAt": "2020-01-01T00:00:00.000Z"
}
]
},
"b84d178fd4fa": {
"name": "taskListSettled",
"ordinal": 21,
"value": true
},
"ba411b67de4b": {
"name": "taskListSettled",
"ordinal": 9,
"value": true
},
"bf0de0571310": {
"name": "taskListSettled",
"ordinal": 17,
"value": true
},
"c40da88e1087": {
"name": "error",
"ordinal": 25,
"value": ""
},
"c6d55e6b8844": {
"name": "linear.listIssues#1",
"ordinal": 3,
@@ -381,14 +539,32 @@
}
}
},
"caf8f91bd626": {
"name": "error",
"cbe48ad190bf": {
"name": "taskListSettled",
"ordinal": 18,
"value": true
},
"e8ba61988aec": {
"name": "refreshing",
"ordinal": 17,
"value": false
},
"eb79a9b3682a": {
"status": "fulfilled",
"startedAt": 0,
"settledAt": 0,
"value": {
"$rpc": "undefined"
}
},
"f1dcb0c02c92": {
"name": "error",
"ordinal": 6,
"value": ""
},
"d2396a6354db": {
"f7948247f5de": {
"name": "items",
"ordinal": 24,
"ordinal": 25,
"value": [
{
"key": "linear:linear-workspace:issue-1",
@@ -421,145 +597,10 @@
}
]
},
"dd5be60ee9f9": {
"name": "linear.searchIssues#1",
"ordinal": 11,
"args": [
{
"name": "method",
"value": "linear.searchIssues"
},
{
"name": "params",
"value": {
"limit": 50,
"query": "bug",
"workspaceId": "linear-workspace"
}
},
{
"name": "options",
"value": {
"$rpc": "absent"
}
}
],
"settlement": {
"status": "fulfilled",
"startedAt": 0,
"settledAt": 0,
"value": {
"id": "frame-2",
"ok": true,
"result": [
{
"description": "",
"id": "issue-2",
"identifier": "ENG-2",
"labels": [],
"priority": 0,
"state": {
"color": "#000",
"name": "Todo",
"type": "unstarted"
},
"team": {
"id": "team-1",
"key": "ENG",
"name": "Engineering"
},
"title": "A found issue",
"updatedAt": "2020-01-01T00:00:00.000Z",
"url": "",
"workspaceId": "linear-workspace"
}
]
}
}
},
"e3642939f5f6": {
"name": "linear.searchIssues#1",
"ordinal": 12,
"json": "{\"id\":\"frame-2\",\"deviceToken\":\"recording-device\",\"method\":\"linear.searchIssues\",\"params\":{\"query\":\"bug\",\"limit\":50,\"workspaceId\":\"linear-workspace\"}}"
},
"eb79a9b3682a": {
"status": "fulfilled",
"startedAt": 0,
"settledAt": 0,
"value": {
"$rpc": "undefined"
}
},
"ee67e864ea01": {
"name": "linear.listIssues#2",
"ordinal": 23,
"json": "{\"id\":\"frame-3\",\"deviceToken\":\"recording-device\",\"method\":\"linear.listIssues\",\"params\":{\"filter\":\"all\",\"limit\":50,\"workspaceId\":\"linear-workspace\"}}"
},
"ef8932b03a8c": {
"name": "error",
"ordinal": 14,
"value": ""
},
"f1dcb0c02c92": {
"name": "error",
"ordinal": 6,
"value": ""
},
"f310b6adb00d": {
"name": "linear.searchIssues#1",
"ordinal": 11,
"args": [
{
"name": "method",
"value": "linear.searchIssues"
},
{
"name": "params",
"value": {
"limit": 50,
"query": "bug",
"workspaceId": "linear-workspace"
}
},
{
"name": "options",
"value": {
"$rpc": "absent"
}
}
],
"settlement": {
"status": "pending",
"startedAt": 0
}
},
"fdc3528e1a4e": {
"name": "linear.listIssues#2",
"ordinal": 22,
"args": [
{
"name": "method",
"value": "linear.listIssues"
},
{
"name": "params",
"value": {
"filter": "all",
"limit": 50,
"workspaceId": "linear-workspace"
}
},
{
"name": "options",
"value": {
"$rpc": "absent"
}
}
],
"settlement": {
"status": "pending",
"startedAt": 0
}
"fe892b7f7693": {
"name": "loading",
"ordinal": 27,
"value": false
}
},
"recording": {
@@ -589,15 +630,15 @@
{
"id": "second-filter-pending",
"observation": {
"sender": ["c6d55e6b8844", "f310b6adb00d"],
"payloads": ["7b6df16c2cf0", "e3642939f5f6"],
"sender": ["c6d55e6b8844", "1d85d05c4c17"],
"payloads": ["7b6df16c2cf0", "19d7ea49485f"],
"settlements": {
"mount": "eb79a9b3682a",
"load-0": "eb79a9b3682a",
"set-query-1": "eb79a9b3682a",
"load-2": "9270aeb7d9c6"
},
"state": "94f44b229d7d",
"state": "99f1aeb70deb",
"effects": [
"39f99cf479f0",
"609f32a21704",
@@ -606,15 +647,16 @@
"5ac1816a09df",
"411aee2eccd9",
"ba411b67de4b",
"3aefb3006914"
"3aefb3006914",
"52e364aee6ba"
]
}
},
{
"id": "second-filter-settled",
"observation": {
"sender": ["c6d55e6b8844", "dd5be60ee9f9"],
"payloads": ["7b6df16c2cf0", "e3642939f5f6"],
"sender": ["c6d55e6b8844", "837199f7c720"],
"payloads": ["7b6df16c2cf0", "19d7ea49485f"],
"settlements": {
"mount": "eb79a9b3682a",
"load-0": "eb79a9b3682a",
@@ -631,19 +673,20 @@
"411aee2eccd9",
"ba411b67de4b",
"3aefb3006914",
"a27078adc061",
"ef8932b03a8c",
"1a5f65e0078d",
"ab9026005b36",
"bf0de0571310"
"52e364aee6ba",
"3e58b6085f7d",
"29cadc65bcbb",
"0a23a5e47479",
"e8ba61988aec",
"cbe48ad190bf"
]
}
},
{
"id": "first-filter-back-pending",
"observation": {
"sender": ["c6d55e6b8844", "dd5be60ee9f9", "fdc3528e1a4e"],
"payloads": ["7b6df16c2cf0", "e3642939f5f6", "ee67e864ea01"],
"sender": ["c6d55e6b8844", "837199f7c720", "0e04c147819c"],
"payloads": ["7b6df16c2cf0", "19d7ea49485f", "6b7ab35b43f3"],
"settlements": {
"mount": "eb79a9b3682a",
"load-0": "eb79a9b3682a",
@@ -662,23 +705,24 @@
"411aee2eccd9",
"ba411b67de4b",
"3aefb3006914",
"a27078adc061",
"ef8932b03a8c",
"1a5f65e0078d",
"ab9026005b36",
"bf0de0571310",
"caf8f91bd626",
"8074cf69af1b",
"427b7993fe85",
"b84d178fd4fa"
"52e364aee6ba",
"3e58b6085f7d",
"29cadc65bcbb",
"0a23a5e47479",
"e8ba61988aec",
"cbe48ad190bf",
"94caa29bceef",
"6ee1eb7bc043",
"029bb83f402f",
"657f394da6f5"
]
}
},
{
"id": "first-filter-back-settled",
"observation": {
"sender": ["c6d55e6b8844", "dd5be60ee9f9", "82788025d560"],
"payloads": ["7b6df16c2cf0", "e3642939f5f6", "ee67e864ea01"],
"sender": ["c6d55e6b8844", "837199f7c720", "c68fccc93876"],
"payloads": ["7b6df16c2cf0", "19d7ea49485f", "6b7ab35b43f3"],
"settlements": {
"mount": "eb79a9b3682a",
"load-0": "eb79a9b3682a",
@@ -697,20 +741,21 @@
"411aee2eccd9",
"ba411b67de4b",
"3aefb3006914",
"a27078adc061",
"ef8932b03a8c",
"1a5f65e0078d",
"ab9026005b36",
"bf0de0571310",
"caf8f91bd626",
"8074cf69af1b",
"427b7993fe85",
"b84d178fd4fa",
"d2396a6354db",
"c40da88e1087",
"915569974be9",
"531ad700826e",
"687501e36688"
"52e364aee6ba",
"3e58b6085f7d",
"29cadc65bcbb",
"0a23a5e47479",
"e8ba61988aec",
"cbe48ad190bf",
"94caa29bceef",
"6ee1eb7bc043",
"029bb83f402f",
"657f394da6f5",
"f7948247f5de",
"6dd330aacfa2",
"fe892b7f7693",
"0bb204f7f9f1",
"38bcf1ed5ff9"
]
}
}
+124 -118
View File
@@ -4,11 +4,21 @@
"family": "tasks.task-list-linear",
"namedDeltas": [],
"values": {
"1a5f65e0078d": {
"0a23a5e47479": {
"name": "loading",
"ordinal": 15,
"ordinal": 16,
"value": false
},
"19d7ea49485f": {
"name": "linear.searchIssues#1",
"ordinal": 13,
"json": "{\"id\":\"frame-2\",\"deviceToken\":\"recording-device\",\"method\":\"linear.searchIssues\",\"params\":{\"query\":\"bug\",\"limit\":50,\"workspaceId\":\"linear-workspace\"}}"
},
"29cadc65bcbb": {
"name": "error",
"ordinal": 15,
"value": ""
},
"39f99cf479f0": {
"name": "error",
"ordinal": 1,
@@ -19,6 +29,41 @@
"ordinal": 10,
"value": ""
},
"3e58b6085f7d": {
"name": "items",
"ordinal": 14,
"value": [
{
"key": "linear:linear-workspace:issue-2",
"provider": "linear",
"source": {
"description": "",
"id": "issue-2",
"identifier": "ENG-2",
"labels": [],
"priority": 0,
"state": {
"color": "#000",
"name": "Todo",
"type": "unstarted"
},
"team": {
"id": "team-1",
"key": "ENG",
"name": "Engineering"
},
"title": "A found issue",
"updatedAt": "2020-01-01T00:00:00.000Z",
"url": "",
"workspaceId": "linear-workspace"
},
"status": "Todo",
"subtitle": "ENG-2 · Engineering",
"title": "A found issue",
"updatedAt": "2020-01-01T00:00:00.000Z"
}
]
},
"3edde845aed1": {
"error": "",
"items": [
@@ -60,6 +105,11 @@
"ordinal": 8,
"value": false
},
"52e364aee6ba": {
"name": "loading",
"ordinal": 11,
"value": true
},
"5ac1816a09df": {
"name": "loading",
"ordinal": 7,
@@ -75,6 +125,62 @@
"ordinal": 4,
"json": "{\"id\":\"frame-1\",\"deviceToken\":\"recording-device\",\"method\":\"linear.listIssues\",\"params\":{\"filter\":\"all\",\"limit\":50,\"workspaceId\":\"linear-workspace\"}}"
},
"837199f7c720": {
"name": "linear.searchIssues#1",
"ordinal": 12,
"args": [
{
"name": "method",
"value": "linear.searchIssues"
},
{
"name": "params",
"value": {
"limit": 50,
"query": "bug",
"workspaceId": "linear-workspace"
}
},
{
"name": "options",
"value": {
"$rpc": "absent"
}
}
],
"settlement": {
"status": "fulfilled",
"startedAt": 0,
"settledAt": 0,
"value": {
"id": "frame-2",
"ok": true,
"result": [
{
"description": "",
"id": "issue-2",
"identifier": "ENG-2",
"labels": [],
"priority": 0,
"state": {
"color": "#000",
"name": "Todo",
"type": "unstarted"
},
"team": {
"id": "team-1",
"key": "ENG",
"name": "Engineering"
},
"title": "A found issue",
"updatedAt": "2020-01-01T00:00:00.000Z",
"url": "",
"workspaceId": "linear-workspace"
}
]
}
}
},
"94f44b229d7d": {
"error": "",
"items": [
@@ -111,46 +217,6 @@
"loading": false,
"refreshing": false
},
"a27078adc061": {
"name": "items",
"ordinal": 13,
"value": [
{
"key": "linear:linear-workspace:issue-2",
"provider": "linear",
"source": {
"description": "",
"id": "issue-2",
"identifier": "ENG-2",
"labels": [],
"priority": 0,
"state": {
"color": "#000",
"name": "Todo",
"type": "unstarted"
},
"team": {
"id": "team-1",
"key": "ENG",
"name": "Engineering"
},
"title": "A found issue",
"updatedAt": "2020-01-01T00:00:00.000Z",
"url": "",
"workspaceId": "linear-workspace"
},
"status": "Todo",
"subtitle": "ENG-2 · Engineering",
"title": "A found issue",
"updatedAt": "2020-01-01T00:00:00.000Z"
}
]
},
"ab9026005b36": {
"name": "refreshing",
"ordinal": 16,
"value": false
},
"b25e7c116f7e": {
"name": "items",
"ordinal": 5,
@@ -191,11 +257,6 @@
"ordinal": 9,
"value": true
},
"bf0de0571310": {
"name": "taskListSettled",
"ordinal": 17,
"value": true
},
"c6d55e6b8844": {
"name": "linear.listIssues#1",
"ordinal": 3,
@@ -254,66 +315,15 @@
}
}
},
"dd5be60ee9f9": {
"name": "linear.searchIssues#1",
"ordinal": 11,
"args": [
{
"name": "method",
"value": "linear.searchIssues"
},
{
"name": "params",
"value": {
"limit": 50,
"query": "bug",
"workspaceId": "linear-workspace"
}
},
{
"name": "options",
"value": {
"$rpc": "absent"
}
}
],
"settlement": {
"status": "fulfilled",
"startedAt": 0,
"settledAt": 0,
"value": {
"id": "frame-2",
"ok": true,
"result": [
{
"description": "",
"id": "issue-2",
"identifier": "ENG-2",
"labels": [],
"priority": 0,
"state": {
"color": "#000",
"name": "Todo",
"type": "unstarted"
},
"team": {
"id": "team-1",
"key": "ENG",
"name": "Engineering"
},
"title": "A found issue",
"updatedAt": "2020-01-01T00:00:00.000Z",
"url": "",
"workspaceId": "linear-workspace"
}
]
}
}
"cbe48ad190bf": {
"name": "taskListSettled",
"ordinal": 18,
"value": true
},
"e3642939f5f6": {
"name": "linear.searchIssues#1",
"ordinal": 12,
"json": "{\"id\":\"frame-2\",\"deviceToken\":\"recording-device\",\"method\":\"linear.searchIssues\",\"params\":{\"query\":\"bug\",\"limit\":50,\"workspaceId\":\"linear-workspace\"}}"
"e8ba61988aec": {
"name": "refreshing",
"ordinal": 17,
"value": false
},
"eb79a9b3682a": {
"status": "fulfilled",
@@ -323,11 +333,6 @@
"$rpc": "undefined"
}
},
"ef8932b03a8c": {
"name": "error",
"ordinal": 14,
"value": ""
},
"f1dcb0c02c92": {
"name": "error",
"ordinal": 6,
@@ -383,8 +388,8 @@
{
"id": "load-settled",
"observation": {
"sender": ["c6d55e6b8844", "dd5be60ee9f9"],
"payloads": ["7b6df16c2cf0", "e3642939f5f6"],
"sender": ["c6d55e6b8844", "837199f7c720"],
"payloads": ["7b6df16c2cf0", "19d7ea49485f"],
"settlements": {
"mount": "eb79a9b3682a",
"load-0": "eb79a9b3682a",
@@ -401,11 +406,12 @@
"411aee2eccd9",
"ba411b67de4b",
"3aefb3006914",
"a27078adc061",
"ef8932b03a8c",
"1a5f65e0078d",
"ab9026005b36",
"bf0de0571310"
"52e364aee6ba",
"3e58b6085f7d",
"29cadc65bcbb",
"0a23a5e47479",
"e8ba61988aec",
"cbe48ad190bf"
]
}
}
@@ -1,33 +0,0 @@
import { describe, expect, it } from 'vitest'
import { resolveDiagnosticsHostId } from './connection-diagnostics-screen-data'
import type { HostProfile } from '../host-catalog/host-profile'
const host = (id: string): HostProfile => ({
id,
name: id,
endpoint: 'ws://192.168.1.2:6768',
deviceToken: 'token',
publicKeyB64: 'key',
lastConnected: 0
})
describe('connection diagnostics screen data', () => {
it('applies route changes synchronously without discarding a chip choice for the same route', () => {
const hosts = [host('a'), host('b')]
expect(resolveDiagnosticsHostId(hosts, undefined, null)).toBe('a')
expect(resolveDiagnosticsHostId(hosts, 'b', { hostId: 'a', requestedHostId: 'a' })).toBe('b')
expect(resolveDiagnosticsHostId(hosts, 'b', { hostId: 'a', requestedHostId: 'b' })).toBe('a')
})
it('does not revive a stale manual choice when routing away and back', () => {
const hosts = [host('a'), host('b'), host('c')]
const firstRouteA = {}
const routeC = {}
const secondRouteA = {}
const manualSelection = { hostId: 'b', requestedHostId: 'a', routeKey: firstRouteA }
expect(resolveDiagnosticsHostId(hosts, 'c', manualSelection, routeC)).toBe('c')
expect(resolveDiagnosticsHostId(hosts, 'a', manualSelection, secondRouteA)).toBe('a')
})
})
@@ -1,70 +0,0 @@
import { describe, expect, it, vi } from 'vitest'
import {
installChatViewHooks,
bannerText,
pressSend,
render,
update
} from './MobileNativeChatView.harness.test-fixture'
vi.mock('react-native', async () => {
const { reactNativeStub } = await import('./MobileNativeChatView.render-stubs.test-fixture')
return reactNativeStub()
})
vi.mock('react-native-safe-area-context', () => ({
useSafeAreaInsets: () => ({ top: 0, bottom: 0, left: 0, right: 0 })
}))
vi.mock('react-native-gesture-handler', async () => {
const { gestureHandlerStub } = await import('./MobileNativeChatView.render-stubs.test-fixture')
return gestureHandlerStub()
})
vi.mock('lucide-react-native', () => ({
ArrowDown: 'ArrowDown',
ChevronsDownUp: 'ChevronsDownUp',
ChevronsUpDown: 'ChevronsUpDown',
Square: 'Square'
}))
vi.mock('./transcript/MobileNativeChatMessage', () => ({
MobileNativeChatMessage: 'ChatMessage'
}))
vi.mock('./transcript/MobileNativeChatLiveLine', () => ({
MobileNativeChatLiveLine: 'LiveStatus'
}))
vi.mock('./input/MobileNativeChatAsk', () => ({ MobileNativeChatAsk: 'ChatAsk' }))
vi.mock('./input/MobileNativeChatPermission', () => ({
MobileNativeChatPermission: 'ChatPermission'
}))
vi.mock('./input/MobileNativeChatQuestion', () => ({
MobileNativeChatQuestion: 'ChatQuestion'
}))
vi.mock('../../components/ActionSheetModal', () => ({ ActionSheetModal: 'ActionSheetModal' }))
vi.mock('./composer/MobileNativeChatComposer', async () => {
const { composerStub } = await import('./MobileNativeChatView.render-stubs.test-fixture')
return composerStub()
})
describe('MobileNativeChatView: send and read failure banners', () => {
installChatViewHooks()
it('retires the previous banner before sending and preserves the new delivery notice', async () => {
const onClearSendError = vi.fn()
await render({
sendErrorMessage: 'Stop failed',
onClearSendError,
onSend: async () => {
expect(onClearSendError).toHaveBeenCalledOnce()
await update({ sendErrorMessage: 'Delivery unconfirmed' })
return true
}
})
await pressSend()
expect(onClearSendError).toHaveBeenCalledOnce()
expect(bannerText()).toBe('Delivery unconfirmed')
})
})
vi.mock('./input/MobileQueuedMessageComposer', () => ({
MobileQueuedMessageComposer: 'QueuedMessageComposer'
}))
@@ -1,189 +0,0 @@
import { resolveMobileNativeChatRowProps } from './transcript/use-mobile-native-chat-row-props'
import { createElement, type ReactElement } from 'react'
import { act, create, type ReactTestInstance, type ReactTestRenderer } from 'react-test-renderer'
import { afterEach, beforeEach, expect, vi } from 'vitest'
import type { NativeChatMessage } from '../../../../src/shared/native-chat/native-chat-types'
import { MobileNativeChatView } from './MobileNativeChatView'
import { setMobileNativeChatDraftText } from './composer/mobile-native-chat-draft-store'
import {
scrollToEnd,
scrollToOffset,
pageScroller
} from './MobileNativeChatView.render-stubs.test-fixture'
vi.mock('../../components/DragReorderList', () => ({ DragReorderList: 'DragReorderList' }))
vi.mock('react-native-reanimated', async () => {
const { useRef } = await import('react')
return {
default: { ScrollView: 'ScrollView' },
useAnimatedRef: () => useRef(null),
useSharedValue: (value: unknown) => useRef({ value }).current
}
})
export type Overrides = {
messages?: Parameters<typeof MobileNativeChatView>[0]['messages']
folded?: Parameters<typeof MobileNativeChatView>[0]['folded']
streaming?: string | null
sendErrorMessage?: string | null
onClearSendError?: () => void
inputLockReason?: 'disconnected' | 'waiting' | null
composerText?: string
onSend?: (text: string) => Promise<boolean>
pending?: Parameters<typeof MobileNativeChatView>[0]['pending']
structuredActivityUi?: boolean
turnIndicator?: Parameters<typeof MobileNativeChatView>[0]['turnIndicator']
agentWorking?: boolean
canStop?: boolean
ask?: Parameters<typeof MobileNativeChatView>[0]['ask']
askRequiresTerminal?: boolean
collapsedPrompt?: Parameters<typeof MobileNativeChatView>[0]['collapsedPrompt']
micActive?: boolean
micProcessing?: boolean
composerTray?: Parameters<typeof MobileNativeChatView>[0]['composerTray']
question?: Parameters<typeof MobileNativeChatView>[0]['question']
permission?: Parameters<typeof MobileNativeChatView>[0]['permission']
sendSurfaceId?: string
keyboardInset?: number
hasMore?: boolean
olderPages?: Parameters<typeof MobileNativeChatView>[0]['olderPages']
onLoadEarlier?: () => void
status?: Parameters<typeof MobileNativeChatView>[0]['status']
error?: string
readFailedFinally?: boolean
actionablePromptIds?: readonly string[]
}
export function assistantTurn(id: string, text: string): NativeChatMessage {
return { id, role: 'assistant', blocks: [{ type: 'text', text }], timestamp: 0, source: 'hook' }
}
const DRAFT_KEY = 'draft-a'
function chatViewElement({
composerText = '',
...overrides
}: Overrides): ReturnType<typeof createElement> {
setMobileNativeChatDraftText(DRAFT_KEY, composerText)
return createElement(MobileNativeChatView, {
messages: [],
folded: [],
status: 'ready',
streaming: null,
onSend: vi.fn().mockResolvedValue(true),
sendSurfaceId: 'tab-a',
getSendCompletionGeneration: () => 0,
getComposerEditGeneration: () => 0,
pending: [],
draftKey: DRAFT_KEY,
onComposerTextChange: vi.fn(),
...overrides
})
}
let renderer: ReactTestRenderer | null = null
export function installChatViewHooks(): void {
beforeEach(() => {
vi.stubGlobal('requestAnimationFrame', (callback: FrameRequestCallback) =>
setTimeout(() => callback(0), 0)
)
vi.stubGlobal('cancelAnimationFrame', (handle: ReturnType<typeof setTimeout>) =>
clearTimeout(handle)
)
})
afterEach(() => {
act(() => renderer?.unmount())
renderer = null
scrollToEnd.mockReset()
scrollToOffset.mockReset()
Object.assign(pageScroller, { scrollTop: 0, scrollHeight: 0, clientHeight: 500 })
vi.unstubAllGlobals()
})
}
export function root(): ReactTestInstance {
return renderer!.root
}
// Mocked react-native components are string tags that ReactTestInstance's ElementType omits.
export function hostType(node: ReactTestInstance): unknown {
return node.type
}
export async function render(overrides: Overrides = {}): Promise<void> {
await act(async () => {
renderer = create(chatViewElement(overrides))
})
}
export async function update(overrides: Overrides = {}): Promise<void> {
await act(async () => {
renderer?.update(chatViewElement(overrides))
})
}
export function listIds(): string[] {
return (list().props.data as { id: string }[]).map((row) => row.id)
}
export function list(): ReactTestInstance {
return renderer!.root.find((node) => hostType(node) === 'FlatList')
}
export function renderedRow(id: string): ReactElement<Record<string, unknown>> {
const listNode = list()
const data = listNode.props.data as NativeChatMessage[]
const index = data.findIndex((row) => row.id === id)
const row = listNode.props.renderItem({ item: data[index], index })
const resolved = resolveMobileNativeChatRowProps(index, data[index]!, row.props.lookups)
return createElement('Row', { ...row.props, ...resolved })
}
export function banners(): ReactTestInstance[] {
return renderer!.root.findAll((node) => node.props.accessibilityRole === 'alert')
}
export function composer(): ReactTestInstance {
return renderer!.root.find((node) => hostType(node) === 'Composer')
}
export function bannerText(): string {
const [alert, ...rest] = banners()
expect(rest).toHaveLength(0)
return alert
.findAll((node) => hostType(node) === 'Text')
.map((node) => node.props.children)
.join('')
}
export async function pressSend(): Promise<void> {
const composer = renderer!.root.find((node) => hostType(node) === 'Composer')
await act(async () => {
await composer.props.onPress()
})
}
export function scrollEvent(y: number, contentHeight: number) {
return {
nativeEvent: {
contentOffset: { y },
contentSize: { height: contentHeight },
layoutMeasurement: { height: 500 }
}
}
}
export async function scrollAwayFromTail(): Promise<void> {
await act(async () => {
list().props.onScrollBeginDrag?.({})
list().props.onScroll({
nativeEvent: {
contentOffset: { y: 200 },
contentSize: { height: 1_200 },
layoutMeasurement: { height: 500 }
}
})
})
}
@@ -1,90 +0,0 @@
import { vi } from 'vitest'
const scrollToEnd = vi.hoisted(() => vi.fn())
const scrollToOffset = vi.hoisted(() => vi.fn())
const platform = vi.hoisted(() => ({ OS: 'ios' }))
const pageScroller = vi.hoisted(() => ({
scrollTop: 0,
scrollHeight: 0,
clientHeight: 500,
getInnerViewNode: () => ({}),
getBoundingClientRect: () => ({ top: 0, bottom: 500 }),
getAttribute: () => null,
querySelectorAll: () => [],
querySelector: () => null,
addEventListener: () => {},
removeEventListener: () => {}
}))
export async function reactNativeStub() {
const React = await import('react')
const { reactNativeMotionStub } = await import('../../test-support/react-native-motion-stub')
return {
...reactNativeMotionStub(),
ActivityIndicator: 'ActivityIndicator',
FlatList: React.forwardRef((props, ref) => {
const handle = { scrollToEnd, scrollToOffset, getScrollableNode: () => pageScroller }
React.useImperativeHandle(ref, () => handle, [])
return React.createElement('FlatList', props)
}),
Platform: platform,
Pressable: 'Pressable',
ScrollView: React.forwardRef((props, ref) => {
const handle = {
scrollTo: ({ y, animated }: { y: number; animated: boolean }) =>
scrollToOffset({ animated, offset: y }),
scrollToEnd,
getScrollableNode: () => pageScroller,
getInnerViewNode: () => pageScroller.getInnerViewNode()
}
React.useImperativeHandle(ref, () => handle, [])
return React.createElement('ScrollView', props)
}),
StyleSheet: { create: (styles: unknown) => styles, hairlineWidth: 1 },
Text: 'Text',
View: 'View'
}
}
export function gestureHandlerStub() {
const chain = {
runOnJS: () => chain,
onStart: () => chain,
onUpdate: () => chain
}
return {
Gesture: { Simultaneous: () => ({}), Native: () => ({}), Pinch: () => chain },
GestureDetector: 'GestureDetector',
GestureHandlerRootView: 'GestureHandlerRootView'
}
}
export async function composerStub() {
const React = await import('react')
const { MobileNativeChatStopButton } = await import('./input/MobileNativeChatStopButton')
const { useMobileNativeChatDraft } = await import('./composer/mobile-native-chat-draft-store')
return {
MobileNativeChatDraftComposer: ({
draftKey,
...props
}: {
draftKey: string | null
onSend: (text: string) => Promise<boolean>
disabled?: boolean
placeholder?: string
stop?: { onStop?: () => void; held: boolean } | null
}) =>
React.createElement(
'Composer',
{
...props,
value: useMobileNativeChatDraft(draftKey),
accessibilityLabel: 'Send message',
onPress: () => props.onSend('hi')
},
props.stop ? React.createElement(MobileNativeChatStopButton, props.stop) : null
)
}
}
export { scrollToEnd, scrollToOffset, platform, pageScroller }
@@ -1,65 +0,0 @@
import { createElement } from 'react'
import { act, create, type ReactTestRenderer } from 'react-test-renderer'
import { afterEach, describe, expect, it, vi } from 'vitest'
import { useMobileNativeChatDrafts } from './use-mobile-native-chat-drafts'
import {
closeMobileNativeChatTabDraft,
useMobileNativeChatDraft
} from './mobile-native-chat-draft-store'
import { loadMobileNativeChatDrafts } from './mobile-native-chat-draft-persistence'
vi.mock('@react-native-async-storage/async-storage', async () => {
const { createInMemoryAsyncStorage } =
await import('../../../test-support/in-memory-async-storage')
return { default: createInMemoryAsyncStorage() }
})
describe('useMobileNativeChatDrafts with queued cards', () => {
let renderer: ReactTestRenderer | null = null
let state: (ReturnType<typeof useMobileNativeChatDrafts> & { composerText: string }) | null = null
afterEach(async () => {
act(() => renderer?.unmount())
await loadMobileNativeChatDrafts('host', 'worktree')
closeMobileNativeChatTabDraft('host\0worktree\0a')
await loadMobileNativeChatDrafts('host', 'worktree')
renderer = null
state = null
})
function Harness(): null {
const drafts = useMobileNativeChatDrafts({
hostId: 'host',
worktreeId: 'worktree',
tabId: 'a',
sessionId: 'session-a',
messages: [],
launchDraft: null,
transcriptLoading: false,
transcriptSettled: true
})
state = { ...drafts, composerText: useMobileNativeChatDraft(drafts.draftKey) }
return null
}
async function render(): Promise<void> {
await act(async () => {
renderer = create(createElement(Harness))
})
}
it("reports whether a queued card's Edit copy landed, so Edit never deletes text it did not keep", async () => {
await render()
let copied: boolean | undefined
act(() => {
copied = state?.appendComposerText('')
})
expect(copied).toBe(false)
act(() => {
copied = state?.appendComposerText('edited text')
})
expect(copied).toBe(true)
expect(state?.composerText).toBe('edited text')
})
})
@@ -19,15 +19,19 @@ function MobileNativeChatPermissionImpl({
permission,
onRespond,
onCancel,
onCollapse
onCollapse,
onAnswerInTerminal
}: {
permission: MobileChatPermission
onRespond: (send: string) => Promise<boolean>
/** Shown when the card has no options: only the terminal can answer it. */
onAnswerInTerminal?: () => void
onCancel?: (prompt?: NonNullable<MobileChatPermission['prompt']>) => Promise<boolean>
// Collapse writes nothing to the agent.
onCollapse?: () => void
}): React.JSX.Element {
useMobileColorScheme()
const t = useMobileTranslation()
const [submitting, setSubmitting] = useState(false)
const submittingRef = useRef(false)
// Unknown newer-host subjects allow only cancellation; preserve their detail for the reader.
@@ -66,7 +70,7 @@ function MobileNativeChatPermissionImpl({
<MobileNativeChatPermissionContext permission={permission} newerSubject={newerSubject} />
<View testID="native-chat-approval-actions" style={styles.options}>
{permission.options.map((option, index) => {
const isPrimary = index === 0
const isPrimary = index === 0 && !permission.neutralOptions
return (
<Pressable
key={`${option.send}:${option.label}`}
@@ -86,6 +90,22 @@ function MobileNativeChatPermissionImpl({
</Pressable>
)
})}
{permission.options.length === 0 && onAnswerInTerminal ? (
<Pressable
accessibilityRole="button"
style={({ pressed }) => [
styles.option,
styles.optionPrimary,
pressed && styles.optionPressed
]}
hitSlop={6}
onPress={onAnswerInTerminal}
>
<Text style={[styles.optionText, styles.optionTextPrimary]}>
{t('chat.promptCard.answerInTerminal', 'Answer in terminal')}
</Text>
</Pressable>
) : null}
</View>
</View>
)
@@ -239,6 +259,8 @@ const styles = themedStyleSheet(() => ({
},
option: {
minHeight: 44,
// A long menu label wraps inside its button instead of running off the card.
maxWidth: '100%',
justifyContent: 'center',
paddingHorizontal: spacing.md,
paddingVertical: spacing.sm,
@@ -123,11 +123,13 @@ export function MobileNativeChatPromptCard({
/>
) : permission ? (
<MobileNativeChatPermission
key={JSON.stringify(permission)}
// Re-aimed options stay one occurrence, so an in-flight answer keeps its card locked.
key={JSON.stringify({ ...permission, options: undefined })}
permission={permission}
onRespond={async (send) => (await onRespondPermission?.(send)) ?? false}
onCancel={onCancelPrompt}
onCollapse={onCollapsePrompt}
onAnswerInTerminal={onAnswerInTerminal}
/>
) : question?.questions ? (
<MobileNativeChatStructuredAsk
@@ -45,7 +45,10 @@ export function useMobileNativeChatPromptCards({
handleNativeChatQuestionAnswer: structured?.respondQuestion,
// A card's X stops its turn; a Pi dialog can open with no turn running, and then nothing can.
handleNativeChatCancelPrompt: structured?.turnId ? cancel : undefined,
collapseNativeChatPrompt: structured ? undefined : presentation.collapsePrompt,
collapseNativeChatPrompt:
structured || presentation.permission?.holdsComposer
? undefined
: presentation.collapsePrompt,
nativeChatCollapsedPrompt: structured ? null : presentation.collapsed
}
}
@@ -0,0 +1,57 @@
import { createElement } from 'react'
import { act, create } from 'react-test-renderer'
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
import { useMobileNativeChatPromptPresentation } from './use-mobile-native-chat-prompt-presentation'
import { mobileNativeChatPromptDismissals } from './mobile-native-chat-prompt-dismissals'
import type { MobileChatPermission } from './mobile-native-chat-permission'
const permission = (holdsComposer?: true): MobileChatPermission => ({
...(holdsComposer ? { holdsComposer } : {}),
title: 'Trust this folder?',
options: [{ label: 'Trust folder', send: '\r' }]
})
describe('useMobileNativeChatPromptPresentation', () => {
let renderer = { unmount: () => {}, update: (_element: ReturnType<typeof createElement>) => {} }
let state: ReturnType<typeof useMobileNativeChatPromptPresentation> | null = null
beforeEach(() => mobileNativeChatPromptDismissals.clearForTests())
afterEach(() => {
act(() => renderer.unmount())
})
function Harness({ shown }: { shown: MobileChatPermission | null }): null {
state = useMobileNativeChatPromptPresentation({
permission: shown,
waitStartedAt: 1,
scopeKey: 'tab-1',
sessionKey: 'session-1',
observing: true,
respondPermission: async () => true
})
return null
}
async function answer(shown: MobileChatPermission): Promise<void> {
await act(async () => {
renderer = create(createElement(Harness, { shown }))
})
await act(async () => {
await state?.respondPermission('\r')
})
}
it('hides an ordinary approval once its answer was accepted', async () => {
await answer(permission())
expect(state?.permission).toBeNull()
})
// Why: the folder-trust dialog is still on screen until the host settles it.
it('keeps a composer-holding card until its host status leaves', async () => {
const shown = permission(true)
await answer(shown)
expect(state?.permission).toBe(shown)
await act(async () => renderer.update(createElement(Harness, { shown: null })))
expect(state?.permission).toBeNull()
})
})
@@ -41,12 +41,13 @@ export function useMobileNativeChatPromptPresentation({
const respond = useCallback(
async (send: string): Promise<boolean> => {
const accepted = await respondPermission(send)
if (accepted) {
// A folder-trust dialog stays up until the host settles it; the card keeps the composer locked meanwhile.
if (accepted && !permission?.holdsComposer) {
dismissPrompt()
}
return accepted
},
[respondPermission, dismissPrompt]
[respondPermission, dismissPrompt, permission?.holdsComposer]
)
return {
occurrenceKey: promptKey === null ? null : JSON.stringify([scopeKey, sessionKey, promptKey]),
@@ -1,14 +0,0 @@
// @vitest-environment happy-dom
import { expect, it } from 'vitest'
import { MobileNativeChatScrollRoots } from './mobile-native-chat-scroll-roots'
it("forgets a closed tool line's nested command and output positions, not its neighbours'", () => {
const at = { top: 30, followsEnd: false }
const memory = new Map(
['run:o', 'run:o/line:a:command', 'run:o/line:a:output', 'line:a:command']
.concat(['run:o/line:ab:command', 'diff:src/line:a.ts'])
.map((address) => [address, at] as const)
)
new MobileNativeChatScrollRoots(memory, 10).forget('line:a')
expect([...memory.keys()]).toEqual(['run:o', 'run:o/line:ab:command', 'diff:src/line:a.ts'])
})
@@ -1,41 +0,0 @@
import { describe, expect, it } from 'vitest'
import {
createNativeChatMerger,
replaceList
} from '../../../../../src/shared/native-chat/native-chat-merge'
import type { NativeChatMessage } from '../../../../../src/shared/native-chat/native-chat-types'
import { applyMobileNativeChatStreamFrame } from './mobile-native-chat-stream-frame'
function message(id: string): NativeChatMessage {
return {
id,
role: 'assistant',
blocks: [{ type: 'text', text: id }],
timestamp: 0,
source: 'transcript'
}
}
describe('applyMobileNativeChatStreamFrame', () => {
it('replaces a partially overlapping replay that no longer extends the retained tail', () => {
const merger = createNativeChatMerger()
replaceList(merger, ['old-1', 'shared', 'old-tail'].map(message))
// Keep hasMore true so only the contiguity check can reject the interleaved row.
const replay = [message('shared'), message('compacted-summary'), message('old-tail')]
expect(
applyMobileNativeChatStreamFrame({
merger,
frame: { type: 'snapshot', messages: replay, hasMore: true, beforeOffset: 9 },
limit: 100,
replaceSnapshot: false
})
).toEqual({
kind: 'messages',
messages: replay,
hasMore: true,
beforeOffset: 9,
windowReplaced: true
})
})
})
@@ -1,31 +0,0 @@
import { describe, expect, it } from 'vitest'
import type { MobileDiffLine } from './mobile-diff-lines'
import { foldEnclosingLine } from './mobile-diff-review-rows'
const context = (text: string): MobileDiffLine => ({ kind: 'context', text })
describe('foldEnclosingLine', () => {
it('names the nearest line above the fold that is indented less than the line after it', () => {
const lines: MobileDiffLine[] = [
context("describe('queue', () => {"),
context(" it('orders files', () => {"),
context(' const queue = build()'),
context(''),
context(' expect(queue).toHaveLength(3)'),
{ kind: 'delete', text: ' removed()' },
context(' expect(queue[0].scope).toBe(1)')
]
expect(foldEnclosingLine(lines, 6)).toBe("it('orders files', () => {")
})
it('skips blank lines after the fold and returns null when nothing encloses it', () => {
const lines = [
context('const a = 1'),
context('const b = 2'),
context(''),
context('const c = 3')
]
expect(foldEnclosingLine(lines, 2)).toBeNull()
expect(foldEnclosingLine(lines, 4)).toBeNull()
})
})
@@ -145,6 +145,77 @@ describe('Tasks lists kept on the phone', () => {
expect(setError).not.toHaveBeenCalled()
})
it('shows the spinner for a new search instead of the previous search rows', async () => {
const issue: TaskItem = {
key: 'github:repo-1:21204',
provider: 'github',
title: '[Feature]: Expose browser tabs',
subtitle: 'orca #21204',
status: 'open',
updatedAt: '2026-11-10T06:51:00.000Z',
source: {
id: 'issue-21204',
type: 'issue',
number: 21204,
title: '[Feature]: Expose browser tabs',
state: 'open',
url: 'https://github.com/stablyai/orca/issues/21204',
labels: [],
updatedAt: '2026-11-10T06:51:00.000Z',
author: 'octocat',
repoId: 'repo-1',
repoName: 'orca'
}
}
const openIssues = { provider: 'github', kind: 'issues', query: 'is:issue is:open', repos: '' }
const bugSearch = { ...openIssues, query: 'is:issue is:open [Bug]' }
const setLoading = vi.fn()
const cache: { current?: ReturnType<typeof useTaskListCache> } = {}
function Probe() {
cache.current = useTaskListCache({
hostId: HOST,
items: [issue],
jiraConnection: {
connected: false,
sites: [],
selection: null,
credentialError: null,
unavailableReason: null
},
provider: 'github',
taskUiReady: true,
setItems: vi.fn(),
setError: vi.fn(),
setGithubPages: vi.fn(),
setGithubCurrentPage: vi.fn(),
setGithubRepoSources: vi.fn(),
setGithubSourceErrors: vi.fn(),
setGithubSourceFallbacks: vi.fn(),
setGithubCountedTotalPages: vi.fn(),
setLoading,
setTaskListSettled: vi.fn()
})
return null
}
await act(async () => {
create(
createElement(QueryClientProvider, { client: new QueryClient() }, createElement(Probe))
)
await vi.runAllTimersAsync()
})
act(() => cache.current!.shown('github', openIssues))
act(() => cache.current!.begin(bugSearch, 'github'))
expect(setLoading).toHaveBeenCalledWith(true)
expect(cache.current!.revalidating).toBe(false)
act(() => cache.current!.shown('github', bugSearch))
setLoading.mockClear()
act(() => cache.current!.begin(bugSearch, 'github'))
expect(setLoading).not.toHaveBeenCalled()
expect(cache.current!.revalidating).toBe(true)
})
it('keeps agent launch commands and hook trust out of the stored hydration', async () => {
const store = memoryStore(HOST)
await storeFromEarlierLaunch(store, [
@@ -48,6 +48,7 @@ export function useMobileTasksTaskPaginationActions(model: TaskListLoadingModel)
loadGenerationRef,
loadLinearContext,
loadTasks,
loading,
revalidating,
selectedHostedRepos,
setError,
@@ -150,9 +151,10 @@ export function useMobileTasksTaskPaginationActions(model: TaskListLoadingModel)
!githubCountedTotalPages &&
(provenPageLimit === null || githubPages.length < provenPageLimit) &&
hasRepoWithFullPage(githubPages.at(-1) ?? [], githubPerRepoLimit)
// Kept or previous-filter pages stand in while the list re-reads; paging from them would mix filters.
// Pages kept or left from another filter stand in while a list loads; paging from them would mix old and new rows.
const githubCanShowPagination =
!revalidating &&
!loading &&
(githubTotalPages > 1 || (githubPages.length > 0 && githubCanLoadUncountedNextPage))
const githubPagePickerPages = useMemo(() => {
const visible = new Set<number>()
@@ -181,6 +183,7 @@ export function useMobileTasksTaskPaginationActions(model: TaskListLoadingModel)
targetPage < 0 ||
githubPaginationLoading ||
revalidating ||
loading ||
selectedHostedRepos.length === 0
) {
return
@@ -267,6 +270,7 @@ export function useMobileTasksTaskPaginationActions(model: TaskListLoadingModel)
githubPages,
githubPaginationLoading,
loadGenerationRef,
loading,
revalidating,
selectedHostedRepos,
setGithubCountedTotalPages,
+14 -5
View File
@@ -1,4 +1,4 @@
import { skipToken, useQuery, useQueryClient } from '@tanstack/react-query'
import { hashKey, skipToken, useQuery, useQueryClient } from '@tanstack/react-query'
import { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react'
import { type HostQueryKey, type HostQueryParams, hostScopeKey } from '../query/host-query-key'
import { persistedHostQueryKey, restoreStoredHostQueries } from '../query/host-query-persistence'
@@ -44,6 +44,8 @@ export function useTaskListCache(view: TaskListView) {
const [rowsReadAt, setRowsReadAt] = useState<number | null>(null)
// The provider whose rows are on screen, so a provider switch never keeps another provider's rows.
const shownProviderRef = useRef<string | null>(null)
// The list the rows on screen were read for; only a re-read of that same list may stand on them.
const shownListRef = useRef<string | null>(null)
const shownRowsRef = useRef(view.items)
useLayoutEffect(() => {
shownRowsRef.current = view.items
@@ -60,6 +62,7 @@ export function useTaskListCache(view: TaskListView) {
const paintRows = useCallback(
(key: HostQueryKey, kept: TaskListSnapshot, provider: string, underRead: boolean): void => {
shownProviderRef.current = provider
shownListRef.current = hashKey(key)
setRowsReadAt(queryClient.getQueryState(key)?.dataUpdatedAt || null)
view.setItems(kept.items)
if (underRead) {
@@ -132,8 +135,8 @@ export function useTaskListCache(view: TaskListView) {
)
}, [hostId, queryClient])
// A read of a list starts on that filter's kept rows, else on the same provider's rows still shown, else the
// spinner; it is also the list this provider opens on next launch.
// A read of a list starts on that filter's kept rows, else on its own rows still shown, else the spinner, so a new
// search never starts on another filter's rows; it is also the list this provider opens on next launch.
const begin = useCallback(
(params: HostQueryParams | null, provider: string): void => {
cancelRead()
@@ -147,7 +150,11 @@ export function useTaskListCache(view: TaskListView) {
paintRows(key, kept, provider, true)
return
}
if (shownRowsRef.current.length > 0 && shownProviderRef.current === provider) {
if (
shownRowsRef.current.length > 0 &&
shownProviderRef.current === provider &&
(!key || shownListRef.current === hashKey(key))
) {
setRevalidating(true)
} else {
view.setLoading(true)
@@ -166,7 +173,9 @@ export function useTaskListCache(view: TaskListView) {
(provider: string, params: HostQueryParams): void => {
awaitingStoredRef.current = null
shownProviderRef.current = provider
setRowsReadAt(queryClient.getQueryState(taskListKey(hostId, params))?.dataUpdatedAt || null)
const key = taskListKey(hostId, params)
shownListRef.current = hashKey(key)
setRowsReadAt(queryClient.getQueryState(key)?.dataUpdatedAt || null)
},
[hostId, queryClient]
)
@@ -0,0 +1,17 @@
import { describe, expect, it } from 'vitest'
import { acceptTerminalLayoutSeq } from './terminal-stream-layout'
describe('acceptTerminalLayoutSeq', () => {
it('accepts a display-mode resize whose layout seq is below the scrollback output seq', () => {
const marks = new Map<string, number>()
expect(acceptTerminalLayoutSeq(marks, 't', { type: 'subscribed', seq: 2 })).toBe(true)
expect(acceptTerminalLayoutSeq(marks, 't', { type: 'scrollback', seq: 14 })).toBe(true)
expect(acceptTerminalLayoutSeq(marks, 't', { type: 'resized', seq: 3 })).toBe(true)
})
it('drops a resize older than the layout seq the stream subscribed at', () => {
const marks = new Map<string, number>()
acceptTerminalLayoutSeq(marks, 't', { type: 'subscribed', seq: 5 })
expect(acceptTerminalLayoutSeq(marks, 't', { type: 'resized', seq: 4 })).toBe(false)
})
})
@@ -1,7 +1,8 @@
import type { Dispatch, SetStateAction } from 'react'
import type { MobileDisplayMode } from './mobile-terminal-model'
/** Records a stream event's layout seq; false for a superseded `resized`. Fresh scrollback resets the mark or reconnect can blank the terminal. */
/** Records a stream event's layout seq; false for a superseded `resized`. Each `subscribed` resets the mark;
* scrollback leaves it, because binary scrollback `seq` counts output bytes, not layout changes. */
export function acceptTerminalLayoutSeq(
marks: Map<string, number>,
handle: string,
@@ -23,8 +24,10 @@ export function acceptTerminalLayoutSeq(
return false
}
marks.set(handle, eventSeq)
} else if (eventSeq != null && data.type === 'scrollback') {
} else if (data.type === 'subscribed' && eventSeq != null) {
marks.set(handle, eventSeq)
} else if (data.type === 'subscribed') {
marks.delete(handle)
}
return true
}
@@ -166,6 +166,7 @@ export function useMobileSessionTerminalSubscription(
return
}
if (data.type === 'subscribed') {
acceptTerminalLayoutSeq(layoutSeqRef.current, handle, data)
outputAck.start(data)
if (resume.subscribed(data)) {
initializedHandlesRef.current.add(handle)
@@ -191,6 +191,7 @@ export function taskListMountAdapters(
loadGenerationRef: { current: 0 },
loadLinearContext: async () => {},
loadTasks: async () => {},
loading: false,
revalidating: false,
selectedHostedRepos: [HOSTED_REPO],
taskUiReady: true,
@@ -1,57 +0,0 @@
import { createElement } from 'react'
import { act, create, type ReactTestRenderer } from 'react-test-renderer'
import { beforeEach, describe, expect, it, vi } from 'vitest'
import type { RpcClient } from '../rpc/rpc-client-contract'
import { useHostStatusGates, type HostStatusGates } from './host-status-gates'
const recordHostAppVersionMock = vi.hoisted(() => vi.fn().mockResolvedValue(undefined))
vi.mock('../../host-descriptors/host-app-version-store', () => ({
recordHostAppVersion: (...args: unknown[]) => recordHostAppVersionMock(...args)
}))
const recordDescriptorFromStatusMock = vi.hoisted(() => vi.fn())
vi.mock('../../host-descriptors/host-descriptor-recorder', () => ({
recordHostDescriptorFromStatus: (...args: unknown[]) => recordDescriptorFromStatusMock(...args)
}))
describe('useHostStatusGates', () => {
beforeEach(() => {
recordDescriptorFromStatusMock.mockClear()
})
it('fails closed when the same host reconnects on a replaced client', async () => {
const firstClient = {
sendRequest: vi.fn().mockResolvedValue({
ok: true,
result: { capabilities: ['browser.screencast.v1'], floatingWorkspaceEnabled: true }
})
} as unknown as RpcClient
const secondClient = {
sendRequest: vi.fn().mockReturnValue(new Promise(() => {}))
} as unknown as RpcClient
let gates: HostStatusGates | undefined
let renderer: ReactTestRenderer | undefined
function Probe({ client }: { client: RpcClient }): null {
gates = useHostStatusGates({ hostId: 'host-1', client, connState: 'connected' })
return null
}
try {
await act(async () => {
renderer = create(createElement(Probe, { client: firstClient }))
await Promise.resolve()
})
expect(gates?.hostCapabilities).toEqual(['browser.screencast.v1'])
await act(async () => {
renderer?.update(createElement(Probe, { client: secondClient }))
})
expect(gates).toMatchObject({ hostCapabilities: [], statusPending: true })
} finally {
renderer?.unmount()
}
})
})
@@ -1,40 +0,0 @@
import { createHash } from 'node:crypto'
import { gunzipSync } from 'fflate'
import { describe, expect, it } from 'vitest'
import { encodeMobileWebBundleRange } from '../../../../src/main/runtime/rpc/methods/mobile-delivery/mobile-web-bundle-range-encoding'
import { MOBILE_WEB_BUNDLE_RANGE_BYTES } from '../../../../src/shared/mobile-web-bundle/bundle-rpc-contract'
/** Script-like and a full range long, so the host's level-6 deflate emits dynamic Huffman blocks. */
function scriptRange(): Buffer {
const words = ['const ', 'function ', 'return ', 'export ', '=> ', '{', '}', ';\n', 'orca']
let text = ''
for (let index = 0; text.length < MOBILE_WEB_BUNDLE_RANGE_BYTES; index += 1) {
text += words[(index * 7) % words.length] + String(index % 1000)
}
return Buffer.from(text.slice(0, MOBILE_WEB_BUNDLE_RANGE_BYTES))
}
describe('a host-encoded range decoded by the phone', () => {
it('inflates node gzip output with fflate to the same bytes', async () => {
const raw = scriptRange()
const encoded = await encodeMobileWebBundleRange(raw)
expect(encoded.encoding).toBe('gzip')
const inflated = gunzipSync(new Uint8Array(encoded.bytes), {
out: new Uint8Array(raw.byteLength + 1)
})
expect(Buffer.from(inflated).equals(raw)).toBe(true)
})
it('leaves incompressible bytes as identity, which needs no decoder', async () => {
const raw = Buffer.concat(
Array.from({ length: 128 }, (_, index) =>
createHash('sha256').update(`range-${index}`).digest()
)
)
const encoded = await encodeMobileWebBundleRange(raw)
expect(encoded.encoding).toBe('identity')
expect(encoded.bytes.equals(raw)).toBe(true)
})
})
@@ -1,14 +1,18 @@
import type { CommandHandler } from '../../dispatch'
import { printOrchestrationReceipt } from './agent-view'
import { getRequiredStringFlag } from '../../flags'
import { getOptionalStringFlag, getRequiredStringFlag } from '../../flags'
import { RuntimeClientError } from '../../runtime-client'
import type { OrchestrationMutationRequestShowResult } from '../../../shared/orchestration/orchestration-mutation-request'
export const ORCHESTRATION_REQUEST_SHOW_HANDLER: Record<string, CommandHandler> = {
'orchestration request-show': async ({ flags, client, json }) => {
const request = getRequiredStringFlag(flags, 'request')
const on = getOptionalStringFlag(flags, 'on')
const result = await client
.call<OrchestrationMutationRequestShowResult>('orchestration.requestShow', { request })
.call<OrchestrationMutationRequestShowResult>('orchestration.requestShow', {
request,
...(on ? { on } : {})
})
.catch((error: unknown) => {
if (error instanceof RuntimeClientError && error.code === 'method_not_found') {
throw new RuntimeClientError(
@@ -0,0 +1,58 @@
import { describe, expect, it } from 'vitest'
import { WORKER_LIST_VIEW, WORKER_SHOW_VIEW } from './worker-agent-views'
describe('worker views of a worker a paired server runs', () => {
it('labels a remote worker’s show with its server, record time, last report and note', () => {
expect(
WORKER_SHOW_VIEW.fields({
dispatch: { id: 'ctx_w1', taskId: 'task_1', runId: 'run_1', status: 'dispatched' },
worker: {
dispatchId: 'ctx_w1',
state: 'ready',
stage: 'server_record',
agentTerminalHandle: null
},
projection: null,
observation: { reason: 'devB could not be reached, so this is this Orca’s record.' },
server: { name: 'devB', asOf: '2026-11-09T08:30:00Z', reachable: false },
lastReport: 'Halfway: tests written.'
})
).toMatchObject({
dispatchId: 'ctx_w1',
state: 'ready',
stage: 'server_record',
server: 'devB',
asOf: '2026-11-09T08:30:00Z',
lastReport: 'Halfway: tests written.',
note: 'devB could not be reached, so this is this Orca’s record.',
waitingOnHuman: 'unknown'
})
})
it('names a listed remote worker’s server, and says when its pairing was re-made', () => {
const row = {
taskId: 'task_1',
runId: 'run_1',
workerState: 'ready',
dispatchStatus: 'dispatched',
agentTerminalHandle: null,
terminalState: null
}
const fields = WORKER_LIST_VIEW.fields({
workers: [
{ ...row, dispatchId: 'ctx_w1', server: { name: 'devB', asOf: '2026-11-09T08:30:00Z' } },
{
...row,
dispatchId: 'ctx_w2',
server: { name: 'devB', asOf: '2026-11-09T08:45:00Z', repaired: true }
}
],
counts: {},
scope: { source: 'all' }
})
expect(fields.workers).toEqual([
expect.objectContaining({ dispatchId: 'ctx_w1', host: 'devB', asOf: '2026-11-09T08:30:00Z' }),
expect.objectContaining({ dispatchId: 'ctx_w2', host: 'devB (pairing re-made)' })
])
})
})
@@ -39,10 +39,18 @@ export type WorkerShowResult = {
releaseState?: string | null
terminalHandle?: string | null
} | null
observation?: { agentWait?: { source: string; reason?: string } | null }
observation?: { agentWait?: { source: string; reason?: string } | null; reason?: string }
/** Present only for a worker a paired server runs, which this Orca's record answers. */
server?: RemoteWorkerServer & { reachable?: boolean }
lastReport?: string | null
autoReleaseAt?: string | null
/** The paired Orca whose Run here coordinates this worker. */
coordinatedFrom?: string | null
}
/** A worker a paired server runs, as this Orca names that server and last heard from it. */
type RemoteWorkerServer = { name: string; asOf: string; repaired?: true }
type WorkerShowFields = {
dispatchId: string
taskId?: string
@@ -56,10 +64,15 @@ type WorkerShowFields = {
terminal?: string
terminalState?: string
workspace?: string
server?: string
asOf?: string
lastReport?: string
note?: string
attention?: string[]
waitingOnHuman?: string
lastError?: string
autoReleaseAt?: string
coordinatedFrom?: string
next?: string
}
@@ -84,6 +97,10 @@ export const WORKER_SHOW_VIEW: OrchestrationAgentView<WorkerShowResult, WorkerSh
value.terminalResource?.releaseState ??
undefined,
workspace: value.projection?.workspace?.id ?? value.worker.worktreeId ?? undefined,
server: value.server?.name,
asOf: value.server?.asOf,
lastReport: value.lastReport ?? undefined,
note: value.server ? value.observation?.reason : undefined,
attention: actionableAttention(value.projection),
// Silence means checked and clear; an older host or unreadable pane never evaluated it.
waitingOnHuman:
@@ -94,6 +111,7 @@ export const WORKER_SHOW_VIEW: OrchestrationAgentView<WorkerShowResult, WorkerSh
: undefined,
lastError: value.worker.lastError ?? undefined,
autoReleaseAt: value.autoReleaseAt ?? undefined,
coordinatedFrom: value.coordinatedFrom ?? undefined,
next: value.projection ? renderOrchestrationArgv(value.projection.nextAction.argv) : undefined
}
}
@@ -111,6 +129,8 @@ export type WorkerListResult = {
coordinatedFrom?: string | null
resource?: { worktreeId?: string | null; autoReleaseAt?: string | null } | null
projection?: WorkerProjection
/** Only on a worker a paired server runs, listed from this Orca's record of it. */
server?: RemoteWorkerServer
}[]
counts: Record<string, number>
page?: { hasMore: boolean; nextCursor: string | null; total: number }
@@ -135,6 +155,7 @@ type WorkerListRow = {
workspace?: string
host?: string
coordinatedFrom?: string
asOf?: string
attention?: string[]
autoReleaseAt?: string
next?: string
@@ -169,8 +190,9 @@ export const WORKER_LIST_VIEW: OrchestrationAgentView<ScopedWorkerList, WorkerLi
terminalState: worker.terminalState ?? undefined,
// Older runtimes send no projection; the terminal resource row still names both.
workspace: projection?.workspace?.id ?? worker.resource?.worktreeId ?? undefined,
host: projection?.host.id,
host: projection?.host.id ?? remoteHost(worker.server),
coordinatedFrom: worker.coordinatedFrom ?? undefined,
asOf: worker.server?.asOf,
attention: actionableAttention(projection),
autoReleaseAt: projection?.autoReleaseAt ?? worker.resource?.autoReleaseAt ?? undefined,
next: projection
@@ -194,6 +216,11 @@ export const WORKER_LIST_VIEW: OrchestrationAgentView<ScopedWorkerList, WorkerLi
}
}
/** A re-made pairing leaves the record, but its server no longer reports the worker here. */
export function remoteHost(server: RemoteWorkerServer | undefined): string | undefined {
return server && (server.repaired ? `${server.name} (pairing re-made)` : server.name)
}
// Older runtimes send no projection and cannot close finished workers on their own.
function olderHostReleaseNext(worker: WorkerListResult['workers'][number]): string | undefined {
return worker.terminalState === 'reclaimable' && !worker.resource?.autoReleaseAt
@@ -30,6 +30,14 @@ export const ORCHESTRATION_WORKER_OBSERVATION_HANDLERS: Record<string, CommandHa
if (value.dispatch?.followUpOf) {
lines.push(`Follow-up of: dispatch:${value.dispatch.followUpOf}`)
}
// This Orca's record of a worker on a server that did not answer.
if (value.server) {
lines.push(
`Server: ${value.server.name} (record as of ${value.server.asOf})`,
...(value.observation?.reason ? [`Note: ${value.observation.reason}`] : []),
...(value.lastReport ? [`Last report: ${value.lastReport}`] : [])
)
}
// A live PTY can contain a dead agent; show the independent agent verdict and recovery action.
if (value.projection) {
lines.push(
@@ -1,7 +1,7 @@
import type { CommandHandler } from '../../dispatch'
import { printResult } from '../../format'
import { printOrchestrationResult } from './agent-view'
import { WORKER_LIST_VIEW, type WorkerListResult } from './worker-agent-views'
import { remoteHost, WORKER_LIST_VIEW, type WorkerListResult } from './worker-agent-views'
import {
formatHelperStops,
WORKER_RELEASE_VIEW,
@@ -133,6 +133,7 @@ export const ORCHESTRATION_WORKER_TERMINAL_HANDLERS: Record<string, CommandHandl
run: scope.run,
terminalState,
...(flags.has('include-remote') ? { includeRemote: true } : {}),
on: getOptionalStringFlag(flags, 'on'),
cursor: getOptionalStringFlag(flags, 'cursor'),
limit: getOptionalPositiveIntegerFlag(flags, 'limit')
})
@@ -166,7 +167,9 @@ export const ORCHESTRATION_WORKER_TERMINAL_HANDLERS: Record<string, CommandHandl
const attention = projection?.attention?.categories.join(',') || 'none'
const details = projection
? `/${stage}] attention=${attention} liveness=${liveness} provider=${provider} host=${projection.host.id} workspace=${workspace}`
: `]`
: worker.server
? `] host=${remoteHost(worker.server)} asOf=${worker.server.asOf}`
: `]`
const next = projection
? ` next=${projection.nextAction.argv.join(' ') || 'none'}`
: ''
+10 -1
View File
@@ -35,7 +35,16 @@ export function orchestrationMutationRecoveryError(
// Without a dispatch id, query by request id to inspect the outcome before retrying a mutation.
const queryCommand = dispatchId
? [executable, 'orchestration', 'worker-show', '--dispatch', dispatchId, '--json']
: [executable, 'orchestration', 'request-show', '--request', requestId, '--json']
: [
executable,
'orchestration',
'request-show',
'--request',
requestId,
// A command forwarded to a paired server keeps its receipt there.
...(typeof data?.server === 'string' ? ['--on', data.server] : []),
'--json'
]
const recovery = {
orchestrationRequestId: requestId,
...(dispatchId ? { dispatchId } : {}),
@@ -1,43 +0,0 @@
import { describe, expect, it } from 'vitest'
import { OrchestrationRequestEvidence } from './orchestration-compatibility-envelope'
const CHAT = { ORCA_AGENT_SESSION_ID: '11111111-1111-4111-8111-111111111111' }
describe('caller evidence on requests to another server', () => {
it('sends a chat read there like a shell, with no session id', () => {
const evidence = new OrchestrationRequestEvidence(CHAT)
expect(
evidence.envelopeFor('orchestration.inbox', {
remote: true,
mutation: false,
requestId: undefined
}).orchestrationCompatibilityEvidence
).toBeUndefined()
})
it('keeps the session id on writes there, so that server still refuses them', () => {
const evidence = new OrchestrationRequestEvidence(CHAT)
expect(
evidence.envelopeFor('orchestration.taskCreate', {
remote: true,
mutation: true,
requestId: 'request_1'
}).orchestrationCompatibilityEvidence
).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()
})
})
+12 -3
View File
@@ -145,14 +145,23 @@ export const ORCHESTRATION_WORKER_COMMAND_SPECS: CommandSpec[] = [
path: ['orchestration', 'worker-list'],
summary: 'List supervised worker terminal resource accounting',
usage:
'orca orchestration worker-list [--run <run_id>] [--terminal-state <active|reclaimable|retained|release_pending|release_unknown|released>] [--include-remote] [--cursor <cursor>] [--limit <1-100>] [--json]',
allowedFlags: [...GLOBAL_FLAGS, 'run', 'terminal-state', 'include-remote', 'cursor', 'limit'],
'orca orchestration worker-list [--run <run_id>] [--terminal-state <active|reclaimable|retained|release_pending|release_unknown|released>] [--include-remote] [--on <server>] [--cursor <cursor>] [--limit <1-100>] [--json]',
allowedFlags: [
...GLOBAL_FLAGS,
'run',
'terminal-state',
'include-remote',
'on',
'cursor',
'limit'
],
notes: [
'Terminal state is process accounting and is reported separately from Task status; a completed Task can still own a live terminal.',
'A reclaimable worker with resource.autoReleaseAt is released automatically at that time unless it is reused with worker-start --terminal or kept open (worker-keep-open, worker-start --keep-open, or the user).',
'Context-only Dispatches created by orchestration dispatch are included as unsupervised with terminal state retained.',
'Returns at most 100 local rows, newest first, by default; --include-remote adds connected-server observations when the host supports fleet listing. Continue with the opaque nextCursor value unchanged.',
'Without --run the list is scoped to the Run bound to the calling terminal, and to every Run when there is no binding; the receipt reports which in scope.source (flag, bound, or all).'
'Without --run the list is scoped to the Run bound to the calling terminal, and to every Run when there is no binding; the receipt reports which in scope.source (flag, bound, or all).',
"--on <server> lists that paired server's own workers for your Run there (or all of them without a Run), paged with its own cursor."
]
}
]
+4 -3
View File
@@ -209,12 +209,13 @@ export const ORCHESTRATION_COMMAND_SPECS: CommandSpec[] = [
{
path: ['orchestration', 'request-show'],
summary: 'Ask whether one orchestration mutation request already took effect',
usage: 'orca orchestration request-show --request <request_id> [--json]',
allowedFlags: [...GLOBAL_FLAGS, 'request'],
usage: 'orca orchestration request-show --request <request_id> [--on <server>] [--json]',
allowedFlags: [...GLOBAL_FLAGS, 'request', 'on'],
notes: [
'Read-only: it never starts, retries, or settles anything, so it is safe to run after any lost response.',
'completed means the mutation landed and --retry-request replays the recorded outcome instead of starting a second one. pending means the original mutation is still running or Orca restarted before recording its outcome; wait for a live original command, otherwise replay with --retry-request.',
'absent means this runtime holds no receipt for that request under your caller identity: it never arrived, it failed before recording anything, or the receipt was pruned. Absent is not proof that nothing happened.'
'absent means this runtime holds no receipt for that request under your caller identity: it never arrived, it failed before recording anything, or the receipt was pruned. Absent is not proof that nothing happened.',
'A command about a worker on a paired server keeps its receipt on that server; --on <server> asks there.'
]
},
{
@@ -1,7 +1,4 @@
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import { normalizeHookPayload } from '../../../../../../shared/agent-hook-listener/normalization/normalize-hook-payload'
import { createHookListenerState } from '../../../../../../shared/agent-hook-listener/listener-state'
import { buildRelayHookEnvelope } from '../../../../../../wsl-guest/agent-hook-envelope-build'
import { AgentHookServer, _internals } from '../../../agent-hook-server'
import { PANE, buildBody, postHookEvent } from '../../server.test-fixtures'
@@ -29,18 +26,6 @@ const ACCEPTED = {
hook_event_name: 'PostToolUse',
tool_response: '{"accepted":true}'
}
const reply = (index: number) => ({
hook_event_name: 'UserPromptSubmit',
turn_id: 'turn-1',
prompt: `<send_user_message_question_reply>\n${JSON.stringify([
{
answer: 'SQLite',
question: QUESTIONS.questions[index]!.title,
questionItemId: JSON.stringify(['request_user_input_async', 'call_3_1', index])
}
])}\n</send_user_message_question_reply>`
})
beforeEach(() => {
_internals.resetCachesForTests()
})
@@ -49,27 +34,6 @@ afterEach(() => {
vi.restoreAllMocks()
})
// The execution host normalizes each hook, then main ingests the relayed row, as for SSH and WSL.
function codexPane() {
const host = createHookListenerState()
const server = new AgentHookServer()
return {
report(payload: Record<string, unknown>) {
const event = normalizeHookPayload(
host,
'codex',
buildBody(payload, { worktreeId: 'folder-workspace' }),
'production'
)
if (!event) {
throw new Error('Expected a Codex hook event')
}
server.ingestRemote(buildRelayHookEnvelope(event, 'codex'), 'wsl:Ubuntu')
return { host: event.payload, main: server.getStatusSnapshotForPane(PANE)[0] }
}
}
}
const waitingOnQuestion = {
state: 'waiting',
toolName: 'request_user_input_async',
@@ -77,33 +41,6 @@ const waitingOnQuestion = {
}
describe('Codex async questions', () => {
it('waits on an open question through the turn until every question is answered', () => {
const pane = codexPane()
pane.report({ hook_event_name: 'UserPromptSubmit', turn_id: 'turn-1', prompt: 'Set up a db' })
expect(pane.report(ASK).main).toMatchObject(waitingOnQuestion)
// Codex accepts the call at once and keeps working; the question is still open.
const accepted = pane.report(ACCEPTED)
expect(accepted.host).toMatchObject(waitingOnQuestion)
expect(accepted.main).toMatchObject(waitingOnQuestion)
pane.report({ hook_event_name: 'PreToolUse', turn_id: 'turn-1', tool_name: 'Bash' })
// An approval on screen wins over the open question.
const approval = pane.report({
hook_event_name: 'PermissionRequest',
turn_id: 'turn-1',
tool_name: 'Bash',
tool_input: { command: 'pnpm tc' }
}).main
expect(approval?.state).toBe('waiting')
expect(approval?.interactivePrompt).toContain('"approval"')
pane.report({ hook_event_name: 'PostToolUse', turn_id: 'turn-1', tool_name: 'Bash' })
expect(pane.report(reply(0)).main).toMatchObject(waitingOnQuestion)
const answered = pane.report(reply(1)).main
expect(answered).toMatchObject({ state: 'working' })
expect(answered?.interactivePrompt).toBeUndefined()
})
it('drops one question per skip keystroke on a local pane, since Codex reports no skip', async () => {
const server = new AgentHookServer()
await server.start({ env: 'production' })
@@ -1,57 +0,0 @@
import { describe, expect, it } from 'vitest'
import type { AgentWorkspaceTrustDecision } from '../../../shared/agent-launch/permissions/agent-workspace-trust-decision'
import type { AgentTrustSpawnFields } from './agent-workspace-trust'
import { applyAgentWorkspaceTrustToSpawn } from './agent-workspace-trust-spawn'
// An SSH launch only forwards the request to the relay, so no local config is written.
async function sshTrustRequest(input: {
worktreeId: string
globalEnabled?: boolean
repoDecision?: AgentWorkspaceTrustDecision
}): Promise<AgentTrustSpawnFields> {
const spawnOptions: AgentTrustSpawnFields = {}
await applyAgentWorkspaceTrustToSpawn({
launchAgent: 'claude',
worktreeId: input.worktreeId,
cwd: '/srv/app',
store: {
getFolderWorkspace: () => ({ folderPath: '/srv/folder' }),
getRepo: (repoId) =>
repoId === 'repo-1' && input.repoDecision
? { agentWorkspaceTrust: input.repoDecision }
: undefined
},
isFreshLaunch: true,
settings: { agentWorkspaceTrustEnabled: input.globalEnabled ?? true },
env: {},
claudeAuth: null,
wslDistro: null,
connectionId: 'ssh-1',
spawnOptions
})
return spawnOptions
}
describe('agent folder trust follows the repo decision', () => {
it('pre-trusts a repo whose decision is pre-trust', async () => {
expect(
await sshTrustRequest({ worktreeId: 'repo-1::/srv/app', repoDecision: 'pre-trust' })
).toEqual({ agentWorkspaceTrust: { workspacePath: '/srv/app' } })
})
it('leaves the folder untrusted when the repo lets agents ask', async () => {
expect(
await sshTrustRequest({ worktreeId: 'repo-1::/srv/app', repoDecision: 'agent-asks' })
).toEqual({})
})
it('never pre-trusts when folder trust is off globally', async () => {
expect(
await sshTrustRequest({
worktreeId: 'repo-1::/srv/app',
globalEnabled: false,
repoDecision: 'pre-trust'
})
).toEqual({})
})
})
@@ -1,4 +1,4 @@
import type { AiVaultScanIssue } from '../../shared/ai-vault/contracts/ai-vault-types'
import type { AiVaultScanIssue } from '../../../shared/ai-vault/contracts/ai-vault-types'
import type { SessionSearchDirectoryReader } from './session-search-directory-listings'
export type SessionSearchDegradedRoot = { root: string; reason: string }
@@ -1,8 +1,8 @@
import './session-search-worker.test-fixture'
import '../worker/session-search-worker.test-fixture'
import { mkdir, rm, writeFile } from 'node:fs/promises'
import { join } from 'node:path'
import { afterEach, beforeEach, expect, it } from 'vitest'
import { resetTranscriptConsumersForTests } from '../ai-vault/transcripts/session-transcript-consumers'
import { resetTranscriptConsumersForTests } from '../../ai-vault/transcripts/session-transcript-consumers'
import { retireDeletedSessionSearchSources } from './session-search-deleted-sources'
import {
SessionSearchDirectoryListings,
@@ -11,8 +11,8 @@ import {
import {
openSessionSearchIndexerHarness,
type SessionSearchIndexerHarness
} from './session-search-indexer-test-fixture'
import { SessionSearchStore } from './session-search-store'
} from '../indexing/session-search-indexer-test-fixture'
import { SessionSearchStore } from '../storage/session-search-store'
let harness: SessionSearchIndexerHarness
let store: SessionSearchStore
@@ -3,7 +3,7 @@ import type { SessionSearchDegradedRoot } from './session-search-degraded-roots'
import type { SessionSearchDirectoryReader } from './session-search-directory-listings'
import { isUnderScanRoot } from './session-search-scan-roots'
import { splitSyntheticSessionSource } from './session-search-synthetic-sources'
import type { SessionSearchIndexStore } from './session-search-store'
import type { SessionSearchIndexStore } from '../storage/session-search-store-types'
// Walk missing directories upward to seek a listing that proves which component disappeared.
const MISSING_DIRECTORY = new Set(['ENOENT', 'ENOTDIR'])
@@ -3,7 +3,7 @@ import { SessionSearchDirectoryListings } from './session-search-directory-listi
const { readdir } = vi.hoisted(() => ({ readdir: vi.fn() }))
vi.mock('../native-chat/wsl-transcript-fs-access', () => ({
vi.mock('../../native-chat/wsl-transcript-fs-access', () => ({
wslGatedReaddir: readdir
}))
@@ -1,4 +1,4 @@
import { wslGatedReaddir } from '../native-chat/wsl-transcript-fs-access'
import { wslGatedReaddir } from '../../native-chat/wsl-transcript-fs-access'
export type SessionSearchDirectoryListing =
| { listed: true; names: ReadonlySet<string> }
@@ -1,6 +1,6 @@
import { expect, it } from 'vitest'
import { delimiter, join } from 'node:path'
import type { SessionFileDiscovery } from '../ai-vault/session-scanner-types'
import type { SessionFileDiscovery } from '../../ai-vault/session-scanner-types'
import { sameSessionSearchRoots, sessionSearchRootListings } from './session-search-scan-roots'
const STATE = '/tmp/ss-roots/openclaw-state'
@@ -1,13 +1,13 @@
import type { AiVaultScanIssue } from '../../shared/ai-vault/contracts/ai-vault-types'
import { AI_VAULT_AGENT_SOURCES } from '../ai-vault/session-scanner-agent-sources'
import { normalizedWslHomeDirs } from '../ai-vault/session-scanner-roots'
import { sessionCandidatesFromDiscoveries } from '../ai-vault/session-scanner-candidates'
import { discoverAiVaultSessionSources } from '../ai-vault/session-scanner-source-discovery'
import type { AiVaultScanIssue } from '../../../shared/ai-vault/contracts/ai-vault-types'
import { AI_VAULT_AGENT_SOURCES } from '../../ai-vault/session-scanner-agent-sources'
import { normalizedWslHomeDirs } from '../../ai-vault/session-scanner-roots'
import { sessionCandidatesFromDiscoveries } from '../../ai-vault/session-scanner-candidates'
import { discoverAiVaultSessionSources } from '../../ai-vault/session-scanner-source-discovery'
import type {
AiVaultScanOptions,
SessionFileCandidate,
SessionFileDiscovery
} from '../ai-vault/session-scanner-types'
} from '../../ai-vault/session-scanner-types'
export type SessionSearchRootListing = { root: string; files: number }
@@ -1,6 +1,6 @@
import type { AiVaultScanIssue } from '../../shared/ai-vault/contracts/ai-vault-types'
import { splitOpenCodeSqliteCandidate } from '../../shared/opencode-sqlite-session-path'
import type { SessionFileCandidate } from '../ai-vault/session-scanner-types'
import type { AiVaultScanIssue } from '../../../shared/ai-vault/contracts/ai-vault-types'
import { splitOpenCodeSqliteCandidate } from '../../../shared/opencode-sqlite-session-path'
import type { SessionFileCandidate } from '../../ai-vault/session-scanner-types'
/** A session inside a shared container rather than a standalone transcript file. */
export type SessionSearchSyntheticSource = { container: string; id: string }
@@ -0,0 +1,96 @@
import { mkdir, writeFile } from 'node:fs/promises'
import { dirname, join } from 'node:path'
import { afterEach, beforeEach, expect, it } from 'vitest'
import { parseAgentSessionFileCached } from '../../ai-vault/parse-cache/session-scanner-parse-cache'
import { resetSessionParseCacheForTests } from '../../ai-vault/parse-cache/session-parse-cache-store'
import { resetCodexSessionIndexTitleCacheForTests } from '../../ai-vault/scanners/codex/session-scanner-codex-title-index'
import type { SessionFileCandidate } from '../../ai-vault/session-scanner-types'
import { resetTranscriptConsumersForTests } from '../../ai-vault/transcripts/session-transcript-consumers'
import { registerSessionSearchIndexConsumer } from './session-search-index-consumer'
import {
openSessionSearchIndexFile,
type SessionSearchIndexFile
} from '../storage/session-search-index-test-fixture'
import { SessionSearchStore } from '../storage/session-search-store'
import {
CODEX_ROLLOUT_FILE,
CODEX_SESSION_ID,
codexRolloutLines,
sessionCandidate
} from './session-search-transcript-fixtures'
let index: SessionSearchIndexFile
let store: SessionSearchStore
let root: string
let errors: unknown[]
beforeEach(async () => {
resetTranscriptConsumersForTests()
resetCodexSessionIndexTitleCacheForTests()
index = await openSessionSearchIndexFile('ss-dependent-transcripts')
root = dirname(index.path)
errors = []
store = new SessionSearchStore(index.path, (error) => errors.push(error))
registerSessionSearchIndexConsumer(store)
})
afterEach(async () => {
resetTranscriptConsumersForTests()
resetSessionParseCacheForTests()
resetCodexSessionIndexTitleCacheForTests()
store.close()
await index.close()
})
async function writeSource(path: string, content: string): Promise<void> {
await mkdir(dirname(path), { recursive: true })
await writeFile(path, content)
}
async function coldRead(candidate: SessionFileCandidate) {
resetSessionParseCacheForTests()
const session = await parseAgentSessionFileCached(candidate, process.platform)
expect(errors).toEqual([])
expect(session).not.toBeNull()
return session
}
function matches(term: string): unknown {
return index.db
.prepare(
`SELECT count(*) AS n FROM messages_fts
JOIN messages m ON m.id = messages_fts.rowid
JOIN sessions s ON s.id = m.session_row_id
WHERE messages_fts MATCH ?`
)
.get(term)
}
it('updates the indexed Codex title when only session_index.jsonl changes', async () => {
const home = join(root, 'codex')
const path = join(home, 'sessions', CODEX_ROLLOUT_FILE)
await writeSource(path, `${codexRolloutLines(['pwd'], '/repo/app', 'codexmessage').join('\n')}\n`)
const titleIndex = join(home, 'session_index.jsonl')
await writeSource(
titleIndex,
`${JSON.stringify({ id: CODEX_SESSION_ID, thread_name: 'Original' })}\n`
)
const candidate = await sessionCandidate('codex', path, home)
candidate.file.sidecar = 'none'
await coldRead(candidate)
expect(index.db.prepare('SELECT title FROM sessions').get()).toEqual({ title: 'Original' })
await writeSource(
titleIndex,
`${JSON.stringify({ id: CODEX_SESSION_ID, thread_name: 'Renamed conversation' })}\n`
)
expect((await sessionCandidate('codex', path, home)).file).toEqual({
...candidate.file,
sidecar: undefined
})
expect(await coldRead(candidate)).toMatchObject({ title: 'Renamed conversation' })
expect(index.db.prepare('SELECT title FROM sessions').get()).toEqual({
title: 'Renamed conversation'
})
expect(matches('codexmessage')).toEqual({ n: 1 })
})
@@ -1,7 +1,7 @@
import { inSessionParseFileLane } from '../ai-vault/parse-cache/session-parse-file-lane'
import { requestWholeTranscriptRead } from '../ai-vault/transcripts/session-transcript-reader'
import { traceSessionSearch } from './session-search-trace'
import type { AiVaultAgent } from '../../shared/ai-vault/contracts/ai-vault-types'
import { inSessionParseFileLane } from '../../ai-vault/parse-cache/session-parse-file-lane'
import { requestWholeTranscriptRead } from '../../ai-vault/transcripts/session-transcript-reader'
import { traceSessionSearch } from '../session-search-trace'
import type { AiVaultAgent } from '../../../shared/ai-vault/contracts/ai-vault-types'
import {
registerTranscriptConsumer,
type TranscriptConsumer,
@@ -9,11 +9,14 @@ import {
type TranscriptReadConsumer,
type TranscriptReadOutcome,
type TranscriptReadStart
} from '../ai-vault/transcripts/session-transcript-consumers'
import type { SessionFileCandidate } from '../ai-vault/session-scanner-types'
import { fileIdentity } from './session-search-file-cursor'
import type { SessionSearchFileWrite } from './session-search-index-writer'
import type { SessionSearchResumableCursor, SessionSearchIndexStore } from './session-search-store'
} from '../../ai-vault/transcripts/session-transcript-consumers'
import type { SessionFileCandidate } from '../../ai-vault/session-scanner-types'
import { fileIdentity } from '../storage/session-search-file-cursor'
import type { SessionSearchFileWrite } from '../storage/session-search-index-writer'
import type {
SessionSearchResumableCursor,
SessionSearchIndexStore
} from '../storage/session-search-store-types'
export const SELF_CONTAINED_TRANSCRIPT_AGENTS = {
claude: true,
@@ -1,13 +1,16 @@
import { throwIfAiVaultScanCancelled } from '../ai-vault/ai-vault-scan-cancellation'
import { throwIfAiVaultScanCancelled } from '../../ai-vault/ai-vault-scan-cancellation'
import {
createSessionParseStats,
parseAgentSessionFileCached,
type SessionParseStats
} from '../ai-vault/parse-cache/session-scanner-parse-cache'
import type { SessionFileCandidate } from '../ai-vault/session-scanner-types'
import { fileIdentity } from './session-search-file-cursor'
} from '../../ai-vault/parse-cache/session-scanner-parse-cache'
import type { SessionFileCandidate } from '../../ai-vault/session-scanner-types'
import { fileIdentity } from '../storage/session-search-file-cursor'
import { sessionSearchReadDecision } from './session-search-read-decision'
import type { SessionSearchFileRow, SessionSearchIndexStore } from './session-search-store'
import type {
SessionSearchFileRow,
SessionSearchIndexStore
} from '../storage/session-search-store-types'
export type SessionSearchIndexPassOptions = {
signal?: AbortSignal
@@ -1,5 +1,5 @@
import type { SessionSearchClock } from './session-search-clock'
import type { SessionSearchScanRoots } from './session-search-scan-roots'
import type { SessionSearchScanRoots } from '../discovery/session-search-scan-roots'
export const DEFAULT_SESSION_SEARCH_RECONCILE_INTERVAL_MS = 20_000
export const DEFAULT_SESSION_SEARCH_RECENT_PER_AGENT = 12
@@ -1,11 +1,11 @@
import './session-search-worker.test-fixture'
import '../worker/session-search-worker.test-fixture'
import { mkdir, mkdtemp, rename, rm, stat, utimes, writeFile } from 'node:fs/promises'
import { tmpdir } from 'node:os'
import { dirname, join } from 'node:path'
import SyncDatabase from '../sqlite/sync-database'
import { isolatedScanRoots } from '../ai-vault/session-scanner-test-fixtures'
import SyncDatabase from '../../sqlite/sync-database'
import { isolatedScanRoots } from '../../ai-vault/session-scanner-test-fixtures'
import type { SessionSearchClock, SessionSearchTimerHandle } from './session-search-clock'
import type { SessionSearchScanRoots } from './session-search-scan-roots'
import type { SessionSearchScanRoots } from '../discovery/session-search-scan-roots'
import { assistantRecord, userRecord } from './session-search-transcript-fixtures'
const CLOCK_EPOCH_MS = 1_740_000_000_000
@@ -1,13 +1,14 @@
import './session-search-worker.test-fixture'
import { mkdirSync, rmSync } from 'node:fs'
import '../worker/session-search-worker.test-fixture'
import 'node:fs'
import { appendFile, chmod, mkdir, rm, stat, utimes } from 'node:fs/promises'
import { join } from 'node:path'
import { afterEach, beforeEach, expect, it } from 'vitest'
import { resetSessionParseCacheForTests } from '../ai-vault/parse-cache/session-parse-cache-store'
import { resetTranscriptConsumersForTests } from '../ai-vault/transcripts/session-transcript-consumers'
import type SyncDatabase from '../sqlite/sync-database'
import { resetSessionParseCacheForTests } from '../../ai-vault/parse-cache/session-parse-cache-store'
import { resetTranscriptConsumersForTests } from '../../ai-vault/transcripts/session-transcript-consumers'
import type SyncDatabase from '../../sqlite/sync-database'
import { SessionSearchIndexer } from './session-search-indexer'
import { removeSessionSearchDatabase } from './session-search-schema'
import '../storage/session-search-schema'
import { removeVersionedCacheDatabase } from '../../sqlite/versioned-cache-database'
import { parseTranscript } from './session-search-transcript-fixtures'
import {
claudeLines,
@@ -263,41 +264,6 @@ it('moves the retention window with the clock instead of freezing it at construc
expect(sessionsMatching('ages')).toEqual([])
})
it.skipIf(!CAN_DENY_READ)('stops re-reading a transcript it cannot read', async () => {
const path = transcriptPath()
await writeClaudeTranscript(path, ['a session behind the wrong mode bits'], SESSION_ID)
await chmod(path, 0o000)
try {
await newIndexer().start()
for (let cycle = 0; cycle < 4; cycle++) {
await nextCycle()
}
expect(indexer?.status()).toMatchObject({ filesDue: 0, filesFailed: 1, phase: 'degraded' })
expect(rowFor(path)?.failCount).toBeGreaterThanOrEqual(3)
// A changed stat releases the failed-read hold; chmod alone does not change the freshness key.
await chmod(path, 0o644)
const later = new Date(Date.now() + 60_000)
await utimes(path, later, later)
await nextCycle()
expect(sessionsMatching('mode')).toEqual([SESSION_ID])
expect(indexer?.status()).toMatchObject({ filesFailed: 0, phase: 'current' })
} finally {
await chmod(path, 0o644)
}
})
it('releases the database path when the open itself throws', async () => {
// A directory at the database path makes opening fail without leaving an ownership claim.
mkdirSync(harness.databasePath, { recursive: true })
await expect(newIndexer().initialize()).rejects.toThrow()
rmSync(harness.databasePath, { recursive: true, force: true })
await expect(newIndexer().initialize()).resolves.toBeUndefined()
})
it('re-reads a file a chunked read left half written, and settles it in one pass', async () => {
const path = transcriptPath()
await writeClaudeTranscript(path, ['the committed half'], SESSION_ID)
@@ -353,7 +319,7 @@ it('reads a declined file at its current stat, not the one it was recorded with'
// Retain the session-list cursor while deleting the index to force an append the consumer must decline.
await indexer?.close()
removeSessionSearchDatabase(harness.databasePath)
removeVersionedCacheDatabase(harness.databasePath)
newIndexer()
await appendFile(path, `${claudeLines(['declined turn'], SESSION_ID, 10).join('\n')}\n`)
await parseTranscript(path)
@@ -444,50 +410,6 @@ it('keeps rows under no configured root, and retires them only when gone', async
expect(sessionsMatching('profile')).toEqual([])
})
it('stops everything on close, including work already queued', async () => {
await writeClaudeTranscript(transcriptPath(), ['indexed before the close'], SESSION_ID)
await newIndexer().start()
const queued = indexer?.reconcile({ full: true })
await indexer?.close()
await queued
expect(errors).toEqual([])
expect(clock.pendingTimers).toBe(0)
clock.advance(5 * INTERVAL_MS)
await indexer?.settled()
expect(errors).toEqual([])
const after = transcriptPath(OTHER_SESSION_ID)
await writeClaudeTranscript(after, ['written after the close'], OTHER_SESSION_ID)
await parseTranscript(after)
expect(sessionsMatching('written')).toEqual([])
expect(sessionsMatching('indexed')).toEqual([SESSION_ID])
})
it('stops the opening sweep at its deadline and drains the rest over the passes that follow', async () => {
for (let index = 0; index < 5; index++) {
const session = `0000000${index}-bbbb-4ccc-8ddd-eeeeeeeeeeee`
await writeClaudeTranscript(transcriptPath(session), [`backlogged session ${index}`], session)
}
await newIndexer(readsPerPass(2)).start()
expect(indexer?.status()).toMatchObject({
filesIndexed: 2,
filesDue: 3,
phase: 'indexing',
lastSweepCompletedAt: null
})
await nextCycle()
expect(indexer?.status()).toMatchObject({ filesIndexed: 4, filesDue: 1, phase: 'indexing' })
expect(indexer?.status().lastSweepCompletedAt).toBeNull()
await nextCycle()
expect(sessionsMatching('backlogged')).toHaveLength(5)
expect(indexer?.status()).toMatchObject({ filesIndexed: 5, filesDue: 0, phase: 'current' })
expect(indexer?.status().lastSweepCompletedAt).not.toBeNull()
})
it.skipIf(!CAN_DENY_READ)('retires a deleted file behind a block of unreadable rows', async () => {
// Keep the root nonempty so empty-root grace cannot mask retirement behavior.
await writeClaudeTranscript(transcriptPath(), ['a live conversation'], SESSION_ID)
@@ -520,30 +442,3 @@ it.skipIf(!CAN_DENY_READ)('retires a deleted file behind a block of unreadable r
await chmod(locked, 0o700)
}
})
it('holds out a repeatedly rejected write while other files continue indexing', async () => {
const broken = transcriptPath()
await writeClaudeTranscript(broken, ['rejectedneedle'], SESSION_ID)
await writeClaudeTranscript(transcriptPath(OTHER_SESSION_ID), ['healthyneedle'], OTHER_SESSION_ID)
const subject = newIndexer()
await subject.initialize()
harness.write((db) =>
db.exec(`CREATE TRIGGER reject_one_file BEFORE INSERT ON messages
WHEN (SELECT file_path FROM sessions WHERE id=NEW.session_row_id) LIKE '%${SESSION_ID}%'
BEGIN SELECT RAISE(ABORT, 'rejected fixture write'); END`)
)
await subject.start()
for (let pass = 0; pass < 3; pass++) {
await subject.reconcile({ full: true })
}
expect(rowFor(broken)).toEqual({ state: 'failed', failCount: 3 })
expect(sessionsMatching('healthyneedle')).toEqual([OTHER_SESSION_ID])
expect(sessionsMatching('rejectedneedle')).toEqual([])
await appendFile(
transcriptPath(OTHER_SESSION_ID),
`${claudeLines(['continuedneedle'], OTHER_SESSION_ID, 10).join('\n')}\n`
)
await subject.reconcile({ full: true })
expect(sessionsMatching('continuedneedle')).toEqual([OTHER_SESSION_ID])
expect(rowFor(broken)).toEqual({ state: 'failed', failCount: 3 })
})
@@ -6,13 +6,13 @@ import {
DEFAULT_SESSION_SEARCH_RECONCILE_INTERVAL_MS,
type SessionSearchIndexerOptions
} from './session-search-indexer-options'
import { SessionSearchDirectoryListings } from './session-search-directory-listings'
import { SessionSearchDirectoryListings } from '../discovery/session-search-directory-listings'
import { registerSessionSearchIndexConsumer } from './session-search-index-consumer'
import { runSessionSearchPass } from './session-search-pass'
import { sessionSearchHistoryCutoffMs } from './session-search-retention-policy'
import type { SessionSearchStateCounts } from './session-search-store'
import { SessionSearchWorkerStore } from './session-search-worker-store'
import type { SessionSearchDegradedRoot } from './session-search-degraded-roots'
import { sessionSearchHistoryCutoffMs } from '../session-search-retention-policy'
import type { SessionSearchStateCounts } from '../storage/session-search-store-types'
import { SessionSearchWorkerStore } from '../worker/session-search-worker-store'
import type { SessionSearchDegradedRoot } from '../discovery/session-search-degraded-roots'
import { SessionSearchWorkLoop } from './session-search-work-loop'
// Duplicate indexers would register competing consumers and fence each other’s writes.
@@ -1,12 +1,12 @@
import { appendFile, writeFile } from 'node:fs/promises'
import { dirname, join } from 'node:path'
import { expect, it } from 'vitest'
import { resetSessionParseCacheForTests } from '../ai-vault/parse-cache/session-parse-cache-store'
import { resetTranscriptConsumersForTests } from '../ai-vault/transcripts/session-transcript-consumers'
import { resetSessionParseCacheForTests } from '../../ai-vault/parse-cache/session-parse-cache-store'
import { resetTranscriptConsumersForTests } from '../../ai-vault/transcripts/session-transcript-consumers'
import { registerSessionSearchIndexConsumer } from './session-search-index-consumer'
import { runSessionSearchIndexPass } from './session-search-index-pass'
import { openSessionSearchIndexFile } from './session-search-index-test-fixture'
import { SessionSearchStore } from './session-search-store'
import { openSessionSearchIndexFile } from '../storage/session-search-index-test-fixture'
import { SessionSearchStore } from '../storage/session-search-store'
import { parseTranscript, sessionCandidate, userRecord } from './session-search-transcript-fixtures'
it('recovers a declined append through its proven prefix while the transcript keeps growing', async () => {
@@ -0,0 +1,55 @@
import { afterEach, beforeEach, expect, it } from 'vitest'
import { resetTranscriptConsumersForTests } from '../../ai-vault/transcripts/session-transcript-consumers'
import { registerSessionSearchIndexConsumer } from './session-search-index-consumer'
import {
openSessionSearchIndexFile,
replayTranscriptRead,
syntheticCandidate,
userMessages,
type SessionSearchIndexFile
} from '../storage/session-search-index-test-fixture'
import { SessionSearchStore } from '../storage/session-search-store'
let index: SessionSearchIndexFile
let store: SessionSearchStore
const messages = userMessages('Searchable conversation', 2)
beforeEach(async () => {
index = await openSessionSearchIndexFile('ss-list-reparse')
store = new SessionSearchStore(index.path)
registerSessionSearchIndexConsumer(store)
})
afterEach(async () => {
resetTranscriptConsumersForTests()
store.close()
await index.close()
})
it('still indexes new appended messages', () => {
replayTranscriptRead({ messages })
replayTranscriptRead({
candidate: syntheticCandidate({ sizeBytes: 5000 }),
mode: 'append',
previousByteOffset: 4096,
messages,
outcome: { byteOffset: 5000 }
})
expect(index.db.prepare('SELECT count(*) AS n FROM messages').get()).toEqual({ n: 4 })
})
it('keeps the index current when a second fold appends a span it already holds', () => {
// Pi and OMP can publish the same append when folding one shared transcript.
replayTranscriptRead({ messages })
const append = {
candidate: syntheticCandidate({ sizeBytes: 5000 }),
mode: 'append' as const,
previousByteOffset: 4096,
messages,
outcome: { byteOffset: 5000 }
}
replayTranscriptRead(append)
replayTranscriptRead(append)
expect(index.db.prepare('SELECT count(*) AS n FROM messages').get()).toEqual({ n: 4 })
expect(index.db.prepare('SELECT state FROM files').get()).toEqual({ state: 'current' })
})
@@ -1,17 +1,17 @@
import { mkdtemp, rm, writeFile, appendFile } from 'node:fs/promises'
import { mkdtemp, rm, writeFile } from 'node:fs/promises'
import { tmpdir } from 'node:os'
import { join } from 'node:path'
import { afterEach, beforeEach, expect, it } from 'vitest'
import { resetSessionParseCacheForTests } from '../ai-vault/parse-cache/session-parse-cache-store'
import { resetSessionParseCacheForTests } from '../../ai-vault/parse-cache/session-parse-cache-store'
import {
registerTranscriptConsumer,
resetTranscriptConsumersForTests,
type TranscriptSessionIdentity
} from '../ai-vault/transcripts/session-transcript-consumers'
import { requestWholeTranscriptRead } from '../ai-vault/transcripts/session-transcript-reader'
import SyncDatabase from '../sqlite/sync-database'
} from '../../ai-vault/transcripts/session-transcript-consumers'
import '../../ai-vault/transcripts/session-transcript-reader'
import SyncDatabase from '../../sqlite/sync-database'
import { registerSessionSearchIndexConsumer } from './session-search-index-consumer'
import { SessionSearchStore } from './session-search-store'
import { SessionSearchStore } from '../storage/session-search-store'
import {
assistantRecord,
CLAUDE_SESSION_ID as SESSION_ID,
@@ -64,31 +64,6 @@ function sessionsMatching(term: string): string[] {
).map((row) => row.id)
}
it('indexes a Claude transcript through the reader and resumes on append', async () => {
const root = await makeTempDir()
const path = join(root, `${SESSION_ID}.jsonl`)
await writeFile(
path,
`${[
userRecord(0, 'find the flaky terminal reattach'),
assistantRecord(1, 'look at resolveTerminalPath first')
].join('\n')}\n`
)
await parseTranscript(path)
expect(errors).toEqual([])
expect(sessionsMatching('reattach')).toEqual([SESSION_ID])
expect(sessionsMatching('terminal')).toEqual([SESSION_ID])
await appendFile(path, `${assistantRecord(2, 'the zygomorphic follow-up landed')}\n`)
const resumed = await parseTranscript(path)
expect(resumed.stats).toMatchObject({ incremental: 1, fullParses: 0 })
expect(errors).toEqual([])
expect(sessionsMatching('zygomorphic')).toEqual([SESSION_ID])
expect(reader.prepare('SELECT count(*) AS n FROM sessions').get()).toEqual({
n: 1
})
})
it('keeps the prompt searchable while excluding tool results', async () => {
const root = await makeTempDir()
const codexHome = await makeTempDir()
@@ -164,30 +139,3 @@ it('names a Codex session mid-read from its own opening record', async () => {
cwd: '/repo/app'
})
})
it('indexes a file the session list already read past, once a whole read is asked for', async () => {
const root = await makeTempDir()
const path = join(root, `${SESSION_ID}.jsonl`)
await writeFile(path, `${userRecord(0, 'the opening prompt')}\n`)
// Simulate first enablement with a warm session-list cache and an empty index.
resetTranscriptConsumersForTests()
await parseTranscript(path)
registerSessionSearchIndexConsumer(store)
await appendFile(path, `${assistantRecord(1, 'a zygomorphic reply')}\n`)
const appended = await parseTranscript(path)
expect(appended.stats).toMatchObject({ incremental: 1, fullParses: 0 })
// The index never saw the preceding bytes, so it must decline this append.
expect(sessionsMatching('zygomorphic')).toEqual([])
expect(store.files()).toEqual([])
requestWholeTranscriptRead(path)
const reread = await parseTranscript(path)
expect(reread.stats).toMatchObject({ incremental: 0, fullParses: 1 })
expect(errors).toEqual([])
expect(sessionsMatching('zygomorphic')).toEqual([SESSION_ID])
expect(sessionsMatching('opening')).toEqual([SESSION_ID])
expect(store.files().map((row) => row.state)).toEqual(['current'])
})
@@ -1,10 +1,10 @@
import './session-search-worker.test-fixture'
import '../worker/session-search-worker.test-fixture'
import { chmod, rm } from 'node:fs/promises'
import { delimiter, join } from 'node:path'
import { afterEach, beforeEach, expect, it } from 'vitest'
import { resetSessionParseCacheForTests } from '../ai-vault/parse-cache/session-parse-cache-store'
import { resetTranscriptConsumersForTests } from '../ai-vault/transcripts/session-transcript-consumers'
import type SyncDatabase from '../sqlite/sync-database'
import { resetSessionParseCacheForTests } from '../../ai-vault/parse-cache/session-parse-cache-store'
import { resetTranscriptConsumersForTests } from '../../ai-vault/transcripts/session-transcript-consumers'
import type SyncDatabase from '../../sqlite/sync-database'
import { SessionSearchIndexer } from './session-search-indexer'
import {
FakeSessionSearchClock,
@@ -1,21 +1,21 @@
import './session-search-worker.test-fixture'
import '../worker/session-search-worker.test-fixture'
import { join } from 'node:path'
import { afterEach, beforeEach, expect, it, vi } from 'vitest'
// Replace worker transport while exercising the real SQLite readers.
export const openCodeReadCalls: string[] = []
vi.mock(
'../ai-vault/scanners/opencode/reader-transport/session-scanner-opencode-sqlite-worker-spawn',
'../../ai-vault/scanners/opencode/reader-transport/session-scanner-opencode-sqlite-worker-spawn',
async () => {
const list =
await import('../ai-vault/scanners/opencode/sqlite/session-scanner-opencode-sqlite-list')
await import('../../ai-vault/scanners/opencode/sqlite/session-scanner-opencode-sqlite-list')
const parse =
await import('../ai-vault/scanners/opencode/sqlite/session-scanner-opencode-sqlite')
await import('../../ai-vault/scanners/opencode/sqlite/session-scanner-opencode-sqlite')
const capture =
await import('../ai-vault/scanners/opencode/sqlite/session-scanner-opencode-sqlite-capture')
await import('../../ai-vault/scanners/opencode/sqlite/session-scanner-opencode-sqlite-capture')
const own = await import('./session-search-opencode-index.test')
const { listOpenCode2SqliteSessions } =
await import('../ai-vault/scanners/opencode2/session-scanner-opencode2-sqlite-list')
await import('../../ai-vault/scanners/opencode2/session-scanner-opencode2-sqlite-list')
return {
listOpenCode2SqliteSessionsViaWorker: listOpenCode2SqliteSessions,
resolveOpenCodeSqliteWorkerEntryPath: () => null,
@@ -37,16 +37,13 @@ vi.mock(
}
}
)
import { resetSessionParseCacheForTests } from '../ai-vault/parse-cache/session-parse-cache-store'
import { resetTranscriptConsumersForTests } from '../ai-vault/transcripts/session-transcript-consumers'
import {
appendOpenCodeSqliteTurn,
writeOpenCodeSqliteDatabase
} from '../ai-vault/scanners/opencode/sqlite/session-scanner-opencode-sqlite-fixture'
import type SyncDatabase from '../sqlite/sync-database'
import { SessionSearchEngine } from './session-search-engine'
import { resetSessionParseCacheForTests } from '../../ai-vault/parse-cache/session-parse-cache-store'
import { resetTranscriptConsumersForTests } from '../../ai-vault/transcripts/session-transcript-consumers'
import { writeOpenCodeSqliteDatabase } from '../../ai-vault/scanners/opencode/sqlite/session-scanner-opencode-sqlite-fixture'
import type SyncDatabase from '../../sqlite/sync-database'
import { SessionSearchEngine } from '../query/session-search-engine'
import { SessionSearchIndexer } from './session-search-indexer'
import { openSessionSearchDatabase } from './session-search-schema'
import { openSessionSearchDatabase } from '../storage/session-search-schema'
import {
FakeSessionSearchClock,
openSessionSearchIndexerHarness,
@@ -159,20 +156,3 @@ it('excludes tool output from both search scopes', async () => {
expect(all.hits).toEqual([])
expect(openEngine().search({ query: TOOL_ONLY, scope: 'conversation' }).hits).toEqual([])
})
it('re-reads a session that gained a message and replaces its rows', async () => {
writeVault()
const started = await startIndexer()
expect(openEngine().search({ query: 'orthogonal vestibule' }).hits).toHaveLength(0)
appendOpenCodeSqliteTurn(dbPath(), SESSION, {
role: 'assistant',
parts: ['an orthogonal vestibule appeared']
})
await started.reconcile()
const engine = openEngine()
expect(engine.search({ query: 'orthogonal vestibule' }).hits[0]?.sessionId).toBe(SESSION)
expect(engine.search({ query: ANSWER }).hits).toHaveLength(1)
expect(openCodeReadCalls.filter((call) => call === `capture:${SESSION}`)).toHaveLength(2)
})
@@ -1,17 +1,17 @@
import type { AiVaultScanIssue } from '../../shared/ai-vault/contracts/ai-vault-types'
import type { AiVaultScanIssue } from '../../../shared/ai-vault/contracts/ai-vault-types'
import {
cursorChatMetaRefusals,
withCursorChatMetaScan
} from '../ai-vault/scanners/cursor/session-scanner-cursor-chat-meta'
import { recordSessionScanIssue } from '../ai-vault/session-scan-issues'
} from '../../ai-vault/scanners/cursor/session-scanner-cursor-chat-meta'
import { recordSessionScanIssue } from '../../ai-vault/session-scan-issues'
import {
mergeDegradedRoots,
scanIssueDegradedRoots,
unreadableRoots,
type SessionSearchDegradedRoot
} from './session-search-degraded-roots'
import { retireDeletedSessionSearchSources } from './session-search-deleted-sources'
import type { SessionSearchDirectoryReader } from './session-search-directory-listings'
} from '../discovery/session-search-degraded-roots'
import { retireDeletedSessionSearchSources } from '../discovery/session-search-deleted-sources'
import type { SessionSearchDirectoryReader } from '../discovery/session-search-directory-listings'
import { runSessionSearchIndexPass } from './session-search-index-pass'
import {
discoverSessionSearchCandidates,
@@ -19,9 +19,12 @@ import {
sessionSearchEmptiedRoots,
sessionSearchRootListings,
type SessionSearchScanRoots
} from './session-search-scan-roots'
import type { SessionSearchFileRow, SessionSearchIndexStore } from './session-search-store'
import { sessionSearchEnumeratedContainers } from './session-search-synthetic-sources'
} from '../discovery/session-search-scan-roots'
import type {
SessionSearchFileRow,
SessionSearchIndexStore
} from '../storage/session-search-store-types'
import { sessionSearchEnumeratedContainers } from '../discovery/session-search-synthetic-sources'
// Bound recent-cycle retirement work and prioritize rows within the recency window.
const RETIREMENT_ROWS_PER_CYCLE = 512
@@ -1,11 +1,8 @@
import { expect, it } from 'vitest'
import type { SessionFileCandidate } from '../ai-vault/session-scanner-types'
import type { SessionSearchIndexedFile } from './session-search-file-cursor'
import {
SESSION_SEARCH_FAILURES_BEFORE_HELD_OUT,
sessionSearchReadDecision
} from './session-search-read-decision'
import type { SessionSearchFileRow } from './session-search-store'
import type { SessionFileCandidate } from '../../ai-vault/session-scanner-types'
import type { SessionSearchIndexedFile } from '../storage/session-search-file-cursor'
import { sessionSearchReadDecision } from './session-search-read-decision'
import type { SessionSearchFileRow } from '../storage/session-search-store-types'
const PATH = '/transcripts/one.jsonl'
const MTIME = 1_740_000_000_000
@@ -66,23 +63,6 @@ it('reads whole rather than appending onto a cursor that continues nothing', ()
expect(decide({ file: { sizeBytes: 40 }, cursor })).toBe('whole')
})
it('retries a failed read until it has failed enough times at one stat', () => {
for (let failures = 1; failures < SESSION_SEARCH_FAILURES_BEFORE_HELD_OUT; failures++) {
expect(
decide({ row: row({ state: 'failed', failCount: failures, failedMtimeMs: MTIME }) })
).toBe('any')
}
expect(
decide({
row: row({
state: 'failed',
failCount: SESSION_SEARCH_FAILURES_BEFORE_HELD_OUT,
failedMtimeMs: MTIME
})
})
).toBe('skip')
})
it('starts trying again the moment a held-out file changes', () => {
expect(
decide({
@@ -1,7 +1,10 @@
import type { SessionFileCandidate } from '../ai-vault/session-scanner-types'
import type { SessionParseReadRequirement } from '../ai-vault/parse-cache/session-scanner-parse-cache'
import { requiresWholeRead, type SessionSearchIndexedFile } from './session-search-file-cursor'
import type { SessionSearchFileRow } from './session-search-store'
import type { SessionFileCandidate } from '../../ai-vault/session-scanner-types'
import type { SessionParseReadRequirement } from '../../ai-vault/parse-cache/session-scanner-parse-cache'
import {
requiresWholeRead,
type SessionSearchIndexedFile
} from '../storage/session-search-file-cursor'
import type { SessionSearchFileRow } from '../storage/session-search-store-types'
// Allow transient rewrite failures before holding out a file at an unchanged mtime.
export const SESSION_SEARCH_FAILURES_BEFORE_HELD_OUT = 3
@@ -1,15 +1,13 @@
import './session-search-worker.test-fixture'
import { join } from 'node:path'
import '../worker/session-search-worker.test-fixture'
import 'node:path'
import { afterEach, beforeEach, expect, it, vi } from 'vitest'
import { SessionSearchIndexer } from './session-search-indexer'
import {
FakeSessionSearchClock,
openSessionSearchIndexerHarness,
writeClaudeTranscript,
type SessionSearchIndexerHarness
} from './session-search-indexer-test-fixture'
import { resetSessionParseCacheForTests } from '../ai-vault/parse-cache/session-parse-cache-store'
import { resetTranscriptConsumersForTests } from '../ai-vault/transcripts/session-transcript-consumers'
import { resetSessionParseCacheForTests } from '../../ai-vault/parse-cache/session-parse-cache-store'
import { resetTranscriptConsumersForTests } from '../../ai-vault/transcripts/session-transcript-consumers'
let harness: SessionSearchIndexerHarness
let indexer: SessionSearchIndexer | undefined
@@ -26,38 +24,6 @@ afterEach(async () => {
await harness.cleanup()
})
it('refreshes roots on scheduled full sweeps and reuses them on recent cycles', async () => {
const clock = new FakeSessionSearchClock()
let roots = harness.roots
const resolveRoots = vi.fn(async () => roots)
indexer = new SessionSearchIndexer({
databasePath: harness.databasePath,
roots,
resolveRoots,
historyDays: null,
clock,
fullSweepEveryCycles: 1
})
await indexer.start()
expect(resolveRoots).toHaveBeenCalledTimes(1)
const newRoot = join(harness.root, 'late')
const id = 'aaaaaaaa-bbbb-4ccc-8ddd-eeeeeeeeeeee'
await writeClaudeTranscript(join(newRoot, 'project', `${id}.jsonl`), ['a late conversation'], id)
roots = { ...roots, claudeProjectsDir: newRoot }
clock.advance(20_000)
await indexer.settled()
expect(resolveRoots).toHaveBeenCalledTimes(1)
expect(indexer.status().filesIndexed).toBe(0)
clock.advance(20_000)
await indexer.settled()
expect(resolveRoots).toHaveBeenCalledTimes(2)
expect(indexer.status().filesIndexed).toBe(1)
clock.advance(20_000)
await indexer.settled()
expect(resolveRoots).toHaveBeenCalledTimes(2)
expect(indexer.status().filesIndexed).toBe(1)
})
it('does not access a closed store when pending discovery completes', async () => {
const pending = Promise.withResolvers<typeof harness.roots>()
const errors = vi.fn()
@@ -3,8 +3,8 @@ import {
createSessionParseStats,
parseAgentSessionFileCached,
type SessionParseStats
} from '../ai-vault/parse-cache/session-scanner-parse-cache'
import type { SessionFileCandidate } from '../ai-vault/session-scanner-types'
} from '../../ai-vault/parse-cache/session-scanner-parse-cache'
import type { SessionFileCandidate } from '../../ai-vault/session-scanner-types'
export const CLAUDE_SESSION_ID = 'aaaaaaaa-bbbb-4ccc-8ddd-eeeeeeeeeeee'
export const CODEX_SESSION_ID = '019f0000-1111-7222-8333-444444444444'

Some files were not shown because too many files have changed in this diff Show More