Skip to content

Log AHP frames for the Web PubSub relay transport - #332453

Merged
Osvaldo Ortega (osortega) merged 2 commits into
mainfrom
osortega/sandbox-relay-ahp-logging
Aug 25, 2026
Merged

Log AHP frames for the Web PubSub relay transport#332453
Osvaldo Ortega (osortega) merged 2 commits into
mainfrom
osortega/sandbox-relay-ahp-logging

Conversation

@osortega

@osortega Osvaldo Ortega (osortega) commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

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 to product.quality !== 'stable' — on in Insiders and dev builds, off in stable. AhpJsonlLogger truncates 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
  • Verified against a live session: the transcript captured the full handshake and per-request frames.

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>
Copilot AI balanced review requested due to automatic review settings August 25, 2026 00:07

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 authenticate request containing the cloud sandbox's encrypted_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. AgentHostIpcChannelTransport already redacts params.token before logging; apply that redaction centrally (ideally in AhpJsonlLogger) 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

Comment thread src/vs/platform/agentHost/browser/webPubSubRelayTransport.ts
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@osortega
Osvaldo Ortega (osortega) marked this pull request as ready for review August 25, 2026 00:46
@osortega
Osvaldo Ortega (osortega) merged commit b74782f into main Aug 25, 2026
27 checks passed
@osortega
Osvaldo Ortega (osortega) deleted the osortega/sandbox-relay-ahp-logging branch August 25, 2026 01:23
@vs-code-engineering vs-code-engineering Bot added this to the 1.136.0 milestone Aug 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants