Skip to content

test(e2e): assert Hermes routing topology - #8896

Merged
prekshivyas merged 5 commits into
mainfrom
codex/hermes-switchyard-integration
Aug 13, 2026
Merged

test(e2e): assert Hermes routing topology#8896
prekshivyas merged 5 commits into
mainfrom
codex/hermes-switchyard-integration

Conversation

@cjagwani

@cjagwani cjagwani commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

Summary

The live Hermes E2E previously proved gateway restart behavior without recording the process topology needed for native Relay and Switchyard qualification. It now captures normalized, credential-safe process evidence before and after restart and requires one Hermes gateway with no standalone NeMo Relay or Switchyard sidecars.

Related Issue

Part of #8889.

Changes

  • Add a trusted /proc topology probe that reads command and process identity metadata without reading process environments.
  • Reject duplicate Hermes gateways, unexpected gateway PIDs, and standalone nemo-relay or switchyard-server processes.
  • Persist normalized before-and-after routing topology artifacts in the managed Hermes E2E.
  • Add focused E2E-support coverage for parsing, process detection, failure cases, artifact capture, and input validation.

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: This changes internal E2E evidence only and does not change or establish supported routing behavior.
  • Sensitive paths changed (security, policy, credentials, preflight, onboarding, inference, runner, sandbox, or messaging)
  • Sensitive-path review completed or maintainer-approved waiver recorded — security review: PASS; the probe reads process metadata but never process environments, strictly validates evidence, and fails closed.
  • Non-success, skipped, or missing CI check accepted by maintainer — optional PR review advisor (Nemotron 3 Ultra) failed due its internal tool-order contract after two attempts; maintainer waiver and false-positive audit. Required CI passed.

Documentation Writer Review

  • Documentation writer subagent reviewed the completed changes
  • Result: no-docs-needed
  • Evidence: Commit a30fe4e24 changes only internal Hermes E2E fixtures, tests, and evidence artifacts. The final commit exercises the topology probe's exact process-metadata permission-denial path. The complete PR does not change a CLI, configuration, API, policy, default, user-visible error, supported workflow, or native routing support claim.
  • Agent: Codex Desktop

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 — npx vitest run test/e2e/support/hermes-routing-topology.test.ts --project e2e-support (8 passed); npm run typecheck:cli; Biome
  • Applicable broad gate passed — Not applicable; the change is isolated to one live E2E assertion and its focused support fixture.
  • 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: Charan Jagwani cjagwani@nvidia.com

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

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: decb8c58-d056-412e-a742-d8f6d1bb189c

📥 Commits

Reviewing files that changed from the base of the PR and between 8d51796 and a30fe4e.

📒 Files selected for processing (1)
  • test/e2e/support/hermes-routing-topology.test.ts

📝 Walkthrough

Walkthrough

Changes

Hermes E2E tests now inspect /proc metadata through a validated Python probe. The fixture detects gateways and routing sidecars, stores topology artifacts, and validates topology before and after gateway restarts.

Hermes routing topology

Layer / File(s) Summary
Probe and topology validation
test/e2e/fixtures/hermes-routing-topology.ts
Adds the embedded /proc probe, topology interfaces, trusted script construction, JSON validation, and gateway sidecar assertions.
Topology capture and artifact storage
test/e2e/fixtures/hermes-routing-topology.ts, test/e2e/support/hermes-routing-topology.test.ts
Executes the probe, validates successful command results, writes raw and normalized topology artifacts, and tests validation and failure behavior.
Live restart topology checks
test/e2e/live/hermes-e2e.test.ts, test/e2e/support/hermes-routing-topology.test.ts
Captures topology before and after both gateway restart paths and validates the absence of standalone routing sidecars.

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

Sequence Diagram(s)

sequenceDiagram
  participant HermesE2ETest
  participant captureHermesRoutingTopology
  participant Sandbox
  participant PythonProcProbe
  HermesE2ETest->>captureHermesRoutingTopology: capture gateway topology
  captureHermesRoutingTopology->>Sandbox: run trusted probe
  Sandbox->>PythonProcProbe: inspect /proc metadata
  PythonProcProbe-->>Sandbox: return topology JSON
  Sandbox-->>captureHermesRoutingTopology: return probe result
  captureHermesRoutingTopology-->>HermesE2ETest: return validated topology
  HermesE2ETest->>HermesE2ETest: assert no standalone sidecars after restart
