Skip to content

Ask the model again when its reply holds its own markup, then remove it - #67

Merged
TechNomadCode merged 1 commit into
mainfrom
fix/hide-model-markup
Nov 2, 2026
Merged

TechNomadCode merged 1 commit into
mainfrom
fix/hide-model-markup

Conversation

@TechNomadCode

Copy link
Copy Markdown
Owner

The owner saw gpt-oss-120b write its own control tokens (<|start|>, <|call|> and others) as the text of a reply, three times on "Draft the first section.": a search after a save, its reasoning and made-up searches, and a search in an answer's first call, so nothing ran or saved.

  • retryingModelMarkup in src/server/ai/cloudflare.ts sends the same request once more when a reply's text holds one of those tokens, at most once per model call. The reply carries both calls' tokens.
  • If the second reply holds markup too, its whole text goes, since the words before the first token can be reasoning. A tool call in the same reply stays.
  • The chat then treats it as a reply without words: a saved section stands alone, and otherwise the visitor gets the usual error and "Try again".
  • Two warnings, without the reply's text, show in the logs how often this happens and how often the retry helps.

This changes the transport, so it's one to note before the next measurement: the removed text no longer comes back with later messages, and a retried call sends a second HTTP request. The prompt, tools and generation settings are unchanged. No cause is isolated, and whether the retry usually works is unmeasured.

Checks: npm run verify passed locally (636 unit tests), with all three replies replayed in tests/unit/cloudflare.test.ts. Not yet seen on the real model.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@TechNomadCode
TechNomadCode merged commit 7e188fe into main Nov 2, 2026
5 checks passed
@TechNomadCode
TechNomadCode deleted the fix/hide-model-markup branch November 2, 2026 23:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant