Skip to content

Fix: Handle None message content in print_prompt_completions_sample - #7454

Open
AmineDiro wants to merge 2 commits into
mainfrom
fix-print-none-content
Open

AmineDiro wants to merge 2 commits into
mainfrom
fix-print-none-content

Conversation

@AmineDiro

@AmineDiro AmineDiro commented Sep 30, 2026 •

Copy link
Copy Markdown
Member

print_prompt_completions_sample crashes when an assistant message has content=None, which is common for tool-call-only turns, because rich's Text.append(None) raises a TypeError. This treats None as empty text.


Note

Low Risk
Single-line defensive change in debug/logging output only; no training or model logic affected.

Overview
Fixes a crash in training-time completion logging when chat-formatted prompts/completions include messages with content: null (e.g. tool-call-only assistant turns).

In print_prompt_completions_sample’s format_entry helper, message body text is now appended as msg["content"] or "" instead of passing None into Rich’s Text.append, which raises TypeError.

Reviewed by Cursor Bugbot for commit 936f0a6. Bugbot is set up for automated code reviews on this repo. Configure here.

@bot-ci-comment

Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@qgallouedec

Copy link
Copy Markdown
Member

Thanks! better to have it in its own pr instead of as part of #6947

This branch has not been deployed

No deployments
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.

2 participants