Skip to content

fix: hide system reminders in chat#45

Open
lauridskern wants to merge 1 commit into
mainfrom
fix/31-hide-system-reminders
Open

fix: hide system reminders in chat#45
lauridskern wants to merge 1 commit into
mainfrom
fix/31-hide-system-reminders

Conversation

@lauridskern
Copy link
Copy Markdown
Owner

Summary

Prevent raw <system_reminder> XML from rendering in chat messages.

Context

Resolves #31. System reminders can appear in assistant-visible transcript text, but that internal markup should not be displayed directly to users.

Changes

  • Sanitize assistant, reasoning, and status output transcript text while building chat thread items.
  • Remove <system_reminder>...</system_reminder> blocks before messages reach the visible chat rows.
  • Drop messages that contain only a system reminder after sanitization.
  • Added regression coverage for both mixed-content and reminder-only assistant messages.

Testing

  • cargo check --manifest-path src-tauri/Cargo.toml
  • git diff --check

Attempted but unavailable in this environment:

  • bun test src/components/chat/ChatWorkRow.test.ts (bun is not installed)
  • npx tsc -b (npx is not installed)

Links

Copy link
Copy Markdown

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

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: fb94b6bfc3

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +15 to +18
return text
.replace(SYSTEM_REMINDER_PATTERN, "")
.replace(/\n{3,}/gu, "\n\n")
.trim();
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 Avoid trimming normal assistant text in sanitizer

removeSystemReminderMarkup always applies .replace(/\n{3,}/, ...) and .trim() even when the message contains no <system_reminder> tag, so this commit now rewrites all assistant/reasoning/status output text rather than only removing internal markup. That can alter user-visible formatting (for example, leading indentation used for Markdown code blocks or intentional extra blank lines) in ordinary responses, which is a behavior regression unrelated to reminder removal.

Useful? React with 👍 / 👎.

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.

Prevent system_reminder XML from rendering in chat messages

1 participant