Repository navigation
Add hardware requirement labels to model selection UI (closes #1140) - #1170
Conversation
- Add `min_memory_gb: u8` to `CatalogEntry` (8/16/16/24 GB for the four catalog entries) - Propagate `min_memory_gb` through `ModelInfo` in `agent_types.rs`, `GgufModelManager::list()`, `OllamaModelManager::list()` (0 = unknown), and the daemon gRPC `ModelEntry` proto field - Add `get_system_ram_gb` Tauri command (exposed via `detect_system_ram()` made public) - Add `min_memory_gb` to TypeScript `ModelInfo` interface - Model manager UI shows "Requires X GB RAM" on every card; dims card and shows "Insufficient RAM" chip when system RAM is below the model's requirement - Extend `list_models_have_correct_metadata` and `list_includes_gemma4_entries_with_correct_metadata` tests with `min_memory_gb` assertions Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Code Review SummaryThis PR cleanly implements the hardware-requirement label feature from issue #1140. Every acceptance criterion is met: `min_memory_gb` flows from the Rust catalog through gRPC/Tauri to the TypeScript type, renders in the UI as "Requires X GB RAM", and cards with insufficient RAM are visually distinguished via dimming + a warning chip. Tests are extended appropriately and the logic is well-guarded (double zero-check prevents false positives when RAM or the field is unknown). The implementation is lean and avoids over-engineering. A few findings to address. FindingsCritical Issues[Critical/Blocker] File: min_memory_gb: entry.min_memory_gb as u8,`entry.min_memory_gb` is a `u32` from the protobuf `ModelEntry`. Casting directly to `u8` silently wraps for values ≥ 256. While current catalog values are all ≤ 24, this is a latent correctness bug. The field on the Rust `ModelInfo` struct is already `u8`, so the narrowing is necessary — but it should be explicit: min_memory_gb: entry.min_memory_gb.try_into().unwrap_or(u8::MAX),or at minimum: min_memory_gb: entry.min_memory_gb.min(u8::MAX as u32) as u8,Suggested Improvements[Improvement] `detect_system_ram` is now `pub` — this leaks an implementation detail File: The function was made `pub` solely to expose it to `chat_models.rs` in the desktop crate. This punches a hole in the module boundary: any consumer of the `nodespace_agent` crate can now call a low-level sysinfo wrapper directly. Consider one of:
[Improvement] Ollama models hardcode `min_memory_gb: 0` (unknown) — document the rationale in code File: The issue itself acknowledges this decision and proposes an alternative (`Option<u8>`). The PR chose `0` as the sentinel, which is fine, but the comment in the struct definition (`agent_types.rs`) and here diverges from the issue's suggestion of defaulting to 16 GB for Ollama. A brief inline comment at the `0` assignment explaining the intentional choice ("Ollama manages its own model loading; memory footprint is not tracked by the catalog") would prevent future contributors from treating it as an oversight. [Improvement] `systemRamGb` is not fetched in the non-Tauri mock path File: The mock path does not set `systemRamGb`, so it stays `0` in development mode, meaning the "Insufficient RAM" chip never renders during browser-based dev work even though the mock models all have `min_memory_gb > 0`. For local development fidelity, consider seeding a plausible value (e.g., 8) so the UI behavior can be exercised without a live Tauri process. Nitpicks
VerdictThe Critical finding (silent u8 truncation) must be fixed before merge. The improvement suggestions are non-blocking but the `detect_system_ram` visibility point is worth addressing to preserve module hygiene. Everything else is polish. |
…eed mock RAM - Fix silent truncation: use .min(u8::MAX as u32) as u8 for proto u32→u8 cast - Add comment on min_memory_gb: 0 sentinel for Ollama models - Seed systemRamGb = 8 in mock path so warning chip is visible in non-Tauri dev mode Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
…1170) * Add hardware requirement labels to model selection UI (closes #1140) - Add `min_memory_gb: u8` to `CatalogEntry` (8/16/16/24 GB for the four catalog entries) - Propagate `min_memory_gb` through `ModelInfo` in `agent_types.rs`, `GgufModelManager::list()`, `OllamaModelManager::list()` (0 = unknown), and the daemon gRPC `ModelEntry` proto field - Add `get_system_ram_gb` Tauri command (exposed via `detect_system_ram()` made public) - Add `min_memory_gb` to TypeScript `ModelInfo` interface - Model manager UI shows "Requires X GB RAM" on every card; dims card and shows "Insufficient RAM" chip when system RAM is below the model's requirement - Extend `list_models_have_correct_metadata` and `list_includes_gemma4_entries_with_correct_metadata` tests with `min_memory_gb` assertions Co-Authored-By: Claude Sonnet 4.6 <[email protected]> * Address review findings: fix u32→u8 truncation, add Ollama comment, seed mock RAM - Fix silent truncation: use .min(u8::MAX as u32) as u8 for proto u32→u8 cast - Add comment on min_memory_gb: 0 sentinel for Ollama models - Seed systemRamGb = 8 in mock path so warning chip is visible in non-Tauri dev mode Co-Authored-By: Claude Sonnet 4.6 <[email protected]> --------- Co-authored-by: Michael Libio <[email protected]> Co-authored-by: Claude Sonnet 4.6 <[email protected]>
Summary
min_memory_gbfield toCatalogEntryandModelInfo(8 GB Ministral 3B, 16 GB Ministral 8B / Gemma 4 E4B, 24 GB Gemma 4 31B)GgufModelManager::list(),OllamaModelManager::list()(0 = unknown), daemon gRPCModelEntryproto, and TypeScriptModelInfointerfaceget_system_ram_gbTauri command using the existingdetect_system_ram()function (now public)list_models_have_correct_metadataandlist_includes_gemma4_entries_with_correct_metadatatests withmin_memory_gbassertionsTest plan
model_managertests: 33 passed, 0 failedbun run quality:fixpassed cleannodespace-agentandnodespace-daemoncompile clean (cargo check)🤖 Generated with Claude Code