Skip to content

Support updatedToolOutput for PostToolUse#20703

Open
abhinav-oai wants to merge 8 commits into
mainfrom
abhinav/post-tool-use-output-rewrite
Open

Support updatedToolOutput for PostToolUse#20703
abhinav-oai wants to merge 8 commits into
mainfrom
abhinav/post-tool-use-output-rewrite

Conversation

@abhinav-oai
Copy link
Copy Markdown
Collaborator

@abhinav-oai abhinav-oai commented May 1, 2026

Why

PostToolUse hooks can already inspect the stable tool_response that Codex exposes after a tool runs, but they cannot currently replace what model-authored callers receive. Supporting the existing updatedToolOutput / updatedMCPToolOutput hook fields lets hook authors redact or normalize post-run results consistently for direct tool calls and code-mode nested calls without changing execution or telemetry semantics.

What

  • parse updatedToolOutput and/or updatedMCPToolOutput from PostToolUse hook output
    • updatedMCPToolOutput is ignored when updatedToolOutput is provided
  • validate replacements by JSON kind against the original hook-facing tool_response, invalid replacements are ignored with a hook warning
  • preserve the original typed tool output while applying accepted replacements to the caller-visible output after the hook phase
  • surface accepted rewrites to code mode too
    • exec_command keeps its structured code-mode metadata and replaces only the output field

@abhinav-oai abhinav-oai changed the title [codex] support PostToolUse output rewrites Support updatedToolOutput for PostToolUse May 1, 2026
@abhinav-oai abhinav-oai marked this pull request as ready for review May 1, 2026 23:43
@abhinav-oai abhinav-oai requested a review from a team as a code owner May 1, 2026 23:43
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: a041fd668b

ℹ️ 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 thread codex-rs/core/src/tools/registry.rs Outdated
@abhinav-oai
Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown
Contributor

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

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

@abhinav-oai
Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown
Contributor

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

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

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.

1 participant