From 73eab83ea5619b2999a57c06b8be40ed40c93568 Mon Sep 17 00:00:00 2001 From: npub1223z34hd7vtwc6qj4s7flsxkj644nlre2nthu7lrrmkumhu3xddsrx9r6w <52a228d6edf316ec6812ac3c9fc0d696ab59fc7954d77e7be31eedcddf91335b@sprout-oss.stage.blox.sqprod.co> Date: Fri, 26 Jun 2026 14:17:21 -0700 Subject: [PATCH] docs(agents): sharpen provider-source comment per rust create-path trace Co-authored-by: Taylor Ho Signed-off-by: Taylor Ho --- .../agents/ui/personaDialogState.test.mjs | 4 ++-- .../src/features/agents/ui/personaDialogState.ts | 15 +++++++++------ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/desktop/src/features/agents/ui/personaDialogState.test.mjs b/desktop/src/features/agents/ui/personaDialogState.test.mjs index f476ac829..1f9817013 100644 --- a/desktop/src/features/agents/ui/personaDialogState.test.mjs +++ b/desktop/src/features/agents/ui/personaDialogState.test.mjs @@ -349,8 +349,8 @@ test("saveAsPersonaTemplateDialogState carries name, prompt, model, and envVars" test("saveAsPersonaTemplateDialogState carries the provider id from a provider backend", () => { // A databricks/anthropic agent must promote with its provider, not lose it. - // The canonical provider source is backend.id (the create input), not the - // derived top-level ManagedAgent.provider snapshot. + // backend.id is the canonical source: top-level ManagedAgent.provider is a + // persona-pinned snapshot and is null for the persona-less agents this acts on. const state = saveAsPersonaTemplateDialogState( makeAgent({ backend: { type: "provider", id: "databricks", config: {} } }), [], diff --git a/desktop/src/features/agents/ui/personaDialogState.ts b/desktop/src/features/agents/ui/personaDialogState.ts index 190adae19..24571d519 100644 --- a/desktop/src/features/agents/ui/personaDialogState.ts +++ b/desktop/src/features/agents/ui/personaDialogState.ts @@ -94,12 +94,15 @@ function runtimeIdForAgentCommand( * Extract the LLM provider id from a managed agent's backend so it can carry * into the persona template (a databricks/anthropic agent should promote with * its provider, not lose it). The canonical provider source is the backend - * union, not the top-level `provider` field on `ManagedAgent`: that top-level - * field is a derived snapshot (output), while a `"provider"` backend carries - * the provider id that was the actual create input. A `"local"` backend has - * none. Returns `undefined` for local backends — the persona's `provider` is - * optional, so an absent provider just carries as unset (auto-detect / - * provider-locked runtime). + * union, NOT the top-level `provider` field on `ManagedAgent`. That top-level + * field is a persona-pinned snapshot: `create_managed_agent` only fills it + * from a linked persona's snapshot (commands/agents.rs), so it is `null` for + * the persona-less agents this feature acts on (`personaId === null`) — while + * `backend` always preserves the real `{ type: "provider"; id }` from the + * create input. Reading top-level `provider` here would lose the provider on + * exactly those agents. A `"local"` backend has none. Returns `undefined` for + * local backends — the persona's `provider` is optional, so an absent provider + * just carries as unset (auto-detect / provider-locked runtime). */ function providerForAgentBackend( backend: ManagedAgent["backend"],