You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Web UI: client-generated message IDs cause infinite processing loop when client/server clocks diverge #11863
When sending a message from the Web UI, the user message gets an ID that sorts after all assistant message IDs, causing the processing loop in prompt.ts to never exit.
This burns tokens indefinitely in the background, and it also prevent Web UI (or desktop UI I assume), to display the right message. On the TUI side, the user message is marked as queued.
Both use the same algorithm, but any clock skew between client and server means the user message ID sorts after (or before) assistant IDs, breaking the assumption that ID order = chronological order.
The loop exit condition at session/prompt.ts L296-303 checks lastUser.id < lastAssistant.id — if the user ID is "larger" (client clock ahead), the loop never breaks and keeps generating responses indefinitely.
Observed data (from the session messages endpoint, see attached JSON):
#
Role
ID
time.created
1
assistant
msg_c1f6b1d57001RHuvN3zOJhP9vQ
1770053639511
2
assistant
msg_c1f6b7956001ie0EeKm2LsYp68
1770053663062
3
assistant
msg_c1f71ddc4001pBbmRnquIAmNbi
1770054081988
4
user
msg_c20455b9d001RX64FkeGhqcCIC
1770053639500
The user message was created 11ms before the first assistant message (time.created: 1770053639500 vs 1770053639511), yet its ID timestamp hex (c20455b9d001) sorts after all assistant ID prefixes (c1f6..., c1f7...). The assistant messages reference the user message as parentID, confirming it's the original prompt.
This issue appears to be related to #7426 as it also involves incorrect message ordering due to ID sorting. In #7426, messages are exported in the wrong order because alphabetical ID sorting doesn't guarantee chronological order. In this issue (#11863), the loop exit condition relies on ID comparison assuming ID order correlates to message creation time, which breaks when client/server clocks diverge.
Both issues highlight the same architectural assumption: that message ID string comparison reflects chronological order. The fix for one should likely address concerns in both.
Activity
github-actions commentedon Feb 2, 2026
This issue might be a duplicate of existing issues. Please check:
This issue appears to be related to #7426 as it also involves incorrect message ordering due to ID sorting. In #7426, messages are exported in the wrong order because alphabetical ID sorting doesn't guarantee chronological order. In this issue (#11863), the loop exit condition relies on ID comparison assuming ID order correlates to message creation time, which breaks when client/server clocks diverge.
Both issues highlight the same architectural assumption: that message ID string comparison reflects chronological order. The fix for one should likely address concerns in both.
github-actions commentedon Apr 4, 2026
To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.
chenyuanrun commentedon May 19, 2026
I have the same issue, need to fix it