Skip to content

agentHost: bound and deduplicate AHP transport logging - #341868

Merged
roblourens merged 1 commit into
mainfrom
roblou/agents/ahp-logging-restrictions-internal-users
Oct 15, 2026
Merged

roblourens merged 1 commit into
mainfrom
roblou/agents/ahp-logging-restrictions-internal-users

Conversation

@roblourens

Copy link
Copy Markdown
Member

Summary

Prevent AHP reconnect loops from producing unbounded JSONL logs and avoid capturing the same traffic at both endpoints.

  • Default capture to Insiders only; preserve explicit opt-in on other builds.
  • Share a cumulative 500 MiB budget across connections/reconnects using the same log directory in one process. Preserve existing per-connection rotation. Stop with one warning at the cap and skip further serialization; accounting adds no filesystem scans or metadata calls.
  • Capture ordinary local/remote traffic in the window only, and Mission Control traffic on the host only. Keep startup enablement forwarding so initial handshakes are captured, and mirror the owning local window's setting through AHP root config for live changes.
  • Discover Mission Control host logs through optional initialization metadata and use existing authorized resource reads for the viewer/export, without enabling host-management methods or widening filesystem grants. Exclude log-inspection traffic to prevent recursive capture/watch feedback.

The budget is per process, not machine-wide, and resets on window/host restart. No linked issue was supplied; this addresses a reported reconnect loop producing excessive AHP logs.

Validation

  • npm run build-fast -- --client-only — passed, including a refresh after formatting.
  • npm run typecheck-client — passed.
  • git diff --name-only -z -- '*.ts' | xargs -0 npm run eslint -- — passed for all 26 changed TypeScript files.
  • npm run eslint -- src/vs/platform/agentHost/node/protocolServerHandler.ts src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugWireLogView.ts — passed after formatting.
  • git diff --cached --check — passed.
  • Commit pre-commit hygiene — passed after applying the repository formatter to two files. Parsed TypeScript tokens were verified unchanged by formatting.
  • Focused regression selection below — 759 passing, 7 pending. Covers byte accounting, reconnects, concurrent writers, rotation, live enablement, startup forwarding, capture ownership, host metadata, self-inspection exclusion, and viewer/export behavior.
Exact focused test command
./scripts/test.sh --reporter dot \
  --run src/vs/platform/agentHost/test/common/ahpJsonlLogger.test.ts \
  --run src/vs/platform/agentHost/test/common/agentHostConfigurationSync.test.ts \
  --run src/vs/platform/agentHost/test/common/agentHostSchema.test.ts \
  --run src/vs/platform/agentHost/test/node/missionControlHost.test.ts \
  --run src/vs/platform/agentHost/test/node/nodeAgentHostStarter.test.ts \
  --run src/vs/platform/agentHost/test/node/webSocketTransport.test.ts \
  --run src/vs/platform/agentHost/test/node/agentHostDebugLogs.test.ts \
  --run src/vs/platform/agentHost/test/node/missionControlProtocolServer.test.ts \
  --run src/vs/platform/agentHost/test/node/protocolServerHandler.test.ts \
  --run src/vs/workbench/contrib/chat/test/browser/agentHostLogSources.test.ts \
  --run src/vs/workbench/contrib/chat/test/browser/exportAgentHostDebugLogs.test.ts \
  --run src/vs/workbench/contrib/chat/test/browser/remoteAgentHost/cloudSandboxAgentHostService.test.ts

Result: 759 passed, 7 pending. Reused the completed run because subsequent changes were verified formatting-only.

Live UI/mobile Mission Control flows and full integration/smoke suites were not run.

Manual verification

  1. Verify capture is default-off outside Insiders and can be explicitly enabled.
  2. Exercise local and ordinary remote connections: confirm window-owned JSONL files without a duplicate generic WebSocket host capture.
  3. Connect through Mission Control: confirm host-owned capture and that the remote AHP viewer/export reads those files. Change the setting in the host's owning window and verify the existing lane follows it.
  4. Exceed the cumulative budget across reconnects: verify one warning, no additional capture, and no budget reset from rotation or toggling the setting.

(Written by Copilot)

Restrict default capture to Insiders and enforce a shared 500 MiB process budget across reconnects without additional filesystem accounting. Keep one capture owner per route: the window for ordinary connections and the host for Mission Control. Forward startup enablement, mirror live owner configuration, and use authorized host resources for Mission Control log viewing and export.

