Skip to content

fix(cli): preserve agent profile fields when setting policy - #4492

Open
xianjianlf2 wants to merge 3 commits into
block:mainfrom
xianjianlf2:fix/preserve-agent-profile-fields-4490
Open

xianjianlf2 wants to merge 3 commits into
block:mainfrom
xianjianlf2:fix/preserve-agent-profile-fields-4490

Conversation

@xianjianlf2

Copy link
Copy Markdown

Closes #4490

What changed

  • Read the current kind:10100 agent profile before updating the channel-add policy.
  • Preserve existing profile fields such as name and respond_to while replacing channel_add_policy.
  • Return a clear error for malformed or non-object profile content.
  • Add a regression test for field preservation.

Validation

  • cargo fmt --all
  • cargo test -p buzz-cli set_add_policy

Signed-off-by: MarkXian <mark-xian@foxmail.com>
@xianjianlf2
xianjianlf2 requested a review from a team as a code owner August 3, 2026 08:18
@Chessing234

Copy link
Copy Markdown
Contributor

looks right — read-merge-write on kind:10100 so set-add-policy keeps name/respond_to. one nit: if prior content is valid json but not an object, you hard-error; maybe worth a short note in the pr body so ops aren't surprised.

@xianjianlf2

Copy link
Copy Markdown
Author

Updated this branch with current main and resolved the channels.rs merge conflict while preserving the kind:10100 profile carry-forward behavior.\n\nValidation run locally:\n- cargo fmt --check\n- cargo test -p buzz-cli channels\n\nAlso noting the maintainer nit: the current behavior intentionally errors if an existing kind:10100 profile is valid JSON but not an object, because there is no safe object field to preserve/update in that case.

…ofile-fields-4490

Signed-off-by: MarkXian <mark-xian@foxmail.com>

# Conflicts:
#	crates/buzz-cli/src/commands/channels.rs
@xianjianlf2
xianjianlf2 force-pushed the fix/preserve-agent-profile-fields-4490 branch from b13afc8 to f503f68 Compare August 11, 2026 06:54
@xianjianlf2

Copy link
Copy Markdown
Author

Follow-up: amended the merge commit with the required DCO signoff and force-pushed with --force-with-lease. DCO is now passing on head f503f68.

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

This fixes the current field-clobbering bug cleanly. The command now preserves the existing profile object, changes only channel_add_policy and fails closed on malformed content.

I checked exact head f503f68. All five focused tests, strict buzz-cli Clippy, formatting and the diff check pass.

This is worth landing as the narrow fix for #4490. It does not remove the concurrent two-writer race discussed on #5546, so that review still stands.

@xianjianlf2

Copy link
Copy Markdown
Author

Resolved conflicts against upstream main.

Validation:

  • cargo test -p buzz-cli commands::channels::tests (60 passed)
  • cargo fmt --check
  • git diff --check

Current head: 27dda20

@github-actions

github-actions Bot commented Aug 29, 2026

Copy link
Copy Markdown

🔐 Codex Security Review

Status: review required for the current range.

The current range is 00e61eafa917d296104006576b7a2ddbfd58bb5a...5cf7608c5570ea797bb7f4ad9c234fd67ede0ba2.
A new review must complete for this exact range. When manual authorization
is required, a Block organization member must comment exactly
@buzz-security-review 5cf7608c5570ea797bb7f4ad9c234fd67ede0ba2 to authorize a new review.
Any previous review applies only to its recorded range.

…profile-fields-4490

Signed-off-by: MarkXian <mark-xian@foxmail.com>

# Conflicts:
#	crates/buzz-cli/src/commands/channels.rs
@xianjianlf2
xianjianlf2 force-pushed the fix/preserve-agent-profile-fields-4490 branch from 27dda20 to 5cf7608 Compare August 29, 2026 07:00
@xianjianlf2

Copy link
Copy Markdown
Author

Amended the merge commit with DCO signoff.

Current head: 5cf7608

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.

buzz channels set-add-policy replaces the caller's whole kind:10100 agent profile, erasing name and respond_to

3 participants