fix(desktop): adopt matching folded agent definitions#2727
Conversation
Signed-off-by: brainx <12695242+brainx@users.noreply.github.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 57b84eec93
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| && snapshot_field_matches(definition.model.as_deref(), record.model.as_deref()) | ||
| && snapshot_field_matches(definition.provider.as_deref(), record.provider.as_deref()) |
There was a problem hiding this comment.
Preserve record-only model/provider before linking
When a folded definition has a blank/absent model or provider but the standalone record has one, this wildcard match links the record without manufacturing a definition that contains those record-only values. After persona_id is set, agent_event_content omits model/provider for every definition-linked 30177 event (desktop/src-tauri/src/managed_agents/agent_events.rs:70-96), so the next event sync or restore on another device resolves through the incomplete definition and loses the agent's configured model/provider. Require the definition to carry the same non-empty fields, or copy the record values into a definition, before slimming the record.
Useful? React with 👍 / 👎.
Summary
Verification
just cicargo test --manifest-path desktop/src-tauri/Cargo.toml --lib migration::backfill::tests -- --nocapture(18 passed)cargo test --manifest-path desktop/src-tauri/Cargo.toml --lib migration::databricks_tests -- --nocapture(11 passed)Scope
This prevents duplicate definitions when untouched pre-fold stores are upgraded. It deliberately does not garbage-collect or relink stores that already contain both manufactured and folded definitions, because those records may be intentionally distinct.
Addresses #1725