fix: expose explicit legacy CLI selection for Boat agents

Show CLI as the visible initial engine for fresh legacy agents on active Boat environments and preserve explicit choices through probe and hire. Permit the runtime engine selector on attached Boat environments while retaining managed host-path restrictions and other environment policy.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
DottaandPaperclip committed 2026-10-10 13:53:54 -05:00
1 parent 3081b7480f
commit 6e09a5ee82
8 files changed
+133 -12

No files matched your search

@@ -81,6 +81,7 @@ export function ClaudeLocalAdvancedFields({
eff,
mark,
managedSandboxOnly,
allowExecutionEngineSelection,
}: AdapterConfigFieldsProps) {
const rawEngine = isCreate
? values!.claudeEngine ?? "auto"
@@ -91,12 +92,10 @@ export function ClaudeLocalAdvancedFields({
return configFieldsForSection(section, (
<>
{/*
The execution engine picks which binary runs on the execution host, and
the ACP sub-fields below name host paths. The platform-managed
environment owns both, so the managed-sandbox-only policy hides them,
the same way `runnerManaged` hides them for the Paperclip Runner.
Attached computers can select an engine while the managed policy keeps
every host-path field hidden.
*/}
{!managedSandboxOnly && <Field label="Execution engine" hint="Default uses ACP. If ACP is unavailable, the run fails with a setup error. Choose CLI explicitly to use it.">
{(!managedSandboxOnly || allowExecutionEngineSelection) && <Field label="Execution engine" hint="Default uses ACP. If ACP is unavailable, the run fails with a setup error. Choose CLI explicitly to use it.">
<select
className={inputClass}
value={engine}
@@ -62,13 +62,12 @@ export function CodexLocalConfigFields({
models,
hideInstructionsFile,
managedSandboxOnly,
allowExecutionEngineSelection,
}: AdapterConfigFieldsProps) {
const runnerManaged = adapterType === "paperclip_runner";
// The execution engine picks which binary runs on the execution host, and the
// ACP sub-fields below name host paths. The platform-managed environment owns
// both, so the managed-sandbox-only policy hides them the same way
// `runnerManaged` already does for the Paperclip Runner.
const hideEngineChoice = runnerManaged || managedSandboxOnly === true;
// Attached computers can select an engine independently of the managed policy
// that still hides host paths. Native runners own their engine selection.
const hideEngineChoice = runnerManaged || (managedSandboxOnly === true && !allowExecutionEngineSelection);
const configuredRunnerProvider = runnerManaged
? isCreate
? values!.adapterSchemaValues?.provider
+17
View File
@@ -58,6 +58,23 @@ async function renderSection(
}
describe("adapter configuration sections", () => {
it.each([
[CodexLocalConfigFields, "codex_local"], [ClaudeLocalAdvancedFields, "claude_local"],
] as const)("exposes an attached computer engine without host-path fields: %s %s", async (Component, adapterType) => {
const html = await renderMarkup(<TooltipProvider><Component
mode="edit" isCreate={false} adapterType={adapterType} values={null} set={null}
config={{ engine: "acp", stateDir: "/private/host-state", agentCommand: "/private/host-command" }}
eff={(_group, _key, original) => original} mark={() => {}} models={[]}
managedSandboxOnly allowExecutionEngineSelection hideInstructionsFile
/></TooltipProvider>);
expect(html).toContain("Execution engine");
expect(html).toContain('value="cli"');
expect(html).not.toContain("/private/host-state");
expect(html).not.toContain("/private/host-command");
expect(html).not.toContain("ACP server command");
expect(html).not.toContain("ACP state directory");
});
it("separates provider selection from lifecycle and hides fixed Codex permissions", async () => {
const config = {
provider: "codex",
+4 -1
View File
@@ -44,13 +44,16 @@ export interface AdapterConfigFieldsProps {
hideInstructionsFile?: boolean;
/**
* When true, the adapter must hide every host filesystem path field and every
* execution-engine choice. Non-path behavior toggles stay visible.
* execution-engine choice unless separately enabled for an attached computer.
* Non-path behavior toggles stay visible.
*
* The form sets this from the instance managed-sandbox-only policy
* (`enableManagedSandboxOnly`), and also while that policy is still loading,
* so a stored path never flashes before the policy resolves.
*/
managedSandboxOnly?: boolean;
/** Permit the engine selector on an attached Boat without exposing host paths. */
allowExecutionEngineSelection?: boolean;
/** Show Dot for new selections only when its experimental prerequisites are enabled. */
openAiDotEnabled?: boolean;
}
@@ -112,7 +112,7 @@ vi.mock("../adapters", () => ({
// adapter's fields.
ConfigFields: (props: AdapterConfigFieldsProps) => {
if (type === "paperclip_runner") return <CodexLocalConfigFields {...props} />;
const { adapterType, hideInstructionsFile, managedSandboxOnly } = props;
const { adapterType, hideInstructionsFile, managedSandboxOnly, allowExecutionEngineSelection } = props;
return adapterType === "hermes_gateway"
? <div data-testid="hermes-gateway-config-fields">Hermes Gateway fields</div>
: (
@@ -120,6 +120,7 @@ vi.mock("../adapters", () => ({
data-testid="adapter-config-fields"
data-hide-instructions-file={String(hideInstructionsFile === true)}
data-managed-sandbox-only={String(managedSandboxOnly === true)}
data-allow-execution-engine={String(allowExecutionEngineSelection === true)}
/>
);
},
@@ -3877,6 +3878,30 @@ describe("AgentConfigForm managed-sandbox-only host surfaces", () => {
expect(result.container.textContent).not.toContain("/srv/agents/cody");
});
it.each(["active", "archived"] as const)("only exposes the engine for a resolved active Boat, keeping managed host paths hidden (%s)", async status => {
setManagedSandboxOnly(true);
const result = await renderForm(
[makeEnvironment({ id: "boat-1", name: "Boat", driver: "computer", status, config: { provider: "boat" } })],
{ adapterType: "claude_local", defaultEnvironmentId: "boat-1", adapterConfig: MANAGED_AGENT_CONFIG },
);
roots.push(result.root);
await act(async () => {
for (const button of result.container.querySelectorAll("button")) {
if (["Advanced", "Advanced Run Policy"].includes(button.textContent?.trim() ?? "")) button.click();
}
});
await flushReact();
const labels = fieldLabels(result.container);
expect(labels.includes("Execution engine")).toBe(status === "active");
for (const label of ["Working directory (deprecated)", "Command", "ACP server command", "ACP state directory"]) {
expect(labels).not.toContain(label);
}
expect(choosePathButtons(result.container)).toHaveLength(0);
const adapterFields = result.container.querySelector('[data-testid="adapter-config-fields"]');
expect(adapterFields?.getAttribute("data-managed-sandbox-only")).toBe("true");
expect(adapterFields?.getAttribute("data-allow-execution-engine")).toBe(String(status === "active"));
});
it("keeps the non-path ACP controls visible when the policy hides the engine choice", async () => {
setManagedSandboxOnly(true);
const result = await renderForm(
+4
View File
@@ -969,6 +969,10 @@ export function AgentConfigForm(props: AgentConfigFormProps) {
// every adapter without a per-adapter edit.
hideInstructionsFile: hideInstructionsFile || hideHostPaths || isDotRunner,
managedSandboxOnly: hideHostPaths || isDotRunner,
allowExecutionEngineSelection: experimentalSettings !== undefined
&& effectiveLoginEnvironment?.status === "active"
&& effectiveLoginEnvironment.driver === "computer"
&& effectiveLoginEnvironment.config.provider === "boat",
openAiDotEnabled: experimentalSettings?.enableOpenAiDot === true,
};
@@ -146,6 +146,7 @@ function Setup({
const [effort, setEffort] = useState("");
const [modelOpen, setModelOpen] = useState(false);
const [environmentOverride, setEnvironmentOverride] = useState("");
const [boatEngine, setBoatEngine] = useState<"cli" | "acp" | undefined>();
const [provider, setProvider] = useState("openrouter");
const [apiKey, setApiKey] = useState("");
const [providerBinding, setProviderBinding] = useState<EnvBinding | null>(
@@ -272,6 +273,10 @@ function Setup({
: "Could not resolve the environment.";
}
const environment = envs.data?.find((env) => env.id === environmentId);
const boatLegacyEngine = environment?.status === "active"
&& environment.driver === "computer"
&& environment.config.provider === "boat"
&& (adapterType === "codex_local" || adapterType === "claude_local");
const sandboxProvider =
typeof environment?.config?.provider === "string"
? environment.config.provider
@@ -339,6 +344,23 @@ function Setup({
(!(managedOnly || forced.forced) || environmentId),
);
const busy = testState === "running" || saving;
const boatEngineField = ready && boatLegacyEngine ? (
<Field label="Execution engine">
<select
aria-label="Execution engine"
className={controlClass}
value={boatEngine ?? "cli"}
disabled={busy}
onChange={(event) => {
setBoatEngine(event.target.value === "acp" ? "acp" : "cli");
resetTest();
}}
>
<option value="cli">{adapterType === "codex_local" ? "Codex CLI" : "Claude CLI"}</option>
<option value="acp">ACP</option>
</select>
</Field>
) : null;
function buildConfig(
nextConnection = connection,
@@ -363,6 +385,7 @@ function Setup({
: {}),
};
const config = getUIAdapter(adapterType).buildAdapterConfig(values);
if (boatLegacyEngine) config.engine = boatEngine ?? "cli";
if (isRunner)
Object.assign(config, {
provider: (runnerProvider === "claude" || runnerProvider === "grok") ? "acpx" : runnerProvider,
@@ -733,6 +756,7 @@ function Setup({
center
/>
</div>
{boatEngineField && <div className="mb-6">{boatEngineField}</div>}
{ready ? <AgentProviderConnection
key={environmentId ?? "local"}
companyId={companyId}
@@ -849,6 +873,7 @@ function Setup({
Configure your agent
</h2>
<fieldset disabled={busy} className="space-y-8">
{boatEngineField}
<section className="space-y-5">
{isDot && <>
<p className="text-sm text-muted-foreground">Create this agent, then copy its pairing prompt to your Dot.</p>
+49
View File
@@ -310,6 +310,55 @@ describe("New agent setup", () => {
expect(container.textContent).toContain("This adapter is unavailable");
expect(api.hire).not.toHaveBeenCalled();
});
it.each([
["codex_local", "OpenAI", undefined], ["claude_local", "Claude", undefined],
["codex_local", "OpenAI", "acp"], ["claude_local", "Claude", "acp"],
])("shows Boat's CLI default before connecting and preserves an explicit engine for %s (%s, %s)", async (adapter, provider, choice) => {
envApi.list.mockResolvedValue([
{ id: "boat-1", name: "Boat", driver: "computer", status: "active", config: { provider: "boat" } },
]);
settings.get.mockResolvedValue({ defaultEnvironmentId: "boat-1" });
settings.getExperimental.mockResolvedValue({ enableManagedSandboxOnly: true, enableNativeRunner: true });
await render(adapter);
const engine = container.querySelector<HTMLSelectElement>('[aria-label="Execution engine"]')!;
expect(engine).not.toBeNull();
expect(engine.value).toBe("cli");
expect(engine.selectedOptions[0].textContent).toBe(adapter === "codex_local" ? "Codex CLI" : "Claude CLI");
expect(api.testEnvironment).not.toHaveBeenCalled();
if (choice) await act(async () => {
engine.value = choice;
engine.dispatchEvent(new Event("change", { bubbles: true }));
});
await click(provider + "API key");
await fill("API key", "boat-test-key");
await click("Connect");
expect(api.testEnvironment.mock.calls[0][2]).toMatchObject({
environmentId: "boat-1", adapterConfig: { engine: choice ?? "cli" },
});
expect(container.querySelector<HTMLSelectElement>('[aria-label="Execution engine"]')?.value).toBe(choice ?? "cli");
await click("Finish setup");
expect(api.hire.mock.calls[0][1]).toMatchObject({
defaultEnvironmentId: "boat-1", adapterConfig: { engine: choice ?? "cli" },
runtimeConfig: { heartbeat: { enabled: false } },
});
});
it.each(["codex_local", "claude_local"])("does not expose or inject a Boat engine on a managed sandbox for %s", async adapter => {
envApi.list.mockResolvedValue([
{ id: "managed-1", name: "Managed", driver: "sandbox", status: "active", config: { provider: "daytona" } },
]);
settings.get.mockResolvedValue({ defaultEnvironmentId: "managed-1" });
settings.getExperimental.mockResolvedValue({ enableManagedSandboxOnly: true, enableNativeRunner: true });
await render(adapter);
expect(container.querySelector('[aria-label="Execution engine"]')).toBeNull();
await click((adapter === "codex_local" ? "OpenAI" : "Claude") + "API key");
await fill("API key", "sandbox-test-key");
await click("Connect");
expect(api.testEnvironment.mock.calls[0][2].adapterConfig.engine).toBeUndefined();
await click("Finish setup");
expect(api.hire.mock.calls[0][1].adapterConfig.engine).toBeUndefined();
});
it.each([
["grok_local", "subscription"], ["grok_local", "api_key"],
["paperclip_runner", "subscription"], ["paperclip_runner", "api_key"],