Skip to content

fix(oberon): restore PATH in hermes-agent systemd service#32

Merged
thinceller merged 1 commit into
masterfrom
worktree-calm-oak-dzha
Jun 14, 2026
Merged

fix(oberon): restore PATH in hermes-agent systemd service#32
thinceller merged 1 commit into
masterfrom
worktree-calm-oak-dzha

Conversation

@thinceller

Copy link
Copy Markdown
Owner

概要

hermes-agent (oberon上) が cat / rm などのごく一般的なコマンドを実行できず、write_file ツールが失敗していた問題を修正する。

根本原因

hosts/oberon/hermes-agent.nixenvironment = lib.mkForce {...} が systemd サービスの environment attrset を丸ごと置換していた。

上流の nixosModule は PATH を environment.PATH ではなく path オプション(内部的に environment.PATH へ展開される)で供給している。そのため mkForce による全置換が PATH キーごと消去し、hermes-agent プロセスの PATH が空になっていた。

$ systemctl show hermes-agent --property=Environment
Environment=HERMES_HOME=... HERMES_MANAGED=true HOME=... LOCALE_ARCHIVE=... TZDIR=...
# → PATH が完全に欠落(LOCALE_ARCHIVE/TZDIR は systemd グローバル環境由来で生存)

修正

environment 全体の mkForce 置換をやめ、本来の意図だった MESSAGING_CWD(deprecated 警告の発生源)の除外だけを キー単位の lib.mkForce null で実現する。null のキーは systemd unit 生成時に出力から除外されるため、警告抑制を維持しつつ PATH と他の環境変数を温存できる。

検証

config.systemd.services.hermes-agent.environment の eval で確認:

  • PATH: hermes-agent / bash / coreutils / git / findutils / gnugrep / gnused / systemd の bin が並ぶ(path オプション由来が復活)
  • MESSAGING_CWD: null(unit 出力から除外され deprecated 警告も維持されたまま抑制)
  • HOME / HERMES_HOME / HERMES_MANAGED: 従来通り

デプロイ

適用には oberon への nixos-rebuild が必要。経路系(cloudflared/sshd/network)の変更ではなく hermes-agent サービスの再起動のみなので、通常の --target-host デプロイで問題なし。

🤖 Generated with Claude Code

`environment = lib.mkForce {...}` replaced the entire systemd environment
attrset, which wiped the PATH key that the upstream nixosModule injects via
its `path` option (expanded into environment.PATH). As a result the
hermes-agent process had no PATH, so basic commands like cat/rm were not
found and write_file failed.

Override only the MESSAGING_CWD key with `lib.mkForce null` instead of
replacing the whole attrset. null keys are omitted from the generated unit,
so the deprecated-warning suppression is preserved while PATH and the other
environment variables remain intact.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@thinceller thinceller merged commit 5612e13 into master Jun 14, 2026
3 checks passed
@thinceller thinceller deleted the worktree-calm-oak-dzha branch June 14, 2026 11:16
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