Skip to content

fix(desktop): persist Edit Agent provider/model edits for linked personas (#4157) - #4268

Open
iroiro147 wants to merge 1 commit into
block:mainfrom
iroiro147:fix/4157-linked-builtin-provider
Open

fix(desktop): persist Edit Agent provider/model edits for linked personas (#4157)#4268
iroiro147 wants to merge 1 commit into
block:mainfrom
iroiro147:fix/4157-linked-builtin-provider

Conversation

@iroiro147

Copy link
Copy Markdown

Problem

For linked built-in personas (e.g. Honey, Bumble), the Edit Agent dialog drops provider/model/systemPrompt from the instance update because it defers those fields to the persona definition. Built-in definitions ship with provider and model unset, so the edited values are silently discarded — the agent falls back to global defaults and surfaces as "needs configuration" after restart.

Root cause

AgentInstanceEditDialog.handleSubmit sends provider: undefined and model: undefined whenever linkedPersona != null, deferring to the definition (see lines ~700-710). For built-in personas, the definition has no provider/model set, so the definition-first resolver in resolve_linked (effective_config/mod.rs:74-109) falls back to global defaults.

Fix

  1. computeLinkedPersonaProviderModelPatch() (new pure helper in personaRuntimeModel.ts) — returns the subset of {provider, model} that differs from the persona definition, or null when nothing changed. Empty/whitespace local values never propagate; linked-write fires only for linked personas.

  2. handleSubmit wiring — after the instance mutation succeeds, calls useUpdatePersonaMutation with the patch (spread into UpdatePersonaInput with the persona's existing displayName and systemPrompt preserved) when linkedPersona != null and the patch is non-null.

Unlinked instances are completely unaffected.

Tests

  • agentInstanceLinkedPersonaPatch.test.mjs — 8 tests covering: no-op (values match), whitespace-only (never null out), provider-only/model-only/both-diff patches, built-in-unset-fills-local scenario, trim behavior, and the unlinked guard.
  • All 3914 existing desktop webview tests pass.
  • cargo check --lib on desktop/src-tauri clean.

Refs #4157

…onas (block#4157)

For linked built-in definitions (e.g. Honey, Bumble), the Edit Agent
dialog drops provider/model/systemPrompt from the instance update because
it defers those fields to the persona definition. Built-in definitions
ship with provider and model unset, so the edited values were silently
discarded — the agent fell back to global defaults and surfaced as
"needs configuration" after restart.

The fix:
- computeLinkedPersonaProviderModelPatch() in personaRuntimeModel.ts
  returns the subset of {provider, model} that differs from the
  definition, or null when nothing changed.
- handleSubmit calls updatePersonaMutation with that patch (spread
  into UpdatePersonaInput with the persona's existing displayName and
  systemPrompt preserved) before the instance mutation fires.
- Guarded by linkedPersona != null so unlinked instances are unaffected.
- Empty/whitespace local values never propagate (never null out a
  persona field from the instance dialog).

Refs block#4157

Signed-off-by: Sarthak Singh <sarthak.singh@juspay.in>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant