Skip to content

fix(hermes-01x): keep cron/ usable by the gateway in the tools image - #91

Open
derekhsu wants to merge 1 commit into
feat/image-only-clifrom
fix/90-tools-cron-dir-perms
Open

derekhsu wants to merge 1 commit into
feat/image-only-clifrom
fix/90-tools-cron-dir-perms

Conversation

@derekhsu

@derekhsu derekhsu commented Dec 3, 2026

Copy link
Copy Markdown
Owner

Summary

In the Hermes tools image, /sandbox/.hermes/cron was 0700 gateway:sandbox, so the Hermes gateway, which runs as user sandbox, could not use cron. A root build step in Dockerfile.tools ran Hermes on /sandbox/.hermes without HERMES_CONTAINER=1, and Hermes' ensure_hermes_home() then changed /sandbox/.hermes and cron/ to 0700. That step now sets HERMES_CONTAINER=1, and the build and check-image.sh fail when the tools layer changes a directory under /sandbox/.hermes.

Related Issue

Closes #90

Changes

  • agents/hermes-01x/Dockerfile.tools:
    • Set HERMES_CONTAINER=1 on the root get_browser_backend() check that reads /sandbox/.hermes, as the base image's cron probes do.
    • Record the owner, group, and mode of every directory under /sandbox/.hermes before the first Hermes process. After the last one, compare them with diff -u. Any difference fails the build.
    • Before and after, check /sandbox/.hermes is sandbox:sandbox 3770 and cron/ is gateway:sandbox 2770. These are the base Dockerfile values from its chmod and check_metadata steps.
  • tools/openclaw-tools-image/fixtures/check-image.sh: in hermes mode, compare the directories under /sandbox/.hermes between the base and tools images. A changed owner, group, or mode, or an added directory, fails the check.
  • test/hermes-01x-image.test.ts:
    • Two static tests: every HERMES_HOME=/sandbox/.hermes line sets HERMES_CONTAINER=1, and the directory and cron/ checks run after the last Hermes process.
    • Three check-image.sh behavior tests with a fake docker: the check passes when directories match, fails when cron/ is 0700, and fails when the tools image adds a directory.
  • ci/source-shape-test-budget.json: register the two static tests as security source-shape exceptions.
  • docs/modification/2026-11-17-hermes-tools-image.md: describe the new check-image.sh comparison, the cause, and the build checks.

Cause evidence: no container runtime was available, so I ran the same python -c line from Dockerfile.tools against Hermes 0.21.3 source on a temporary HERMES_HOME. Without HERMES_CONTAINER, both HERMES_HOME and cron/ became 0700. With HERMES_CONTAINER=1, both modes stayed the same. build-hermes-mcp-digest.py does not import Hermes and does not set HERMES_HOME, so it is unchanged.

Not verified:

  1. I did not build the image. The new Dockerfile.tools checks, the find -printf output format, and the check-image.sh comparison against real base and tools images are first exercised by Images / Hermes Tools Verify on this PR.
  2. I did not confirm the cron/ mode in the published base image. The issue shows the base directory as drwxrwx--- without the setgid bit, and the base Dockerfile checks 2770. If the published value differs, the new check fails the build.
  3. Even with HERMES_CONTAINER=1, running load_config as root can leave a root-owned backups/config/config.yaml.good.* file under /sandbox/.hermes. The new comparison covers directories, not files, so it does not catch this file.

Type of Change

  • Code change (feature, bug fix, or refactor)
  • Code change with doc updates
  • Doc only (prose changes, no code sample modifications)
  • Doc only (includes code sample changes)

Quality Gates

  • Tests added or updated for changed behavior
  • Existing tests cover changed behavior — justification:
  • Tests not applicable — justification:
  • Docs updated for user-facing behavior changes
  • Docs not applicable — justification:
  • Sensitive paths changed (security, policy, credentials, preflight, onboarding, inference, runner, sandbox, or messaging)
  • Sensitive-path review completed or maintainer-approved waiver recorded — reviewer/approval link/justification:
  • Non-success, skipped, or missing CI check accepted by maintainer — check name, approval link, and follow-up issue:

Documentation Writer Review

  • Documentation writer subagent reviewed the completed changes
  • Result: docs-updated
  • Evidence: docs/modification/2026-11-17-hermes-tools-image.md. The review passed with nits, and all nits are fixed in this commit.
  • Agent: Claude Code

DGX Station Hardware Evidence

  • Tested on DGX Station
  • Tested commit:
  • Station profile/scenario:
  • Result:
  • Supporting evidence:

Verification

  • PR description includes a Signed-off-by: line and every commit appears as Verified in GitHub
  • Normal pre-commit, commit-msg, and pre-push hooks passed, or npm run validate:pr passed after refreshing origin/main when hooks were skipped or unavailable
  • Targeted behavior tests pass for the current change set, or tests are marked not applicable above — command/result or justification: npx vitest run --project integration test/hermes-01x-image.test.ts passed 56/56; with test/hermes-tools-image-release.test.ts, test/check-image-layer-count.test.ts, and test/hermes-final-image-layout.test.ts, 103/103 passed. npm run source-shape:check, shellcheck, and hadolint passed.
  • Applicable broad gate passed — npm test for broad runtime/test-harness changes; npm run check for repo-wide validation/coverage changes — command/result:
  • Quality Gates section completed with required justifications or waivers
  • No secrets, API keys, or credentials committed
  • npm run docs builds without warnings (doc changes only)
  • Doc pages follow the style guide (doc changes only)
  • New doc pages include SPDX header and frontmatter (new pages only)

Signed-off-by: Derek Hsu derekhsu@hotmail.com

A root build step in Dockerfile.tools ran Hermes on /sandbox/.hermes
without HERMES_CONTAINER=1. Hermes' ensure_hermes_home() then chmodded
/sandbox/.hermes and cron/ to 0700, so cron/ became 0700 gateway:sandbox
and the Hermes gateway, which runs as user sandbox, could not use cron.

Set HERMES_CONTAINER=1 on that step, as the base image's cron probes do.
Record every directory under /sandbox/.hermes before the first Hermes
process and fail the build if any owner, group, or mode differs after the
last one, and check the base values for /sandbox/.hermes (3770) and
cron/ (2770). check-image.sh now compares those directories between the
base and tools images in hermes mode.

Fixes #90

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Derek Hsu <derekhsu@hotmail.com>

This branch has not been deployed

No deployments
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.

Hermes tools image: /sandbox/.hermes/cron is 0700 gateway:sandbox, so the gateway (running as sandbox) cannot use cron

1 participant