fix(desktop): preserve agent-set about on managed profile republish - #4267
Open
iroiro147 wants to merge 1 commit into
Open
fix(desktop): preserve agent-set about on managed profile republish#4267iroiro147 wants to merge 1 commit into
iroiro147 wants to merge 1 commit into
Conversation
`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>
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
sync_managed_agent_profilerebuilt the agent's kind:0 profile event from the managed-agent record without consulting the existing on-relay profile. Because the record has noaboutfield, the new event omittedaboutentirely — wiping any about the agent set itself viabuzz users set-profileon the same identity (#4150).Fix
Query the relay for the current kind:0 profile before building the republish event, and carry the existing
aboutforward. Record-owned fields (name,avatar) still update; agent-owned fields (about, plus any future field the agent owns) survive.AgentProfileInfowithabout: Option<String>and parse it from the kind:0 content inquery_agent_profile.build_profile_event_fullthat takes anaboutparameter and passes it through tocrate::events::build_profile.build_profile_eventas a thin wrapper (no about) so existing no-about unit tests inrelay.rskeep their shape.sync_managed_agent_profilethrough the new query + merge sequence. A failed query is non-fatal — the sync still publishes from the record (noaboutpreserved).profile_event_full_carries_about_field/ fails:Some("...")appears verbatim in the JSON.Noneis omitted (never serialized asnull, which would clobber the relay-side value).Tests
cd desktop/src-tauri && cargo test --lib --quiet→ 2089 passed, 0 failed, 14 ignored (cleanly on macOS with stubbed sidecar binaries).Refs #4150