GeezerVison is showing github.com — Avoid OpenCode restarts when the build is unchanged by dezren39 · Pull Request #12299 · developing-today/code
Conversation
dezren39
commented
Nov 22, 2026
•
edited by coderabbitai
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
Summary
Home Manager reloads changed units
X-RestartIfChanged=false for opencode.service
activation compares the serving OpenCode store path
same build -> no systemctl action
changed build -> restart/start service
This is the non-disruptive same-build slice of #10639. It does not implement socket activation or drain-signal handling, does not claim the issue, and does not perform live verification.
Evidence
- Before: the generated unit can change through helper-only derivations and trigger a service restart even when the serving OpenCode build path is unchanged.
- After:
bash home/common/opencode-deploy.test.sh passes fake-systemctl cases for unchanged build, matching first activation, and changed build.
bash -n home/common/opencode-deploy.sh home/common/opencode-deploy.test.sh passes.
nix-instantiate --parse home/common/default.nix passes.
- No live laptop service was queried, switched, or restarted; live PID/port continuity remains unverified.
Merge Danger
Door: Two-way; reverting restores Home Manager's default changed-unit restart behavior.
Blast Radius: Low; limited to the OpenCode user unit's activation behavior.

Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.
Summary by CodeRabbit
- New Features
- OpenCode deployments now track the active build and start or restart the service when a different build is deployed. If the requested build is already running, the service is left running; unchanged builds do not trigger a restart.
- If the system service manager is unavailable, deployment state is not updated.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Disable automatic unit restarts for helper-only changes and deploy explicitly by the serving OpenCode store path. Seed the initial key from the active process command line. Add fake-systemctl regression tests.
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
| Review |
Status |
Commit |
Review trigger |
| 📝 Code Review |
✅ Completed 2026-11-22T18:50:11.463764Z |
612649e |
New commits |
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review" or "@codex security review".
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
coderabbitai
Bot
commented
Nov 22, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
|

Warning
Review limit reached
You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.
Next included review available in 52 minutes.
Check out review usage here.
View limit details
-
Limit details: You’ve used the included review currently available.
Learn how review limits work.
Review configuration:
Run configuration
-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: defaults
- Review profile: CHILL
- Plan: Advanced
- Run ID:
2a4945c0-f30f-4525-a2ec-ad51104dbbb1
Commits
-
Reviewing files that changed from the base of the PR and between 1626482 and 612649e.
Files selected for processing: 4
-
.github/workflows/nix-ci.yml
home/common/default.nix
home/common/opencode-deploy.sh
home/common/opencode-deploy.test.sh
Walkthrough
-
The OpenCode systemd unit disables automatic restarts when unit files change and runs a deployment helper after systemd reload. The helper compares build paths, manages service startup or restart, and records deployment state. Regression tests cover unchanged, already-running, and changed builds.
Changes: OpenCode deployment
| Layer / File(s) |
Summary |
Build-aware deployment helper home/common/opencode-deploy.sh |
The helper validates its arguments, skips deployment when the requested build matches the saved key, records an already-running process at the requested path, and starts or restarts the service otherwise. |
Systemd activation wiring home/common/default.nix |
The OpenCode unit disables automatic restart on unit changes and invokes the helper after reloadSystemd, passing the package path, state-file path, systemctl, and /proc. |
Deployment tests and CI home/common/opencode-deploy.test.sh, .github/workflows/nix-ci.yml |
The regression test checks unchanged, already-running, and changed builds. The CI job runs the test script. |
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix
Possibly related issues
developing-today/code#10639: This PR implements the issue’s same-build restart-skip item. The socket activation and drain-signal items are not included.
Merge Risk: Moderate · previous review 16264
-
Unchanged OpenCode builds will no longer restart the service. If the user systemd manager is degraded, for example because an unrelated user unit has failed, a new OpenCode build will not be started or restarted, and the old build will keep serving. Accept the degraded state alongside running and add a regression test for it before merging.
Pre-merge checks: 4
-
| Check name |
Status |
Explanation |
| Description Check |
 |
Check skipped - CodeRabbit’s high-level summary is enabled. |
| Title check |
 |
The title "Avoid OpenCode restarts when the build is unchanged" matches the main change. The PR adds deploy logic that compares the serving OpenCode store path, skips systemctl actions when the build … |
| Linked Issues check |
 |
Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check |
 |
Check skipped because no linked issues were found for this pull request. |
Full details: Title check
-
Explanation
The title "Avoid OpenCode restarts when the build is unchanged" matches the main change. The PR adds deploy logic that compares the serving OpenCode store path, skips systemctl actions when the build is unchanged, and disables restart-on-change for the OpenCode user unit. The title is specific and short, and it describes the primary behavior change from the developer's perspective.
Finishing Touches
-
Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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
-
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 16264824ba
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
|
|
|
|
# Do not record a key while the user manager is unavailable; a later activation
|
|
|
# must retry the deployment instead of treating an unperformed restart as done.
|
|
|
if "$systemctl" --user is-system-running --quiet; then
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Allow deployment when the user manager is degraded
When any unrelated user unit has failed, this guard silently skips deployment of a changed OpenCode build even though the user manager remains available. The systemctl documentation defines degraded as “The system is operational but one or more units failed” and specifies a nonzero exit status. Since home/common/default.nix:1180 now disables Home Manager's automatic changed-unit restart, OpenCode keeps serving the old build while activation reports success; subsequent activations also skip deployment until the failed-unit state is cleared. Check manager reachability or explicitly accept degraded rather than requiring every user unit to be healthy.
Useful? React with 👍 / 👎.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 93e8d5e. The helper now accepts the degraded manager state and the regression test proves deployment proceeds; offline state still does not record the key. Targeted shell regression test passes.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
|
Lane code-j claimed queue task 21065 to shepherd PR #12299. Fresh GitHub state: PR OPEN, ready (not draft), labels empty (no hold labels), merge state CLEAN. Review findings remain; next I am validating the CodeRabbit/Codex finding on degraded systemd user managers, then will test and resolve before merge.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Addressed the degraded-manager review findings from Codex and CodeRabbit in 93e8d5e0067. The helper now reads systemctl --user is-system-running and proceeds for both running and degraded; unavailable states still skip without recording the build key. Added regression coverage for degraded deployment and offline retry behavior. Verified locally: bash home/common/opencode-deploy.test.sh (all scenarios pass), bash -n on both scripts, and git diff --check. The PR branch also includes a merge of current main (no rebase); the remaining PR diff is limited to the original four files.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Merged latest main (2e7fe3270a7) into the existing PR branch as 612649ef8a1 and pushed to the canonical head. The focused deployment regression tests pass (including degraded and unavailable manager cases), both scripts pass bash -n, and git diff --check passes; diff remains limited to the four intended files. GitHub now reports the PR base/head as current, but mergeability is still UNKNOWN immediately after the push; I am refreshing that state before merge.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
|
Completed: PR #12299 merged at 8aa0064f7409e837e99a02c21bc216a16df7f7e4 (head 612649ef8a19634f36cdb8786e175642ebbef662, based on 2e7fe3270a7c1b2fc5f07ab978c10f491f5cf1fb). Focused deployment tests pass, shell syntax and diff checks pass, and the four-file intended diff was verified. GitHub mergeability was CLEAN/MERGEABLE; CodeRabbit was neutral/skipping; no hold labels or unresolved actionable findings remained.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
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.
|