Skip to content

fix(gateway): use user role for cron mirror messages to maintain message alternation - #2223

Closed
ygd58 wants to merge 3 commits into
NousResearch:mainfrom
ygd58:fix/cron-mirror-role-alternation
Closed

fix(gateway): use user role for cron mirror messages to maintain message alternation#2223
ygd58 wants to merge 3 commits into
NousResearch:mainfrom
ygd58:fix/cron-mirror-role-alternation

Conversation

@ygd58

@ygd58 ygd58 commented Mar 20, 2026

Copy link
Copy Markdown
Contributor

Fixes #2221

Root Cause

gateway/mirror.py was appending cron delivery messages with role: "assistant". Since the previous message is also role: "assistant" (the agent's response), this created two consecutive assistant messages — violating the expected user/assistant alternation.

Fix

Changed mirror message role from "assistant" to "user" and added a [Cron delivery from {source_label}] prefix so the model understands this is an injected cron result, not a real user message.

Impact

  • Fixes two consecutive assistant messages in gateway sessions
  • Prevents API rejections from strict providers that require strict alternation
  • Consistent with how the model should process injected cron outputs

@teknium1

Copy link
Copy Markdown
Contributor

Closing — this has been superseded by recent gateway changes to cron delivery and session handling. Thanks for the contribution!

@teknium1 teknium1 closed this Mar 22, 2026
@SteelDynamite

Copy link
Copy Markdown

The issue this PR was trying to solve still exists.

See:
#8793
#21441
#10650
#21750
#7400

This is a significant issue in the UX.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(gateway): cron job outputs injected as assistant role, breaking message alternation

3 participants