fix: re-read persona system_prompt at spawn time for non-pack agents#729
Draft
tellaho wants to merge 1 commit into
Draft
fix: re-read persona system_prompt at spawn time for non-pack agents#729tellaho wants to merge 1 commit into
tellaho wants to merge 1 commit into
Conversation
Previously, the persona re-read in spawn_agent_child() was gated behind has_persona_pack (requiring both persona_pack_path and persona_name_in_pack). Non-pack persona-linked agents fell through to the stale record.system_prompt snapshot from creation time. Now, when record.persona_id is set, we always re-read the PersonaRecord from personas.json at spawn time. Falls back to the record snapshot only when no persona is linked or the persona can't be found. Fixes: editing a persona's instructions now takes effect on the next agent spawn without needing to delete and recreate the agent.
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
Editing a persona's system prompt had no effect on existing agents — even after respawn — because non-pack agents used a stale snapshot from creation time (
record.system_prompt). Pack agents already re-read fresh instructions viaload_personas(), but non-pack persona-linked agents were gated behindhas_persona_pack.Fix
Removed the
has_persona_packgate inspawn_agent_child()so the persona re-read fires wheneverrecord.persona_idis set. Falls back torecord.system_promptonly when there's no linked persona or the persona can't be found.Covers all three spawn paths (manual start, respawn, app-launch restore) since they all flow through
spawn_agent_child().Changes
desktop/src-tauri/src/managed_agents/runtime.rs: net -5 linesTesting
cargo check✅cargo test --lib managed_agents::runtime✅ (11/11)rustfmt --check✅