fix(desktop): persist Edit Agent provider/model edits for linked personas (#4157) - #4268
Open
iroiro147 wants to merge 1 commit into
Open
fix(desktop): persist Edit Agent provider/model edits for linked personas (#4157)#4268iroiro147 wants to merge 1 commit into
iroiro147 wants to merge 1 commit into
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
For linked built-in personas (e.g. Honey, Bumble), the Edit Agent dialog drops
provider/model/systemPromptfrom 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.handleSubmitsendsprovider: undefinedandmodel: undefinedwheneverlinkedPersona != 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 inresolve_linked(effective_config/mod.rs:74-109) falls back to global defaults.Fix
computeLinkedPersonaProviderModelPatch()(new pure helper inpersonaRuntimeModel.ts) — returns the subset of{provider, model}that differs from the persona definition, ornullwhen nothing changed. Empty/whitespace local values never propagate; linked-write fires only for linked personas.handleSubmitwiring — after the instance mutation succeeds, callsuseUpdatePersonaMutationwith the patch (spread intoUpdatePersonaInputwith the persona's existingdisplayNameandsystemPromptpreserved) whenlinkedPersona != nulland 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.cargo check --libondesktop/src-tauriclean.Refs #4157