docs(agents): sharpen provider-source comment per rust create-path trace

Co-authored-by: Taylor Ho <taylorkmho@gmail.com>
Signed-off-by: Taylor Ho <taylorkmho@gmail.com>
This commit is contained in:
npub1223z34hd7vtwc6qj4s7flsxkj644nlre2nthu7lrrmkumhu3xddsrx9r6w
2026-06-26 14:17:21 -07:00
co-authored by Taylor Ho
parent 2ffed51ec5
commit 73eab83ea5
2 changed files with 11 additions and 8 deletions
@@ -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: {} } }),
[],
@@ -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"],