Repository navigation
Description
Overview
packages/agent/tests/ollama_integration.rs (gated behind --features testing, requires a live local Ollama server) currently has approximately 17 failing tests, all sharing the same failure mode: the model (mistral:7b) intermittently returns an empty response with no tool calls, where a tool call was expected by the test.
Problem Statement
Running the suite locally with Ollama running and mistral:7b loaded:
cargo test -p nodespace-agent --test ollama_integration --features testingproduces failures like:
thread 'test_pipeline_get_node_by_id' panicked at packages/agent/tests/ollama_integration.rs:1616:5:
Expected get_node for explicit ID lookup, got: []
and
thread 'test_pipeline_search_nodes_keyword' panicked at packages/agent/tests/ollama_integration.rs:1250:10:
send_message should succeed: Engine("model produced empty response with no tool calls")
and
thread 'test_ollama_inference_with_production_prompt' panicked at packages/agent/tests/ollama_integration.rs:345:5:
completion_tokens=0 — looks like context-window truncation (expected > 1). prompt_tokens=0. Check that num_ctx is being sent correctly.
Verified this is not caused by any in-progress work: the same failures reproduce identically on main at commit 4962856b (before any related changes), so this is pre-existing flakiness/regression in the test suite or model-serving path, not a new break.
Currently failing tests (as observed against main@4962856b, mistral:7b, Ollama running locally — some entries may be intermittent rather than deterministic, so a future investigation should re-run and confirm which are consistently failing vs. flaky):
test_ollama_inference_with_production_prompttest_pipeline_delete_nodetest_pipeline_get_node_by_idtest_pipeline_get_related_nodestest_pipeline_multi_turn_session_persistencetest_pipeline_schema_creationtest_pipeline_schema_creation_project_task_relationshiptest_pipeline_schema_creation_title_template_fieldstest_pipeline_schema_creation_with_relationshiptest_pipeline_search_nodes_keywordtest_pipeline_search_nodes_with_type_filtertest_pipeline_task_status_updatetest_pipeline_update_node_contenttest_skill_pipeline_graph_editing_real_modeltest_skill_pipeline_node_creation_real_modeltest_skill_pipeline_node_deletion_real_modeltest_skill_pipeline_research_real_model
Related prior work
- Ollama integration tests don't catch context-window truncation causing empty responses #1443 (closed) — Ollama integration tests didn't catch context-window truncation causing empty responses. Related but distinct: that issue was about test assertions not detecting empty responses; this issue is about the underlying empty responses themselves now happening frequently enough to fail a large fraction of the suite.
- Strengthen Ollama integration test assertions to reject empty responses #1446 (closed) — Strengthened Ollama integration test assertions to reject empty responses. This is likely why these failures are now visible/loud rather than silently passing — worth checking whether the assertion hardening from Strengthen Ollama integration test assertions to reject empty responses #1446 is what's now surfacing a pre-existing model/prompt problem, versus something regressing after Strengthen Ollama integration test assertions to reject empty responses #1446 landed.
Proposed Solution
Not proposed here — this issue is filed to track investigation, not to prescribe a fix. Candidate angles for a future investigation:
- Whether
num_ctx/ context-window sizing is actually being sent correctly to Ollama (thetest_ollama_inference_with_production_promptfailure explicitly suspects this). - Whether the production system prompt (7800 chars, 14 tools per the test output) is too large or ambiguous for
mistral:7bto reliably produce tool calls against. - Whether this is model-version/Ollama-version drift (a
mistral:7bre-pull or Ollama update changing serving behavior) rather than a code change. - Whether these tests are simply too flaky for a 7B local model at this system prompt size, and need a smaller/more constrained test prompt to be reliable.
Acceptance Criteria
- Root cause identified for the empty-tool-call-response failures
- Failing tests from the list above are individually triaged: fixed, confirmed flaky-by-nature (with a documented reason), or the assertion adjusted if the expectation was wrong
- Suite passes reliably (or documented flake tolerance) when re-run with
cargo test -p nodespace-agent --test ollama_integration --features testing - No regression in the rest of the
nodespace-agenttest suite
Technical Specifications
Reference Files
- Test suite:
packages/agent/tests/ollama_integration.rs - Feature gate:
packages/agent/Cargo.toml(testingfeature,required-features = ["testing"]on this test binary) - Local agent engine:
packages/agent/src/local_agent/(system prompt assembly, tool-call parsing, ollama NDJSON reading)
Reproduction
# Ensure Ollama is running with mistral:7b loaded, then:
cargo test -p nodespace-agent --test ollama_integration --features testingNon-Goals
- Not proposing to add this suite to any CI gate — it requires a live local model server and is explicitly excluded from
bun run test:alltoday via thetestingfeature gate.
Activity
malibio commentedon Jul 11, 2026
Frontend baseline: 4031 passed (159 test files), 44.48s
malibio commentedon Jul 11, 2026
Root Cause Analysis
Root-caused via direct Ollama API testing (bypassing all NodeSpace code) plus full test-harness reproduction. Summary:
1. Tool-count ceiling (primary cause, ~13 of the 17 failing tests).
mistral:7breliably fails to emit structuredtool_callsonce ~6+ tools are offered in one turn — it narrates the intended call as prose/JSON-in-markdown instead. Deterministic (not flaky): confirmed identical across 2 full suite runs and 3-5 repeated raw API calls per scenario. Holds regardless of system prompt content (bare fallback prompt, no prompt, or the full 7800-char production prompt all fail identically). Verified model-size correlation:ministral-3:3b(3B) fails worse,mistral:7b(7B) fails,ornith:9b(9B) andmistral-nemo:12b(12B) both succeed reliably at the same 10-tool case.2. Non-deterministic test harness (contributing).
resolve_engine()usedfirst_ollama_model()— whichever model Ollama's/api/tagslists first, which depends on local pull order and isn't reproducible across machines. Fixed: now pins tomistral:7bexplicitly.3. One incorrect assertion (
test_skill_pipeline_organization_real_model, not in original failing list but surfaced once pinned): asserted the model should only callcreate_relationship/get_node, but the real Organization skill'stool_whitelist(seed_skill_nodes) legitimately includessearch_nodes/search_semantic— needed to resolve a collection name to an ID before linking. Assertion was stricter than the skill definition it's meant to mirror. Fixed.4. GPU memory exhaustion (separate, transient issue also encountered). Independently hit
ggml_metal_synchronize: Insufficient Memory (kIOGPUCommandBufferCallbackErrorOutOfMemory)when Ollama allocated a 32768-token KV cache under concurrent memory pressure on a 16GB machine — not a code bug, just a reproducibility hazard on memory-constrained dev machines. Not addressed in code (nothing to fix), noted for awareness.Resolution
resolve_engine()tomistral:7b(deterministic across machines).#[ignore]with detailed reasons documenting the verified tool-count/structured-arg-complexity ceiling — these are real, valuable regression tests that will correctly re-activate if the underlying model/architecture changes; they're not deleted or silently skipped.nodespace-agent's broader test suite (291 unit tests) or the full workspacetest:all(4031 frontend + 979 Rust, all passing).Follow-up
Filed #1634 to track the underlying production gap this surfaced:
GraphToolExecutor::available_tools()sends the full unscoped tool set on every turn for the Ollama provider path, with no dynamic scoping — realmistral:7b-via-Ollama users can hit the same narration failure on ordinary requests. This is a genuine architecture decision (extend ADR-038's skill-mediated routing to the Ollama path, reduce baseline tool count, or document a recommended Ollama model) out of scope for this test-suite triage issue.Note: this does not implicate ADR-046 (Ministral 8B locked as the native llama.cpp path model) — that ADR's evidence and the #1370 agent tool-call matrix only evaluated the native path.
mistral:7bvia Ollama is a separate, real, user-selectable provider path (per #1370's model-picker design) that hadn't previously been evaluated against this specific failure mode.WIP: #1529 Phase 2 — guidance alignment (SKILL.md rewritten against C…
WIP: #1529 Phase 2 — complete, reviewed, addressed; ready for Section 3
Fix search_nodes-vs-execute_query guidance for unfiltered listing req…
WIP: #1529 Section 3 — propagation tooling, ready for review
WIP: #1529 Section 3 — done, reviewed, addressed; ready for Section 4
Align CLI + SKILL.md with local-agent capability and guidance (#1529)…