Skip to content

Desktop: stop auto-healing agent kind:0 on start and restore#1339

Open
tlongwell-block wants to merge 1 commit into
mainfrom
fix/desktop-stop-healing-kind0
Open

Desktop: stop auto-healing agent kind:0 on start and restore#1339
tlongwell-block wants to merge 1 commit into
mainfrom
fix/desktop-stop-healing-kind0

Conversation

@tlongwell-block

Copy link
Copy Markdown
Collaborator

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

Change

Remove the two non-explicit kind:0 writers:

  • the start-path reconcile spawn in start_managed_agent (commands/agents.rs)
  • the restore reconcile loop in restore_managed_agents (managed_agents/restore.rs)

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's deleted rather than left as dead code (clippy -D warnings would reject it anyway): reconcile_agent_profile, resolve_legacy_avatar, profile_needs_sync, the ProfileReconcileData struct, the now-unused relay helpers query_agent_profile / AgentProfileInfo, and their unit tests.

Behavior change to note

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 — exactly what this removes. A legacy agent now backfills on the next explicit edit-save instead of silently on start.

Scope

  • No relay changes. Agent signing keys remain in the keyring.
  • This is the agreed quick-fix and a strict subset of the larger relay-first identity work (Lane A): it stops desktop healing now; agent-side self-author + import/export combine land on top later.

Validation

  • cargo test --lib (desktop): 718 passed, 0 failed.
  • cargo clippy --lib --all-targets -- -D warnings: clean for all touched files. One pre-existing manual-contains lint fires at managed_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.

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>
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