Skip to content

fix: re-read persona system_prompt at spawn time for non-pack agents#729

Draft
tellaho wants to merge 1 commit into
mainfrom
fix/persona-reread-on-spawn
Draft

fix: re-read persona system_prompt at spawn time for non-pack agents#729
tellaho wants to merge 1 commit into
mainfrom
fix/persona-reread-on-spawn

Conversation

@tellaho
Copy link
Copy Markdown
Collaborator

@tellaho tellaho commented May 22, 2026

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 via load_personas(), but non-pack persona-linked agents were gated behind has_persona_pack.

Fix

Removed the has_persona_pack gate in spawn_agent_child() so the persona re-read fires whenever record.persona_id is set. Falls back to record.system_prompt only 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 lines
  • No schema migrations, no new deps, no frontend changes

Testing

  • cargo check
  • cargo test --lib managed_agents::runtime ✅ (11/11)
  • rustfmt --check

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.
@tellaho tellaho requested a review from a team as a code owner May 22, 2026 23:56
@tellaho tellaho marked this pull request as draft May 23, 2026 00:09
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