Skip to content

perf(test): reduce subprocess isolation in rebuild and setup tests - #6279

Merged
cv merged 5 commits into
mainfrom
codex/perf-test-io-6245-batch-2
Jul 5, 2026
Merged

cv merged 5 commits into
mainfrom
codex/perf-test-io-6245-batch-2

Conversation

@cv

@cv cv commented Jul 4, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Reduce unnecessary process isolation across the rebuild credential/preflight, Hermes config generation, and policy-tier onboarding suites while retaining representative executable and adapter contracts. This removes 128 of 140 test-launched processes across the three areas (91%) and keeps product defaults unchanged.

Related Issue

Part of #6245

Changes

  • Move rebuild credential/preflight decision coverage into the direct rebuild-flow harness, retaining six CLI/process contracts plus the DCode liveness child.
  • Add an explicit, import-safe Hermes config generation seam and build legacy messaging plans in process, retaining executable and copied-script contracts.
  • Exercise policy-tier selection, prompt, env, and resolution seams directly while retaining adapter contracts for CLI rejection and registry persistence.
  • Thread the explicit Hermes generation environment through managed-tool matrix loading and verify direct/executable parity against an ambient decoy.
  • Reduce test-launched processes from 27 to 7 for rebuild preflight, 75 to 2 for Hermes config, and 38 to 3 for policy tiers.

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: internal test-harness and dependency-seam refactoring only; CLI output, config shape, and user-facing behavior are unchanged.
  • 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 local reviews covered rebuild mutation ordering and interactive wiring, Hermes generation and messaging semantics, policy-tier persistence, and process-wide state restoration; all required findings were addressed.
  • 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 commit appears as Verified in GitHub
  • Normal pre-commit, commit-msg, and pre-push hooks passed, or npm run check:diff passed when hooks were skipped or unavailable
  • Targeted behavior tests pass for the current change set, or tests are marked not applicable above — 228/228 passed in 19.97s across the eight changed and adjacent test surfaces; npm run typecheck:cli passed
  • Applicable broad gate passed — npm test for broad runtime/test-harness changes; npm run check for repo-wide validation/coverage changes — local npm test reached 13,096 passing tests; seven mode assertions inherited the host's 077 umask and passed 68/68 under 022, while one E2E source-shape failure is byte-identical on origin/main
  • 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)

Benchmark

  • Final six-surface run under strace: 43.58s for 182 tests.
  • Previous rebuild credential/preflight file alone under strace: 115.16s.
  • In the ordinary final run, rebuild credential/preflight completed in 9.44s, Hermes config in 0.39s, and policy tiers in 1.15s.

Signed-off-by: Carlos Villela cvillela@nvidia.com

Summary by CodeRabbit

  • New Features

    • Hermes configuration generation now uses the provided environment consistently, making generated outputs more predictable.
    • Sandbox rebuild confirmations can now be reused in more places, with support for custom prompt handling.
  • Bug Fixes

    • Improved rebuild preflight checks and warnings for active sessions, missing credentials, and unsupported multi-agent rebuilds.
    • Hardened rebuild flows so failures surface clearer messages and avoid unintended changes.

cv added 3 commits July 4, 2026 14:52
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
@cv cv self-assigned this Jul 4, 2026
@coderabbitai

coderabbitai Bot commented Jul 4, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Extracts Hermes config generation into a reusable generateHermesConfig module, threads an environment parameter through Hermes config-building functions, exports confirmSandboxRebuildIfNeeded with an injectable prompt, and substantially refactors/expands tests for rebuild flow, credential preflight, messaging plan generation, and policy tier onboarding.

Changes

Hermes Config Generation Extraction

Layer / File(s) Summary
New generateHermesConfig module, env-parameterized builders, and CLI wiring
agents/hermes/config/generate.ts, agents/hermes/config/hermes-config.ts, agents/hermes/config/hermes-env.ts, agents/hermes/config/managed-tool-gateway.ts, agents/hermes/generate-config.ts
New generateHermesConfig pipeline reads settings, builds config/env lines, finalizes toolsets, and writes files; buildHermesConfig, buildHermesEnvLines, and loadManagedToolGatewayMatrix gain optional env parameters; the CLI entrypoint now delegates to generateHermesConfig behind an isMainModule() guard.
Hermes config generation tests updated to in-process calls
test/generate-hermes-config.test.ts
Tests now build env in-process, call generateHermesConfig/applyMessagingBuildPhase directly, and use a new expectGenerationError helper instead of subprocess status/stderr checks across validation and messaging platform scenarios.

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

Sandbox Rebuild Flow: Confirmation Injection and Credential Preflight Testing

Layer / File(s) Summary
Exported confirmation with injectable prompt
src/lib/actions/sandbox/rebuild-preflight-confirmation.ts
confirmSandboxRebuildIfNeeded is exported and accepts an injectable prompt parameter (default askPrompt).
Confirmation and preflight guard tests
src/lib/actions/sandbox/rebuild-preflight-confirmation.test.ts
New tests cover confirmation input parsing, active-session warning ordering, skip behavior, multi-agent rejection, and fallback behavior of countActiveSandboxSessionsForRebuild.
Credential hydration harness support
test/helpers/rebuild-flow-test-harness.ts, test/helpers/rebuild-flow-test-support.ts
Adds hydrateCredentialEnvSpy and a hydrateCredentialEnv override to the rebuild flow test harness types.
Credential preflight scenario suite
test/helpers/rebuild-flow-credential-preflight-cases.ts, src/lib/actions/sandbox/rebuild-flow.test.ts
Registers a large scenario suite covering gateway provider registration, credential hydration, messaging plan carryover, and OAuth/nvidia provider reuse.
Multi-agent lifecycle and base-image preflight tests
test/helpers/rebuild-flow-lifecycle-cases.ts, src/lib/actions/sandbox/rebuild-agent-base-image-preflight.test.ts
Adds a lifecycle test rejecting multi-agent rebuilds pre-backup and a base-image preflight test asserting rethrow/logging on build failure.
Process-contract test rewrite
test/rebuild-credential-preflight.test.ts
Narrows the suite to atomic process-contract cases with a rewritten fixture (sandboxes.json, onboard-session.json, fake openshell/docker/ssh scripts) and simplified harness.

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

Messaging Plan Helper and Policy Tier Onboarding Test Refactors

Layer / File(s) Summary
In-process legacy messaging plan builder
test/messaging-plan-test-helper.ts
Adds withLegacyMessagingPlanEnvDirect and withProcessEnv helpers to build messaging plans in-process instead of via child process.
Policy tier onboarding adapter test harness
test/policy-tiers-onboard.test.ts
Introduces createPromptHarness, createSetupHarness, and runAdapterScript replacing onboard.js subprocess stubbing.
Policy tier selection and setup scenario tests
test/policy-tiers-onboard.test.ts
Rewrites tier resolution, setup, and selectTierPresetsAndAccess tests to use the adapter harness directly.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant CLI as generate-config.ts
  participant Gen as generateHermesConfig
  participant Config as hermes-config.ts / hermes-env.ts
  participant Matrix as managed-tool-gateway.ts
  participant FS as Config Files

  CLI->>Gen: generateHermesConfig({env, scriptDir})
  Gen->>Gen: read build settings from env
  Gen->>Config: buildHermesConfig(settings, env)
  Config->>Matrix: loadManagedToolGatewayMatrix(env)
  Matrix-->>Config: matrix data
  Gen->>Config: buildHermesEnvLines(settings, env)
  Config->>Matrix: loadManagedToolGatewayMatrix(env)
  Gen->>Gen: finalize platform toolsets
  Gen->>FS: write config files
  Gen-->>CLI: {settings, config, envLines, written}
Loading

Suggested labels: refactor, area: sandbox

Suggested reviewers: jyaunches, ericksoa, 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 matches the main refactor: reducing subprocess isolation in test suites.
✨ 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/perf-test-io-6245-batch-2

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

@github-code-quality

github-code-quality Bot commented Jul 4, 2026 •

Copy link
Copy Markdown
Contributor

Code Coverage Overview

Languages: TypeScript

TypeScript / code-coverage/plugin

The overall coverage in the codex/perf-test-io-6... branch is 96%. Coverage data for the main branch is not yet available.

Show a code coverage summary of the most covered files.
File main codex/perf-test-io-6... cf52277 +/-
nemoclaw/src/se...cret-scanner.ts — 100% —
nemoclaw/src/commands/slash.ts — 100% —
nemoclaw/src/li...bprocess-env.ts — 100% —
nemoclaw/src/bl...eprint/state.ts — 98% —
nemoclaw/src/onboard/config.ts — 98% —
nemoclaw/src/bl...int/snapshot.ts — 97% —
nemoclaw/src/bl...print/runner.ts — 95% —
nemoclaw/src/co...ration-state.ts — 94% —
nemoclaw/src/bl...ate-networks.ts — 94% —
nemoclaw/src/index.ts — 94% —

TypeScript / code-coverage/cli

The overall coverage in the codex/perf-test-io-6... branch is 71%. Coverage data for the main branch is not yet available.

Show a code coverage summary of the most covered files.
File main codex/perf-test-io-6... cf52277 +/-
src/lib/shields...nsition-lock.ts — 87% —
src/lib/actions...all/run-plan.ts — 81% —
src/lib/state/o...oard-session.ts — 81% —
src/lib/onboard/preflight.ts — 71% —
src/lib/state/sandbox.ts — 71% —
src/lib/shields/index.ts — 69% —
src/lib/onboard...er-gpu-patch.ts — 69% —
src/lib/policy/index.ts — 66% —
src/lib/actions...licy-channel.ts — 60% —
src/lib/onboard.ts — 24% —

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

@github-actions

github-actions Bot commented Jul 4, 2026 •

Copy link
Copy Markdown
Contributor

PR Review Advisor (Nemotron Ultra) — Informational

Merge posture: Informational / low confidence
Primary next action: Resolve or justify PRA-1: PR review advisor unavailable.
Open items: 0 required · 1 warning · 0 suggestions · 1 test follow-up
Top item: PR review advisor unavailable

Action checklist

  • PRA-1 Resolve or justify: PR review advisor unavailable
  • PRA-T1 Add or justify test follow-up: Runtime validation

Findings index

ID Severity Category Location Required action
PRA-1 Resolve/justify correctness — Re-run the PR Review Advisor or perform a manual review.
Review findings by urgency: 0 required fixes, 1 item to resolve/justify, 0 in-scope improvements

⚠️ Resolve or justify before merge

Investigate these in the current review; either fix them, explain why they are not applicable, or document the accepted risk.

PRA-1 Resolve/justify — PR review advisor unavailable

  • Location: not file-specific
  • Category: correctness
  • Problem: The automated advisor could not complete: Could not parse JSON from PR review advisor output; see /home/runner/work/NemoClaw/NemoClaw/artifacts/pr-review-advisor-nemotron-ultra/pr-review-advisor-retry-raw-output.txt
  • Impact: Automated review evidence is incomplete, so human review must cover the changed code manually.
  • Recommended action: Re-run the PR Review Advisor or perform a manual review.
  • Expected follow-up: Resolve in this PR or explain why the risk is acceptable.
  • Verification: Inspect the workflow logs and raw advisor artifact for the execution failure.
  • Missing regression test: No regression test recommendation is available because the advisor did not complete.
  • Done when: The risk is fixed or explicitly justified in the PR. Verification: Inspect the workflow logs and raw advisor artifact for the execution failure.
  • Evidence: Could not parse JSON from PR review advisor output; see /home/runner/work/NemoClaw/NemoClaw/artifacts/pr-review-advisor-nemotron-ultra/pr-review-advisor-retry-raw-output.txt

💡 In-scope improvements

These are lower-risk, not throwaway. Prefer fixing them in this PR when they are local to changed code; defer only with rationale or a linked follow-up.

  • None.
Test follow-ups to resolve or justify

