Codex chat composer materializes HTML styling in pasted text as Markdown, changing code copied from VS Code or a web browser
What version of the Codex App are you using (From “About Codex” dialog)?
26.707.91948
What subscription do you have?
Plus
What platform is your computer?
Microsoft Windows NT 10.0.26100 x64
What issue are you seeing?
When copied content includes a styled text/html clipboard item, the Codex composer converts that styling into plain-text Markdown. This changes the pasted code itself.
This affects the latest versions of both the VS Code extension and the Codex (aka ChatGPT) app.
Examples:
Code in the editor:
int readPointer();
<img width="220" alt="Image" src="https://github.com/user-attachments/assets/59d4c427-2c36-4994-b40b-4847314a566e" />
or:
await page.goto(targetUrl)
<img width="300" alt="Image" src="https://github.com/user-attachments/assets/d5ca9c7f-0cee-4e9f-b03e-3f8e4863b0ff" />
Pasted into the Codex app or extension chat:
<img width="307" height="141" alt="Image" src="https://github.com/user-attachments/assets/70147faa-50ab-4273-8d07-471a97f481be" />
<img width="280" alt="Image" src="https://github.com/user-attachments/assets/27c201af-a9e2-4b20-94c0-cf547393535d" />
In message bubble:
<img width="284" height="71" alt="Image" src="https://github.com/user-attachments/assets/a1f198c6-60b9-41ed-bc1a-1d3889fc69f7" />
<img width="281" height="76" alt="Image" src="https://github.com/user-attachments/assets/7c241f74-bf2d-48f4-be67-1d4650cef03f" />
What the model sees:
int *readPointer*();
*await* page*.goto*(targetUrl)
<img width="980" height="470" alt="Image" src="https://github.com/user-attachments/assets/ee62dd3a-14b3-4086-ba3a-bd0c47d62520" />
In effect, user sends:
int readPointer();
But the model reasons about different code:
int *readPointer();
What steps can reproduce the bug?
To reproduce, you can copy code from literally anywhere that writes a text/html clipboard item when you copy (such as VS Code, Visual Studio, or a web browser), provided that at least one symbol in the copied code is displayed in italics.
One concrete way to do it:
- Set the VS Code theme to Night Owl _(3,536,921 installs)_.
- Make a
.jsfile with the following contents:
``js``
await page.goto(targetUrl)
<img width="300" alt="Image" src="https://github.com/user-attachments/assets/c7974afb-9a9e-445c-9687-b86a4766607c" />
and/or a .cpp file with this:
``cpp``
int readPointer();
<img width="300" alt="Image" src="https://github.com/user-attachments/assets/80b9c36a-e3ac-4473-abc2-a7b3abfc563c" />
- Copy that code and paste it into Codex chat composer. Send it.
- Inspect the session rollout or ask Codex what input it literally received. See that code was changed and model received not the code you actually pasted.
Speaking of VS Code themes, another extremely popular theme that uses italics is Dracula (10,700,818 installs).
What is the expected behavior?
Code pasted into the Codex chat composer must never be changed purely because it was displayed with styling in the source it was copied from.
sorry for caps, this is just insane and I am desperate. See notes about "non-code use case" below.
Additional information
Ctrl+Shift+V → Paste as plain text is not supported (for some reason), but it would be the wrong solution to this problem anyway. Unlike Gmail or MS Word, the Codex composer is not a place where HTML styles in pasted code should be "preserved" on paste by default and sent to the model as part of the input.
A proper solution, taking into account that some Codex users don't care about code at all, would be:
Ctrl+Vor Right click →Pasteshould never materialize styles by default. A setting can switch betweenDefault paste with formattingandDefault paste as plain text.- The right-click menu would have explicit options:
Paste,Paste as plain text,Paste with formatting Ctrl+Shift+Valways pastes as plain textCtrl+Alt+Valways pastes with formatting
P.S.
Imagine the severity of the impact in this example: you copy some example code from some API/library/framework documentation website, paste it into VS Code, and VS Code suddenly pastes it with unrelated Markdown styling. This is not how coding works, and it is not how the Codex composer should ever behave.
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