Repository navigation
Description
Bug Description
Summary
In a Docker deployment using nousresearch/hermes-agent:latest / Hermes dashboard v0.11.0 / release 2026.4.23, Hermes persistent state under /opt/data is being written by agent/tool memory operations as root:root with restrictive permissions, while the gateway process runs as the hermes user / UID 10000.
This causes files such as /opt/data/memories/MEMORY.md to become unreadable by the gateway. Memory can appear to be written successfully by the agent/tool side, but the running gateway cannot reliably read/inject it into session context.
This appears reproducible after memory-tool writes/consolidation.
Environment
- Image:
nousresearch/hermes-agent:latest - Dashboard version:
0.11.0 - Release date shown by dashboard:
2026.4.23 - Docker host: Synology NAS / DSM
- Persistent host path:
/volume1/docker/hermes - Container path:
/opt/data - Main container command:
gateway run - Dashboard container command:
dashboard --host 0.0.0.0 --port 9119 --no-open --insecure - Gateway process runs as
hermes/ UID10000 - Container PID 1 runs via
tini/ entrypoint as root, then the gateway process runs ashermes
Steps to Reproduce
- Run Hermes in Docker with persistent host storage mounted to
/opt/data. - Confirm the gateway process runs as
hermes/ UID10000:
docker exec hermes sh -lc 'ps aux | grep -Ei "[h]ermes|[g]ateway"'
- Fix memory ownership manually so it is readable by the gateway:
sudo chown 10000:10000 /volume1/docker/hermes/memories/MEMORY.md
sudo chmod 660 /volume1/docker/hermes/memories/MEMORY.md
- Ask the agent to write/consolidate memory using the memory tool.
- Check ownership again:
docker exec hermes sh -lc 'ls -la /opt/data/memories/MEMORY.md /opt/data/memories/USER.md'
- Observe that
MEMORY.mdhas reverted toroot:rootwith mode0600.
Expected Behavior
All Hermes persistent state written under $HERMES_HOME / /opt/data should remain readable/writable by the Hermes runtime user.
Expected:
-rw-rw---- 1 hermes hermes ... /opt/data/memories/MEMORY.md
or equivalent UID/GID 10000:10000. Memory writes should not make the file unreadable by the running gateway process.
Actual Behavior
Memory/tool writes create or replace state files as:
-rw------- 1 root root ... /opt/data/memories/MEMORY.md
This breaks the non-root gateway process because the gateway runs as hermes / UID 10000.
Observed after memory write:
-rw------- 1 root root 2435 Apr 28 19:35 /opt/data/memories/MEMORY.md
-rw-rw---- 1 hermes hermes 1105 Apr 24 21:12 /opt/data/memories/USER.md
Earlier cron symptom:
IOError reading jobs.json: [Errno 13] Permission denied: '/opt/data/cron/jobs.json'
The issue is recurring permission drift caused by root-written files under /opt/data.
Affected Component
Agent Core (conversation loop, context compression, memory)
Messaging Platform (if gateway-related)
No response
Debug Report
Debug report generated with `docker exec -it hermes hermes debug share`.
Report:
https://paste.rs/lGUr0
Note: agent.log and gateway.log failed to upload due paste service errors. The report link auto-deletes after 6 hours.
I reviewed the report before posting. It does not appear to include raw API keys, but it does include configured-provider names, local container paths, Docker network IPs, cron job names, skill paths, and recent log excerpts.
Additional relevant evidence from the report:
- Gateway is running in Docker.
- Hermes home is `/opt/data`.
- Dashboard/Hermes version is `0.11.0` / `2026.4.23`.
- Cron job execution showed multiple permission-denied errors reading skill files under `/opt/data/skills/...`.Operating System
Synology DSM / Docker
Python Version
No response
Hermes Version
0.11.0
Additional Logs / Traceback (optional)
Repeated cron permission error previously observed:
IOError reading jobs.json: [Errno 13] Permission denied: '/opt/data/cron/jobs.json'
Dashboard status after API server fix:
"gateway_running": true,
"gateway_state": "running",
"gateway_platforms": {
"telegram": { "state": "connected" },
"api_server": { "state": "connected" }
}
The gateway itself runs successfully, but state files created/replaced by root-running agent/tool operations can become unreadable by the gateway runtime user.Root Cause Analysis (optional)
The apparent root cause is a UID/GID mismatch in Docker:
- Gateway/runtime process runs as
hermes/ UID10000. - Agent/tool/memory write operations appear to run as
root/ UID0. - Persistent state is shared under
$HERMES_HOME//opt/data.
When the memory tool writes or replaces /opt/data/memories/MEMORY.md, the replacement file is created as root:root with mode 0600. The gateway process later needs to read the same file as hermes but cannot.
This same pattern can affect any persistent file under /opt/data — cron state, profile dirs, generated docs, skills, cache, config backups.
Proposed Fix (optional)
Ensure all writes under $HERMES_HOME / /opt/data are performed as the Hermes runtime UID/GID, or normalize ownership/mode after writes.
Preferred behavior:
- Memory/config/cron/state writes should be owned by
hermes:hermes/ UID10000:10000. - Regular state files should be readable/writable by the runtime user, e.g. mode
0660. - Directories should be accessible by the runtime user, e.g. mode
0770.
Possible fixes:
- Run agent/tool write operations as UID/GID
10000:10000. - Ensure memory-tool file replacement preserves existing ownership/mode.
- Add ownership/mode normalization after writes under
$HERMES_HOME. - Avoid creating persistent runtime files as
root:rootwhen the gateway runs as non-root.
Are you willing to submit a PR for this?
- I'd like to fix this myself and submit a PR
Activity
alt-glitch commentedon Apr 28, 2026
Related to #15718 (auth.json root ownership) and #10270 (pairing files root ownership) — same class of Docker root-writes bug. PRs #11071 and #15861 fix the pairing and auth variants respectively; this is the memory-tool write path.
CipherFrame commentedon Jun 20, 2026
Following up on this from a fresh v0.17.0 deployment (2026-06-20). The bug class is broader than #17144's memory scope and now includes cron. Field notes:
Same root cause, two paths:
hermes_cli/config.py→_chown_to_hermes_uid()exists but explicitly skips the chown when current process is non-root (relies on entrypoint chown that doesn't always fire)cron/jobs.py→_save_jobs_unlocked()(line ~554) has no chown at all — just_secure_file()which only chmodsTwo-month observation window:
hermes config setre-rootedconfig.yaml, gateway fell back to defaults for 16+ minutes before manual fixcron/jobs.jsonTHREE times in one session from the agent'scronjobtool, each time silentlyjobs.jsonon its first scheduled tickWorking workaround in production since 2026-06-20:
docker exec --user hermes:Same pattern for
hermes-config.Heals in <1 second. Worst-case drift window: 5 minutes.
Suggested upstream fix (4 lines, applies to both code paths):
This belongs on the same PR/branch as the fixes for #15718 and #10270 — same class. The
_chown_to_hermes_uid_best_efforthelper should live inhermes_constantsor a shared util so both call sites use the same one.Also worth noting: the silent fallback is the worst part. The gateway should log a loud, actionable error when it can't read its own config/cron DB —
RuntimeError: Failed to read cron databaseis technically thrown but doesn't surface in agent sessions. Users see "my crons aren't firing" with no cause.Happy to test a fix branch if someone opens a PR. — @CipherFrame
CipherFrame commentedon Jun 20, 2026
#17825 / 04ce8d9 → PR #49826 is up
Following up on my earlier field report: a fix is now open as PR #49826.
TL;DR: in
cron/jobs.py:_save_jobs_unlocked, after the existing_secure_filechmod, chown the new file to match the owner ofHERMES_DIR(set at install time, stable). Best-effort — swallowsOSError/NotImplementedError/PermissionErrorso the save never breaks even if we lackCAP_CHOWN. 1-line call site, 21-line helper, 3 new tests.Why this is a real fix and not a workaround: the 5-min ownership watchdog I noted in the previous comment is fine for
jobs.jsonbecause it happens to be on its allowlist, but the underlying bug class — "any process that writes to a hermes-owned file can break the gateway" — applies toconfig.yaml,MEMORY.md,USER.md, anything. The watchdog only patches the symptom. The PR fixes the source.Field validation since the last comment: running this code in production for ~24h on a Docker Compose deployment.
jobs.jsonhas not drifted fromhermes:hermesonce. The watchdog is still running, but it's no longer needed forjobs.json— it can keep doing its job for the other files the gateway writes (config.yaml,MEMORY.md, etc.) which still drift occasionally.Diff: https://github.com/NousResearch/hermes-agent/pull/49826/files
Happy to split the PR (e.g. one for the chown fix, one for the watchdog allowlist expansion) if that helps the merge — let me know.
fix(cron): chown jobs.json to HERMES_DIR owner on save
konsisumer commentedon Jul 1, 2026
These issues look like facets of one underlying problem: #17144, #41683, #41699.
They were grouped by a semantic pass as different symptoms of one underlying problem in
area/docker. A single coordinated fix may resolve them together — flagging for visibility; no action has been taken on the individual issues.Automated root-cause grouping. Reply to correct if these are unrelated.
teknium1 commentedon Jul 12, 2026
Closing as implemented on main. This automated hermes-sweeper review verified that the official Docker runtime no longer executes ordinary gateway, agent, tool, or
docker exec … hermeswrites as root.aeb992d34374bf07f34811a3e8a11e623d1cc16badds the Docker exec privilege-drop shim.docker/hermes-exec-shim.sh:52-87re-execs rootdocker exec … hermescalls ashermes.docker/main-wrapper.sh:22,72-82drops every normal Docker CMD—includinggateway run—tohermesbefore the gateway and its tool calls run.tools/memory_tool.py:309-312,760-779writesMEMORY.md/USER.mdas the calling process; under the current Docker launch path that process is the gateway runtime user, not root.tests/docker/test_docker_exec_privilege_drop.py:106-146exercises a built image and asserts a state file written through defaultdocker execis owned byhermes:hermes.The linked PR #49826 addresses cron with a narrower post-write chown, but the root execution path underlying this issue is already prevented on current main. Deliberate root opt-outs remain documented as intentional root semantics.