Skip to content

test(e2e): add gateway drift preflight guard for #3423 - #3463

Merged
cv merged 2 commits into
mainfrom
test/gateway-drift-preflight-e2e-guard
May 13, 2026
Merged

cv merged 2 commits into
mainfrom
test/gateway-drift-preflight-e2e-guard

Conversation

@jyaunches

@jyaunches jyaunches commented May 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds a failing-test-first regression guard for #3423 / #3399 in the dedicated regression-e2e.yaml holding pen.

The guard exercises the CLI boundary with fake openshell and docker shims so it catches the real failure mode that unit-level mocks can miss:

  1. openshell sandbox list exits non-zero with the [Ubuntu 24.04][Upgrade] v0.0.38 → v0.0.39 in-place upgrade breaks CLI ↔ cluster RPC with protobuf "invalid wire type" decode error #3399 protobuf invalid wire type decode error.
  2. A stale patched gateway image reports as nemoclaw-cluster:0.0.36-fuse-overlayfs-aa8b8487 while installed OpenShell is 0.0.37.

Expected red/green behavior

  • 🔴 On current main / unfixed code, gateway-drift-preflight-e2e fails because NemoClaw either treats the protobuf failure as a stopped sandbox or misses the patched-image drift.
  • 🟢 On fix(cli): fail closed on OpenShell gateway drift #3423 after the fix, the same job should pass by failing closed with schema-drift recovery guidance and by detecting patched stale gateway images before trusting sandbox state.

Regression workflow

This is not added to scheduled nightly. It lives in .github/workflows/regression-e2e.yaml and can be dispatched explicitly:

gh workflow run regression-e2e.yaml -f jobs=gateway-drift-preflight-e2e --ref <branch>

Verification

Related: #3423

Summary by CodeRabbit

  • Tests

    • Added an end-to-end regression that validates gateway-drift preflight behavior, ensuring schema mismatches and stale gateway images fail safely and report correct diagnostics.
  • Chores

    • Updated CI workflow to include and dispatch the new gateway-drift preflight regression job.

Review Change Stack

Adds a failing E2E test that demonstrates the gateway drift bug tracked by #3423.

Until the fix lands, the targeted regression gateway-drift-preflight-e2e dispatch will fail. This is intentional: the failing test is proof of coverage and the executable acceptance criterion for #3423.

Related: #3423
@github-actions

github-actions Bot commented May 13, 2026 •

Copy link
Copy Markdown
Contributor

E2E Advisor Recommendation

Required E2E: gateway-drift-preflight-e2e
Optional E2E: gateway-health-honest-e2e, dashboard-remote-bind-e2e

Dispatch hint: gateway-drift-preflight-e2e

Workflow run

Full advisor summary

Pi Semantic E2E Advisor

Base: origin/main
Head: HEAD
Confidence: high

Required E2E

  • gateway-drift-preflight-e2e: This PR introduces this exact regression job and its only test script. The job must be dispatched at least once to confirm the new script runs green in CI with the workflow's environment (Node 22, ubuntu-latest, NEMOCLAW_NON_INTERACTIVE=1) and that the selector wiring (gateway_drift_preflight output, jobs-input filtering) routes correctly. Nothing else exercises this script.

Optional E2E

  • gateway-health-honest-e2e: Sister regression job in the same workflow. The selector logic in select_regression_jobs was edited to add the new third branch; running the existing gateway job confirms the prior selector branches and jobs input parsing still behave correctly when the new entry is present.
  • dashboard-remote-bind-e2e: Other selector branch in the same workflow_dispatch matrix; useful smoke to confirm the refactored select_regression_jobs step still emits a correct dashboard output and the reusable workflow call still resolves after the YAML edit.

New E2E recommendations

  • sandbox-lifecycle/gateway-drift (medium): The new script stubs openshell/docker, but the real-world drift scenario it guards (production OpenShell image mismatching the embedded protobuf schema causing backup-all to misclassify running sandboxes as stopped) is not exercised against an actual gateway anywhere in the suite. A nightly counterpart that runs against a real stale gateway image alongside test-openshell-gateway-upgrade.sh would catch regressions that the shim-based test cannot.
    • Suggested test: nightly-e2e job gateway-drift-preflight-live-e2e that pins a deliberately stale ghcr.io/nvidia/openshell/cluster image, runs nemoclaw onboard + nemoclaw backup-all, and asserts fail-closed messaging plus non-zero exit (live counterpart to test/e2e/test-gateway-drift-preflight.sh).
  • sandbox-lifecycle/backup-all (low): backup-all is invoked by the new test but there is no general happy-path E2E for it visible in test/e2e (no test-backup-all.sh). Without a positive-path counterpart, the fail-closed assertions in this script could mask a regression where backup-all simply errors on every input.
    • Suggested test: test/e2e/test-backup-all-happy-path.sh exercising nemoclaw backup-all against a healthy fake gateway with at least one running and one stopped sandbox, asserting Backup complete and correct per-sandbox classification.

Dispatch hint

  • Workflow: regression-e2e.yaml
  • jobs input: gateway-drift-preflight-e2e

@coderabbitai

coderabbitai Bot commented May 13, 2026 •

Copy link
Copy Markdown
Contributor

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: 7e41df83-f76a-44ee-8d71-8a813e38bcef

📥 Commits

Reviewing files that changed from the base of the PR and between 1dd9105 and d2b6b5b.

📒 Files selected for processing (1)
  • test/e2e/test-gateway-drift-preflight.sh
🚧 Files skipped from review as they are similar to previous changes (1)
  • test/e2e/test-gateway-drift-preflight.sh

📝 Walkthrough

Walkthrough

Adds a new gateway-drift-preflight-e2e regression job to the regression-e2e workflow and a bash E2E test script that stubs openshell/docker, builds the CLI, and runs two scenarios validating protobuf mismatch and stale gateway image preflight failures.

Changes

Gateway Drift Preflight E2E Test

Layer / File(s) Summary
Workflow dispatch integration
\.github/workflows/regression-e2e.yaml
The workflow is extended to include the gateway-drift-preflight-e2e job in the valid dispatch list, adds a corresponding output flag, wires selection logic, and defines the job to run the test script with Node setup and repo checkout.
Test harness infrastructure
test/e2e/test-gateway-drift-preflight.sh
The test script establishes logging, workspace management, cleanup traps, environment initialization, deterministic registry generation, and fake openshell/docker binary implementations that intercept and respond to specific CLI subcommands. Test case orchestration and output assertion helpers are wired.
Test scenarios and execution
test/e2e/test-gateway-drift-preflight.sh
The CLI is built, then two regression scenarios run: (1) protobuf mismatch from sandbox list must fail closed without mutation guidance, and (2) stale gateway image must fail preflight before invoking sandbox list. A completion summary is printed on success.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • NVIDIA/NemoClaw#3429: Related test stub changes for openshell in test/e2e scripts and gateway-drift testing.
  • NVIDIA/NemoClaw#3411: Also modified regression-e2e.yaml job-selection outputs to add gateway-related regression jobs.

Suggested labels

enhancement: testing, E2E, CI/CD, v0.0.40

Suggested reviewers

  • ericksoa
  • cv

Poem

🐰 I hop through temp dirs, scripts in tow,
I fake docker calls and make outputs show,
Two preflight checks the gateway must pass,
Protobuf and image—errors caught fast,
A little rabbit cheers: tests green at last.

🚥 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
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically identifies the main change: adding a gateway drift preflight e2e test guard, and references the associated issue #3423. It directly reflects the primary objective of the pull request.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 test/gateway-drift-preflight-e2e-guard

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

@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

