feat: attach client_session_id to requests and set the CLI session env var - #1074
Open
aqandrew wants to merge 3 commits into
Open
feat: attach client_session_id to requests and set the CLI session env var#1074aqandrew wants to merge 3 commits into
aqandrew wants to merge 3 commits into
Conversation
Attach the session ID to every API request via the W3C baggage header (session_id=<id>) so the server can correlate requests with the session's logs and telemetry, threading it through CoderApi.create at all call sites. Set CODER_TRACE_SESSION_ID on both process.env and the terminal environment collection so the spawned `coder ssh` ProxyCommand reuses the plugin's session ID instead of generating its own.
aqandrew
force-pushed
the
aqandrew/devex-661-session-id-requests
branch
from
August 12, 2026 22:00
f2f6512 to
e6e52cc
Compare
Align with the updated RFC: the session ID baggage key changes from session_id to client_session_id.
aqandrew
force-pushed
the
aqandrew/devex-661-session-id-requests
branch
from
August 13, 2026 00:40
0baf84a to
8d98780
Compare
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.
What
Propagate the session ID from Phase 1 to outbound API requests and to the CLI,
so server-side logs, telemetry, and the spawned
coder sshprocess can all becorrelated with the extension's session.
This is Phase 2 of 3 for
DEVEX-661. It builds on
#1073.
Changes
sessionIdargument toCoderApi.createandattach the session ID to every request via the W3C
baggageheader using theclient_session_idkey (baggage: client_session_id=<hex>), on both the RESTdefault headers and the WebSocket handshake headers. Threaded through all
CoderApi.createcall sites, including the pre-auth OAuth/login/deploymentclients, so every request carries it.
telemetry
sessionId, which ships on every event's context.applySshEnvironmentto also setCODER_TRACE_SESSION_IDon bothprocess.envand the terminal environmentcollection, so the spawned
coder sshProxyCommand reuses the plugin'ssession ID instead of generating its own.
Testing
pnpm typecheck, targetedpnpm lint, fullpnpm test:extension(2108passing).
baggage: client_session_id=<hex>present/absent onCoderApi;CODER_TRACE_SESSION_IDapplied toprocess.envand the terminal collectionand restored on dispose.
🤖 Generated by Coder Agents.