Skip to content

fix(hermes): honor Ollama context floor#6767

Open
HwangJohn wants to merge 2 commits into
NVIDIA:mainfrom
HwangJohn:codex/6760-hermes-ollama-context
Open

fix(hermes): honor Ollama context floor#6767
HwangJohn wants to merge 2 commits into
NVIDIA:mainfrom
HwangJohn:codex/6760-hermes-ollama-context

Conversation

@HwangJohn

@HwangJohn HwangJohn commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Summary

NemoHermes Local Ollama onboarding now carries Hermes Agent's 64000-token context floor through daemon setup, model validation, and generated Hermes config. OpenClaw keeps the existing 16384-token Ollama floor, while explicit Hermes NEMOCLAW_CONTEXT_WINDOW values below 64000 fail config generation instead of producing a sandbox that fails on first inference.

Related Issue

Fixes #6760

Changes

  • Add a consumer-specific Ollama context floor helper so OpenClaw remains at 16384 tokens and Hermes uses 64000 tokens.
  • Thread the Hermes floor through Local Ollama systemd override repair, managed Linux/macOS Ollama startup, and model validation.
  • Reject explicit Hermes NEMOCLAW_CONTEXT_WINDOW values below 64000 in config generation.
  • Update Hermes/Ollama docs and troubleshooting guidance for the 64000-token minimum.
  • Add targeted tests across Ollama runtime context, onboarding selection, install startup, systemd override, and Hermes config generation.

Type of Change

  • 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)

Quality Gates

  • Tests added or updated for changed behavior
  • Existing tests cover changed behavior — justification:
  • Tests not applicable — justification:
  • 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: maintainer review requested for onboarding/inference boundary changes; no waiver claimed before review.
  • Non-success, skipped, or missing CI check accepted by maintainer — check name, approval link, and follow-up issue:

Verification

  • PR description includes the DCO sign-off declaration and every commit appears as Verified in GitHub
  • Normal pre-commit, commit-msg, and pre-push hooks passed, or npm run check:diff passed when hooks were skipped or unavailable — local Windows note: npm run check:diff reaches repository checks but the existing runner hits Windows-only spawnSync("tsx.cmd") and executable-bit limitations; manual equivalent repository checks, npx commitlint --from origin/main --to HEAD, and npx prek run --from-ref origin/main --to-ref HEAD --stage pre-push passed.
  • Targeted behavior tests pass for the current change set, or tests are marked not applicable above — command/result or justification: targeted Vitest checks passed for src/lib/inference/ollama-runtime-context.test.ts, src/lib/onboard/ollama-systemd.test.ts, src/lib/onboard/setup-nim-flow.test.ts, src/lib/onboard/setup-nim-ollama.test.ts, src/lib/onboard/install-ollama-macos.test.ts, src/lib/onboard/install-ollama-linux.test.ts, and test/generate-hermes-config.test.ts with the new [All Platforms][Onboard] NemoHermes Ollama onboard reports Ready but hermes inference fails: Ollama context 16384 below Hermes 64K minimum #6760 cases selected.
  • Applicable broad gate passed — npm test for broad runtime/test-harness changes; npm run check for repo-wide validation/coverage changes — command/result:
  • Quality Gates section completed with required justifications or waivers
  • No secrets, API keys, or credentials committed
  • npm run docs builds without warnings (doc changes only) — local Windows note: npm run docs:check-agent-variants, npm run docs:check-routes, and PowerShell-equivalent Fern check passed with 0 errors; full npm run docs does not complete under Windows PowerShell because the existing script uses POSIX FERN_VERSION=$(...) syntax.
  • Doc pages follow the style guide (doc changes only)
  • New doc pages include SPDX header and frontmatter (new pages only)

Signed-off-by: HwangJohn angelic805@gmail.com

Summary by CodeRabbit

  • New Features
    • Hermes now enforces a minimum context window of 64,000 tokens during configuration.
    • Ollama onboarding/model selection can automatically apply a Hermes-specific context-window floor for consistent runtime behavior.
    • Linux/macOS local Ollama install/upgrade flows can request the appropriate context length when needed.
  • Bug Fixes
    • Hermes config generation is blocked when an explicitly set context window is below 64,000.
  • Documentation
    • Updated Hermes onboarding and troubleshooting guidance with the 64,000 minimum and clarified behavior for detected vs explicitly configured values.

@copy-pr-bot

copy-pr-bot Bot commented Jul 13, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 64cd771a-9a98-4a90-b6d8-fedb620fc6a6

📥 Commits

Reviewing files that changed from the base of the PR and between 24a97b8 and dd2cd37.

📒 Files selected for processing (10)
  • agents/hermes/config/build-env.ts
  • src/lib/inference/local.ts
  • src/lib/inference/ollama-runtime-context.ts
  • src/lib/onboard.ts
  • src/lib/onboard/install-ollama-linux.ts
  • src/lib/onboard/install-ollama-macos.ts
  • src/lib/onboard/ollama-systemd.ts
  • src/lib/onboard/setup-nim-flow.ts
  • src/lib/onboard/setup-nim-ollama.ts
  • src/lib/onboard/setup-nim-selection.ts
🚧 Files skipped from review as they are similar to previous changes (10)
  • src/lib/onboard/setup-nim-selection.ts
  • src/lib/onboard/install-ollama-linux.ts
  • src/lib/onboard/setup-nim-flow.ts
  • src/lib/onboard/install-ollama-macos.ts
  • src/lib/inference/local.ts
  • src/lib/onboard.ts
  • src/lib/inference/ollama-runtime-context.ts
  • agents/hermes/config/build-env.ts
  • src/lib/onboard/ollama-systemd.ts
  • src/lib/onboard/setup-nim-ollama.ts

📝 Walkthrough

Walkthrough

Hermes now requires a minimum 64,000-token context window. Local Ollama detection, onboarding state, daemon startup, systemd overrides, model selection, configuration generation, tests, and documentation enforce and propagate this floor.

Changes

Hermes validation and documentation

