style(desktop): format close-stop handling

This commit is contained in:
Hermes Agent
2026-09-24 19:36:44 -05:00
committed by brooklyn!
parent de16db2b6b
commit 354d499511
2 changed files with 27 additions and 18 deletions

View File

@@ -44,21 +44,25 @@ test('close/stop inventories owned PIDs after the tree kill and clears only unhe
const cleared: string[] = []
const alive = new Set([9001])
const result = finishWindowsCloseStop([4242, 9001], [
{ path: 'gone.lock', holderPids: [4242] },
{ path: 'still-held.lock', holderPids: [9001] },
{ path: 'foreign-held.lock', holderPids: [7777], held: true },
{ path: 'no-holder.lock', holderPids: [] }
], {
killTree: pid => {
killed.push(pid)
alive.delete(pid === 4242 ? 4242 : -1)
},
isPidAlive: pid => alive.has(pid),
clearLock: path => {
cleared.push(path)
const result = finishWindowsCloseStop(
[4242, 9001],
[
{ path: 'gone.lock', holderPids: [4242] },
{ path: 'still-held.lock', holderPids: [9001] },
{ path: 'foreign-held.lock', holderPids: [7777], held: true },
{ path: 'no-holder.lock', holderPids: [] }
],
{
killTree: pid => {
killed.push(pid)
alive.delete(pid === 4242 ? 4242 : -1)
},
isPidAlive: pid => alive.has(pid),
clearLock: path => {
cleared.push(path)
}
}
})
)
assert.deepEqual(killed, [4242, 9001], 'does not widen the tree-kill to foreign holders')
assert.deepEqual(result.remainingPids, [9001])

View File

@@ -12340,12 +12340,15 @@ function releaseHostSpawnReservation() {
hostSpawnReservation = null
}
function startHermes({ supervisorRecovery = false }: { supervisorRecovery?: boolean } = {}): Promise<Awaited<ReturnType<typeof backendConnectionState.getPromise>>> {
function startHermes({ supervisorRecovery = false }: { supervisorRecovery?: boolean } = {}): Promise<
Awaited<ReturnType<typeof backendConnectionState.getPromise>>
> {
primaryRecoverySuppressed = false
primaryStartsInFlight += 1
const start: Promise<Awaited<ReturnType<typeof backendConnectionState.getPromise>>> =
localBackendLifecycle.start(() => runHermesStart({ supervisorRecovery }))
const start: Promise<Awaited<ReturnType<typeof backendConnectionState.getPromise>>> = localBackendLifecycle.start(
() => runHermesStart({ supervisorRecovery })
)
const releaseStart = (): void => {
primaryStartsInFlight -= 1
@@ -12461,7 +12464,9 @@ function latchedBootFailure(): Error | null {
return bootstrapFailure ?? backendStartFailure ?? remoteReauthFailure ?? null
}
async function runHermesStart({ supervisorRecovery = false }: { supervisorRecovery?: boolean } = {}): Promise<Awaited<ReturnType<typeof backendConnectionState.getPromise>>> {
async function runHermesStart({ supervisorRecovery = false }: { supervisorRecovery?: boolean } = {}): Promise<
Awaited<ReturnType<typeof backendConnectionState.getPromise>>
> {
// Only the single-instance lock holder may reap/spawn/claim the desktop
// backend. A lock-losing instance must stay inert even if some path reaches
// here (e.g. the deferred-quit window before `ready`): its reapOrphans()