Skip to content

Friend chat: a message sent in the first seconds after an invite join is refused and lost #442

Closed

Description

@Birfy

What happened

2026-10-19 18:03 (Asia/Shanghai), the owner's Mac test instances (3080 = danyang.home, 3081 = friend.home), Bot Social prod.

  1. friend.home joined an invite for the Bot 测试 on danyang.home.
  2. About 8 seconds later, the owner typed "Hi" in the new friend chat on 3081 (18:03:12).
  3. Bot Social delivered it, but 3080 dropped it: it had not yet recorded 测试's local grant for the new friend, so the inbound message was refused and lost. No reply, and no error was shown to the sender.
  4. The owner sent "Hi" again, which tripped Bot Social loop detection and paused the chat (fixed separately in Bot Social docs: Magpie-style LESSONS, code-standards, and review skill #28/ci: CI modeled on yetone/magpie (macOS leg, plugin tests + coverage, package check, tag release) #29 and FlyBot Friend chat stuck 'paused' after Extend: remove the turn limit and the Extend UI (owner decision 2026-10-19) #439/Remove Extend from paused friend chats; a paused chat says to send again (Fixes #439) #440).

Expected

A message that arrives right after an invite join is never silently lost. Either:

  • the receiving FlyBot records the grant before (or as part of) acknowledging the join, or
  • an inbound message for a not-yet-known grant is held and retried once the grant syncs (short window), instead of being refused and dropped,
  • and if it is still refused, the sender sees a clear "Not sent" line rather than silence.

Notes

  • Found while fixing the paused-chat bug; prod audit log shows delivery at 18:03:12 and no reply.
  • Probably touches the social plugin's inbound/grant-sync path; tier to be set by the controller.

Activity

  1. self-assigned this
    on Oct 19, 2026
  2. added
    bugSomething isn't working
    area:socialFriends, invites, grants, Bot Social
    on Oct 19, 2026
  3. Birfy commented on Oct 19, 2026

    @Birfy
    CollaboratorAuthor

    Triage (maintenance run, 2026-10-19 18:55 Asia/Shanghai)

    Where it fails today: an inbound friend message goes through the owner policy in core/src/host/hooks.js (rt.deliver wrapper). When the receiving home has not yet synced the new talk-through grant from the invite join, the policy says deny, the delivery is only logged (delivery to … refused) and dropped. Nothing goes back to the sender. The grant sync (syncOutgoingGrants in plugins/social/src/social.js) runs on the roster fetch, so a message that lands in the first seconds after a join can beat it.

    Proposed fix (scope: social plugin inbound path + the owner-policy deny branch, no Bot Social change):

    1. When an inbound remote message is denied only because no grant is known for that sender yet, run one grant sync right away and judge the message again (one retry, bounded to ~30 s). If it passes, deliver it normally.
    2. If it is still refused after the retry, send the sender a short "Not sent: isn't set up to talk with you yet. Try again in a moment." line back over the friend chat, so it is never silent.
    3. Test: a message that arrives before the grant sync is delivered once the sync completes; a message for a truly ungranted sender still gets refused, now with the Not sent notice; no duplicate delivery.

    Options for the owner: (a) the above, sync-and-retry plus a Not sent notice (recommended); (b) also make the join itself wait for the grant record before acknowledging (needs a Bot Social change, bigger); (c) only the Not sent notice, no retry.

    Waiting for the owner's confirmation before agent-ready.

  4. added
    needs-humanThe agent loop stopped; a person must decide (reason in the last comment)
    on Oct 19, 2026
  5. Birfy commented on Oct 19, 2026

    @Birfy
    CollaboratorAuthor

    Owner decision (2026-10-19 18:58 Asia/Shanghai): option b. Make the invite join write the grant before the join is confirmed, so the receiving FlyBot already knows the new friend's grant when the first message arrives (no refuse-and-drop window). This needs a Bot Social server change (file a linked Birfy/bot-social issue; prod deploy only after the owner's yes) plus the matching FlyBot change. If a message is still refused for a missing grant, the sender must see a clear "Not sent" line, never silence.

  6. added
    agent-readyMaintainer-approved spec: an agent may take it. Only maintainers set this; never in a template
    agent-workingAn agent has claimed this issue (the claim comment names the branch)
    and removed
    needs-humanThe agent loop stopped; a person must decide (reason in the last comment)
    on Oct 19, 2026
  7. Birfy commented on Oct 19, 2026

    @Birfy
    CollaboratorAuthor

    Claimed for development (2026-10-19 20:00 Asia/Shanghai). Branch fix/442-invite-grant-before-join off main 753b7e9. Working in parallel this maintenance run.

  8. Birfy commented on Oct 19, 2026

    @Birfy
    CollaboratorAuthor

    Linked Bot Social server work: Birfy/bot-social#30 (grant before join confirm). Prod deploy of that change still needs the owner's explicit yes.

  9. Birfy commented on Oct 19, 2026

    @Birfy
    CollaboratorAuthor

    Re-claimed (2026-10-19 20:57 Asia/Shanghai): the 20:00 run's worker stopped without changes; development restarts now on the same branch name off main 753b7e9.

  10. added a commit that references this issue on Oct 19, 2026
    58f7a52
  11. Birfy commented on Oct 19, 2026

    @Birfy
    CollaboratorAuthor

    Maintenance cleanup (2026-10-19 21:57 Asia/Shanghai): #449 merged to main (58f7a52); removing stale agent-working and assignee from this closed issue.

  12. removed their assignment
    on Oct 19, 2026
  13. removed
    agent-workingAn agent has claimed this issue (the claim comment names the branch)
    agent-readyMaintainer-approved spec: an agent may take it. Only maintainers set this; never in a template
    on Oct 19, 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