Skip to content

fix(desktop): adopt matching folded agent definitions#2727

Open
brainx wants to merge 1 commit into
block:mainfrom
brainx:agent/adopt-folded-agent-definitions
Open

fix(desktop): adopt matching folded agent definitions#2727
brainx wants to merge 1 commit into
block:mainfrom
brainx:agent/adopt-folded-agent-definitions

Conversation

@brainx

@brainx brainx commented Jul 24, 2026

Copy link
Copy Markdown

Summary

  • adopt a unique compatible folded definition before the standalone-agent backfill manufactures a new one
  • preserve instance-specific runtime, environment, avatar, and behavior settings while rejecting ambiguous or behavior-changing matches
  • canonicalize Databricks provider/model data before matching so source hashes reflect final records

Verification

  • just ci
  • cargo 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

Signed-off-by: brainx <12695242+brainx@users.noreply.github.com>
@brainx
brainx marked this pull request as ready for review July 24, 2026 16:53
@brainx
brainx requested a review from a team as a code owner July 24, 2026 16:53

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +160 to +161
&& snapshot_field_matches(definition.model.as_deref(), record.model.as_deref())
&& snapshot_field_matches(definition.provider.as_deref(), record.provider.as_deref())

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

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