picoclaw/pkg
Hoshina 24e2ed79c0 refactor(bus): fix deadlock and concurrency issues in MessageBus
PublishInbound/PublishOutbound held RLock during blocking channel sends,
deadlocking against Close() which needs a write lock when the buffer is
full. ConsumeInbound/SubscribeOutbound used bare receives instead of
comma-ok, causing zero-value processing or busy loops after close.

Replace sync.RWMutex+bool with atomic.Bool+done channel so Publish
methods use a lock-free 3-way select (send / done / ctx.Done). Add
context.Context parameter to both Publish methods so callers can cancel
or timeout blocked sends. Close() now only sets the atomic flag and
closes the done channel—never closes the data channels—eliminating
send-on-closed-channel panics.

- Remove dead code: RegisterHandler, GetHandler, handlers map,
  MessageHandler type (zero callers across the whole repo)
- Add ErrBusClosed sentinel error
- Update all 10 caller sites to pass context
- Add msgBus.Close() to gateway and agent shutdown flows
- Add pkg/bus/bus_test.go with 11 test cases covering basic round-trip,
  context cancellation, closed-bus behavior, concurrent publish+close,
  full-buffer timeout, and idempotent Close
2026-02-24 12:10:45 +08:00
..
agent refactor(bus): fix deadlock and concurrency issues in MessageBus 2026-02-24 12:10:45 +08:00
auth feat(fmt): Fix formatting 2026-02-20 20:03:11 +02:00
bus refactor(bus): fix deadlock and concurrency issues in MessageBus 2026-02-24 12:10:45 +08:00
channels refactor(bus): fix deadlock and concurrency issues in MessageBus 2026-02-24 12:10:45 +08:00
config fix(security): change gateway default bind to 127.0.0.1 (#393) 2026-02-24 08:54:10 +11:00
constants refactor: replace bool map with set-style map for internal channels (#472) 2026-02-19 11:48:17 +01:00
cron feat(fmt): Run formatters 2026-02-18 21:48:23 +02:00
devices refactor(bus): fix deadlock and concurrency issues in MessageBus 2026-02-24 12:10:45 +08:00
health Add health check endpoints (/health and /ready) for container orchestration liveness and readiness probes. (#104) 2026-02-16 11:53:11 +08:00
heartbeat refactor(bus): fix deadlock and concurrency issues in MessageBus 2026-02-24 12:10:45 +08:00
logger fix: align Docker Go version with go.mod and optimize logger (#596) 2026-02-24 08:52:16 +11:00
media refactor(media): add MediaStore for unified media file lifecycle management 2026-02-24 12:10:45 +08:00
migrate feat: add native Mistral AI provider support 2026-02-22 11:40:21 +04:00
providers fix: remove extra fields from ToolCall JSON serialization 2026-02-22 11:40:21 +04:00
routing feat: add multi-agent routing with declarative bindings 2026-02-13 12:12:33 -03:00
session feat(fmt): Run formatters 2026-02-18 21:48:23 +02:00
skills translate Chinese comments 2026-02-24 10:27:49 +11:00
state feat(fmt): Run formatters 2026-02-18 21:48:23 +02:00
tools refactor(bus): fix deadlock and concurrency issues in MessageBus 2026-02-24 12:10:45 +08:00
utils refactor(channels): unify message splitting and add per-channel worker queues 2026-02-24 12:10:45 +08:00
voice feat(linter): Fix govet linter 2026-02-20 22:35:16 +02:00