Codex Desktop: MCP form elicitation messages collapse newline characters in approval UI
What version of the Codex App are you using (From “About Codex” dialog)?
26.721.4979.0
What subscription do you have?
ChatGPT subscription. The exact tier is not available in this diagnostic context; the issue is in the client-side rendering of an MCP message.
What platform is your computer?
Microsoft Windows NT 10.0.26100.0 x64
What issue are you seeing?
Codex Desktop collapses newline characters in the plain-text message of an MCP form elicitation into spaces. This makes a structured approval prompt render as one dense paragraph, even though the MCP server deliberately separates the asset, risk, reasons, command/SQL, and authorization scope onto different lines.
For example, an MCP server sends a message equivalent to:
Protected operation requires approval
Asset: staging database
Risk: medium
Reason:
- The query has a broad filter.
SQL:
SELECT id, created_at
FROM logs
ORDER BY created_at DESC
LIMIT 1;
The approval UI currently renders it approximately as:
Protected operation requires approval Asset: staging database Risk: medium Reason: - The query has a broad filter. SQL: SELECT id, created_at FROM logs ORDER BY created_at DESC LIMIT 1;
Both LF (\n) and CRLF (\r\n) are collapsed. Raw HTML such as <br> is correctly treated as text and therefore cannot be used as a safe workaround. The issue is specifically about preserving line-break characters in the existing plain-text renderer, not enabling Markdown or HTML.
This is more than a cosmetic problem for approval dialogs: visually separating the target asset, risk assessment, exact operation, and authorization scope makes it substantially easier for users to review sensitive MCP actions before approving them.
What steps can reproduce the bug?
- Register an MCP server that supports
elicitation/create. - Have a tool send a form-mode elicitation whose
messagecontains\n, for example:
{
"jsonrpc": "2.0",
"id": "approval-1",
"method": "elicitation/create",
"params": {
"mode": "form",
"message": "Protected operation requires approval\n\nAsset: staging database\nRisk: medium\n\nSQL:\nSELECT id FROM logs LIMIT 1",
"requestedSchema": {
"type": "object",
"properties": {
"approve": {
"type": "boolean",
"title": "Approve this operation"
}
},
"required": ["approve"]
}
}
}
- Trigger the tool in Codex Desktop.
- Observe that the approval dialog displays the entire
messageas one paragraph instead of preserving its line breaks.
What is the expected behavior?
The form elicitation approval UI should preserve newline characters in params.message while continuing to render the value as escaped plain text.
The example above should display as separate visual blocks:
Protected operation requires approval
Asset: staging database
Risk: medium
SQL:
SELECT id FROM logs LIMIT 1
Long SQL, commands, hashes, and URLs should still wrap within the dialog instead of overflowing horizontally.
Additional information
A minimal rendering change would be to use white-space: pre-wrap on the message container, together with a long-token wrapping rule. With Tailwind utilities, the intended behavior is equivalent to:
<div className="text-sm font-medium whitespace-pre-wrap break-words">
{request.message}
</div>
If preserving repeated spaces is undesirable, whitespace-pre-line would also preserve newline characters:
<div className="text-sm font-medium whitespace-pre-line break-words">
{request.message}
</div>
Suggested acceptance criteria:
- LF and CRLF in an MCP form elicitation
messageproduce visible line breaks. - The message remains escaped plain text; Markdown and HTML are not interpreted.
- Long unbroken content still wraps inside the approval dialog.
- Existing single-line messages render unchanged.
I searched existing issues for MCP elicitation, approval rendering, newlines, line breaks, white-space, and pre-wrap. Related issues cover form elicitation acceptance/schema behavior or unrelated Markdown/input rendering, but I did not find one for newline preservation in the MCP form elicitation approval message.