Skip to content

test: make llama.cpp model replacement deterministic - #12612

Closed
prekshivyas wants to merge 1 commit into
mainfrom
fix/llama-cpp-model-replacement-fixture
Closed

prekshivyas wants to merge 1 commit into
mainfrom
fix/llama-cpp-model-replacement-fixture

Conversation

@prekshivyas

@prekshivyas prekshivyas commented Oct 5, 2026 •

Copy link
Copy Markdown
Collaborator

Outcome

Make the Docker llama.cpp model-identity regression fixtures reliably replace the model file. Three rejection and recovery cases now receive a different inode even when successive writes fall within one filesystem timestamp tick.

Reason

Full prerequisite validation for #12376 found an intermittent failure: the reconstructed lifecycle reached a fresh bridge fixture instead of rejecting the changed model against its durable journal. In 100 diagnostic repetitions, all nine failures coincided with identical device, inode, size, mtime and ctime before and after the same-size overwrite. The test source is unchanged from main.

Related issues

Part of #12376 validation. Retains the model-identity contracts covered for #8395 and #8414.

Changes

  • Use a same-size temporary file and rename it over the model in three model inspection and receipt-recovery fixtures.
  • Share the private bridge fixture between the initial and reconstructed lifecycle, with a healthy baseline assertion before replacement.
  • Preserve the existing exact journal, filesystem-identity and recovery assertions. The separate in-place modification test still forces a timestamp change and verifies rollback.

Verification

  • Isolated Linux execution of the exact committed test source: all 68 tests passed.
  • Diagnostic repetition of each affected case 100 times: all 300 passed. These repetitions used a temporary copy and did not add permanent duplicate tests.
  • Negative control: omitting the rename makes the same-size replacement assertion fail because inspection no longer rejects the unchanged model.
  • Normal signed-commit hooks passed, including repository checks, lint, formatting, secret scanning and code-growth checks.
  • Self-review confirmed a single test-file change with no production changes, assertion removals, timeout increases, secrets or credentials.

The original bootstrap full-suite run remains recorded as failed; these focused results do not claim that it or the original PR's live E2E is green.

Review notes

