opcode icon indicating copy to clipboard operation
opcode copied to clipboard

Frontend not displaying Claude Code streaming output despite working backend

Open shivanathd opened this issue 1 year ago โ€ข 7 comments

๐Ÿ› 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

shivanathd avatar Jun 29 '25 20:06 shivanathd

I am having the same issue

uptownhr avatar Jun 29 '25 21:06 uptownhr

Same issue here!

siddharthsudheer avatar Jun 29 '25 22:06 siddharthsudheer

Same for me

dreambit avatar Jun 30 '25 08:06 dreambit

the same ,how to deal with

lorenzopapa2 avatar Jul 01 '25 03:07 lorenzopapa2

Same issue. Claude code times out. It answered the first command, but for the second command, it's stuck on a loading spinner.

TradeSlinger avatar Jul 02 '25 16:07 TradeSlinger

Same issue. Intermittent, yet effectively unusable.

ahelme avatar Jul 06 '25 10:07 ahelme

same of me

FlapPearLabs avatar Apr 09 '26 09:04 FlapPearLabs