Layer / File(s) Summary
Hermes minimum validation
agents/hermes/config/build-env.ts, test/generate-hermes-config.test.ts, docs/inference/*.mdx, docs/reference/troubleshooting.mdx
Hermes exports a 64,000-token minimum, rejects smaller explicit context values, and documents Local Ollama behavior.
Runtime floor resolution
src/lib/inference/ollama-runtime-context.ts, src/lib/inference/ollama-runtime-context.test.ts, src/lib/inference/local.ts
Ollama context floors are resolved per agent and applied when adopting daemon-reported context values.

Ollama onboarding propagation

Layer / File(s) Summary
Onboarding floor propagation
src/lib/onboard/..., src/lib/onboard/setup-nim-*, src/lib/onboard/install-ollama-*, src/lib/onboard/ollama-systemd.*
The Hermes floor flows through selection state, model validation, installer commands, systemd overrides, and Ollama startup environment configuration across Linux and macOS.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant SetupNim
  participant OllamaSelection
  participant OllamaSystemd
  participant OllamaRuntime
  SetupNim->>OllamaSelection: provide agent context floor
  OllamaSelection->>OllamaSystemd: configure contextWindowFloor
  OllamaSelection->>OllamaRuntime: apply runtime context floor
  OllamaSystemd->>OllamaRuntime: resolve and write Ollama context length
Loading

Possibly related PRs

  • NVIDIA/NemoClaw#4852: Both modify Ollama runtime-context flooring and related systemd override behavior.
  • NVIDIA/NemoClaw#6873: Both modify Ollama onboarding model-selection contracts and argument propagation.

Suggested labels: area: providers

Suggested reviewers: cjagwani, cv, ericksoa

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 31.03% which is insufficient. The required threshold is 80.00%. 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 is concise and accurately summarizes the main change: Hermes now honors the Ollama context floor.
Linked Issues check ✅ Passed The PR implements the Hermes 64,000-token floor across onboarding, validation, startup, and config generation as required by #6760.
Out of Scope Changes check ✅ Passed The changes stay focused on Hermes/Ollama context-floor handling and related documentation/tests, with no clear unrelated additions.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@github-actions

github-actions Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

E2E Advisor Recommendation

Required E2E: inference-routing, network-policy, onboard-repair, onboard-resume, cloud-onboard
Optional E2E: hermes-e2e

Dispatch hint: inference-routing,network-policy,onboard-repair,onboard-resume,hermes-e2e

Workflow run

Full advisor summary

E2E Recommendation Advisor

Base: target/main
Head: HEAD
Confidence: high

Required E2E

  • inference-routing: Required validation floor: confirm the selected inference provider remains reachable through the advertised host-to-sandbox route after Local Ollama context-window handling changes.
  • network-policy: Required validation floor: confirm the intended Local Ollama route is permitted at the sandbox boundary without unintended egress.
  • onboard-repair: Required validation floor: Local Ollama installation, systemd override repair, and persisted onboarding state must converge after partial or repaired onboarding.
  • onboard-resume: Required validation floor: onboarding must safely resume with the selected provider, model, and runtime-derived context state.
  • cloud-onboard (high): Changed onboard, trace timing, scorecard, or E2E workflow code can affect cloud onboard wall-clock behavior and should refresh the trusted cloud-onboard trace timing signal.

Optional E2E

  • hermes-e2e: Useful adjacent coverage for the Hermes sandbox creation and real assistant inference flow affected by Hermes context-window config generation.

New E2E recommendations

  • assistant-runtime (high): Existing Hermes E2E uses hosted inference and does not exercise Local Ollama onboarding, the 64000-token daemon floor, generated Hermes config, or rejection of an explicit smaller context window.
    • Suggested test: Add a Hermes Local Ollama live onboarding scenario that starts or repairs Ollama with a sub-64000 reported context length, verifies the daemon and generated Hermes config use 64000, then proves an assistant inference turn; include a negative explicit-below-floor configuration assertion.

Dispatch hint

  • Workflow: .github/workflows/e2e.yaml
  • jobs input: inference-routing,network-policy,onboard-repair,onboard-resume,hermes-e2e

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 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 `@docs/reference/troubleshooting.mdx`:
- Line 2419: Update the adjacent shared troubleshooting commands by splitting
them into agent-specific <AgentOnly> blocks: retain OLLAMA_CONTEXT_LENGTH=16384
for OpenClaw and use OLLAMA_CONTEXT_LENGTH=64000 for Hermes. Keep each command’s
existing behavior and agent-specific context unchanged.
🪄 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: efa5bc21-d1b6-4a63-b484-1fcf11b88629

📥 Commits

Reviewing files that changed from the base of the PR and between 3de1de6 and 9d2dca1.

📒 Files selected for processing (20)
  • agents/hermes/config/build-env.ts
  • docs/inference/configure-model-limits.mdx
  • docs/inference/set-up-ollama.mdx
  • docs/reference/troubleshooting.mdx
  • src/lib/inference/local.ts
  • src/lib/inference/ollama-runtime-context.test.ts
  • src/lib/inference/ollama-runtime-context.ts
  • src/lib/onboard.ts
  • src/lib/onboard/install-ollama-linux.test.ts
  • src/lib/onboard/install-ollama-linux.ts
  • src/lib/onboard/install-ollama-macos.test.ts
  • src/lib/onboard/install-ollama-macos.ts
  • src/lib/onboard/ollama-systemd.test.ts
  • src/lib/onboard/ollama-systemd.ts
  • src/lib/onboard/setup-nim-flow.test.ts
  • src/lib/onboard/setup-nim-flow.ts
  • src/lib/onboard/setup-nim-ollama.test.ts
  • src/lib/onboard/setup-nim-ollama.ts
  • src/lib/onboard/setup-nim-selection.ts
  • test/generate-hermes-config.test.ts

Comment thread docs/reference/troubleshooting.mdx Outdated
@HwangJohn HwangJohn force-pushed the codex/6760-hermes-ollama-context branch from 9d2dca1 to 9c7952b Compare July 13, 2026 11:58
Signed-off-by: HwangJohn <angelic805@gmail.com>
@HwangJohn HwangJohn force-pushed the codex/6760-hermes-ollama-context branch from 9c7952b to 24a97b8 Compare July 13, 2026 12:00
@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Caution

Failed to replace (edit) comment. This is likely due to insufficient permissions or the comment being deleted.

Error details
putComment timed out

@wscurran wscurran added area: local-models Local model providers, downloads, launch, or connectivity area: onboarding Onboarding FSM, provider setup, sandbox launch, or first-run flow bug-fix PR fixes a bug or regression integration: hermes Hermes integration behavior labels Jul 13, 2026
@wscurran

Copy link
Copy Markdown
Contributor

✨ Thanks for the fix, @HwangJohn. Honoring the Hermes Ollama context floor should prevent the silent inference failure after onboarding reports Ready. Ready for maintainer review.


Related open issues:


Related open issues:

Signed-off-by: HwangJohn <angelic805@gmail.com>
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 area: onboarding Onboarding FSM, provider setup, sandbox launch, or first-run flow bug-fix PR fixes a bug or regression integration: hermes Hermes integration behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[All Platforms][Onboard] NemoHermes Ollama onboard reports Ready but hermes inference fails: Ollama context 16384 below Hermes 64K minimum

2 participants