Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -121,12 +121,15 @@ const ModelHarnessSectionBody = ({
section,
...params
}: {
section: "model-harness" | "advanced"
section: "model-harness" | "advanced" | "connect-key"
} & Parameters<typeof useModelHarness>[0]) => {
const mh = useModelHarness(params)
if (section === "advanced") {
return <>{mh.advancedDrawerBody}</>
}
if (section === "connect-key") {
return <>{mh.providerCredentialsSection}</>
}
return <>{mh.modelHarnessDrawerBody}</>
}

Expand Down Expand Up @@ -490,6 +493,19 @@ export const AgentTemplateControl = memo(function AgentTemplateControl({
}),
[sectionChanges.draft, onChange, config, committed],
)
// Whether THIS session's edit touched the provider/connection specifically (`llm.connection.*` /
// `llm.provider`), not just some other model-harness field (e.g. `harness.kind`). Gates the
// connect-key pane's diff-aware variant below — narrower than "the section has any change" so a
// harness-only edit that happens to also need a key keeps its plain (model-picker-inclusive) pane
// instead of losing the picker to a body that only knows how to show the credentials group.
Comment thread
bekossy marked this conversation as resolved.
Outdated
const credentialsPathChanged = useMemo(
() =>
(sectionChanges.draft.sectionsByKey.get("model-harness")?.scalarChanges ?? []).some(
(c) => c.key === "llm.provider" || c.key.startsWith("llm.connection"),
Comment thread
bekossy marked this conversation as resolved.
),
[sectionChanges.draft],
)

// The inline body for a drawer-backed section: its own controls, narrowed to what changed — the
// same affordance as the Connect-key field, with a different filter (see SectionChangeBody).
// The body is a COMPONENT rendered inside the providers, never `mh`'s pre-built output: the hook
Expand Down Expand Up @@ -817,7 +833,13 @@ export const AgentTemplateControl = memo(function AgentTemplateControl({
// What the section surfaces inline, in precedence order. Dropping `onOpen` is what makes
// a section expand inline instead of routing to the drawer.
// 1. Required info missing (no provider key) — BLOCKING, so it wins: the same key field
// the drawer uses, right here.
// the drawer uses, right here. If THIS SESSION also moved the connection/provider
// itself, swap the bare (headerless) pane for the changed-aware accordion variant —
// otherwise that diff has no affordance anywhere: the bare pane never mounts under a
// ChangedPathsProvider (`mh.providerCredentialsInline` here is the parent's
// uncontexted instance) and structurally has no indicator/badge/revert chrome. A
// change to some OTHER model-harness field (e.g. harness.kind) keeps the plain pane,
// so it doesn't lose the inline model picker for a diff it can't represent anyway.
// 2. Uncommitted changes — informational: what changed (see `changeBodyFor`).
// 3. Neither — the plain drawer row it has always been.
...(showKeyPane
Expand All @@ -832,7 +854,22 @@ export const AgentTemplateControl = memo(function AgentTemplateControl({
onOpenDetails={() => openSectionDrawer("model-harness")}
disabled={disabled}
>
{mh.providerCredentialsInline}
{credentialsPathChanged ? (
<ChangedPathsProvider changes={panelChangedPaths}>
<ModelHarnessSectionBody
section="connect-key"
Comment thread
bekossy marked this conversation as resolved.
schema={schema}
config={config}
onChange={onChange}
disabled={disabled}
withTooltip={withTooltip}
revisionId={revisionId}
savedHarnessValue={savedHarnessValue}
/>
</ChangedPathsProvider>
) : (
mh.providerCredentialsInline
)}
</SectionQuickAction>
</div>
</HeightCollapse>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1094,6 +1094,10 @@ export function useModelHarness({
// self-managed card; no nested header/badge, no rail) for the inline "Connect key"
// quick-action under the section header — aligned with the drawer without duplicating it.
providerCredentialsInline,
// The full accordion variant (header, "Connect key" badge, changed-path indicator, group
// revert) — used instead of the bare pane when the connect-key state coincides with an
// uncommitted change, so the change stays visible rather than being silently dropped.
providerCredentialsSection,
Comment thread
coderabbitai[bot] marked this conversation as resolved.
// A model is selected but the chosen harness can't run it — a *model* problem (the harness
// itself stays valid), so the config panel flags the Model & harness section as invalid.
modelUnsupported: !!modelId && !selectedKeepsModel,
Expand Down
Loading