mirror of
https://github.com/stablyai/orca.git
synced 2026-10-02 00:02:05 +00:00
fix(pty): preserve owner close without incarnation
This commit is contained in:
@@ -69,6 +69,24 @@ describe('killPtySessions input bounds', () => {
|
||||
])
|
||||
})
|
||||
|
||||
it('allows explicit owner-close when a capable host omits incarnation evidence', async () => {
|
||||
const provider = {
|
||||
listProcesses: vi.fn(async () => []),
|
||||
supportsIncarnationFence: vi.fn(() => true)
|
||||
}
|
||||
const shutdown = vi.fn(async () => undefined)
|
||||
const results = await killPtySessions([{ id: 'session-1' }], 'owner-close', {
|
||||
listProviders: () => [{ provider: provider as never }],
|
||||
providerForSession: () => provider as never,
|
||||
shutdown,
|
||||
supportsIncarnationFence: (target, id) =>
|
||||
target.supportsIncarnationFence?.({ sessionId: id }) ?? false
|
||||
})
|
||||
|
||||
expect(shutdown).toHaveBeenCalledTimes(1)
|
||||
expect(results).toEqual([{ id: 'session-1', verdict: 'exited' }])
|
||||
})
|
||||
|
||||
it('resolves incarnation-fence capability per session route', async () => {
|
||||
const provider = {
|
||||
listProcesses: vi.fn(async () => []),
|
||||
|
||||
@@ -81,7 +81,10 @@ export async function killPtySessions(
|
||||
}
|
||||
}
|
||||
fenceCapabilities.set(ref.id, fenceCapable)
|
||||
if (fenceCapable && !ref.incarnationId) {
|
||||
// Orphan cleanup must prove the exact incarnation before acting. Explicit
|
||||
// owner-close is already user-authorized and retains legacy id-only behavior
|
||||
// when the listing omits an incarnation.
|
||||
if (intent === 'orphan-cleanup' && fenceCapable && !ref.incarnationId) {
|
||||
return { ...ref, verdict: 'refused', reason: 'missing incarnation fence' }
|
||||
}
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user