fix(aws): show the sandbox as off wherever an AWS project can't run it

PermissionModeControl read the raw sandbox_mode_enabled, so an AWS
project showed "Sandbox ON — bubblewrap isolation" and no Bypass
caution although the host forces it off. A shared sandboxEffective()
(false for any AWS project) now feeds both it and the Runtime toggle.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shadowdaoandClaude Opus 5.5 committed 2026-11-16 17:59:44 -08:00
1 parent c25761789e
commit 10f473f3da
4 files changed
+18 -2

No files matched your search

@@ -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(<PermissionModeControl project={aws} onChange={vi.fn()} />);
expect(screen.getByTestId("sandbox-state")).toHaveTextContent(/Sandbox OFF/);
expect(screen.getByTestId("permission-mode-hint")).toHaveTextContent(/Caution/i);
});
});
@@ -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<PermissionMode>[] = [
{ 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) =>
@@ -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={
<Toggle
label="Sandbox mode"
checked={sandboxOff ? false : project.sandbox_mode_enabled}
checked={sandboxEffective(project)}
disabled={disabled || sandboxOff}
onChange={(v) => save({ sandbox_mode_enabled: v })}
/>
+7
View File
@@ -21,6 +21,13 @@ export function isAwsProject(p: Pick<Project, "host_id">): 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<Project, "host_id" | "sandbox_mode_enabled">): 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;