#22832: fix: strip [[reply_to_current]] directive from chat history
app: web-ui
gateway
size: XS
Cluster:
Model Reasoning Fixes
Codex 5.3 emits [[reply_to_current]] tags that leak into the web UI via chat.history. This strips them in sanitizeChatHistoryContentBlock, matching the same patterns already handled by parseInlineDirectives() on messaging-channel paths.
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Added `stripChatDirectiveTags()` to remove Codex 5.3 directive tags (`[[reply_to_current]]`, `[[reply_to:...]]`, `[[audio_as_voice]]`) from chat history content blocks before serving to the web UI, matching the same patterns already handled by `parseInlineDirectives()` in `directive-tags.ts`.
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge with minimal risk
- The change is minimal and well-scoped: it adds a sanitization step to strip directive tags from chat history using a regex pattern that matches the existing implementation in `directive-tags.ts`. The logic correctly tracks whether changes were made and integrates cleanly into the existing sanitization pipeline.
- No files require special attention
<sub>Last reviewed commit: bc914bb</sub>
<!-- greptile_other_comments_section -->
<sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#23370: fix: strip [[reply_to_current]] tags from WebChat + validate invoke...
by alexmelges · 2026-02-22
83.6%
#20164: fix(webchat): strip reply directive tags before rendering assistant...
by Limitless2023 · 2026-02-18
82.7%
#23073: fix(ui): strip reply directive tags from assistant messages in WebC...
by x4v13r1120 · 2026-02-22
82.4%
#23144: fix(ui): strip reply directive tags from assistant messages in WebC...
by echoVic · 2026-02-22
79.1%
#20231: fix: strip untrusted metadata blocks from chat history
by MisterGuy420 · 2026-02-18
78.7%
#15204: fix(ui): preserve angle-bracketed text in chat
by bufordtjustice2918 · 2026-02-13
77.7%
#17244: fix: strip TTS tags from agent replies before delivery (#14652)
by robbyczgw-cla · 2026-02-15
77.5%
#8334: fix(webchat): Filter NO_REPLY messages from chat history
by vishaltandale00 · 2026-02-03
77.5%
#23271: fix(chat): strip untrusted metadata blocks from Control UI messages
by lbo728 · 2026-02-22
76.1%
#8742: fix(webchat): hide internal system messages from UI (#7440)
by revenuestack · 2026-02-04
76.1%