refactor(onboard): extract docker gateway runtime helpers - #5125
Conversation
|
Warning Review limit reached
More reviews will be available in 10 minutes and 7 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (3)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
E2E Advisor RecommendationRequired E2E: Full advisor summaryE2E Recommendation AdvisorBase: Required E2E
Optional E2E
New E2E recommendations
|
E2E Scenario Advisor RecommendationRequired scenario E2E: Dispatch required scenario E2E:
Full scenario advisor summaryE2E Scenario AdvisorBase: Required scenario E2E
Optional scenario E2E
Relevant changed files
|
PR Review AdvisorFindings: 0 needs attention, 1 worth checking, 0 nice ideas Review findings🛠️ Needs attention
🔎 Worth checking
🌱 Nice ideas
Consider writing more tests for
Since last review detailsCurrent findings:
This is an automated advisory review. A human maintainer must make the final merge decision. |
Selective E2E Results — ❌ Some jobs failedRun: 27265179682
|
Selective E2E Results — ✅ All requested jobs passedRun: 27265179682
|
|
✨ |
## Summary Extracts createSandbox dashboard port and CHAT_UI_URL resolution into the dashboard-port helper so the precedence chain can be reviewed and tested outside the full onboarding flow. This draft PR is stacked on #5125 and keeps Hermes dashboard forwarding orchestration in onboard.ts for a later slice. ## Related Issue Refs #3802 ## Changes - Added resolveCreateSandboxDashboardPort to centralize --control-ui-port, CHAT_UI_URL, registry, agent, and default port precedence. - Replaced the inline createSandbox dashboard port/URL block with the helper while preserving the existing effectivePort and chatUiUrl flow. - Added focused coverage for precedence, warning emission, schemeless CHAT_UI_URL normalization, remote host URL rewriting, and malformed CHAT_UI_URL behavior. ## 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) ## Verification Targeted checks run: - npx @biomejs/biome lint src/lib/onboard.ts src/lib/onboard/dashboard-port.ts src/lib/onboard/dashboard-port.test.ts - npm run typecheck:cli - npm run build:cli - git diff --check - npx vitest run src/lib/onboard/dashboard-port.test.ts test/onboard.test.ts test/onboard-custom-dockerfile.test.ts test/shellquote-sandbox.test.ts Required live validation: - ubuntu-repo-cloud-openclaw passed: https://github.com/NVIDIA/NemoClaw/actions/runs/27267579584 - concurrent-gateway-ports-e2e passed: https://github.com/NVIDIA/NemoClaw/actions/runs/27267579798 - double-onboard-e2e passed: https://github.com/NVIDIA/NemoClaw/actions/runs/27267579798 - [ ] `npx prek run --all-files` passes - [ ] `npm test` passes - [x] Tests added or updated for new or changed behavior - [x] No secrets, API keys, or credentials committed - [ ] Docs updated for user-facing behavior changes - [ ] `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) --- Signed-off-by: Carlos Villela <cvillela@nvidia.com> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Refactor** * Refactored internal dashboard port and URL selection logic for improved maintainability. * **Tests** * Added comprehensive tests for dashboard port selection and URL normalization behavior. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
Summary
Extracts the Docker-driver gateway runtime/process helpers from
src/lib/onboard.tsinto a focused onboarding module. This keeps the gateway startup orchestration inonboard.tswhile moving the state-dir, PID, runtime drift, executable resolution, and port-listener helpers behind an injected helper factory.Related Issue
Refs #3802
Changes
src/lib/onboard/docker-driver-gateway-runtime.tswith the Docker-driver gateway runtime helper factory.src/lib/onboard.tswith destructured helpers wired to the existing onboarding dependencies.onboard.tscompatibility exports for gateway environment, runtime drift, PID, and port-listener helpers.onboard.ts.Type of Change
Verification
Focused local checks passed:
npx @biomejs/biome format --write src/lib/onboard.ts src/lib/onboard/docker-driver-gateway-runtime.ts src/lib/onboard/docker-driver-gateway-runtime.test.tsnpx @biomejs/biome lint src/lib/onboard.ts src/lib/onboard/docker-driver-gateway-runtime.ts src/lib/onboard/docker-driver-gateway-runtime.test.tsnpm run typecheck:clinpm run build:cligit diff --checknpx vitest run src/lib/onboard/docker-driver-gateway-runtime.test.ts test/onboard-gateway-runtime.test.ts test/gateway-start-wait.test.ts test/gateway-final-failure-cleanup.test.ts test/gateway-start-failure-integration.test.ts src/lib/onboard/docker-driver-gateway-service.test.ts src/lib/onboard/gateway-binding.test.tsnpx vitest run src/lib/onboard/docker-driver-gateway-env.test.ts src/lib/onboard/docker-driver-gateway-launch.test.ts src/lib/onboard/docker-driver-gateway-runtime-marker.test.ts src/lib/onboard/host-gateway-process.test.tsRemote checks passed:
gateway-health-honest-e2e,gateway-drift-preflight-e2e(run).ubuntu-repo-cloud-openclaw,ubuntu-repo-docker-post-reboot-recovery(run).concurrent-gateway-ports-e2epassed on rerun (run); the first attempt failed before PR-specific behavior on Docker Hub pull timeouts.Full local hook/test note: regular commit hooks and regular pre-push hooks currently fail only in
test/release-latest-tag.test.tsbecause this workstation's global git config enables commit signing with/home/cvillela/.ssh/git-signing-key.pub, but the matching private key is unavailable. I did not touch that test or git configuration.npx prek run --all-filespassesnpm testpassesnpm run docsbuilds without warnings (doc changes only)Signed-off-by: Carlos Villela cvillela@nvidia.com