Codex Desktop: MCP form elicitation messages collapse newline characters in approval UI

Open Beginner friendly
#35,906 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
tailwindcss, typescript
Domain
desktop, frontend

Research direction

Inspect the form-mode MCP elicitation approval renderer and the container displaying params.message; reproduce the issue with the LF and CRLF examples from the report. Done means line breaks remain visible as escaped plain text, long unbroken content wraps in the dialog, and single-line messages remain unchanged.

Written by the indexing model from the issue text.

Description

app bug mcp windows-os
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?
  1. Register an MCP server that supports elicitation/create.
  2. Have a tool send a form-mode elicitation whose message contains \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"]
    }
  }
}
  1. Trigger the tool in Codex Desktop.
  2. Observe that the approval dialog displays the entire message as 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 message produce 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.

Dominant language
Rust
Stars
125k
Forks
19.5k
Avg merge
1m
Merged PRs (30d)
1k

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from openai/codex

All issues in openai/codex

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.