Skip to content

Deduplicate last assistant message after harness restart #343

@cbusillo

Description

@cbusillo

Summary

After restarting/resuming the Every Code harness, the TUI can render the assistant's last response twice in the chat history.

Evidence

Observed on 2026-06-02 immediately after a harness restart on main:

  • Header showed Every Code Lab, model GPT-5.5 (High), directory ~/Developer/code, branch main.
  • The user's prompt Ok what are we working on now? appeared once.
  • The assistant response beginning Right now the active workstream is dogfooding Auto Review after the diagnostics slice. appeared twice consecutively.
  • The duplicate content looked identical and visible in the scrollback, not merely a transient repaint.

Why This Matters

Duplicate rendered assistant messages make restart/recovery feel unreliable and can confuse users about whether the model repeated itself, whether history replay duplicated a message, or whether hidden context/tool actions were also duplicated.

Desired Behavior

On resume/restart, each assistant response should appear once in visible history. If replay and live stream both reference the same response, the TUI should dedupe by stable turn/item/message identity rather than rendering both.

Questions To Answer

  • Is this duplicate only a visible TUI replay/rendering artifact, or is the persisted conversation history itself duplicated?
  • Does it affect only final assistant messages, or also reasoning/streaming inserts/tool cells?
  • Is the duplication tied to restarting while the final answer is still being persisted or replayed?

Acceptance Criteria

  • Add a focused resume/restart replay regression test for a final assistant answer.
  • Verify persisted history contains one logical assistant response for the turn.
  • Ensure replay plus live/last-message recovery does not double-render the same response.
  • Confirm no duplicate hidden context/tool actions are emitted when the visible duplication occurs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions