Skip to content

Stream text/reasoning deltas to ACP and deduplicate using snapshots#2

Merged
nkosi23 merged 1 commit intodevfrom
codex/fix-output-truncation-in-acp-agent-plugin-68apj7
Mar 1, 2026
Merged

Stream text/reasoning deltas to ACP and deduplicate using snapshots#2
nkosi23 merged 1 commit intodevfrom
codex/fix-output-truncation-in-acp-agent-plugin-68apj7

Conversation

@nkosi23
Copy link
Owner

@nkosi23 nkosi23 commented Mar 1, 2026

Motivation

  • Ensure incremental text and reasoning updates are forwarded to ACP when message.part.updated events arrive without explicit delta events.
  • Prevent duplicated chunks when a message.part.delta is followed by a message.part.updated that includes the same content.

Description

  • Add a textSnapshots map to track the last full text for each part via textSnapshots.
  • Add a textDelta helper that computes the incremental delta from the previous snapshot and updates the snapshot.
  • Send incremental agent message chunks for text and reasoning parts in the message.part.updated flow using textDelta.
  • Update message.part.delta handling to set the snapshot (textSnapshots.set) when full text is available to avoid replaying the same content.
  • Add unit tests in packages/opencode/test/acp/event-subscription.test.ts to verify that text chunks are emitted for message.part.updated and that duplicate chunks are not produced when a delta is followed by an updated event.

Testing

  • Ran the ACP event subscription tests in packages/opencode/test/acp/event-subscription.test.ts via yarn test for the package and the new tests passed.
  • The two added tests (emits text chunks from message.part.updated when delta events are absent and does not duplicate chunks when message.part.delta is followed by message.part.updated) succeeded as part of the suite.

Codex Task

@nkosi23 nkosi23 merged commit d216b6d into dev Mar 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant