š fix(dvara): the watchdog spares a core whose member has a live child outside it
dvara's watchdog no longer kills a hook whose quiet pair is waiting on a child of its own. On 2026-11-26 it killed a pre-push as an internal deadlock: pnpm (91855) and sh (91890) sat quiet on a pipe, while pnpm's other child (91869) polled for agnipariksha's mutation lock, which another worktree held. The waiter keeps no descriptor on the lock, so lsof showed nothing that leads out of the pair (slice #625).
The rule (findHangCore)
- A core counts as closed only if every live (non-zombie) child of every member is also a member.
- A parent waits on its children's exit, which
lsofnever shows. So a core with a live child outside it is spared. - Nothing names agnipariksha or any other tool.
Trade-off
- A real deadlock with an idle sibling child of a member is now spared too. It gets only the 60-minute
idle-externalwarning. psandlsofshow an idle sibling exactly as they show a lock waiter, so no rule can tell the two apart. This is the rule #625 was approved with.- The deadlock the watchdog was built for still convicts and is still killed. Its fixtures are real captures from 2026-09-13 and are unchanged.
Tests (watchdog.test.ts)
- The 2026-11-26 incident, scrubbed from the real
psandlsofoutput, is spared. - The same pair convicts once the waiter has exited or is a zombie.
- A live child of a non-member does not spare the core.
- The synthetic fixtures had a live non-member child next to the core, which the new rule spares:
- The shared
createWatchdogfixture's idlecat(40480) is now a zombie. - The shape test's pid 3 now has a parent outside the core.
- Two
decidespare tests now have their extra leaf outside the core, so each one still spares for its own reason.
- The shared
- New tests cover paths no test reached before:
- fds with no type, device or address,
- a pid with no classified fds,
- an expired diagnostics entry that disappears between
statand removal, - a watchdog stopped without a verdict.
Rewrites in watchdog.ts (no behaviour change)
These remove the equivalent mutants that #628 and #629 left. Each states its check only once.
| Before | After | Why the behaviour is the same |
|---|---|---|
perfLevelNames = [], supervisorFds = [] | both required | The supervisor already passes perfLevelNames, and inspect already passes supervisorFds. Tests pass []. watchdog.js is not a package export, and the README's module contract already lists perfLevels as required. |
if (!line) continue in parseLsof | dropped | An empty line has no tag, so it matches no branch. |
x ?? "" on an fd's name or type | String(x) | "null" matches no pattern, no type table entry and no type check, just as "" didn't. |
| supervisor objects omit a missing device | they include null | Every lookup is guarded by a non-empty string. |
holders.get(fd.device ?? "") | holders.get(fd.device) | Only present devices are stored. |
/^0x0+$/i.test(peer) | Number.parseInt(peer, 16) === 0 | Same result for every 0x[0-9a-f]+ address. |
classes.get(pid) ?? [] | if (!fds) continue or ?.some | A missing entry still yields nothing. |
(cpuDelta.get(pid) ?? 1) !== 0 and === 0 | without ?? 1 | undefined compares with 0 the same way 1 does. |
ipc.length === 0 || ⦠| dropped | A leaf with no channel reaches no peer, which peers.length > 0 already rejects. |
fd.device !== null && in coreSharedOutside | dropped | Its set never holds null. |
|| classes === null in closedVerdict | dropped | decide returns internal-deadlock only when classes are present, and both callers pass the same classes. |
root find + !== undefined | one tree.some(ā¦) | The root appears in the tree only once. |
summary.verdict && ⦠&& verdictAt !== null | verdictAt !== null && ⦠| The two are set and cleared together. |
The refactor commit's body says the supervisor passed both defaulted arguments. Only perfLevelNames comes from the supervisor; the table above has it right.
Checks
- Mutation gate (
pnpm exec agnipariksha --lane dvara --files packages/dvara/src/watchdog.ts --no-reuse): 1001 of 1001 killed, 0 blocking. pnpm checkpasses.pnpm --filter ./packages/dvara testpasses.- The README's watchdog section states the new rule.
Review and approval
- Alok approved the slice with š on https://github.com/veda-hq/veda/issues/625#issuecomment-7193218737.
- Alok also said to merge this fix without a Cubic review. Cubic's allowance is used up until 2026-12-09, so its check reports neutral.
- A dvara patch release follows.
Slice: #625
š¤ Generated with Claude Code
Summary by cubic
Fixes dvara's watchdog killing a hook whose member has a live child outside the deadlock core. A parent waits on its children's exit, which lsof never shows, so a core with such a child is now spared.
Trade-off
- A real deadlock with an idle sibling child of a member is also spared now, getting only the 60-minute
idle-externalwarning. psandlsofshow an idle sibling exactly like a lock waiter, so no rule can tell them apart.
Refactor and tests
- The
watchdog.tsrewrites state each check once and have no behavior change. - New tests reproduce the 2026-11-26 incident from real
psandlsofoutput and cover paths no test reached before.