Skip to content

fix: preserve interactive CLI formatting for async subagent output#1930

Merged
Re-bin merged 1 commit intoHKUDS:mainfrom
ducheng121:fix/cli-async-output
Mar 12, 2026
Merged

fix: preserve interactive CLI formatting for async subagent output#1930
Re-bin merged 1 commit intoHKUDS:mainfrom
ducheng121:fix/cli-async-output

Conversation

@ducheng121
Copy link
Copy Markdown
Contributor

@ducheng121 ducheng121 commented Mar 12, 2026

Fixes #1904

Summary

Fix interactive CLI output corruption when async subagent completion messages arrive while the user is typing.

Cause

The CLI used prompt_toolkit for interactive input, but async outbound messages were rendered by Rich directly to the terminal. This could corrupt the prompt and leak ANSI control sequences like ?[36m...?[0m.

Fix

  • Keep Rich/Markdown rendering for async replies
  • Render async output to ANSI first
  • Send that ANSI through prompt_toolkit safe terminal output instead of writing directly to stdout

Verification

Manually tested:

  • async subagent completion while typing
  • async reply with Markdown formatting
  • interactive CLI prompt remains intact

@chengyongru
Copy link
Copy Markdown
Collaborator

Hi @ducheng121

Thanks for your working!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

命令行状态下调用子代理执行完成后返回信息显示乱码

3 participants