-
Notifications
You must be signed in to change notification settings - Fork 76
Transcript wrapper leakage still appears on v1.18.0 (system-reminder / thinking / tool_exec / tool_output / H:A wrappers) #167
Description
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
v1.18.0upstreamserver.tsstill has no transcript sanitizer for these wrapper forms- Earlier issues/PRs I checked:
- Tool call leakage: raw tool_use blocks appear as text instead of being executed #94 raw tool_use leakage
- sytem prompts showing in the context, like someone speacking to himself #106 talking-to-itself / system prompt leakage
- Missing tools usage and output #153 missing tools usage/output
- fix: remap block indices across multi-turn streaming responses #159 block index remapping
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.