Skip to content

fix(acp): backfill missing text chunks from part updates#15614

Open
nkosi23 wants to merge 7 commits intoanomalyco:devfrom
nkosi23:dev
Open

fix(acp): backfill missing text chunks from part updates#15614
nkosi23 wants to merge 7 commits intoanomalyco:devfrom
nkosi23:dev

Conversation

@nkosi23
Copy link

@nkosi23 nkosi23 commented Mar 1, 2026

Issue for this PR

Closes #15613

Type of change

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

What does this PR do?

  • Some ACP clients/plugins (e.g. JetBrains/GLM plugin) can miss or delay message.part.delta delivery, causing assistant output to appear truncated until a later refresh.
  • The agent needs to emit any missing assistant/reasoning chunks when only message.part.updated arrives so ACP clients receive output incrementally.

This PR therefore contains:

  • Added textSnapshots: Map<string,string> to packages/opencode/src/acp/agent.ts to track the last-seen text for each part id.
  • Handle message.part.updated for text and reasoning parts by computing the missing delta via textDelta(id, next) and emitting an agent_message_chunk or agent_thought_chunk containing only the new text.
  • Update message.part.delta handling to keep textSnapshots in sync (store full part text) so delta and updated events don’t cause duplicate emission.

Codex Task

If you paste a large clearly AI generated description here your PR may be IGNORED or CLOSED!

How did you verify your code works?

I have added unit tests

Screenshots / recordings

image

Checklist

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

If you do not follow this template your PR will be automatically rejected.

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

github-actions bot commented Mar 1, 2026

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

Based on my search, I found two potentially related PRs that deal with similar concerns about duplicate events and streaming updates:

Potentially Related PRs:

  1. PR refactor(opencode): replace reconcile() with path-syntax setStore and delta coalescing for streaming updates #15309: refactor(opencode): replace reconcile() with path-syntax setStore and delta coalescing for streaming updates

  2. PR fix(app): prevent streaming content duplication during event coalescing #14820: fix(app): prevent streaming content duplication during event coalescing

However, neither of these appears to be a direct duplicate of PR #15614 (the current PR), as they address different aspects of the codebase. PR #15614 is specifically focused on backfilling missing text chunks in the ACP agent when message.part.updated arrives without message.part.delta, whereas the other PRs deal with broader streaming and coalescing concerns.

@github-actions github-actions bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Mar 1, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 1, 2026

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@nkosi23
Copy link
Author

nkosi23 commented Mar 7, 2026

@adamdotdevin 🙏

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.

ACP in JetBrains Rider: assistant output chunks are delayed/truncated until next prompt when using GLM5 plugin

1 participant