picoclaw/pkg
Hoshina afc7a1988f 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-23 00:44:45 +08:00
..
agent refactor(bus): fix deadlock and concurrency issues in MessageBus 2026-02-23 00:44:45 +08:00
auth enable misspell 2026-02-25 21:14:19 +11:00
bus refactor(bus): fix deadlock and concurrency issues in MessageBus 2026-02-23 00:44:45 +08:00
channels refactor(bus): fix deadlock and concurrency issues in MessageBus 2026-02-23 00:44:45 +08:00
config config: change default dm_scope to per-channel-peer 2026-02-26 16:51:18 +08: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-23 00:44: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-23 00:44:45 +08:00
logger enable prealloc 2026-02-25 21:31:07 +11:00
media refactor(media): add MediaStore for unified media file lifecycle management 2026-02-22 23:27:55 +08:00
migrate Merge pull request #677 from yinwm/refactor/model-to-model-name 2026-02-24 19:05:40 +08:00
providers fix(providers): support per-model request_timeout in model_list (#733) 2026-02-26 19:08:19 +11: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 Perf/precompile regex (#687) 2026-02-26 20:44:03 +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-23 00:44:45 +08:00
utils refactor(channels): unify message splitting and add per-channel worker queues 2026-02-22 22:46:29 +08:00
voice feat(linter): Fix govet linter 2026-02-20 22:35:16 +02:00