fix(imessage): detect namespaced thinking reflections#95690
Closed
Pick-cat wants to merge 1 commit into
Closed
Conversation
Contributor
Author
|
Closing this as superseded by the existing iMessage canonical branch: #93820. I rechecked both diffs. This PR and #93820 make the same production change in This PR's source-level proof was valid, but keeping both open creates duplicate landing risk. The right path is to keep the review and CI discussion on #93820. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Problem This Solves
iMessage's reflection guard had a local thinking-tag detector that recognized bare
<think>/<thinking>/<thought>tags, but not the namespaced forms already handled by the shared reasoning-tag helper and Slack path. Reflected assistant content containing<mm:think>...</mm:think>or<antml:thinking>...</antml:thinking>could therefore bypassdetectReflectedContent()and continue through inbound processing.Why This Change Was Made
extensions/imessage/src/monitor/inbound-processing.tsdrops inbound messages whendetectReflectedContent()identifies assistant-internal markers. The detector inextensions/imessage/src/monitor/reflection-guard.tskept a local thinking-tag regex that had not picked up the knownmm:andantml:namespace prefixes. This change aligns that detector with the shared/Slack thinking tag family while preserving the existing requirement for a complete tag close bracket.User Impact
iMessage users get stronger loop/reflection protection for model outputs that use MiniMax or Anthropic-style namespaced thinking tags. Normal user text and code examples remain protected by the existing code-region checks.
Evidence
main(8e76feb482): temporarily added the same regression assertions toextensions/imessage/src/monitor/reflection-guard.test.tsand rannode scripts/run-vitest.mjs extensions/imessage/src/monitor/reflection-guard.test.ts.main: failed as expected.detectReflectedContent("<mm:think>internal reasoning</mm:think>").isReflectionreturnedfalse.git diff --checkpassed..agents/skills/autoreview/scripts/autoreview --mode localpassed with no accepted/actionable findings.