fix: cron jobs bypassed by ResponseMode/listen-only mode#519
fix: cron jobs bypassed by ResponseMode/listen-only mode#519ciaranashton wants to merge 3 commits intospacedriveapp:mainfrom
Conversation
Cron-originated messages carry a platform source (e.g., "slack") for adapter routing but use sender_id="system". The listen-only guard only checked message.source != "system", so cron messages were silently suppressed — the channel returned without running the LLM, producing no output and skipping delivery. Add sender_id != "system" to the guard so cron messages are correctly exempted from listen-only suppression.
WalkthroughThe listen-only (quiet/mention-only) suppression guard in Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/agent/channel.rs`:
- Around line 1762-1767: The listen-only exemption added for single messages
wasn’t applied to coalesced batches; update handle_message_batch so the
suppression check matches the single-message logic: when self.listen_only_mode
and not self.is_dm(), do not suppress messages in the batch that have
message.source != "system" (i.e., platform-originated cron outputs) even if
message.sender_id == "system"; in practice, change the batch-suppression
predicate in handle_message_batch to consider both message.source and
message.sender_id (same conditions used where the single-message path was fixed)
so scheduled/cron messages are exempted from quiet-mode suppression.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 9f5c7b8a-b8df-4b3c-a3a1-ba5cf5b4c0fb
📒 Files selected for processing (1)
src/agent/channel.rs
Upstream replaced listen_only_mode boolean with ResponseMode enum. Applied the sender_id="system" fix to the new guard and updated the test to match.
vsumner
left a comment
There was a problem hiding this comment.
Two correctness issues remain in the current patch. The single-message exemption is a step in the right direction, but the batch path still needs parity and the regression test should exercise the real behavior.
| // In Quiet/MentionOnly modes, ingest messages but only reply when explicitly invoked. | ||
| // Cron-originated messages carry a platform source (e.g., "slack") for adapter | ||
| // routing but use sender_id="system" — exempt them from suppression. | ||
| if !matches!(self.resolved_settings.response_mode, ResponseMode::Active) |
There was a problem hiding this comment.
This fixes the single-message response-mode guard, but the coalesced batch path still suppresses unsolicited traffic whenever response_mode is not Active and !batch_has_invoke. Cron/system-originated work can flow through handle_message_batch too, so scheduled output can still be dropped in Quiet/MentionOnly mode when messages are buffered together. Please mirror this exemption in the batch suppression branch as well.
| @@ -3809,6 +3812,35 @@ mod tests { | |||
| assert!(!invoked_by_reply); | |||
There was a problem hiding this comment.
The new test recomputes a local boolean instead of driving the actual channel suppression logic, so it can still pass even if handle_message or the batch path regresses. This bug class needs a behavior-level regression test that exercises the real guard branch, and it should include the coalesced batch case because that is the remaining unprotected path.
Summary
listen_only_modeis enabled on the agentchannel.rschecksmessage.source != "system", but cron messages use the adapter platform as source (e.g.,"slack") for routing — so they get suppressed as unsolicited messagesmessage.sender_id != "system"to the guard, since only cron and system retrigger messages use this sender ID (retriggers already bypass viasource == "system")