Skip to content

fix(docker): align HOME for dashboard and s6 gateway services#33481

Merged
benbarclay merged 1 commit into
NousResearch:mainfrom
Dusk1e:fix/docker-s6-services-home-alignment
May 28, 2026
Merged

fix(docker): align HOME for dashboard and s6 gateway services#33481
benbarclay merged 1 commit into
NousResearch:mainfrom
Dusk1e:fix/docker-s6-services-home-alignment

Conversation

@Dusk1e

@Dusk1e Dusk1e commented May 27, 2026

Copy link
Copy Markdown
Contributor

Summary

This brings the supervised Docker paths back in line with the HOME invariant introduced for the main container command path.

docker/main-wrapper.sh already resets HOME=/opt/data before dropping from root to the hermes user, but the supervised dashboard run script and dynamically generated s6 gateway run scripts were still inheriting HOME=/root from with-contenv. That left a parity gap between the direct CMD path and the supervised s6 paths.

Parity Source

This PR is a parity follow-up to:

  • 628aaea
  • fix(docker): propagate env through s6 to cont-init and main CMD

That commit established the invariant that container processes running as the hermes user should resolve HOME under /opt/data, not /root. This PR applies the same invariant to the remaining supervised sibling paths.

Problem

After with-contenv, supervised services can still see HOME=/root unless they explicitly reset it before s6-setuidgid hermes.

That meant:

  • docker/s6-rc.d/dashboard/run could still run with root HOME semantics
  • dynamically generated profile gateway run scripts from S6ServiceManager._render_run_script() could do the same

In practice, HOME-anchored state could end up resolving under /root or fail on permissions, depending on the library/tooling involved.

Fix

  • Add export HOME=/opt/data to docker/s6-rc.d/dashboard/run
  • Add export HOME=/opt/data to the generated s6 gateway run script in hermes_cli/service_manager.py
  • Add regression coverage for both paths

Files Changed

  • docker/s6-rc.d/dashboard/run
  • hermes_cli/service_manager.py
  • tests/hermes_cli/test_service_manager.py
  • tests/test_docker_home_override_scripts.py

Testing

Tests run

.venv\Scripts\python.exe -m pytest -o addopts= tests\hermes_cli\test_service_manager.py::test_render_run_script_resets_home_before_exec tests\test_docker_home_override_scripts.py -q

2 passed in 0.23s

@alt-glitch alt-glitch added type/bug Something isn't working area/docker Docker image, Compose, packaging comp/cli CLI entry point, hermes_cli/, setup wizard P2 Medium — degraded but workaround exists labels May 27, 2026
@benbarclay benbarclay merged commit c341a2d into NousResearch:main May 28, 2026
22 checks passed
mathias3 pushed a commit to mathias3/hermes-agent that referenced this pull request May 28, 2026
Bryce-huang pushed a commit to wbkunlun/hermes-agent that referenced this pull request May 29, 2026
zwolniony pushed a commit to zwolniony/hermes-agent that referenced this pull request May 29, 2026
mosaiq-systems pushed a commit to mosaiq-systems/hermes-agent that referenced this pull request May 29, 2026
KKT-OPT pushed a commit to KKT-OPT/hermes-agent that referenced this pull request May 31, 2026
gweeteve pushed a commit to gweeteve/hermes-agent that referenced this pull request Jun 2, 2026
GillesETOUBLEAU added a commit to GillesETOUBLEAU/hermes-agent that referenced this pull request Jun 4, 2026
v0.15.x added platform locks at $XDG_STATE_HOME/hermes/gateway-locks,
defaulting to ~/.local/state (gateway/status.py). Our bespoke Railway
entrypoint drops to the unprivileged hermes user via s6-setuidgid but
left HOME inherited as /root, so the Discord adapter crashed on boot:

    PermissionError: [Errno 13] Permission denied:
    '/root/.local/state/hermes/gateway-locks'

Export HOME=$HERMES_HOME (/opt/data, the writable persistent volume)
in the hermes phase, mirroring upstream's s6 main-wrapper.sh which does
`export HOME=/opt/data` for exactly this reason (PR NousResearch#33481). The s6
boot path got this fix during the migration; the direct-entrypoint
path used by railway.toml's startCommand did not.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
ilkoretskiy added a commit to ilkoretskiy/hermes-agent that referenced this pull request Jun 8, 2026
Resolutions:
- gateway/run.py: take upstream. Our cherry-picked topic-binding patch
  (_refresh_telegram_topic_binding_after_session_switch, for NousResearch#20470) is now
  subsumed by upstream _sync_telegram_topic_binding (NousResearch#20470/NousResearch#29712/NousResearch#33414).
- Dockerfile: merge PATH — keep upstream /opt/hermes/bin privilege-drop shim
  ahead of venv, keep fork /opt/tools persistent-tools volume + pipx/gobin/cargo.
- tests/agent/transports/test_chat_completions.py: keep both (fork codex-ack
  test + upstream extra_content tests).
Brings upstream PR NousResearch#33481 (HOME=/opt/data for s6 gateway services) — closes the
local NousResearch#9 workaround.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/docker Docker image, Compose, packaging comp/cli CLI entry point, hermes_cli/, setup wizard P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants