Skip to content

fix(desktop): preserve agent-set about on managed profile republish - #4267

Open
iroiro147 wants to merge 1 commit into
block:mainfrom
iroiro147:fix/4150-preserve-about
Open

fix(desktop): preserve agent-set about on managed profile republish#4267
iroiro147 wants to merge 1 commit into
block:mainfrom
iroiro147:fix/4150-preserve-about

Conversation

@iroiro147

Copy link
Copy Markdown

Problem

sync_managed_agent_profile rebuilt the agent's kind:0 profile event from the managed-agent record without consulting the existing on-relay profile. Because the record has no about field, the new event omitted about entirely — wiping any about the agent set itself via buzz users set-profile on the same identity (#4150).

Fix

Query the relay for the current kind:0 profile before building the republish event, and carry the existing about forward. Record-owned fields (name, avatar) still update; agent-owned fields (about, plus any future field the agent owns) survive.

  • Extend AgentProfileInfo with about: Option<String> and parse it from the kind:0 content in query_agent_profile.
  • Add build_profile_event_full that takes an about parameter and passes it through to crate::events::build_profile.
  • Keep build_profile_event as a thin wrapper (no about) so existing no-about unit tests in relay.rs keep their shape.
  • Route sync_managed_agent_profile through the new query + merge sequence. A failed query is non-fatal — the sync still publishes from the record (no about preserved).
  • New unit test profile_event_full_carries_about_field / fails:
    • Some("...") appears verbatim in the JSON.
    • None is omitted (never serialized as null, which would clobber the relay-side value).

Tests

cd desktop/src-tauri && cargo test --lib --quiet2089 passed, 0 failed, 14 ignored (cleanly on macOS with stubbed sidecar binaries).

Refs #4150

`sync_managed_agent_profile` used to build a fresh kind:0 profile event
from the managed-agent record without consulting the existing on-relay
profile. Because the record has no `about` field, the new event omitted
`about` entirely — clobbering any about the agent set itself via
`buzz users set-profile` on the same identity.

Query the relay for the current kind:0 profile before building the
republish event, and carry the existing `about` forward so record-owned
fields (`name`, `avatar`) still update but agent-owned fields survive.

- Extend `AgentProfileInfo` with `about: Option<String>` and parse it
  from the kind:0 content in `query_agent_profile`.
- Add `build_profile_event_full` that takes an `about` parameter and
  passes it through to `crate::events::build_profile`.
- Keep `build_profile_event` as a thin wrapper (no about) for the
  existing unit tests that exercise the no-about path.
- Route `sync_managed_agent_profile` through the new query + merge
  sequence. A failed query is non-fatal — fall through with no merge.
- New unit test `profile_event_full_carries_about_field` verifies the
  `Some(about)` case is included verbatim and the `None` case is omitted
  entirely (so a null does not clobber the relay-side value).

Refs block#4150

Signed-off-by: Sarthak Singh <sarthak.singh@juspay.in>
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