fix(inference): bound adapter health-response memory - #7661
Conversation
Signed-off-by: Ho Lim <subhoya@gmail.com>
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThe local adapter health probe caps responses at 64 KiB, handles oversized or failed streams as unhealthy, prevents multiple settlements, and adds boundary tests for streamed, exact-limit, declared oversized, and early-close responses. ChangesLocal adapter health response bounding
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant HealthServer
participant probeLocalAdapterHealth
participant ResponseStream
HealthServer->>probeLocalAdapterHealth: health response
probeLocalAdapterHealth->>ResponseStream: inspect content-length and data chunks
ResponseStream-->>probeLocalAdapterHealth: streamed response data or close event
probeLocalAdapterHealth->>ResponseStream: destroy on size limit breach
probeLocalAdapterHealth-->>HealthServer: resolve health result
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
PR Review Advisor — No blocking findings reportedAdvisor assessment: No blocking advisor findings reported Model lanes
Nemotron output stays in workflow artifacts and does not change the assessment above. E2E guidanceAdvisory only. E2E / PR Gate selects and runs jobs independently. Recommended E2E: This automated review informs maintainers. Warnings and suggestions do not require a response. A maintainer decides whether to merge. |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/lib/inference/local-adapter-lifecycle.ts (1)
235-235: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winUse
closeinstead of deprecatedaborted. Keep the!res.completeguard so incomplete responses still settle as unhealthy.🤖 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 `@src/lib/inference/local-adapter-lifecycle.ts` at line 235, In the response lifecycle handler around settle, replace the deprecated res “aborted” event with the “close” event and retain the !res.complete guard so only incomplete responses settle as unhealthy.Source: Learnings
🤖 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/inference/local-adapter-lifecycle.test.ts`:
- Around line 160-174: Update the oversized-response test around
probeLocalAdapterHealth so the server sends valid JSON containing the expected
token hash while still exceeding LOCAL_ADAPTER_HEALTH_MAX_RESPONSE_BYTES, rather
than whitespace-only bytes. Keep the assertion that probeLocalAdapterHealth
resolves false, ensuring it fails if the response-size cap is removed.
---
Nitpick comments:
In `@src/lib/inference/local-adapter-lifecycle.ts`:
- Line 235: In the response lifecycle handler around settle, replace the
deprecated res “aborted” event with the “close” event and retain the
!res.complete guard so only incomplete responses settle as unhealthy.
🪄 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: 731dd397-bc46-437a-9398-8d8ae7f4c99f
📒 Files selected for processing (2)
src/lib/inference/local-adapter-lifecycle.test.tssrc/lib/inference/local-adapter-lifecycle.ts
Signed-off-by: Ho Lim <subhoya@gmail.com>
prekshivyas
left a comment
There was a problem hiding this comment.
Maintainer security review: PASS at exact PR SHA fbac40b04e08bb6ab678ceaef4b3cf60c2112abc.
- Secrets and credentials — PASS: no credential value is added, retained, or logged; token verification still compares only the SHA-256 hash.
- Input validation — PASS: declared and streamed response sizes are capped at 64 KiB before JSON parsing, and oversized responses fail closed.
- Authentication and authorization — PASS: the expected-token-hash contract is unchanged, and a malformed or oversized response cannot become healthy.
- Dependencies — PASS: no dependency changed.
- Error handling and logging — PASS: timeout, response abort/error, parse failure, and request error settle once without exposing response contents.
- Cryptography and data protection — PASS: the existing SHA-256 token hashing remains unchanged; this PR adds no cryptographic behavior.
- Configuration and security headers — PASS: no port, origin, image, permission, or runtime configuration changed.
- Security testing — PASS: focused coverage now rejects oversized chunked and declared
Content-Lengthresponses;npx vitest run --project cli src/lib/inference/local-adapter-lifecycle.test.tspassed 15/15. - System security — PASS: retained health-response memory is bounded, buffers are released on overflow, and terminal paths cannot overwrite the first verdict.
No correctness or security findings remain. The CodeRabbit aborted-event note is a non-blocking API-maintenance suggestion; it does not weaken the bounded-memory or fail-closed behavior.
|
Exact-head ordinary CI is green, but credentialed E2E is blocked by the repository's fork-approval environment configuration.
The controller refused to start the plan because |
Signed-off-by: Prekshi Vyas <prekshiv@nvidia.com>
cjagwani
left a comment
There was a problem hiding this comment.
Exact-head maintainer security review — PASS at 15ec6b0c0675fce17f2e398d96af0960ae754530 against base 795de982e26b400009bf1fc0f3826845d79acc4d.
- Secrets and credentials: PASS. Response bodies are never logged, and the existing expected-token-hash comparison remains the only health identity check.
- Input validation: PASS. Both declared and streamed bodies are capped at 64 KiB; oversized, malformed, incomplete, aborted, and errored responses fail closed.
- Authentication and authorization: PASS. No permission or trust boundary changes; an oversized or partial response cannot be classified healthy.
- Dependencies and supply chain: PASS. No dependency, lockfile, image, or download changes.
- Error handling and exposure: PASS. A single-settlement guard prevents later events from overwriting the first terminal verdict without exposing response data.
- Cryptography: PASS. Existing SHA-256 token hashing is unchanged.
- Configuration and infrastructure: PASS. No ports, origins, policies, filesystem permissions, or runtime configuration change.
- Security tests: PASS. Exact-head tests cover streamed overflow, declared overflow before buffering, the exact boundary, incomplete close, and valid/invalid token hashes. Required CI and protected E2E are green.
- System security: PASS. Retained loopback health data is bounded; overflow clears retained chunks and destroys the response.
All 10 commits are GitHub Verified, the current primary advisor reports 0 blockers / 0 warnings / 0 suggestions, and no unresolved current review thread remains. Documentation-writer result is no-docs-needed at this exact head. Diff fingerprint: 58fb9b8d1917563d2dc993efe7d1de8cc685ff7acb41c9a1b12bb29b260dc0be.
prekshivyas
left a comment
There was a problem hiding this comment.
Approved exact head 15ec6b0. All 40 current checks are green; trusted E2E passed inference-routing and network-policy against base 795de98; focused health-probe suite passed 17/17; all commits are GitHub Verified; docs review is no-docs-needed; security review passes all nine categories; no unresolved major/critical findings. GitHub reports MERGEABLE/CLEAN. Per maintainer direction, a newer conflict-free main SHA alone does not require another refresh.
|
Maintainer coordination: exact-head review, CI, and deterministic E2E are in progress for |
Signed-off-by: Prekshi Vyas <prekshiv@nvidia.com>
cjagwani
left a comment
There was a problem hiding this comment.
Exact-head approval after the branch reached the quiet threshold. The production and regression-test patch is byte-for-byte unchanged from previously security-reviewed head 15ec6b0; intervening commits only refresh main and exact-head gate evidence. Deterministic maintainer gate passes with all 40 current checks green, clean merge state, all 14 commits Verified, protected inference-routing and network-policy evidence, and zero advisor findings. The prior nine-category security PASS therefore remains applicable to this exact product diff.
prekshivyas
left a comment
There was a problem hiding this comment.
Approved exact head da824e96f776672036cf0fd93dc6f64c8283148f. This head adds only a signed/Verified empty gate-refresh commit over the reviewed two-file product patch; its product tree is byte-identical to eec44b9e35c4b0a3df00f7b31045311da7ab697c. The hard gate reports allPass: true: all 40 current checks are green; trusted inference-routing and network-policy E2E passed against base 376beb50b6d184675283bdbc4f2eca18d7200a86; focused tests passed 17/17; all 14 commits are Verified; exact-head documentation writer result is no-docs-needed; nine-category security review passes; no unresolved threads; GitHub reports CLEAN/MERGEABLE. No conflict-based refresh is needed.
|
Maintainer coordination: please do not merge |
Signed-off-by: Prekshi Vyas <prekshiv@nvidia.com>
prekshivyas
left a comment
There was a problem hiding this comment.
Maintainer approval for exact head 42224f6. The two-file inference patch remains byte-identical after the signed/Verified base merge and empty gate-refresh commit. All 40 current checks pass; trusted E2E inference-routing and network-policy both pass; focused adapter lifecycle tests pass 17/17; all 16 commits are GitHub Verified; the exact-head documentation-writer receipt is no-docs-needed; the nine-category security review passes; and there are no unresolved review threads. The PR is CLEAN and MERGEABLE. Current main advanced only through #7864 with zero path overlap, and git merge-tree produced a clean tree; per the maintainer direction, no conflict-free currency refresh is required.
<!-- markdownlint-disable MD041 --> ## Summary Adds the canonical July 30 release entry for `v0.0.99` before the release tag is captured. The entry covers all 37 merged PRs since `v0.0.98` and bounds experimental or dormant work without presenting it as supported behavior. ## Changes - Adds `docs/changelog/2026-07-30.mdx` with the exact `## v0.0.99` heading, parser-safe MDX SPDX comment, summary, detailed release bullets, and published documentation routes. - Records user-visible recovery, snapshot, shared-route, Hermes, readiness, inference, image, documentation, and release E2E changes. - States that the managed-image selection and startup-profile contracts remain dormant and do not activate buildless onboarding. Source summary: - [#7972](#7972) -> `docs/changelog/2026-07-30.mdx`: Records restored managed OpenClaw configuration modes during recovery. - [#7834](#7834) -> `docs/changelog/2026-07-30.mdx`: Records clone-bound pairing verification after snapshot restore. - [#7975](#7975) -> `docs/changelog/2026-07-30.mdx`: Records managed startup recovery coverage. - [#7960](#7960) -> `docs/changelog/2026-07-30.mdx`: Records dormant startup-profile coordination without activating a supported surface. - [#7856](#7856) -> `docs/changelog/2026-07-30.mdx`: Records persistence of the credential-free OpenClaw startup command. - [#7959](#7959) -> `docs/changelog/2026-07-30.mdx`: Records dormant startup-profile construction without changing onboarding. - [#7946](#7946) -> `docs/changelog/2026-07-30.mdx`: Records the internal startup-profile schema and transport contract. - [#7951](#7951) -> `docs/changelog/2026-07-30.mdx`: Records platform-pull cleanup before managed-image validation. - [#7949](#7949) -> `docs/changelog/2026-07-30.mdx`: Records rejection of retained Hermes `uv` build cache metadata. - [#7597](#7597) -> `docs/changelog/2026-07-30.mdx`: Records separate command and agent first-turn latency evidence. - [#7931](#7931) -> `docs/changelog/2026-07-30.mdx`: Records focused E2E replacement evidence for retired selectors. - [#7950](#7950) -> `docs/changelog/2026-07-30.mdx`: Records exclusion of build-only BuildKit telemetry from the Deep Agents Code probe. - [#7665](#7665) -> `docs/changelog/2026-07-30.mdx`: Records consolidated priority 2 E2E coverage. - [#7911](#7911) -> `docs/changelog/2026-07-30.mdx`: Records the corrected NVIDIA DORI installation pin. - [#7934](#7934) -> `docs/changelog/2026-07-30.mdx`: Records the staging image-family wait before Brev Launchable deployment. - [#7772](#7772) -> `docs/changelog/2026-07-30.mdx`: Records dormant managed-image selection contracts without activating buildless onboarding. - [#7941](#7941) -> `docs/changelog/2026-07-30.mdx`: Records corrected agent-specific provider and policy guidance. - [#7819](#7819) -> `docs/changelog/2026-07-30.mdx`: Records removal of empty Deep Agents Code provider-switch sections. - [#7932](#7932) -> `docs/changelog/2026-07-30.mdx`: Records independent credential-generation E2E execution. - [#7840](#7840) -> `docs/changelog/2026-07-30.mdx`: Records shared-route preservation and pre-delete peer validation during upgrades. - [#7874](#7874) -> `docs/changelog/2026-07-30.mdx`: Records the split between pre-tag release entries and post-tag Announcements. - [#7876](#7876) -> `docs/changelog/2026-07-30.mdx`: Records the writable Hermes runtime root within lockdown. - [#7756](#7756) -> `docs/changelog/2026-07-30.mdx`: Records validated multi-platform managed-image publication. - [#7914](#7914) -> `docs/changelog/2026-07-30.mdx`: Records accepted `uv` version metadata in Hermes image validation. - [#7686](#7686) -> `docs/changelog/2026-07-30.mdx`: Records the explicitly experimental Microsoft Entra runtime identity reference. - [#7869](#7869) -> `docs/changelog/2026-07-30.mdx`: Records classified gateway relaunch quarantine and rebuild guidance. - [#7814](#7814) -> `docs/changelog/2026-07-30.mdx`: Records state restore into replacement sandboxes and SQLite write verification. - [#7839](#7839) -> `docs/changelog/2026-07-30.mdx`: Records quieter onboarding test execution without a user-facing behavior claim. - [#7854](#7854) -> `docs/changelog/2026-07-30.mdx`: Records generalized agent-selection guidance. - [#7845](#7845) -> `docs/changelog/2026-07-30.mdx`: Records isolated CDI test evidence without a user-facing behavior claim. - [#7843](#7843) -> `docs/changelog/2026-07-30.mdx`: Records the corrected Omni sub-agent model ID. - [#7908](#7908) -> `docs/changelog/2026-07-30.mdx`: Records reviewed Hermes and Deep Agents Code dependency pins. - [#7887](#7887) -> `docs/changelog/2026-07-30.mdx`: Records rejection of a symlinked DGX Station release marker. - [#7747](#7747) -> `docs/changelog/2026-07-30.mdx`: Records the internal compute-driver separation without a user-facing behavior claim. - [#7660](#7660) -> `docs/changelog/2026-07-30.mdx`: Records atomic publication of rebuild recovery manifests. - [#7661](#7661) -> `docs/changelog/2026-07-30.mdx`: Records bounded local inference health-response retention. - [#7654](#7654) -> `docs/changelog/2026-07-30.mdx`: Records state preservation across supervisor relaunch recovery. ## 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) ## Quality Gates - [ ] Tests added or updated for changed behavior - [x] Existing tests cover changed behavior — justification: `test/changelog-docs.test.ts` validates the dated changelog contract, SPDX comment, version heading, and published routes. - [ ] Tests not applicable — justification: - [x] Docs updated for user-facing behavior changes - [ ] Docs not applicable — justification: - [ ] Sensitive paths changed (security, policy, credentials, preflight, onboarding, inference, runner, sandbox, or messaging) - [ ] Sensitive-path review completed or maintainer-approved waiver recorded — reviewer/approval link/justification: - [ ] Non-success, skipped, or missing CI check accepted by maintainer — check name, approval link, and follow-up issue: ## Documentation Writer Review - [x] Documentation writer subagent reviewed the completed changes - Result: `docs-updated` - Evidence: `docs/changelog/2026-07-30.mdx`; the documentation-only diff passed review against `WRITING.md`, the controlled word list, and `docs/CONTRIBUTING.md`. The review covered terminology, structure, active voice, release meaning, product-scope boundaries, and link and code presentation. Changelog tests passed 6/6, and the docs build reported 0 errors with 2 pre-existing warnings. - Agent: Codex CLI <!-- docs-review-head-sha: 200940f --> <!-- docs-review-agents-blob-sha: c052d60 --> ## DGX Station Hardware Evidence - [ ] Tested on DGX Station - Tested commit: - Station profile/scenario: - Result: - Supporting evidence: ## Verification - [x] PR description includes a `Signed-off-by:` line and every commit appears as `Verified` in GitHub - [x] Normal `pre-commit`, `commit-msg`, and `pre-push` hooks passed, or `npm run validate:pr` passed after refreshing `origin/main` when hooks were skipped or unavailable - [x] Targeted behavior tests pass for the current change set, or tests are marked not applicable above — command/result or justification: `npx vitest run test/changelog-docs.test.ts` passed 6/6 tests. - [ ] Applicable broad gate passed — `npm test` for broad runtime/test-harness changes; `npm run check` for repo-wide validation/coverage changes — command/result: Not applicable to this documentation-only release entry. - [x] Quality Gates section completed with required justifications or waivers - [x] No secrets, API keys, or credentials committed - [ ] `npm run docs` builds without warnings (doc changes only) — result: Build passed with 0 errors and 2 pre-existing warnings. - [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) --- Signed-off-by: San Dang <sdang@nvidia.com> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Documentation** * Added release notes for v0.0.99 covering snapshot restoration, sandbox recovery, gateway route upgrades, and Hermes security updates. * Documented experimental Microsoft Entra runtime identity support and enhanced readiness checks. * Added details on managed image validation, trusted CI image promotion, and end-to-end release evidence. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
Summary
Local inference adapter health checks currently retain an unbounded loopback response before validating its token hash. Bound retained health-response data to 64 KiB and fail closed on oversized declared or chunked bodies, so a faulty adapter or port collision cannot grow CLI memory with the response size.
Changes
Content-Lengthvalues before buffering response dataBufferchunks and settle every terminal path onceType of Change
Quality Gates
fbac40b0; all nine categories pass; exact head42224f624revalidated after early-close correctionDocumentation Writer Review
no-docs-neededsrc/lib/inference/local-adapter-lifecycle.tsbounds internal health responses;src/lib/inference/local-adapter-lifecycle.test.tscovers oversized chunked and declared responses; no user-facing contract or output changedDGX Station Hardware Evidence
Verification
Signed-off-by:line and every commit appears asVerifiedin GitHubpre-commit,commit-msg, andpre-pushhooks passed, ornpm run check:diffpassed when hooks were skipped or unavailablenpx --no-install vitest run --project cli src/lib/inference/local-adapter-lifecycle.test.ts(15 passed)npm run checks;npm run build:clinpm run docsbuilds without warnings (doc changes only)Signed-off-by: Ho Lim subhoya@gmail.com
Summary by CodeRabbit