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.
bd81f32 to
4e2ec85
Compare
There was a problem hiding this comment.
Blocking: relay-mesh preflight still does not follow the new effective-config semantics. start_local_agent_with_preflight previews apply_persona_snapshot and passes that record to ensure_relay_mesh_for_record, but apply_persona_snapshot updates provider/model without clearing or recomputing the typed record.relay_mesh. relay_mesh_config falls back to that typed field whenever the current provider is not relay-mesh. Thus, after a linked definition changes from relay-mesh to another provider, the stale relay_mesh marker still triggers mesh bootstrap and can block an otherwise non-mesh start. The launch-restore preflight has the same issue after its re-snapshot.
Conversely, a definition/global resolution that inherits relay-mesh is not reliably represented by this record-only preview (especially a blank definition falling through to the global provider), so preflight can be skipped even though spawn resolves relay-mesh and emits its env.
Please drive preflight from resolve_effective_config (including global fallback), or construct a record/config whose provider, model, and typed mesh marker all match that resolution, and add switch-away plus global-inheritance regressions for interactive start and restore.
4e2ec85 to
7da2ced
Compare
|
hey @wesbillman this should be ready for another look — both directions from your last review are addressed now. The mesh preflights (interactive start and restore-on-launch) derive their decision from |
…prompt Linked agent instances now resolve effective model/provider/prompt through a single resolver (effective_config.rs): definition -> global, never consulting stale materialized record bytes. Editing the definition reliably propagates on the next spawn/restart. Previously three divergent resolution paths (record-first local spawn, persona-first deploy, and persona_field_with_record_fallback snapshot) could disagree. This unifies them at the shared spawn_agent_child boundary so every caller (interactive start, launch restore, start_managed_agent_process) inherits orphan refusal and correct resolution. Key changes: - resolve_effective_config() is the single source for model/provider/prompt at spawn, deploy, card-summary, and both relay-mesh preflights. - Orphan guard: spawn, deploy, and mesh preflight block with a friendly error when the linked definition is missing/not synced. - Backend rejects model/provider/prompt edits on linked records; frontend omits those fields for linked instances. - spawn_config_hash digests the resolved model/provider so global default changes trip the restart badge for linked inherited agents. - relay_mesh_model_id() unifies the mesh gate across spawn and preflight, eliminating the stale record.relay_mesh marker discrepancy. - restart_eligible() predicate: orphaned instances never show "Restart required" since spawn refuses them. - Deletes dead persona_field_with_record_fallback and spawn_orphan_refusal. - Adds model_source to ManagedAgentSummary for card label (inherited vs explicit). Co-authored-by: Will Pfleger <pfleger.will@gmail.com> Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
32c2eed to
6d0afda
Compare
Summary
Introduces a single effective-config resolver that makes agent definitions authoritative for model, provider, system prompt, and relay-mesh routing on linked instances. Stale materialized record bytes are never consulted at spawn, deploy, readiness, hash, card summary, or mesh preflight.
Resolution semantics (field-specific):
None= inherit global default. Record value never consulted.resolve_effective_configresolution spawn's mesh env consults — never the record's ownprovider/model/relay_meshbytes.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_varEffectiveAgentConfig::relay_mesh_model_id()andresolve_effective_relay_mesh_model_id()added; both mesh preflights (start_local_agent_with_preflight,restore_managed_agents_on_launch) call this instead of the deletedrelay_mesh_config/relay_mesh_model_idrecord-byte sniffs and legacy env-var fallbackpersona_field_with_record_fallbackand wrapperpersona_snapshot_with_agent_config_fallbackdeleted; callers usepersona_snapshotdirectly