[BUG] VS Code extension: "Prefer Agent Host" breaks Trusted Devices enrollment for Remote Control
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
When the VS Code experimental setting Chat->Editor->Claude: "Prefer Agent Host" is enabled, /remote-control fails with:
Remote Control failed to connect: Your organization requires Trusted Devices for Remote Control, but this device is not enrolled. Please run /login in Claude Code to enroll this device.
This happens even after a full logout/login cycle via the Command Palette's "Claude Code: Logout" / sign-in flow. The device never appears under claude.ai/settings/account → Trusted devices.
Disabling "Prefer Agent Host" and reloading the window fixes it immediately — /remote-control connects and the device shows up as enrolled.
For comparison, the standalone Claude Code CLI (run directly in a terminal, not through the extension) enrolls correctly and shows up as a trusted device without any issue.
Suspected cause
This looks like the same underlying failure class as #62634 — a host-embedded Claude Code process ending up with a user ID but no organization UUID attached to its OAuth grant, which the Remote Control bridge needs to enroll the device. "Prefer Agent Host" routes the extension into VS Code's Agent Host process (VS Code 1.129+), which may not be passing through the same org context that the extension's normal embedded process uses.
What Should Happen?
Also with "Prefer Agent Host" setting set, the trusted device enrollment should work.
Error Messages/Logs
Steps to Reproduce
- Org has "Require trusted devices" enabled (Team/Enterprise, Claude Code admin settings).
- In VS Code, enable the experimental "Prefer Agent Host" setting.
- Run /remote-control in the Claude Code extension.
- Observe the Trusted Devices enrollment error.
- Log out/in again via Command Palette — error persists.
- Disable "Prefer Agent Host," reload window, retry /remote-control — works, device enrolls.
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.223
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
VS Code integrated terminal
Additional Information
Claude Code extension version: 2.1.223
VS Code version: 1.132.0
Claude Code CLI version (for comparison): 2.1.223
OS: macOS -> devcontainer -> ubuntu 24.04.4
Plan: Team