Code Review
Also available: Markdown Β· Plain text
Code Review β Gnomad Desktop Assistant
Reviewed: 2026-05-31 (updated after hiring-feedback implementation)
Scope: src/, src-tauri/src/, workflows, agent/security paths
Summary
The app is a Tauri v2 + React 19 desktop assistant: tray/panel, global shortcut, OS context (active window, clipboard), cloud + local LLM chat with an agent tool loop, persistent PTY shell session, filesystem agent tools, Sudo Gate / Path Gate HITL, and structured error payloads end-to-end.
| Area | Status |
|---|---|
Frontend build (npm run build) |
Pass |
Rust tests (cargo test) |
Pass (error, privilege, shell_session) |
| LLM orchestration | Cloud chat_completion_turn + tools; local Ollama + <gnomad-run> fallback |
| Structured errors | GnomadError β JSON in invoke Err(String); frontend parseInvokeError + AgentErrorBanner |
| App shell | App.tsx ~400 lines; hooks + ChatView / SettingsPanel / gate modals |
| Elevation hardening | Pre-flight injection blocks; Linux pkexec argv-only; macOS per-arg escaping |
Architecture (high level)
Tray + Global Shortcut (lib.rs)
β
βΌ
React App shell (App.tsx) ββhooksβββΊ useAgentExecution, useChatSubmit, β¦
β β
βΌ βΌ
ChatView / SettingsPanel ββinvokeβββΊ Tauri commands
βββ agent_runtime / agent_fs
βββ shell_session (PTY)
βββ privilege.rs (safety + elevation)
βββ error.rs (GnomadError payloads)
βββ context, keychain, llm, β¦
Agent error payload contract
Tauri commands still return Result<T, String>. During migration, error strings are JSON matching:
{
"code": "safety_blocked",
"message": "Human-readable summary",
"detail": "Optional technical detail",
"hint": "Optional remediation",
"retryable": false
}
Frontend: src/lib/errors.ts β parseInvokeError, executionFailedLabel, formatErrorForUser.
UI: src/components/AgentErrorBanner.tsx on messages with errorPayload.
Stable code values are covered by error::tests::payload_codes_are_stable.
Strengths
- Module split β Rust agent, shell, privilege, FS; React hooks mirror execution concerns.
- HITL β Sudo Gate and Path Gate with explicit approve/deny.
- Defense in depth β Server-side safety before shell; elevation rejects injection patterns.
- Cross-platform awareness β
platformInfodrives labels and capability flags.
Remaining gaps (priority)
P1 β Security / product
- Wave B error migration β β Shipped on LLM, planner, and chat history paths.
- Windows elevation β Structured
elevation_unsupported; user must use elevated terminal for admin ops. - Path Gate tokens β β Shipped β
path_token.rs; boolean IPC bypass rejected.
P2 β Engineering
- Typed invoke errors β Optional future:
Result<T, AgentErrorPayload>at Tauri boundary once JSON-in-string is stable everywhere. - Vitest β β
parseInvokeErrortests in CI (npm run test). - GGUF planner + local chat β In-process inference via optional
embedded-llmfeature; Ollama remains fallback.
Suggested next steps
- Generate updater signing keys per UPDATER.md and replace the placeholder
pubkeyintauri.conf.json. - End-to-end updater test once signing keys are configured.
- Snap / Flatpak manifests (community packaging).
File reference
| File | Role |
|---|---|
src/App.tsx |
Thin shell, providers wiring |
src/hooks/useAgentExecution.ts |
Shell cwd, gates, executeCommandSafely |
src/hooks/useChatSubmit.ts |
Submit orchestration, agent loop |
src/components/ChatView.tsx |
Messages, composer, context footer |
src-tauri/src/error.rs |
GnomadError, AgentErrorPayload |
src-tauri/src/privilege.rs |
Safety + elevation |
src-tauri/src/shell_session.rs |
PTY session + validation |