test(worktree-activation): restore the OMP surfaced-agent resume test

The handoff removal deleted it alongside the terminal-owner tests, but it
covers the surfaced-PTY block that still guards resume, including an agent
whose ownership is unknown.
This commit is contained in:
Brennan Benson
2026-09-25 02:33:29 -07:00
parent 2bd44f5f7d
commit f79eb9b88f
@@ -368,6 +368,40 @@ describe('worktree agent activation gate', () => {
})
})
it.each(['present', 'unknown'] as const)(
'does not resume OMP when a surfaced %s agent lacks conversation ownership',
async (agentOwnership) => {
const record = {
...sleepingRecord('old-tab', DEAD_LEAF_ID, 'omp-session'),
agent: 'omp' as const
}
const ptyId = `${WORKTREE_ID}@@current-omp`
const { deps, resume, createTab } = testDeps({
sessions: [{ ...listed(ptyId), title: 'OMP', agentOwnership }],
sleeping: [record],
surfaceOwners: new Map([
[
ptyId,
{
ptyId,
tabId: 'current-tab',
paneKey: `current-tab:${LIVE_LEAF_ID}`
}
]
])
})
seedExistingSurface(deps.getState(), {
tabId: 'current-tab',
leafId: LIVE_LEAF_ID,
boundPtyId: ptyId
})
await expect(runWorktreeAgentActivationGate(WORKTREE_ID, deps)).resolves.toBe('blocked')
expect(resume).not.toHaveBeenCalled()
expect(createTab).not.toHaveBeenCalled()
expect(deps.getState().sleepingAgentSessionsByPaneKey[record.paneKey]).toEqual(record)
}
)
it('does not use an ambiguous tab binding as a live session claim', async () => {
const live = sleepingRecord('tab-live', LIVE_LEAF_ID, 'live-session')
const livePtyId = `${WORKTREE_ID}@@live-agent`