Skip to content

fix(deploy): autodeploy works under systemctl --user + ignores untracked runtime files - #190

Merged
github-actions[bot] merged 1 commit into
mainfrom
claude/autodeploy-user-scope-fixes
Aug 13, 2026
Merged

fix(deploy): autodeploy works under systemctl --user + ignores untracked runtime files#190
github-actions[bot] merged 1 commit into
mainfrom
claude/autodeploy-user-scope-fixes

Conversation

@dizhaky

@dizhaky dizhaky commented Aug 13, 2026

Copy link
Copy Markdown
Owner

What does this PR do?

Fixes two bugs in the autodeploy unit from #189, both found by actually installing it on a live rootless host (mfc1):

  1. 218/CAPABILITIES under systemctl --user. The service's hardening block (ProtectKernelModules, ProtectKernelTunables, ProtectControlGroups, RestrictSUIDSGID) was copied from the system-level hermes-gateway.service. Those directives require a privileged (root) service manager and fail the unit at start under a rootless user manager — the exact path the unit's own header documents. Reduced the always-on hardening to the user-safe subset (NoNewPrivileges, PrivateTmp) and left the privileged directives commented, to be uncommented for a dedicated-host system install.

  2. Dirty-tree guard refused forever on live hosts. The guard used git status --porcelain, which includes untracked files. A running gateway writes runtime state inside the checkout (cron/executions.db), so the guard would block every deploy on any real host. Restricted it to modified tracked files (--untracked-files=no); untracked files don't block a fast-forward, and git errors on its own in the rare case an incoming commit would overwrite one.

Related Issue

Follow-up to #189 (DAN-2730).

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)

Changes Made

  • deploy/hermes-agent-autodeploy.service — user-safe hardening subset; privileged directives commented with an explanatory note.
  • deploy/hermes-agent-autodeploy.sh — dirty-tree guard uses --untracked-files=no; comment explains why untracked runtime files are ignored.

How to Test

  1. Verified live on the target host: the oneshot now reaches Result=success under systemctl --user (previously 218/CAPABILITIES), hits the no-op path when current, and does not trip on the untracked cron/executions.db.
  2. Scratch-repo harness: an untracked runtime file present + branch behind → deploys (file untouched); a modified tracked file → refuses with exit 1.
  3. bash -n clean.

Checklist

  • Conventional Commits (fix(deploy): ...)
  • PR contains only changes related to this fix
  • Tested on my platform: Linux (live host + scratch harness)
  • cli-config.yaml.example / AGENTS.md — N/A

🤖 Generated with Claude Code

https://claude.ai/code/session_01MW1vwtetBTLSMJcBYp9r1C


Generated by Claude Code

…racked runtime files

Two bugs found while installing the unit on a live rootless host:

1. The service's hardening block (ProtectKernelModules, RestrictSUIDSGID,
   etc.), copied from the system-level hermes-gateway.service, is not
   permitted under `systemctl --user` and fails the unit at start with
   status=218/CAPABILITIES. Reduce the always-on set to the user-safe
   subset (NoNewPrivileges, PrivateTmp) and leave the privileged
   directives commented for system-level installs.

2. The dirty-tree guard used `git status --porcelain`, which counts
   untracked files. A live gateway writes runtime state inside the
   checkout (cron/executions.db), so the guard would refuse to deploy
   forever on any real host. Restrict it to modified tracked files
   (--untracked-files=no); untracked files never block a fast-forward.

Verified on the target host (no-op + deploy paths) and against a scratch
repo (untracked runtime file no longer blocks; modified tracked file
still does).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MW1vwtetBTLSMJcBYp9r1C
@dizhaky
dizhaky marked this pull request as ready for review August 13, 2026 15:48
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@github-actions
github-actions Bot merged commit facc18e into main Aug 13, 2026
46 checks passed
@github-actions
github-actions Bot deleted the claude/autodeploy-user-scope-fixes branch August 13, 2026 15:52
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.

2 participants