Skip to content

fix(hermes): fail startup when provider placeholder refresh fails - #12512

Closed
drakeo338 wants to merge 1 commit into
NVIDIA:mainfrom
drakeo338:claude/12510-fix
Closed

drakeo338 wants to merge 1 commit into
NVIDIA:mainfrom
drakeo338:claude/12510-fix

Conversation

@drakeo338

@drakeo338 drakeo338 commented Sep 30, 2026 •

Copy link
Copy Markdown

Outcome

Provider placeholder refresh works after a sandbox restart, and a guard failure now fails startup.

Reason

The guard validated a temp file with env-file, which only accepts /sandbox/.hermes/.env, so refresh always failed, and refresh_hermes_provider_placeholders returned the later boundary check's status, hiding it.

Related issues

Fixes #12510

Changes

  • start.sh: return the guard's status.
  • validate-env-secret-boundary.py: add an env-text subcommand that validates stdin with the same content checks.
  • runtime-config-guard.py: pass the candidate on stdin; Dockerfile SHA-256 updated.
  • New tests in hermes-start-placeholder-refresh.test.ts and hermes-runtime-config-guard.test.ts.

Verification

  • npx vitest run test/agents/hermes/hermes-start-placeholder-refresh.test.ts — fails on main (status=0), passes with the fix
  • npx vitest run on that file, hermes-start.test.ts and hermes-runtime-config-guard.test.ts — 75 passed
  • pre-commit run --from-ref origin/main --to-ref HEAD — all passed except hadolint (not installed locally)

Review notes

Written with AI assistance (Claude Code) and reviewed by me.


Signed-off-by: drakeo338 [email protected]

Summary by CodeRabbit

  • Bug Fixes
    • Environment secret validation now checks candidate configuration directly, without relying on a temporary file.
    • Placeholder refresh stops when the runtime configuration guard reports a failure, preventing subsequent validation from proceeding with an invalid configuration.

 NVIDIA#12510)

refresh_hermes_provider_placeholders discarded the status of the guard
call because validate_hermes_env_secret_boundary was the last command.
Return the guard status.

The guard validated its candidate .env by writing a temp file and
running the boundary validator's env-file subcommand, which the
installed validator refuses for any path other than
/sandbox/.hermes/.env. Add an env-text subcommand that validates stdin
with no path check, sharing the content checks with env-file, and pass
the candidate on stdin. Update the pinned validator SHA-256.

Signed-off-by: drakeo338 <[email protected]>
@copy-pr-bot

copy-pr-bot Bot commented Sep 30, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@coderabbitai

coderabbitai Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: NVIDIA/NemoClaw/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 6cfc1252-aa16-4d3b-8c2a-3414dd7d0d5e

📥 Commits

Reviewing files that changed from the base of the PR and between 41b9d9f and d288101.

📒 Files selected for processing (6)
  • agents/hermes/Dockerfile
  • agents/hermes/runtime-config-guard.py
  • agents/hermes/start.sh
  • agents/hermes/validate-env-secret-boundary.py
  • test/agents/hermes/hermes-runtime-config-guard.test.ts
  • test/agents/hermes/hermes-start-placeholder-refresh.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.


📝 Walkthrough

Walkthrough

The Hermes environment validator accepts candidate .env content through stdin. The runtime-config guard uses this mode instead of a temporary file, and placeholder refresh returns when the guard fails.

Changes

Hermes environment validation

Layer / File(s) Summary
Validator stdin mode
agents/hermes/validate-env-secret-boundary.py, agents/hermes/Dockerfile
The validator shares byte-content validation between file and stdin inputs and adds the env-text CLI mode. The Dockerfile updates the validator’s expected SHA-256 value.
Guard and startup integration
agents/hermes/runtime-config-guard.py, agents/hermes/start.sh, test/agents/hermes/hermes-runtime-config-guard.test.ts, test/agents/hermes/hermes-start-placeholder-refresh.test.ts
The guard sends candidate environment text to the validator through stdin. Placeholder refresh returns if the guard fails. Tests cover validation without a temporary path and guard-failure propagation.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: ericksoa, prekshivyas

Merge Risk: ⚪ Minimal · up to d2881

This change lets Hermes provider-placeholder refresh succeed after a restart, and a failed guard now stops startup with a failure status. No merge-blocking risk was found.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 5 files. (1 skipped: 1… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: Hermes startup now fails when provider placeholder refresh fails.
Linked Issues check ✅ Passed Issue [#12510] requires the startup placeholder refresh to validate the candidate environment without violating the installed validator's canonical-path rule, and to report refresh failure. The PR add…
Out of Scope Changes check ✅ Passed The changed files support issue [#12510]. They implement candidate-text validation, failure propagation, integrity-pin maintenance, and automated tests for the startup refresh path. No unrelated funct…
Full details: Docstring Coverage

Explanation

Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 5 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

Comment @coderabbitai help to get the list of available commands.

@wscurran wscurran added area: providers Inference provider integrations and provider behavior area: security Security controls, permissions, secrets, or hardening bug-fix PR fixes a bug or regression integration: hermes Hermes integration behavior platform: container Affects Docker, containerd, Podman, or images labels Oct 6, 2026
sandl99 pushed a commit that referenced this pull request Oct 9, 2026
## Outcome

Hermes rebuilds reapply manifest-owned messaging configuration after
restoring the agent home and before the native restart.
Provider-placeholder refresh validates candidate env content through
stdin and propagates failures. Private mutable Hermes homes require the
image-owned runtime-topology check.

**Author scope decision:** ordinary rebuild exit status and recovery
retention are explicitly excluded. The cleanup finding predates this PR;
it is documented below as an inherited limitation requiring separate
ownership, not a requested implementation change here.

## Reason

Restoring the agent home can overwrite Teams configuration baked into
the replacement image. Placeholder refresh also used a temporary path
rejected by the installed validator's canonical-path restriction.

### Related issues

Fixes #12510. Fixes #12264.

The placeholder fix reuses #12512 at
`d2881011e4c45c5228fc0e5cc9252a0b7b2a0252`. NVIDIA inference policy,
authentication, provider ownership and probe repairs remain separate.

## Changes

- Validate bounded candidate env content through stdin before writes;
propagate guard failures from startup.
- Reapply the matching Hermes messaging plan before restart. Preserve
unrelated configuration and disabled channels; reject mismatched plans
and failed reads. Reapply failures retain the existing stop/cron
behavior and omit raw parser errors from logs.
- Preserve the legacy `3770` contract; accept private `0700` only with
the guard's non-root topology attestation. Keep ownership, file-mode,
link and metadata-drift checks; reject immutable or append-only config
directories and files using their open descriptors. Report failed
mutable-config verification with bounded, redacted diagnostics and a
retry command.

## Verification

Source: `29bef1af7fd7b902e22b8021bb0a63a1524099a5`. Recorded PR base:
`5f765a1318a2338114a1f6865de3113d9083b405`.

- [CI run
37909519940](https://github.com/NVIDIA/NemoClaw/actions/runs/37909519940)
passed for parent `576a3f5161`, which GitHub reports as Verified. CI,
GitHub verification and review for `29bef1af7f` await publication.
- The inode-flag repair passed 70 focused tests, CLI typecheck, lint,
formatting, 11 selected repository checks and seven growth checks. The
two added cases failed on the parent probe. Tests supply flag metadata
while retaining real file I/O; no independent Linux/macOS reproduction
with actual blocking flags was run.
- The test-only consolidation in `576a3f5161` removes one file and 30
net lines by reusing the existing shell harness and extractor. The same
startup failure case and assertions remain. All 45 tests in the
consolidated file, CLI typecheck, lint, formatting, project membership
and seven growth checks passed; committed contents match the validated
hash. That consolidation did not change production code.
- The logging repair passed 58 post-restore tests, CLI typecheck, lint,
formatting, repository checks and seven growth checks. Post-commit
source hashes matched the validated contents.
- The hash investigation ran two temporary local component cases: an
untouched baseline and a real Teams manifest reapply. Both reached the
launch observation with valid active hashes; details and limits are
below. No additional test or documentation file is included in the PR
for this investigation.
- Live Teams message delivery is not verified. Earlier combined
experiments with NVIDIA repairs do not establish a live pass for this
PR. The separate NVIDIA baseline work remains deferred. The reviewed
diff contains no real credentials.

## Review notes

Parent `576a3f5161` received an approving review with a non-blocking
[inode-flag
finding](#12841 (comment)).
[Advisor run
37911564231](https://github.com/NVIDIA/NemoClaw/actions/runs/37911564231)
completed all nine specialists with no findings. Those results do not
approve the new repair commit.

The repair reads blocking flags through the existing descriptors and
includes ctime in metadata stability checks. For `ENOTTY`, `EOPNOTSUPP`
or `EINVAL`, the probe skips the flag check; other flag-read errors fail
verification. The probe remains read-only. The prior cleanup and hash
dispositions below remain unchanged; inherited cleanup is not fixed or
waived.

### Cleanup recovery: inherited and explicitly outside scope

`F-operability-recovery-3feccd81e6fb10a68f98` reports behavior already
present in base `5f765a1`. The [current cleanup
branch](https://github.com/NVIDIA/NemoClaw/blob/0aa02cf7e9b1e9aa79df1d8fde0857924066c062/src/lib/actions/sandbox/rebuild-pipeline.ts#L1016-L1028)
is identical to the [base
branch](https://github.com/NVIDIA/NemoClaw/blob/5f765a1318a2338114a1f6865de3113d9083b405/src/lib/actions/sandbox/rebuild-pipeline.ts#L1016-L1028);
this PR does not change that file. The [base regression
test](https://github.com/NVIDIA/NemoClaw/blob/5f765a1318a2338114a1f6865de3113d9083b405/src/lib/actions/sandbox/rebuild-post-restore-phase.test.ts#L826-L841)
explicitly expects `{ mutableConfigPermissionsVerified: false }` without
`bail`.

**Disposition requested: inherited, out of scope for this messaging
repair.** The author explicitly excludes changes to ordinary rebuild
exit status and recovery retention. This follows the repository's
[inherited-finding
rule](https://github.com/NVIDIA/NemoClaw/blob/5f765a1318a2338114a1f6865de3113d9083b405/.agents/skills/_shared/pr-follow-up.md#decide):
leave the candidate unchanged and preserve the base evidence. Any
lifecycle repair requires a separate scope decision.

This is a real limitation: an ordinary rebuild can continue into cleanup
after unsuccessful mutable-config verification. The disposition does not
declare it harmless, fix it, or waive a review gate.

### Hash finding: existing non-root restart refresh confirmed

`F-architecture-standard-work-51d6a4be1557f2501c17` assumes the restart
consumes manifest changes without updating integrity state. The [native
non-root
relaunch](https://github.com/NVIDIA/NemoClaw/blob/0aa02cf7e9b1e9aa79df1d8fde0857924066c062/agents/hermes/start.sh#L3241-L3251)
calls [runtime
preparation](https://github.com/NVIDIA/NemoClaw/blob/0aa02cf7e9b1e9aa79df1d8fde0857924066c062/agents/hermes/start.sh#L2883-L2899),
which invokes the existing guard to refresh the active compatibility
hash before launch. The hash writer remains owned by the runtime guard.

A local experiment on Linux x86_64 at `0aa02cf7e9` used the real Teams
planner/applier, shell file writes, startup preparation and Python
guard. The untouched baseline retained its valid hash. Reapply changed
both files and made the old hash invalid; startup preparation then
refreshed it. Independent `sha256sum --check` passed at the
gateway-launch observation. Hash generation and validation were not
mocked.

For the tested non-root path, existing startup preparation refreshed the
active compatibility hash before launch. The experiment did not
reproduce the reported missing-refresh failure. The experiment replaced
OpenShell transport with local temporary-file I/O and observed the
launch boundary without starting a live daemon. It does not qualify
installed identity attestation, root/legacy topologies, inference or
Teams delivery. The temporary probe was retained as local evidence and
removed from the source tree.

---
Signed-off-by: Hung Le <[email protected]>

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **Bug Fixes**
- Messaging settings are now restored before OpenClaw or Hermes starts
after a sandbox rebuild. Hermes Teams settings are preserved without
adding credentials, and disabled Teams remains disabled.
- Failed configuration checks now stop startup or restoration safely,
without exposing sensitive configuration details in logs.
- Hermes environment validation now rejects oversized or invalid content
and checks configuration permissions and runtime conditions before
changes are made.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Hung Le <[email protected]>
@hunglp6d

hunglp6d commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator

Thank you for reporting #12510 and contributing this fix!

The provider-placeholder refresh fix from this PR was incorporated into #12841, which has merged into main.

Closing this PR as superseded by #12841. We appreciate your contribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: providers Inference provider integrations and provider behavior area: security Security controls, permissions, secrets, or hardening bug-fix PR fixes a bug or regression integration: hermes Hermes integration behavior platform: container Affects Docker, containerd, Podman, or images

Projects

None yet

3 participants