Skip to content

fix: reconcile ACP assistant chunks before end_turn#29120

Open
tonystark-agent wants to merge 1 commit into
anomalyco:devfrom
tonystark-agent:fix/acp-reconcile-prompt-deltas
Open

fix: reconcile ACP assistant chunks before end_turn#29120
tonystark-agent wants to merge 1 commit into
anomalyco:devfrom
tonystark-agent:fix/acp-reconcile-prompt-deltas

Conversation

@tonystark-agent
Copy link
Copy Markdown

Issue for this PR

Closes #17505

Type of change

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

What does this PR do?

ACP can resolve session/prompt before the final assistant deltas have drained to session/update, which lets clients observe end_turn with an empty or truncated visible reply.

This change serializes ACP sessionUpdate sends and reconciles the returned assistant message before end_turn. Any text/reasoning suffix that was not already streamed is replayed once, and late duplicate deltas are skipped or trimmed against the delivered character count.

How did you verify your code works?

  • bun test test/acp/event-subscription.test.ts --timeout 30000 from packages/opencode (15 pass)
  • bun run typecheck from packages/opencode
  • bun run lint packages/opencode/src/acp/agent.ts packages/opencode/test/acp/event-subscription.test.ts (0 errors; existing warnings only)
  • git diff --check

Screenshots / recordings

Not applicable; ACP transport ordering fix covered by unit tests.

Checklist

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

@github-actions
Copy link
Copy Markdown
Contributor

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

Potential Duplicate Found

PR #25683: fix(acp): drain message events before returning end_turn
#25683

Why it's related:
This PR addresses a very similar issue in the ACP subsystem—handling message event draining before the end_turn signal. Both PRs are focused on reconciling/draining assistant message deltas to ensure clients don't see truncated or empty replies when end_turn occurs. The current PR (29120) appears to be an evolution or refinement of the approach taken in PR #25683, with more robust reconciliation logic (replaying text/reasoning suffixes and handling duplicate deltas).

You should verify whether #25683 was closed/merged without fully resolving the issue, or if #29120 represents a new approach to the same problem.

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)

2 participants