Skip to content

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

Closed as not planned

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

Activity

  1. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Mar 11, 2026
  2. github-actions commented on Mar 11, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    Please review #11863 in particular, as it describes the identical root cause and symptoms.

  3. added a commit that references this issue on Apr 7, 2026
    c312eae
  4. removed
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on May 3, 2026
  5. github-actions commented on Jul 4, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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