🤖 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/test-gateway-drift-preflight.sh`:
- Around line 186-190: The test currently treats a zero exit code from
backup-all as non-fatal by calling info; change the branch so a successful
(rc==0) exit fails the test instead: when checking the variable rc after running
backup-all, replace the info branch with a failing action (e.g. call the test
harness fail function or echo an error and exit 1) so that a 0 exit causes the
script to error; reference the existing rc variable and the pass/info helpers
around the backup-all invocation to locate where to swap info for fail/exit.
- Around line 208-210: The current check using grep -qx 'sandbox list' against
"$CASE_DIR/openshell-calls.log" is too strict and misses invocations that
include arguments; update the check in test/e2e/test-gateway-drift-preflight.sh
to use a regex-based grep that anchors "sandbox list" at line start but allows
trailing whitespace/arguments (e.g., use grep -qE with a pattern like '^sandbox
list' plus allowance for space/args) so any call to the sandbox list command
with parameters is caught, keeping the existing fail "sandbox list was called
despite preflight image drift" behavior.
🪄 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: d06da98f-d4e3-4adc-9709-c839576c2658

📥 Commits

Reviewing files that changed from the base of the PR and between 09e1793 and 1dd9105.

📒 Files selected for processing (2)
  • .github/workflows/regression-e2e.yaml
  • test/e2e/test-gateway-drift-preflight.sh

Comment on lines +186 to +190
if [ "$rc" -ne 0 ]; then
pass "backup-all exits non-zero on protobuf mismatch"
else
info "backup-all exited 0; checking that it did not silently treat the RPC failure as stopped"
fi

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.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Enforce non-zero exit in the protobuf mismatch case.

Line 189 currently logs info and continues when backup-all exits 0, which can let this guard pass on an unexpected success path.

Suggested fix
 if [ "$rc" -ne 0 ]; then
   pass "backup-all exits non-zero on protobuf mismatch"
 else
-  info "backup-all exited 0; checking that it did not silently treat the RPC failure as stopped"
+  fail "backup-all unexpectedly exited 0 on protobuf mismatch"
 fi
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if [ "$rc" -ne 0 ]; then
pass "backup-all exits non-zero on protobuf mismatch"
else
info "backup-all exited 0; checking that it did not silently treat the RPC failure as stopped"
fi
if [ "$rc" -ne 0 ]; then
pass "backup-all exits non-zero on protobuf mismatch"
else
fail "backup-all unexpectedly exited 0 on protobuf mismatch"
fi
🤖 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/test-gateway-drift-preflight.sh` around lines 186 - 190, The test
currently treats a zero exit code from backup-all as non-fatal by calling info;
change the branch so a successful (rc==0) exit fails the test instead: when
checking the variable rc after running backup-all, replace the info branch with
a failing action (e.g. call the test harness fail function or echo an error and
exit 1) so that a 0 exit causes the script to error; reference the existing rc
variable and the pass/info helpers around the backup-all invocation to locate
where to swap info for fail/exit.

Comment on lines +208 to +210
if grep -qx 'sandbox list' "$CASE_DIR/openshell-calls.log"; then
fail "sandbox list was called despite preflight image drift"
fi

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.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

sandbox list assertion is too narrow and can miss real calls.

Line 208 only matches the exact string sandbox list; calls with arguments won’t be detected.

Suggested fix
-if grep -qx 'sandbox list' "$CASE_DIR/openshell-calls.log"; then
+if grep -qE '^sandbox list($|[[:space:]])' "$CASE_DIR/openshell-calls.log"; then
   fail "sandbox list was called despite preflight image drift"
 fi
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if grep -qx 'sandbox list' "$CASE_DIR/openshell-calls.log"; then
fail "sandbox list was called despite preflight image drift"
fi
if grep -qE '^sandbox list($|[[:space:]])' "$CASE_DIR/openshell-calls.log"; then
fail "sandbox list was called despite preflight image drift"
fi
🤖 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/test-gateway-drift-preflight.sh` around lines 208 - 210, The current
check using grep -qx 'sandbox list' against "$CASE_DIR/openshell-calls.log" is
too strict and misses invocations that include arguments; update the check in
test/e2e/test-gateway-drift-preflight.sh to use a regex-based grep that anchors
"sandbox list" at line start but allows trailing whitespace/arguments (e.g., use
grep -qE with a pattern like '^sandbox list' plus allowance for space/args) so
any call to the sandbox list command with parameters is caught, keeping the
existing fail "sandbox list was called despite preflight image drift" behavior.

@cv
cv merged commit 3cb6c8e into main May 13, 2026
30 of 31 checks passed
jyaunches added a commit to yimoj/NemoClaw that referenced this pull request May 13, 2026
Recognize locally patched nemoclaw-cluster image tags when comparing the running OpenShell gateway image with the installed CLI version.

Also hardens the regression guard shims so the fake Docker command survives NemoClaw's subprocess environment filtering.

Related: NVIDIA#3423 NVIDIA#3463
@cv cv assigned jyaunches and prekshivyas and unassigned jyaunches May 14, 2026
@wscurran wscurran added area: cli Command line interface, flags, terminal UX, or output area: e2e End-to-end tests, nightly failures, or validation infrastructure bug-fix PR fixes a bug or regression and removed NemoClaw CLI labels Jun 3, 2026
@jyaunches
jyaunches deleted the test/gateway-drift-preflight-e2e-guard branch June 12, 2026 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: cli Command line interface, flags, terminal UX, or output area: e2e End-to-end tests, nightly failures, or validation infrastructure bug-fix PR fixes a bug or regression

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants