Skip to content

IPC logging for agent hosts#304338

Merged
roblourens merged 2 commits intomainfrom
roblou/unique-landfowl
Mar 24, 2026
Merged

IPC logging for agent hosts#304338
roblourens merged 2 commits intomainfrom
roblou/unique-landfowl

Conversation

@roblourens
Copy link
Member

Co-authored-by: Copilot copilot@github.com

Co-authored-by: Copilot <copilot@github.com>
Copilot AI review requested due to automatic review settings March 24, 2026 02:40
@roblourens roblourens enabled auto-merge (squash) March 24, 2026 02:40
@roblourens roblourens self-assigned this Mar 24, 2026
@vs-code-engineering vs-code-engineering bot added this to the 1.114.0 milestone Mar 24, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds opt-in, per-agent-host IPC tracing to help diagnose missing/hidden agent-host events (e.g. hooks not appearing in debug logs) by logging all agent-host protocol traffic to dedicated Output channels.

Changes:

  • Introduces chat.agentHost.ipcLoggingEnabled setting (Insiders-only) to enable IPC traffic logging.
  • Adds LoggingAgentConnection wrapper that logs calls/results/errors/events for an IAgentConnection to an Output channel.
  • Switches both local agent host and remote agent host contributions to use the logging wrapper (and adjusts remote host parsing test coverage).

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/vs/workbench/contrib/chat/browser/chat.contribution.ts Registers new IPC logging configuration setting.
src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/loggingAgentConnection.ts New logging wrapper that records IPC traffic into a dedicated Output channel.
src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostChatContribution.ts Routes local agent-host traffic through LoggingAgentConnection and removes log-level-based output logic.
src/vs/sessions/contrib/remoteAgentHost/browser/remoteAgentHost.contribution.ts Routes remote agent-host traffic through LoggingAgentConnection with per-connection channel ids/labels.
src/vs/platform/agentHost/test/electron-browser/remoteAgentHostService.test.ts Expands parsing test inputs to include “Agent host proxy listening …” log line format.
src/vs/platform/agentHost/common/agentService.ts Adds exported setting id constant for IPC logging enablement.
Comments suppressed due to low confidence (2)

src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/loggingAgentConnection.ts:114

  • IPC logging currently records the full authenticate params/result payloads. That includes bearer tokens (token) and potentially other secrets, which can end up in the Output panel and be copied/shared. Please redact sensitive fields (at least token/accessToken/refreshToken and common auth headers) before writing to the output channel, or special-case authenticate logging to avoid emitting the token value.
	async authenticate(params: IAuthenticateParams): Promise<IAuthenticateResult> {
		return this._logCall('authenticate', params, () => this._inner.authenticate(params));
	}

src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/loggingAgentConnection.ts:175

  • Error logging in _logCall/logError only records error.message, which often drops the stack and other useful context (and String(error) can become [object Object]). For debugging IPC issues, consider logging error.stack when available and otherwise using the same payload formatting/JSON logic as normal payloads so details aren’t lost.
	logError(context: string, error: unknown): void {
		this._log('!!', context, error instanceof Error ? error.message : String(error));
	}

	// ---- Internal helpers ---------------------------------------------------

	private async _logCall<T>(method: string, params: unknown, fn: () => Promise<T>): Promise<T> {
		this._log('>>', method, params);
		try {
			const result = await fn();
			this._log('<<', method, result);
			return result;
		} catch (err) {
			this._log('!!', method, err instanceof Error ? err.message : String(err));
			throw err;
		}

@roblourens roblourens merged commit 3535854 into main Mar 24, 2026
20 checks passed
@roblourens roblourens deleted the roblou/unique-landfowl branch March 24, 2026 03:15
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.

3 participants