fix(client): undoing an unpin keeps an older pin in its place #48069
main fromrefs/pull/48069/head·merged by juliusmarminge View on GitHubPins saved before manual ordering have no order key. Undoing the unpin of one of these pins used to give it a fresh key at the top, so it moved above the threads that had been ahead of it. The undo plan now records that the pin had no key, and both web and mobile restore it without one, so it goes back to its earlier place in Pinned.
Reproduction on main#
Commit ff4d267910 (main). The thread returns at the top of Pinned, ahead of the thread that was above it. Expected: The thread returns to its previous place in Pinned.
- Open a sidebar where a thread pinned before manual ordering appears below another pinned thread.
- Unpin the older thread.
- Click Undo in the sidebar.
The cause is at packages/client-runtime/src/state/threadUndo.ts:60. Ran pnpm scenarios:prove scripts/scenarios/undo-unpin-keeps-legacy-pin-position.e2e.ts --target web with the repro scenario added: it failed in 2 of 2 runs on a clean checkout, with expected "Older pin" to be "Arranged pin" in the output.
Evidence#
Environment: The web app in Chromium on Linux x64, a fresh checkout.
Proven: the repro fails at the test commit 5cb2fcd6f6 and passes on the head 012f0a854d, both on main 3fac5b2ad2.
| Before | After | |
|---|---|---|
| Commit | 5cb2fcd6f6 | 012f0a854d |
| Result | ASSERTION_FAILED: expected "Older pin" to be "Arranged pin" | passed |
| pinned order after undo | ![]() The thread returns at the top of Pinned, ahead of the thread that was above it. | ![]() The thread returns to its previous place in Pinned. |
| failure | ![]() | |
| Recording | Before: recording | After: recording |
Tests#
- 5cb2fcd6f6 adds the failing test, alone, before the fix.
pnpm exec vp run check:changed 3fac5b2ad2b07a60ce21a43e4191cf8f86dafcd3passed on head.
Not in this change#
- Pins that have no order key still always sort after keyed pins. This change keeps that existing ordering.
- The scenario still tries the
defaultreplay model first and falls back when it is not advertised, because some replay catalogs advertise onlydefaultand others only the named recordings.
Who did the work#
- Repro written by GPT 6.2 Sol, in Codex
- Duplicate check judged by Claude Opus 5.5, in Claude Code
- Written by Claude Opus 5.5, in Claude Code
- Reviewed by Claude Opus 5.5, in Claude Code, and by GPT 6.2 Sol, in Codex
- Reproduction, checks and proof run by a program on base and head, not by an agent
Made in T3 Code by GPT 6.2 Sol and Claude Opus 5.5
- 1
- 2
Pusheda3c412c
Evidence#
Seed “Older pin” pinned without an order key and “Arranged pin” pinned with key “m”. Open Arranged pin, click Older pin’s Unpin thread button, immediately click Undo, then reload the thread and capture the persisted sidebar order.
Environment on both sides: real web app, Chromium, 1280×800, light theme, fresh isolated server data, Replay (dev).
Scenario: Undo returns an older pin to its place in the sidebar#
Proven: the scenario fails on base 5dea97de40 and passes on head a3c412cc43.
Base 5dea97de40 Head a3c412cc43 Result ❌ failed
ASSERTION_FAILED: expected ["Older pin","Arranged pin"] to equal ["Arranged pin","Older pin"]✅ passed pinned order after undo 

failure 
Before recording · After recording · Scenario source
Not shown:
- Mobile was not run on a device; this proof covers the web client only.
juliusmarminge added labelstakeover:ready
juliusmarminge removed labelstakeover:in-progress
juliusmarminge merged thisbdbc06a
juliusmarminge closed this
juliusmarminge removed labelstakeover:ready
Sign in to join this conversation.





macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes