Skip to content

Adopt Gemma 4 E4B as the locked native model (supersedes ADR-046's Ministral 8B lock) #1636

Closed

Description

@malibio

Overview

packages/desktop-app/src-tauri/tests/ai_chat_send_to_idle_test.rs (the ADR-048 Tauri-seam e2e AI-chat test that runs in the pre-push gate) was hardcoded to use ministral-3b-q4km (Ministral-3-3B-Instruct-2512-Q4_K_M.gguf) as "the fastest available real model." It reproducibly stalls: the daemon's inference turn never produces a single assistant token, and the test times out at 300s with assistant_count=0 — every time. This is a different failure class from the load-sensitive flakiness already fixed in #1610/#1616.

Problem Statement

Running the pre-push gate while landing an unrelated docs-only change (#1529 Phase 2, a SKILL.md-only diff) failed identically three times in a row on this one test:

ai-chat turn did not reach idle-with-new-reply within 300s; last status="idle", assistant_count=0
  • System load average was quiet during at least one of the runs (1.69 / 2.02 / 1.80 on a 10-core machine — well below the ~10.5 load that caused ADR-048 Tauri-seam e2e tests flake under machine load with daemon-health timeouts #1610's flakiness), ruling out CPU contention as the cause.
  • The model file is present on disk (~/.nodespace/models/Ministral-3-3B-Instruct-2512-Q4_K_M.gguf, ~2GB), so the test's model_file_available skip-check was not silently skipping it — the turn genuinely ran and genuinely produced zero tokens.
  • Isolating the cause: temporarily swapping the test's MODEL_ID/MODEL_FILENAME constants to ministral-8b-q4km (Ministral-3-8B-Instruct-2512-Q4_K_M.gguf, also present on disk) and re-running just that test directly passed cleanly (31-44s) across two separate runs.

The stall is specific to ministral-3b-q4km (or its GGUF file) on this machine — not a test-harness bug, not the #1610 load-flake class, and unrelated to #1529's daemon/CLI/schema changes.

Architecture Impact

ADR-046 ("Ministral 8B Is the Locked Native Model") already decided that ministral-8b-q4km is the only model locked to the native llama.cpp path — chosen specifically because it's the one model that passes NodeSpace's full agent tool-call matrix (12/12). ministral-3b-q4km is not the locked native model and was never validated against that matrix; this test's choice of the 3B model as "fastest available real model" for a smoke test predates or was made independently of that decision. This issue does not reverse ADR-046 — the interim fix below (switching the test to 8B) actually aligns the test with the already-decided native model, rather than diverging from it. No companion nodespace-docs change is required.

Interim Fix Landed

As part of #1529, the test's hardcoded model was switched from ministral-3b-q4km to ministral-8b-q4km (the ADR-046-locked native model) so the pre-push gate is unblocked. This is a workaround for the gate, not a fix for the underlying 3B stall — the root cause below is still open.

Acceptance Criteria

  • Root cause of the ministral-3b-q4km generation stall is identified (corrupted/incompatible GGUF file, a chat-template or tokenizer discrepancy specific to the 3B checkpoint, or a llama.cpp inference-path bug that only manifests on this weights file)
  • Either the 3B model is fixed and re-verified against a manual ai-chat turn, or a decision is recorded that the 3B model is not viable and should be removed from the catalog / no longer offered
  • Code passes bun run quality:fix; tests pass

Technical Specifications

Reference Files

  • ai_chat_send_to_idle_test.rs: packages/desktop-app/src-tauri/tests/ai_chat_send_to_idle_test.rs — the e2e test that surfaced the stall; already switched to ministral-8b-q4km as an interim fix
  • model_manager.rs: packages/agent/src/local_agent/model_manager.rs — CATALOG entries for ministral-3b-q4km and ministral-8b-q4km; compare chat template / generation config between the two entries

Suggested Investigation

  • Re-download and checksum-verify Ministral-3-3B-Instruct-2512-Q4_K_M.gguf — a corrupted GGUF would explain a silent generation stall with no error surfaced.
  • Diff the ministral-3b-q4km catalog entry against ministral-8b-q4km for any chat-template, context-size, or generation-parameter difference that could cause the smaller model to hang rather than generate.
  • Reproduce independently of the Tauri test harness — e.g. nodespace model load ministral-3b-q4km then drive a manual ai-chat turn via scripts/aichat.sh — to confirm the stall isn't specific to the Tauri command layer (the reproduction here already used the real Tauri command layer, so this is a secondary check, not the primary lead).

Related Issues

Activity

  1. added
    bug
    on Jul 11, 2026
  2. added a commit that references this issue on Jul 11, 2026
  3. malibio commented on Jul 11, 2026

    @malibio
    CollaboratorAuthor

    Correction/addendum to the original report: the ministral-8b-q4km swap is NOT fully deterministic either. After landing the swap, the pre-push gate hit the identical failure mode once more — assistant_count=0 at the 300s timeout — on a quiet machine (load average ~1.7) with 8B already in place. Re-running the same test in isolation immediately after passed cleanly in 30s, and a second full-gate push attempt right after that passed too.

    So the accurate claim is: ministral-3b-q4km stalls to 0 tokens on every single observed run (4/4). ministral-8b-q4km is meaningfully more reliable (passed 3 of 4 full-gate attempts, plus 2 isolated runs) but flaked once under full-suite contention, consistent with the same class of load/contention sensitivity #1610 already documented for this suite generally — just with a longer tail than #1610's fix fully closed out, or a model-loading-under-contention edge case specific to this test's EnsureModelReady + inference sequencing.

    Doesn't change the interim fix (8B stays as the test's model) or the root-cause investigation scope for the 3B stall specifically, but the acceptance criteria here should probably also cover: confirm whether 8B's occasional stall under full-gate contention is the same root cause as the 3B deterministic stall (shared code path issue) or a separate, purely load-related flake that #1610/#1616 didn't fully eliminate for this specific test.

  4. added 2 commits that reference this issue on Jul 12, 2026
  5. malibio commented on Jul 12, 2026

    @malibio
    CollaboratorAuthor

    Baseline (worktree issue-1636-gemma4-native-model): Frontend 159 test files / 4031 tests passed. Scope redirected per user direction: this issue now covers adopting Gemma 4 E4B as the native/locked model (superseding ADR-046's Ministral 8B lock), not the ministral-3b-q4km stall root-cause. Gemma 4 E4B scored 10/12 on the aichat-matrix tool-call eval (fails: query-tool phrasing mismatch on 'list all', incomplete update turn missing the update_node follow-up) — tracked as follow-up, not blocking.

  6. changed the title [-]ministral-3b-q4km stalls to 0 tokens generated (300s timeout) independent of machine load[/-] [+]Adopt Gemma 4 E4B as the locked native model (supersedes ADR-046's Ministral 8B lock)[/+] on Jul 12, 2026
  7. malibio commented on Jul 12, 2026

    @malibio
    CollaboratorAuthor

    Scope redirected

    Per direction this session, this issue no longer investigates the ministral-3b-q4km generation stall. Instead: adopt Gemma 4 E4B (gemma-4-e4b-q4km) as the locked native model, replacing Ministral 8B.

    Why

    Full rationale: ADR-056, which supersedes ADR-046.

    Changes in this PR

    • packages/desktop-app/src-tauri/tests/ai_chat_send_to_idle_test.rs: swapped MODEL_ID/MODEL_FILENAME from Ministral to gemma-4-e4b-q4km
    • packages/agent/src/local_agent/model_manager.rs: recommended_model_id() (the live gRPC 'recommend a model' default used by the CLI and Settings UI model picker) now returns Gemma 4 E4B instead of Ministral 8B. Gemma 4 12B/31B remain parked per ADR-046 — this does not change the RAM-tiered recommended_model_id_for(Gemma4) behavior for those tiers.

    Follow-up (not blocking)

    • Tune skill/tool prompts for Scenario 5 (query-tool selection) and Scenario 6 (incomplete update turn), then re-run the matrix.
    • The original ministral-3b-q4km stall this issue started as is no longer being pursued — Ministral is being phased out as the native default, not fixed. If needed later, the investigation notes upstream in this issue's original body are still valid starting points.
    • llama-cpp-2 crate bump (0.1.146 -> 0.1.151) was attempted and reverted: newer releases removed apply_chat_template_oaicompat/the openai module our Gemma 4 chat-template code depends on. Tracked separately.
  8. added a commit that references this issue on Jul 12, 2026
    7ec77dd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    backendbugtesting

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions