Uh oh!
There was an error while loading. Please reload this page.
fix: use parentID matching instead of ID ordering for prompt loop exit and message rendering - #14307
fix: use parentID matching instead of ID ordering for prompt loop exit and message rendering#14307MakonnenMak wants to merge 2 commits into
Conversation
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
The following comment was made by an LLM, it may be inaccurate: Found one potentially related PR: Related PR:
The current PR (14307) takes a different approach to solving clock skew problems by using parentID matching instead of relying on timestamp-based ID ordering. PR #11869 may have attempted a fix at the ID generation level rather than the matching logic level. You may want to check if #11869 was merged or closed to understand the context. |
| if (input.assistantMessage.error) return "stop" | ||
| return "continue" | ||
| const exitReason = needsCompaction ? "compact" : blocked ? "stop" : input.assistantMessage.error ? "stop" : "continue" | ||
| return exitReason as any |
There was a problem hiding this comment.
We should avoid using 'any' for typing. See Contributing guidelines
There was a problem hiding this comment.
Fixed on latest commit thanks for flagging @alexyaroshuk . Unsure how to repro the windows e2e failure though, might it be flaky?
There was a problem hiding this comment.
Seems like it was, new run with rebase passed 🙏🏾
0e734cb to
6f428edCompare6f428ed to
fc258eaCompareMakonnenMak
commented
Feb 20, 2026
There was a conflict with the base dev branch so I had to fix and rebase. Done ✅ |
alexyaroshuk
commented
Feb 20, 2026
can't see any more issues, lgtm |
MakonnenMak
commented
Feb 21, 2026
@adamdotdevin wanted to bump for a review if you have some time 🙏🏾 currently blocking us from using opencode web on a coder.com remote dev env |
MakonnenMak
commented
Feb 24, 2026
@adamdotdevin bumping again, would be great to get this out |
adamdotdevin
commented
Feb 27, 2026
@rekram1-node want to get your eyes on this as well |
…r prompt loop exit and message rendering
…r prompt loop exit and message rendering
…r prompt loop exit and message rendering
…r prompt loop exit and message rendering
…r prompt loop exit and message rendering
…r prompt loop exit and message rendering
…r prompt loop exit and message rendering
…r prompt loop exit and message rendering
…r prompt loop exit and message rendering
…r prompt loop exit and message rendering
…r prompt loop exit and message rendering
sjqwert
commented
Apr 5, 2026
This PR cannot be merged into the beta branch due to: Merge failed Please resolve this issue to include this PR in the next beta release. |
MakonnenMak
commented
Apr 6, 2026
@sjqwert on it |
…t-loop-exit # Conflicts: # packages/opencode/src/session/prompt.ts
This PR cannot be merged into the beta branch due to: Merge conflicts with dev branch Please resolve this issue to include this PR in the next beta release. |
4 similar comments
This PR cannot be merged into the beta branch due to: Merge conflicts with dev branch Please resolve this issue to include this PR in the next beta release. |
This PR cannot be merged into the beta branch due to: Merge conflicts with dev branch Please resolve this issue to include this PR in the next beta release. |
This PR cannot be merged into the beta branch due to: Merge conflicts with dev branch Please resolve this issue to include this PR in the next beta release. |
This PR cannot be merged into the beta branch due to: Merge conflicts with dev branch Please resolve this issue to include this PR in the next beta release. |
This PR cannot be merged into the beta branch due to: Merge conflicts with dev branch Please resolve this issue to include this PR in the next beta release. |
17 similar comments
This PR cannot be merged into the beta branch due to: Merge conflicts with dev branch Please resolve this issue to include this PR in the next beta release. |
This PR cannot be merged into the beta branch due to: Merge conflicts with dev branch Please resolve this issue to include this PR in the next beta release. |
This PR cannot be merged into the beta branch due to: Merge conflicts with dev branch Please resolve this issue to include this PR in the next beta release. |
This PR cannot be merged into the beta branch due to: Merge conflicts with dev branch Please resolve this issue to include this PR in the next beta release. |
This PR cannot be merged into the beta branch due to: Merge conflicts with dev branch Please resolve this issue to include this PR in the next beta release. |
This PR cannot be merged into the beta branch due to: Merge conflicts with dev branch Please resolve this issue to include this PR in the next beta release. |
This PR cannot be merged into the beta branch due to: Merge conflicts with dev branch Please resolve this issue to include this PR in the next beta release. |
This PR cannot be merged into the beta branch due to: Merge conflicts with dev branch Please resolve this issue to include this PR in the next beta release. |
This PR cannot be merged into the beta branch due to: Merge conflicts with dev branch Please resolve this issue to include this PR in the next beta release. |
This PR cannot be merged into the beta branch due to: Merge conflicts with dev branch Please resolve this issue to include this PR in the next beta release. |
This PR cannot be merged into the beta branch due to: Merge conflicts with dev branch Please resolve this issue to include this PR in the next beta release. |
This PR cannot be merged into the beta branch due to: Merge conflicts with dev branch Please resolve this issue to include this PR in the next beta release. |
This PR cannot be merged into the beta branch due to: Merge conflicts with dev branch Please resolve this issue to include this PR in the next beta release. |
This PR cannot be merged into the beta branch due to: Merge conflicts with dev branch Please resolve this issue to include this PR in the next beta release. |
This PR cannot be merged into the beta branch due to: Merge conflicts with dev branch Please resolve this issue to include this PR in the next beta release. |
This PR cannot be merged into the beta branch due to: Merge conflicts with dev branch Please resolve this issue to include this PR in the next beta release. |
This PR cannot be merged into the beta branch due to: Merge conflicts with dev branch Please resolve this issue to include this PR in the next beta release. |
MakonnenMak
commented
Apr 20, 2026
Closing this since the original UI bug is now fixed upstream in #23093. This PR also included a |
Issue for this PR
Closes#14236
Type of change
What does this PR do?
Fixes#14236
Large # of line changes test additions.
When the client and server clocks are out of sync (e.g. browser on a local machine, server on a remote host), client-generated message IDs can sort after server-generated assistant IDs because IDs are timestamp-based. This caused two bugs:
SessionTurnonly scanned forward from the user message index to find assistant replies. With skewed IDs, the assistant sorts before the user message and was never found.Fix: Both checks now use
parentIDmatching instead of relying on ID/timestamp ordering:shouldExitLoop()inprompt.ts— checkslastAssistant.parentID === lastUser.idregardless of ID sort order.findAssistantMessages()infind-assistant-messages.tsx— scans forward first, then backward if nothing found, matching onparentID.console.logstatements added during investigation.I was running into this on coder.com remote environments where opencode web seemingly takes minutes to get a response back or just infinitely loops.
How did you verify your code works?
shouldExitLoopunit tests (8 cases): normal exit, clock skew exit, tool-calls, unknown, no assistant, no finish, parentID mismatch, no userfindAssistantMessagesunit tests (8 cases): normal ordering, clock skew ordering, no assistant, multiple assistants, parentID mismatch, scan boundaries, invalid indexScreenshots / recordings
N/A — no UI changes, logic-only fix.
Checklist