mirror of
https://github.com/sipeed/picoclaw.git
synced 2026-07-28 01:27:58 +00:00
b292defd95
Add defer-recover to 11 goroutines across 4 files to prevent ungoroutine panics from crashing the entire process: - pkg/tools/toolloop.go: parallel tool execution - pkg/channels/manager.go: HTTP server (x2), channel registration - pkg/events/subscription.go: concurrent dispatch, timeout handler, watchContext - pkg/tools/shell.go: cmd.Wait, PTY cmd.Wait, PTY read, pipe read Key design decisions: - Recover handlers send fallback values to channels (shell done, subscription done) to prevent deadlocks when the producer panics - PTY cmd.Wait sets session.Status='error' on panic for consistency - toolloop sets ErrorResult on panic so the LLM gets a meaningful response instead of a nil result - subscription.go uses log.Printf to match existing invokeHandler style - Other files use project logger (ErrorCF) with stack traces Refs: FIX-PLAN-0.3.0 #2