Skip to content

fix(caam): stop the linux daemon restart loop when caam is missing - #3089

Merged
shunkakinoki merged 1 commit into
mainfrom
fix/caam-daemon-restart-gate
Oct 15, 2026
Merged

shunkakinoki merged 1 commit into
mainfrom
fix/caam-daemon-restart-gate

Conversation

@shunkakinoki

@shunkakinoki shunkakinoki commented Oct 15, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • caam-daemon.service crash-loops on Linux hosts where ~/.local/bin/caam is absent: each start exits 203/EXEC and Restart=always retries every 10s.
  • ConditionPathIsExecutable does not stop this. systemd evaluates Condition* only when a start job is queued, and automatic restarts skip it. On the CI boxes the last condition check is dated 2026-10-11, and the unit has restarted about 1,670 times since then without re-checking.
  • RestartPreventExitStatus = 203 ends the loop the first time the binary is missing. A manual start or a new activation re-checks the condition.

Evidence (read-only)

  • Three Linux CI boxes: /root/.local/bin/caam does not exist and NRestarts is about 1,670. ConditionResult=yes, with ConditionTimestamp from 2026-10-11.
  • A host with the binary installed is active.

Testing

  • shellspec spec/caam_sync_service_spec.sh: 15 examples, 0 failures. The new example fails on origin/main, which has no RestartPreventExitStatus.
  • nix-instantiate --parse succeeds.

decided: RestartPreventExitStatus = 203 rather than a Darwin/Linux host split - 203 is systemd's exec-failure status, so the fix is local to the unit and keeps the daemon on hosts that do install caam.

🤖 Generated with Claude Code


Summary by cubic

Stops the caam-daemon.service crash-loop on Linux hosts where the caam binary is missing. Each start previously exited with 203/EXEC and Restart=always retried every 10 seconds forever, because ConditionPathIsExecutable is only evaluated when a start job is queued, not on automatic restarts. Adding RestartPreventExitStatus = 203 ends the loop after the first failed start while keeping the restart behavior on hosts that do have the binary installed.

Written for commit 06aaa3a. Summary will update on new commits.

View guided diff Turn on auto-fix

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@indent

indent Bot commented Oct 15, 2026

Copy link
Copy Markdown

Warning

This organization's free trial has ended, so Indent couldn't start this review. Manage billing to resume reviews on this repository.

Review agents

Select any unchecked box below to run or rerun that agent.

Pending (1)
  • Indent Review Agent · This agent has not run.
Full results

Indent Review Agent

  • Summary: This agent has not run.
  • Latest resultNo result — this agent has not run.

@coderabbitai

coderabbitai Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4451104a-08f2-41c1-8624-0f8861b3d1ed
📥 Commits

Reviewing files that changed from the base of the PR and between d5ef342 and 06aaa3a.

📒 Files selected for processing: 2
  • home-manager/services/caam/default.nix
  • spec/caam_sync_service_spec.sh

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

📝 Summary

Summary by CodeRabbit

  • Bug Fixes
    • Prevented the Linux CAAM daemon from restarting when it exits with status 203.

The Linux CAAM daemon service now prevents systemd from restarting it after exit status 203. A spec checks that the service configuration includes this setting.

Changes: CAAM daemon restart policy

Layer / File(s) Summary
Configure restart prevention
home-manager/services/caam/default.nix, spec/caam_sync_service_spec.sh
The Linux daemon service sets RestartPreventExitStatus = 203. The spec checks for this setting.

Priority: ➖ Normal

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

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 06aaa

The daemon will stop retrying after an executable failure with status 203 while retaining its restart policy for other exits. No identified issue blocks merging.

Pre-merge checks: Passed 5
Passed Passed checks: 5 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: stopping the Linux daemon restart loop when the caam binary is missing.
Description check Passed The description directly explains the restart-loop issue, the proposed systemd fix, supporting evidence, and test results.
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 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

A rabbit checks the service line,
Exit two-oh-three is fine.
No restart follows in its wake,
The spec confirms the change we make.
Then hops away beneath the moon.

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

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

1 issue found across 2 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="spec/caam_sync_service_spec.sh">

<violation number="1" location="spec/caam_sync_service_spec.sh:63">
P3: This regression example only checks that the text exists in the Nix source, so it does not verify that systemd receives the setting or suppresses a 203/EXEC restart. Assert the rendered user unit, or exercise the service restart behavior in an environment with systemd.</violation>
</file>

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

End

It 'stops restarting the linux daemon after the caam binary disappears'
When run bash -c "grep -F 'RestartPreventExitStatus = 203' '$NIX'"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P3: This regression example only checks that the text exists in the Nix source, so it does not verify that systemd receives the setting or suppresses a 203/EXEC restart. Assert the rendered user unit, or exercise the service restart behavior in an environment with systemd.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At spec/caam_sync_service_spec.sh, line 63:

<comment>This regression example only checks that the text exists in the Nix source, so it does not verify that systemd receives the setting or suppresses a 203/EXEC restart. Assert the rendered user unit, or exercise the service restart behavior in an environment with systemd.</comment>

<file context>
@@ -59,6 +59,12 @@ The output should include 'ConditionPathIsExecutable'
 End
 
+It 'stops restarting the linux daemon after the caam binary disappears'
+When run bash -c "grep -F 'RestartPreventExitStatus = 203' '$NIX'"
+The output should include 'RestartPreventExitStatus'
+The status should be success
</file context>

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reviewed changes

  • home-manager/services/caam/default.nix: Added RestartPreventExitStatus = 203; with explanatory comments to prevent restart loops when caam binary is missing
  • spec/caam_sync_service_spec.sh: Added a test verifying RestartPreventExitStatus = 203 is present

✅ No new issues found.

Pullfrog  | View workflow run | Using free | 𝕏

@shunkakinoki
shunkakinoki merged commit 6f39db7 into main Oct 15, 2026
31 of 33 checks passed
@shunkakinoki
shunkakinoki deleted the fix/caam-daemon-restart-gate branch October 15, 2026 17:58
@linear-code

linear-code Bot commented Oct 15, 2026

Copy link
Copy Markdown

SHUN-18016

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