Skip to content

[Bug] turn changes summary only shows last assistant message, not cumulative changes #428

@Astro-Han

Description

@Astro-Han

What happened?

When an assistant makes multiple edits across several assistant messages within a single user turn, the turn changes summary at the bottom of the conversation only displays the changes from the last assistant message, not the cumulative changes of the entire turn.

This leads to confusing UX where the user sees a small diff (e.g., +31 -20) when in reality the assistant made substantial changes across multiple steps (e.g., +161 -126 followed by +31 -20).

Which area seems affected?

UI or design system

How much does this affect you?

Breaks an important workflow

Steps to reproduce

  1. Start a new session
  2. Ask the assistant to make changes to a file
  3. The assistant makes an edit (e.g., +161 -126)
  4. The assistant then makes another edit to fix an issue (e.g., +31 -20)
  5. Observe that the turn changes summary at the bottom only shows +31 -20, omitting the first edit entirely

What did you expect to happen?

The turn changes summary should reflect all file changes made during the entire user turn — from the user's last message to the point where the assistant finishes and waits for the next user input.

PawWork version

local (dev build)

OS version

macOS 15.3

Can you reproduce it again?

Yes, every time

Diagnostics

Root Cause

turnChangeMessageID in session-turn.tsx uses findLast to select only the last assistant message that has visible turn changes:

const turnChangeMessageID = createMemo(() => {
  const messages = assistantMessages()
  return (
    messages.findLast((item) => item.time.completed && hasVisibleTurnChanges(props.turnChanges?.[item.id]))?.id ??
    messages.findLast((item) => item.time.completed)?.id
  )
})

The server records turn changes per assistant messageID, not per user turn. When multiple assistant messages each have their own TurnChangeDisplay, only the last one's stats are surfaced in the UI.

Evidence

From a recent session export, two edit tool calls were made in separate assistant messages (msg_df1c89ad... and msg_df1c8fcb...) under the same user message. The UI only showed the second message's stats (+31 -20) while omitting the first (+161 -126).

Affected Code

  • packages/ui/src/components/session-turn.tsxturnChangeMessageID logic
  • packages/app/src/pages/session/message-timeline.tsxturnChanges store and fetch logic
  • packages/opencode/src/session/turn-change.ts — server-side turn change recording

Suggested Fix

Option A (client-side): Accumulate TurnChangeDisplay.files across all assistant messages belonging to the same user turn, merging stats for files touched multiple times.

Option B (server-side): Record turn changes at the user-turn level rather than per assistant message.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium priorityappApplication behavior and product flowsbugSomething isn't workinguiDesign system and user interface

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions