Skip to content

fix(acp): drain updates before end turn - #40422

Merged
nexxeln merged 1 commit into
devfrom
fix-acp-order
Aug 4, 2026
Merged

fix(acp): drain updates before end turn#40422
nexxeln merged 1 commit into
devfrom
fix-acp-order

Conversation

@nexxeln

@nexxeln nexxeln commented Aug 4, 2026

Copy link
Copy Markdown
Member

Issue for this PR

Closes #17505

Type of change

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

What does this PR do?

Waits for the backing session to emit its idle status before returning the ACP prompt response. The ACP event subscription processes events sequentially and awaits each sessionUpdate, so observing idle guarantees earlier message and tool updates have reached the client before end_turn.

The waiter is registered before starting prompt, command, and summarize requests so an idle event cannot race the HTTP response. Pending turns also fail if the event stream disconnects instead of returning an incorrectly ordered response.

How did you verify your code works?

  • bun test test/acp from packages/opencode (128 pass)
  • bun typecheck from packages/opencode
  • pre-push bun turbo typecheck (30 packages)

Screenshots / recordings

Not applicable.

Checklist

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

@nexxeln
nexxeln merged commit 44614c7 into dev Aug 4, 2026
10 of 11 checks passed
@nexxeln
nexxeln deleted the fix-acp-order branch August 4, 2026 11:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

session/update notifications sent after session/prompt response (end_turn)

1 participant