Skip to content

fix(openai): preserve non-instruction system messages in update_chat_ctx for realtime models - #4942

Merged
longcw merged 1 commit into
mainfrom
longc/realtime-preserve-system-messages-in-chat-ctx
Feb 26, 2026
Merged

fix(openai): preserve non-instruction system messages in update_chat_ctx for realtime models#4942
longcw merged 1 commit into
mainfrom
longc/realtime-preserve-system-messages-in-chat-ctx

Conversation

@longcw

@longcw longcw commented Feb 25, 2026

Copy link
Copy Markdown
Contributor

preserves non-instruction system messages (e.g. context summaries) in update_chat_ctx for OpenAI realtime, instead of stripping all system messages.

fix #4875

@chenghao-mou
chenghao-mou requested a review from a team February 25, 2026 09:04

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 2 additional findings.

Open in Devin Review

@StianHanssen StianHanssen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Really appreciate the quick fix!

@chenghao-mou chenghao-mou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@anmolgaud

anmolgaud commented Feb 25, 2026

Copy link
Copy Markdown

PR #4310 Also introduced exclude_instruction=true for google and aws realtime plugins also. The earlier verison of livekit didn't have any such restriction. They might also need to be fixed. We were previously using google-realtime models with the same approach.

Thanks a lot for this quick fix. A core feature of our agents was breaking because of this change.

@longcw

longcw commented Feb 26, 2026

Copy link
Copy Markdown
Contributor Author

@anmolgaud google realtime doesn't support system role, it only has user and model roles. before #4310 the system role was parsed as user message. and in the latest version, it will raise a warning that system message is going to be dropped, you may add your original system messages as user messages to keep the same behavior as before.

@longcw
longcw merged commit 93480d0 into main Feb 26, 2026
18 of 19 checks passed
@longcw
longcw deleted the longc/realtime-preserve-system-messages-in-chat-ctx branch February 26, 2026 02:10
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] update_chat_ctx strips system instructions and prevents dynamic behavior injection in realtime agents

4 participants