Co-authored-by: Copilot <[email protected]>
Copilot AI balanced review requested due to automatic review settings October 15, 2026 20:51

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.

🟡 Changes recommended

Large host-log reads can disconnect Mission Control lanes, and remote wire logs lose automatic viewer updates.

2 open findings
What changed in this PR

Bounds AHP transport logging and assigns capture to one endpoint, while making Mission Control host logs available to the viewer and export.

Changes:

  • Adds a shared 500 MiB process budget and Insiders-only default capture.
  • Removes duplicate host capture and forwards startup/live settings.
  • Adds host-log discovery, inspection filtering, and regression coverage.
File Description
src/​vs/​workbench/​contrib/​chat/​test/​browser/​remoteAgentHost/​cloudSandboxAgentHostService.test.ts Tests capture ownership.
src/​vs/​workbench/​contrib/​chat/​test/​browser/​exportAgentHostDebugLogs.test.ts Tests Mission Control export.
src/​vs/​workbench/​contrib/​chat/​test/​browser/​agentHostLogSources.test.ts Tests host-log discovery and reads.
src/​vs/​workbench/​contrib/​chat/​browser/​remoteAgentHost/​cloudSandboxAgentHostService.ts Disables duplicate Mission Control client capture.
src/​vs/​workbench/​contrib/​chat/​browser/​chatDebug/​chatDebugWireLogView.ts Adds host-capture guidance.
src/​vs/​workbench/​contrib/​chat/​browser/​chatDebug/​chatDebugEnablement.ts Allows viewing host-owned logs independently.
src/​vs/​workbench/​contrib/​chat/​browser/​chatDebug/​chatDebugEditor.ts Uses connection-aware viewer enablement.
src/​vs/​workbench/​contrib/​chat/​browser/​chatDebug/​agentHostLogSources.ts Discovers advertised host logs.
src/​vs/​workbench/​contrib/​chat/​browser/​chat.shared.contribution.ts Removes relocated setting registration.
src/​vs/​workbench/​contrib/​chat/​browser/​actions/​exportAgentHostDebugLogsAction.ts Exports Mission Control host resources.
src/​vs/​platform/​agentHost/​test/​node/​protocolServerHandler.test.ts Tests log metadata without management access.
src/​vs/​platform/​agentHost/​test/​node/​nodeAgentHostStarter.test.ts Tests startup setting forwarding.
src/​vs/​platform/​agentHost/​test/​node/​missionControlHost.test.ts Tests capture defaults and live settings.
src/​vs/​platform/​agentHost/​test/​common/​ahpJsonlLogger.test.ts Tests budgets and inspection exclusion.
src/​vs/​platform/​agentHost/​node/​webSocketTransport.ts Removes generic host-side capture.
src/​vs/​platform/​agentHost/​node/​protocolServerHandler.ts Advertises optional log-directory metadata.
src/​vs/​platform/​agentHost/​node/​nodeAgentHostStarter.ts Forwards capture enablement at launch.
src/​vs/​platform/​agentHost/​node/​missionControl/​missionControlHost.ts Applies host capture settings and metadata.
src/​vs/​platform/​agentHost/​node/​agentHostServerMain.ts Removes WebSocket logger setup.
src/​vs/​platform/​agentHost/​node/​agentHostMain.ts Removes duplicate capture wiring.
src/​vs/​platform/​agentHost/​LOCAL_ENDPOINT.md Documents ownership, budgets, and access.
src/​vs/​platform/​agentHost/​electron-main/​electronAgentHostStarter.ts Forwards desktop capture enablement.
src/​vs/​platform/​agentHost/​common/​meta/​vscode/​agentHostDebugLogsMeta.ts Adds validated log-directory metadata helpers.
src/​vs/​platform/​agentHost/​common/​meta/​agentHostDebugLogsMeta.ts Exposes metadata helpers.
src/​vs/​platform/​agentHost/​common/​ahpJsonlLogger.ts Enforces shared budgets and excludes inspection traffic.
src/​vs/​platform/​agentHost/​common/​agentHostStarter.config.contribution.ts Registers capture defaults and local synchronization.
src/​vs/​platform/​agentHost/​common/​agentHostSchema.ts Adds read-only capture configuration.

🧠 Review effort: Balanced


💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@roblourens
roblourens marked this pull request as ready for review October 15, 2026 21:42
@roblourens
roblourens enabled auto-merge (squash) October 15, 2026 21:42
@roblourens
roblourens merged commit df07fce into main Oct 15, 2026
37 checks passed
@roblourens
roblourens deleted the roblou/agents/ahp-logging-restrictions-internal-users branch October 15, 2026 22:18
@vs-code-engineering vs-code-engineering Bot added this to the 1.143.0 milestone Oct 15, 2026
Ross Wollman (rwoll) added a commit that referenced this pull request Oct 29, 2026
Corrects or removes stale and misleading statements in agent skills, instructions and architecture docs. I compared the 1000 most recent `microsoft/vscode` Copilot Memories with the docs and checked every conflict against the current code. Each change replaces or removes a single statement; no new guidance was added.

The last column tags the author of the commit that introduced each changed statement (bulk prose-unwrap commits are skipped). Please update or revert after merge if anything here is wrong.

## Changes

| File | Correction | Evidence | Last modified by |
|---|---|---|---|
| `src/vs/sessions/skills/troubleshoot/SKILL.md` | AHP wire logging is on by default in Insiders, not off by default | `ahpJsonlLogger.ts` `isAhpJsonlLoggingEnabled`; default changed in #341868 | @vijayupadya |
| `.github/skills/otel/SKILL.md`, `src/vs/platform/agentHost/OTEL.md` | The runtime version is `copilotRuntimeVersion` in `package.json`; `package-lock.json` has no `@github/copilot` entry | `package.json`, `build/gulpfile.vscode.ts` | @zhichli |
| `.github/skills/agent-host-e2e-tests/SKILL.md` | `hostOnlyTest(...)` is now `conformanceTest(...)` / `providerHostOnlyTest(...)` | `e2eTestContext.ts` | @roblourens |
| `smoke-tests`, `flaky-smoke-tests`, `agent-host-e2e-tests` skills | The runtime is the native `copilot-runtime` from `@github/copilot-sdk-<platform>`, not the `@github/copilot` CLI | `copilotRuntimePaths.ts` | @pwang347 |
| `src/vs/platform/agentHost/AGENTS.md` | Managed filesystem sandbox lists *are* resolved by `SandboxSettingsResolutionHelper`: a managed grant list replaces the local one, and denied paths are combined | `sandboxSettingsResolutionHelper.ts`, `sessionSandbox.ts` | @dileepyavan |
| `.github/skills/code-oss-logs/SKILL.md` | `scripts/code.sh` defaults to `code-oss-dev` in the platform app-data dir; `~/.vscode-oss-dev` is only the `launch.json` profile | `userDataPath.ts`, `.vscode/launch.json` | @roblourens |
| `MISSION_CONTROL.md` | Each relay gets its own `ProtocolServerHandler` instance rather than sharing the local handler | `missionControlHost.ts` `_attachRelay` | @roblourens |
| `.github/skills/agent-host-logs/SKILL.md` | `_ahpLog.ts` is when the logging process handled the message, not the time it was sent | `ahpJsonlLogger.ts` | @roblourens |
| `.github/skills/chat-customizations-editor/SKILL.md` | Remove the stale "currently gated fixtures" list; none of those fixtures is gated anymore | `aiCustomizationManagementEditor.fixture.ts` (`blocksCi: false`) | @joshspicer |
| `.github/skills/customizations-in-the-agent-host/SKILL.md` | Generated protocol files are changed upstream and synced with `scripts/sync-agent-host-protocol.ts`, not "backported" | `common/state/AGENTS.md` | @connor4312 |
| `ux-css-layout` skill | Point to `dom.DisposableResizeObserver` instead of a raw `ResizeObserver` | `dom.ts` | @mrleemurray |
| `.github/copilot-instructions.md` | Use `DisposableResizeObserver`'s `resizeObserverCtor` test seam as the example | `dom.ts` | @bryanchen-d |
| `design-tokens.instructions.md`, `ux-css-layout` skill | `vscode-known-variables.json` lists are regenerated by `./scripts/test-documentation.sh` and are not alphabetically maintained by hand; CSS-only properties go in `"others"` | `colorRegistry.releaseTest.ts`, `validateVariableNames.ts` | @mrleemurray |
| `.agents/skills/launch/SKILL.md` | Replace the stale `transpile-client` unit-test prep with `build-fast -- --client-only` | `.github/copilot-instructions.md`, `unit-tests` skill | @roblourens |

