Skip to content

[BUG] Background subagent final response delivered as thousands of duplicated <acp> message-ref tags instead of report text #43746

Closed as not planned

Description

@rorshopping

Description

A background subagent (task tool, background=true, general agent) completed its work correctly on disk, but the final response delivered to the parent session was corrupted: instead of the actual report text, the parent received ~11K tokens consisting of the literal string <acp tokens=N type=text>mNNNNN</acp> repeated hundreds of times, referencing the child session's own internal message IDs (e.g. m00001–m00086). Zero actual report text was delivered.

This looks like the message-reference annotation pass (ACP/bili-style context-management tags rendered as <acp ...>mNNNNN</acp> prefixes) recursing on or echoing its own output while serializing the child→parent completion payload.

Environment

  • OpenCode harness with ACP context-management (bili) tooling
  • Platform: Windows 11, PowerShell
  • Subagent type: general, launched with background=true
  • Session context: long-running session (~10 prior subagent completions, heavy bili_compress usage)

Steps to reproduce

Not reliably reproducible yet. Observed twice-shaped failure modes in one session (~10 background subagent runs):

  1. This bug: child finishes real work (verified independently on disk), final message arrives as thousands of duplicated <acp> tag lines instead of text.
  2. Related: another run same day ended state=completed with no text at all and no work performed — matches [BUG] Subagent terminates prematurely mid-execution but reports completed #32132.

Observed behavior

  • Parent received a completion event with an ~11K-token message containing only repeated <acp tokens=... type=text>mNNNNN</acp> fragments
  • The referenced mNNNNN ids belong to the child session, not the parent
  • No error surfaced anywhere; state was completed

Expected behavior

  • Final assistant text is delivered verbatim exactly once, with at most one annotation prefix per part
  • If serialization fails or final text is empty, the completion should fail loudly (or retry) rather than deliver garbage/silence

Impact

Parent agents silently lose subagent reports and must independently verify all work (which is what happened here — the work itself was fine). At ~20% of background completions misbehaving in one session, this materially erodes trust in fire-and-forget delegation.

Suggested fix

Sanitize/validate the child→parent completion payload: render annotations exactly once, strip nested/self-referential tag output, and treat an empty final text as an error state rather than a successful completion.

Activity

  1. github-actions commented on Aug 21, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of or closely related to existing issues. Please check:

  2. nexxeln commented on Oct 1, 2026

    @nexxeln
    Contributor

    Not an opencode bug: the <acp> message-ref tags come from a third-party context plugin, not from opencode or the Agent Client Protocol. Please report it to that plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions