anomalyco / anomalyco/opencode
[BUG] Background subagent final response delivered as thousands of duplicated <acp> message-ref tags instead of report text
@neriousy is already working on this.
Since Aug 21, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
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):
- This bug: child finishes real work (verified independently on disk), final message arrives as thousands of duplicated
<acp>tag lines instead of text. - Related: another run same day ended
state=completedwith no text at all and no work performed — matches #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
mNNNNNids 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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.