[Feature]: Single-request metadata trace for Codex client tools on the Cursor adapter

Open
#8,866 2 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
34/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
typescript

Research direction

Start with the v2.100.3 paths named in the issue: parseRequest, createCursorRequest, prepareCursorRunRequest, planMcpArgsHandling, mapCursorProtobufServerMessage, and parseConnectEndStreamError. Run the offline synthetic fixtures to trace where declaration, wire, return, and relay classifications are available. Done means an opt-in trace for one request and correlated continuations reports those stages using metadata only, then turns off automatically.

Written by the indexing model from the issue text.

Description

enhancement tools
Area

Tools / MCP and Cursor adapter observability

What are you trying to accomplish?

Diagnose one Codex Desktop Responses turn that ends without a client-tool event. For the same request, distinguish (a) the tool or its deferred entry point was not forwarded, (b) Cursor returned assistant text rather than a structured tool call, (c) a structured Cursor call was observed but could not be relayed as a client tool event, and (d) an upstream error. This is an observation request, not a request to execute untrusted text, retry, or weaken validation.

What prevents this today?

On released v2.100.3, the request history shows route and terminal status, and provider debug has a request tool count and frame types. Those do not establish whether one particular declaration survived all the way to the Cursor wire and which output it produced on the same request. Cache diagnostics do not expose tool names. A successful HTTP response or an assistant string containing [Tool Result] is not proof of execution.

Offline synthetic reproduction (v2.100.3)

Using the v2.100.3 tag, pass a synthetic Responses request with model cursor/gemini-4-argon, input Synthetic handoff fixture, and a namespace declaration mcp__codex_app containing a function send_message_to_thread with a synthetic string prompt argument. No servers or model calls are needed. Call parseRequest → createCursorRequest → prepareCursorRunRequest and decode the bytes using AgentClientMessageSchema to inspect runRequest.mcpTools. For the return path, feed synthetic Cursor frames to planMcpArgsHandling / mapCursorProtobufServerMessage (or a synthetic Connect terminal to parseConnectEndStreamError). None of these fixtures executes the tool.

Synthetic variation Observed declaration / wire / upstream / downstream
Declared namespaced tool; structured mcpArgs, providerIdentifier=opencodex-responses, matching wire name, synthetic prompt declared / present / structured tool / tool event
Same declaration with tool_choice: "none"; synthetic frame attempts the omitted tool anyway declared / absent / structured tool / adapter rejects an unadvertised tool
Same declaration; textDelta containing CallDynamicTool({"toolName":"send_message_to_thread"}) followed by [Tool Result] declared / present / text / text, no tool event
Same declaration; synthetic Connect end-stream {"error":{"code":"unavailable","message":"synthetic"}} declared / present / upstream error / error, no tool event
Declare only the freeform functions.exec entry point exec entry point visible; nested send-tool availability still unknown until host discovery

These are offline adapter fixtures, not evidence that any live turn had a particular upstream failure. The missing feature is a way to see the equivalent stage classifications for one actual request without capturing the request body.

Expected behaviour

An opt-in, local trace for one explicitly armed request or one turn (including only that turn's correlated continuations), then automatically off. For example, a row could report: declared=direct | exec_only | absent, cursor_wire=direct | exec_only | absent | unobserved, cursor_return=tool | text | upstream_error | unobserved, and relay=tool | text | adapter_error | none, with fixed reason codes where known. If multiple frame types occur, preserve the distinctions rather than inferring from the final HTTP status. If only exec is visible, mark the nested tool as unknown without host evidence.

Please keep it metadata-only: no prompts, arguments, tool outputs, raw schema or frames, headers, credentials, or account/session identifiers in exported diagnostics. No global capture, permanent logs, tool-policy changes, or automatic replays needed.

Related, but different
  • #8132 / #8492 address guidance for reaching deferred tools; they do not expose this request-scoped evidence.
  • #2317 and #8538 involve behavior after a tool already executed; #1217 is about transport-stage timing and failure attribution, not tool declaration and relay evidence.
Checks
  • I searched existing issues and documentation.
  • This describes a concrete OpenCodex workflow and synthetic reproduction.
  • No secrets, personal data, private chat, or customer material are included.
Dominant language
TypeScript
Stars
16.9k
Forks
1.3k
Avg merge
1d 4h
Merged PRs (30d)
814

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from lidge-jun/opencodex

All issues in lidge-jun/opencodex

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.