If these cover changed behavior, prefer adding them in this PR; otherwise state why existing coverage is enough or link the follow-up.

  • PRA-T1 Runtime validation — Add or identify targeted runtime/integration validation for the changed behavior; do not report external E2E job pass/fail here.. Runtime/sandbox/infrastructure paths need behavioral runtime validation: agents/hermes/config/generate.ts, agents/hermes/config/hermes-config.ts, agents/hermes/config/hermes-env.ts, agents/hermes/config/managed-tool-gateway.ts, agents/hermes/generate-config.ts, src/lib/actions/sandbox/rebuild-preflight-confirmation.ts.

Workflow run details

This is an automated, non-binding review; it still expects maintainers and agents to respond to each required or warning item. Treat suggestions as current-PR improvements when they touch changed code; defer only with maintainer rationale or a linked follow-up. A human maintainer must make the final merge decision.

@github-actions

github-actions Bot commented Jul 4, 2026 •

Copy link
Copy Markdown
Contributor

E2E Advisor Recommendation

Required E2E: hermes-e2e, rebuild-hermes, sandbox-rebuild
Optional E2E: hermes-discord, rebuild-hermes-stale-base

Dispatch hint: hermes-e2e,rebuild-hermes,sandbox-rebuild

Workflow run

Full advisor summary

E2E Recommendation Advisor

Base: origin/main
Head: HEAD
Confidence: high

Required E2E

  • hermes-e2e (high): Required because Hermes config generation and immutable runtime config are changed. This job exercises real install/onboard, Hermes sandbox startup, config presence, gateway behavior, inference.local, and hosted inference through a real assistant flow.
  • rebuild-hermes (high): Required because the PR affects both Hermes generated config and sandbox rebuild preflights. This job preserves the real install.sh, Docker/OpenShell, Hermes base-image rebuild, registry/session, messaging-placeholder, backup hygiene, and nemoclaw <name> rebuild --yes boundaries.
  • sandbox-rebuild (high): Required because rebuild confirmation/preflight and lifecycle behavior changed. This job runs a real OpenClaw sandbox rebuild and verifies state preservation, registry refresh, and backup credential hygiene across the destructive rebuild boundary.

Optional E2E

  • hermes-discord (high): Useful adjacent coverage for the Hermes config/env refactor because it validates Hermes messaging schema, provider placeholders, credential isolation, native gateway rewrite, and rebuild-related messaging contracts with a real sandbox.
  • rebuild-hermes-stale-base (high): Useful if maintainers want extra confidence around the touched Hermes base-image preflight/rebuild tests; it specifically preserves the stale cached Hermes base-image regression boundary.

New E2E recommendations

  • Sandbox rebuild active-session confirmation (medium): Existing live rebuild jobs run non-interactively with --yes and do not appear to validate active SSH session warning/cancel behavior before destructive rebuild work. This PR changes that prompt path.
    • Suggested test: Add a live rebuild preflight/cancellation E2E that creates or simulates an active OpenShell session, runs rebuild without --yes, verifies the active-session warning, cancels, and asserts no backup/delete/onboard occurred.
  • Hermes managed-tool gateway config (medium): Managed-tool gateway matrix/config/env behavior is covered by unit tests, but there is no obvious dedicated live E2E that onboards Hermes with managed tool gateway presets and verifies the generated runtime config/env inside the sandbox.
    • Suggested test: Add a Hermes managed-tool-gateway live E2E that enables representative presets, starts a real Hermes sandbox, and asserts gateway-backed tool config, resolver-safe env entries, and relevant toolset exposure inside the sandbox.

Dispatch hint

  • Workflow: .github/workflows/e2e.yaml
  • jobs input: hermes-e2e,rebuild-hermes,sandbox-rebuild

@github-actions

github-actions Bot commented Jul 4, 2026 •

Copy link
Copy Markdown
Contributor

E2E Target Recommendation

Required E2E targets: rebuild-hermes
Optional E2E targets: rebuild-openclaw

Dispatch required E2E targets:

  • gh workflow run e2e.yaml --ref <pr-head-ref> --field jobs=rebuild-hermes

Workflow run

Full E2E target advisor summary

E2E Target Advisor

Base: origin/main
Head: HEAD
Confidence: high

