@devries-cameron20 / t3code-1 / commits / d5726cb88c
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(server): agents get no device tools or instructions while the Device hub is off (#32542)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

Julius Marminge committed Nov 14, 2026 at 20:52 UTC d5726cb88c3e80548de5d4e2f4cec0ebaa224760
4 files changed +54 -4
apps/server/src/mcp/McpDeviceToolkit.test.ts
+1 -1
@@ -235,7 +235,7 @@ it.effect("registers the device tools and returns the screenshot as image conten
235 expect(denied.content).toEqual([
236 {
237 type: "text",
238 - text: "Agent device access is turned off for this environment. Ask the user to turn on Agent device access in Settings > Integrations > Devices; it applies when the agent session next starts, such as in a new thread.",
238 + text: "Agent device access is turned off for this environment. Ask the user to turn on the Device hub and Agent device access in Settings > Integrations > Devices; it applies when the agent session next starts, such as in a new thread.",
239 },
240 ]);
241 }),
apps/server/src/mcp/toolkits/device/handlers.ts
+1 -1
@@ -89,7 +89,7 @@ const requireDeviceAccess = McpInvocationContext.requireThreadMcpCapability("dev
89 () =>
90 new DeviceToolUnavailableError({
91 reason:
92 - "Agent device access is turned off for this environment. Ask the user to turn on Agent device access in Settings > Integrations > Devices; it applies when the agent session next starts, such as in a new thread.",
92 + "Agent device access is turned off for this environment. Ask the user to turn on the Device hub and Agent device access in Settings > Integrations > Devices; it applies when the agent session next starts, such as in a new thread.",
93 }),
94 ),
95 );
apps/server/src/orchestration-v2/ProviderSessionManager.test.ts
+47
@@ -813,6 +813,8 @@ function runBrowserAccessScenario(input: {
813 readonly enableAgentBrowserAccess: boolean;
814 readonly projectOverride: boolean;
815 readonly deviceOverride?: boolean;
816 + readonly enableAgentDeviceAccess?: boolean;
817 + readonly enableDeviceSupport?: boolean;
818 readonly createThread?: boolean;
819 readonly projectExists?: boolean;
820 readonly delegatedBy?: ThreadId;
@@ -867,6 +869,12 @@ function runBrowserAccessScenario(input: {
869 projectServiceLayer: layerProjectService,
870 serverSettingsLayer: ServerSettings.layerTest({
871 enableAgentBrowserAccess: input.enableAgentBrowserAccess,
872 + ...(input.enableAgentDeviceAccess === undefined
873 + ? {}
874 + : { enableAgentDeviceAccess: input.enableAgentDeviceAccess }),
875 + ...(input.enableDeviceSupport === undefined
876 + ? {}
877 + : { enableDeviceSupport: input.enableDeviceSupport }),
878 projectSettingsOverrides: {
879 [projectId]: {
880 enableAgentBrowserAccess: input.projectOverride,
@@ -5569,6 +5577,7 @@ it.effect(
5577 enableAgentBrowserAccess: false,
5578 projectOverride: false,
5579 deviceOverride: true,
5580 + enableDeviceSupport: true,
5581 });
5582 assert.isTrue(enabled?.capabilities?.has("device"));
5583 assert.isFalse(enabled?.browserToolsAvailable);
@@ -5576,12 +5585,49 @@ it.effect(
5585 enableAgentBrowserAccess: false,
5586 projectOverride: false,
5587 deviceOverride: true,
5588 + enableDeviceSupport: true,
5589 projectExists: false,
5590 });
5591 assert.isFalse(denied?.capabilities?.has("device"));
5592 }),
5593 );
5594
5595 +it.effect("ProviderSessionManagerV2 withholds device tools while device support is off", () =>
5596 + Effect.gen(function* () {
5597 + const global = yield* runBrowserAccessScenario({
5598 + enableAgentBrowserAccess: false,
5599 + projectOverride: false,
5600 + enableAgentDeviceAccess: true,
5601 + enableDeviceSupport: false,
5602 + });
5603 + assert.isFalse(
5604 + global?.capabilities?.has("device"),
5605 + "global agent device access granted device tools with device support off",
5606 + );
5607 + const project = yield* runBrowserAccessScenario({
5608 + enableAgentBrowserAccess: false,
5609 + projectOverride: false,
5610 + deviceOverride: true,
5611 + enableDeviceSupport: false,
5612 + });
5613 + assert.isFalse(
5614 + project?.capabilities?.has("device"),
5615 + "project agent device access granted device tools with device support off",
5616 + );
5617 + const missingProject = yield* runBrowserAccessScenario({
5618 + enableAgentBrowserAccess: false,
5619 + projectOverride: false,
5620 + enableAgentDeviceAccess: true,
5621 + enableDeviceSupport: false,
5622 + projectExists: false,
5623 + });
5624 + assert.isFalse(
5625 + missingProject?.capabilities?.has("device"),
5626 + "agent device access granted device tools with device support off for a missing project",
5627 + );
5628 + }),
5629 +);
5630 +
5631 // Device instructions reach delegated children only because their own sessions hold `device`.
5632 it.effect("ProviderSessionManagerV2 gives a delegated child its project's device access", () =>
5633 Effect.gen(function* () {
@@ -5589,6 +5635,7 @@ it.effect("ProviderSessionManagerV2 gives a delegated child its project's device
5635 enableAgentBrowserAccess: false,
5636 projectOverride: false,
5637 deviceOverride: true,
5638 + enableDeviceSupport: true,
5639 delegatedBy: ThreadId.make("thread-provider-session-manager-parent"),
5640 });
5641 assert.isTrue(child?.capabilities?.has("device"));
apps/server/src/orchestration-v2/ProviderSessionManager.ts
+5 -2
@@ -469,13 +469,16 @@ export const layerWithOptions = (
469 if (Option.isNone(project))
470 return {
471 browser: browserOverridden ? false : settings.enableAgentBrowserAccess,
472 - device: deviceOverridden ? false : settings.enableAgentDeviceAccess,
472 + device:
473 + settings.enableDeviceSupport &&
474 + !deviceOverridden &&
475 + settings.enableAgentDeviceAccess,
476 };
477 }
478 const effective = resolveProjectSettings(settings, thread.projectId).settings;
479 return {
480 browser: effective.enableAgentBrowserAccess,
478 - device: effective.enableAgentDeviceAccess,
481 + device: settings.enableDeviceSupport && effective.enableAgentDeviceAccess,
482 };
483 }).pipe(
484 Effect.catch((cause) =>