Skip to content

Fix MIME types for path-backed feedback attachments - #30796

Merged
btraut-openai merged 2 commits into
mainfrom
btraut/fix-feedback-attachment-mime
Jul 3, 2026
Merged

Fix MIME types for path-backed feedback attachments#30796
btraut-openai merged 2 commits into
mainfrom
btraut/fix-feedback-attachment-mime

Conversation

@btraut-openai

Copy link
Copy Markdown
Contributor

Why

Path-backed feedback attachments were always labeled text/plain, even when the attached file was a gzip archive. Sentry consumers could therefore UTF-8-decode a valid Codex Desktop log bundle and corrupt the transferred bytes before anyone inspected it. Desktop already creates a valid archive and sends its path through feedback/upload; the bad metadata was assigned later by app-server's feedback upload path.

Slack investigation: https://openai.slack.com/archives/C09NZ54M4KY/p1782867266569699

What changed

Path-backed feedback attachments now derive their MIME type from the final uploaded filename. Gzip files use application/gzip, known text formats remain text, and unrecognized files use the safe application/octet-stream fallback. Attachment filenames and bytes are unchanged.

How it works

  • Classify at the upload boundary: The feedback crate selects MIME metadata after resolving the final filename, including filename overrides.
  • Preserve text rollouts: Codex .jsonl rollouts remain text/plain, while other known formats use the repository's existing mime_guess mapping.
  • Protect unknown binaries: Unrecognized extensions fall back to application/octet-stream instead of being treated as UTF-8 text.
  • Keep the wire stable: feedback/upload still accepts the same path list, so Desktop, generated protocol surfaces, and remote-host minimums do not change.

Verification

Added focused coverage for gzip MIME, unknown binary fallback, .jsonl text handling, and exact filename/byte preservation. Ran the complete codex-feedback test suite (9 tests), crate-scoped Clippy, Rust formatting, Bazel lock refresh, and diff checks successfully.

@btraut-openai

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown
Contributor

Codex Review: Didn't find any major issues. Bravo.

Reviewed commit: f5f648d3a3

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@btraut-openai
btraut-openai marked this pull request as ready for review July 1, 2026 06:18

@etraut-openai etraut-openai 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.

Code looks good. I also had codex run a manual test, and I confirmed (by using Sentry) that the file type and MIME types were correct.

@btraut-openai
btraut-openai merged commit 1f17e75 into main Jul 3, 2026
35 checks passed
@btraut-openai
btraut-openai deleted the btraut/fix-feedback-attachment-mime branch July 3, 2026 20:06
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 3, 2026
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.

2 participants