Skip to content

fix(onboard): convert stdout Buffer to string in gateway container probe - #2053

Merged
ericksoa merged 1 commit into
NVIDIA:mainfrom
TruongNguyenG:fix/gateway-container-probe-buffer
Apr 18, 2026
Merged

ericksoa merged 1 commit into
NVIDIA:mainfrom
TruongNguyenG:fix/gateway-container-probe-buffer

Conversation

@TruongNguyenG

@TruongNguyenG TruongNguyenG commented Apr 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

One-line fix — verifyGatewayContainerRunning() crashes with TypeError on second sandbox onboard because result.stdout is a Buffer, not a string.

Related Issue

Regression from PR #2032.
Detailed issue at 2054

Changes

  • Wrap result.stdout with String() before calling .trim() in verifyGatewayContainerRunning()

Type of Change

  • Code change (feature, bug fix, or refactor)

Verification

  • npx prek run --all-files passes
  • npm test passes

AI Disclosure

  • AI-assisted — tool: Cursor

Signed-off-by: Truong Nguyen [email protected]

Summary by CodeRabbit

  • Bug Fixes
    • Improved reliability of gateway container status verification by enhancing string type handling during status checks.

verifyGatewayContainerRunning() calls result.stdout.trim() but the run()
helper returns stdout as a Buffer. On second onboard (gateway already
running), this crashes with TypeError: .trim is not a function.

Wrap with String() to ensure trim() works on both Buffer and string.

Signed-off-by: Truong Nguyen <[email protected]>
Made-with: Cursor
@coderabbitai

coderabbitai Bot commented Apr 18, 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: Pro Plus

Run ID: 23f5d54e-a941-4684-a9b8-d187ad35c983

📥 Commits

Reviewing files that changed from the base of the PR and between 1a8ea87 and a07c1c2.

📒 Files selected for processing (1)
  • src/lib/onboard.ts

📝 Walkthrough

Walkthrough

A type coercion fix in the verifyGatewayContainerRunning() function ensures result.stdout is converted to a string before being trimmed and compared. The control flow and return values remain unchanged.

Changes

Cohort / File(s) Summary
Type Safety Fix
src/lib/onboard.ts
Modified verifyGatewayContainerRunning() to coerce result.stdout to a string using String(result.stdout || "") before trimming and comparison, preventing potential type errors.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

🐰 A string so shy, hiding in the dark,
Now wrapped in String() with a safety spark!
No more trim mishaps, no undefined fright,
Our gateway runs true, everything's right! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main fix: converting a stdout Buffer to string in the gateway container probe function.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@TruongNguyenG TruongNguyenG added Getting Started VRDC Issues and PRs submitted by NVIDIA VRDC test team. labels Apr 18, 2026
@TruongNguyenG
TruongNguyenG marked this pull request as ready for review April 18, 2026 10:29

@ericksoa ericksoa left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Correct, minimal fix. spawnSync with stdio: "pipe" returns stdout as a Buffer — the original (result.stdout || "").trim() from #2032 doesn't coerce it to a string, so the === "true" comparison fails on second sandbox onboard. String() is the right fix.

Non-blocking thought for a follow-up: there may be other run() callsites in onboard.ts with the same implicit Buffer-as-string assumption. Could be worth auditing, or adding encoding: "utf8" to spawnSync in run() so it returns strings globally.

@ericksoa
ericksoa merged commit f9b18c1 into NVIDIA:main Apr 18, 2026
19 checks passed
@ericksoa ericksoa mentioned this pull request Apr 18, 2026
2 tasks done
@wscurran wscurran added area: install Install, setup, prerequisites, or uninstall flow area: onboarding Onboarding FSM, provider setup, sandbox launch, or first-run flow bug-fix PR fixes a bug or regression and removed Getting Started labels Jun 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: install Install, setup, prerequisites, or uninstall flow area: onboarding Onboarding FSM, provider setup, sandbox launch, or first-run flow bug-fix PR fixes a bug or regression VRDC Issues and PRs submitted by NVIDIA VRDC test team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants