Skip to content

fix(provider): re-arm the watchdog when a drained relaunch fails - #1337

Closed
owizdom wants to merge 2 commits into
Layr-Labs:masterfrom
owizdom:agent/update-restart-watchdog
Closed

owizdom wants to merge 2 commits into
Layr-Labs:masterfrom
owizdom:agent/update-restart-watchdog

Conversation

@owizdom

@owizdom owizdom commented Oct 4, 2026 •

Copy link
Copy Markdown

Summary

darkbloom update and darkbloom restart leave the watchdog stopped when relaunching the drained provider fails (#1306, side note). ServiceDrain.prepare stops and disables the watchdog before the drain. On master, restart re-arms it only after restartAfterDrain returns (RestartCommand.swift), and update re-arms it inside the do block, so its catch rethrows with crash recovery still off (UpdateCommand.swift). The provider then stays down until the owner starts it by hand.

#1315 fixed the launchd race behind the original launchctl bootstrap failed: 5 report by waiting for confirmed removal of the old job. It also adds a new way for the relaunch to throw: the removal is not confirmed within its 10 s budget. This PR is now only the re-arm. It was rebased on #1315 and drops its own wait loop.

  • restart and update share one post-drain step, ServiceDrain.relaunchDrainedProvider, which re-arms the watchdog (per the existing auto_restart rule) whether the relaunch succeeds or throws. The error is rethrown and reported as before.

Linked issue

Fixes the watchdog half of the side note in #1306. The launchd wait is #1315; the main bug in #1306 was fixed by #1305.

Before and after

flowchart TB
  subgraph Before
    direction TB
    B1[drain: watchdog stopped and disabled] --> B2[relaunch throws]
    B2 --> B3[error rethrown before the re-arm]
    B3 --> B4[provider down, watchdog off until a manual start]
  end
  subgraph After
    direction TB
    A1[drain: watchdog stopped and disabled] --> A2[relaunch succeeds or throws]
    A2 --> A3[watchdog re-armed either way]
    A3 --> A4[error rethrown as before]
  end
  Before ~~~ After
Loading

Test plan

  • ServiceDrainRelaunchTests: the re-arm runs once when the relaunch succeeds and once when it throws, and the error is rethrown.
  • On the branch merged with master (Oct 6): swift test --filter ServiceDrain 32 tests in 5 suites passed; --filter 'Restart|UpdateCommand|SelfUpdater|ServiceDrainRelaunch' 102 of 103 passed. The one failure, SelfUpdaterTests "signed extracted child proves retained Gemma marker before staging succeeds", fails the same way on a master build on this machine.

Components touched

  • coordinator (Go)
  • provider (Rust, legacy)
  • provider-swift (Swift CLI)
  • console-ui (Next.js)
  • enclave (Swift)
  • infra / CI / release
  • docs

Protocol / interface changes

  • No protocol/interface changes

Documentation impact

  • Canonical documentation updated

CHANGELOG entry added.

Notes for reviewers

Not claimed:

  • Not reproduced against a real provider install; the tests drive the shared step with a throwing relaunch.

Rollout: ships with the next provider release. Rollback: revert the merge commit. Removal: none.

…aunching, and re-arm the watchdog on failure
@vercel

vercel Bot commented Oct 4, 2026

Copy link
Copy Markdown

@owizdom is attempting to deploy a commit to the EigenLabs Team on Vercel.

A member of the Team first needs to authorize it.

@owizdom
owizdom marked this pull request as ready for review October 4, 2026 04:22
@github-actions

github-actions Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Threat model review — advisory

Reviewed head f8bf49ca1586 against base dccc9ee03333.

Review not completed for this head. Previous findings are superseded, not confirmed resolved.
normal spending limit reached; remaining coverage deferred

Models: budgeted Sonnet / selective Opus / selective Sol 6.1. Findings require human validation; this review never requests changes or blocks merging.

Coverage: 12/28 source units; cross-file integration pending. 0 selected depth batch(es) pending. All threat definitions indexed; relevant full definitions selected. Unchanged callers are not scanned.

Cost this run: $0.3856 reported, $0.0000 reserved with unknown cost; 5 paid request(s), 0 reused batch(es), 80388 provider cache-hit tokens.

Saved findings and earlier report · Historical findings are not confirmed resolved.

Layr-Labs#1315 landed the launchd removal wait; keep only the watchdog re-arm on a failed relaunch.
@owizdom owizdom changed the title fix(provider): wait for launchd to release the drained job before relaunching fix(provider): re-arm the watchdog when a drained relaunch fails Oct 6, 2026
@owizdom

owizdom commented Oct 14, 2026

Copy link
Copy Markdown
Author

Superseded by #1484. That PR carries the same fix rebased onto current master as a minimal change: the watchdog re-arm infrastructure landed separately since this branch, so #1484 only guarantees re-arm on the failed-relaunch path and adds a regression test. Closing in favor of #1484.

@owizdom owizdom closed this Oct 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant