Skip to content

Transcript wrapper leakage still appears on v1.18.0 (system-reminder / thinking / tool_exec / tool_output / H:A wrappers) #167

@disolaterX

Description

@disolaterX

Summary

There is still a transcript-leakage class on current upstream main / v1.18.0 that is distinct from the earlier raw tool_use text and block-index issues.

The proxy can still surface internal orchestration / transcript wrapper text into model-visible content, for example:

  • <system-reminder> ... </system-reminder>
  • <task_metadata> ... </task_metadata>
  • <thinking> ... </thinking>
  • leaked <tool_exec ...> / <tool_output ...> wrappers
  • <!-- OMO_INTERNAL_INITIATOR -->
  • H: / A: transcript prefixes
  • ⚙ background_output [task_id=...]

When these leak into prompt reconstruction or forwarded text, Claude can start echoing them back as normal conversation text.

Example symptom

Things like this show up in assistant-visible output instead of being treated as internal transcript/control formatting:

Thinking: The user wants me to handle the case...
Tool Use: read({...})
H: [Tool Result for toolu_...: ...]
A: <tool_exec name="bash" />
<system-reminder>...</system-reminder>

This is very similar in user impact to #94 and #106, but the currently leaked shapes are broader than raw [Tool Use: ...] text alone.

What I checked

Those fixes help adjacent problems, but they do not seem to strip these specific wrapper patterns before they become model/user-visible.

Suggested direction

A small, targeted sanitizer at the proxy boundary for text-only content paths (prompt reconstruction + streamed/non-stream text forwarding), stripping only internal transcript wrappers while preserving real tool semantics.

Patterns that seemed necessary in local testing:

  • <system-reminder>[\\s\\S]*?</system-reminder>
  • <task_metadata>[\\s\\S]*?</task_metadata>
  • <thinking>[\\s\\S]*?</thinking>
  • <tool_output\\b[^>]*>[\\s\\S]*?</tool_output>
  • <tool_exec\\b[^>]*\\/> and paired form
  • <!-- OMO_INTERNAL_INITIATOR -->
  • \\[SYSTEM DIRECTIVE: OH-MY-OPENCODE[^\\]]*\\]
  • ⚙ background_output [task_id=...]
  • stray H: / A: wrapper prefixes

Why this matters

These wrappers are orchestration/debug transcript artifacts, not semantic content Claude needs. If they enter normal conversation text, they can confuse the model and create the impression that it is "talking to itself" again.

If useful, I can provide a minimal patch shape that only addresses these wrapper leaks without changing broader session/model logic.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions