fix(buzz-acp): curated default kind list for SubscribeMode::All - #4091
Open
iroiro147 wants to merge 1 commit into
Open
fix(buzz-acp): curated default kind list for SubscribeMode::All#4091iroiro147 wants to merge 1 commit into
iroiro147 wants to merge 1 commit into
Conversation
In All mode with no BUZZ_ACP_KINDS override, the ACP harness subscribed
with a true wildcard (kinds: None). Any sibling agents sharing a channel
then woke on each other's bookkeeping traffic — kind 7 (reactions,
including the harness's own 👀/💬 lifecycle markers) and kind 5
(NIP-09 deletions) — and stormed on each other's wake events, burning
tokens and flooding the channel with turns nobody asked for.
When kinds_override is None, both resolve_channel_filters() and
resolve_dynamic_channel_filter() now install the same curated default
kind list:
[9, 40002, 40003, 1059, 40007, 40100, 46010, 46020]
i.e. stream chat (v1/v2/edit), gift-wrapped DMs, stream reminders,
canvas, workflow approval requests, and workflow triggers — every kind
an agent legitimately needs to wake on. Kinds 5 (NIP-09 deletion) and
7 (reaction) are excluded: they are harness bookkeeping, not user
intent.
Users who genuinely want the old wildcard can still set
BUZZ_ACP_KINDS explicitly including 5 and 7; the override remains
authoritative.
Tests updated:
- test_all_mode_wildcard now asserts the curated list (and asserts it
excludes kinds 5 and 7).
- New test_all_mode_dynamic_channel_matches_static locks the dynamic
(instant-join) resolver to the same defaults as the bootstrap
resolver, so instantly-joined channels behave identically to
bootstrapped ones.
- test_all_mode_with_kinds_override still passes unchanged.
Fixes block#4086.
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
In
SubscribeMode::All, when the operator does not set aBUZZ_ACP_KINDSoverride, the ACP harness opens each channel subscription with a true wildcard (kinds: None) — seeresolve_channel_filters()andresolve_dynamic_channel_filter().A wildcard subscription means every sibling agent sharing a channel wakes on every event in it — including pure harness bookkeeping:
👀(REACTION_SEEN) /💬(REACTION_WORKING) lifecycle markers, andTwo or more agents in the same channel then mutually wake on each other's bookkeeping, storm indefinitely, burn tokens, and flood the channel with turns no user asked for. Reported in #4086 with a repro.
Fix (issue's option 3 — curated default with escape hatch)
When
kinds_overrideisNone, both resolvers now install the same curated default kind list instead of a wildcard:KIND_STREAM_MESSAGEKIND_STREAM_MESSAGE_V2KIND_STREAM_MESSAGE_EDITKIND_GIFT_WRAPKIND_STREAM_REMINDERKIND_CANVASKIND_WORKFLOW_APPROVAL_REQUESTEDKIND_WORKFLOW_TRIGGERKinds 5 (NIP-09 deletion) and 7 (reaction) are deliberately excluded — they are harness bookkeeping, not user intent.
This exactly matches the reporter's verified workaround list from the issue discussion and is applied identically in both
resolve_channel_filters()(bootstrap path) andresolve_dynamic_channel_filter()(instant-join path) so instantly-joined channels behave identically to bootstrapped ones.Escape hatch preserved: setting
BUZZ_ACP_KINDSexplicitly (including5and7) still takes effect unchanged; the override remains authoritative.Tests
test_all_mode_wildcard— updated: now asserts the curatedSome(kinds)and asserts it excludesKIND_DELETIONandKIND_REACTION.test_all_mode_dynamic_channel_matches_static— new lockstep test: dynamic join resolver must emit identical kinds/require_mention as the bootstrap resolver.test_all_mode_with_kinds_override— unchanged, still passes (overrideSome([9, 7])flows through untouched).Verification
Fixes #4086.