diff --git a/app/src/components/projects/PermissionModeControl.test.tsx b/app/src/components/projects/PermissionModeControl.test.tsx
index f1d6d83..f61b227 100644
--- a/app/src/components/projects/PermissionModeControl.test.tsx
+++ b/app/src/components/projects/PermissionModeControl.test.tsx
@@ -149,4 +149,11 @@ describe("PermissionModeControl", () => {
/Caution/i,
);
});
+
+ it("shows the sandbox OFF on an AWS project whatever the setting says", () => {
+ const aws = { ...baseProject, host_id: "aws-1", sandbox_mode_enabled: true, permission_mode: "bypass" as const };
+ render();
+ expect(screen.getByTestId("sandbox-state")).toHaveTextContent(/Sandbox OFF/);
+ expect(screen.getByTestId("permission-mode-hint")).toHaveTextContent(/Caution/i);
+ });
});
diff --git a/app/src/components/projects/PermissionModeControl.tsx b/app/src/components/projects/PermissionModeControl.tsx
index 8d32012..043efdb 100644
--- a/app/src/components/projects/PermissionModeControl.tsx
+++ b/app/src/components/projects/PermissionModeControl.tsx
@@ -1,5 +1,6 @@
import type { PermissionMode, Project } from "../../lib/types";
import SegmentedControl, { type Segment } from "../ui/SegmentedControl";
+import { sandboxEffective } from "../../lib/awsWorkspace";
export const PERMISSION_MODES: Segment[] = [
{ value: "plan", label: "Plan", hint: "Claude proposes a plan and makes no changes." },
@@ -56,7 +57,7 @@ export default function PermissionModeControl({
disabledReason,
}: Props) {
const mode = effectivePermissionMode(project);
- const sandboxOn = project.sandbox_mode_enabled;
+ const sandboxOn = sandboxEffective(project);
const uncontainedBypass = mode === "bypass" && !sandboxOn;
const segments = PERMISSION_MODES.map((segment) =>
diff --git a/app/src/components/projects/home/config/RuntimeSection.tsx b/app/src/components/projects/home/config/RuntimeSection.tsx
index b2fc661..b9bef91 100644
--- a/app/src/components/projects/home/config/RuntimeSection.tsx
+++ b/app/src/components/projects/home/config/RuntimeSection.tsx
@@ -10,6 +10,7 @@ import {
NOT_ON_AWS,
SANDBOX_OFF_ON_AWS,
isAwsProject,
+ sandboxEffective,
} from "../../../../lib/awsWorkspace";
interface Props {
@@ -55,7 +56,7 @@ export default function RuntimeSection({
control={
save({ sandbox_mode_enabled: v })}
/>
diff --git a/app/src/lib/awsWorkspace.ts b/app/src/lib/awsWorkspace.ts
index d2a38d2..68b0896 100644
--- a/app/src/lib/awsWorkspace.ts
+++ b/app/src/lib/awsWorkspace.ts
@@ -21,6 +21,13 @@ export function isAwsProject(p: Pick): boolean {
return p.host_id != null;
}
+/** Whether Claude Code's sandbox actually runs for `p`: never on AWS (the
+ * host forces it off there; Rust `aws_host::sandbox_allowed`), else the
+ * project's setting. */
+export function sandboxEffective(p: Pick): boolean {
+ return !isAwsProject(p) && p.sandbox_mode_enabled;
+}
+
/** Fargate CPU sizes (units of 1/1024 vCPU). */
export const FARGATE_CPUS = [256, 512, 1024, 2048, 4096, 8192, 16384] as const;