Make harness choices deployment-configurable

Managed deployments need to control harness availability without changing Core policy. Add a generic environment contract and apply it across harness and model selectors, preserving saved supported profiles and validating import, team, and invite selections. Document deployment ownership in agent guidance.

Validation: focused local tests and typechecks passed; all applicable CI checks passed on the reviewed head. Greptile scored 5/5 with no unresolved comments.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
Devin FoleyandPaperclip authored and GitHub committed 2026-11-20 15:45:36 -08:00
1 parent 104f323bee
commit ae2afd525b
35 files changed
+822 -88

No files matched your search

@@ -1,4 +1,5 @@
// @vitest-environment jsdom
import { sampleHarnesses } from "@/test-support/harness-availability";
import { act, useState, type ComponentProps } from "react";
import { flushSync } from "react-dom";
@@ -8,6 +9,7 @@ import type { Agent } from "@paperclipai/shared";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { agentsApi } from "@/api/agents";
import { ComposerRunSettingsPicker } from "./ComposerRunSettingsPicker";
import { queryKeys } from "@/lib/queryKeys";
import type { ComposerRunSettings } from "./composer-run-settings";
import { getLastComposerEffort, rememberComposerEffort } from "@/lib/recent-composer-effort";
import { Dialog, DialogContent, DialogTitle } from "@/components/ui/dialog";
@@ -61,6 +63,20 @@ afterEach(() => {
});
describe("composer assignee picker", () => {
it.each(["antigravity", "copilot"])("applies the Cloud allowlist to saved %s model settings", async acpxAgent => {
const selectedAgent = { ...agent, adapterType: "paperclip_runner", adapterConfig: { provider: "acpx", acpxAgent, model: "saved-model" } } as Agent;
const client = render(vi.fn(), vi.fn(), false, { agents: new Map([[selectedAgent.id, selectedAgent]]) });
await act(async () => {
client.setQueryData(queryKeys.health, { status: "ok", cloud: { managed: true, availableHarnesses: sampleHarnesses } });
await new Promise(resolve => setTimeout(resolve, 0));
});
expect(document.querySelector('[aria-label="Select model and effort"]') !== null).toBe(acpxAgent === "copilot");
if (acpxAgent === "copilot") {
await click("Select model and effort");
expect(document.querySelector('[aria-label="Choose exact model"]')).not.toBeNull();
}
});
it.each([false, true])("allows model and effort changes with a fixed conversation agent (mobile: %s)", async (mobile) => {
const onAssigneeChange = vi.fn();
const onSettingsChange = vi.fn();
@@ -3,6 +3,8 @@ import { useQuery } from "@tanstack/react-query";
import { ArrowLeft, Check, ChevronDown, Plus, RotateCcw, Search, X, Zap } from "lucide-react";
import { aiRuntimeConnectionBindingSchema, agentHarnessType, type Agent, type IssueAssigneeAdapterOverrides } from "@paperclipai/shared";
import { agentsApi, type AdapterModel } from "@/api/agents";
import { useCloudInstance } from "@/hooks/useCloudInstance";
import { useCloudHarnessPolicy } from "@/hooks/useCloudHarnessPolicy";
import { queryKeys } from "@/lib/queryKeys";
import { ACCOUNT_BOUND_MODEL_DISCOVERY_QUERY_OPTIONS, nativeTaskModelCatalogOptions } from "@/lib/native-model-catalog";
import { cn } from "@/lib/utils";
@@ -106,7 +108,9 @@ export function ComposerRunSettingsPicker({
const mobileViewportStyle = useMobileEntityPickerViewportStyle();
const agentId = assigneeValue.startsWith("agent:") ? assigneeValue.slice(6) : "";
const agent = agents.get(agentId);
const modelSupported = supportsComposerModel(agent);
const cloud = Boolean(useCloudInstance());
const harnessPolicy = useCloudHarnessPolicy();
const modelSupported = supportsComposerModel(agent) && (!cloud || Boolean(agent && harnessPolicy.isCloudHarnessAllowed(agent.adapterType, agent.adapterConfig)));
const view = (requestedView === "models" && !modelSupported) || (requestedView === "agents" && !allowAssigneeChange)
? "settings"
: requestedView;