Repository navigation
Description
Overview
Several bugs were discovered during manual verification of #1142 (Gemma 4 + Ministral chat-template paths). The AI chat viewer is non-functional due to a combination of a missing gRPC service registration, a property-flattening gap in the dev proxy, and a viewer reactivity issue. The model manager also has status display bugs.
Problem Statement
1. LocalAgentService not registered in daemon gRPC server
`packages/daemon/src/main.rs` builds a `ServiceBundle` and registers several gRPC services, but never adds `LocalAgentServiceServer`. As a result, `LocalAgentService/ListModels`, `LoadModel`, `DownloadModel`, and all other model-management RPCs return `Unimplemented`. The model manager UI therefore cannot list or load models.
Fixed in this session — `LocalAgentServiceImpl` is now constructed in `build_services()` and registered in both the headless and tray server blocks.
2. Dev proxy returns namespaced properties instead of flat properties
`packages/dev-tools/src/dev-proxy.ts` — `nodeDataToApiNode()` parses the raw JSON string from gRPC but returns it as-is (e.g. `{ "ai-chat": { "provider": "native" } }`). The Tauri Rust layer runs `flatten_properties_for_api()` to extract the type namespace before sending to the frontend, but the proxy has no equivalent. So in browser dev mode, `node.properties.provider` is always `undefined`, and the AI chat viewer is permanently stuck on the placeholder.
Fixed in this session — added `flattenProperties(nodeType, raw)` to `nodeDataToApiNode()` in the proxy, mirroring the Rust logic.
3. AI chat viewer stuck on placeholder after provider selection (Tauri)
In the Tauri app, even after `provider: 'native'` is persisted to the DB (confirmed via grpcurl), the `AiChatNodeViewer` still renders the placeholder. The `$derived` for `provider` reads `node?.properties?.provider` which should be `'native'` after `flatten_properties_for_api` — but the viewer does not re-render. Root cause not yet confirmed; likely a Svelte 5 reactivity issue on initial hydration from the watcher path or a guard in `setNode` blocking the update.
Not yet fixed.
4. Model download status never transitions to "ready"
After a download completes (confirmed in daemon logs: "Download complete"), the model manager UI continues to show "downloading" status. The daemon emits no event to signal completion back to the frontend event stream, so the UI never refreshes the status row.
5. Model shows "Error" status before/during download
When a model download is triggered, the UI briefly (or persistently) shows "Error" for that model row before the download event stream begins. This appears to be a race between the optimistic status update and the first progress event.
6. Daemon startup timeout too short for embedding model load
`packages/desktop-app/src-tauri/src/daemon_setup.rs` — `wait_for_daemon()` uses a 5-second timeout. On first launch, `nodespaced` must load `nomic-embed-text` before it binds the gRPC socket, which takes 6–8 seconds. The Tauri app therefore fails to connect on cold start ("nodespaced did not respond within 5s") and falls back to showing a disconnected state, even though the daemon successfully starts shortly after.
Acceptance Criteria
- `LocalAgentService` is registered in the daemon — model list, download, and load RPCs return results (not `Unimplemented`)
- Dev proxy `nodeDataToApiNode()` returns flat properties matching the Tauri Rust shape
- AI chat viewer in Tauri renders `AiChatModelPicker` when `properties.provider === 'native'` — no manual workaround needed
- Model download status transitions from "downloading" → "ready" in the UI after the daemon confirms completion
- No "Error" flash shown on a model row when a valid download is triggered
- Daemon startup timeout extended (or made adaptive) so cold-start embedding model load does not cause a connection failure
Technical Specifications
Files Modified in This Session (items 1 & 2 already fixed)
- Daemon gRPC registration: `packages/daemon/src/main.rs` — `LocalAgentServiceImpl` added to `ServiceBundle`, registered in both `serve_grpc` blocks
- Dev proxy flattening: `packages/dev-tools/src/dev-proxy.ts` — `flattenProperties(nodeType, raw)` added to `nodeDataToApiNode()`
Files Needing Work (items 3–6)
- Viewer reactivity: `packages/desktop-app/src/lib/components/viewers/ai-chat-node-viewer.svelte` lines 103–112 — `$derived` for `provider` / `isMessageProvider`
- Download status: `packages/agent/src/local_agent/model_manager.rs` — download completion event emission; `packages/daemon/src/services/local_agent_service.rs` — streaming response after download
- Daemon timeout: `packages/desktop-app/src-tauri/src/daemon_setup.rs` — `wait_for_daemon()` timeout constant
Root Cause References
- `flatten_properties_for_api` in `packages/desktop-app/src-tauri/src/types.rs:502` — Rust reference implementation for property flattening
- `nodeDataToApiNode` in `packages/dev-tools/src/dev-proxy.ts:204` — proxy equivalent (now fixed)
- `selectProvider` in `ai-chat-node-viewer.svelte:114` — guard `if (p === provider) return` may fire incorrectly
- `setNode` in `shared-node-store.svelte.ts:1320` — skip-while-editing guard may block hydration update
Related Issues
- Verify Gemma 4 and Mistral chat-template path on real Apple Silicon hardware (follow-up to #1094) #1142 (parent — Gemma 4 verification, blocked by items 3–6)
Activity
malibio commentedon May 31, 2026
Frontend baseline: 132 files, 3836 tests passed. Starting work on items 3–6 (viewer reactivity, download status, error flash, daemon timeout).
Fix AI chat viewer and model manager bugs found during Gemma 4 verifi…
Fix AI chat viewer and model manager bugs found during Gemma 4 verifi…