anomalyco / anomalyco/opencode
Submitted prompt is stored twice in the app message store (fork dialog duplicates, undo leaves a ghost)
@Brendonovich is already working on this.
Since Aug 9, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Description
Since #41001 (91132551) the web/desktop app keeps two copies of every submitted prompt in the client message store.
The prompt input adds an optimistic user message stamped with the client's Date.now() and sends the same message id to the server, which persists it with its own timestamp when the prompt lands — so the server copy's time.created is always a bit later. The message.updated handler now resolves rows by messageKey (time.created + id) instead of id, misses the optimistic row because the key differs, and splices the server copy in next to it: same id, two rows.
Knock-on effects until a full session refetch: the fork dialog reads this store without deduping, so the prompt is listed twice; message.removed deletes only the first same-id row, so removing the message leaves a ghost copy; mergeOptimisticPage never confirms the optimistic item because its exact-key search misses too. Same pattern in server-session.ts (message.updated handler and mergeOptimisticPage), sync.tsx, and global-sync/event-reducer.ts.
Steps to reproduce
- In the web app, submit a prompt in any session
- The session's message store now holds two rows with the same message id and different
time.created— the fork dialog lists the prompt twice - Unit-level repro: sync a
createServerSessionstore containing a message attime.created: 1, then applymessage.updatedwith the same id attime.created: 2— the store ends up with 2 rows instead of replacing the one
OpenCode version
dev @ 0bff28de
Operating System
reproduced at the store level (unit test), platform-independent
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.