[Bug]: Visible turn items collide when inherited and local share an id#27860

opened19d agobySsamkelly880

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

packages/client-runtime

Steps to reproduce

Open a forked/child thread whose visible timeline includes an inherited row and a local row that share the same sourceItemId (different sourceThreadId).

  1. Stream a turn-item.updated for the local item.
  2. Or hide the local item (for example a rolled-back run update that removes it from the visible list).
  3. Or expand deferred work anchored on that shared id.

Expected behavior

Only the local (sourceThreadId, sourceItemId) row is updated, hidden, or used as the deferred-work anchor. The inherited row stays put. Equal-ordinal deferred rows keep a stable id order.

Actual behavior

Upsert/remove and deferred-work lookup match on sourceItemId alone, so the inherited row can be overwritten, removed, or chosen as the anchor. Deferred equal-ordinal sorting also lacks an id tie-break.

Impact

Incorrect timeline rows in forked threads when ids collide across source threads.

Fix

https://github.com/pingdotgg/t3code/pull/27861