Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
MUL-7705 docs(channels): correct comments main's own later changes made false (#8833)
Xichang(Seacen) Zhao005462ec22fc
diff --git a/server/cmd/server/router.go b/server/cmd/server/router.goindex dc660efa19..4b51872561 100644--- a/server/cmd/server/router.go+++ b/server/cmd/server/router.go@@ -1144,17 +1144,17 @@ func NewRouterWithOptions(pool *pgxpool.Pool, hub *realtime.Hub, bus *events.Bus}slog.Info("wecom integration enabled (smart bot, long connection)")- // SINGLE-REPLICA CONSTRAINT: WeCom outbound (agent replies +- // inbox pushes) is delivered only by the replica holding each- // bot's in-process WebSocket lease. On a multi-replica- // deployment, an EventChatDone/EventInboxNew published on another- // replica cannot reach the lease holder, so those replies are- // dropped. This is stated conditionally rather than gated on a- // replica-count signal: the server has no reliable count here,- // and REDIS_URL means "Redis configured" (it also gates rate- // limiting), not "more than one replica". See wecom/outbound.go- // and SELF_HOSTING.md. Remove once outbound routes to the lease- // holder.+ // REPLICA TOPOLOGY: WeCom outbound (agent replies + inbox+ // pushes) is written only by the replica holding each bot's+ // in-process WebSocket lease. With a sharded/dual realtime relay,+ // an EventChatDone/EventInboxNew published on another replica is+ // forwarded to the lease holder; without one (legacy relay mode,+ // or no Redis) it cannot reach the lease holder and is dropped,+ // so the backend has to run as a single replica. This is stated+ // conditionally rather than gated on a replica-count signal: the+ // server has no reliable count here, and REDIS_URL means "Redis+ // configured" (it also gates rate limiting), not "more than one+ // replica". See wecom/outbound.go and SELF_HOSTING.md.if opts.WecomRelayOutbound != nil {slog.Info("wecom integration: cross-replica outbound routing enabled — agent replies and inbox pushes produced on a replica that does not hold the bot's WebSocket lease are forwarded to the lease holder over the realtime relay. A reply produced while NO replica holds a live connection (every one mid-reconnect) is still lost; see wecom/relay_outbound.go.")} else {diff --git a/server/internal/integrations/slack/typing_indicator.go b/server/internal/integrations/slack/typing_indicator.goindex a4faef3145..5aea627a29 100644--- a/server/internal/integrations/slack/typing_indicator.go+++ b/server/internal/integrations/slack/typing_indicator.go@@ -264,9 +264,22 @@ func (m *TypingIndicatorManager) handleEvent(e events.Event) {}// chatSessionIDFromEvent recovers the chat session id from a task-lifecycle-// event. EventChatDone sets it on the envelope; EventTaskFailed carries it only-// in the broadcast payload map (chat tasks only), so both are checked.-// Every EventTaskCancelled publisher sets both.+// event.+//+// The envelope is where all three types carry it for a chat task:+// EventChatDone through service.broadcastChatDone, and EventTaskFailed and+// EventTaskCancelled through service.taskEvent, which stamps e.ChatSessionID+// and the chat_session_id payload key together. (The sweeper's own task:failed+// envelope does the same.) EventTaskFailed is not the payload-only exception+// this comment used to call it — it goes through the same builder as+// EventTaskCancelled.+//+// The payload read is a second look, not a fallback any current publisher+// needs, and only the two task events can satisfy it: EventChatDone's payload+// is a protocol.ChatDonePayload struct, not a map, so for chat:done the+// envelope is the only place this function finds the id. The read stays+// because it costs one type assertion and keeps a hand-built envelope that+// fills only the map working.func chatSessionIDFromEvent(e events.Event) (pgtype.UUID, bool) {if e.ChatSessionID != "" {if id, err := util.ParseUUID(e.ChatSessionID); err == nil && id.Valid {diff --git a/server/internal/integrations/wecom/types.go b/server/internal/integrations/wecom/types.goindex 1fd7e29872..beff6f2688 100644--- a/server/internal/integrations/wecom/types.go+++ b/server/internal/integrations/wecom/types.go@@ -38,10 +38,23 @@// (outbound_media.go) and never to the agent, which has already exited.// Routing that outcome back into a later turn is its own piece of work.//-// Known limit, deliberate: outbound delivery requires a SINGLE backend-// replica, because the only send path is the in-process WebSocket in-// sendersRegistry while EventChatDone dispatches on the in-process-// events.Bus. See SELF_HOSTING.md.+// Outbound no longer requires a single backend replica. The only send path is+// still the in-process WebSocket in sendersRegistry, held by whichever replica+// owns that bot's lease, so a reply produced on another replica is routed to+// the lease holder over the Redis Stream relay (relay_outbound.go). Where+// there is no relay to route it — legacy relay mode, or no Redis at all — the+// reply is dropped, and a WeCom-enabled backend has to run as a single+// replica. In every mode, a reply produced while NO replica holds a live+// connection (all of them mid-reconnect) is still lost. See SELF_HOSTING.md.+//+// Every aibot_send_msg leaves under a per-chat quota gate (rate_limit.go).+// A chat slightly over WeCom's quota has its push delayed into the next free+// slot; one that bursts past what the caller's budget can wait for is refused+// before the write, with nothing on the wire — best effort, not lossless. A+// frame WeCom throttles anyway is retried once, when the caller can still+// afford the wait. The gate holds no shared state: the same lease that makes+// one replica the only sender makes that replica's own count the platform's+// count.package wecomimport (