Skip to content

Reopening sessions recorded before the conversation-fold release renders assistant messages as fragmented one-line pieces #4795

Open

Description

@StephenZhang-hash

Problem

Sessions whose wire records were written before content parts carried a block index fold each per-delta stream fragment into a separate conversation item when reopened. Every client that reads the conversation fold (web UI, desktop) then renders one assistant message as many short lines — for example a step that streamed with interleaved empty think parts becomes hundreds of tiny items (, / tmux / \n\n each on its own line), making old conversations unreadable.

Reproduction

  1. Have a session recorded by a server/CLI from before the conversation-fold release (2026-11-06, PR feat(kap-server): stream agent conversations as turns and items #4663): its wire.jsonl content.part records have no block field, one record per stream delta. Streams from OpenAI-compatible reasoning endpoints that interleave empty think parts produce this shape reliably.
  2. Restart the server (or reopen the session) with a current build and open the session in the web UI.
  3. Assistant text from those steps renders fragment-per-line instead of one message.

Expected

The message renders as one consolidated item, matching how it streamed live and how the same session renders for newly recorded turns.

Notes

Root cause (for whoever picks this up): the conversation fold keys items by stepUuid:block ?? position; legacy per-delta records have no block, so every fragment gets its own item. A fix needs to coalesce adjacent same-kind blockless records within a step at fold time (and drop vacuous parts), mirroring the per-block consolidation the write path now does.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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