Skip to content

WebChat: slash command output appears at wrong position in timeline #38613

Description

@lileilei-camera

Describe the bug

In WebChat, when using slash commands (e.g. /memory, /plan), the command output sometimes appears at the wrong position in the timeline — above the previous message instead of below it.

To Reproduce

  1. Complete a normal chat turn (send a message, wait for AI response)
  2. Immediately send a slash command (e.g. /memory status)
  3. Observe that the slash command output may appear above the previous AI response

Expected behavior

Slash command output should always appear in chronological order at the bottom of the conversation.

Root Cause

Event-stream race condition: when slash command output messages arrive before the previous turn's final flush events, the sync data array contains messages in the wrong order. The messages memo in model.ts and the createTimelineProjection call in message-timeline.tsx both use the unsorted sync array directly.

Proposed Fix

  • model.ts: sort messages by time.created in the messages memo
  • message-timeline.tsx: add orderedMessages memo as defensive layer

Metadata

Metadata

Assignees

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