Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion agent/moa_loop.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,13 @@ def _reference_messages(messages: list[dict[str, Any]]) -> list[dict[str, Any]]:
if role == "user":
if text.strip():
last_user_content = text
rendered.append({"role": "user", "content": text})
rendered.append({"role": "user", "content": text})

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This skips blank turns only when another message renders. With a transcript containing only {"role": "user", "content": " "}, rendered stays empty and the unchanged fallback at lines 521-527 returns the whitespace string as a user message. Please harden that fallback and add an empty-only regression test.

# Empty/whitespace-only user messages are skipped entirely.
# ZAI (glm-5.2) rejects empty user content with error 1213
# ("The prompt parameter was not received normally"), and other
# strict providers may behave similarly. Dropping them avoids
# both the 1213 and any consecutive-role alternation violation
# they might create.
elif role == "assistant":
parts: list[str] = []
if text.strip():
Expand Down