Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Bug]: opencode zen GLM 4.7 causes message ordering conflict that corrupts session for ALL models #998

@lazybutai

Description

@lazybutai

Describe the bug

When using the opencode zen GLM 4.7 model, it triggers a "Message ordering conflict" error that corrupts the session in a way that causes ALL models to fail until a full reset is performed.

Steps to reproduce

  1. Use opencode zen GLM 4.7 model
  2. Session runs for a while (sometimes after debugging loops or other issues)
  3. Suddenly all messages return: "Message ordering conflict - please try again. If this persists, use /new to start a fresh session."
  4. Critical: Even after using /new, /reset, or clawdbot /new, the error persists
  5. All other models also fail with the same error
  6. Only a full reset fixes it (see Workaround)

Expected behavior

  • Model should handle message ordering correctly
  • Session reset commands (/new, /reset) should recover from corrupted state
  • Corrupted session should be isolated to the problematic model/provider

Actual behavior

  • opencode zen GLM 4.7 triggers message ordering conflict
  • Error spreads to ALL models (not just the problematic one)
  • /new, /reset, and clawdbot /new don't recover the session
  • Complete reset required

Workaround (to recover)

  1. Delete all session files from ~/.clawdbot/sessions/
  2. Restart the clawdbot gateway completely (not just hot reload)
  3. Start a new session with a DIFFERENT model (e.g., z.ai coding plan GLM 4.7)

Environment

  • Problematic model: opencode zen GLM 4.7
  • Working model with same base: z.ai coding plan GLM 4.7
  • Other models: Work fine after recovery
  • Error source: src/agents/pi-embedded-helpers/errors.ts (lines 198-201) - triggered by LLM returning "incorrect role information" or "roles must alternate"

Additional notes

  • The same GLM 4.7 model from z.ai provider works without issues
  • This isolates the bug to the opencode provider's implementation
  • The session corruption shouldn't cascade to other models - suggests session state isn't properly isolated per-provider

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions