Skip to content

fix: strip echoed tags from V2 Responses replies - #700

Merged
Tarquinen merged 1 commit into
devfrom
fix/strip-echoed-tags
Dec 3, 2026
Merged

Tarquinen merged 1 commit into
devfrom
fix/strip-echoed-tags

Conversation

@Tarquinen

Copy link
Copy Markdown
Owner

On OpenCode V2, models copy DCP's @N@ tags and the <dcp-system-reminder> block onto the end of their own replies, and that text is shown in the chat and stored (#632).

Now DCP removes them from the end of the finished reply for providers that use the OpenAI Responses API, over both HTTP and WebSocket. Tags in the middle of a reply are left alone.

This does not cover Anthropic or chat-completions providers. They only stream the reply in pieces, so there is no finished text to clean without a new host hook. The tag also still flashes while the reply streams, and the WebSocket path needs OpenCode 2.0.6 or later.

Tested in Docker with a mock provider on OpenCode 2.0.4, 2.0.11 and 2.4.3, checking both the printed reply and the stored message, and against live gpt-5-nano and gpt-6-sol: the tag is echoed on dev and gone with this change.

Refs #632

@linsaftw

linsaftw commented Dec 3, 2026

Copy link
Copy Markdown

Thank you !

linsaftw added a commit to linsaftw/opencode-dynamic-context-pruning that referenced this pull request Dec 3, 2026
Merges Tarquinen/opencode-dynamic-context-pruning v3.2.2 into the fork.

Conflict resolution:
- lib/v2/index.ts: keep the fork's JSON/SSE response sanitizer and the fork's
  "generate" session hook kind; add the upstream Responses/WS echoed-tail hooks
  that strip copied reminders and compact tags. The new hooks run before the
  existing sanitizer so both layers compose.
- package.json: take upstream tar 8.1.0 while retaining fork ws 8.23.1 and
  cross-spawn 7.1.2 overrides; drop the duplicated cross-spawn key.
- package-lock.json: keep fork version identity with upstream tar entries.
- Version advanced to 3.2.2-fork.1 (fork 3.2.1-fork.5 + upstream 3.2.2).

Docs: ledger gains Tarquinen#700/Tarquinen#701/Tarquinen#702, Tarquinen#642 moves to partial, verification table
records the new current release.

Refs: Tarquinen#700
Refs: Tarquinen#701
Refs: Tarquinen#702
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.

2 participants