Skip to content

feat(dashboard): Keep the conversation list order stable - #3047

Merged
BYK merged 9 commits into
fix/dashboard-needs-youfrom
feat/dashboard-stable-list
Nov 10, 2026
Merged

BYK merged 9 commits into
fix/dashboard-needs-youfrom
feat/dashboard-stable-list

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #3032

Stacked on #3046 (stack #3058: #3037 → #3046 → #3047 → #3035 → #3036). #3046 owns who is in Needs you; this PR owns the order. Review the diff against fix/dashboard-needs-you.

The conversation list moved under the reader's pointer. Every event moved a row, and the waiting section put the newest activity first, so a queue you were working through kept changing order. This PR fixes the order and cuts the row markers to three channels.

Order

  • Needs you: the oldest wait goes first. /api/review-items/waiting-conversations now returns waitingSince next to fix(dashboard): Show only Review items that wait on you in Needs you #3046's items. It is the createdAt of the conversation's oldest open item for the viewer. New activity no longer moves the queue.
  • Date sections: sorted by the last Message. Feed rows get lastMessageAt, which is the newer of the last true user Message and the last Junior reply that the transcript shows. Like the unread reply, it skips tool calls, status changes, Events, and quiet replies, so they don't move a row. It also skips progress acks (meta.progress). That exclusion starts working when feat(notifications): Deliver progress replies without unread or push #3044, a separate PR, lands on main; until then nothing writes the flag. The row age and the home card time show this time too. A row with no Message yet uses lastSeenAt.
  • pinnedAndWaitingFirst sorts the same way before paging, so pages split where the sections do.

Hold while you work in the list

  • One list component. The sidebar and the home card list both render through ConversationSectionList. It builds the sections, holds the order, shows the pill, and owns pin reorder. Each list keeps only its own row look. A dashboard lint rule (no-restricted-imports in .oxlintrc.json) allows buildConversationSections and heldListOrder only in that component, so a new list can't skip the hold.
  • While the pointer is over the list, or focus is in it, rows keep their section and position. The hold covers the whole list area, including its padding and scrollbar, from the first paint. Their data still updates: bold, dot, spinner, and the review chip.
  • An "N updated" pill offers the new order. N is the number of rows that the new order would add or move, using the longest increasing run, so moving one row counts as 1. Clicking the pill applies the new order. So does moving the pointer out once focus has left the list.
  • Row actions apply at once. Pin, unpin, reorder, archive, and mark read/unread release the hold, so you see their result. Opening a row does not release it, so the row you just read stays where it was.
  • The hold starts only after the feed and waiting reads finish. A pointer resting on the list during a page load does not hold back the first rows.
  • Rows that sort after every held row, such as the next page of the home list, show at the end. Loading more doesn't wait on the pill.
  • Touch has no hover, so only a mouse or pen holds the order. On a phone only focus holds it. The pill fades in only under motion-safe. AnimatedList is unchanged and still animates rows in and out.
Held, dark Held, light
held dark held light

In these shots, Checkout latency triage has started waiting. It gets its dot, bold title, and chip in place, and the pill offers to move it into Needs you.

The home card list in a 700px window with a mouse, held and then applied:

Home held, dark Home held, light Home applied, light
home held dark home held light home applied light

Three marker channels

  • Position: the section, such as Needs you.
  • Read state: a dot plus a bold title. This is one channel, so unread and waiting rows keep both. The separate violet "waiting" dot and orange "unread" dot are now one accent dot. The section and the review chip already show that a row is waiting.
  • Motion: the running spinner.
  • Secondary text: the private lock, and "Failed" or "Stopped", sit beside the age, not in the marker slot. The idle glyph is gone.

This applies to the sidebar, the home and mobile list cards, and the Code page's recent conversations rows. Thread rows under a parent keep their own child status icon, which is unchanged.

Mark as unread does not change

Every read/unread control works as on main:

  • The dot slot in the sidebar is still the read toggle. It shows on unread rows, shows a preview on hover or focus, and has the "Mark as read/unread" tooltip.
  • The row context menu still has Mark as unread/read.
  • The mobile conversation menu still has Mark as unread.

This PR adds no shortcuts. The only change is that these actions release the hold, so the row moves right away.

Needs you, before / after (dark) Sidebar, before / after (light)
sidebar dark sidebar light
Read toggle on hover, before / after Row menu, before / after
read toggle context menu

Before is #3046 (470f3a73f). In the read toggle and row menu shots, Needs you now lists the longest wait first, so Plan the billing migration moves above Roll out payments-v42.

Mobile list, before / after Mobile Needs you, before / after Mobile conversation menu
home mobile needs you mobile mobile menu

On mobile, "Failed" is now text beside the time, not a rose dot on the tile. A running card shows one spinner, in place of the time, not a second one on the tile. The waiting card's dot is the same accent dot as unread, not the glowing violet one.

Pins stay manual

Pins don't change, and nothing pins on its own. For diagnosis, a pin change tags its request span with app.conversation.pin.action (pin, unpin, or reorder) and app.conversation.pin.count, which is the viewer's pin count after the change. The names and a query recipe are in TELEMETRY.md. The browser still sends only spans and ratings.

Notes for reviewers

  • Ordering on top of fix(dashboard): Show only Review items that wait on you in Needs you #3046: in conversationSections.ts, buildConversationSections and pinnedAndWaitingFirst now take waiting (the waiting map with waitingSince) in place of fix(dashboard): Show only Review items that wait on you in Needs you #3046's waitingIds set. Membership is unchanged: a row is in Needs you only when it is in that map.
  • Feed query cost: the feed reads lastMessageAt from a new junior_conversations.last_message_at column, so it adds no per-row event reads. Recent perf work on main took two routes: perf(dashboard): Cache model usage sums per Conversation #3006 caches usage sums in Redis with a seq watermark, and perf(api): Read list previews and costs without scanning every event #2761 reads previews through bounded index walks. I chose a column over a Redis cache because this time changes only when a Message is appended, and the append already writes the Conversation row in its transaction. So there is nothing to invalidate or watermark.
    • Write: refreshLastMessageAt (sql/last-message.ts) runs in the append transaction, only when the append adds a message or user_message event. It does the three index walks once per append, not once per root on every feed read.
    • Migration 0099_conversation_last_message_at: adds the nullable column, with no backfill. An update of every root would lock the rows that appends write (the migration-locks check rejects it). A row with no stored time reads it from its events in coalesce, which skips that read for every row that has one. Old idle rows drop out of the feed page over time.
  • API change: waitingSince is a required field on the strict waiting-conversations schema. The dashboard is the only consumer. The e2e mocks and mock-reporting/review-items.ts send it.

Frameshift changes

Report for 8e5f8c40a: 67 changed and 3 added. I measured every pair and looked at each one that changed outside the sidebar rows.

Count Cause Verdict
45 The private lock on Direct Message moves from the leading slot to beside the age. This is the only change. Expected
8 The same lock move, plus noise elsewhere: transcript scroll position (4), a different demo video frame (3), or a "Conversation details" tooltip (1). Expected, plus noise
5 Mobile home cards: one accent dot for unread and waiting, and "Failed" as text. The cards also showed a bug: an empty status slot added a flex gap, so every title cut off 12px early. Fixed in a63504507. Expected, bug fixed
2 The Code page recent rows lose the idle dot. Expected
7 Noise only: transcript scroll (4 mobile), a chart tooltip on a different day on Memories, the random MCP port, and the nav rail height in one full-page capture. Noise
3 added conversations-list-held (dark and light) and conversation-menu-mark-unread (mobile). New in this PR

I checked the noise locally against main where it was cheap. conversation-unsent-answers (desktop and mobile) is the same on the branch and on main, except for the lock, in two runs each. automation-page differs between two runs of the branch, and one of them matches main.

Testing

  • Unit: the conversationSections wait and last-Message order, and the new heldListOrder tests (held order, pending count, new and removed rows).
  • Integration (Postgres):
    • unread.test.ts: a quiet reply or a progress ack doesn't move lastMessageAt, and a shown reply does. The append stores the time on the row, and a row with no stored time still reads it from its events.
    • review-items/actions.test.ts: waitingSince is the oldest item's time.
    • list.test.ts and pin.test.ts pass.
  • E2E:
    • New: "holds the order under the pointer and offers the new one". It checks the hold, the pill, applying on click, and applying on leave plus blur.
    • New: "holds the home list order under the pointer", in a 700px window with a mouse.
    • New: "holds the order for a pointer on the list edge through the first load". It fails on 51a864b37, before the hold covered the whole list area.
    • conversations.spec "scrolls long conversation and transcript panes independently" now finds the sidebar scroll area by its slot, because the list has a wrapper.
    • The mobile mark-unread test now saves a menu screenshot.
    • The conversations-attention spec passed 3 times in a row with 3 workers.
  • Full dashboard e2e: 144 of 146 passed with 4 workers. conversations-attention "puts waiting conversations in Needs you first" timed out under load and passes on its own. The scroll test failed on the old locator and passes with the fix.
  • Checks: pnpm typecheck, pnpm lint (with migration-locks, file-length, and test-architecture), and the dashboard unit suite (432 tests) pass. Full integration: 926 passed. any-resource-event-automations times out here with or without this change, and attachment-s3-storage needs a local S3 server.

via @BYK.

--

View Session [Sentry]

@vercel

vercel Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
junior-docs Ready Ready Preview Nov 10, 2026 11:10pm UTC

Request Review

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

68 screenshot changes — 65 changed · 3 added · 0 removed

Review screenshots in Frameshift

Code Repository · Desktop
Code Repository · Desktop
Changed
Code Repository · Mobile
Code Repository · Mobile
Changed
Conversation Attachment · Desktop
Conversation Attachment · Desktop
Changed
Conversation Attachment · Mobile
Conversation Attachment · Mobile
Changed
Conversation Attachment Modal · Desktop
Conversation Attachment Modal · Desktop
Changed
Conversation Attachment Zoom · Desktop
Conversation Attachment Zoom · Desktop
Changed
Show 12 more changed screenshots
Conversation Attachment Zoom · Mobile
Conversation Attachment Zoom · Mobile
Changed
Conversation Captured Memories Popover · Desktop
Conversation Captured Memories Popover · Desktop
Changed
Conversation Child Agent Drawer · Desktop
Conversation Child Agent Drawer · Desktop
Changed
Conversation Child Agent Page · Desktop
Conversation Child Agent Page · Desktop
Changed
Conversation Child Agents · Desktop
Conversation Child Agents · Desktop
Changed
Conversation Create Focused · Desktop
Conversation Create Focused · Desktop
Changed
Conversation Create Focused · Mobile
Conversation Create Focused · Mobile
Changed
Conversation Detail · Desktop
Conversation Detail · Desktop
Changed
Conversation Details Watched Linked Work · Desktop
Conversation Details Watched Linked Work · Desktop
Changed
Conversation Event Details · Desktop
Conversation Event Details · Desktop
Changed
Conversation Event Details Mobile · Desktop
Conversation Event Details Mobile · Desktop
Changed
Conversation Event Log · Desktop
Conversation Event Log · Desktop
Changed

47 more changed screenshots in Frameshift.

@sentry-junior
sentry-junior Bot force-pushed the feat/dashboard-stable-list branch from a635045 to 01bd017 Compare November 9, 2026 23:51
@sentry-junior
sentry-junior Bot changed the base branch from main to fix/dashboard-needs-you November 9, 2026 23:51
@sentry-junior
sentry-junior Bot added this pull request to stack #3049 November 9, 2026 23:51
@sentry-junior
sentry-junior Bot force-pushed the feat/dashboard-stable-list branch from cad1ce9 to e13b20d Compare November 10, 2026 00:22
@sentry-junior
sentry-junior Bot force-pushed the feat/dashboard-stable-list branch from e13b20d to eea79bc Compare November 10, 2026 00:30
@sentry-junior
sentry-junior Bot removed this pull request from stack #3049 November 10, 2026 05:42
@sentry-junior
sentry-junior Bot added this pull request to stack #3058 November 10, 2026 05:42
@sentry-junior
sentry-junior Bot force-pushed the feat/dashboard-stable-list branch from eea79bc to 50a5ff4 Compare November 10, 2026 06:06

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 51a864b. Configure here.

@sentry-junior sentry-junior Bot closed this Nov 10, 2026
@sentry-junior
sentry-junior Bot force-pushed the feat/dashboard-stable-list branch from 51c46eb to c3baabc Compare November 10, 2026 21:48
@github-actions github-actions Bot added risk: medium PR risk score: medium and removed risk: high PR risk score: high labels Nov 10, 2026
@sentry-junior sentry-junior Bot reopened this Nov 10, 2026
@github-actions github-actions Bot added risk: high PR risk score: high and removed risk: medium PR risk score: medium labels Nov 10, 2026
sentry-junior Bot and others added 9 commits November 10, 2026 22:52
Order Needs attention by wait start, oldest first, and date sections by
the last Message from a person or a shown Junior reply. Hold the
sidebar order while the pointer or focus is on it, with an "N updated"
pill. Cut row markers to position, read state, and a running spinner,
and move private, failed, and stopped to secondary text. Tag pin
changes with the action and the viewer's pin count.

Refs #3032

Co-Authored-By: BYK <[email protected]>
A progress ack (`meta.progress`) only says that work continues, so it
must not move a row. Nothing writes the flag until #3044 lands.

Co-Authored-By: BYK <[email protected]>
A focused pill that unmounts sends no blur, so the hold kept the list
after a keyboard user left it. Check for focus that fell to the body
after each apply. Cover the row menu and the keyboard pill in e2e.

Co-Authored-By: BYK <[email protected]>
The wrapper span rendered with no status text and added a flex gap, so
every home card title truncated 12px early.

Co-Authored-By: BYK <[email protected]>
The feed ran three lateral subqueries per listed root to find the newest
Message that a reader would notice. That time changes only when a
Message is appended, and the append already writes the Conversation row
in its transaction. So the append now stores it in
`junior_conversations.last_message_at`, and the feed reads the column.

An append runs the same index walks once, and only when it adds a
`message` or `user_message` event. The migration adds the column with no
backfill, because an update of every root would lock the rows that
appends write. A row with no stored time reads it from its events, and
`coalesce` skips that read for every other row.

Co-Authored-By: BYK <[email protected]>
… list

`ConversationSectionList` now groups, sorts, and holds the rows of both
lists, and shows the "N updated" pill. The home list held nothing
before, so it re-sorted under a mouse in a narrow window. A lint rule
keeps `buildConversationSections` and the hold inside that component.

The hold adds rows that sort after every held row, such as the next
page of the home list, at the end, so loading more does not wait on the
pill.

Co-Authored-By: BYK <[email protected]>
`ConversationSectionList` sat inside the sidebar scroll area and mounted
only after the first load, so its padding and scrollbar did not count as
the list. A pointer there let rows move. It now wraps the scroll area and
stays mounted through the loading state, and the home list does the same.

Co-Authored-By: BYK <[email protected]>
The test architecture check keeps layout reads such as boundingBox out
of dashboard e2e. Hover at a position in the scroll area instead.

Co-Authored-By: BYK <[email protected]>
@sentry-junior
sentry-junior Bot force-pushed the feat/dashboard-stable-list branch from e54099b to f27a916 Compare November 10, 2026 23:09
@BYK
BYK merged commit 2590034 into main Nov 10, 2026
43 checks passed
@BYK
BYK deleted the feat/dashboard-stable-list branch November 10, 2026 23:48
sentry-junior Bot added a commit that referenced this pull request Nov 21, 2026
A command killed by a session stop came back as a normal exit (143), and
the next call ran on a new sandbox without the old files and said nothing.

- After a 137 or 143 exit, probe the session. A stopped session fails the
  call through the existing sandbox-unavailable tool error.
- When a sandbox tool call runs on a new sandbox that lost the earlier
  files, its result gets a sandbox_notice that says so and asks the agent
  to check its checkout first.

Refs #3047, #3703

Co-Authored-By: David Cramer <[email protected]>
dcramer added a commit that referenced this pull request Nov 22, 2026
…ns (#3710)

When a Vercel Sandbox session stops during a Turn, two things go wrong
today:

1. The provider kills the running command with a signal and returns a
normal command result, so the call reads as an ordinary non-zero exit
and never reaches the sandbox-unavailable tool error.
2. The next call reacquires the sandbox. A non-persistent sandbox
resumes into a new session from its source snapshot, and the agent is
not told. Local commits and other files are gone. An agent that then
pushes `HEAD` can push an old commit over its own work.

Vercel stops a session 24 hours after it starts, so a long conversation
can lose its session in the middle of a Turn.

Context: #3047. #3703 is the push-guard
backstop for the same failure.

## Change

- **Kill path.** After a SIGTERM or SIGKILL exit, the bash executor
probes the session with the probe that cached sessions already use. A
stopped session throws the provider error. That marks the session
unavailable and goes through the existing
`createSandboxUnavailableToolError` path, which says the outcome is not
reliable and the next call uses a fresh session. When the session is
live, or the probe fails for another reason, the command's own exit
stands.
- **Replacement notice.** `SandboxRef.toolSession` stores the sandbox
and session id of the last sandbox tool call (`bash`, `readFile`,
`writeFile`, `editFile`). It is saved in thread state next to
`app_sandbox_id`, so it survives Run and execution slice boundaries. A
call on a different session gets a `sandbox_notice` in its result when
the earlier files are gone: the Sandbox changed, or a new session
started on a Sandbox that does not keep files across sessions. The
notice says that files and local commits are gone and to check HEAD and
the branch before acting. This also covers a conversation that stayed
idle past the keepalive and resumes into a new session.
- `SandboxSession.keepsFilesAcrossSessions` reports this. Vercel maps it
from `sandbox.persistent`. Docker is always `false`, because a restarted
container keeps its id, so a new session id is a new container.
- Only tool calls update the stored session, so the between-step
AGENTS.md read cannot hide a replacement.
- `switchWorkspace` clears it, because the switch result already says
that files do not carry over.
- **Session rotation at Turn start.** `SandboxSession.startedAtMs` gives
the session start time. On Vercel it comes from the session's
`startedAt`, or `createdAt` when `startedAt` is not set. On Docker it
comes from the container's `StartedAt`. When the first Run of a Turn
reopens a stored sandbox whose session is older than 20 hours, it stops
that session and resumes a new one before any work starts. A Run that
resumes a paused Turn keeps its session, so rotation does not drop
unpushed work in the middle of a Turn. A sandbox that does not keep
files gets the replacement notice on its next tool call.
- The bash, file, and command executors move to
`sandbox/tool-executors.ts` to keep `session.ts` under the file length
limit. The only behavior change there is the probe.

Reused: the sandbox-unavailable tool error and session invalidation, the
probe from the reacquire path in #3515, and the stored
`SandboxRef` with its existing `onSandboxRefChanged` persistence.
Unknown outcomes from cancelled commands (#915) stay as
they are.

## Limits and open questions

- **Turn start after recovery.** "Turn start" means the Turn has no
paused record. When recovery restarts a Turn after a lost worker without
a paused record, that Run can still rotate an old session.
- **Persistent sandboxes.** Rotation stops the session and resumes it
right away. Conversation sandboxes are non-persistent today. For a
persistent sandbox, a resume while the stop still snapshots has not been
checked against the live API.
- **Plugin tools.** A plugin tool that runs a command through the
sandbox records the new session too, and it drops `sandbox_notice`. If
the first call after a replacement is a plugin tool, the agent does not
see the notice.
- **Stop timing.** The kill check assumes the session API rejects the
probe right after the provider kills the command. If a stopping session
still accepts the probe, the kill is reported as a normal exit, and the
next call still gets the replacement notice.

<!-- junior-request-attribution:start -->
via @dcramer.
<!-- junior-request-attribution:end -->

<!-- junior-session-footer:start -->
<!-- junior-conversation-id:agent%3A2129e94419c987dc504daaf71f9cea79 -->

--

[View
Session](https://junior-prod.sentry.dev/conversations/agent%3A2129e94419c987dc504daaf71f9cea79)
[[Sentry]](https://sentry.sentry.io/explore/conversations/agent%3A2129e94419c987dc504daaf71f9cea79/?project=4510944073809921)

<!-- junior-session-footer:end -->

---------

Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Co-authored-by: David Cramer <[email protected]>

This branch was successfully deployed

1 active deployment
Preview – junior-docs — f27a916e Deployed Nov 10, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: high PR risk score: high

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Keep the dashboard conversation list order stable

1 participant