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~ 🌸
Added detailed documentation covering:
- Coverage goal: maintain near-100% test coverage across codebase
- Console mocking strategies for preventing flaky tests
- E2E integration testing approach for cross-platform code
- Guidance for adding tests when developing new features
This documentation ensures future development maintains our excellent
test coverage and follows established testing patterns.
Add a SystemClock component that displays the current date and time in
British format. The clock appears in the top control bar (same row as
Clipboard and Actions buttons) and updates every second.
Features:
- Date format: "7 February 2026" (British English)
- Time format: "14:35:42" (24-hour)
- Auto-updates every second via setInterval
- Proper cleanup on unmount using Svelte 5 $effect
- Hover effect with accent colour border
- Positioned with margin-left: auto to align right
Testing:
- Added comprehensive unit tests for date/time formatting logic
- 12 test cases covering edge cases, month boundaries, leap years
- All tests passing with proper local timezone handling
- Updated CLAUDE.md with testing requirements and guidelines
Resolves: #128
## Summary
This PR resolves several critical bugs that were blocking the permission modal and causing config loss:
- **Permission modal not appearing** - Fixed z-index issues and runtime errors
- **Config store race condition** - Resolved critical race condition causing settings to be lost
- **Excessive logging** - Removed redundant fmt layer that was writing to hidden stdout
- **System tool prompts** - Prevented unnecessary permission prompts for built-in tools
- **Permission batching** - Added support for parallel permission requests
- **ExitPlanMode tool** - Fixed ExitPlanMode tool not functioning correctly
## Changes Made
### Permission Modal Fixes
- Updated z-index to proper value (9999) to ensure modal appears above all other UI elements
- Fixed runtime errors that were preventing modal from rendering
- Resolved issues with permission grants not being properly applied
### Config Store Race Condition
- Fixed critical race condition where multiple rapid config updates would result in lost settings
- Ensured config writes are properly sequenced to prevent data loss
- Added proper synchronisation for config store operations
### Logging Cleanup
- Removed redundant fmt formatting layer that was outputting to hidden stdout
- Cleaned up excessive debug logging added during troubleshooting
- Removed temporary debugging documentation files
### UX Improvements
- Added close confirmation modal with minimise to tray option
- Implemented batching for parallel permission requests
- Added debug console for viewing frontend and backend logs
### ExitPlanMode Fix
- Fixed ExitPlanMode tool not functioning correctly, ensuring proper transitions out of plan mode
## Issues Resolved
Closes#112 - Permission flow now properly handles multiple tool requests
Closes#113 - ExitPlanMode tool now functions correctly
Closes#126 - Debug console feature added (partial - basic implementation complete)
## Test Plan
- [x] Permission modal appears and functions correctly
- [x] Config settings persist across app restarts
- [x] No excessive logging in production builds
- [x] System tools don't trigger permission prompts
- [x] Parallel permission requests are properly batched
- [x] Debug console displays frontend and backend logs
- [x] ExitPlanMode properly exits plan mode
---
✨ This PR was created with help from Hikari~ 🌸
Co-authored-by: Naomi Carrigan <commits@nhcarrigan.com>
Reviewed-on: #127
Co-authored-by: Hikari <hikari@nhcarrigan.com>
Co-committed-by: Hikari <hikari@nhcarrigan.com>