Set codex-local creation defaults for model and sandbox bypass

This commit is contained in:
Dotta
2026-03-03 12:41:50 -06:00
parent 8351f7f1bd
commit 0810101fda
5 changed files with 78 additions and 9 deletions

View File

@@ -11,6 +11,10 @@ import type { AdapterModel } from "../api/agents";
import { agentsApi } from "../api/agents";
import { secretsApi } from "../api/secrets";
import { assetsApi } from "../api/assets";
import {
DEFAULT_CODEX_LOCAL_BYPASS_APPROVALS_AND_SANDBOX,
DEFAULT_CODEX_LOCAL_MODEL,
} from "@paperclipai/adapter-codex-local";
import {
Popover,
PopoverContent,
@@ -433,7 +437,13 @@ export function AgentConfigForm(props: AgentConfigFormProps) {
if (isCreate) {
// Reset all adapter-specific fields to defaults when switching adapter type
const { adapterType: _at, ...defaults } = defaultCreateValues;
set!({ ...defaults, adapterType: t });
const nextValues: CreateConfigValues = { ...defaults, adapterType: t };
if (t === "codex_local") {
nextValues.model = DEFAULT_CODEX_LOCAL_MODEL;
nextValues.dangerouslyBypassSandbox =
DEFAULT_CODEX_LOCAL_BYPASS_APPROVALS_AND_SANDBOX;
}
set!(nextValues);
} else {
// Clear all adapter config and explicitly blank out model + both effort keys
// so the old adapter's values don't bleed through via eff()
@@ -441,9 +451,15 @@ export function AgentConfigForm(props: AgentConfigFormProps) {
...prev,
adapterType: t,
adapterConfig: {
model: "",
model: t === "codex_local" ? DEFAULT_CODEX_LOCAL_MODEL : "",
effort: "",
modelReasoningEffort: "",
...(t === "codex_local"
? {
dangerouslyBypassApprovalsAndSandbox:
DEFAULT_CODEX_LOCAL_BYPASS_APPROVALS_AND_SANDBOX,
}
: {}),
},
}));
}

View File

@@ -18,6 +18,10 @@ import { Button } from "@/components/ui/button";
import { cn } from "../lib/utils";
import { getUIAdapter } from "../adapters";
import { defaultCreateValues } from "./agent-config-defaults";
import {
DEFAULT_CODEX_LOCAL_BYPASS_APPROVALS_AND_SANDBOX,
DEFAULT_CODEX_LOCAL_MODEL,
} from "@paperclipai/adapter-codex-local";
import { AsciiArtAnimation } from "./AsciiArtAnimation";
import { ChoosePathButton } from "./PathInstructionsModal";
import { HintIcon } from "./agent-config-primitives";
@@ -156,11 +160,15 @@ export function OnboardingWizard() {
...defaultCreateValues,
adapterType,
cwd,
model,
model: adapterType === "codex_local" ? model || DEFAULT_CODEX_LOCAL_MODEL : model,
command,
args,
url,
dangerouslySkipPermissions: adapterType === "claude_local",
dangerouslyBypassSandbox:
adapterType === "codex_local"
? DEFAULT_CODEX_LOCAL_BYPASS_APPROVALS_AND_SANDBOX
: defaultCreateValues.dangerouslyBypassSandbox,
});
}
@@ -456,7 +464,12 @@ export function OnboardingWizard() {
: "border-border hover:bg-accent/50"
)}
onClick={() => {
if (!opt.comingSoon) setAdapterType(opt.value as AdapterType);
if (opt.comingSoon) return;
const nextType = opt.value as AdapterType;
setAdapterType(nextType);
if (nextType === "codex_local" && !model) {
setModel(DEFAULT_CODEX_LOCAL_MODEL);
}
}}
>
<opt.icon className="h-4 w-4" />