mirror of
https://github.com/qwibitai/nanoclaw.git
synced 2026-06-04 10:14:47 +08:00
fix: reply in the Slack DM thread the user wrote in
- chat-sdk-bridge: forward thread.id to the router for DMs so sub-thread context survives into delivery. Previously hardcoded to null, which collapsed every reply to the DM top level. - router: when a DM (is_group=0) is wired as `shared`, don't auto-escalate to per-thread — keep one session for the whole DM and let thread_id flow through to the adapter. - agent-runner poll-loop: defer follow-up messages whose thread_id differs from the active turn's routing. Mixing threads into one streaming turn sent every reply to the first thread because routing is captured at turn start. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
committed by
exe.dev user
parent
79fd142be4
commit
fdece8047e
@@ -249,13 +249,18 @@ async function processQuery(query: AgentQuery, routing: RoutingContext, config:
|
||||
const pollHandle = setInterval(() => {
|
||||
if (done) return;
|
||||
|
||||
// Skip system messages (MCP tool responses) and admin commands (need fresh query)
|
||||
// Skip system messages (MCP tool responses) and admin commands (need fresh query).
|
||||
// Also defer messages whose thread_id differs from the active turn's routing
|
||||
// — mixing threads into one streaming turn would send the reply to the wrong
|
||||
// thread because `routing` is captured at turn start. The next turn will pick
|
||||
// them up with fresh routing.
|
||||
const newMessages = getPendingMessages().filter((m) => {
|
||||
if (m.kind === 'system') return false;
|
||||
if (m.kind === 'chat' || m.kind === 'chat-sdk') {
|
||||
const cmd = categorizeMessage(m);
|
||||
if (cmd.category === 'admin') return false;
|
||||
}
|
||||
if ((m.thread_id ?? null) !== (routing.threadId ?? null)) return false;
|
||||
return true;
|
||||
});
|
||||
if (newMessages.length > 0) {
|
||||
|
||||
Reference in New Issue
Block a user