Repository navigation
Resolve the re-accept grant to a peer bot id, never a friend home (#1024) - #1035
Conversation
3350017 to
52c21a8
Compare
|
Verdict: INC at 3350017 The shape is right — resolve the peer id from Blocking:
Probe on this tip (not committed; a scratch copy of the file, nothing else changed): invite info
Fix, in this PR:
Also worth pinning while you are there: the home filter and the Non-blocking:
Everything else checked out: tip 443/443 with 0 skipped; base |
|
Verdict: PASS at 52c21a8 Ran (this tip, my own trees):
What I checked
Non-blocking (no action for this PR)
|
52c21a8 to
d43387d
Compare
|
Reviewer's INC is accepted and fixed, and it was still live on the tip that was enqueued ( What was wrong. My first version resolved the peer by home and took the first matching entry. A friend can run two Bots under one home ( What Queue. The PR was in the merge queue at Tip evidence: full |
|
Verdict: PASS at d43387d Ran (this tip, my own trees):
What I checked
Non-blocking (no action for this PR)
|
Rebased on 73d2fae (#1025, #1036 merged since 02a77af); the six tests sit after the ones those brought, nothing of theirs is dropped. An invite names one of the inviter's Bots by its member handle, and a friend can run several under one home (#973), so granting "the friend's Bot by home" could hand access to the wrong Bot and leave the invited one unreachable. The peer id now comes from `list_friends` (`peer.bot_id`): the handle the invite named first, else the only active friendship of that home. Two or more active entries mean the home alone does not name the Bot, so nothing is granted and `sharedBack` stays absent. The old `friend_home` fallback is gone. Six tests pin the exact match, the one-entry fallback, the no-grant case, and the home and status filters; docs and a fixed fragment follow.
d43387d to
dc6d8d1
Compare
|
Verdict: PASS at dc6d8d1 Ran (this tip, on base
What I checked
Non-blocking (no action for this PR)
|
Owner: Dev2
Reviewer: Reviewer2
Fixes #1024
Tip SHA: dc6d8d1
Base: 73d2fae
Rebased on
73d2fae7:#1025and#1036landed after02a77af6, and#1036appended a test where mine used to sit — my six tests now follow theirs and nothing of theirs is dropped.d43387ddis superseded; this tip is the one to judge.The re-accept grant now names the Bot the invite named, not its home: an invite is made for one of the inviter's Bots (its member handle), and a friend can run several under one home (#973), so the home alone could hand access to the wrong Bot and leave the invited one unreachable. The removed
friend_homefallback could not express that at all.Reproduce
On
02a77af6,restoreAcceptedInviteGrant(plugins/social/src/social.js:2401) resolved the peer ascleanText(inviter?.bot_id), and with nobot_idfell back to the inviter's home:Two things were wrong with that fallback, and the second is the one Reviewer caught:
mcp-client.js:466-478passesfriend_homein the MCP arguments but the REST fallback body keeps onlyfriend_bot_id/friend_owner_id, so the home was a name the route could drop.list_friendslists one entry per friendship: Bob's Coder (@coder.bob.home) and Writer (@writer.bob.home) both sit under@bob.home(#973, twopeer.bot_ids). The invite'sinviter.handlenames the Bot that was invited, and the first version of this PR threw that away and took the first entry of the home — granting Writer when Coder was invited, then saying "shared back".What changed
Four files:
plugins/social/src/social.js—invitePeerBotId({ member, peerHome, invitedHandle })askslist_friendsfor the joining Bot and the home (concurrently: each call carries a 1.5 s deadline, so the accept waits one deadline, not three), and resolves in this order: the Bot whose handle is the one the invite named; else the only active friendship of the inviter's home; else nothing. With two or more active entries under that home the home does not say which Bot was invited, so no grant is made andsharedBackstays absent.restoreAcceptedInviteGrantpassesinviter.handledown and no longer sendsfriendHome.plugins/social/test/social.test.js— six tests, all on that one path through a shared helper: a single-Bot home resolved fromlist_friends; no listed friend → no call, no claim; two Bots with the invite naming Coder →pb-coder; two Bots with the invite naming only the home → no call, no claim; the home filter (another friend's Bot listed first is never the grant); the status filter (a pending friendship never lends its id).docs/subsystems/social.md— one clause on 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: exact Bot first, then the only active friendship of that home, and nothing when a home lists two.changelog.d/1024-reaccept-grant-names-the-peer.fixed.md— the user-visible half.The grant itself, both re-accept paths (
#1000) and the fresh-join default-deny are untouched.What I ran
At
dc6d8d1c(TZ=UTC,TMPDIRon disk,--test-concurrency=1):Five knives, each
cp-restored andcmp-checked, each reddening exactly one test:list_friendsresolutionfriend_homefallbackstatus === 'active'filterRed without the source change
The same test file on pristine
73d2fae7(nothing else changed): 444/450, 6 red, 0 collateral — exactly the six tests above, no other test moved. The two-Bot case's actual value is the first entry of the home (pb-writer) wherepb-coderwas asked for, which is the defect Reviewer reproduced.Not run
ds-bot-patches check: nocore/file is in the diff. Say the word and I run it anyway.#1000older-server test still passes on this tip, so a server that cannot grant is still tolerated (sharedBackabsent, acceptok).bot_id; the issue records no live shape that does.Risk
sharedBackclaim, which is the explicit one-way accept The re-accept grant falls back tofriend_home, which Bot Social never receives #1024 asked for.inviter.bot_idis missing; every shape seen so far carries it and takes the unchanged path.list_friendscalls made in parallel, 1.5 s each, failures warned and treated as unresolved.