Repository navigation
feat(social): answer a friend's Bot in the group that calls it (#825) - #836
Merged
Merged
Conversation
A @mention of a friend's Bot in a group used to leave the group and land in that Bot's own chat, so the group never heard its answer. The room line now carries the handles it calls and the hop it is at; the friend's FlyBot opens one turn for the Bot the line names, and the answer comes back as a line of the same room. The hop cap (3 by default) and one answer per line keep two Bots from calling each other forever.
Collaborator
Author
|
Verdict: PASS at 6071242 Ran:
What I checked:
Notes (non-blocking, not merge-gate items):
|
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.
Fixes #825
Written-by: Dev3
Tip SHA: 6071242
Reproduce
Before this change, a line that named a friend's Bot in a group never came back into that group:
fanoutRoomLine(core/src/host/room-membership.js) sent anop: 'line'envelope with nocallsand nohop, so the receiving home could not know which of its Bots the line named.applyInboundRoomShareappended that line as a bubble and started nothing: the projected room had nort.startInboundTurn, so no turn ever ran for the named Bot.fanoutRoomLine(room.origin === 'inbound-share'), so even a turn started there had no way back to the group it mirrors.hooks.jspostedsent — its replies appear in its own chat, not in this groupfor every successful mention, which is what a user saw instead of an answer.The new tests in
core/test/remote-room.test.jsfail on all four points; see Red without the source change.What changed
core/src/shared/room-share.js: the envelope carrieshop(0–99) andcalls(up to 24 handles), validated on both write and read.core/src/host/room-membership.js:fanoutRoomLineputscalls: callsIn(room, line.text)andhopon every line it sends: a person's line is hop 0, a local Bot's line is one hop on.origin: 'inbound-share') goes back to the inviter who shared it, as anop: 'line'envelope under theirroomId, one hop on, carrying the calls it makes. An answer the other side's owner holds or refuses produces onenoticeline in the room (held for approval/rejected by its owner) instead of silence.applyInboundRoomSharekeeps only the calls that name this room's own Bot (localCalls, matched on the room'sinvitedHandleand local Bots, never by reading@out of the text), opens one turn per call throughrt.startInboundTurn, and skips it when the line's hop has reachedroom.maxHops(DEFAULT_MAX_HOPS = 3) or when the sameremoteRoomId:seq:botIdwas already answered (last 200 keys inroom.answered).recordInboundSharedRoomstoresmaxHops.core/src/host/groups.js:rt.startInboundTurnopens the participant session, runs one turn (participant.runTurn) with the remote line quoted and fenced as data, and appends the answer as an ordinary room line, which is what sends it back.appendRoomstamps each line through astampRoomLineseam wired ininstall()(same pattern asfanoutRoomLine), so a top-level helper never reaches forrt.core/src/host/hooks.js:mentionReceiptno longer posts the "sent" line; deny/hold receipts stay.docs/subsystems/core-host.md(the shared-room bullet and the mention-receipt bullet),docs/subsystems/plugin-runtime.md(bullet 8), andchangelog.d/825-group-mention-answers.added.md.patches/ds-bot/fromcore/(node scripts/ds-bot-patches.mjs generate).What I ran
At the tip, in
core/:The 1294/1294 run needs
gitonPATHand arefs/remotes/origin/mainref; withoutgitthe onecheck-arch-docs.test.jscase fails withcannot diff against HEAD, which is the test bench, not the change (it passes 5/5 withgitpresent).Red without the source change
Four controls, each applied alone to the tip and reverted (44/44 green again after each revert):
calls: callsIn(...)from the line envelope#825: a line carries the calls it makes…fails (deepEqualgetsundefined); 43 pass / 1 failrt.startInboundTurncall inapplyInboundRoomShare#825: a called Bot in a projected room gets one turn per line…fails (0 !== 1); 43/1hop >= 0)3 !== 2); 43/1room.answereddedupe2 !== 1); 43/1The
hooks.jshalf is pinned by the updatedcore/test/flybot.test.js: with the success receipt back, the test would wait 2 s for a receipt that must no longer appear.Not run
dev/bench.sh smoke(needs a bench checkout and a port; the change is insrc/host/), and the plugin suites (plugins/*untouched).applyInboundRoomShare/fanoutRoomLineagainst the mock model, not two live homes.Risk
(roomId, seq, botId)key bound the chain, but a room withmaxHopsraised answers further.applyInboundRoomSharewithout awaiting it, so a slow model does not hold up the envelope; a failure is logged as a host warning instead of reaching the group.hold/deny), and remote text stays insidefencedUntrusted.room.answeredand the envelope'scallslist are bounded (200 keys, 24 handles); a line naming more than 24 Bots only calls the first 24.