✨ feat(dvara): a built-in watchdog and dvara slot (#376)
Slice: #376
Under work item #43.
W-63 moves athya_mono's hook watchdog and its per-machine test slot into dvara, so
athya_mono can drop its own copies once this is released.
"watchdog": "dvara"attaches the built-in watchdog (src/watchdog.ts,
src/liveness.ts). It stops only a hook that is provably deadlocked: exit 124, with the
last stage markedtimed_out. A hook that is just slow keeps running. It is opt-in;
any other string is still read as a module path.DVARA_WATCHDOG*variables set it.dvara slot(src/slot.ts) runs a command, with its--setvariables, only while it
holds a machine-wide slot, and it never waits for one. Its lock file and record match
the old wrapper byte for byte, so runs from before and after the move share one slot.- The tests are ported to
node:testcase for case. The capturedlsof/psfixtures
underfixtures/watchdog/name a neutral working directory.
No version bump and no tag. The release is cut separately after this merges.
Evidence: pnpm check at the PR head
pnpm check (provenance, then pnpm -r check, test:scripts, eslint . and
scripts/guards.sh) exited 0:
| Package | Tests | Pass | Fail | Skipped | Lines / branches / funcs |
|---|---|---|---|---|---|
| dvara | 569 | 569 | 0 | 0 | 99.73 / 96.85 / 99.50 |
| agnipariksha | 117 | 117 | 0 | 0 | 99.43 / 98.99 / 98.77 |
| eslint-plugin-shuddhi | 2915 | 2915 | 0 | 0 | 99.98 / 97.56 / 100.00 |
| pariksha | 4006 | 4006 | 0 | 0 | 99.97 / 99.14 / 99.94 |
| kavach (node) | 767 | 767 | 0 | 0 | 99.89 / 97.44 / 99.68 |
| kavach (python) | 917 | OK | — | — | — |
| sarathi | 585 | 582 | 0 | 3 (live-service cases, opt-in via SARATHI_LIVE_SERVICES) | 99.58 / 97.77 / 99.79 |
| scripts | 184 | 184 | 0 | 0 | 100.00 / 98.61 / 100.00 |
Coverage of dvara's new files: slot.ts 100 / 97.99 / 100, watchdog.ts
98.52 / 92.38 / 97.50, supervisor.fixture.ts 100 / 100 / 100. The dvara build and smoke
run (node dist/cli.js --version && node dist/cli.js shell stages) both passed. The
guards passed too: pariksha boundary found no denied word in 579 files, the required
settings are present, and .claude/sarathi.json is valid.
🤖 Generated with Claude Code
Summary by cubic
Moves athya_mono's hook watchdog and its per-machine test slot into dvara, so athya_mono can drop its own copies once this is released.
New Features
"watchdog": "dvara"attaches the built-in watchdog, which stops only a provably deadlocked hook (exit 124, last stagetimed_out) and never a slow one.- It is opt-in: any other string is still read as a module path, and
DVARA_WATCHDOG*variables configure it. dvara slotruns a command with its--setvariables only while holding a machine-wide slot, and it never waits for one.- Its lock file and record match the old wrapper byte for byte, so runs on either side of the move share one slot.
No version bump or tag; the release is cut separately.