Repository navigation
Conversation
Every request already carries x-beta9-caller and, when BETA9_AGENT_SESSION is set, x-beta9-agent-session, and the gateway stamps both on stub events. Nothing set the session, though, and the caller never said which agent ran the CLI. The CLI now reads the variables coding agents export to the commands they run (CLAUDECODE, CURSOR_AGENT, CODEX_THREAD_ID/CODEX_SANDBOX, GEMINI_CLI, COPILOT_CLI, and AI_AGENT for the rest). The caller becomes `cli/<version> (<agent>)`, and the agent's own session id (CLAUDE_CODE_SESSION_ID, CURSOR_CONVERSATION_ID, CODEX_THREAD_ID) fills the session when BETA9_AGENT_SESSION is unset. Explicit values still win. The MCP bridge sent neither header, so the gateway could not tell which agent made an MCP call. It now attributes its requests to the client that connected, `mcp/<version> (<clientInfo.name>/<version>)`, with one session id per server process. Both go in its environment, so the CLI processes its deploy and run tools start share them. Co-authored-by: Cursor <cursoragent@cursor.com>
This was referenced Oct 31, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Every request already carries
x-beta9-callerand, whenBETA9_AGENT_SESSIONis set,x-beta9-agent-session, and the gateway stamps both on stub events. Nothing set the session, though, and the caller never said which coding agent ran the CLI.CLI. It now reads the variables coding agents export to the commands they run:
CLAUDECODE,CURSOR_AGENT,CODEX_THREAD_IDorCODEX_SANDBOX,GEMINI_CLI,COPILOT_CLI, andAI_AGENTfor everything else. The caller becomescli/<version> (<agent>). WhenBETA9_AGENT_SESSIONis unset, the agent's own session id (CLAUDE_CODE_SESSION_ID,CURSOR_CONVERSATION_ID,CODEX_THREAD_ID) fills it. ExplicitBETA9_CALLERandBETA9_AGENT_SESSIONvalues still win.MCP bridge. It sent neither header, so the gateway couldn't tell which agent made an MCP call. It now attributes its requests to the client that connected, as
mcp/<version> (<clientInfo.name>/<version>), with one session id per server process. Both go in its environment, so the CLI processes itsdeployandruntools start share them.Checked from a Cursor agent: the caller arrived as
cli/0.1.292 (cursor), with the conversation id as the session.beam feedback(beam-cloud/beam-client#102) sends these headers to internal-api, which stores them with each report, so once this ships, feedback names the agent that sent it. Neither PR depends on the other.