generated from nhcarrigan/template
fix: comprehensive agent tracking and cleanup improvements
This commit fixes all 4 reported agent tracking bugs and adds comprehensive test coverage: **Bug Fixes:** 1. Agents stuck in "running" state after completion - Added SubagentStop hook parsing in wsl_bridge.rs - Emits claude:agent-end events when SubagentStop hooks detected - Includes 8 new Rust tests for hook parsing 2. Agents persisting after disconnect - Added clearConversation() call on disconnect in tauri.ts - Prevents agents from persisting across sessions 3. "Kill All" button doing nothing - Added markAllErrored() call in AgentMonitorPanel after interrupt - Updates UI state immediately after killing process 4. Badge persisting after closing tab - Added clearConversation() call in conversations.ts deleteConversation() - Properly cleans up agent tracking when tab is closed **Test Coverage:** - Added comprehensive agents.test.ts with 24 new tests - Tests all store methods: addAgent, updateAgentId, endAgent, markAllErrored, clearCompleted, clearConversation, runningAgentCount - Added 8 Rust tests for SubagentStart/Stop hook parsing - All 387 frontend tests pass - All 426 backend tests pass **Documentation:** - Updated CLAUDE.md with comprehensive testing guidelines - Documents coverage goals, console mocking strategies, and E2E integration testing patterns ✨ This fix was implemented with help from Hikari~ 🌸
This commit is contained in:
@@ -52,6 +52,7 @@ All new features, fixes, and significant changes should include tests whenever p
|
||||
### Mocking Strategies
|
||||
|
||||
#### Console Mocking
|
||||
|
||||
When testing code that intentionally logs errors (like error handling paths), mock console methods to prevent stderr output that makes tests appear flaky:
|
||||
|
||||
```typescript
|
||||
@@ -70,6 +71,7 @@ it("handles errors gracefully", async () => {
|
||||
```
|
||||
|
||||
#### E2E Integration Testing for Cross-Platform Code
|
||||
|
||||
For code that calls platform-specific system APIs (like Windows PowerShell or Linux notify-send), use helper functions that build the command structure without execution. This allows CI to verify cross-platform compatibility on Linux-only containers:
|
||||
|
||||
```rust
|
||||
@@ -99,6 +101,7 @@ fn test_e2e_notify_send_command_structure() {
|
||||
```
|
||||
|
||||
This approach:
|
||||
|
||||
- Verifies command structure, argument order, and escaping logic
|
||||
- Tests cross-platform code paths without requiring the target platform
|
||||
- Allows CI to catch regressions in Windows-specific code whilst running on Linux
|
||||
|
||||
Reference in New Issue
Block a user