Skip to content

fix(rooms): say why a group cannot mix a friend's Bot with an unshared Bot of mine, and offer the way out - #321

Merged
Birfy merged 1 commit into
mainfrom
fix/group-friend-granted-bots
Oct 18, 2026
Merged

Birfy merged 1 commit into
mainfrom
fix/group-friend-granted-bots

Conversation

@Birfy

@Birfy Birfy commented Oct 18, 2026

Copy link
Copy Markdown
Collaborator

A group that holds a friend's Bot (e.g. Yi's) and one of my own Bots that is not shared with that friend ends in a bare red line: "Only a Bot you granted (or one that joined with the room code) may be in a room with friends' Bots". That line says nothing about which Bot, which friend or what to do.

Root cause

room-membership.js (REMOTE_ROOM_MESSAGE, raised by applyParticipants at create, addRoomParticipant for both directions). The rule is not a leftover: a group with a friend's Bot is relayed to the friend's home. fanoutRoomLine sends the group's lines on, and the replies of every local Bot that mayShareRoom; the friend's Bot's lines come back into the room my Bots read; notifyRoomShare projects the room to their home. A local Bot with no grant to that friend would be silently cut off from them (its lines are filtered) while reading their text, and Bot Social would refuse its sends anyway (the grant lives on the server and exists only after the friend accepts an invite to that Bot). The screenshot case: the only local Bot (程序员) has no grant to Yi.

Behaviour chosen

  • Rule unchanged (grants per Bot, default deny, no room-scoped auto-grant, no team-via-groups).
  • The refusal now names the Bot(s) and friend(s) and the two ways out, and carries error.details = { reason: 'ungranted-local', bots, remotes } (channel fail forwards a plain-object details; client api.js puts it on the error).
  • New-chat shows a card instead of a dead end: Copy invite link for {Bot} (the Bot's own invite via __flybot__.social.createInvite; the friend's accept is what creates the grant, so nothing is granted by the click) and Leave {Bot} out. ZH strings added.

Verification (tip e0f074b, Node 24.21.0)

  • ARCH_DOCS_BASE=upstream/main TZ=UTC npm run verify: exit 0 (core 848, social 212, tree 56, timeline 80, interop and live-e2e green); ds-bot-patches check ok, ds-bot pristine at pin 2b10c70.
  • New tests are red at base (worktree at upstream/main + only the test files): 9 fail; green at tip.
  • Not run: smoke test, browser run of the card.

…d Bot of mine, and offer the way out

A group with a friend's Bot is projected to that friend's home (fanoutRoomLine
sends its lines and every sharing Bot's replies on; the friend's lines come
back into the room my Bots read), so a local Bot with no grant to that friend
stays refused. The refusal was a bare rule ('Only a Bot you granted ...') and a
dead end. It now names the Bot and the friend, carries details for the client,
and the new-chat screen offers the Bot's invite link or leaving it out.
Nothing is granted by the click.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-18T09:31:09.444911Z e0f074b PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e0f074b02a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +68 to +69
await navigator.clipboard?.writeText(link)
setFixNote(t('Invite link for {name} copied. Send it to your friend; once they accept, create the group again.', { name: bot.name }))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Treat an unavailable clipboard as a copy failure

In an insecure context or locked-down WebView where navigator.clipboard is undefined, optional chaining makes this await complete successfully, so the UI claims the invite link was copied even though the clipboard was unchanged. Because this card does not display the newly minted link anywhere, the user cannot send that invite; check for clipboard.writeText explicitly and show the failure or link fallback instead of the copied message.

Useful? React with 👍 / 👎.

@Birfy
Birfy added this pull request to the merge queue Oct 18, 2026
@Birfy

Birfy commented Oct 18, 2026

Copy link
Copy Markdown
Collaborator Author

Maintenance review at tip e0f074b: design-consistent (no auto-grant, per-Bot grants kept, the refusal now names the Bot/friend and offers the invite or leave-out; English UI + zh). CI green, mergeable, verify green locally on top of current main. One open item, Codex's P2 on new-chat.js:69: with no navigator.clipboard the card says "copied" while the freshly minted link is shown nowhere. Fix (one commit on top of e0f074b, fast-forward; regenerated client.js + patches, new-chat/remote-room tests pass): Birfy@3029ec8 on Birfy:fix/321-clipboard-fallback — a missing API or refused write now shows the link in the note (wrapping, selectable). I could not push it here: fix/group-friend-granted-bots is a protected upstream branch (push declined). Pull it with git fetch https://github.com/Birfy/FlyBot fix/321-clipboard-fallback && git merge --ff-only FETCH_HEAD. The PR is T3 (room-membership/channel/shared), so it still needs Danyang's one-click approval at head before the merge queue.

Merged via the queue into main with commit 24bcf1b Oct 18, 2026
8 checks passed
@Birfy
Birfy deleted the fix/group-friend-granted-bots branch October 18, 2026 10:14
Birfy added a commit to Birfy/FlyBot that referenced this pull request Oct 18, 2026
…ead of claiming it was copied

Codex review on ThinkFlowLab#321: with no navigator.clipboard (insecure context, locked-down
WebView) the optional-chained await resolved and the card said 'copied' while the
link, minted for this click, was shown nowhere. Now a missing API or a refused
write puts the link itself in the note (wrapping, selectable).
Birfy added a commit to Birfy/FlyBot that referenced this pull request Oct 18, 2026
…ok it, else show it to copy by hand (ThinkFlowLab#330)

Follow-up to ThinkFlowLab#321 (Codex P2 on new-chat.js: a missing or failed
clipboard counted as a copy). Ran ARCH_DOCS_BASE=origin/main TZ=UTC npm
run verify at the tip.

Co-authored-by: Danyang Chen <15378933+Birfy@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant