Skip to content

fix(social): name collisions, per-Bot grant leaks, Bot removal and approval defaults (#136 #138 #139 #140) - #141

Merged
Birfy merged 1 commit into
ThinkFlowLab:mainfrom
Birfy:cursor/selftest-136-140-dae8
Oct 16, 2026
Merged

Birfy merged 1 commit into
ThinkFlowLab:mainfrom
Birfy:cursor/selftest-136-140-dae8

Conversation

@Birfy

@Birfy Birfy commented Oct 16, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #136, #138, #140 and partly #139, from the automated self-test on main 1ac7104. Social plugin only; no core/pin changes.

Deferred (needs Bot Social server work): #137 Bot avatar sync (update_bot_profile has only display_name + bot_id; face join sends { code, bots: [handle] }) and the other-side half of #139. Documented in docs/subsystems/social.md.

Verified: ARCH_DOCS_BASE=upstream/main npm run verify passes.

…FlowLab#139, ThinkFlowLab#140

Retry a taken home name at onboard, show the connected handle, keep
per-Bot invites from leaking Chief, confirm Remove, and default
Auto-send off. Owner-chosen avatars (ThinkFlowLab#137) stay deferred: Bot Social
has no profile look fields.

Co-authored-by: Danyang Chen <birfychen@gmail.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 16, 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-16T12:09:20.212567Z 041923e 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: 041923e911

ℹ️ 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".

const view = grantPersonView(grant)
return {
id: grant.id || grant.relationshipId || `${bot.id}:${grant.grantee}`,
grantee: grant.grantee,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Store a canonical handle in each core grant

When list_bot_grants returns the decorated format covered by this change (for example Chief@chief.bob.home), this keeps that value as grantee and puts the usable handles only in home/member. flybot.grants.set ultimately goes through core/src/host/reach.js:212-221, which discards those two side fields, while normGrantee at lines 43-53 does not parse a decorated non-@ value. The core reach gate therefore cannot match the grant to @chief.bob.home or @bob.home, so an accepted per-Bot grant is denied; persist the canonical member/home handle as grantee.

Useful? React with 👍 / 👎.

Comment on lines +1258 to +1259
const peerHome = roster?.homes?.find(entry => entry.bots?.length)?.home
if (autoAcceptOf(peerHome)) await serverAutoApprove(String(relationshipId ?? ''), true)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Match auto-send to the relationship being accepted

When another friendship already appears first in the roster, accepting a request from a new person uses that unrelated first home's Auto-send setting. For example, if Bob is first and has Auto-send enabled, accepting Carol calls set_auto_approve for Carol's relationship even though Carol should start off; the inverse also suppresses an existing opt-in. Resolve the peer home for relationshipId from the pending request/result instead of selecting the first nonempty roster entry.

Useful? React with 👍 / 👎.

const key = norm(bot.handle)
if (!key) return false
if (settings.inboundBots?.[key] || settings.inboundBots?.[bot.home]) return true
if (outgoingPeerHandles().has(key)) return false

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Backfill inbound provenance before filtering reciprocal grants

On the first start after this upgrade, inboundBots is empty, so an existing reciprocal share is misclassified: if @chief.bob.home both accepted an invite to one local Bot and was separately shared back, it is in outgoingPeerHandles() and this branch drops it even though list_remote_bots legitimately returned it. Only new join/respond calls populate the marker, so existing users permanently lose the valid Bot and leaveMissingRemotes() also evicts it from groups; migrate or derive inbound direction before applying this filter.

Useful? React with 👍 / 👎.

const localHandles = new Set(locals.map(bot => bot.handle).filter(Boolean))
for (const member of snapshot.members ?? []) {
const handle = norm(member.handle)
if (handle && !localHandles.has(handle)) markRoomRemote(handle, snapshot.roomId)

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 Preserve shared Bots when tracking room-only remotes

If a face-room participant is already a normally shared friend Bot but the friendship predates the new inboundBots map, this unconditional call records it as room-only. The next roster refresh rejects every roomBots handle, and dropRoomRemotes() deliberately retains the record after leaving, so merely joining a face room makes that existing friend's Bot disappear permanently. Mark only handles whose room-only provenance is established, such as remotes absent from the pre-room friend roster.

Useful? React with 👍 / 👎.

try {
const result = await client.callTool('list_remote_bots', { home: home.id })
const homes = mapRemoteHomes(result?.homes)
const next = revealHiddenIfPresent(settings, presentRemoteHandles(homes))

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 Reveal only the Bot from the retried invite

When multiple locally removed Bots are still present in the home-wide list_remote_bots response, retrying one invite that returns relationship_exists passes every returned handle here and clears every matching hiddenRemotes entry. Re-adding Bob therefore silently restores unrelated Eve/other Bots the user explicitly removed; scope the reveal to the Bot or relationship associated with the retried invite.

Useful? React with 👍 / 👎.


export function nextOnboardDisplayName(base, attempt) {
const name = String(base ?? 'FlyBot').trim() || 'FlyBot'
return attempt <= 1 ? name : `${name}${attempt}`

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 Keep the onboarding suffix within the handle limit

For a display name whose sanitized handle part already occupies the 32-character limit modeled by homeHandleOf, appending 2, 3, and so on after the full name leaves the first 32 sanitized characters unchanged. All 12 retries request the same taken home (or the suffixed display name is rejected for length), so collision recovery still fails; truncate/reserve space for the suffix inside the handle-bearing portion.

Useful? React with 👍 / 👎.

@Birfy
Birfy added this pull request to the merge queue Oct 16, 2026
Merged via the queue into ThinkFlowLab:main with commit 18749e1 Oct 16, 2026
6 checks passed
Birfy added a commit to Birfy/FlyBot that referenced this pull request Oct 16, 2026
…ound backfill, scoped unhide

- Persist canonical @Handles in core grants (not decorated Chief@…).
- Seed inboundBots once from the existing remote roster so upgrade does not
  drop reciprocal friends before the outgoing-only filter.
- Resolve Auto-send on respond from the pending relationship, not the first
  roster home.
- Scope relationship_exists unhide to the invite's Bot/peer home.
- Do not mark existing friend remotes as room-only; truncate onboard
  suffixes within the 32-char homeHandleOf limit.

Co-authored-by: Danyang Chen <birfychen@gmail.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.

Social startup: fresh install fails on a taken handle (default displayName 'FlyBot'), and my own handle is never shown

2 participants