Loading

Possibly related issues

Suggested labels: integration: hermes, area: e2e

Suggested reviewers: cv, prekshivyas

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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 and concisely describes the main change: adding Hermes routing-topology assertions to E2E tests.
✨ 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/hermes-switchyard-integration

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

@github-code-quality

github-code-quality Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Code Coverage Overview

Languages: TypeScript

TypeScript / code-coverage/plugin

The overall coverage in commit d770c76 in the codex/hermes-switchy... branch remains at 96%, unchanged from commit 164a7be in the main branch.

TypeScript / code-coverage/cli

The overall coverage in commit d770c76 in the codex/hermes-switchy... branch remains at 82%, unchanged from commit 164a7be in the main branch.

Show a code coverage summary of the most impacted files.
File main 164a7be codex/hermes-switchy... d770c76 +/-
src/lib/onboard...der/snapshot.ts 83% 75% -8%
src/lib/policy/...ne-exclusion.ts 92% 87% -5%
src/lib/onboard...press-resume.ts 82% 78% -4%
src/lib/securit...ntial-filter.ts 95% 91% -4%
src/lib/state/o...d-checkpoint.ts 87% 90% +3%
src/lib/trace.ts 90% 94% +4%
src/lib/cua/run...ime-manifest.ts 84% 91% +7%
src/lib/messagi...annel-config.ts 92% 99% +7%
src/lib/state/registry/lock.ts 39% 48% +9%
src/lib/cua/bounded-file.ts 84% 94% +10%

Updated August 12, 2026 18:16 UTC

@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: 2

🧹 Nitpick comments (3)
test/e2e/fixtures/hermes-routing-topology.ts (2)

180-182: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Prefer an explicit return type over ReturnType<typeof trustedSandboxShellScript>.

The indirect type hides the public shape from readers of this fixture. Import and name the concrete type instead.

♻️ Proposed change
-export function buildHermesRoutingTopologyProbeScript(
-  procRoot = "/proc",
-): ReturnType<typeof trustedSandboxShellScript> {
+export function buildHermesRoutingTopologyProbeScript(procRoot = "/proc"): TrustedShellCommand {

Add the type import:

-import type { ShellProbeRunOptions } from "./shell-probe.ts";
+import type { ShellProbeRunOptions, TrustedShellCommand } from "./shell-probe.ts";
🤖 Prompt for 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.

In `@test/e2e/fixtures/hermes-routing-topology.ts` around lines 180 - 182, Update
buildHermesRoutingTopologyProbeScript to use the concrete trusted sandbox shell
script type as its explicit return type instead of ReturnType<typeof
trustedSandboxShellScript>. Import the named type and preserve the function’s
existing behavior.

266-285: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider writing the artifact before the topology assertions run downstream.

captureHermesRoutingTopology writes the artifact only after parseHermesRoutingTopology succeeds. If the probe emits malformed JSON, no routing-topology artifact is persisted, and the failure diagnosis loses the captured evidence. The execShell artifacts still hold raw stdout, so this is not a data loss defect. Persisting a raw-capture artifact on the parse-failure path would improve triage.

🤖 Prompt for 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.

In `@test/e2e/fixtures/hermes-routing-topology.ts` around lines 266 - 285, Update
captureHermesRoutingTopology so malformed probe output still persists a
raw-capture artifact before parseHermesRoutingTopology can fail. Keep the
existing parsed topology artifact for successful parsing, and use the existing
artifact-writing mechanism and artifactLabel(options.artifactName) naming
context for the failure-path capture.
test/e2e/support/hermes-routing-topology.test.ts (1)

136-148: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Reuse runTopologyProbe instead of repeating the spawn logic.

This test repeats the spawnSync invocation that runTopologyProbe already provides. Reuse of the helper keeps one spawn configuration and removes the duplicate.

♻️ Proposed change
-      const result = spawnSync("sh", ["-c", buildHermesRoutingTopologyProbeScript(procRoot)], {
-        encoding: "utf8",
-      });
-
-      expect(result.status, result.stderr).toBe(0);
-      expect(parseHermesRoutingTopology(result.stdout.trim())).toEqual({
+      const { topology } = runTopologyProbe(procRoot);
+
+      expect(topology).toEqual({
🤖 Prompt for 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.

In `@test/e2e/support/hermes-routing-topology.test.ts` around lines 136 - 148,
Update the test “detects both external sidecar shapes from process metadata only
(`#8889`)” to call the existing runTopologyProbe helper with the generated
procRoot/script instead of invoking spawnSync directly. Preserve the current
probe result assertions and inputs while removing the duplicated spawn
configuration.
🤖 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 `@test/e2e/live/hermes-e2e.test.ts`:
- Around line 747-750: Update the artifact name passed to
assertNoStandaloneRoutingSidecars in the restart path at this location so it
uniquely identifies this supervisor restart phase; also apply the matching
distinct name to the call in the other restart path near the corresponding
second occurrence. Preserve the declared semantic phase and progress-reporting
conventions while ensuring each topology capture is attributed to its relevant
restart phase.

In `@test/e2e/support/hermes-routing-topology.test.ts`:
- Around line 71-80: Bound both synchronous topology probes: in
test/e2e/support/hermes-routing-topology.test.ts lines 71-80, update
runTopologyProbe’s spawnSync options with a positive timeout shorter than the
first heartbeat and killSignal "SIGKILL"; at lines 144-146, replace the repeated
spawnSync call with runTopologyProbe so it reuses the bounded configuration.

---

Nitpick comments:
In `@test/e2e/fixtures/hermes-routing-topology.ts`:
- Around line 180-182: Update buildHermesRoutingTopologyProbeScript to use the
concrete trusted sandbox shell script type as its explicit return type instead
of ReturnType<typeof trustedSandboxShellScript>. Import the named type and
preserve the function’s existing behavior.
- Around line 266-285: Update captureHermesRoutingTopology so malformed probe
output still persists a raw-capture artifact before parseHermesRoutingTopology
can fail. Keep the existing parsed topology artifact for successful parsing, and
use the existing artifact-writing mechanism and
artifactLabel(options.artifactName) naming context for the failure-path capture.

In `@test/e2e/support/hermes-routing-topology.test.ts`:
- Around line 136-148: Update the test “detects both external sidecar shapes
from process metadata only (`#8889`)” to call the existing runTopologyProbe helper
with the generated procRoot/script instead of invoking spawnSync directly.
Preserve the current probe result assertions and inputs while removing the
duplicated spawn configuration.
🪄 Autofix

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: f264a3b9-bba0-4002-a738-6566c910b2cf

📥 Commits

Reviewing files that changed from the base of the PR and between ac6adac and ed2b09c.

📒 Files selected for processing (3)
  • test/e2e/fixtures/hermes-routing-topology.ts
  • test/e2e/live/hermes-e2e.test.ts
  • test/e2e/support/hermes-routing-topology.test.ts

Comment thread test/e2e/live/hermes-e2e.test.ts
Comment thread test/e2e/support/hermes-routing-topology.test.ts Outdated
@github-actions

github-actions Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

PR Review Advisor — No blocking findings reported

Advisor assessment: No blocking advisor findings reported
Next action: No advisor follow-up needed.
Findings: 0 blockers · 0 warnings · 0 suggestions

Model lanes

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

Advisory only. These are normalized differences from the primary terminology receipt.

  • sidecar at test/e2e/fixtures/hermes-routing-topology.ts:76: selected only by the second-opinion lane as conflict.
  • proc root at test/e2e/fixtures/hermes-routing-topology.ts:192: selected only by the second-opinion lane as established.
2 additional E2E selections from the second opinion

Advisory only. The primary lane did not select these E2E jobs or targets.

  • gateway-guard-recovery: The completed second-opinion lane identified E2E coverage that the primary lane omitted.
  • rebuild-hermes: The completed second-opinion lane identified E2E coverage that the primary lane omitted.

Second-opinion terminology and E2E selections are advisory. Live E2E does not run automatically for pull requests.

3 semantic terminology decisions

Terminology decisions are advisory. They affect the assessment only when a separate finding identifies concrete semantic impact.

  • define — routing topology at test/e2e/fixtures/hermes-routing-topology.ts:161: Retain the term and its schema fields together so topology artifacts identify the exact observed process set.
  • established — process metadata at test/e2e/support/hermes-routing-topology.test.ts:142: Retain this established term for the bounded /proc data that the probe reads.
  • justified — sidecar at test/e2e/fixtures/hermes-routing-topology.ts:251: Retain the routing context where the test distinguishes routing processes from non-process sidecars.

E2E guidance

Advisory only. A maintainer can dispatch the default E2E suite for the commit under review.

Recommended E2E: None

Manual-only E2E: cloud-inference, cloud-onboard, security-posture, hermes-e2e
The manual PR workflow does not run these selectors for the commit under review. Run them from reviewed code on main.

Workflow run details

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

Signed-off-by: Charan Jagwani <cjagwani@nvidia.com>
Signed-off-by: Charan Jagwani <cjagwani@nvidia.com>
@cjagwani cjagwani added the chore Build, CI, dependency, or tooling maintenance label Aug 12, 2026
@cjagwani
cjagwani requested a review from cv August 12, 2026 13:45
@cjagwani cjagwani added area: e2e End-to-end tests, nightly failures, or validation infrastructure integration: hermes Hermes integration behavior labels Aug 12, 2026
@cjagwani cjagwani self-assigned this Aug 12, 2026
@cjagwani
cjagwani requested a review from prekshivyas August 12, 2026 13:45
@cjagwani

Copy link
Copy Markdown
Collaborator Author

Security review — PASS

Reviewed the complete diff for the Hermes routing-topology E2E boundary against all nine repository security categories.

  • Secrets and credentials: PASS — the probe reads only /proc/*/cmdline and /proc/*/status, never environ; artifacts contain only PID/PPID/UID and sidecar counts.
  • Input validation and sanitization: PASS — the proc-root argument rejects empty/NUL input, is base64-encoded before entering the trusted shell command, and returned JSON is schema/type/count validated.
  • Authentication and authorization: PASS — no authentication or authorization contract changes.
  • Dependencies: PASS — no dependency or downloaded artifact changes.
  • Error handling and logging: PASS — nonzero execution, malformed JSON, inconsistent counts, and permission denial all fail; raw diagnostic output contains no command lines or credentials.
  • Cryptography and data protection: PASS — no cryptographic or protected-data flow changes.
  • Configuration and security controls: PASS — no runtime policy/default change; the probe is bounded to 30 seconds.
  • Security testing: PASS — focused tests cover shell-text false positives, sidecar detection, duplicate/mismatched evidence, malformed output, unsafe input, and exact permission-denial failure.
  • System security: PASS — live E2E checks the exact supervised Hermes PID and zero standalone Relay/Switchyard sidecars both before and after restart.

No security findings. This review establishes an E2E evidence baseline only; it does not claim final native routing support.

@cjagwani

Copy link
Copy Markdown
Collaborator Author

Maintainer waiver — optional Nemotron advisor lane

Accepted non-success check: PR review advisor (Nemotron 3 Ultra), attempt 2.

The lane failed twice because its model emitted analysis before completing a required internal tool result (pr_review_read_terminology). The trusted publisher completed successfully, the primary GPT-5.6 Terra lane completed at high confidence, and the combined assessment is merge_as_is with zero blocking findings.

I also inspected the two partial Nemotron findings rather than discarding them:

  • The topology capture before restart is unconditional.
  • The root-supervised post-restart capture is in if (rootSupervisorTopology).
  • The managed post-restart capture is in its mutually exclusive else branch.
  • Therefore every execution performs exactly two captures: one before restart and one after the applicable restart. The final expect(routingTopologyCaptures).toBe(2) is correct.

The partial blocker and warning incorrectly treated the mutually exclusive branches as if both or neither executed. No code change is warranted. Required CI, including the previously failed CLI shard 12, passed on rerun.

@cv cv left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Accepted scope is explicit in #7937 and #8889. The delta from the prior approved commit only merges current main's unrelated version-comparator change; the complete three-file PR diff remains correct. It records one supervised Hermes gateway and zero standalone Relay/Switchyard sidecars before and after either restart path. Strict parsing, exact PID binding, bounded execution, redacted artifacts, and failure-path tests limit regression and security risk. No current automated findings or competing PRs exist, and current main is fully merged.

@prekshivyas
prekshivyas merged commit 181b115 into main Aug 13, 2026
51 checks passed
@prekshivyas
prekshivyas deleted the codex/hermes-switchyard-integration branch August 13, 2026 02:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: e2e End-to-end tests, nightly failures, or validation infrastructure chore Build, CI, dependency, or tooling maintenance integration: hermes Hermes integration behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants