Skip to content

feat: restart tailscaled if it terminates or becomes unresponsive - #112

Merged
Derek Kaser (dkaser) merged 2 commits into
trunkfrom
feat/tailscaled-monitor
Jul 16, 2026
Merged

feat: restart tailscaled if it terminates or becomes unresponsive#112
Derek Kaser (dkaser) merged 2 commits into
trunkfrom
feat/tailscaled-monitor

Conversation

@dkaser

@dkaser Derek Kaser (dkaser) commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator

Closes #111

Summary by CodeRabbit

  • New Features
    • Added automatic monitoring to detect when the Tailscale service is unavailable or unresponsive.
    • Added automatic recovery that retries after a brief delay and restarts Tailscale when needed.
    • Integrated health checks into the background monitoring process to improve service reliability.

Signed-off-by: Derek Kaser <11674153+dkaser@users.noreply.github.com>
@github-actions github-actions Bot added the feat label Jul 16, 2026
@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@dkaser, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 53 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 7f743198-26e4-43c6-8f9d-1816c1b9ecfb

📥 Commits

Reviewing files that changed from the base of the PR and between 2354102 and cdbec5b.

📒 Files selected for processing (1)
  • src/usr/local/php/unraid-tailscale-utils/unraid-tailscale-utils/System.php
📝 Walkthrough

Walkthrough

The watcher now checks Tailscale daemon health on each polling iteration. System helpers detect process absence or API unresponsiveness, recheck after 30 seconds, and restart Tailscale when the failure persists.

Changes

Tailscale watchdog recovery

Layer / File(s) Summary
Daemon health check and watcher integration
src/usr/local/php/unraid-tailscale-utils/unraid-tailscale-utils/System.php, src/usr/local/php/unraid-tailscale-utils/unraid-tailscale-utils/Watcher.php
System checks for a responsive tailscaled process, delays and rechecks failures, and restarts /etc/rc.d/rc.tailscale; Watcher invokes this check in its polling loop.

Estimated code review effort: 2 (Simple) | ~10 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Watcher
  participant System
  participant tailscaled
  participant rc.tailscale
  Watcher->>System: run checkTailscale()
  System->>tailscaled: check process and API status
  tailscaled-->>System: status response or failure
  System->>System: wait 30 seconds and recheck
  System->>rc.tailscale: restart Tailscale when still unhealthy
Loading
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: restarting tailscaled when it stops or becomes unresponsive.
Linked Issues check ✅ Passed The PR detects failed tailscaled, restarts it automatically, and checks it before the watcher waits for an IP.
Out of Scope Changes check ✅ Passed The changes stay focused on Tailscale supervision and watcher flow, with no unrelated functionality added.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/tailscaled-monitor

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/usr/local/php/unraid-tailscale-utils/unraid-tailscale-utils/System.php`:
- Around line 150-153: Update the restart branch in System.php so it restarts
sshd after Utils::runwrap restarts Tailscale. Preserve the existing
isTailscaleRunning check and ensure the sshd restart occurs afterward to bind to
the new Tailscale interface/IP.
- Around line 132-139: Update the daemon health check in the surrounding status
method to inspect the object returned by LocalAPI::getStatus() and treat an
empty \stdClass as unresponsive, logging the existing message and returning
false. Remove the ineffective RuntimeException catch and the unused $status
handling while preserving true for non-empty status responses.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 42602390-d8e5-4816-8f29-aa4257bead36

📥 Commits

Reviewing files that changed from the base of the PR and between c1beb23 and 2354102.

📒 Files selected for processing (2)
  • src/usr/local/php/unraid-tailscale-utils/unraid-tailscale-utils/System.php
  • src/usr/local/php/unraid-tailscale-utils/unraid-tailscale-utils/Watcher.php

Signed-off-by: Derek Kaser <11674153+dkaser@users.noreply.github.com>
@dkaser
Derek Kaser (dkaser) merged commit ce7c2a0 into trunk Jul 16, 2026
5 checks passed
@dkaser
Derek Kaser (dkaser) deleted the feat/tailscaled-monitor branch July 16, 2026 02:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Watcher doesn't restart tailscaled after watchdog crash

1 participant