Skip to content

fix image drag drop - #5794

Merged
zhao-oai merged 3 commits into
mainfrom
with_paste_logging
Oct 28, 2025
Merged

zhao-oai merged 3 commits into
mainfrom
with_paste_logging

Conversation

@zhao-oai

@zhao-oai zhao-oai commented Oct 27, 2025 •

Copy link
Copy Markdown
Contributor

fixing drag/drop photos bug in codex

state of the world before:

sometimes, when you drag screenshots into codex, the image does not properly render into context. instead, the file name is shown in quotation marks.

before.2.mov

the screenshot is not actually included in agent context. the agent needs to manually call the view_image tool to see the screenshot. this can be unreliable especially if the image is part of a longer prompt and is dependent on the agent going out of its way to view the image.

state of the world after:

after.mov

now, images will always be directly embedded into chat context

Technical Details

  • MacOS sends screenshot paths with a narrow no‑break space right before the “AM/PM” suffix, which used to trigger our non‑ASCII fallback in the paste burst detector.
  • That fallback flushed the partially buffered paste immediately, so the path arrived in two separate handle_paste calls (quoted prefix + PM.png'). The split string could not be normalized to a real path, so we showed the quoted filename instead of embedding the image.
  • We now append non‑ASCII characters into the burst buffer when a burst is already active. Finder’s payload stays intact, the path normalizes, and the image attaches automatically.
  • When no burst is active (e.g. during IME typing), non‑ASCII characters still bypass the buffer so text entry remains responsive.

@zhao-oai

Copy link
Copy Markdown
Contributor Author

@codex pls review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 249 to 251
pub fn handle_paste(&mut self, pasted: String) -> bool {
tracing::info!("handle_paste: {pasted}");
let char_count = pasted.chars().count();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Avoid logging full paste contents at info level

The new tracing::info!("handle_paste: {pasted}") call writes every pasted string—including arbitrary user messages, file contents, and potentially secrets—to the standard info log. Unlike the existing debug tooling, this is always executed and prints the entire payload, so a normal production build will emit user data to logs. Besides privacy concerns, large pastes will also generate very large log entries. Consider removing this log or gating/truncating it behind a debug flag.

Useful? React with 👍 / 👎.

@zhao-oai

Copy link
Copy Markdown
Contributor Author

@codex review

@zhao-oai zhao-oai changed the title [draft] With paste logging fix image drag drop Oct 27, 2025
@chatgpt-codex-connector

Copy link
Copy Markdown
Contributor

Codex Review: Didn't find any major issues. Delightful!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@joshka-oai

Copy link
Copy Markdown
Contributor

@genki i wonder if you'd mind taking a quick look at this one when you have a chance. No problem if you can't. I suspect IME will continue to work fine on this and I'll test to the best of my ability, but you likely know the edge cases better than I do on IME, and would notice problems straight away.

@zhao-oai
zhao-oai merged commit 4d6a42a into main Oct 28, 2025
@zhao-oai
zhao-oai deleted the with_paste_logging branch October 28, 2025 00:11
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 28, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants