fix(onboard): classify a failed forward list as list-failed - #8529
fix(onboard): classify a failed forward list as list-failed#8529laitingsheng wants to merge 12 commits into
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 Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Comment |
Code Coverage OverviewLanguages: TypeScript TypeScript / code-coverage/pluginThe overall coverage in commit 38d56ae in the TypeScript / code-coverage/cliThe overall coverage in commit 38d56ae in the Show a code coverage summary of the most impacted files.
Updated |
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 — No blocking findings reportedAdvisor assessment: No blocking advisor findings reported Model lanes
2 additional E2E selections from the second opinionAdvisory only. The primary lane did not select these E2E jobs or targets.
Second-opinion terminology and E2E selections are advisory. Live E2E does not run automatically for pull requests. 3 semantic terminology decisionsTerminology decisions are advisory. They affect the assessment only when a separate finding identifies concrete semantic impact.
E2E guidanceAdvisory only. A maintainer can dispatch the default E2E suite against this exact revision. Recommended E2E: 1 optional E2E recommendation
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 |
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