Skip to content

fix(s08): avoid consecutive user messages#240

Open
huanghuang358 wants to merge 1 commit intoshareAI-lab:mainfrom
huanghuang358:fix/s08-consecutive-user-messages
Open

fix(s08): avoid consecutive user messages#240
huanghuang358 wants to merge 1 commit intoshareAI-lab:mainfrom
huanghuang358:fix/s08-consecutive-user-messages

Conversation

@huanghuang358
Copy link
Copy Markdown

The previous implementation always appended a new user message for background results regardless of the trailing message's role. After a tool round-trip (or right after the user query), the messages list could end up with two adjacent user messages, which is messy for prompt caching, token accounting and stricter API gateways.

Now we merge the background-results block into the trailing user message when its role is already user, and only append a fresh user message otherwise. tool_result blocks still immediately follow their tool_use, so the protocol contract is preserved.

…tifications

The previous implementation always appended a new user message for background
results regardless of the trailing message's role. After a tool round-trip
(or right after the user query), the messages list could end up with two
adjacent user messages, which is messy for prompt caching, token accounting
and stricter API gateways.

Now we merge the background-results block into the trailing user message
when its role is already user, and only append a fresh user message
otherwise. tool_result blocks still immediately follow their tool_use, so
the protocol contract is preserved.
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 19, 2026

@huanghuang358 is attempting to deploy a commit to the crazyboym's projects Team on Vercel.

A member of the Team first needs to authorize it.

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.

1 participant