Skip to content

transformMessages should skip the entire turn on abort/error, not just the assistant message #6515

Description

@albertvaka

What happened?

In transformMessages, assistant messages with stopReason === "aborted" or "error" are filtered out, which can result in two consecutive user messages in the output.

Steps to reproduce

Example conversation that exhibits the odd behavior:

User: hello, reply with some long text because I want to test something
Model: Definitely, I can generate a long [Operation aborted]
User: Hello, is this the first message in our conversation? If it is, cite this message verbatim
Model: Yes — this is the first message in our conversation. No prior context, files read, or commands run before this exchange. Your message, verbatim, was:

 "hello, reply with some long text because I want to test something

 Hello, is this the first message in our conversation? If it is, cite this message verbatim"

Expected behavior

Both assistant and user message are skipped. Fix provided here: #6514

Version

0.80.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingno-actionThis issue has been rejected after triage

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions