fix(channels): wire accumulate mode through the bridge
The router + session DB were already fully plumbed for
ignored_message_policy='accumulate' — fan-out in routeInbound calls
deliverToAgent(wake=false) for non-engaging agents on accumulate wirings,
writeSessionMessage writes trigger=0, countDueMessages filters trigger=1,
container formatter includes all messages regardless of trigger. But the
Chat SDK bridge dropped non-engaging messages before the router ever saw
them, so accumulate was dead on arrival for every adapter that goes
through the bridge.
Expose ignored_message_policy on ConversationConfig, project it in
buildConversationConfigs, and widen shouldEngage's "forward" decision to
"engage OR accumulate" with the union taken across all wirings on a
conversation. stickySubscribe stays gated on a real engage — subscribing
a thread we'd only silently accumulate on would misrepresent the bot's
presence.
shouldEngage return shape is now { forward, stickySubscribe } — engage
was an internal concept the caller never needed, and conflating it with
forward was the source of this bug.
7 new tests cover: non-engaging messages forwarding under accumulate,
mixed drop/accumulate wirings taking the union, accumulate not
triggering sticky subscribe, unknown-conversation drop precedence over
accumulate, and drop policy preserving existing behavior on engaging
messages.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -22,6 +22,20 @@ export interface ConversationConfig {
|
||||
engageMode: 'pattern' | 'mention' | 'mention-sticky';
|
||||
/** Regex source when engageMode='pattern'. '.' is the "always" sentinel. */
|
||||
engagePattern?: string | null;
|
||||
/**
|
||||
* What to do with messages this wiring doesn't engage on.
|
||||
*
|
||||
* 'drop' — discard silently
|
||||
* 'accumulate' — still forward to the host so the router can store the
|
||||
* message in this agent's session with trigger=0. It
|
||||
* rides along as context when the agent next wakes, but
|
||||
* doesn't wake it on its own.
|
||||
*
|
||||
* The bridge reads this to decide whether to forward a non-engaging
|
||||
* message at all — if any wiring on a conversation has 'accumulate', the
|
||||
* bridge forwards and lets the router apply the per-wiring decision.
|
||||
*/
|
||||
ignoredMessagePolicy?: 'drop' | 'accumulate';
|
||||
sessionMode: 'shared' | 'per-thread' | 'agent-shared';
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user