From 361320cd9ff342b5212e7e1b7a1636ca89f57c9c Mon Sep 17 00:00:00 2001 From: Vincent Koc Date: Fri, 19 Jun 2026 01:16:31 +0800 Subject: [PATCH] refactor(text): remove unused final tag predicate --- src/gateway/gateway-models.profiles.live.test.ts | 4 ++-- src/shared/text/final-tags.ts | 5 ----- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/gateway/gateway-models.profiles.live.test.ts b/src/gateway/gateway-models.profiles.live.test.ts index e8dedb699fad..e5f9aaac4cff 100644 --- a/src/gateway/gateway-models.profiles.live.test.ts +++ b/src/gateway/gateway-models.profiles.live.test.ts @@ -58,7 +58,7 @@ import { resolveProviderThinkingProfile } from "../plugins/provider-runtime.js"; import type { ProviderThinkingModelCompat } from "../plugins/provider-thinking.types.js"; import { DEFAULT_AGENT_ID } from "../routing/session-key.js"; import { stripAssistantInternalScaffolding } from "../shared/text/assistant-visible-text.js"; -import { containsFinalTag, stripFinalTags } from "../shared/text/final-tags.js"; +import { findFinalTagMatches, stripFinalTags } from "../shared/text/final-tags.js"; import { GATEWAY_CLIENT_MODES, GATEWAY_CLIENT_NAMES } from "../utils/message-channel.js"; import { GatewayClient } from "./client.js"; import { @@ -598,7 +598,7 @@ function assertNoReasoningTags(params: { if (!params.text) { return; } - if (THINKING_TAG_RE.test(params.text) || containsFinalTag(params.text)) { + if (THINKING_TAG_RE.test(params.text) || findFinalTagMatches(params.text).length > 0) { const snippet = params.text.length > 200 ? `${params.text.slice(0, 200)}…` : params.text; throw new Error( `[${params.label}] reasoning tag leak (${params.model} / ${params.phase}): ${snippet}`, diff --git a/src/shared/text/final-tags.ts b/src/shared/text/final-tags.ts index a810f78661fb..d49f290926f5 100644 --- a/src/shared/text/final-tags.ts +++ b/src/shared/text/final-tags.ts @@ -130,11 +130,6 @@ export function findFinalTagMatches(text: string): FinalTagMatch[] { return matches; } -/** Returns true when text contains at least one valid `` control tag. */ -export function containsFinalTag(text: string): boolean { - return findFinalTagMatches(text).length > 0; -} - /** Removes valid `` tags while preserving their enclosed visible answer text. */ export function stripFinalTags(text: string): string { let output = "";