From 29c6b252a923f6a5ac423e1cf13ed35e82a2dae0 Mon Sep 17 00:00:00 2001 From: Auto Date: Thu, 22 Jan 2026 09:39:24 +0200 Subject: [PATCH] fix: correct SDK import and clear stale agent UI on stop Changes: - Revert incorrect import from claude_code_sdk to claude_agent_sdk in agent.py (PR #50 introduced an undocumented change to a deprecated package) - Clear activeAgents and recentActivity in useWebSocket when agent stops to prevent stale UI state The claude_code_sdk package is deprecated (last updated Sep 2025) while claude_agent_sdk is the active, maintained package. The import change in PR #50 was undocumented and would have caused ImportError since only claude-agent-sdk is specified in requirements.txt. Co-Authored-By: Claude Opus 4.5 --- agent.py | 2 +- ui/src/hooks/useWebSocket.ts | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/agent.py b/agent.py index ebe12e3..efff621 100644 --- a/agent.py +++ b/agent.py @@ -14,7 +14,7 @@ from pathlib import Path from typing import Optional from zoneinfo import ZoneInfo -from claude_code_sdk import ClaudeSDKClient +from claude_agent_sdk import ClaudeSDKClient # Fix Windows console encoding for Unicode characters (emoji, etc.) # Without this, print() crashes when Claude outputs emoji like ✅ diff --git a/ui/src/hooks/useWebSocket.ts b/ui/src/hooks/useWebSocket.ts index cec2bf7..95ad084 100644 --- a/ui/src/hooks/useWebSocket.ts +++ b/ui/src/hooks/useWebSocket.ts @@ -112,6 +112,8 @@ export function useProjectWebSocket(projectName: string | null) { setState(prev => ({ ...prev, agentStatus: message.status, + // Clear active agents when process stops to prevent stale UI + ...(message.status === 'stopped' && { activeAgents: [], recentActivity: [] }), })) break