Desktop: stop auto-healing agent kind:0 on start and restore#1339
Open
tlongwell-block wants to merge 1 commit into
Open
Desktop: stop auto-healing agent kind:0 on start and restore#1339tlongwell-block wants to merge 1 commit into
tlongwell-block wants to merge 1 commit into
Conversation
The desktop record was the authority for an agent's avatar: on every agent start and on app-launch restore, a fire-and-forget task called reconcile_agent_profile, which recomputed the avatar from the local ManagedAgentRecord and republished kind:0 whenever it diverged from the relay. That healed a self-set avatar back to the device default — the one identity field desktop still overwrote without an explicit user action. Remove the two non-explicit kind:0 writers (the start-path spawn in start_managed_agent and the restore loop in restore_managed_agents). Desktop now publishes kind:0 only on explicit user action — agent creation and rename/model-edit save, both of which call sync_managed_agent_profile directly and are untouched. With both call sites gone, the reconcile chain is orphaned, so it is deleted rather than left as dead code: reconcile_agent_profile, resolve_legacy_avatar, profile_needs_sync, the ProfileReconcileData struct, and the now-unused relay helpers query_agent_profile / AgentProfileInfo, plus their unit tests. One behavior change: reconcile_agent_profile also performed a one-shot legacy-avatar backfill for pre-PR-921 records with no stored avatar_url. That backfill was coupled to the unwanted background healer; preserving it would reintroduce an implicit background kind:0 writer. A legacy agent now backfills on the next explicit edit-save instead of silently on start. No relay changes. Agent signing keys remain in the keyring. Co-authored-by: Tyler Longwell <tlongwell@block.xyz> Signed-off-by: Tyler Longwell <tlongwell@block.xyz>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The desktop local record was the authority for an agent's avatar. On every agent start (
start_managed_agent) and on app-launch restore (restore_managed_agents), a fire-and-forget task calledreconcile_agent_profile, which recomputed the avatar from the localManagedAgentRecordand republishedkind:0whenever it diverged from the relay.That healed a self-set avatar back to the device default — the one identity field desktop still overwrote without an explicit user action.
Change
Remove the two non-explicit
kind:0writers:start_managed_agent(commands/agents.rs)restore_managed_agents(managed_agents/restore.rs)Desktop now publishes
kind:0only on explicit user action — agent creation and rename/model-edit save, both of which callsync_managed_agent_profiledirectly and are untouched.With both call sites gone, the reconcile chain is orphaned, so it's deleted rather than left as dead code (clippy
-D warningswould reject it anyway):reconcile_agent_profile,resolve_legacy_avatar,profile_needs_sync, theProfileReconcileDatastruct, the now-unused relay helpersquery_agent_profile/AgentProfileInfo, and their unit tests.Behavior change to note
reconcile_agent_profilealso performed a one-shot legacy-avatar backfill for pre-PR-921 records with no storedavatar_url. That backfill was coupled to the unwanted background healer; preserving it would reintroduce an implicit backgroundkind:0writer — exactly what this removes. A legacy agent now backfills on the next explicit edit-save instead of silently on start.Scope
Validation
cargo test --lib(desktop): 718 passed, 0 failed.cargo clippy --lib --all-targets -- -D warnings: clean for all touched files. One pre-existingmanual-containslint fires atmanaged_agents/runtime.rs:67(unmodified by this PR, surfaced by clippy 1.95.0) — out of scope here.cargo build(desktop) compiles; pre-commit/pre-push hooks (fmt, rust/desktop/mobile tests) green.🤖 Plan validated and implementation reviewed by Max.