Frontend not displaying Claude Code streaming output despite working backend
Problem Description Claudia's frontend shows an infinite loading spinner when executing Claude Code commands, even though the backend Rust code is working perfectly and Claude Code commands execute successfully. Expected Behavior
Claude Code output should stream in real-time in the Claudia UI User should see command responses, tool use, and final results Loading spinner should stop when command completes
❌ Actual Behavior
Infinite loading spinner with no output displayed Commands execute successfully in background (verified in logs) Frontend never shows Claude's responses Only way to see output is through terminal debug logs
Environment
OS: macOS (Apple Silicon) Claudia Version: 0.1.0 Claude Code: Working (tested independently) Build: Custom build with PATH fix applied
Steps to Reproduce
Start Claudia from Terminal: /Applications/Claudia.app/Contents/MacOS/claudia Create or continue a Claude Code session Send any command (e.g., "check if netlify.toml exists") Observe infinite spinner in UI despite successful execution in logs
Technical Analysis ✅ Backend Working Correctly The Rust backend (src-tauri/src/commands/claude.rs) is functioning perfectly: rust// Backend properly spawns Claude with streaming let mut child = cmd.spawn().map_err(|e| format!("Failed to spawn Claude: {}", e))?;
// Correctly emits session-specific events
app.emit(&format!("claude-output:{}", session_id), &line);
app.emit(&format!("claude-error:{}", session_id), &line);
app.emit(&format!("claude-complete:{}", session_id), status);
// Also emits generic events for backward compatibility app.emit("claude-output", &line); app.emit("claude-error", &line); app.emit("claude-complete", status); Verified Working Backend Logs [2025-06-29T20:01:27Z INFO claudia::commands::claude] Spawned Claude process with PID: Some(54091) and session ID: claude-1751227287324-98577d0f-75d4-4a9f-89e4-a6487083e625
[2025-06-29T20:01:42Z DEBUG claudia::commands::claude] Claude stdout: {"type":"assistant","message":...}
[2025-06-29T20:01:56Z INFO claudia::commands::claude] Claude process exited with status: exit status: 0 Cost/Duration: $0.47, 21 seconds, 781 output tokens - Command completed successfully ❌ Frontend Issue The React frontend (in src/ directory) is not properly:
Listening to session-specific events like claude-output:{session_id} Updating the UI with streamed output Stopping the loading spinner when claude-complete:{session_id} is received
Root Cause Event listener mismatch between what the backend emits and what the frontend listens for:
Backend emits: claude-output:claude-1751227287324-... Frontend probably listens for: claude-output (generic)
️ Suggested Fix Option 1: Fix Frontend Event Listeners Update React components to listen to session-specific events: typescript// Instead of: listen('claude-output', callback);
// Use:
listen(claude-output:${sessionId}, callback);
listen(claude-error:${sessionId}, errorCallback);
listen(claude-complete:${sessionId}, completeCallback);
Option 2: Backend Emit Generic Events Only
Modify spawn_claude_process() to only emit generic events if that's what frontend expects.
Option 3: Dual Event Listening
Frontend listens to both session-specific AND generic events for backward compatibility.
Testing Done
✅ Verified Claude Code works independently ✅ Confirmed backend spawns processes correctly ✅ Validated event emission in Rust logs ✅ Tested with multiple commands (all show same issue) ✅ Process cleanup working (no zombie processes)
Files Involved
Backend: src-tauri/src/commands/claude.rs (working) Frontend: React components handling Claude Code sessions (needs investigation) Event system: Tauri event listeners in frontend
Impact
High: Users cannot see Claude Code output Workaround: Check terminal logs for actual responses Functionality: Commands work but UI is unusable
Additional Context
First command in a session works sometimes Subsequent commands always show infinite spinner Backend sandboxing and PATH fixes applied successfully --dangerously-skip-permissions flag already implemented in backend
Source: winfunc/opcode