Skip to content

Log js_repl nested tool responses in rollout history#12837

Merged
fjord-oai merged 2 commits intomainfrom
fjord/js_repl_tool_logging
Feb 26, 2026
Merged

Log js_repl nested tool responses in rollout history#12837
fjord-oai merged 2 commits intomainfrom
fjord/js_repl_tool_logging

Conversation

@fjord-oai
Copy link
Contributor

@fjord-oai fjord-oai commented Feb 25, 2026

Summary

  • add tracing-based diagnostics for nested codex.tool(...) calls made from js_repl
  • emit a bounded, sanitized summary at info!
  • emit the exact raw serialized response object or error string seen by JavaScript at trace!
  • document how to enable these logs and where to find them, especially for codex app-server

Why

Nested codex.tool(...) calls inside js_repl are a debugging boundary: JavaScript sees the tool result, but that result is otherwise hard to inspect from outside the kernel.

This change adds explicit tracing for that path using the repo’s normal observability pattern:

  • info for compact summaries
  • trace for exact raw payloads when deep debugging is needed

What changed

  • js_repl now summarizes nested tool-call results across the response shapes it can receive:
    • message content
    • function-call outputs
    • custom tool outputs
    • MCP tool results and MCP error results
    • direct error strings
  • each nested codex.tool(...) completion logs:
    • exec_id
    • tool_call_id
    • tool_name
    • ok
    • a bounded summary struct describing the payload shape
  • at trace, the same path also logs the exact serialized response object or error string that JavaScript received
  • docs now include concrete logging examples for codex app-server
  • unit coverage was added for multimodal function output summaries and error summaries

How to use it

Summary-only logging

Set:

RUST_LOG=codex_core::tools::js_repl=info

For codex app-server, tracing output is written to the server process stderr.

Example:

RUST_LOG=codex_core::tools::js_repl=info \
LOG_FORMAT=json \
codex app-server \
2> /tmp/codex-app-server.log

This emits bounded summary lines for nested codex.tool(...) calls.

Full raw debugging

Set:

RUST_LOG=codex_core::tools::js_repl=trace

Example:

RUST_LOG=codex_core::tools::js_repl=trace \
LOG_FORMAT=json \
codex app-server \
2> /tmp/codex-app-server.log

At trace, you get:

  • the same info summary line
  • a trace line with the exact serialized response object seen by JavaScript
  • or the exact error string if the nested tool call failed

Where the logs go

For codex app-server, these logs go to process stderr, so redirect or capture stderr to inspect them.

Example:

RUST_LOG=codex_core::tools::js_repl=trace \
LOG_FORMAT=json \
/Users/fjord/code/codex/codex-rs/target/debug/codex app-server \
2> /tmp/codex-app-server.log

Then inspect:

rg "js_repl nested tool call" /tmp/codex-app-server.log

Without an explicit RUST_LOG override, these js_repl nested tool-call logs are typically not visible.

@fjord-oai fjord-oai force-pushed the fjord/js_repl_tool_logging branch from 0a7dea3 to 079575a Compare February 25, 2026 23:55
@fjord-oai fjord-oai force-pushed the fjord/js_repl_tool_logging branch 3 times, most recently from 97a3216 to 019d18f Compare February 26, 2026 04:21
@etraut-openai etraut-openai added the oai PRs contributed by OpenAI employees label Feb 26, 2026
Persist a sanitized summary for nested codex.tool() calls by default and keep the exact raw response or error only when extended rollout history is enabled.
@fjord-oai fjord-oai force-pushed the fjord/js_repl_tool_logging branch from 019d18f to ea24e55 Compare February 26, 2026 16:14
@fjord-oai fjord-oai merged commit eb77db2 into main Feb 26, 2026
57 of 61 checks passed
@fjord-oai fjord-oai deleted the fjord/js_repl_tool_logging branch February 26, 2026 18:12
@github-actions github-actions bot locked and limited conversation to collaborators Feb 26, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

oai PRs contributed by OpenAI employees

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants