Log AHP frames for the Web PubSub relay transport - #332453
Merged
Osvaldo Ortega (osortega) merged 2 commits intoAug 25, 2026
Merged
Conversation
The Web PubSub relay was the only agent host transport with no AHP JSONL logging, and cloud sandbox hosts do not implement `vscode/collectAgentHostDebugLogs`, so the debug-log export cannot gather frames for them either. That left sandbox sessions with no way to see what was actually put on the wire. Frames are recorded gated on `chat.agentHost.ahpJsonlLoggingEnabled`, which is off by default since the transcript carries full frame contents. Outbound frames are logged before chunking so the transcript holds whole AHP messages rather than the relay frames they were split into. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds JSONL frame logging to the Web PubSub transport for cloud sandbox diagnostics.
Changes:
- Logs outbound messages before chunking and inbound messages after reassembly.
- Creates a transport-owned logger for each connection.
Show a summary per file
| File | Description |
|---|---|
cloudSandboxAgentHostService.ts |
Configures per-transport AHP logging. |
webPubSubRelayTransport.ts |
Records inbound and outbound AHP messages. |
Review details
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Suppressed comments (1)
src/vs/platform/agentHost/browser/webPubSubRelayTransport.ts:290
- The raw message can be an
authenticaterequest containing the cloud sandbox'sencrypted_github_token(this service sends it during establishment), so this writes a credential envelope into the JSONL log. This is especially risky because the setting defaults to enabled in non-stable builds.AgentHostIpcChannelTransportalready redactsparams.tokenbefore logging; apply that redaction centrally (ideally inAhpJsonlLogger) so this and other relay transports cannot persist authentication credentials.
this._options.ahpLogger?.log(message, 'c2s', getAhpLogByteLength(JSON.stringify(message)));
- Files reviewed: 2/2 changed files
- Comments generated: 2
- Review effort level: Balanced
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Osvaldo Ortega (osortega)
marked this pull request as ready for review
August 25, 2026 00:46
Dmitriy Vasyura (dmitrivMS)
approved these changes
Aug 25, 2026
roblourens
approved these changes
Aug 25, 2026
Osvaldo Ortega (osortega)
deleted the
osortega/sandbox-relay-ahp-logging
branch
August 25, 2026 01:23
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.
The Web PubSub relay was the only agent host transport with no AHP JSONL logging. Cloud sandbox hosts also do not implement
vscode/collectAgentHostDebugLogs, so the debug-log export cannot gather frames for them either. Between the two, a sandbox session had no way to show what it actually put on the wire.What this does
Records every AHP frame to a JSONL transcript, gated on
chat.agentHost.ahpJsonlLoggingEnabled, which defaults toproduct.quality !== 'stable'— on in Insiders and dev builds, off in stable.AhpJsonlLoggertruncates oversized values rather than retaining everything.Outbound frames are logged before chunking, so the transcript holds whole AHP messages rather than the relay frames they were split into. Inbound frames are logged after reassembly, for the same reason.
The logger is optional and owned by the transport, so it is disposed with it. Each soft-reconnect builds a fresh transport and gets its own logger keyed on the connection id.
Risk
No behaviour change when the setting is off, which is the default. The only non-logging change is that the transport registers the logger for disposal.
Validation
npm run typecheck-client