fix(onboard): classify a failed forward list as list-failed - #8529
Conversation
The cleanup helper inferred list failure only from a thrown exception, so the messaging adapter's null result was coerced to an empty string, parsed as an empty ownership map, and reclassified as no-entry. That ran the sandbox-scoped forward stop precisely when ownership could not be established. ForwardListRunner now returns string or null, and the helper treats null as list-failed before parsing, so the safety contract sits at the shared boundary instead of relying on each adapter to throw. The dashboard adapter's throw guard becomes a pass-through. The messaging capture seam also forces ignoreError so that a timed-out probe returns null. Without it the OpenShell adapter reports a spawn error and exits the process, so the classification is never reached. Signed-off-by: Tinson Lai <tinsonl@nvidia.com>
📝 WalkthroughWalkthroughThe change preserves ChangesForward cleanup failure handling
Estimated code review effort: 3 (Moderate) | ~20 minutes Suggested labels: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
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 `@src/lib/onboard/agent-fixed-forward.test.ts`:
- Around line 29-48: Update both tests in
src/lib/onboard/agent-fixed-forward.test.ts lines 29-48 to assert that
deps.runCaptureOpenshell receives ["forward", "list"] in each scenario. Also
update src/lib/onboard/forward-cleanup.test.ts lines 98-106 to assert that fetch
receives ["forward", "list"] before checking the fail-closed result; no other
behavioral assertions need changing.
In `@src/lib/onboard/forward-cleanup.ts`:
- Around line 67-72: Update the contract comment near the forward-cleanup runner
handling to allow adapters such as captureOpenShellOutput to use ignoreError:
true, provided ignored command failures are converted to null. Clarify that
runners must not convert failures into an empty string, so getOccupiedPorts
receives the preserved failure signal.
🪄 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: 8ae965a1-24f9-434f-83f8-6c69ab67e37e
📒 Files selected for processing (6)
src/lib/actions/sandbox/messaging-host-forward-lifecycle.tssrc/lib/onboard/agent-fixed-forward.test.tssrc/lib/onboard/agent-fixed-forward.tssrc/lib/onboard/dashboard-forward-control.tssrc/lib/onboard/forward-cleanup.test.tssrc/lib/onboard/forward-cleanup.ts
PR Review Advisor — InformationalAdvisor assessment: Informational / low confidence Model lanes
Second-opinion terminology and E2E selections are advisory. Live E2E does not run automatically for pull requests. E2E guidanceAdvisory only. A maintainer can dispatch the default E2E suite for the commit under review. Recommended E2E: None Manual-only E2E: This automated review informs maintainers. Warnings and suggestions do not require a response. A maintainer decides whether to merge. |
Signed-off-by: Tinson Lai <tinsonl@nvidia.com>
Signed-off-by: Tinson Lai <tinsonl@nvidia.com>
Signed-off-by: Tinson Lai <tinsonl@nvidia.com>
Signed-off-by: Tinson Lai <tinsonl@nvidia.com>
cv
left a comment
There was a problem hiding this comment.
Please cover the changed concrete messaging adapter before approval. Add a focused test through ensureMessagingHostForwardAfterRebuild that makes forward list fail, verifies the capture uses ignoreError: true, and verifies no forward stop runs. The shared helper and fixed-forward tests do not execute that adapter seam. Refresh onto the current main commit and rerun the required checks after adding the test.
Signed-off-by: Apurv Kumaria <akumaria@nvidia.com>
Signed-off-by: Apurv Kumaria <akumaria@nvidia.com>
|
Addressed the formal change request on branch revision
Validation after the main refresh:
Documentation writer review remains Security reviewVerdict: PASS. No security findings were found. The change improves the fail-closed cleanup boundary by preserving unknown ownership and retaining the sandbox-scoped stop form.
Fresh required checks are running for the refreshed branch. |
|
CI disposition after the branch refresh:
The concrete messaging-adapter regression requested in the formal review is present, both review threads are resolved, and the branch is now waiting only for independent re-review. |
The requested messaging adapter test was added. A current review records the remaining dashboard adapter coverage gap separately.
cv
left a comment
There was a problem hiding this comment.
The messaging adapter test is now present. One equivalent changed boundary remains uncovered: add a focused createSandboxForwardStopper test where runCaptureOpenshell returns null, assert list-failed, and verify no forward stop command runs.
Signed-off-by: Apurv Kumaria <akumaria@nvidia.com>
|
Addressed the dashboard-forward-stopper change request and completed a refreshed security review for branch revision
Security reviewVerdict: PASS. No remaining findings.
|
Signed-off-by: Apurv Kumaria <akumaria@nvidia.com>
Signed-off-by: Apurv Kumaria <akumaria@nvidia.com>
Signed-off-by: Apurv Kumaria <akumaria@nvidia.com>
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
|
Addressed the remaining change request and refreshed the branch onto current
Fresh CI is fully green for branch revision |
cv
left a comment
There was a problem hiding this comment.
Re-reviewed commit 38d56ae9c. The requested createSandboxForwardStopper regression is present. A null list result now produces list-failed and does not call forward stop. The shared forward-list type preserves null, and the added tests distinguish list failure from a successful empty list. I found no new correctness or security blocker.
I am not approving this commit because the required changes check is SKIPPED. CodeRabbit is also pending. Obtain a successful required-check result on this commit, then request approval.
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
Signed-off-by: Apurv Kumaria <akumaria@nvidia.com>
|
Security review: PASS for the current branch. Rechecked again after refreshing the branch with current Reviewed secrets and credentials, input validation, authorization and ownership, dependencies, logging, cryptography, configuration, tests, and failure modes. The forward-list boundary remains fail-closed: an unavailable ownership result stays distinct from a successful empty list, so cleanup does not stop a forward and start polling does not accept a live port when ownership is unknown. Raw credential handling, permissions, network policy, and destructive authority are unchanged. The PR-specific change documents the existing null-versus-empty contract. The latest main refresh changes disjoint files. No security findings remain. |
apurvvkumaria
left a comment
There was a problem hiding this comment.
Reviewed the completed forward-list failure classification and its adapter coverage. A failed list remains distinct from a successful empty result, and stop operations remain fail-closed. All current checks pass, no unresolved review threads remain, documentation and security receipts are current, and the previously requested tests are present. I approve the implementation.
|
Implementation review is complete. The requested adapter regressions are present, no review threads remain unresolved, the current CI suite passes, and a maintainer approval is recorded. GitHub still reports changes requested from the earlier review, so this PR is not merge-ready. I will not dismiss or reroute that review. Main has advanced; after the reviewer updates the outstanding review state, the branch needs a routine refresh and another required-check run. |
The latest PR commit tests a null forward-list result, returns list-failed, and proves that no stop command runs.
Signed-off-by: Apurv Kumaria <akumaria@nvidia.com>
Signed-off-by: Apurv Kumaria <akumaria@nvidia.com>
|
Post-merge CI and review classification: repository lifecycle/infrastructure; no PR code regression found.
The post-merge all-agent managed-runtime job is still running and remains under observation. |
Summary
bestEffortForwardStopForSandboxinferred a failedopenshell forward listonly from a thrown exception, so the messaging adapter'snullresult was coerced to an empty string, parsed as an empty ownership map, and reclassified asno-entry. Before this change a failed list ran the sandbox-scopedforward stopprecisely when ownership could not be established; after it, the helper returnslist-failedand skips the stop. The same failure signal is now preserved during forward-start polling, so the live-port compatibility fallback cannot succeed unless ownership enumeration actually succeeded.Related Issue
Fixes #8522
Changes
src/lib/onboard/forward-cleanup.ts:ForwardListRunnerreturnsstring | null, andbestEffortForwardStopForSandboxreturnslist-failedfornullbefore it reachesgetOccupiedPorts. The stale comment stating that runners must throw is rewritten to describe both failure signals.src/lib/onboard/agent-fixed-forward.ts: both the stop and start-polling adapters preservenullas a failed ownership probe instead of converting it to a successful empty result.src/lib/onboard/dashboard-forward-control.ts: the adapter-local throw onnullbecomes a pass-through. Classification now lives at the shared boundary, so a future adapter cannot reintroduce the defect by forgetting to throw.src/lib/onboard/dashboard-forward-control.test.ts(new): exercises the dashboard stopper when the ownership probe returnsnull, verifieslist-failed, and verifies that no stop command runs.src/lib/actions/sandbox/messaging-host-forward-lifecycle.ts:captureOpenShellOutputforcesignoreErrorso a timed-out probe returnsnull. Without it the OpenShell adapter treats theETIMEDOUTspawn error as fatal and exits the process, so the classification above is never reached. The existing caller already passedignoreError, so only the stop-adapter path changes.src/lib/actions/sandbox/messaging-host-forward-lifecycle.test.ts(new): exercises the concrete rebuild adapter when both forward-list probes fail, verifies that the captures ignore the command error, and verifies that no stop command runs.src/lib/onboard/agent-fixed-forward.test.ts(new) andsrc/lib/onboard/forward-cleanup.test.ts: cover the failed-list and genuinely-empty-list outcomes at both the helper and theensureAgentFixedForwardentry point, and assert that each case reaches theforward listprobe before its fail-closed result.src/lib/onboard/forward-start.ts,src/lib/onboard/dashboard.ts, andsrc/lib/onboard/forward-start.test.ts: preservenullthrough start polling, distinguish it from a genuine empty list, and prove that a live listener is not accepted when ownership enumeration failed.Type of Change
Quality Gates
Documentation Writer Review
no-docs-neededDGX Station Hardware Evidence
Verification
Signed-off-by:line and every commit appears asVerifiedin GitHubpre-commit,commit-msg, andpre-pushhooks passed, ornpm run validate:prpassed after refreshingorigin/mainwhen hooks were skipped or unavailablemainrefresh (5 files, 54 tests), as did the dashboard integration coverage (1 file, 16 tests).npm run typecheck:cli,npm run test:titles:check,npm run test:projects:check, source-shape, test-size, Biome, and diff checks passed.npm testfor broad runtime/test-harness changes;npm run checkfor repo-wide validation/coverage changes — command/result:npm run docsbuilds without warnings (doc changes only)Signed-off-by: Tinson Lai tinsonl@nvidia.com
Summary by CodeRabbit
Bug Fixes
Tests