fix(hermes): symlink .hermes_history to writable data dir#2473
fix(hermes): symlink .hermes_history to writable data dir#2473octo-patch wants to merge 2 commits intoNVIDIA:mainfrom
Conversation
…IA#2432) Hermes TUI (prompt_toolkit) attempts to write command history to /sandbox/.hermes/.hermes_history at runtime. /sandbox/.hermes is intentionally locked root:root during image build to prevent config tampering, making the history path unwritable for the sandbox user. Create a symlink /sandbox/.hermes/.hermes_history → /sandbox/.hermes-data/.hermes_history before the DAC hardening step. The symlink itself becomes root-owned (chown -h root:root) but the target path lives under the sandbox-user-writable .hermes-data dir, so prompt_toolkit can create and append to the history file at runtime. Also add a regression test asserting the symlink is present in the Dockerfile and appears before the chown step that locks the directory.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe Dockerfile adds a build-time symlink redirecting Hermes TUI history from Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@test/hermes-plugin-handlers.test.ts`:
- Around line 93-104: The test currently searches raw src for substrings which
can appear in comments and yield false positives; update the test in
hermes-plugin-handlers.test.ts to only inspect executable Dockerfile RUN
commands by splitting src into lines, filtering out comment lines (lines
starting with '#' or '//') or extracting lines beginning with 'RUN', then
perform the contains/indexOf checks against that filtered/run-only string (use
the existing src variable, then compute a runOnlySrc or filteredSrc and use
symlinkIdx/chownIdx comparisons against that instead).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 802544c0-4fd7-4ac0-a687-14f25dc2aa1a
📒 Files selected for processing (2)
agents/hermes/Dockerfiletest/hermes-plugin-handlers.test.ts
Filter out comment lines and use regex matching against `RUN ln -s ...` and `RUN chown root:root ...` so the regression assertion can no longer pass on doc comments alone. Addresses CodeRabbit review feedback. Co-Authored-By: Octopus <liyuan851277048@icloud.com>
Fixes #2432
Problem
Hermes TUI (prompt_toolkit) writes command history to
/sandbox/.hermes/.hermes_history. Because/sandbox/.hermesisintentionally locked to
root:rootat image build time (to preventconfig tampering), the sandbox user cannot write to this path — every
interaction triggers a traceback and
Press ENTER to continue...prompt, blocking
/exit.Solution
Create a symlink
/sandbox/.hermes/.hermes_history→/sandbox/.hermes-data/.hermes_historybefore the DAC hardening stepin the Dockerfile. This follows the same pattern already used for
SOUL.md(line 92).After the
chown -h root:rootpass, the symlink itself becomesroot-owned, but the target path lives under
/sandbox/.hermes-data/which is owned by the sandbox user. When prompt_toolkit opens
/sandbox/.hermes/.hermes_historyin append mode it follows thesymlink transparently and creates/writes the file in the writable
directory.
Testing
test/hermes-plugin-handlers.test.tsasserting the Dockerfile contains the symlink and that it appears
before the
chown root:root /sandbox/.hermesstep.path.isAbsoluteof the symlink target resolvescorrectly through the writable dir at container runtime.
Summary by CodeRabbit
Bug Fixes
Tests