feat(desktop): re-snapshot persona config on every agent spawn#1268
Merged
Conversation
When an agent linked to a persona is spawned (or auto-restored on launch), the persona's current system_prompt, model, provider, env_vars, and source_version hash are written back onto the agent record before the process starts. This clears the "OUT OF DATE" drift badge without requiring a delete+recreate cycle. Two spawn paths are covered: - Interactive spawn (start_local_agent_with_preflight): re-snapshots before start_managed_agent_process and queues a relay publish via retain_managed_agent_pending so the updated record propagates. - Auto-restore on launch (restore_managed_agents_on_launch Phase A): re-snapshots all agents in the to_start set before Phase B spawns them, and re-collects to_start from the mutated records so Phase B sees the refreshed config. Agent-level env_vars overrides still win — persona_snapshot layers persona env under agent overrides, matching the create-time contract. Also updates the "OUT OF DATE" badge tooltip to remove the now-stale instruction to delete the agent before respawning. Co-authored-by: Will Pfleger <pfleger.will@gmail.com> Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
762011b to
d56ce4e
Compare
Biome reformatted the warning text line break in ManagedAgentRow.tsx. Bumped the agents.rs file-size override from 1350 to 1380 to account for the ~23 lines added by the persona re-snapshot path. Co-authored-by: Will Pfleger <pfleger.will@gmail.com> Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
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.
Summary
When an agent linked to a persona is spawned (or auto-restored on launch), the persona's current
system_prompt,model,provider,env_vars, andpersona_source_versionhash are written back onto the agent record before the process starts. This clears the "OUT OF DATE" drift badge without requiring a delete+recreate cycle.Changes
commands/agents.rs— Instart_local_agent_with_preflight, before callingstart_managed_agent_process, re-snapshot the persona onto the mutable record. Aftersave_managed_agents, callretain_managed_agent_pendingto queue a relay publish of the updated record.managed_agents/restore.rs— Inrestore_managed_agents_on_launchPhase A, after buildingto_start, re-snapshot all persona-linked agents in that set. Setchanged = trueso the refreshed records are persisted. Re-collectto_startfrom the mutatedrecordsslice so Phase B spawns the refreshed config.ManagedAgentRow.tsx— Update the "OUT OF DATE" badge tooltip to remove the now-stale instruction to delete the agent before respawning.Behavior
env_varsoverrides still win —persona_snapshotlayers persona env under agent overrides, matching the create-time contract.persona_idare unaffected.Acceptance Criteria
persona_source_versionon the agent record matches the current persona hash after spawncargo checkpasses clean