Skip to content

fix(installer): restart upgraded systemd services#833

Open
agent-p1p wants to merge 2 commits into
masterfrom
pip/mdk-832
Open

fix(installer): restart upgraded systemd services#833
agent-p1p wants to merge 2 commits into
masterfrom
pip/mdk-832

Conversation

@agent-p1p

@agent-p1p agent-p1p commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Summary

  • restart active wn-agent and wn-opencode systemd user services after unit reloads
  • retain enable --now for inactive services and preserve existing no-start options
  • exercise fresh-install and active-upgrade paths with deterministic installer fixtures

Test plan

  • just opencode-installer-test
  • bash -n scripts/install-opencode-marmot.sh integrations/opencode/marmot/tests/test_installer.sh
  • just fast-ci gates: fmt, naming, default/OTLP checks, and default/OTLP clippy (clippy completed with a tmpfs target after the root filesystem filled)

Fixes #832


Open in Stage

Restart active wn-agent and wn-opencode user services after replacing their binaries and units. Keep enable --now for fresh installs and preserve no-start paths.

Fixes #832
@coderabbitai

coderabbitai Bot commented Jul 12, 2026

Copy link
Copy Markdown

Warning

Review limit reached

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

Next review available in: 48 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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 405dc780-5de9-4a58-85d2-5a25dc0366d3

📥 Commits

Reviewing files that changed from the base of the PR and between e391adc and 9b59c8c.

📒 Files selected for processing (2)
  • integrations/opencode/marmot/tests/test_installer.sh
  • scripts/install-opencode-marmot.sh
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch pip/mdk-832

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.

@stage-review

stage-review Bot commented Jul 12, 2026

Copy link
Copy Markdown

Ready to review this PR? Stage has broken it down into 3 individual chapters for you:

Title
1 Define systemd service restart logic
2 Apply restart logic to installer services
3 Verify service restarts in installer tests
Open in Stage

Chapters generated by Stage for commit 9b59c8c on Jul 12, 2026 6:07pm UTC.

@agent-p1p agent-p1p left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Adversarial review of 8e1d4ef

BLOCKING:

  • none

SUGGESTION:

  • Dry-run output no longer describes the upgrade path: scripts/install-opencode-marmot.sh:494,535 still says the installer would run enable --now unconditionally. A real active-service upgrade now runs enable plus restart. Since dry-run intentionally avoids the state probe, wording such as “enable/start, or restart if already active” would keep the preview accurate.
  • Guard the explicit no-start behavior in the new active-service fixture: integrations/opencode/marmot/tests/test_installer.sh:135-142 exercises the active default path, while --no-start-wn-opencode is covered only by dry-run text. An active fixture with --no-start-wn-opencode that asserts no restart wn-opencode.service call would lock in the PR’s preservation claim.

NITPICK:

  • none

FOLLOW-UP:

  • Filed #834 for the same pre-existing upgrade bug in the Hermes and OpenClaw installers. This is out of scope for #832/#833: #834

SUMMARY: The change is small and correct. After unit rewrite and daemon-reload, active wn-agent and wn-opencode user services take the enable + restart path and therefore load the new executable/environment; inactive services retain enable --now. Existing --no-service, --no-start-wn-agent, and --no-start-wn-opencode gates remain upstream. The deterministic mock uses exact command-line assertions to distinguish fresh and active upgrades. No security/privacy regressions or sensitive paths were found.

VERDICT: APPROVE
SENSITIVE_PATHS: none

Verified locally:

  • integrations/opencode/marmot/tests/test_installer.sh — passed
  • bash -n scripts/install-opencode-marmot.sh integrations/opencode/marmot/tests/test_installer.sh — passed
  • git diff --check origin/master...HEAD — passed

Keep Linux dry-run output accurate for active-service upgrades and verify --no-start-wn-opencode skips every systemd action for the harness.
@agent-p1p

Copy link
Copy Markdown
Contributor Author

Addressed both adversarial-review suggestions in 9b59c8c: Linux dry-run output now describes enable/start versus active-service restart, and the active-service fixture verifies --no-start-wn-opencode performs no systemd probe, enable, or restart for wn-opencode. Local installer and shell-syntax checks pass.

@agent-p1p

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 12, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@agent-p1p
agent-p1p marked this pull request as ready for review July 12, 2026 18:38
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.

OpenCode installer: restart active systemd services after upgrade

1 participant