mirror of
https://github.com/browser-use/browser-use.git
synced 2026-09-14 19:59:47 +08:00
7dcb968fcb
Dropping the `not formatted_messages` guard fixed the assistant-first case but went too far: for a `user -> system -> user` ordering the system text was merged into the second user message, where the documented behaviour is to prepend to the *first* user message and otherwise fall back to the separate system instruction. Track whether a user message has already been serialized and merge only while none has. An earlier assistant turn still does not disqualify the first user message, but a user turn does, and the leftover text now reaches the caller as the system instruction instead of being silently relocated.