feat(relay): relay a bot's own command output to the hub bot - #56
Merged
Conversation
A bot's own command output (e.g. a !market reply) sent into its own private group never reached the relay mesh: inc_pgmsg() (Sources/Bot.php) ignores messages the bot sends to itself to avoid feeding its own relayed output back into the command dispatcher, so Relay's privgroup()/gmsg() event handlers never fired for it - only genuine third-party chat relayed. Hook the outgoing reply path instead: output_destination() (Commodities/00_BasePassiveModule.php), the single choke point nearly every module's command reply flows through, now also calls a new Relay::relay_command_output() for PG-channel replies. It reuses the existing relay_to_bot() plumbing unchanged, so the hub and any bot already relaying (like the main bot) need no changes to receive it. Gated behind a new opt-in Relay.RelayCommandOutput setting (default off) so nothing changes until a bot explicitly turns it on.
zznathans
pushed a commit
that referenced
this pull request
Aug 4, 2026
This whole feature (relaying a bot's own command output/activity lines across the mesh, added across #56/#58, partially reverted in #60) turned out to be more scope and code-base churn than it was worth for what's actually needed. Fully removing it: - Modules/Relay.php: drop relay_command_output() and the Relay.RelayCommandOutput setting. - Modules/Ao/Market.php: announce()/announce_background() go back to their original single send_pgroup() call - local private-channel logging stays exactly as it was before any of this, just no longer relayed across bots. - Commodities/00_BasePassiveModule.php: drop the leftover explanatory comment from the #60 revert. - Tests/Stubs/FakeMarketBot.php, Tests/Stubs/FakeRelayBot.php, Tests/Modules/Ao/MarketTest.php, Tests/Modules/RelayTest.php, Tests/README.md: back to their pre-#56 state. Confirmed via `git diff` against the commit before #56 that every touched file is now byte-identical to its pre-feature state. Co-Authored-By: Claude Sonnet 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.
Summary
!marketreply) sent into its own private group never reached the relay mesh -inc_pgmsg()(Sources/Bot.php) deliberately ignores messages the bot sends to itself (anti-echo-loop guard), soRelay::privgroup()/gmsg()never saw it as an event to act on. Only genuine third-party chat relayed.output_destination()(Commodities/00_BasePassiveModule.php), the single choke point nearly every module's command reply flows through, now also calls a newRelay::relay_command_output()forPG-channel replies.relay_to_bot()plumbing unchanged, so bots already relaying (like the main/hub bot) need zero changes to start receiving this - it arrives exactly like relayed chat does today.Relay.RelayCommandOutputsetting (defaultfalse) - existing behavior is unchanged until a bot explicitly turns it on via!settings relay relaycommandoutput on.Test plan
php -llint matrix + PHPUnit unit-test matrix + docs-check (Tests/README.mdhand-updated to matchgenerate-readme.php's expected output, no local PHP binary available to run it directly)Relay.RelayCommandOutputon a spoke bot, run a command like!market <search>inside its own private group, confirm the output also shows up relayed on the main/hub bot🤖 Generated with Claude Code