feat: enable adaptive plugin for CLI and OpenClaw#128
Conversation
Signed-off-by: Will Killian <wkillian@nvidia.com>
WalkthroughThis PR integrates adaptive plugin support into NeMo Flow CLI by adding the ChangesAdaptive Plugin Integration
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
🚥 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 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 |
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 `@crates/cli/src/gateway.rs`:
- Around line 596-608: In effective_upstream_request, avoid always reserializing
request.content (which can be a sentinel JSON null) — instead detect when
request.content is JSON null and in that case keep the original body_bytes; only
call serde_json::to_vec(&request.content) when request.content is not a Null
value, and still fallback to body_bytes.clone() on serialization error; update
the logic around the variable request/content and body_bytes to choose the
preserved original bytes when content is Null.
In `@integrations/openclaw/test/config.test.ts`:
- Around line 753-763: The mock in the adaptive section hardcodes the kind
string instead of using the declared constant; update the ComponentSpec factory
to use ADAPTIVE_PLUGIN_KIND for the kind field (replace the literal "adaptive"
with ADAPTIVE_PLUGIN_KIND) so the mock stays consistent with
ADAPTIVE_PLUGIN_KIND and cannot drift from the contract; ensure you reference
the adaptive.ADAPTIVE_PLUGIN_KIND symbol and the adaptive.ComponentSpec function
when making the change.
🪄 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: ASSERTIVE
Plan: Enterprise
Run ID: a9b02710-b2b0-4718-b87b-7cca1d073cae
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (12)
crates/cli/Cargo.tomlcrates/cli/src/gateway.rscrates/cli/src/plugins/config_io.rscrates/cli/src/server.rscrates/cli/tests/coverage/gateway_tests.rscrates/cli/tests/coverage/plugins_tests.rscrates/cli/tests/coverage/server_tests.rsdocs/integrations/openclaw-plugin.mdintegrations/openclaw/README.mdintegrations/openclaw/src/modules.tsintegrations/openclaw/test/config.test.tsintegrations/openclaw/test/live-smoke.test.ts
📜 Review details
🧰 Additional context used
📓 Path-based instructions (34)
**/*.rs
📄 CodeRabbit inference engine (.agents/skills/test-ffi-surface/SKILL.md)
**/*.rs: Runcargo fmt --allfor FFI work as it is Rust work
Runjust test-rustfor FFI validation
Runcargo clippy --workspace --all-targets -- -D warningsto enforce warnings-as-errors linting
**/*.rs: Runcargo fmt --allfor Rust code formatting
Runcargo clippy --workspace --all-targets -- -D warningsto enforce Rust linting with no warnings
Runjust test-rustas the shared-runtime build/test wrapper for Rust changesUse Rust snake_case naming convention for Rust code
**/*.rs: Any Rust change must runjust test-rust
Any Rust change must runcargo fmt --all
Any Rust change must runcargo clippy --workspace --all-targets -- -D warnings
**/*.rs: Runcargo fmt --allfor Rust code formatting when Node changes touch Rust files
Runcargo clippy --workspace --all-targets -- -D warningsto enforce strict linting when Rust files changed as part of Node work
**/*.rs: Always runjust test-rustwhen any Rust code changes
Always runcargo fmt --allwhen any Rust code changes
Always runcargo clippy --workspace --all-targets -- -D warningswhen any Rust code changesIf any Rust files changed as part of the Python work, also run
cargo fmt --all,just test-rust, andcargo clippy --workspace --all-targets -- -D warnings
Files:
crates/cli/src/plugins/config_io.rscrates/cli/tests/coverage/plugins_tests.rscrates/cli/tests/coverage/gateway_tests.rscrates/cli/src/server.rscrates/cli/tests/coverage/server_tests.rscrates/cli/src/gateway.rs
**/*.{rs,go,js,ts,tsx}
📄 CodeRabbit inference engine (CONTRIBUTING.md)
Include SPDX license headers in all Rust, Go, JavaScript, and TypeScript source files using C-style comment syntax
Files:
crates/cli/src/plugins/config_io.rsintegrations/openclaw/test/live-smoke.test.tscrates/cli/tests/coverage/plugins_tests.rscrates/cli/tests/coverage/gateway_tests.rsintegrations/openclaw/test/config.test.tscrates/cli/src/server.rsintegrations/openclaw/src/modules.tscrates/cli/tests/coverage/server_tests.rscrates/cli/src/gateway.rs
**/*.{rs,py,go,js,ts,tsx}
📄 CodeRabbit inference engine (CONTRIBUTING.md)
Use
SONAR_IGNORE_START/SONAR_IGNORE_ENDmarkers only for documented false positives that cannot be resolved in code; keep ignored blocks small, add explanatory comments, and require reviewer sign-off
Files:
crates/cli/src/plugins/config_io.rsintegrations/openclaw/test/live-smoke.test.tscrates/cli/tests/coverage/plugins_tests.rscrates/cli/tests/coverage/gateway_tests.rsintegrations/openclaw/test/config.test.tscrates/cli/src/server.rsintegrations/openclaw/src/modules.tscrates/cli/tests/coverage/server_tests.rscrates/cli/src/gateway.rs
**/*.{js,ts,tsx,jsx,py,rs,go,java,c,cpp,h,cc,cxx,cs,rb,php,swift,kt}
📄 CodeRabbit inference engine (.agents/skills/prepare-pr/SKILL.md)
Changed files must be formatted with the language-native formatter
Files:
crates/cli/src/plugins/config_io.rsintegrations/openclaw/test/live-smoke.test.tscrates/cli/tests/coverage/plugins_tests.rscrates/cli/tests/coverage/gateway_tests.rsintegrations/openclaw/test/config.test.tscrates/cli/src/server.rsintegrations/openclaw/src/modules.tscrates/cli/tests/coverage/server_tests.rscrates/cli/src/gateway.rs
**/*.{py,js,ts,tsx,go,rs,md}
📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)
Format changed files with the language-native formatter before the final lint/test pass
Files:
crates/cli/src/plugins/config_io.rsintegrations/openclaw/test/live-smoke.test.tscrates/cli/tests/coverage/plugins_tests.rscrates/cli/tests/coverage/gateway_tests.rsintegrations/openclaw/test/config.test.tscrates/cli/src/server.rsintegrations/openclaw/src/modules.tscrates/cli/tests/coverage/server_tests.rsdocs/integrations/openclaw-plugin.mdintegrations/openclaw/README.mdcrates/cli/src/gateway.rs
**/*.{rs,py,js,ts,tsx,go}
📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)
During iteration, prefer
uv run pre-commit run --files <changed files...>for targeted validation
Files:
crates/cli/src/plugins/config_io.rsintegrations/openclaw/test/live-smoke.test.tscrates/cli/tests/coverage/plugins_tests.rscrates/cli/tests/coverage/gateway_tests.rsintegrations/openclaw/test/config.test.tscrates/cli/src/server.rsintegrations/openclaw/src/modules.tscrates/cli/tests/coverage/server_tests.rscrates/cli/src/gateway.rs
**/*.{js,ts,tsx}
📄 CodeRabbit inference engine (CONTRIBUTING.md)
Use camelCase naming convention for Node.js code
Files:
integrations/openclaw/test/live-smoke.test.tsintegrations/openclaw/test/config.test.tsintegrations/openclaw/src/modules.ts
**/*.{md,markdown,py,sh,bash,js,ts,java,cpp,go,rust}
📄 CodeRabbit inference engine (.agents/skills/contribute-docs/SKILL.md)
Keep package names, repo references, and build commands current in documentation
Files:
integrations/openclaw/test/live-smoke.test.tsintegrations/openclaw/test/config.test.tsintegrations/openclaw/src/modules.tsdocs/integrations/openclaw-plugin.mdintegrations/openclaw/README.md
**/*.{md,markdown,py,sh,bash,js,ts,example}
📄 CodeRabbit inference engine (.agents/skills/contribute-docs/SKILL.md)
Example commands must match current package names and paths
Files:
integrations/openclaw/test/live-smoke.test.tsintegrations/openclaw/test/config.test.tsintegrations/openclaw/src/modules.tsdocs/integrations/openclaw-plugin.mdintegrations/openclaw/README.md
**/{integrations,integration,*-integration}/**
📄 CodeRabbit inference engine (.agents/skills/contribute-integration/SKILL.md)
**/{integrations,integration,*-integration}/**: Keep NeMo Flow optional in framework integrations
Preserve the framework's original behavior when NeMo Flow is absent
Wrap tool and LLM paths at the correct framework boundary
Integration pattern must followdocs/integrate-frameworks/adding-scopes.md
Files:
integrations/openclaw/test/live-smoke.test.tsintegrations/openclaw/test/config.test.tsintegrations/openclaw/src/modules.tsdocs/integrations/openclaw-plugin.mdintegrations/openclaw/README.md
{crates/adaptive/**,python/nemo_flow/{adaptive,plugin}.py,go/nemo_flow/{adaptive,**}/*.go,**/*.{ts,js,wasm}}
📄 CodeRabbit inference engine (.agents/skills/maintain-optimizer/SKILL.md)
Keep adaptive config schema, plugin lifecycle, and bindings in sync across crates/adaptive, core, bindings, Python (python/nemo_flow/adaptive.py and python/nemo_flow/plugin.py), Go (go/nemo_flow/adaptive and go/nemo_flow), and Node/WebAssembly helpers
Files:
integrations/openclaw/test/live-smoke.test.tsintegrations/openclaw/test/config.test.tsintegrations/openclaw/src/modules.ts
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)
If Node.js language surface changed, always run Node.js test target even when Rust core did not change
Files:
integrations/openclaw/test/live-smoke.test.tsintegrations/openclaw/test/config.test.tsintegrations/openclaw/src/modules.ts
**/Cargo.{toml,lock}
📄 CodeRabbit inference engine (CONTRIBUTING.md)
Run
cargo deny checkfor Rust dependency auditing as configured indeny.toml
Files:
crates/cli/Cargo.toml
**/*.toml
📄 CodeRabbit inference engine (CONTRIBUTING.md)
Include SPDX license headers in TOML files using TOML comment syntax
Files:
crates/cli/Cargo.toml
**/Cargo.toml
📄 CodeRabbit inference engine (.agents/skills/prepare-code-freeze/SKILL.md)
Confirm or infer the target release version from
upstream/main:Cargo.toml. Derive the release branch asrelease/<major>.<minor>
Files:
crates/cli/Cargo.toml
{crates/**/tests/**,python/tests/**,go/nemo_flow/**/*_test.go}
⚙️ CodeRabbit configuration file
{crates/**/tests/**,python/tests/**,go/nemo_flow/**/*_test.go}: Tests should cover the behavior promised by the changed API surface, including error paths and cross-request isolation where relevant.
Prefer assertions on lifecycle events, scope stacks, middleware ordering, and binding parity over shallow smoke tests.
Files:
crates/cli/tests/coverage/plugins_tests.rscrates/cli/tests/coverage/gateway_tests.rscrates/cli/tests/coverage/server_tests.rs
**/*.{md,rst,html,txt}
📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-brand-terminology.md)
**/*.{md,rst,html,txt}: Always spellNVIDIAin all caps. Do not useNvidia,nvidia,nVidia,nVIDIA, orNV.
Usean NVIDIAbefore a noun because the name starts with an 'en' sound.
Do not add a registered trademark symbol afterNVIDIAwhen referring to the company.
Use trademark symbols with product names only when the document type or legal guidance requires them.
Verify official capitalization, spacing, and hyphenation for product names.
Precede NVIDIA product names withNVIDIAon first mention when it is natural and accurate.
Do not rewrite product names for grammar or title-case rules.
Preserve third-party product names according to the owner's spelling.
Include the company name and full model qualifier on first use when it helps identify the model.
Preserve the official capitalization and punctuation of model names.
Use shorter family names only after the full name is established.
Spell out a term on first use and put the acronym in parentheses unless the acronym is widely understood by the intended audience.
Use the acronym on later mentions after it has been defined.
For long documents, reintroduce the full term if readers might lose context.
Form plurals of acronyms withs, not an apostrophe, such asGPUs.
In headings, common acronyms can remain abbreviated. Spell out the term in the first or second sentence of the body.
Common terms such asCPU,GPU,PC,API, andUIusually do not need to be spelled out for developer audiences.
Files:
docs/integrations/openclaw-plugin.mdintegrations/openclaw/README.md
**/*.{md,rst,html}
📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-brand-terminology.md)
Link the first mention of a product name when the destination helps the reader.
Files:
docs/integrations/openclaw-plugin.mdintegrations/openclaw/README.md
**/*.{md,rst,txt}
📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-guide.md)
**/*.{md,rst,txt}: SpellNVIDIAin all caps. Do not useNvidia,nvidia, orNV.
Format commands, code elements, expressions, package names, file names, and paths as inline code.
Use descriptive link text. Avoid raw URLs and weak anchors such as 'here' or 'read more.'
Use title case consistently for technical documentation headings.
Introduce code blocks, lists, tables, and images with complete sentences.
Write procedures as imperative steps. Keep steps parallel and split long procedures into smaller tasks.
Prefer active voice, present tense, short sentences, contractions, and plain English.
Usecanfor possibility and reservemayfor permission.
Useafterfor temporal relationships instead ofonce.
Preferrefer tooverseewhen the wording points readers to another resource.
Avoid culture-specific idioms, unnecessary Latinisms, jokes, and marketing exaggeration in technical documentation.
Spell out months in body text, avoid ordinal dates, and use clear time zones.
Spell out whole numbers from zero through nine unless they are technical values, parameters, versions, or UI values.
Use numerals for 10 or greater and include commas in thousands.
Do not add trademark symbols to learning-oriented documentation unless the source, platform, or legal guidance explicitly requires them.
Do not add trademark symbols to NeMo Flow learning documentation by default.
Do not rewrite API names, package names, command flags, or code literals for style reasons.
Files:
docs/integrations/openclaw-plugin.mdintegrations/openclaw/README.md
**/*.{md,markdown,rst}
📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-technical-docs.md)
**/*.{md,markdown,rst}: Use title case consistently in technical documentation headings
Avoid quotation marks, ampersands, and exclamation marks in headings
Keep product, event, research, and whitepaper names in their official title case
Use title case for table headers
Do not force social-media sentence case into technical docs
Use monospace formatting for code elements, commands, parameters, package names, and expressions
Use monospace formatting for directories, file names, and paths
Use angle brackets inside monospace for variables inside paths, such as/home/<username>/.login
Use quotation marks for error messages and strings in documentation
Use bold formatting for UI buttons, menus, fields, and labels in documentation
Use angle brackets between UI labels for menu paths, such as File > Save As
Use italics for new terms on first use in documentation
Use italics for publication titles in documentation
Use plain text formatting for keyboard shortcuts in documentation
Prefer[NVIDIA/NeMo](link)format for GitHub repository references over generic phrases like 'the GitHub repo'
Introduce every code block with a complete sentence
Do not make a code block complete the grammar of the previous sentence
Do not continue a sentence after a code block
Use syntax highlighting when the format supports it for code blocks
Avoid the word 'snippet' unless the surrounding docs already use it as a term of art
Keep inline method, function, and class references consistent with nearby docs, omitting empty parentheses for prose readability when no call is shown
Use descriptive anchor text that matches the destination title when possible for links
Avoid raw URLs in running text in documentation
Avoid generic link anchors such as 'here,' 'this page,' and 'read more' in documentation
Include the acronym in link text if a linked term includes an acronym
Do not link long sentences or multiple sentences in documentation
Avoid links that pull readers away from a procedure unles...
Files:
docs/integrations/openclaw-plugin.mdintegrations/openclaw/README.md
**/*.{html,md}
📄 CodeRabbit inference engine (CONTRIBUTING.md)
Include SPDX license headers in HTML and Markdown files using HTML comment syntax
Files:
docs/integrations/openclaw-plugin.mdintegrations/openclaw/README.md
docs/**/*.md
📄 CodeRabbit inference engine (CONTRIBUTING.md)
Run
./scripts/build-docs.shfor documentation site changes
docs/**/*.md: Relevant getting-started or reference docs must be updated when examples change
Release-policy docs must point to GitHub Releases as the only release-history source of truth
docs/**/*.md: Use title case for headings in technical documentation
Introduce code blocks, tables, and lists with complete lead-in sentences in documentation
Files:
docs/integrations/openclaw-plugin.md
**/*.md
📄 CodeRabbit inference engine (CONTRIBUTING.md)
Run Markdown link checking via
lycheeforREADME.md,CONTRIBUTING.md, anddocs/through pre-commit hooks
Files:
docs/integrations/openclaw-plugin.mdintegrations/openclaw/README.md
{RELEASING.md,CHANGELOG.md,docs/**/*.md}
📄 CodeRabbit inference engine (.agents/skills/contribute-docs/SKILL.md)
Keep release-process and release-notes guidance in repo-maintainer docs such as RELEASING.md, not as user-facing docs pages or CHANGELOG.md
Files:
docs/integrations/openclaw-plugin.md
**/*.{md,markdown,py,sh,bash}
📄 CodeRabbit inference engine (.agents/skills/contribute-docs/SKILL.md)
Keep stable user-facing wrappers at scripts/ root in docs and examples; only point at namespaced helper paths when documenting internal maintenance work
Files:
docs/integrations/openclaw-plugin.mdintegrations/openclaw/README.md
{scripts/*.sh,docs/**/*.md}
📄 CodeRabbit inference engine (.agents/skills/contribute-integration/SKILL.md)
Use root
./scripts/*.shcommands in docs and contributor guidance as documented, with implementations underscripts/third-party/
Files:
docs/integrations/openclaw-plugin.md
{docs/**,examples/**,crates/adaptive/**,python/nemo_flow/**,go/nemo_flow/**,**/{example,component}.{ts,tsx,js,rs,py,go}}
📄 CodeRabbit inference engine (.agents/skills/maintain-optimizer/SKILL.md)
Any new adaptive component kind must have documentation, examples, and binding coverage across all supported languages
Files:
docs/integrations/openclaw-plugin.md
{README*,CHANGELOG*,docs/**/*.{md,rst,txt},examples/**/*,*.md}
📄 CodeRabbit inference engine (.agents/skills/rename-surfaces/SKILL.md)
Update documentation, examples, and getting-started guides with new package/module/crate names after rename operations
Files:
docs/integrations/openclaw-plugin.md
**/*.{md,txt,rst}
📄 CodeRabbit inference engine (.agents/skills/review-doc-style/SKILL.md)
**/*.{md,txt,rst}: Ensure commands, package names, file paths, and APIs in documentation are correct and not stale; flag incorrect or outdated information as blocking issues
Ensure examples and procedures in documentation will execute successfully with current APIs and commands
Use consistent user-facing terminology throughout documentation that matches current repo terminology
Capitalize NVIDIA correctly in all documentation and public-facing text
Format code, commands, paths, and filenames as inline code (monospace) in documentation
Use descriptive anchor text for links instead of bare URLs or weak labels like 'here' in documentation
Prefer active voice, present tense, short sentences, and plain English in documentation
Structure documentation procedures as imperative steps that are easy to scan and not too long for a single sequence
Prefer 'after' instead of 'once' for temporal references in documentation
Use 'can' instead of 'may' when describing possibility (rather than permission) in documentation
Avoid ambiguous numeric dates and ordinal dates in documentation body text
Files:
docs/integrations/openclaw-plugin.mdintegrations/openclaw/README.md
{README.md,docs/**/*.md,examples/**/*.{js,ts,py,go,rs}}
📄 CodeRabbit inference engine (.agents/skills/maintain-packaging/SKILL.md)
Keep documentation and examples synchronized with current install, import, and build commands
Files:
docs/integrations/openclaw-plugin.md
{README.md,CONTRIBUTING.md,docs/**/*.md}
📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)
For docs-only changes, run targeted checks only if commands, package names, or examples changed. Use
just docsfor docs-site builds andjust docs-linkcheckwhen links changed
Files:
docs/integrations/openclaw-plugin.md
{docs/**,README.md,CONTRIBUTING.md,RELEASING.md,SECURITY.md}
⚙️ CodeRabbit configuration file
{docs/**,README.md,CONTRIBUTING.md,RELEASING.md,SECURITY.md}: Review documentation for technical accuracy against the current API, command correctness, and consistency across language bindings.
Flag stale examples, missing SPDX headers where required, and instructions that no longer match CI or pre-commit behavior.
Files:
docs/integrations/openclaw-plugin.md
**/README.md
📄 CodeRabbit inference engine (CONTRIBUTING.md)
Update relevant crate or package README when that surface changed
Relevant package or crate README.md files must be updated when examples or binding guidance changes
Files:
integrations/openclaw/README.md
{README.md,docs/index.md,**/README.md}
📄 CodeRabbit inference engine (.agents/skills/review-doc-style/SKILL.md)
Update entry-point documentation (README.md, docs/index.md, package READMEs, binding-level source READMEs) whenever public behavior changes
Files:
integrations/openclaw/README.md
🧠 Learnings (1)
📚 Learning: 2026-05-07T18:04:44.387Z
Learnt from: mnajafian-nv
Repo: NVIDIA/NeMo-Flow PR: 67
File: integrations/openclaw/src/modules.ts:1-2
Timestamp: 2026-05-07T18:04:44.387Z
Learning: In NVIDIA/NeMo-Flow, TypeScript source files should use `//` line comments for SPDX headers (e.g., `// SPDX-FileCopyrightText: ...` and `// SPDX-License-Identifier: ...`) rather than C-style block comments (`/* ... */`). The repo’s copyright checker enforces this mapping, so `//` SPDX headers in `.ts` files should not be flagged as a style violation.
Applied to files:
integrations/openclaw/test/live-smoke.test.tsintegrations/openclaw/test/config.test.tsintegrations/openclaw/src/modules.ts
🔇 Additional comments (12)
crates/cli/tests/coverage/plugins_tests.rs (1)
8-33: LGTM!Also applies to: 291-323, 375-387
docs/integrations/openclaw-plugin.md (1)
12-13: LGTM!Also applies to: 15-19, 107-124, 159-160, 168-171, 249-250, 253-253
integrations/openclaw/README.md (1)
12-13: LGTM!Also applies to: 15-18, 34-34, 103-119, 154-155, 163-166, 211-211
integrations/openclaw/src/modules.ts (1)
11-12: LGTM!Also applies to: 28-29, 49-54, 58-59, 65-69, 74-74
integrations/openclaw/test/config.test.ts (1)
72-105: LGTM!Also applies to: 247-263, 289-327
integrations/openclaw/test/live-smoke.test.ts (1)
48-64: LGTM!crates/cli/Cargo.toml (1)
25-25: LGTM!crates/cli/src/plugins/config_io.rs (1)
10-10: LGTM!Also applies to: 119-121
crates/cli/src/server.rs (1)
11-11: LGTM!Also applies to: 156-158
crates/cli/src/gateway.rs (1)
9-10: LGTM!Also applies to: 300-327, 441-467, 571-586, 621-627, 770-771
crates/cli/tests/coverage/gateway_tests.rs (1)
10-10: LGTM!Also applies to: 143-223
crates/cli/tests/coverage/server_tests.rs (1)
361-401: LGTM!Also applies to: 796-803
| fn effective_upstream_request( | ||
| body_bytes: &Bytes, | ||
| headers: &HeaderMap, | ||
| effective_request: Option<&LlmRequest>, | ||
| ) -> (Bytes, HeaderMap) { | ||
| let Some(request) = effective_request else { | ||
| return (body_bytes.clone(), headers.clone()); | ||
| }; | ||
|
|
||
| let body_bytes = serde_json::to_vec(&request.content) | ||
| .map(Bytes::from) | ||
| .unwrap_or_else(|_| body_bytes.clone()); | ||
| let mut headers = headers.clone(); |
There was a problem hiding this comment.
Preserve raw payload when runtime content is sentinel null.
Line 605 always reserializes request.content when effective_request is present. If inbound JSON parsing failed upstream of this path, that rewrites the original payload to literal null instead of forwarding original bytes.
Proposed fix
fn effective_upstream_request(
body_bytes: &Bytes,
headers: &HeaderMap,
effective_request: Option<&LlmRequest>,
) -> (Bytes, HeaderMap) {
let Some(request) = effective_request else {
return (body_bytes.clone(), headers.clone());
};
- let body_bytes = serde_json::to_vec(&request.content)
- .map(Bytes::from)
- .unwrap_or_else(|_| body_bytes.clone());
+ let body_bytes = if request.content.is_null()
+ && std::str::from_utf8(body_bytes.as_ref())
+ .map(str::trim)
+ .ok()
+ != Some("null")
+ {
+ body_bytes.clone()
+ } else {
+ serde_json::to_vec(&request.content)
+ .map(Bytes::from)
+ .unwrap_or_else(|_| body_bytes.clone())
+ };
let mut headers = headers.clone();
for (name, value) in &request.headers {
let Ok(name) = HeaderName::from_bytes(name.as_bytes()) else {
continue;
};🤖 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 `@crates/cli/src/gateway.rs` around lines 596 - 608, In
effective_upstream_request, avoid always reserializing request.content (which
can be a sentinel JSON null) — instead detect when request.content is JSON null
and in that case keep the original body_bytes; only call
serde_json::to_vec(&request.content) when request.content is not a Null value,
and still fallback to body_bytes.clone() on serialization error; update the
logic around the variable request/content and body_bytes to choose the preserved
original bytes when content is Null.
| adaptive: { | ||
| ADAPTIVE_PLUGIN_KIND: "adaptive", | ||
| ComponentSpec: ( | ||
| config: Parameters<NemoFlowModules["adaptive"]["ComponentSpec"]>[0], | ||
| options?: Parameters<NemoFlowModules["adaptive"]["ComponentSpec"]>[1], | ||
| ) => ({ | ||
| kind: "adaptive", | ||
| enabled: options?.enabled ?? true, | ||
| config, | ||
| }), | ||
| }, |
There was a problem hiding this comment.
🧹 Nitpick | 🔵 Trivial | ⚡ Quick win
Avoid hardcoded adaptive kind in ComponentSpec mock.
ComponentSpec currently hardcodes "adaptive" instead of reusing ADAPTIVE_PLUGIN_KIND, so the mock can silently drift from its own declared contract.
Proposed refactor
function createModules(params: {
validateDiagnostics?: Array<{ level: "warning" | "error"; code: string; message: string }>;
validateThrows?: Error;
initializeDiagnostics?: Array<{ level: "warning" | "error"; code: string; message: string }>;
} = {}): TestModules {
const nf = createNemoFlowRuntime();
const calls: TestPluginHost["calls"] = { validate: [], initialize: [], clear: 0 };
+ const adaptivePluginKind = "adaptive";
return {
nf,
adaptive: {
- ADAPTIVE_PLUGIN_KIND: "adaptive",
+ ADAPTIVE_PLUGIN_KIND: adaptivePluginKind,
ComponentSpec: (
config: Parameters<NemoFlowModules["adaptive"]["ComponentSpec"]>[0],
options?: Parameters<NemoFlowModules["adaptive"]["ComponentSpec"]>[1],
) => ({
- kind: "adaptive",
+ kind: adaptivePluginKind,
enabled: options?.enabled ?? true,
config,
}),
},🤖 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 `@integrations/openclaw/test/config.test.ts` around lines 753 - 763, The mock
in the adaptive section hardcodes the kind string instead of using the declared
constant; update the ComponentSpec factory to use ADAPTIVE_PLUGIN_KIND for the
kind field (replace the literal "adaptive" with ADAPTIVE_PLUGIN_KIND) so the
mock stays consistent with ADAPTIVE_PLUGIN_KIND and cannot drift from the
contract; ensure you reference the adaptive.ADAPTIVE_PLUGIN_KIND symbol and the
adaptive.ComponentSpec function when making the change.
Overview
Enable the adaptive plugin path for
nemo-flow-cliand the publicnemo-flow-openclawintegration package.Details
LlmRequestproduced by managed execution request intercepts to the upstream HTTP request body and headers.Validation run:
cargo fmt --allnpm run typecheck --workspace=nemo-flow-openclawcargo test -p nemo-flow-clinpm test --workspace=nemo-flow-openclawgit diff --checkWhere should the reviewer start?
Start with
crates/cli/src/gateway.rsfor the managed execution request forwarding change, thencrates/cli/src/server.rsandcrates/cli/src/plugins/config_io.rsfor adaptive plugin registration.Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to)
Summary by CodeRabbit
Release Notes
New Features
Documentation