Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions desktop/scripts/check-file-sizes.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,17 @@ const overrides = new Map([
// config-bridge: get_agent_config_surface/write_agent_config_field/put_agent_session_config
// commands add ~40 lines. Queued to split.
// branch cut; override bumped to cover the merged total. Queued to split.
// persona-blank-fallback: persona_snapshot_with_agent_config_fallback call
// sites add ~4 lines (extra fallback params + inline comments). build_deploy_payload
// fix (blank-persona provider/model fallback) adds ~6 lines. Bug fix.
// archive/mod_tests.rs carries the full test module for archive/mod.rs:
// unit tests + 4 real-relay integration tests (ignored, live-relay only).
// Production logic in mod.rs is now ~527 lines (under 1000). mod_tests.rs
// is test-only content; the override covers the test growth accumulated
// across the local-archive + agent-metric-archive PR series. store_tests.rs
// (~731 lines) is under 1000 so needs no override.
["src-tauri/src/archive/mod_tests.rs", 1208],
["src-tauri/src/commands/agents.rs", 1437],
["src-tauri/src/commands/agents.rs", 1443],
// #1418 read-path fix: get_thread_replies' blocker fix (shared TIMELINE_KINDS
// const + build_thread_replies_filter helper, mirroring the channel sibling so
// the two p-gate filters can't drift) plus two guard unit tests. The file was
Expand All @@ -91,7 +94,9 @@ const overrides = new Map([
// activity-feed threads avatar_url into build_managed_agent_summary for the
// assistant-bubble pinned snapshot.
// +1 for agent_pubkey field in setup payload (config-nudge card wire).
["src-tauri/src/managed_agents/runtime.rs", 2208],
// persona-blank-fallback: resolve_effective_prompt_model_provider gains a
// record_provider param + applies persona_field_with_record_fallback. +5 lines.
["src-tauri/src/managed_agents/runtime.rs", 2213],
// config-bridge setup-payload env-boundary fix adds readiness wiring in
// spawn_agent_child; load-bearing security fix, queued to split.
["src-tauri/src/managed_agents/config_bridge/reader.rs", 1016],
Expand Down
1 change: 1 addition & 0 deletions desktop/src-tauri/src/commands/agent_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ fn resolve_config_surface(
personas,
record.system_prompt.clone(),
record.model.clone(),
record.provider.clone(),
);

// Build the baseline the reader overrides a live model against, paired with
Expand Down
25 changes: 17 additions & 8 deletions desktop/src-tauri/src/commands/agents.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,12 +258,19 @@ async fn start_local_agent_with_preflight(
// starts with the current persona config (system_prompt, model, provider,
// env_vars). This clears the "out of date" drift badge without requiring a
// delete+recreate. Agent-level env_vars overrides still win (persona_snapshot
// layers persona env under agent overrides).
// layers persona env under agent overrides). When the persona leaves model or
// provider blank, the agent record's own configured values are preserved so a
// user-set model/provider is never clobbered by an unconfigured persona.
if let Some(persona_id) = record.persona_id.clone() {
let personas = load_personas(app).unwrap_or_default();
if let Some(persona) = personas.iter().find(|p| p.id == persona_id) {
let snapshot =
crate::managed_agents::persona_events::persona_snapshot(persona, &record.env_vars);
crate::managed_agents::persona_events::persona_snapshot_with_agent_config_fallback(
persona,
&record.env_vars,
record.model.as_deref(), // fallback: record.model
record.provider.as_deref(), // fallback: record.provider
);
if let Some(prompt) = snapshot.system_prompt {
record.system_prompt = Some(prompt);
}
Expand Down Expand Up @@ -330,9 +337,10 @@ fn build_deploy_payload(
// stale derived env copies in `env_vars` (or have no provider at all for
// imported personas whose derived keys were filtered at import time).
//
// Precedence mirrors local spawn: persona structured model is authoritative
// when present; the agent record's `model` is a fallback for personas that
// don't specify one (or when no persona is linked).
// Precedence: persona field wins when non-blank; otherwise falls back to the
// record's own field (same blank-normalization as the snapshot path). This
// matches `persona_snapshot_with_agent_config_fallback` exactly — a blank
// persona field must not wipe a record value that the user configured.
let (effective_model, effective_provider) = if let Some(pid) = record.persona_id.as_deref() {
let personas = load_personas(app).map_err(|e| {
format!(
Expand All @@ -343,11 +351,12 @@ fn build_deploy_payload(
.into_iter()
.find(|p| p.id == pid)
.ok_or_else(|| format!("persona `{pid}` not found while building deploy payload"))?;
let model = persona.model.clone().or(record.model.clone());
let provider = persona.provider;
let fallback = crate::managed_agents::persona_events::persona_field_with_record_fallback;
let model = fallback(persona.model.as_deref(), record.model.as_deref()); // fallback: record.model
let provider = fallback(persona.provider.as_deref(), record.provider.as_deref()); // fallback: record.provider
(model, provider)
} else {
(record.model.clone(), None)
(record.model.clone(), record.provider.clone())
};

Ok(serde_json::json!({
Expand Down
Loading
Loading