mirror of
https://github.com/stablyai/orca.git
synced 2026-10-24 00:04:01 +00:00
fix(runtime): clear stale doubt when a probe later confirms the pane absent
The exited arm set provenAbsent but left any verdict an earlier unanswerable probe had recorded, so a null-then-false transition published connected:false while getPtyLivenessVerdict still reported unverifiable — under-reporting a pane the probe positively answered about. The live arm's asymmetry is deliberate and unchanged: it clears doubt only while the leaf still publishes connected, because dropping a verdict under connected:false is what worker observation reads as a confirmed exit. Here that reading is the correct one.
This commit is contained in:
@@ -34101,6 +34101,12 @@ export class OrcaRuntimeService {
|
||||
break
|
||||
case 'exited':
|
||||
provenAbsent = isConfirmedPtyAbsence(unlistedPresence)
|
||||
// The probe positively answered absence, so lost-contact doubt from an
|
||||
// earlier unanswerable probe is stale; leaving it would publish a pane
|
||||
// we hold proof about as `unverifiable`.
|
||||
if (provenAbsent) {
|
||||
this.forgetPtyLivenessVerdict(leaf.ptyId)
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
@@ -195,6 +195,27 @@ describe('listTerminals liveness truth for restored leaves', () => {
|
||||
expect(runtime.getPtyLivenessVerdict('pty-proven-absent')).toBeNull()
|
||||
})
|
||||
|
||||
// A confirmed absence is positive evidence of the exit, so lost-contact doubt
|
||||
// recorded by an earlier unanswerable probe is stale. Publishing
|
||||
// `connected:false` while still reporting `unverifiable` would under-report a
|
||||
// pane we hold proof about.
|
||||
it('clears recorded doubt when the presence query later proves the pane absent', async () => {
|
||||
let answer: boolean | null = null
|
||||
const runtime = makeRuntimeWithLeaf({
|
||||
leafPtyId: 'pty-doubted-then-absent',
|
||||
controllerSessions: [],
|
||||
hasPty: () => answer
|
||||
})
|
||||
|
||||
await runtime.listTerminals(`id:${WORKTREE_ID}`)
|
||||
expect(runtime.getPtyLivenessVerdict('pty-doubted-then-absent')?.status).toBe('unverifiable')
|
||||
|
||||
answer = false
|
||||
const { terminals } = await runtime.listTerminals(`id:${WORKTREE_ID}`)
|
||||
expect(terminals[0]).toMatchObject({ connected: false, writable: false })
|
||||
expect(runtime.getPtyLivenessVerdict('pty-doubted-then-absent')).toBeNull()
|
||||
})
|
||||
|
||||
it('clears recorded doubt when the presence query later proves the pane live', async () => {
|
||||
let answer: boolean | null = null
|
||||
const runtime = makeRuntimeWithLeaf({
|
||||
|
||||
Reference in New Issue
Block a user