feat(send): --all broadcast and comma-separated recipients#364
Open
kzv8wznnj4-cloud wants to merge 3 commits into
Open
feat(send): --all broadcast and comma-separated recipients#364kzv8wznnj4-cloud wants to merge 3 commits into
kzv8wznnj4-cloud wants to merge 3 commits into
Conversation
<to> now accepts --all (alias @ALL) to fan out to every team member except the sender, and alice,bob comma lists. The fan-out is a single multi-row INSERT so a broadcast is atomic. Single-recipient calls are byte-for-byte unchanged. Closes the long-standing ask in fujibee#25/fujibee#26. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
What
Extends
<to>insend.sh <team> <from> <to> <message>to support multiplerecipients and broadcast:
--all(alias@all) — deliver to every team member except the senderalice,bob— comma-separated multiple recipients (spaces after commas aretolerated, empty entries are skipped)
Why
Broadcasting to a whole team (leader → all members) is a common need, but
previously required calling
send.shonce per recipient. This addresses thelong-standing requests in #25 / #26.
How
--all/@all: enumeratesagentsfrom the team config(
teams/<team>/config.json) via sqlite3'sjson_each, excluding thesender, to build the recipient set.
agmsg_validate_team_name(
lib/validate.sh), rejecting path fragments that would escapeteams/(Team names can escape teams/ via path traversal #140).tr -d '\r': works around Windowssqlite3.exeemitting CRLF-terminatedrows (same class of issue as team.sh: CRLF in sqlite3 row output breaks member-count arithmetic on Windows (Git Bash) #130).
IFS=',' read -r -a, then eachrecipient is trimmed of surrounding whitespace and empty entries are
dropped, so
alice, bob,alice,,bob, andalice,all resolve cleanly.If every entry is empty the call fails with
Missing to agent.(some recipients get the message, others don't) can't happen if one row
fails mid-way.
_agmsg_sqlesc(no new SQL-injection surface introduced).Breaking changes
None. Single-recipient invocations produce byte-identical stdout and DB
writes to before this change; no new required flags, no changed defaults.
Tests
Added 9 cases to
tests/test_messaging.batscovering broadcast (--alland@all), team-not-found and sole-member failure modes, comma-separatedrecipients, space tolerance after commas, skipping empty middle/trailing
entries, and single-recipient backward compatibility.
Behaviour was also verified functionally end-to-end against an isolated store
(
AGMSG_STORAGE_PATH):alice, bob/alice,,bob/alice,all deliver tothe intended recipients,
, ,fails withMissing to agent, and@all/--allbroadcast to every member except the sender (a sole-member team failswith
No recipients).Compatibility
issue).