fix(desktop): make agent definition authoritative for model/provider/prompt#1968
fix(desktop): make agent definition authoritative for model/provider/prompt#1968wpfleger96 wants to merge 1 commit into
Conversation
wesbillman
left a comment
There was a problem hiding this comment.
Blocking: launch restore bypasses the new orphan guard. start_local_agent_with_preflight rejects a linked record whose definition is missing, but restore_managed_agents_on_launch still collects every local start_on_app_launch record, leaves a missing definition untouched at lines 177-182, and then calls spawn_agent_child in Phase B. That spawn path collapses the orphaned model/provider resolver result to (None, None) and continues, while effective_spawn_prompt can still read the materialized record prompt. An orphan configured to start on launch can therefore run despite the PR contract that orphaned linked instances cannot spawn. Please filter/persist an actionable error before Phase B (or put the guard at the shared spawn boundary) and add a restore-path regression test.
Also, the head is currently 13 commits behind main; please rebase and rerun CI before approval.
…prompt Linked agent instances now resolve effective model/provider through definition -> global, never consulting stale materialized record bytes. This fixes the bug where changing an agent's model back to "Inherit global default" left the previously explicit model active after restart. A single pure resolver (effective_config.rs) replaces three divergent resolution paths (record-first local spawn, persona-first deploy, and persona_field_with_record_fallback snapshot). Both local spawn and deploy now agree on the same effective values. The backend rejects model/provider/prompt writes for definition-linked records, and the frontend omits them. Deletes dead persona_field_with_record_fallback and collapses persona_snapshot_with_agent_config_fallback into direct persona_snapshot calls. Blocks orphan spawn/deploy with an actionable error, enforced once at the shared spawn_agent_child boundary so every caller (interactive start, launch restore, start_managed_agent_process) inherits the refusal. Adds model_source metadata to ManagedAgentSummary so card labels distinguish inherited vs explicit. Hashes resolved model/provider in spawn_config_hash so global default changes trip the restart badge for linked inherited agents regardless of runtime model_env_var. Co-authored-by: Will Pfleger <pfleger.will@gmail.com> Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
d7d14df to
2c3dda7
Compare
Summary
Introduces a single effective-config resolver that makes agent definitions authoritative for model, provider, and system prompt on linked instances. Stale materialized record bytes are never consulted at spawn, deploy, readiness, hash, or card summary.
Resolution semantics (field-specific):
None= inherit global default. Record value never consulted.Changes:
effective_configresolver module withConfigSourcemetadata (definition,global,instance_legacy)apply_persona_snapshotno longer preserves stale record model/provider when definition is blankupdate_managed_agentblocks model/provider/prompt writes for linked recordsmodel_sourcefield added toManagedAgentSummaryso card labels distinguish inherited (Default model (X)) from explicitmodel_env_varpersona_field_with_record_fallbackand wrapperpersona_snapshot_with_agent_config_fallbackdeleted; callers usepersona_snapshotdirectly