Sensitive path under src/lib/onboard/**: src/lib/onboard/runtime-provider/docker-llama-cpp-managed-lifecycle.test.ts. Self-review covered NVIDIA/NemoClaw commit 5e1c64da7434d118488f8460052cf6b062945380 against canonical main 766cc036097abce78d888e0d730c33360708d18f. The Linux-tested source matches the committed file byte for byte. The fix strengthens fixture identity while retaining the original rejection outcomes. No independent pre-publication review exists; this draft awaits review.


Signed-off-by: Prekshi Vyas [email protected]

Summary by CodeRabbit

  • Tests
    • Expanded coverage for model replacement, recovery, and reconstruction scenarios. Tests now verify that replacing a model file is detected when its filesystem identity differs from the one recorded during setup.

@prekshivyas prekshivyas self-assigned this Oct 5, 2026
@copy-pr-bot

copy-pr-bot Bot commented Oct 5, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@coderabbitai

coderabbitai Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

🧰 Additional context used
📚 Code guidelines (1)
test/README.md — auto-discovered

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: NVIDIA/NemoClaw/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Enterprise
  • Run ID: 00e9b4f7-3158-47e0-8af2-1f51a3dfe1b3
📥 Commits

Reviewing files that changed from the base of the PR and between 766cc03 and 5e1c64d.

📒 Files selected for processing (1)
  • src/lib/onboard/runtime-provider/docker-llama-cpp-managed-lifecycle.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.


📝 Walkthrough

Walkthrough

The lifecycle tests now replace model files with same-size content by rename. The reconstruction test checks that inspection succeeds before replacement and rejects the replacement when its filesystem identity differs from the durable create journal.

Changes

Managed llama.cpp lifecycle tests

Layer / File(s) Summary
Model replacement and inspection checks
src/lib/onboard/runtime-provider/docker-llama-cpp-managed-lifecycle.test.ts
A shared helper replaces a model file by renaming same-length content into place. Recovery and inspection tests use the helper. The reconstruction test checks inspection before and after replacement and supplies a shared private-bridge fixture to both lifecycle instances.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Other

Suggested reviewers: ericksoa, deepujain

Merge Risk: ⚪ Minimal · up to 5e1c6

This change updates regression tests, not production behavior. The tests exercise the intended model-identity checks, and no merge-blocking issue is established.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: making llama.cpp model replacement deterministic in tests.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@prekshivyas

Copy link
Copy Markdown
Collaborator Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Full review finished.

@github-code-quality

github-code-quality Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Code Coverage Overview

Languages: TypeScript

TypeScript / code-coverage/plugin

The overall line coverage in commit 5e1c64d in the fix/llama-cpp-model-... branch is 97%. The line coverage in commit 63002cd in the main branch is 96%.

Show a line coverage summary of the most impacted files.
File main 63002cd fix/llama-cpp-model-... 5e1c64d +/-
nemoclaw/src/onboard/config.ts 98% 96% -2%
nemoclaw/src/index.ts 94% 93% -1%
nemoclaw/src/bl...t-management.ts 100% 100% 0%
nemoclaw/src/co.../config-show.ts 100% 100% 0%
nemoclaw/src/commands/slash.ts 100% 100% 0%
nemoclaw/src/on...native-route.ts 0% 100% +100%

TypeScript / code-coverage/cli

The overall line coverage in commit 5e1c64d in the fix/llama-cpp-model-... branch is 85%. The line coverage in commit 63002cd in the main branch is 84%.

Show a line coverage summary of the most impacted files.
File main 63002cd fix/llama-cpp-model-... 5e1c64d +/-
src/lib/state/s...tory-restore.ts 86% 0% -86%
src/lib/actions.../status-text.ts 84% 46% -38%
src/lib/state/sandbox.ts 92% 83% -9%
src/lib/onboard...al-inference.ts 84% 90% +6%
src/lib/policy/index.ts 71% 79% +8%
src/lib/state/p...l-retirement.ts 79% 92% +13%
src/lib/onboard.../application.ts 55% 72% +17%
src/lib/adapter...gnostics-cli.ts 0% 87% +87%
src/lib/onboard...ternal-image.ts 0% 94% +94%
src/lib/securit...ig-structure.ts 0% 98% +98%

Updated October 05, 2026 00:58 UTC

@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

PR Review Advisor finished for commit 5e1c64d. Include the Advisor findings in the complete PR feedback collection. Verify and group valid findings before repair.

Request review only when Require no Advisor blockers is green.

All previous runs

@prekshivyas

Copy link
Copy Markdown
Collaborator Author

Closing at the author’s request to consolidate these fixes into DCode PR #12376. The changes are preserved in signed local consolidation commits 7453184 and 7095003; that consolidated update has not yet been pushed. Required installer trust additions are tracked in #12610. The source branch is retained. This closure does not claim that outstanding CI or E2E failures are resolved.

@prekshivyas prekshivyas closed this Oct 5, 2026
@wscurran wscurran added area: local-models Local model providers, downloads, launch, or connectivity platform: container Affects Docker, containerd, Podman, or images labels Oct 6, 2026
prekshivyas added a commit that referenced this pull request Oct 13, 2026
## Outcome

Upgrade managed LangChain Deep Agents Code from 0.1.55 to 0.1.71 with a
hash-locked Python 3.13 dependency graph, updated startup and MCP
behavior, and matching onboarding and runtime validation. Preserve the
existing security, lifecycle, inference, and cleanup requirements.

## Reason

Keep the managed Deep Agents release, dependency lock, startup patches,
and lifecycle contract consistent with Deep Agents Code 0.1.71.

## Changes

- Adapt the Deep Agents image, managed patches, CLI entrypoint, native
startup, persistent environment, and subprocess handling to the pinned
release. Update the Nemotron profile and live version expectations.
- Consolidate the fixture and gateway repairs formerly proposed in
closed #12611, #12612, and #12614. Historical installer fixtures keep
their historical executable reader; process and gateway checks retain
exact ownership and bounded, redacted failure diagnostics.
- For mixed-ownership native state on rootless Podman, complete the
validated wipe as the image's pinned UID/GID 999 after the privileged
pass. The provider rechecks the exact container handle; protected paths,
timeout, final verification, fail-closed registry retention, and the
public destroy assertion remain.
- Bind the Deep Agents base-image, runtime validator, cleanup, and
managed startup contract to one shared UID/GID JSON, resolving the
migration and ownership findings in successive nine-specialist Advisor
reviews.
- Verify the native NVIDIA credential handle inside the OpenClaw sandbox
before redaction, and accept that exact handle in the Hermes E2E config
assertion. Preserve secret suppression and the later inference
assertions. Record scoped, read-only Docker container-discovery evidence
if Model Router onboarding fails.
- Keep the v2 protected activation contract for candidate base-image
builds, the v1 published-base path for older runs, and the existing
assertion ratchet. The source projection, cleanup, deadline, and
inference requirements are not relaxed.

## Verification

Commit under review: `c4131d9db91dc4a9f1904d71e9f5af1c91b2c6a6`; base
`1d76efb8fbb7e10ec5dc2dd431dabc30ce54537e`; trusted E2E workflow
`697289aec2e0c5a1a2b8d2ed5a714b31bb5df4b4`.

**Checks on this commit** (all green):

- [CI](https://github.com/NVIDIA/NemoClaw/actions/runs/38316755721),
[Code
Quality](https://github.com/NVIDIA/NemoClaw/actions/runs/38316751163),
[Code
Scanning](https://github.com/NVIDIA/NemoClaw/actions/runs/38316755897),
DCO, installer hash, docs checks and the codebase-growth guardrails.
- [Managed
Images](https://github.com/NVIDIA/NemoClaw/actions/runs/38316755750),
[Rootless Podman
CPU](https://github.com/NVIDIA/NemoClaw/actions/runs/38316755877) and
[Portable Profile on Rootless
Linux](https://github.com/NVIDIA/NemoClaw/actions/runs/38316755867).
- [PR Review
Advisor](https://github.com/NVIDIA/NemoClaw/actions/runs/38318620078):
all nine specialists clear, no findings, no E2E recommendations, and the
no-blockers gate passed.

**Full default PR E2E** ([run
38327515342](https://github.com/NVIDIA/NemoClaw/actions/runs/38327515342)),
empty selectors, mock inference, no Jetson or Launchable. Final: 77 jobs
succeeded, 5 failed (the three Hermes jobs and protected GPU below, plus
the `Relevant E2E` aggregate, which fails because of them) and 17 were
skipped. The aggregate fails, so no full-suite pass is claimed. These
are workflow job counts, not test counts.

Passed on this commit: the Deep Agents Code repository-install and
deferred-onboarding jobs, MCP bridge for Deep Agents, OpenClaw and
Hermes, protected managed-image startup on amd64 and arm64, and the
credential generation window.

**Comparison with main.** The [full main run
38290099089](https://github.com/NVIDIA/NemoClaw/actions/runs/38290099089)
(`e15557e`) fails the same three jobs with the same assertions. No job
fails on this PR that passes on main.

| Failed job | This PR | Main full run | Same signature |
| --- | --- | --- | --- |
| Hermes E2E (docker) |
[job](https://github.com/NVIDIA/NemoClaw/actions/runs/38327515342/job/115073269954):
`hermes-e2e.test.ts:920`, `configExport.passed` is false |
[job](https://github.com/NVIDIA/NemoClaw/actions/runs/38290099089/job/114959735934):
same assertion | yes |
| Security: Hermes retains the required sandbox posture |
[job](https://github.com/NVIDIA/NemoClaw/actions/runs/38327515342/job/115073273269):
same test and assertion |
[job](https://github.com/NVIDIA/NemoClaw/actions/runs/38290099089/job/114959740568):
same | yes |
| Hermes switches to native NVIDIA |
[job](https://github.com/NVIDIA/NemoClaw/actions/runs/38327515342/job/115073271997):
`hermes-inference-switch.test.ts:228`, PID `2341` versus `1159` |
[job](https://github.com/NVIDIA/NemoClaw/actions/runs/38290099089/job/114959739513):
PID `2341` versus `1160` | yes; only the old PID differs between runs |
| Protected managed-image GPU and local inference |
[job](https://github.com/NVIDIA/NemoClaw/actions/runs/38327515342/job/115080549674):
Ollama and vLLM phases passed; NVIDIA NIM phase failed with `ENOSPC: no
space left on device`; cleanup passed |
[job](https://github.com/NVIDIA/NemoClaw/actions/runs/38290099089/job/114967404868):
Ollama and vLLM passed; NIM phase failed with `No space left on device`
writing `/opt/nim/.cache`; cleanup passed | yes (same phase and cause);
no PR-specific signal |

Main's full run also fails the Hermes Slack credential and channel
stop/start Messaging jobs, which pass here. This PR does not claim to
fix them, and their cause is not established.

The earlier full run on `6672192` (run 38123921937) is superseded by the
run above.

## Remaining qualification

- Protected GPU: Ollama and vLLM qualification passed; the NVIDIA NIM
phase failed on runner disk exhaustion here and on main's full run, so
NIM qualification is not established for this commit. It needs a runner
with enough disk and is not Deep Agents-specific.
- The three Hermes failures above also fail on main with the same
assertions, so they are not introduced by this PR. This PR does touch
some Hermes E2E helpers and fixtures; the identical main signatures are
the evidence they are inherited, and the PR does not claim to fix them.
- Pi qualification receipt digests change in `candidate-authority.ts`
and the two `ci/pi-agent-qualification-v1-*.json` files, refreshed to
match this branch's candidate inputs. Pi inference qualification is
otherwise unrelated to Deep Agents; its known source mismatches are
covered by #12886.
- CodeRabbit skipped this PR ("bot user not eligible"), so it is not
review evidence. Independent human approval is still required.

---
Signed-off-by: Prekshi Vyas <[email protected]>

---------

Signed-off-by: Prekshi Vyas <[email protected]>
Co-authored-by: Prekshi Vyas <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <[email protected]>
@cv
cv deleted the fix/llama-cpp-model-replacement-fixture branch November 21, 2026 20:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: local-models Local model providers, downloads, launch, or connectivity platform: container Affects Docker, containerd, Podman, or images

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants