Skip to content

fix(web): hide injected system asides in user message bubbles - #1535

Merged
wbxl2000 merged 3 commits into
mainfrom
fix/web-hide-system-asides
Jul 10, 2026
Merged

fix(web): hide injected system asides in user message bubbles#1535
wbxl2000 merged 3 commits into
mainfrom
fix/web-hide-system-asides

Conversation

@wbxl2000

Copy link
Copy Markdown
Collaborator

Related Issue

No linked issue — see Problem.

Problem

When a user uploads a large image on the web UI, the server compresses it and inlines a model-facing <system>Image compressed to fit model limits: …</system> aside next to the image. The web app rendered that aside verbatim as user text inside the message bubble, leaking harness markup that should stay hidden from the user.

What changed

Strip every <system>…</system> block from a user turn's text when converting messages to chat turns. It keys on the tag rather than on any specific caption wording, so the stripping stays robust to caption wording changes and also covers any other injected aside. Added regression tests for the standalone caption part, caption-only uploads, captions merged into prose, arbitrary <system> asides, and a guard that ordinary text and stray angle brackets are left untouched.

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue, or explained the problem above.
  • I have added tests that prove my feature works.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

@changeset-bot

changeset-bot Bot commented Jul 10, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 99f739a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@moonshot-ai/kimi-code Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Jul 10, 2026

Copy link
Copy Markdown
pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@99f739a
npx https://pkg.pr.new/@moonshot-ai/kimi-code@99f739a

commit: 99f739a

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: db51059bea

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +717 to +719
const stripped = stripSystemTags(c.text);
if (stripped !== c.text && stripped.trim().length === 0) continue;
textParts.push(stripped);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve literal system tags in user prompts

Because msg.content also carries verbatim user text for normal user/absent origins, stripping every <system>...</system> block here removes content when a user intentionally pastes or asks about that markup (for example XML/prompt examples). The bubble text and edit/resend payload derived from turn.text then no longer match what the user sent; restrict this to known injected captions/metadata instead of all user text parts.

Useful? React with 👍 / 👎.

@wbxl2000

Copy link
Copy Markdown
Collaborator Author

@codex

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2ca156a804

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread .changeset/web-preserve-system-tags.md Outdated
"@moonshot-ai/kimi-code": patch
---

web: Fix user-typed `<system>` text being removed from message bubbles and edit/resend payloads.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3 Badge Remove the misleading duplicate changeset

This commit only ships the narrow image-compression caption stripping; ordinary user-typed <system> blocks were already preserved by the parent behavior and still are. Leaving this second changeset will produce a separate changelog entry claiming a user-visible fix that was not actually part of the release, alongside the real caption-hiding entry, so the release notes become misleading. Please fold or remove this changeset and keep one entry for the actual web fix.

Useful? React with 👍 / 👎.

@wbxl2000

Copy link
Copy Markdown
Collaborator Author

@codex

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: 99f739af9b

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@wbxl2000
wbxl2000 merged commit 04041eb into main Jul 10, 2026
10 checks passed
@wbxl2000
wbxl2000 deleted the fix/web-hide-system-asides branch July 10, 2026 09:02
@github-actions github-actions Bot mentioned this pull request Jul 10, 2026
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