Skip to content

session/load replays turns removed by thread_rolled_back #355

Description

@Skywt2003

session/load replays turns removed by thread_rolled_back

Summary

When the response-item history fallback is active, session/load replays turns
that were removed by editing/rollback. The fallback ignores
event_msg/thread_rolled_back, so the obsolete prompt and answer are merged
back into the current app-server thread history.

Reproduced on current main (992299d, package version 1.1.9).

Reproduction

Pass this sequence to parseResponseItemHistoryFallback (with a missing
function call so the fallback is enabled):

  1. user_message: unfinished prompt
  2. assistant response: obsolete answer
  3. thread_rolled_back: { "num_turns": 1 }
  4. user_message: edited prompt
  5. assistant response: current answer
  6. a function call and its output

Expected message output:

edited prompt
current answer

Actual message output:

unfinished prompt
obsolete answer
edited prompt
current answer

The fallback should discard updates belonging to rolled-back turns before
merging them with the app-server thread history.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions