Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import {
connectionFromConfig,
harnessAllowsModel,
harnessSupportsUserMcp,
isPiHarnessValue,
modelIdFromConfig,
modelLabel,
providerForModel,
Expand Down Expand Up @@ -172,7 +173,7 @@ export function useModelHarness({
// is harness-filtered: selecting a model sets BOTH the model id and its provider, fed by the
// `/inspect` capability map below.
const harnessValue = typeof harness.kind === "string" ? (harness.kind as string) : null
const isPiHarness = harnessValue === "pi_core" || harnessValue === "pi_agenta"
const isPiHarness = isPiHarnessValue(harnessValue)
const llm = config.llm
const modelId = useMemo(() => modelIdFromConfig(llm), [llm])
const connection = useMemo(() => connectionFromConfig(llm), [llm])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,16 @@ function capsFor(
return capabilities[harness] ?? null
}

/**
* Whether a harness value is one of the Pi harnesses. An absent `harness.kind` (`null`/`undefined`)
* runs as `pi_core` at runtime (see `agents/dtos.py`'s `harness: str = "pi_core"` default), so it
* counts as Pi here too — otherwise the Pi permissions controls stay hidden for a run that is
* actually enforcing them (#5661).
*/
export function isPiHarnessValue(harness: string | null | undefined): boolean {
return harness == null || harness === "pi_core" || harness === "pi_agenta"
}

/** External MCP authoring is available only when the selected harness publishes it. */
export function harnessSupportsUserMcp(
capabilities: HarnessCapabilitiesMap | null | undefined,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
harnessAllowsProvider,
harnessSupportsUserMcp,
isDeploymentProviderKind,
isPiHarnessValue,
modelIdFromConfig,
modelSelectionMode,
providerForModel,
Expand Down Expand Up @@ -195,6 +196,14 @@ describe("connectionUtils: capability gating (inspect-fed)", () => {
expect(modelSelectionMode(CAPABILITIES, "claude")).toBe("alias")
})

it("treats an absent harness.kind as pi_core, matching the runner default (#5661)", () => {
expect(isPiHarnessValue(undefined)).toBe(true)
expect(isPiHarnessValue(null)).toBe(true)
expect(isPiHarnessValue("pi_core")).toBe(true)
expect(isPiHarnessValue("pi_agenta")).toBe(true)
expect(isPiHarnessValue("claude")).toBe(false)
})

it("is permissive when the map or harness is missing", () => {
expect(allowedProviders(null, "pi_core")).toEqual(["*"])
expect(allowedProviders(CAPABILITIES, "future-harness")).toEqual(["*"])
Expand Down
Loading