Skip to content

[Bug]: "Last user message" sort counts agent-generated user-role messages (background command notices, delegates, PR updates) #33866

Closed

Description

@ashiboyman

Before submitting

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

Area

apps/web (sidebar sort) and apps/server (thread shell latest_user_message_at)

Steps to reproduce

  1. Set the thread sort order to Last user message, in a layout that sorts by it (for example Boring sidebar on).
  2. In thread A, have the agent start a background command (for example a dev server) and leave it running. Then send a message in thread B so B is on top.
  3. Stop the background command, or let a delegated task, PR update or subagent prompt post into thread A.

Expected behavior

Thread A stays where it is. I didn't send anything there, so its "last user message" time shouldn't change.

Actual behavior

Thread A jumps above thread B. Agent-generated messages are stored with role: 'user', and the sort key counts them as user messages.

From my local statev2.sqlite, user-role messages in the last 7 days:

createdBy creationSource count examples
user web / mobile 206 my real prompts
agent provider 73 Background command "…" was stopped, subagent / delegate prompts
agent mcp 50 task briefs sent to another thread
agent server 24 Update on pull request #…

That's about 147 agent messages bumping threads as if I had written them.

Diagnosis

  • The server builds latest_user_message_at as the newest role = 'user' message, excluding only idle-compaction messages. It also builds latest_user_authored_message_at, which is filtered to createdBy = 'user'.
  • The client contract notes this: latestUserAuthoredMessageAt "Excludes wakes and agent messages that advance latestUserMessageAt through the user role."
  • The client sort key for updated_at ("Last user message") uses latestUserMessageAt, not latestUserAuthoredMessageAt.

Suggested fix: sort "Last user message" by latestUserAuthoredMessageAt ?? latestUserMessageAt.

Impact

Minor bug, but it makes "Last user message" ordering unreliable for anyone who uses background commands, delegates or PR watching.

Version or commit

T3 Code Beta 0.1.8 (desktop AppImage)

Environment

Linux (WSL2), desktop app 0.1.8, Claude Agent provider

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions