anomalyco / anomalyco/opencode

WebChat: slash command output appears at wrong position in timeline

Open
#38,613 0 comments 0 reactions 1 assignee View on GitHub

@Brendonovich is already working on this.

Since Jul 24, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.