Skip to content

Web sessions can loop indefinitely when user message IDs are generated on the client #17012

@ShenAC-SAC

Description

@ShenAC-SAC

Summary

Web sessions can enter an infinite assistant loop after a finished response.

Reproduction

  1. Run the opencode server on one machine
  2. Open the web UI from another machine
  3. Submit a prompt
  4. Observe that an assistant message finishes with stop
  5. Observe that the session immediately returns to busy and creates another assistant message for the same user prompt

Root cause

The web app generates the user messageID in the browser, while assistant message IDs are generated on the server.

SessionPrompt.loop() uses message ID ordering to decide whether the latest finished assistant message belongs to the latest user message:

lastUser.id < lastAssistant.id

That ordering is not reliable across machines. The correct relationship is lastAssistant.parentID === lastUser.id.

Impact

  • repeated assistant messages for the same user prompt
  • hidden context growth
  • increasingly strange follow-up outputs
  • sessions appearing stuck in busy

Metadata

Metadata

Assignees

Labels

coreAnything pertaining to core functionality of the application (opencode server stuff)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions