perf(nemotron): reduce sandbox tool-catalog latency#3808
Conversation
Signed-off-by: Aaron Erickson <aerickson@nvidia.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughAdds a build-time Node.js patch script that injects a compact tool catalog (tool_search, tool_describe, tool_call) into OpenClaw’s compiled selection bundle, stages the script into sandbox build contexts, integrates it into the Docker build to run against pinned dist/, and adds tests validating idempotency, pinned-shape checks, and end-to-end behavior. ChangesOpenClaw compact tool catalog patch
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add Comment |
E2E Advisor RecommendationRequired E2E: Dispatch hint: Auto-dispatched E2E: Full advisor summaryE2E Recommendation AdvisorBase: Required E2E
Optional E2E
New E2E recommendations
Dispatch hint
|
Selective E2E Results — ❌ Some jobs failedRun: 26119037435
|
Signed-off-by: Aaron Erickson <aerickson@nvidia.com>
Selective E2E Results — ✅ All requested jobs passedRun: 26119939423
|
Signed-off-by: Aaron Erickson <aerickson@nvidia.com>
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 `@scripts/patch-openclaw-tool-catalog.js`:
- Around line 207-213: In patchSelectionText, the presence of MARKER is treated
as "already patched" while only ALL_CUSTOM_TOOLS_PATTERN is checked; update
patchSelectionText to, when source.includes(MARKER) is true, also assert that
ALL_CUSTOM_TOOLS_PATTERN and the other three original-substitution pattern
constants used elsewhere in this file (the three other PATTERN constants you use
for the other substitutions) are all absent before returning { patched: false,
text: source }; if any of those patterns are still present, throw the same Error
as now so the build fails and forces re-patching. Ensure you reference the
function patchSelectionText, MARKER, ALL_CUSTOM_TOOLS_PATTERN and the three
other pattern constants when implementing the checks.
- Around line 178-191: The readOpenClawVersion function reads package.json but
doesn't enforce the pinned OpenClaw version; after obtaining payload.version in
readOpenClawVersion, add a strict check that the version === "2026.4.24" and
throw a clear Error if it does not match (e.g., "unexpected OpenClaw version:
<actual>, expected 2026.4.24"), so the script fails closed before any patching
occurs.
🪄 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: a9563b5a-185c-4546-be6c-a0711514bb58
📒 Files selected for processing (2)
scripts/patch-openclaw-tool-catalog.jstest/openclaw-tool-catalog-patch.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- test/openclaw-tool-catalog-patch.test.ts
Selective E2E Results — ✅ All requested jobs passedRun: 26120807823
|
Selective E2E Results — ✅ All requested jobs passedRun: 26121130118
|
Selective E2E Results — ✅ All requested jobs passedRun: 26121207532
|
Selective E2E Results — ❌ Some jobs failedRun: 26121834393
|
Signed-off-by: Aaron Erickson <aerickson@nvidia.com>
There was a problem hiding this comment.
♻️ Duplicate comments (1)
scripts/patch-openclaw-tool-catalog.js (1)
254-257:⚠️ Potential issue | 🟠 Major | ⚡ Quick winFail closed on OpenClaw version drift.
Line 256 reads the version but never enforces the pinned
2026.4.24, so any future bundle that still matches these string anchors will be patched instead of being rejected.Suggested fix
function patchOpenClawToolCatalog(distDir) { const resolvedDist = path.resolve(distDir); const version = readOpenClawVersion(resolvedDist); + if (version !== "2026.4.24") { + throw new Error(`Expected openclaw@2026.4.24, found ${version}`); + } const selectionFiles = listSelectionFiles(resolvedDist);🤖 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 `@scripts/patch-openclaw-tool-catalog.js` around lines 254 - 257, The code in patchOpenClawToolCatalog calls readOpenClawVersion(resolvedDist) but does not enforce the pinned version, so bundles with different versions can be patched; update patchOpenClawToolCatalog to compare the returned version against the expected pinned string "2026.4.24" (use the exact literal) and throw or exit with an explicit error if it does not match, referencing readOpenClawVersion and the pinned version constant so the function fails closed rather than proceeding to patch an unexpected OpenClaw bundle.
🤖 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.
Duplicate comments:
In `@scripts/patch-openclaw-tool-catalog.js`:
- Around line 254-257: The code in patchOpenClawToolCatalog calls
readOpenClawVersion(resolvedDist) but does not enforce the pinned version, so
bundles with different versions can be patched; update patchOpenClawToolCatalog
to compare the returned version against the expected pinned string "2026.4.24"
(use the exact literal) and throw or exit with an explicit error if it does not
match, referencing readOpenClawVersion and the pinned version constant so the
function fails closed rather than proceeding to patch an unexpected OpenClaw
bundle.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 5696ac6b-abe3-445c-b2c1-6ce24d3e4151
📒 Files selected for processing (2)
scripts/patch-openclaw-tool-catalog.jstest/openclaw-tool-catalog-patch.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- test/openclaw-tool-catalog-patch.test.ts
Selective E2E Results — ✅ All requested jobs passedRun: 26125800599
|
Selective E2E Results — ✅ All requested jobs passedRun: 26129228669
|
Selective E2E Results — ✅ All requested jobs passedRun: 26130497107
|
Selective E2E Results — ❌ Some jobs failedRun: 26130733369
|
| "\t\t\tmodelAliasLines: buildModelAliasLines(params.config),", | ||
| ].join("\n"); | ||
|
|
||
| const CATALOG_HELPER_AND_ASSIGNMENT = [ |
Selective E2E Results — ✅ All requested jobs passedRun: 26132641722
|
## Summary Refreshes the NemoClaw docs for v0.0.46 by updating version metadata, release notes, and generated user skills. The refresh also keeps public docs aligned with the docs skip list by removing non-public experimental references from the generated output. ## Related Issue None. ## Changes - #3744 and #3824 -> `docs/about/release-notes.mdx`: Added Windows bootstrap and WSL express install coverage for v0.0.46. - #3392 -> `docs/manage-sandboxes/messaging-channels.mdx`, `docs/reference/commands.mdx`, `docs/reference/network-policies.mdx`, and policy examples: Refreshed public messaging channel docs around WhatsApp and matching policy presets. - #3742, #3767, #3732, #3786, #3777, and #3808 -> `docs/about/release-notes.mdx`: Added release-note coverage for Hermes managed tools, Bedrock Runtime endpoint detection, WSL Ollama proxying, Model Router Python fallback, plugin command registration, and tool-catalog latency improvements. - #3124 -> `docs/about/release-notes.mdx`: Added release-note coverage for hosted uninstall flag guidance. - Generated `nemoclaw-user-*` skills from the updated MDX docs for the v0.0.46 release. ## Type of Change - [ ] Code change (feature, bug fix, or refactor) - [ ] Code change with doc updates - [x] Doc only (prose changes, no code sample modifications) - [ ] Doc only (includes code sample changes) ## Verification - [ ] `npx prek run --all-files` passes - [ ] `npm test` passes - [ ] Tests added or updated for new or changed behavior - [x] No secrets, API keys, or credentials committed - [x] Docs updated for user-facing behavior changes - [ ] `make docs` builds without warnings (doc changes only) - [x] 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) Verification notes: - Commit hooks passed, including markdownlint, gitleaks, docs-to-skills verification, env-var docs, and skills YAML checks. - `python3 scripts/docs-to-skills.py docs/ .agents/skills/ --prefix nemoclaw-user --doc-platform fern-mdx` passed. - `bash test/e2e/e2e-cloud-experimental/check-docs.sh --only-links --local-only --with-skills` passed. - `git diff --check` passed. - `make docs` was attempted but blocked before MDX validation because `npx` received HTTP 403 fetching `fern-api` from npm. --- Signed-off-by: Miyoung Choi <miyoungc@nvidia.com> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Released v0.0.46: improved Windows setup, WhatsApp messaging support, Hermes sandbox/tool routing, Anthropic endpoint compatibility, Ollama proxy routing, model-router fallback, OpenClaw plugin/backup compatibility, sandbox build tooling fixes, and updated uninstall flag behavior. * **Documentation** * Removed WeChat from messaging flows and presets across guides and CLI docs; clarified onboarding and channel setup for WhatsApp. Clarified runtime mutability and filesystem (Landlock) behavior — some changes require sandbox rebuilds; prefer host-side commands for durable config. <!-- review_stack_entry_start --> [](https://app.coderabbit.ai/change-stack/NVIDIA/NemoClaw/pull/3911?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack) <!-- review_stack_entry_end --> <!-- end of auto-generated comment: release notes by coderabbit.ai -->
…DIA#3059) Three documentation additions to `docs/reference/commands.mdx` under `## Environment Variables`: `### At a Glance` is a new categorized index of every documented `NEMOCLAW_*` env var. Eight categories (Service Ports, Onboarding Configuration, Onboarding Behavior Flags, Probe Timeouts, Onboard Timeouts, Gateway Lifecycle Tunables, Sandbox Runtime, Lifecycle Behavior Flags) link into the existing detail subsections so readers can find a variable by category instead of grepping the page. `### Gateway Lifecycle Tunables` documents seven knobs that tune the polling and timeout budgets used by gateway-recovery and health-check paths: `NEMOCLAW_GATEWAY_START_TIMEOUT`, `NEMOCLAW_GATEWAY_RECOVERY_WAIT_SECONDS`, `NEMOCLAW_GATEWAY_RECOVERY_POLL_INTERVAL_SECONDS`, `NEMOCLAW_HEALTH_POLL_COUNT`, `NEMOCLAW_HEALTH_POLL_INTERVAL`, `NEMOCLAW_LOGS_PROBE_TIMEOUT_MS`, and `NEMOCLAW_DOCKER_GPU_SUPERVISOR_RECONNECT_TIMEOUT`. Defaults target typical local development; the section explains when to raise them. `### Sandbox Runtime (v0.0.50)` documents four new user-tunable env vars introduced in v0.0.49 and v0.0.50: `NEMOCLAW_TOOL_CATALOG` (OpenClaw compact tool-catalog rollback per NVIDIA#3808), `NEMOCLAW_OPENCLAW_MANAGED_PROXY` (top-level proxy block emission per NVIDIA#4005), `NEMOCLAW_SANDBOX_BASE_VERSION_TAG` (versioned base-image pin per NVIDIA#4082), and `NEMOCLAW_HERMES_TOOL_GATEWAY_REFRESH_TOKEN` (Nous OAuth refresh token for the Hermes managed-tool gateway broker per NVIDIA#3742). Test seams and internal-only timeouts (including `NEMOCLAW_BEDROCK_RUNTIME_ADAPTER_PORT`, which the allowlist marks as internal-only) are intentionally excluded. Four new entries are added to the Onboarding Behavior Flags table for the existing-but-undocumented macOS VM-driver and Docker-driver GPU patch knobs: `NEMOCLAW_DISABLE_VM_DNS_MONKEYPATCH`, `NEMOCLAW_FORCE_VM_DNS_MONKEYPATCH`, `NEMOCLAW_DARWIN_VM_COMPAT`, `NEMOCLAW_DOCKER_GPU_PATCH_NETWORK`. The mirror at `.agents/skills/nemoclaw-user-reference/references/commands.md` is regenerated by `scripts/docs-to-skills.py`. Fresh recreation of the closed NVIDIA#3652 rebuilt on top of current upstream/main with the v0.0.49/v0.0.50 env-var additions folded into the categorized index. Signed-off-by: latenighthackathon <latenighthackathon@users.noreply.github.com>
Fixes #2600.
Summary
2026.4.24pin for this PR and avoid changing model, context, token, tool-profile, deny-list, or lean-mode defaultstool_search,tool_describe, andtool_calltool_call, including policy filtering, hooks, approvals, MCP/client tools, logging, and existing execution behaviorNEMOCLAW_TOOL_CATALOG=0as a runtime emergency rollback path for patched runtimesReviewer notes
selection-*.jstarget and exactly one of each patch point. If a future OpenClaw release rewrites the selection path, the build fails closed instead of silently shipping an unpatched or partially patched runtime.tool_calldelegates to the real underlying OpenClaw tool definition stored in the closure-backed catalog. The provider sees compact controls, but execution still goes through OpenClaw's existing wrapped tool definitions.COPYpath depends on the optimized sandbox build context. This PR stagesscripts/patch-openclaw-tool-catalog.jsthroughsrc/lib/sandbox/build-context.ts; an earlier head failed selective E2E Docker builds until this was added.tool_describe: nestedtitleand nested schemadescriptionmetadata are stripped, while tool names, root descriptions, properties, required fields, enum values, and execution semantics are preserved.Performance evidence
3.382s/ avg3.685sversus the compact catalog at p500.961s/ avg1.409s.3.5xfaster at p50, saving roughly2.4son the measured turn. A larger 22-tool run measured about4.9xfaster at p50.tool_search->tool_describe->tool_call).OpenClaw upgrade behavior
NEMOCLAW_TOOL_CATALOG=0remains a runtime rollback switch for any patched runtime. It disables the compact wrapper and exposes direct tools again; it is not needed just because the OpenClaw package version changed.COPY/RUN, build-context staging, and replace or retire the backport-specific tests after validating upstream behavior and latency.Validation
node --check scripts/patch-openclaw-tool-catalog.jsnpx vitest run test/openclaw-tool-catalog-patch.test.tsnpx vitest run test/sandbox-build-context.test.ts test/openclaw-tool-catalog-patch.test.tsnpx vitest run test/docker-abstraction-guard.test.tsnpx vitest run test/cli.test.ts -t "enables OpenShell audit events before reading logs"npx vitest run test/cli.test.ts -t "doctor treats a live non-cloudflared PID as stale"npx vitest run test/cli.test.ts -t "connect --probe-only falls back to SSH when sandbox exec times out after starting"test/onboard.test.tsbuild-context staging assertionnpm run build:clinpm run source-shape:checknpm run lintpassed with an existing unrelated warning about an unused Biome suppression insrc/lib/onboard/child-exit-tracker.test.tsgit diff --checkopenclaw@2026.4.24artifactSummary by CodeRabbit
New Features
Tests
Chores