Skip to content

The re-accept grant falls back to friend_home, which Bot Social never receives #1024

Closed

Description

@Birfy

Owner: Dev2

Written-by: Dev2

Found while reviewing #1023 (#1000, merge db56b817). Line numbers are on that commit.

What

restoreAcceptedInviteGrant (plugins/social/src/social.js:2401) resolves the friend from inviter.bot_id, and falls back to the inviter's home when the invite info carries no bot_id:

const peerHome = norm(inviterHome || (inviter?.home ? inviter.home : '') || (inviter?.handle ? homeOfPeer(inviter.handle) : ''))
...
await api.grantBotToFriend({ botId: member.bot_id, ...(!peerId ? { friendHome: peerHome } : {}) })

That fallback cannot work: grantBotToFriend (plugins/social/src/mcp-client.js:466-478) sends friend_bot_id / friend_owner_id only — the comment there says the server takes those two — and the REST body is the same pair. So when Bot Social's invite info names no bot_id, the call throws on the client guard (which friend?) or the server refuses it, the error is caught and logged, and the accept stays one-way with no visible difference — the exact silence #1000 was about.

Expected

Either the fallback resolves a real id (the inviter's Bot is listed by list_friends with peer.bot_id, which friendsOverview already reads), or the branch is dropped so the code does not claim a fallback it cannot make.

Scope

  • plugins/social/src/social.js:2401-2415 — resolve the peer id from list_friends when inviter.bot_id is absent, or delete the friendHome branch.
  • Test: an invite info with no bot_id must still reach the server with a real friend_bot_id, or must not call at all.

Not this issue

  • The grant itself and both re-accept paths (#1000, #1023) are correct; this is the fallback branch only.
  • #1023 was merged with this as a non-blocking: the production invite info has carried bot_id in every shape we have seen (#496, #342).

Activity

  1. added
    agent-readyMaintainer-approved spec: an agent may take it. Only maintainers set this; never in a template
    area:socialFriends, invites, grants, Bot Social
    bugSomething isn't working
    on Oct 24, 2026
  2. Birfy commented on Oct 24, 2026

    @Birfy
    CollaboratorAuthor

    Written-by: Triage

    Triage at main db56b817: confirmed, and the branch really cannot reach the server.

    • plugins/social/src/social.js:2401 restoreAcceptedInviteGrant, :2405 the fallback peerHome (invite home / handle) that is only used when inviter.bot_id is absent.
    • plugins/social/src/mcp-client.js:466 grantBotToFriend({ botId, friendOwnerId, friendHome, friendBotId }) takes friendHome but sends only friend_bot_id / friend_owner_id (:473-474, :479-480, same pair in the REST body), and the comment at :464-465 says why. So the friendHome branch is a no-op by construction, wrapped in the same catch that makes it silent — the exact silence #1000 removed.

    Expected shape (pinned): resolve the peer id from list_friends (peer.bot_id, which friendsOverview already reads) when the invite info carries no bot_id, so a real friend_bot_id reaches the server. Do not just delete the fallback and keep the copy: if the id cannot be resolved, the accept line must not say "shared back" — a visible "could not share back" is acceptable, a silent half-restore is not.

    Acceptance:

    1. Invite info without bot_id: the call reaches the mock server with a real friend_bot_id (or is not made at all and the copy does not promise the share); the existing invite-info-with-bot_id cases stay green.
    2. Knife: remove the list_friends resolution → the new case goes red; keep the resolution but send friendHome only → still the same no-op, so a case must fail if friend_bot_id is missing.
    3. A real invite-info-without-bot_id shape goes in the issue/PR body as the reason the branch exists; if no such shape can be produced, say so and delete the branch with the copy guard instead.
      bug, area:social, agent-ready, Owner: Dev2.
  3. added
    agent-workingAn agent has claimed this issue (the claim comment names the branch)
    and removed
    agent-readyMaintainer-approved spec: an agent may take it. Only maintainers set this; never in a template
    on Oct 24, 2026
  4. Birfy commented on Oct 25, 2026

    @Birfy
    CollaboratorAuthor

    done on 1d5b5a5f — the four closing checks, on the merged tree.

    1. #1024 is closed/completed; Fixes #1024 points at Resolve the re-accept grant to a peer bot id, never a friend home (#1024) #1035, whose merge commit is 1d5b5a5f (the merge_group that Reviewer2 saw green).
    2. changelog.d/1024-reaccept-grant-names-the-peer.fixed.md is on main (378 bytes).
    3. docs/subsystems/social.md carries the clause in the Invite between existing friends: red 'You're already friends. Their Bot is back in your list.' when nothing changed; Remove this Bot doesn't say what stays shared #496/Accepting a re-invite restores only the direction that sent it; the other side is silently absent #1000 entry: the friend is taken by bot id, never by home, the handle the invite named first, else the only active friendship of that home, and nothing when a home lists two ((#1024) present).
    4. The code that landed is the behaviour, not just its description: social.js on main has invitePeerBotId, the exact-handle branch (if (exact && handle === exact) return id) and the one-entry fallback (return byHome.size === 1); the friendHome fallback is gone from restoreAcceptedInviteGrant.

    Labels: agent-working removed here; agent-pr removed from #1035 (pass stays). agent-ready was Triage's and is already gone.

  5. removed
    agent-workingAn agent has claimed this issue (the claim comment names the branch)
    on Oct 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:socialFriends, invites, grants, Bot SocialbugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions