Skip to main content

is_turn_opening_user_message

Function is_turn_opening_user_message 

pub fn is_turn_opening_user_message(message: &ConversationMessage) -> bool
Expand description

Whether this typed message opens a turn for failed-turn span purposes: a user message that is not the runtime’s prompt-mode [Tool results] result carrier.

A prompt-mode tool round appends its results as a user-role message (see history_append::append_tool_round_to_history), and typed replay preserves that carrier as an ordinary user chat. A selector that walks back to “the last user message” would otherwise start the failed-turn span at the carrier and miss the user prompt that actually opened the turn — including the attachments that prompt carried. The same prefix rule the whole-turn trimmer uses for flat boundaries applies here.