Repository navigation
feat(tools): edit selected tool results before tracing and publication - #6141
markstuart-oai wants to merge 3 commits into
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
Approved at e05a2ee67a5447052d48e1e58d95764fd1e31391. Reviewed the full nine-file change and surrounding invocation, MCP conversion, tracing, and publication paths, with two independent reviews. No actionable findings. Exact function/server identity selection, edited text and retained-media ordering, typed JSON validation and conversion preservation, approval/resume and stream argument isolation, failure/timeout/cancellation handling, and process-control diagnostic redaction are consistent with the documented scope. Regression tests cover SDK/OpenTelemetry traces, streamed output, saved history, and the next model request.
The editor and retained media remain trusted; completed tool side effects cannot be undone, and hosted/native tools are outside this feature. Hosted CI is complete: 33 checks passed and 2 skipped; no failures. Static review only; no candidate code or local tests executed.
Update feat/runner-tool-text-transforms against feat/simple-codex.
There was a problem hiding this comment.
Re-reviewed current commit b2ed3f71cb8f2777bf77ebc8756afbee680304b7 and the selector/admission/restore changes since the prior approval. Checked exact function and MCP server identity, namespaced dispatch collisions, weak-reference preservation through tool copying, requirement binding before admission and rechecking before side effects, and persistence of incomplete selected calls in schema 1.23. Missing or stale editors are rejected before a paused session becomes active; nested agent-tool policies follow the same live override/inheritance rules as execution, and rejected calls do not require an editor. Reviewed the new restore and retryability cases alongside the existing output transformation and redaction paths; no actionable regression found.
Hosted CI: {'SUCCESS': 17, 'IN_PROGRESS': 7}. Unfinished checks remain pending follow-up. Static review only; no candidate code or local tests executed.
Hosted CI follow-up (2026-11-22 22:40 UTC): all 33 executed checks passed; 2 checks skipped. No checks remain pending for this commit. Static review only; no local tests executed.
Summary
This pull request adds experimental
tool_text_transformsfor SDK function tools and SDK-discovered MCP tools. Withprepare_tool_output, an MCP result can already be visible in a trace when the editor runs. A selected text editor runs before the Runner publishes the result to traces, history or the next model request.Register the same function tool on the agent and in the run configuration. For MCP, use the connected server object and the original tool name.
Creating a second wrapper or reconnecting a server can leave a selector pointing to an unused object. The Runner raises
UserErrorbefore invoking another object with the same key unless it has its own exact editor. For local functions, the key includes the tool name and namespace. For MCP, it is the server name and original tool name. This rule applies across agents. Use distinct keys or register an editor for each object. For a namespace, register the tool returned bytool_namespace.A pending selected call saves an editor requirement in the invocation record. Register the current tool or server again on resume. A missing match stops the call before execution. A paused
ResumableSessionchecks those pending calls, including calls in an interrupted agent tool, before claiming the session, so the caller can correct the configuration and retry. Older snapshots remain readable and have no saved requirement.The editor returns one string per text slot. For typed function results, return a one-element tuple containing JSON. The SDK validates the edited JSON, checks that serialization preserves the values and returns a dictionary. A selected call bypasses
prepare_tool_outputand error formatters. A failed tool or invalid edit stops the run without publishing the rejected result. Any completed side effects remain.The application must trust the editor and retained media. Hosted and native tools are outside this option.
Test plan
Checks
.agents/skills/code-change-verification/scripts/run.sh.