Skip to content

fix: escape Rich markup in error and user content to prevent crashes#1462

Open
Br1an67 wants to merge 1 commit intoMoonshotAI:mainfrom
Br1an67:fix/rich-markup-escape
Open

fix: escape Rich markup in error and user content to prevent crashes#1462
Br1an67 wants to merge 1 commit intoMoonshotAI:mainfrom
Br1an67:fix/rich-markup-escape

Conversation

@Br1an67
Copy link

@Br1an67 Br1an67 commented Mar 17, 2026

Problem

In print mode, from rich import print replaces the builtin print. When error messages or user input contain text resembling Rich markup tags (e.g., [/login]), Rich throws MarkupError, crashing the CLI.

Stack trace starts at ui/print/__init__.pyrich.console.printrich.markup.render.

Fix

Escape all dynamic content with rich.markup.escape() before passing to print() in ui/print/__init__.py.

Fixes #1291


Open with Devin

Copy link
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 1 additional finding.

Open in Devin Review

When user input or error messages contain text resembling Rich
markup tags (e.g., [/login]), rich.print() tries to interpret
them as formatting tags, causing MarkupError crashes.

Escape all dynamic content passed to rich.print() in print mode
using rich.markup.escape() to prevent Rich from interpreting
brackets as markup.

Fixes MoonshotAI#1291
@Br1an67 Br1an67 force-pushed the fix/rich-markup-escape branch from 094f338 to 8fd1842 Compare March 17, 2026 07:19
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.

Invalid Markdown Formatting In Stdin Prompt Crashes Kimi

1 participant