fix-tui-graph

Fix: TUI graph view should rank active chat tasks by last-activity, not creation time

Metadata

Statusdone
Assignedagent-1376
Agent identityf51439356729d112a6c404803d88015d5b44832c6c584c62b96732b63c2b0c7e
Created2026-05-01T16:35:04.200991180+00:00
Started2026-05-01T16:35:32.676286040+00:00
Completed2026-05-01T17:45:21.344369598+00:00
Tagsfix,bug,tui,ux,chat,sorting, eval-scheduled
Eval score0.70
└ blocking impact0.72
└ completeness0.65
└ constraint fidelity0.70
└ coordination overhead0.72
└ correctness0.72
└ downstream usability0.68
└ efficiency0.72
└ intent fidelity0.70
└ style adherence0.76

Description

Description

The chat the user is currently working in (e.g., the persistent chat handling this session) should render prominently in the TUI's graph view — high up, easy to find. Instead, it's buried among older tasks, sorted by some criterion that doesn't reflect recent activity.

User report 2026-05-01: 'The chat we're working in now, why isn't it rendering high up in the TUI, like relative to every message I've sent it?'

User mental model: a chat with frequent recent message activity is what the user is currently focused on; the TUI should reflect that focus. Sorting purely by creation time means the actively-used chat sinks below newer non-chat tasks; sorting purely by status means chats lump together and the user can't tell which is the active one.

Spec

Sort criterion for chat tasks

Within the in-progress chat-task group, sort by last activity timestamp (last message sent OR received, whichever is more recent). The chat with the most recent activity bubbles to the top.

Sort criterion for the broader task list

  • Status grouping stays as-is (in-progress before open before done, etc.) — chats don't ALWAYS leapfrog non-chat work
  • Within each status group, recent-activity sort applies
  • Chat tasks: 'last activity' = last message timestamp
  • Non-chat tasks: 'last activity' = last state change (started_at, last log entry, etc.)

What 'activity' means concretely

  • Chat task: max(last_user_message_at, last_agent_message_at) from chat history
  • Non-chat task: max(updated_at, last_log_entry_at) — the freshest signal of work happening

Visual treatment (optional polish)

Consider a subtle visual indicator that this is the 'active' chat — e.g., bolder weight, a small dot/marker, or a highlight on the row. Users with multiple chats benefit from this differentiation.

Validation

  • Failing test or repro: in TUI with multiple chat tasks of varying activity, the most-recently-messaged chat appears at the top of the chat-task group
  • Live smoke: send a message to chat-A; observe chat-A bubble to top. Switch to chat-B; send message; chat-B bubbles to top.
  • No regression: status grouping still works (in-progress before done, etc.)
  • Chat tab order in the chat tab bar is consistent with graph view ordering (or document the divergence if intentional)
  • cargo build + cargo test pass
  • cargo install --path . was run before claiming done

Coordinate with adjacent tasks

  • diagnose-tui-viewport (in-flight): viewport behavior — different concern (where the view is anchored), but if this fix changes the order of rows, the viewport's 'top of graph' calculation may shift accordingly. Verify they don't fight.
  • implement-tui-viewport (done): viewport stability policy. The user's prior preference 'top of view at top of graph' implies the most-recently-active task is what should be anchored at top — which is exactly what THIS fix implements via sort.

Depends on

Required by

Log