Skip to content

[codex] Remove legacy shell output formatting paths#22706

Open
pakrym-oai wants to merge 2 commits into
mainfrom
pakrym/delete-shell-rewrite
Open

[codex] Remove legacy shell output formatting paths#22706
pakrym-oai wants to merge 2 commits into
mainfrom
pakrym/delete-shell-rewrite

Conversation

@pakrym-oai
Copy link
Copy Markdown
Collaborator

@pakrym-oai pakrym-oai commented May 14, 2026

Why

The client and tool pipeline still carried compatibility code for legacy structured shell output. Current shell and apply_patch responses are already plain text for model consumption, so keeping a JSON-serialization path plus shell-item rewrite logic makes the request formatter and tests preserve a format we do not need anymore.

What Changed

  • Removed the client-side shell output rewrite from core/src/client_common.rs.
  • Removed the structured exec-output formatter and the shell freeform switch so tool emitters use one model-facing formatter.
  • Collapsed apply_patch/shell serialization tests around the remaining plain-text output expectations and removed duplicate one-variant parameterized cases.
  • Kept the ApplyPatchModelOutput::ShellCommandViaHeredoc compatibility input shape, but no longer treats it as a separate output-format mode.

Validation

  • cargo test -p codex-core client_common
  • cargo test -p codex-core shell_serialization
  • cargo test -p codex-core apply_patch_cli
  • just fix -p codex-core

Documentation

No external Codex documentation update is needed.

@pakrym-oai pakrym-oai marked this pull request as ready for review May 14, 2026 21:52
@pakrym-oai pakrym-oai requested a review from a team as a code owner May 14, 2026 21:52
Copy link
Copy Markdown
Contributor

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

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.

Reviewed commit: 60433a4b65

ℹ️ 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".

}

input
self.input.clone()
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.

P2 Badge Preserve freeform apply_patch output formatting

When the freeform apply_patch tool runs, ToolEmitter::ApplyPatch still falls through to format_exec_output_for_model_structured in codex-rs/core/src/tools/events.rs, so the tool result is initially a JSON string containing output and metadata. This removed formatting pass was the only conversion before the next Responses request; in the existing shell_serialization coverage for ApplyPatchModelOutput::Freeform, the captured custom_tool_call_output is expected to begin with Exit code: 0, but this clone now sends the raw JSON wrapper to the model after any successful patch.

Useful? React with 👍 / 👎.

}

input
self.input.clone()
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.

P2 Badge Keep formatting legacy shell history on resume

For resumed conversations that already contain legacy local_shell_call/shell outputs serialized as {"output":...,"metadata":...}, the old pass converted those historical tool results back to the plain Exit code/Wall time text whenever a current freeform apply_patch tool was present. Cloning the history here now sends the raw JSON wrapper back to the model for those older transcripts, even though context_manager/normalize.rs still preserves local-shell calls and their FunctionCallOutput pairs for prompt history, so users resuming pre-freeform-shell sessions get a different and less readable model context.

Useful? React with 👍 / 👎.

@dylan-hurd-oai dylan-hurd-oai self-requested a review May 14, 2026 22:19
@pakrym-oai pakrym-oai changed the title [codex] Remove legacy shell output rewrite [codex] Remove legacy shell output formatting paths May 14, 2026
@pakrym-oai
Copy link
Copy Markdown
Collaborator Author

@codex review this

Copy link
Copy Markdown
Contributor

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

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.

Reviewed commit: 69615a9fd8

ℹ️ 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".

Comment thread codex-rs/core/src/client_common.rs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants