node_repl js only returns execution_duration_ms to the model when nodeRepl.write emits output

Resolved 💬 2 comments Opened Aug 13, 2026 by roadto1e6 Closed Aug 13, 2026
💡 Likely answer: A maintainer (github-actions[bot], contributor) responded on this thread — see the highlighted reply below.

node_repl js only returns execution_duration_ms to the model when nodeRepl.write emits output

Summary

When using the Codex Desktop node_repl MCP server, nodeRepl.write(...) appears to execute correctly, but the model-visible tool result only contains {"execution_duration_ms": ...}. The actual value passed to nodeRepl.write(...) is not visible to the model.

This breaks workflows that rely on node_repl output as a confirmation channel, including browser/Chrome automation and publishing skills. The practical workaround is to write critical results to work/*.json and verify them through shell reads, but the MCP result channel itself appears incorrect.

Minimal Reproduction

In Codex Desktop, run the node_repl js tool:

nodeRepl.write({ marker: "NODE_REPL_ECHO_PROBE", value: 123 });

Actual Result

The model-visible tool result is:

{"execution_duration_ms":0}

The object passed to nodeRepl.write(...) is not visible to the model.

Expected Result

The model-visible tool result should include the content emitted by nodeRepl.write(...), for example the text/JSON representation of:

{"marker":"NODE_REPL_ECHO_PROBE","value":123}

Timing information such as execution_duration_ms should not replace the emitted output. If it is metadata, it likely belongs in _meta, or the structuredContent should include the actual output as well as timing metadata.

Source Investigation

I checked the public openai/codex source and the generic MCP result path appears to preserve the MCP fields correctly:

  • codex-rs/codex-mcp/src/binding.rs: call_tool_result_from_rmcp(...) preserves content, structured_content, is_error, and _meta.
  • codex-rs/protocol/src/models.rs: CallToolResult::as_function_call_output_payload(...) intentionally prefers non-null structured_content over content.
  • codex-rs/core/src/session/tests.rs: prefers_structured_content_when_present explicitly verifies that content is ignored when structured_content is set.

This suggests the issue may be in the node_repl MCP server's CallToolResult construction: if execution_duration_ms is returned as structuredContent while the nodeRepl.write(...) output is returned only as content, Codex will correctly prefer structuredContent and the actual output will be hidden from the model.

Environment

  • OS: Windows x64
  • Codex Desktop package observed locally: OpenAI.Codex_26.803.*
  • node_repl: bundled Codex Desktop runtime

Impact

Any Codex workflow using nodeRepl.write(...) as the final output channel can silently lose the intended output. This is especially painful for:

  • Browser/Chrome automation that reads documentation or DOM results through nodeRepl.write(...)
  • Publishing skills that need reliable publish/dry-run receipts
  • Long-running JS workflows where the only visible result becomes timing metadata

Workaround

Write important results to files such as work/*.json, then read them back through shell commands. This works, but it is slower and pushes every skill to implement an extra confirmation channel.

View original on GitHub ↗

2 Comments

github-actions[bot] contributor · 15 days ago

Potential duplicates detected. Please review them and close your issue if it is a duplicate.

  • #38287
  • #38225

Powered by Codex Action

roadto1e6 · 15 days ago

Closing this as a duplicate of #38287. #38287 tracks the same structuredContent/content transcription issue with fuller evidence; #38225 covers the related Computer Use/node_repl screenshot surface.