Skip to content

docs(agents-md): spell out full systemctl path in sudo examples - #354

Merged
defangdevs merged 1 commit into
masterfrom
fix/353-sudo-systemctl-full-path
Aug 25, 2026
Merged

docs(agents-md): spell out full systemctl path in sudo examples#354
defangdevs merged 1 commit into
masterfrom
fix/353-sudo-systemctl-full-path

Conversation

@defangdevs

Copy link
Copy Markdown
Owner

Summary

  • The guide (and the matching option docs) told agents to run sudo systemctl reload caddy.service / sudo systemctl start agent-box-update.service. Bare systemctl resolves through PATH to a Nix store path, which the sudoers rule — keyed on the absolute /run/current-system/sw/bin/systemctl path — doesn't match, so the copy-pasted command silently falls back to a password prompt instead of running.
  • Updated modules/src/default-agents.md (the guide text) and the matching option descriptions in modules/agent-box.nix.in to show the full path, with a one-line note explaining why the exact path matters.
  • Regenerated modules/agent-box.nix and refreshed tests/golden/*/etc/agent-box-guides/AGENTS.agent.md to match.

Test plan

  • python3 tests/test-assemble-module.py
  • nix build -L .#checks.aarch64-linux.module-generated-up-to-date
  • nix build -L .#checks.aarch64-linux.assemble-module-escaping
  • nix build -L .#checks.aarch64-linux.golden-snapshot

Fixes #353

🤖 Generated with Claude Code

https://claude.ai/code/session_01GPscnUVnoHcT6iEjMEjx9n

Bare `sudo systemctl reload caddy.service` / `sudo systemctl start
agent-box-update.service`, as literally shown in the guide, resolve
`systemctl` through the agent's PATH to a Nix store path — which the
sudoers rule (keyed on the absolute /run/current-system/sw/bin/systemctl
path) doesn't match, so the command silently falls back to asking for a
password instead of running passwordlessly.

Update the guide text (modules/src/default-agents.md), the matching
option descriptions in modules/agent-box.nix.in, regenerate
modules/agent-box.nix, and refresh the golden fixture.

Fixes #353

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GPscnUVnoHcT6iEjMEjx9n
@coderabbitai

coderabbitai Bot commented Aug 24, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: fdfa6300-6c9d-474f-9f59-7bf69d867dee

📥 Commits

Reviewing files that changed from the base of the PR and between 92c4eb0 and 74106f9.

📒 Files selected for processing (5)
  • modules/agent-box.nix
  • modules/agent-box.nix.in
  • modules/src/default-agents.md
  • tests/golden/vm/etc/agent-box-guides/AGENTS.agent.md
  • tests/golden/web/etc/agent-box-guides/AGENTS.agent.md

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The change updates agent instructions, NixOS option descriptions, and golden guide files to use /run/current-system/sw/bin/systemctl for Caddy reloads and self-updates. The documentation explains exact-path sudo matching and bare systemctl authentication behavior.

Changes

Systemctl path guidance

Layer / File(s) Summary
Command guidance
modules/agent-box.nix, modules/src/default-agents.md, tests/golden/*/etc/agent-box-guides/AGENTS.agent.md
Agent instructions now use the absolute systemctl path for Caddy reloads and self-updates. They document sudo path matching and retain the update-session termination warning.
Option documentation
modules/agent-box.nix, modules/agent-box.nix.in
NixOS option descriptions now reference the absolute commands for Caddy reloads and agent-box-update.service activation.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Merge Risk: ⚪ Minimal · up to 74106

This change updates copied systemctl commands to use the sudoers-matching absolute path and refreshes the corresponding generated documentation. No actionable merge-blocking risk remains after the listed checks.

Suggested reviewers: lionello, claude, web-flow

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: updating agent documentation to use the full systemctl path in sudo examples.
Description check ✅ Passed The description directly explains the documentation changes, the sudoers path-matching issue, regenerated files, refreshed fixtures, and test coverage.
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 0…
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.
Full details: Docstring Coverage

Explanation

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 0 files. (5 skipped: 5 unsupported.)

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/353-sudo-systemctl-full-path

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

@defangdevs
defangdevs merged commit 2ac4335 into master Aug 25, 2026
2 checks passed
@defangdevs
defangdevs deleted the fix/353-sudo-systemctl-full-path branch August 25, 2026 00:07
@github-project-automation github-project-automation Bot moved this from Backlog to Done in Agent-Box Aug 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Documented sudo systemctl start agent-box-update.service hits a password prompt: sudoers path doesn't match the agent's PATH

2 participants