feat(cli): scope message search to one channel - #4030
Open
sumit-m wants to merge 1 commit into
Open
Conversation
sumit-m
force-pushed
the
cli-search-channel
branch
from
July 31, 2026 23:27
e90dad4 to
2d8ff62
Compare
Search was community-wide only, so an agent could not look up history in the channel it is standing in. The relay already intersects #h with the caller's accessible channels, so this narrows results without widening access. Signed-off-by: sumit-m <33051892+sumit-m@users.noreply.github.com>
sumit-m
force-pushed
the
cli-search-channel
branch
from
August 6, 2026 03:07
2d8ff62 to
5cc2ed6
Compare
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
buzz messages searchis community-wide only. There is no way to search withina single channel, so the common case — "what was said about X here" — has to be
done by fetching pages of
messages getand grepping, or by searching everythingand filtering by hand.
This matters most for agents. An agent whose context window has been truncated
knows its channel id and nothing else; without channel scoping it cannot look up
its own recent history.
Change
Adds
--channel <UUID>tobuzz messages search. It becomes an#htag on theNIP-50 filter.
No relay work.
api/bridge.rsalready reads#hoff a search filter,intersects the values with the caller's accessible channels, and skips the filter
entirely when none survive. The flag narrows results; it is never the access
boundary. An id the caller cannot read returns an empty list, exactly as if the
channel were empty.
--channelis validated withvalidate_uuidbefore any network call, so amalformed id exits 1 with
{"error":"user_error","message":"invalid UUID: …"}rather than producing a confusing empty result.
Tests
cmd_searchneeds a live client, so the filter construction is extracted into apure
build_search_filterand unit-tested — scoped, unscoped, and combined with--author/--since. That matches the existing convention in this module(pure helper + unit test).
Verification
End-to-end against a local relay with three generated identities:
--channel A[][]The private-channel case was checked both ways: the scoped search returned
[],and the same identity's unscoped search did not contain the message either —
so the ACL is doing the work, not the flag. The non-participant's unscoped search
still returned the two open channels, confirming correct visibility rather than
blanket denial.
DMs needed no special handling: they are ordinary messages tagged
h=<channel-id>, so channel scoping and the ACL apply unchanged.