fix: harden routing/session isolation for followups and heartbeat#25881
fix: harden routing/session isolation for followups and heartbeat#25881
Conversation
PR SummaryMedium Risk Overview Improves outbound and dedupe correctness for synthetic providers (heartbeat/cron/exec-event) by preferring Written by Cursor Bugbot for commit 1bf6bab. This will update automatically on new commits. Configure here. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
e1607a8 to
1bf6bab
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e1607a8500
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| run, | ||
| enqueuedAt: Date.now(), | ||
| originatingChannel: item.originatingChannel, | ||
| originatingTo: item.originatingTo, |
There was a problem hiding this comment.
Use dequeued run context for overflow summary followups
When dropPolicy: "summarize" and cap > 1, this branch drains one queued item but still uses queue.lastRun instead of that item’s own run. After this change, the drained item’s originatingChannel/originatingTo are forwarded, so replies can now be routed to channel A while the embedded run context (messageProvider, auth/account/model selection) comes from the most recently enqueued channel B. In mixed-channel shared sessions this can produce cross-channel context leakage or wrong delivery behavior; the run context and origin metadata need to stay aligned per dequeued item.
Useful? React with 👍 / 👎.
|
/landpr landed on
What landed:
Validation notes:
Thanks again to reporters: @Gamedesigner, @jadeathena84-arch, and @markshields-tl. |
Summary
lastThreadIdunless a thread/topic is explicitoriginatingChannel,originatingTo,originatingThreadId) during drainTests
Fixes #25864
Fixes #25835
Fixes #25730
Thanks @Gamedesigner, @jadeathena84-arch, and @markshields-tl for the reports and analysis.
Mintlify
0 threads from 0 users in Mintlify
Greptile Summary
This PR hardens routing and session isolation across heartbeat, followup, and messaging tool contexts to prevent cross-channel message leakage. The changes ensure that heartbeat/cron deliveries don't inherit cached thread IDs unless explicitly requested, followup routing strictly enforces origin isolation without dispatcher fallback on failure, and messaging tool deduplication uses originating channel context instead of synthetic provider tags. Queue drain logic now preserves routing metadata (
originatingChannel,originatingTo,originatingAccountId,originatingThreadId) during overflow summary generation.Key improvements:
lastThreadIdfrom session state (src/infra/outbound/targets.ts:121)OriginatingChannelover syntheticProvidertags (src/auto-reply/reply/agent-runner-payloads.ts:90, src/auto-reply/reply/followup-runner.ts:259)Test coverage includes regression tests for all four main fixes plus the overflow summary routing preservation.
Confidence Score: 5/5
Last reviewed commit: e1607a8