Skip to content

Fix err msg order#21473

Closed
LydiaCai1203 wants to merge 1 commit intoanomalyco:devfrom
LydiaCai1203:fix-err-msg-order
Closed

Fix err msg order#21473
LydiaCai1203 wants to merge 1 commit intoanomalyco:devfrom
LydiaCai1203:fix-err-msg-order

Conversation

@LydiaCai1203
Copy link
Copy Markdown

Issue for this PR

Closes #21314

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

This PR fixes an issue where session updates could be applied out of order, leading to incorrectly ordered messages.

The root cause was that session updates were processed concurrently, so their execution order was not guaranteed. As a result, message ordering could become inconsistent depending on timing.

This change serializes session updates to ensure they are processed in a strict sequence. By enforcing ordered execution, message order is now deterministic and consistent, avoiding race conditions without introducing significant overhead.

How did you verify your code works?

  • Reproduced the issue locally by triggering multiple rapid session updates
  • Observed that messages could appear out of order before the fix
  • Verified that after this change, messages are consistently ordered
  • Tested normal flows to ensure no regressions

Screenshots / recordings

N/A

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions github-actions bot added the needs:compliance This means the issue will auto-close after 2 hours. label Apr 8, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 8, 2026

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • No "Type of change" checkbox is checked. Please select at least one.
  • Not all checklist items are checked. Please confirm you have tested locally and have not included unrelated changes.

Please edit this PR description to address the above within 2 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 8, 2026

Hey! Your PR title Fix err msg order doesn't follow conventional commit format.

Please update it to start with one of:

  • feat: or feat(scope): new feature
  • fix: or fix(scope): bug fix
  • docs: or docs(scope): documentation changes
  • chore: or chore(scope): maintenance tasks
  • refactor: or refactor(scope): code refactoring
  • test: or test(scope): adding or updating tests

Where scope is the package name (e.g., app, desktop, opencode).

See CONTRIBUTING.md for details.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 8, 2026

The following comment was made by an LLM, it may be inaccurate:

Based on my search results, I found one potentially related PR:

Related PR:

This PR (21473) appears to fix the underlying root cause (serializing session updates to prevent race conditions), while PR #17149 specifically addresses ordering messages by creation time on the web side. They are complementary fixes for message ordering issues.

No other duplicate PRs found that directly address the same issue.

All ACP sessionUpdate calls are now routed through a promise chain
(`sendUpdate`) that guarantees ordering. After each prompt completes,
a reconciliation step fetches the final assistant message and delivers
any text/reasoning content that was missed by SSE delta events — fixing
a race where streaming events arrive after end_turn.

Also adds handling for the `question.asked` event via the ACP permission
flow, and updates the question tool to use a two-step async pattern.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 8, 2026

This pull request has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window.

Feel free to open a new pull request that follows our guidelines.

@github-actions github-actions bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Apr 8, 2026
@github-actions github-actions bot closed this Apr 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant