Skip to content

Conversation

@pakrym-oai
Copy link
Collaborator

@pakrym-oai pakrym-oai commented Nov 19, 2025

Instead of returning structured out and then re-formatting it into freeform, return the freeform output from shell_command tool.

Keep shell as the default tool for GPT-5.

…ations

- Dropped the o3 model tools assertion from model_selects_expected_tools.
- Added "apply_patch" as an expected tool for gpt-5-codex.
- Clarified test description for gpt-5 toolset assertion.
…utput count

tests: remove ShellModelOutput::ShellCommand cases to match updated model output formatting
@pakrym-oai pakrym-oai marked this pull request as ready for review November 19, 2025 01:48
Copy link
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.

ℹ️ 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 267 to 270
Err(ToolError::Codex(CodexErr::Sandbox(SandboxErr::Timeout { output })))
| Err(ToolError::Codex(CodexErr::Sandbox(SandboxErr::Denied { output }))) => {
let response = super::format_exec_output_for_model(&output);
let response = super::format_exec_output_for_model_structured(&output);
let event = ToolEventStage::Failure(ToolEventFailure::Output(*output));
Copy link
Contributor

Choose a reason for hiding this comment

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

P1 Badge Freeform errors must avoid JSON leakage

We now skip reserializing shell_command in client_common::is_shell_tool_name, so any string returned from here must already be in the final freeform format. The success path handles that, but the timeout/denied branch still calls format_exec_output_for_model_structured, which produces the old JSON blob. Because shell_command is no longer picked up by reserialize_shell_outputs, those error responses will hit the model as raw JSON again. Could we route this branch through the same freeform formatter when self is the Shell { freeform: true, … } variant?

Useful? React with 👍 / 👎.

"update_plan",
"view_image",
],
),
Copy link
Collaborator

Choose a reason for hiding this comment

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

should we still keep the variations here with gpt-5 to validate old behavior?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

they are never used

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

only current model is being picked from the list

Introduce format_exec_output_for_model helper on ToolEmitter to select
freeform vs structured formatting consistently. Use it for success and
sandbox timeout/denied paths. Update freeform exec output truncation to
use SHELL_OUTPUT_MAX_BYTES and a fixed 256 line limit.
…tput

# Conflicts:
#	codex-rs/core/tests/suite/prompt_caching.rs
@pakrym-oai pakrym-oai merged commit ee0484a into main Nov 19, 2025
23 of 25 checks passed
@pakrym-oai pakrym-oai deleted the pakrym/make-shell-command-return-freeform-output branch November 19, 2025 07:38
@github-actions github-actions bot locked and limited conversation to collaborators Nov 19, 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