Required E2E targets

  • rebuild-hermes: Hermes config generation and managed-tool gateway matrix loading changed, and the PR also touches sandbox rebuild preflight confirmation. The rebuild-hermes free-standing E2E job exercises real Hermes install/config generation, persisted session metadata, messaging placeholder preservation, and nemoclaw rebuild --yes through the canonical e2e.yaml dispatch path.
    • Dispatch: gh workflow run e2e.yaml --ref <pr-head-ref> --field jobs=rebuild-hermes

Optional E2E targets

  • rebuild-openclaw: The rebuild preflight confirmation helper is agent-neutral; rebuild-openclaw provides adjacent non-Hermes rebuild coverage if maintainers want broader validation.
    • Dispatch: gh workflow run e2e.yaml --ref <pr-head-ref> --field jobs=rebuild-openclaw

Relevant changed files

  • agents/hermes/config/generate.ts
  • agents/hermes/config/hermes-config.ts
  • agents/hermes/config/hermes-env.ts
  • agents/hermes/config/managed-tool-gateway.ts
  • agents/hermes/generate-config.ts
  • src/lib/actions/sandbox/rebuild-preflight-confirmation.ts

@github-actions

github-actions Bot commented Jul 4, 2026 •

Copy link
Copy Markdown
Contributor

PR Review Advisor — No blocking findings

Merge posture: No blocking advisor findings
Primary next action: Add or justify PRA-T1 and any related test follow-ups.
Open items: 0 required · 0 warnings · 0 suggestions · 2 test follow-ups
Since last review: 3 prior items resolved · 0 still apply · 0 new items found

Action checklist

  • PRA-T1 Add or justify test follow-up: Runtime validation
  • PRA-T2 Add or justify test follow-up: Acceptance clause
Test follow-ups to resolve or justify

If these cover changed behavior, prefer adding them in this PR; otherwise state why existing coverage is enough or link the follow-up.

  • PRA-T1 Runtime validation — Add or identify a focused Hermes config test where process.env.HOME starts as a decoy but generateConfigWithMessaging receives HOME=tmpDir and verifies messaging-rendered Hermes files are written only under tmpDir.. Changed source files touch runtime/sandbox/infrastructure seams, and the current diff includes targeted direct, executable, and process-boundary coverage for the previously identified concrete risks. One additional runtime-style assertion would improve confidence around process-wide HOME handling in the in-process Hermes messaging generation path, but no blocking test gap was found.
  • PRA-T2 Acceptance clause — Part of perf(test): reduce test I/O to restore 2–5 minute full-suite runs #6245 — add test evidence or identify existing coverage. The deterministic validation context included the PR body reference but returned linkedIssues: []; no literal perf(test): reduce test I/O to restore 2–5 minute full-suite runs #6245 issue body or issue comments were available to extract acceptance clauses from. Current diff/test evidence covers the PR-local claims around Hermes config generation seams, rebuild preflight coverage, and policy-tier test refactoring, but issue-level acceptance cannot be verified from the provided context.

Workflow run details

This is an automated, non-binding review; it still expects maintainers and agents to respond to each required or warning item. Treat suggestions as current-PR improvements when they touch changed code; defer only with maintainer rationale or a linked follow-up. A human maintainer must make the final merge decision.

@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.

🧹 Nitpick comments (2)
test/helpers/rebuild-flow-test-harness.ts (1)

141-158: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Extract a shared hydrateCredentialEnv spy factory The two hydrateCredentialEnv spies share the same wrapper logic; factor it once so the implementations stay aligned.

🤖 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/helpers/rebuild-flow-test-harness.ts` around lines 141 - 158, The two
hydrateCredentialEnv spies in rebuild-flow-test-harness.ts duplicate the same
wrapper logic, so extract that shared implementation into a single helper or spy
factory and use it for both the onboardMod and onboardCredentialEnv spies. Keep
the existing override behavior and defaultHydrateCredentialEnv fallback intact,
but centralize the mockImplementation body so hydrateCredentialEnv stays aligned
in one place.
agents/hermes/generate-config.ts (1)

20-28: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Verify CLI error UX after removing explicit error handling.

main() invokes generateHermesConfig with no try/catch. Any thrown validation error (e.g., the various "fails fast"/"fails closed" cases now tested in-process) will surface as Node's default uncaught-exception output (full stack trace, exit code 1) instead of a curated one-line message, if the prior implementation had such handling. The PR states CLI output is unchanged — worth confirming that stderr formatting for failure cases still matches expectations for real subprocess invocations.

Regardless, wrapping the entrypoint in a try/catch is generally good practice for a CLI script to keep stderr clean.

♻️ Optional: cleaner CLI error output
 export function main(): void {
-  generateHermesConfig({ env: process.env, scriptDir: import.meta.dirname });
+  try {
+    generateHermesConfig({ env: process.env, scriptDir: import.meta.dirname });
+  } catch (error) {
+    console.error(`[config] ${error instanceof Error ? error.message : String(error)}`);
+    process.exitCode = 1;
+  }
 }
🤖 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 `@agents/hermes/generate-config.ts` around lines 20 - 28, The CLI entrypoint in
generate-config.ts now calls generateHermesConfig from main() without any error
handling, so thrown validation failures will fall back to Node’s default
uncaught-exception output. Update the main/isMainModule entrypath to catch
errors around generateHermesConfig, print the intended concise stderr message,
and exit with code 1 so subprocess behavior stays consistent with the expected
CLI UX.
🤖 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.

Nitpick comments:
In `@agents/hermes/generate-config.ts`:
- Around line 20-28: The CLI entrypoint in generate-config.ts now calls
generateHermesConfig from main() without any error handling, so thrown
validation failures will fall back to Node’s default uncaught-exception output.
Update the main/isMainModule entrypath to catch errors around
generateHermesConfig, print the intended concise stderr message, and exit with
code 1 so subprocess behavior stays consistent with the expected CLI UX.

In `@test/helpers/rebuild-flow-test-harness.ts`:
- Around line 141-158: The two hydrateCredentialEnv spies in
rebuild-flow-test-harness.ts duplicate the same wrapper logic, so extract that
shared implementation into a single helper or spy factory and use it for both
the onboardMod and onboardCredentialEnv spies. Keep the existing override
behavior and defaultHydrateCredentialEnv fallback intact, but centralize the
mockImplementation body so hydrateCredentialEnv stays aligned in one place.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 9d0dc180-7155-4be6-a99d-7541c59956ec

📥 Commits

Reviewing files that changed from the base of the PR and between 002ac62 and d536a4b.

📒 Files selected for processing (14)
  • agents/hermes/config/generate.ts
  • agents/hermes/generate-config.ts
  • src/lib/actions/sandbox/rebuild-flow-helpers.test.ts
  • src/lib/actions/sandbox/rebuild-flow.test.ts
  • src/lib/actions/sandbox/rebuild-preflight-confirmation.test.ts
  • src/lib/actions/sandbox/rebuild-preflight-confirmation.ts
  • test/generate-hermes-config.test.ts
  • test/helpers/rebuild-flow-credential-preflight-cases.ts
  • test/helpers/rebuild-flow-lifecycle-cases.ts
  • test/helpers/rebuild-flow-test-harness.ts
  • test/helpers/rebuild-flow-test-support.ts
  • test/messaging-plan-test-helper.ts
  • test/policy-tiers-onboard.test.ts
  • test/rebuild-credential-preflight.test.ts

cv added 2 commits July 4, 2026 15:08
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
@github-actions

github-actions Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

E2E Target Results — ✅ All requested jobs passed

Run: 28721215887
Workflow ref: codex/perf-test-io-6245-batch-2
Requested targets: (default — all supported)
Requested jobs: hermes-e2e,rebuild-hermes,sandbox-rebuild
Summary: 3 passed, 0 failed, 0 cancelled, 0 skipped

Job Result
hermes-e2e ✅ success
rebuild-hermes ✅ success
sandbox-rebuild ✅ success

@cv
cv merged commit 7044a03 into main Jul 5, 2026
125 of 126 checks passed
@cv
cv deleted the codex/perf-test-io-6245-batch-2 branch July 5, 2026 00:14
@cv cv added the v0.0.75 label Jul 5, 2026
Hadar301 pushed a commit to Hadar301/NemoClaw-OpenShift that referenced this pull request Jul 12, 2026
…VIDIA#6279)

<!-- markdownlint-disable MD041 -->
## Summary

Reduce unnecessary process isolation across the rebuild
credential/preflight, Hermes config generation, and policy-tier
onboarding suites while retaining representative executable and adapter
contracts. This removes 128 of 140 test-launched processes across the
three areas (91%) and keeps product defaults unchanged.

## Related Issue

Part of NVIDIA#6245

## Changes

- Move rebuild credential/preflight decision coverage into the direct
rebuild-flow harness, retaining six CLI/process contracts plus the DCode
liveness child.
- Add an explicit, import-safe Hermes config generation seam and build
legacy messaging plans in process, retaining executable and
copied-script contracts.
- Exercise policy-tier selection, prompt, env, and resolution seams
directly while retaining adapter contracts for CLI rejection and
registry persistence.
- Thread the explicit Hermes generation environment through managed-tool
matrix loading and verify direct/executable parity against an ambient
decoy.
- Reduce test-launched processes from 27 to 7 for rebuild preflight, 75
to 2 for Hermes config, and 38 to 3 for policy tiers.

## Type of Change

- [x] 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

- [x] Tests added or updated for changed behavior
- [ ] Existing tests cover changed behavior — justification:
- [ ] Tests not applicable — justification:
- [ ] Docs updated for user-facing behavior changes
- [x] Docs not applicable — justification: internal test-harness and
dependency-seam refactoring only; CLI output, config shape, and
user-facing behavior are unchanged.
- [x] Sensitive paths changed (security, policy, credentials, preflight,
onboarding, inference, runner, sandbox, or messaging)
- [x] Sensitive-path review completed or maintainer-approved waiver
recorded — reviewer/approval link/justification: independent local
reviews covered rebuild mutation ordering and interactive wiring, Hermes
generation and messaging semantics, policy-tier persistence, and
process-wide state restoration; all required findings were addressed.
- [ ] Non-success, skipped, or missing CI check accepted by maintainer —
check name, approval link, and follow-up issue:

## Verification

- [x] PR description includes the DCO sign-off declaration 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 — 228/228 passed in 19.97s across the
eight changed and adjacent test surfaces; `npm run typecheck:cli` passed
- [ ] Applicable broad gate passed — `npm test` for broad
runtime/test-harness changes; `npm run check` for repo-wide
validation/coverage changes — local `npm test` reached 13,096 passing
tests; seven mode assertions inherited the host's `077` umask and passed
68/68 under `022`, while one E2E source-shape failure is byte-identical
on `origin/main`
- [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)
- [ ] Doc pages follow the [style
guide](https://github.com/NVIDIA/NemoClaw/blob/main/docs/CONTRIBUTING.md)
(doc changes only)
- [ ] New doc pages include SPDX header and frontmatter (new pages only)

## Benchmark

- Final six-surface run under `strace`: 43.58s for 182 tests.
- Previous rebuild credential/preflight file alone under `strace`:
115.16s.
- In the ordinary final run, rebuild credential/preflight completed in
9.44s, Hermes config in 0.39s, and policy tiers in 1.15s.

---
Signed-off-by: Carlos Villela <cvillela@nvidia.com>

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

* **New Features**
* Hermes configuration generation now uses the provided environment
consistently, making generated outputs more predictable.
* Sandbox rebuild confirmations can now be reused in more places, with
support for custom prompt handling.

* **Bug Fixes**
* Improved rebuild preflight checks and warnings for active sessions,
missing credentials, and unsupported multi-agent rebuilds.
* Hardened rebuild flows so failures surface clearer messages and avoid
unintended changes.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Carlos Villela <cvillela@nvidia.com>
@wscurran wscurran added area: ci CI workflows, checks, release automation, or GitHub Actions area: e2e End-to-end tests, nightly failures, or validation infrastructure chore Build, CI, dependency, or tooling maintenance integration: hermes Hermes integration behavior labels Aug 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: ci CI workflows, checks, release automation, or GitHub Actions 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