Skip to content

fix(shields): attest private mutable Hermes topology - #7049

Merged
apurvvkumaria merged 10 commits into
mainfrom
codex/pr7033-mode-rejection
Jul 16, 2026
Merged

fix(shields): attest private mutable Hermes topology#7049
apurvvkumaria merged 10 commits into
mainfrom
codex/pr7033-mode-rejection

Conversation

@apurvvkumaria

@apurvvkumaria apurvvkumaria commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator

Summary

Supersedes #7033 with an append-only maintainer follow-up that preserves every original commit by Prekshi Vyas. It keeps the intended private Hermes root support while requiring descriptor-safe lifecycle-marker and process-topology attestation before accepting or repairing that state.

Related Issue

Refs #6381

Changes

  • Preserve all seven commits from fix(shields): accept private mutable Hermes root #7033 and their original authorship.
  • Authenticate the root-separated lifecycle marker by pinned descriptor, exact ownership, mode, link count, and content.
  • Attest the pinned process topology before distinguishing root-separated and same-UID runtimes.
  • Re-sample lifecycle and startup-ready state after the procfs proof and fail closed if topology changes during attestation.
  • Restrict accepted same-UID modes and repair root-separated mode inside the sealed transaction.
  • Fail closed on malformed, symlinked, hard-linked, changed, or raced marker and topology state while retaining rollback.
  • Exercise real root-owned repair and exact rollback in a pinned, network-isolated Linux container independent of the host UID.
  • Assert the rollback protocol order: prepare abort, restore the locked state directory, then commit abort.
  • Credit Prekshi Vyas as co-author of both maintainer remediation commits.

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: an independent documentation audit confirmed this tightens an internal sandbox guard without changing supported commands, configuration, or operator workflow.
  • 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: independent exact-head maintainer review covered topology transitions, filesystem authority, rollback order, test isolation, and the automated findings; the remaining analyzer comments were verified as duplicate false positives or inapplicable to the explicitly same-UID E2E fixture.
  • Non-success, skipped, or missing CI check accepted by maintainer — check name, approval link, and follow-up issue:

Verification

  • PR description includes the DCO sign-off declaration and every pushed commit appears as Verified in GitHub
  • Normal pre-commit, commit-msg, and pre-push hooks passed
  • Targeted tests pass for changed behavior
  • Full npm test passes (broad runtime changes only)
  • 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)

Targeted evidence: the topology suite passed (3 host tests; 2 platform-gated), the Docker-backed real-root rollback case passed independently, the legacy shields suite passed (14/14), Python compilation and CLI typecheck passed, and changed-file hooks plus title, size, source-shape, Biome, Docker-abstraction, and diff checks passed. Fresh exact-head CI and trusted E2E are pending.


Signed-off-by: Apurv Kumaria akumaria@nvidia.com

Summary by CodeRabbit

  • Security & Reliability
    • Strengthened Hermes runtime topology attestation using a root lifecycle marker.
    • Added stricter fail-closed behavior for missing/unsafe marker states and unknown topologies.
    • Reconciles/repairs mutable private Hermes directory metadata (mode/ownership) before finalization.
    • Added durability checks by introducing a directory metadata fsync barrier when required.
  • Bug Fixes
    • Relaxed non-final Hermes config-directory mode matching (while keeping owner validation strict), with clearer expected-mode failures during in-progress transactions.
  • Tests
    • Added new Hermes runtime-config-guard topology and reconciliation test coverage (local + Docker), including race/drift and transition recovery scenarios.

prekshivyas and others added 8 commits July 16, 2026 10:48
Signed-off-by: Prekshi Vyas <prekshiv@nvidia.com>
Co-authored-by: Prekshi Vyas <prekshiv@nvidia.com>
Signed-off-by: Apurv Kumaria <akumaria@nvidia.com>
Signed-off-by: Prekshi Vyas <prekshiv@nvidia.com>
Signed-off-by: Prekshi Vyas <prekshiv@nvidia.com>
Signed-off-by: Prekshi Vyas <prekshiv@nvidia.com>
…ate-shields-root

Signed-off-by: Prekshi Vyas <prekshiv@nvidia.com>
Signed-off-by: Prekshi Vyas <prekshiv@nvidia.com>
Co-authored-by: Prekshi Vyas <prekshiv@nvidia.com>
Signed-off-by: Apurv Kumaria <akumaria@nvidia.com>
@apurvvkumaria apurvvkumaria added integration: hermes Hermes integration behavior area: sandbox OpenShell sandbox lifecycle, runtime, config, or recovery area: security Security controls, permissions, secrets, or hardening bug-fix PR fixes a bug or regression v0.0.85 labels Jul 16, 2026
@apurvvkumaria apurvvkumaria self-assigned this Jul 16, 2026
@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The Hermes guard now attests runtime topology, reconciles mutable .hermes metadata accordingly, and enforces final mode and durability checks. Unlock validation and tests cover provisional modes, rollback, topology failures, races, and transition cleanup.

Changes

Hermes topology and shields posture

Layer / File(s) Summary
Runtime topology attestation
agents/hermes/runtime-config-guard.py, test/hermes-runtime-config-guard-topology.test.ts
Lifecycle marker, procfs identity, and startup-readiness checks derive runtime topology and reject unsafe marker states.
Mutable Hermes root finalization
agents/hermes/runtime-config-guard.py, src/lib/shields/index.ts, test/hermes-runtime-config-guard-topology.test.ts
Mutable .hermes metadata is reconciled and revalidated at commit; root-separated transitions add directory metadata fsync, while active Hermes transactions accept provisional mode 700.
Transition compatibility and lifecycle validation
src/lib/shields/legacy-hermes-compat.test.ts, test/e2e/live/hermes-shields-config.test.ts, test/hermes-runtime-config-guard-topology.test.ts, ci/source-shape-test-budget.json
Tests and source-shape configuration cover successful unlock, rollback, invalid modes, posture variants, race handling, later validation failure, and transition artifact cleanup.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Shields
  participant RuntimeConfigGuard
  participant LifecycleMarker
  participant HermesRoot
  Shields->>RuntimeConfigGuard: finish-shields-transition
  RuntimeConfigGuard->>LifecycleMarker: attest runtime topology
  LifecycleMarker-->>RuntimeConfigGuard: return topology state
  RuntimeConfigGuard->>HermesRoot: reconcile and enforce metadata posture
  RuntimeConfigGuard->>HermesRoot: fsync metadata for root-separated topology
  HermesRoot-->>RuntimeConfigGuard: return final metadata
  RuntimeConfigGuard-->>Shields: commit transition or abort on drift
Loading

Possibly related PRs

  • NVIDIA/NemoClaw#7033: Relaxes Hermes unlock mode verification for active transactions and covers related topology and mutable-root permission handling.

Suggested labels: platform: container

Suggested reviewers: cv

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly captures the main change: attesting private mutable Hermes topology in shields.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/pr7033-mode-rejection

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

@github-code-quality

github-code-quality Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Code Coverage Overview

Languages: TypeScript

TypeScript / code-coverage/plugin

The overall coverage remains at 96%, unchanged from the main branch.

TypeScript / code-coverage/cli

The overall coverage in the codex/pr7033-mode-re... branch remains at 80%, unchanged from the main branch.

Show a code coverage summary of the most impacted files.
File main 3558a7a codex/pr7033-mode-re... 7c5546b +/-
src/lib/shields/index.ts 70% 72% +2%
src/lib/state/m...-acquisition.ts 84% 89% +5%
src/lib/sandbox...vileged-exec.ts 75% 87% +12%

Updated July 16, 2026 22:28 UTC
Code Coverage is in Public Preview. Learn more and provide us with your feedback.

Comment thread agents/hermes/runtime-config-guard.py
Comment thread agents/hermes/runtime-config-guard.py

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@agents/hermes/runtime-config-guard.py`:
- Around line 766-793: The _attested_shields_runtime_topology function must
revalidate lifecycle and startup-ready marker state after
_openshell_supervised_nonroot_start_is_live completes. Before returning
"same-uid-nonroot", resample _root_lifecycle_marker_state and
_startup_ready_marker_absent, return "unknown" or fail closed if either no
longer matches the initial state, and preserve the existing root-separated
validation behavior.

In `@src/lib/shields/legacy-hermes-compat.test.ts`:
- Around line 293-304: Update the rollback assertions in the test around
commandFromCall to verify protocol order, not just command presence: assert
prepare-shields-abort occurs before the run-state-dir-transition state lock
command, which occurs before abort-shields-transition. Preserve the existing
guard-action and state-lock checks while deriving and comparing their command
positions in the recorded commands.

In `@test/e2e/live/hermes-shields-config.test.ts`:
- Around line 113-115: Update the assertion in the Hermes shields E2E test to
derive or declare the fixture’s topology and require mode 3770 when the
lifecycle marker indicates root separation, while allowing 700 only for the
same-UID topology. Keep the check at the public command-output boundary and
remove the alternation that accepts 0700 for root-separated execution.
🪄 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: e643bc79-f9cc-4a06-aed9-95da011ad74a

📥 Commits

Reviewing files that changed from the base of the PR and between 41a5885 and e20f45c.

📒 Files selected for processing (5)
  • agents/hermes/runtime-config-guard.py
  • src/lib/shields/index.ts
  • src/lib/shields/legacy-hermes-compat.test.ts
  • test/e2e/live/hermes-shields-config.test.ts
  • test/hermes-runtime-config-guard-topology.test.ts

Comment thread agents/hermes/runtime-config-guard.py
Comment thread src/lib/shields/legacy-hermes-compat.test.ts Outdated
Comment thread test/e2e/live/hermes-shields-config.test.ts
@github-actions

github-actions Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

PR Review Advisor — Informational

Advisor assessment: Informational / high confidence
Next action: No advisor follow-up needed.
Findings: 0 blockers · 0 warnings · 0 suggestions
Status: No actionable findings remain in the canonical review ledger.

Model lanes

  • GPT-5.6 Terra (primary): Completed · high confidence · 0 blockers · 0 warnings · 0 suggestions
  • Nemotron 3 Ultra (second opinion): Completed · high confidence · 0 blockers · 0 warnings · 0 suggestions
  • Model comparison: normalized findings match; normalized E2E selections match; severity counts match.

Nemotron output stays in workflow artifacts and does not change the assessment above.

E2E guidance

Advisory only. E2E / PR Gate selects and runs jobs independently.

Recommended E2E: cloud-onboard, credential-sanitization, full-e2e, hermes-e2e, security-posture, hermes-shields-config

Workflow run details

This automated review informs maintainers. Warnings and suggestions do not require a response. A maintainer decides whether to merge.

apurvvkumaria and others added 2 commits July 16, 2026 15:12
Co-authored-by: Prekshi Vyas <prekshiv@nvidia.com>
Signed-off-by: Apurv Kumaria <akumaria@nvidia.com>
Co-authored-by: Prekshi Vyas <prekshiv@nvidia.com>
Signed-off-by: Apurv Kumaria <akumaria@nvidia.com>
@apurvvkumaria
apurvvkumaria merged commit 64aafee into main Jul 16, 2026
97 of 102 checks passed
@apurvvkumaria
apurvvkumaria deleted the codex/pr7033-mode-rejection branch July 16, 2026 22:48
cv pushed a commit that referenced this pull request Jul 17, 2026
<!-- markdownlint-disable MD041 -->
## Summary

Add the canonical dated changelog entry required before the v0.0.85
release plan can be generated.
The entry summarizes the user-visible OpenShell, DGX Station, inference,
MCP, onboarding, and recovery changes merged since v0.0.84 and links to
their owning guides.

## Changes

- Add `docs/changelog/2026-07-16.mdx` with the exact `## v0.0.85`
heading, parser-safe SPDX comment, release summary, and detailed
bullets.
- Link every documented theme to its most specific published OpenClaw
guide routes.
- Reconcile the release entry with these merged source PRs:
- #6726 -> `docs/changelog/2026-07-16.mdx`: Document the supported
OpenShell v0.0.85 upgrade, immutable consumed artifacts, multiline exec,
credential rewrite diagnostics, and child-process TLS boundary.
- #6986 -> `docs/changelog/2026-07-16.mdx`: Document managed MCP
behavior shared across supported agents.
- #6991 and #7045 -> `docs/changelog/2026-07-16.mdx`: Document qualified
DGX Station host preparation and the interactive-terminal boundary for
`--station-deepseek`.
- #6992, #7001, #7006, and #7044 -> `docs/changelog/2026-07-16.mdx`:
Document managed-model reasoning behavior, safe inference route
mutation, and verified vLLM served aliases.
- #6865, #7010, and #7028 -> `docs/changelog/2026-07-16.mdx`: Document
onboarding DNS recovery, explicit notice acceptance, and upgrades with
user-local OpenShell.
- #7005, #7021, #7029, and #7049 -> `docs/changelog/2026-07-16.mdx`:
Document rebuild backup safety, no-dashboard state, managed gateway
discovery, and Hermes shields topology checks.

## Type of Change

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

## Quality Gates

- [ ] Tests added or updated for changed behavior
- [x] Existing tests cover changed behavior — justification:
`test/changelog-docs.test.ts` validates the canonical heading,
parser-safe SPDX comment, and detailed entry structure; the docs build
validates published routes.
- [ ] Tests not applicable — justification:
- [x] 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:

## Verification

- [x] PR description includes a `Signed-off-by:` line and every commit
appears as `Verified` in GitHub
- [x] Normal `pre-commit`, `commit-msg`, and `pre-push` hooks passed, or
`npm run check:diff` passed when hooks were skipped or unavailable
- [x] Targeted behavior tests pass for the current change set, or tests
are marked not applicable above — `npx vitest run
test/changelog-docs.test.ts` passed 6/6.
- [ ] Applicable broad gate passed — `npm test` for broad
runtime/test-harness changes; `npm run check` for repo-wide
validation/coverage changes — not applicable to this doc-only entry.
- [x] Quality Gates section completed with required justifications or
waivers
- [x] No secrets, API keys, or credentials committed
- [ ] `npm run docs` builds without warnings (doc changes only) — passed
with 0 errors and 2 pre-existing Fern warnings.
- [x] Doc pages follow the [style
guide](https://github.com/NVIDIA/NemoClaw/blob/main/docs/CONTRIBUTING.md)
(doc changes only)
- [x] New doc pages include SPDX header and frontmatter (new pages only)
— native changelog entries use the required parser-safe MDX SPDX comment
instead of frontmatter.

---
Signed-off-by: Charan Jagwani <cjagwani@nvidia.com>


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

## Summary by CodeRabbit

* **Documentation**
  * Added release notes for NemoClaw v0.0.85.
* Documented improvements to compatibility, credential handling, setup
validation, recovery workflows, endpoint configuration, gateway
discovery, and runtime validation.
  * Added links to relevant user-guide sections.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Signed-off-by: Charan Jagwani <cjagwani@nvidia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: sandbox OpenShell sandbox lifecycle, runtime, config, or recovery area: security Security controls, permissions, secrets, or hardening bug-fix PR fixes a bug or regression integration: hermes Hermes integration behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants