Repository navigation
fix(provider): 0.10.12 — the watchdog restores an enabled provider job launchd lost (port of staging #47) - #1945
Merged
Merged
Conversation
…g's grace and restart (red) Port of jonathan308/d-inference-pr-staging#47 onto dev (issue #1104), in two steps. This commit adds AbsentProviderRecovery and its 37 tests, with the decision the watchdog makes on dev: `providerLoaded: snapshot.loaded`. An installed, explicitly enabled job that launchd no longer holds (booted out, not stopped) is then `notManaged`, so it never enters the outage grace and nothing restarts it. Locally (Xcode 27.2, CPU sandbox) on this tree: - AbsentProviderRecoveryTests: 13 tests, 30 issues; - AbsentProviderRecoveryIntegrationTests: 21 tests, 60 issues (grace, issuance under the real lifecycle lease, candidate attribution and rollback backoff after an absent bootstrap); - AbsentProviderRecoveryAdapterTests (launchctl result parsing): 3 pass. Nothing calls the type yet; the next commit makes the decision see an eligible absent job as managed and wires the watchdog. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…lost Port of jonathan308/d-inference-pr-staging#47 onto dev, for 0.10.12 (issue #1104). - AbsentProviderRecovery.decision sees an eligible absent job as managed (`snapshot.loaded || snapshot.eligible`): auto_restart on, the provider's own RunAtLoad plist installed, an explicit "enabled" launchd override, and no live provider identity. A job `darkbloom stop` disabled stays stopped: the watchdog never enables a disabled job. - Watchdog.runTick calls AbsentProviderRecovery.handleTick first, under the lifecycle lease stop and update hold, with bounded (3 s) launchctl calls. Adapted to dev: never for a cluster member's job, or while the pair runs on this Mac (ClusterService.pairServesHere), which own that job as the loaded path's pairOwnsServing does. A loaded job falls through to dev's path unchanged. - cli-reference.md (darkbloom watchdog), test.md and the changelog fragment say so. Tests: the previous commit's 37 fail with dev's loaded-only decision (90 issues) and pass here. WatchdogCommandTests, PairVersionSplitTests, UnpairedMacServesNormallyTests, WatchdogCrashLoopGuardTests and WatchdogDecisionTests pass unchanged (local, CPU sandbox). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…s job again under the lease Independent refactor pass of this port (#1945). - The watchdog's tick-start rule (never a cluster member's job, never while the pair runs here) is a named, tested predicate, `Watchdog.recoversAbsentJob`, beside `pairOwnsServing` and `updates`. - `AbsentProviderRecovery`'s snapshot checks both again under the lifecycle lease: a cluster member's plist is not the provider's own job, and `ClusterService.pairServesHere` makes the job ineligible. The last snapshot comes just before the bootstrap, so a pair that starts, or a member job installed, while journal replay or a rollback runs is left alone. Tests: a member's plist is never bootstrapped; a pair that starts at each of the tick's three samples stops the bootstrap. - Removes the tests' ABSENT_JOB_BASELINE / ABSENCE_LABEL_BASELINE branches (never compiled), a stray MARK note and blank lines; the decision's comment states the rule instead of its history. - cli-reference.md and test.md say so. Local (Xcode 27.2, CPU sandbox): AbsentProvider* 39 tests; UnpairedMacServesNormallyTests, PairVersionSplitTests, WatchdogCommandTests, SoloStopSticksTests 36; WatchdogCrashLoopGuardTests, WatchdogDecisionTests 49: pass. A mutant without the new checks fails exactly the four new tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
9 of 10 tasks
jonathan308
marked this pull request as ready for review
November 10, 2026 00:21
This was referenced Nov 10, 2026
This was referenced Nov 12, 2026
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Issue #1104: the watchdog does not restore the provider when launchd boots its job out. On dev the watchdog decides from
"is the job loaded": an absent job is
notManaged, so it never enters the outage grace and nothing restarts it untilsomeone runs
darkbloom start.darkbloom stopdisables the job, so launchd's override database tells a deliberatestop apart from a lost job.
This restores an absent job when all of these hold:
auto_restarton, the provider's ownRunAtLoadplist installed,an explicit enabled override for its label, and no live provider identity. It then follows the crash path: the
same grace, then a bounded
launchctl bootstrapunder the lifecycle lease that stop and update hold. A disabled job isnever enabled. Adapted to dev: never for a cluster member's job, or while the pair runs on this Mac
(
ClusterService.pairServesHere), which own that job, as the loaded path'spairOwnsServingalready does. Both arechecked when the tick starts (
Watchdog.recoversAbsentJob) and again under the lease each time the job is sampled, thelast time just before the bootstrap, so a pair that starts during journal replay or a rollback is left alone.
Before
After
flowchart TD A["watchdog tick"] --> P{"pair runs here, or a member's job? (recoversAbsentJob)"} P -- yes --> L["dev's loaded path, unchanged"] P -- no --> R["AbsentProviderRecovery: lifecycle lease"] R --> B{"job loaded?"} B -- yes --> L B -- no --> E{"auto_restart, own single-Mac RunAtLoad plist, enabled override, no live provider, pair not running?"} E -- no --> S["stopped or ineligible: nothing (state saved)"] E -- yes --> G["replay the update journal; grace"] G --> C["candidate: charge once, verified rollback or backoff"] C --> E2{"the same checks again, just before the bootstrap"} E2 -- no --> S E2 -- yes --> K["save launch intent; bounded launchctl bootstrap"] K --> I["issued: restart counted / uncertain: guard kept, nothing counted"] classDef good fill:#dcfce7,stroke:#15803d,color:#14532d class R,G,C,K,I goodLinked issue
Refs #1104. Original: jonathan308/d-inference-pr-staging#47 (private).
Test plan
48dc8ec11c):AbsentProviderRecoveryand its 37 tests, with dev's decision(
providerLoaded: snapshot.loaded). Locally (Xcode 27.2, CPU sandbox, dev0f11fbe01a):AbsentProviderRecoveryTests13 tests, 30 issues;
AbsentProviderRecoveryIntegrationTests21 tests, 60 issues; the adapter's 3 pass.CI (dev) run 42683477962 on the red commit: the same two suites failed (30 and 60 issues), plus one unrelated
lifecycle test (
shutdownWaitsForAppAttestWorkerRetirement, which this commit can't reach: nothing calls the new type).079817e31e, local): all 37 pass;WatchdogCommandTests(13),PairVersionSplitTests(4),UnpairedMacServesNormallyTests(14),WatchdogCrashLoopGuardTests(43),WatchdogDecisionTests(6) pass.CI (dev) run 42686401012 on the fix
079817e31e: success (both shards).b8d937a47d, local):AbsentProvider*39 tests (adds a cluster member's plist, neverbootstrapped, and a pair that starts at each of the tick's three samples, which stops the bootstrap);
UnpairedMacServesNormallyTests|PairVersionSplitTests|WatchdogCommandTests|SoloStopSticksTests36 (addswatchdogAbsentJob);WatchdogCrashLoopGuardTests|WatchdogDecisionTests49: pass. A mutant without the new checksfails exactly the four new tests. CI (dev) run 42694536597 on
b8d937a47d: success on attempt 2; attempt 1 lostonly
SSDCheckpointRemovalRaceTests(an SSD checkpoint-store race test this PR can't reach), and the rerun of thefailed jobs passed.
make docs-check(211 files),docs-impact-check --base dev(9 files),changelog check,git diff --check.launchctland use real files and the reallifecycle lock; nothing touches launchd).
Components touched
Protocol / interface changes
Documentation impact
docs/provider/cli-reference.md(darkbloom watchdog),docs/developer/test.md;changelog.d/watchdog-restores-a-lost-provider-job.md.Notes for reviewers
launchctlcalls per tick: oneprintwhen the jobis loaded (two more,
print-disabledandprint, only while an update's launch intent is pending); when it isabsent, three for a stopped or ineligible job (
print, thenprintandprint-disabledunder the lease), five whilethe grace runs, and seven plus the
bootstrapon a restart tick. None on a Mac whose pair runs here or whose job is acluster member's.
candidate attempt is charged once; rollback errors reload durable state. This path downloads no update.
Refactor pass
The original had an independent final review. The port's independent refactor pass (2026-11-09,
b8d937a47d):journal and may roll back before
launchctl bootstrap; nothing the pair does takes that lease. Every snapshot underthe lease now treats a
--cluster-memberplist as not the provider's own job andClusterService.pairServesHereasineligible.
Watchdog.recoversAbsentJob, tested besidepairOwnsServingandupdates.ABSENT_JOB_BASELINE/ABSENCE_LABEL_BASELINEbranches, a stray MARKnote, blank lines, a comment that told history instead of the rule.
the last check and
launchctl bootstrapcan't be excluded here; the serving lock then keeps the single-Mac providerfrom serving beside the part, and the loaded path doesn't revive it while the pair runs (dev's loaded path has the
same window).
AI usage: ported by Claude Opus 5.5 (S-DINF sweep) at the owner's request. Not for merge until reviewed.