## Testing

Documentation only. No tests were run.

*🤖 Authored with GitHub Copilot on behalf of @rwoll.*


Co-authored-by: Copilot <[email protected]>
Dmitrii F. (lingeniare) pushed a commit to lingeniare/vegaide that referenced this pull request Nov 7, 2026
Corrects or removes stale and misleading statements in agent skills, instructions and architecture docs. I compared the 1000 most recent `microsoft/vscode` Copilot Memories with the docs and checked every conflict against the current code. Each change replaces or removes a single statement; no new guidance was added.

The last column tags the author of the commit that introduced each changed statement (bulk prose-unwrap commits are skipped). Please update or revert after merge if anything here is wrong.

## Changes

| File | Correction | Evidence | Last modified by |
|---|---|---|---|
| `src/vs/sessions/skills/troubleshoot/SKILL.md` | AHP wire logging is on by default in Insiders, not off by default | `ahpJsonlLogger.ts` `isAhpJsonlLoggingEnabled`; default changed in microsoft/vscode#341868 | @vijayupadya |
| `.github/skills/otel/SKILL.md`, `src/vs/platform/agentHost/OTEL.md` | The runtime version is `copilotRuntimeVersion` in `package.json`; `package-lock.json` has no `@github/copilot` entry | `package.json`, `build/gulpfile.vscode.ts` | @zhichli |
| `.github/skills/agent-host-e2e-tests/SKILL.md` | `hostOnlyTest(...)` is now `conformanceTest(...)` / `providerHostOnlyTest(...)` | `e2eTestContext.ts` | @roblourens |
| `smoke-tests`, `flaky-smoke-tests`, `agent-host-e2e-tests` skills | The runtime is the native `copilot-runtime` from `@github/copilot-sdk-<platform>`, not the `@github/copilot` CLI | `copilotRuntimePaths.ts` | @pwang347 |
| `src/vs/platform/agentHost/AGENTS.md` | Managed filesystem sandbox lists *are* resolved by `SandboxSettingsResolutionHelper`: a managed grant list replaces the local one, and denied paths are combined | `sandboxSettingsResolutionHelper.ts`, `sessionSandbox.ts` | @dileepyavan |
| `.github/skills/code-oss-logs/SKILL.md` | `scripts/code.sh` defaults to `code-oss-dev` in the platform app-data dir; `~/.vscode-oss-dev` is only the `launch.json` profile | `userDataPath.ts`, `.vscode/launch.json` | @roblourens |
| `MISSION_CONTROL.md` | Each relay gets its own `ProtocolServerHandler` instance rather than sharing the local handler | `missionControlHost.ts` `_attachRelay` | @roblourens |
| `.github/skills/agent-host-logs/SKILL.md` | `_ahpLog.ts` is when the logging process handled the message, not the time it was sent | `ahpJsonlLogger.ts` | @roblourens |
| `.github/skills/chat-customizations-editor/SKILL.md` | Remove the stale "currently gated fixtures" list; none of those fixtures is gated anymore | `aiCustomizationManagementEditor.fixture.ts` (`blocksCi: false`) | @joshspicer |
| `.github/skills/customizations-in-the-agent-host/SKILL.md` | Generated protocol files are changed upstream and synced with `scripts/sync-agent-host-protocol.ts`, not "backported" | `common/state/AGENTS.md` | @connor4312 |
| `ux-css-layout` skill | Point to `dom.DisposableResizeObserver` instead of a raw `ResizeObserver` | `dom.ts` | @mrleemurray |
| `.github/copilot-instructions.md` | Use `DisposableResizeObserver`'s `resizeObserverCtor` test seam as the example | `dom.ts` | @bryanchen-d |
| `design-tokens.instructions.md`, `ux-css-layout` skill | `vscode-known-variables.json` lists are regenerated by `./scripts/test-documentation.sh` and are not alphabetically maintained by hand; CSS-only properties go in `"others"` | `colorRegistry.releaseTest.ts`, `validateVariableNames.ts` | @mrleemurray |
| `.agents/skills/launch/SKILL.md` | Replace the stale `transpile-client` unit-test prep with `build-fast -- --client-only` | `.github/copilot-instructions.md`, `unit-tests` skill | @roblourens |

## Testing

Documentation only. No tests were run.

*🤖 Authored with GitHub Copilot on behalf of @rwoll.*


Co-authored-by: Copilot <[email protected]>
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