Skip to content

docs(plans): deleting a member's account refuses while they own a hosted row (TASK-172) - #2026

Merged
lilyshen0722 merged 5 commits into
mainfrom
wren/task-172-account-delete
Sep 29, 2026
Merged

lilyshen0722 merged 5 commits into
mainfrom
wren/task-172-account-delete

Conversation

@lilyshen0722

@lilyshen0722 lilyshen0722 commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Step 6 of the hosted-MCP plan lists every path that can remove a hosted row. It misses the two paths that remove the row's owner instead of the row: deleting the account and banning it.

DELETE /api/admin/users/:userId (behind both admin pages' Delete) runs deleteOne() on the User and does nothing else, because User has no delete hook. PATCH /api/admin/users/:userId/ban sets banned and does nothing else. resolveHostedConnection never reads the owner. So after either one, the hosted row stays connected:

  • the person's grants keep resolving until they expire;
  • only the granter sees Revoke, and they are gone or refused by auth;
  • the orphan sweep keeps the refresh token, because the row is still active.

This PR changes docs/plans/hosted-mcp-connection-scope.md in four places:

  • For a hosted row, the §7 broker refuses when the row's owner is banned or no longer exists. It reads the owner through sessionAccountService and names the cause: connection_owner_banned, connection_owner_missing or connection_owner_bot (403). The ban reaches the grants only this way, because neither path to the broker passes through auth, and nothing on those paths reads banned. listToolsForGrant, callTool and executeApprovedToolCall all resolve through the check, so it covers the offer, the call and a call approved after the ban. This is TASK-181's shape: a check at call time, trailed refused with the code as reason and named in §9's table. Nothing is written when the ban is set, so lifting it restores the grants with no reconnect. A github-app row is unchanged, because its token belongs to the app installation.
  • §7 adds account deletion. The route refuses 409 while the person owns a hosted row, and its body lists each row's _id and entry. An admin removes them first through DELETE /api/integrations/:id, which admits admins and runs §9's removal. Removal stays one path with one retry.
  • §7 adds the ban. It stays unguarded, because a ban can be urgent and can be lifted, and the material stays for the same reason.
  • §10 step 6 adds four witnesses, among them a call approved after the ban, and §8 says credentialOwnerId holds against the row's delete, not the person's.

Docs only, one file.

Gate: Rhea

🤖 Generated with Claude Code

lilyshen0722 and others added 5 commits September 29, 2026 12:34
…ted row (TASK-172)

The admin user delete removes the person and nothing else, so a hosted
row would outlive its owner, with its grants still resolving and its
refresh token kept by the sweep. §7 names the path and the refusal,
step 6 gains its witness, and §8 says which delete credentialOwnerId
holds against.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…broker, and the 409 names its rows (TASK-172)

The account-delete refusal named no rows, so an admin had no next step.
Its body now lists each row's _id and entry, which is what
DELETE /api/integrations/:id takes.

A ban leaves the row, its grants and the refresh token as live as a
delete does, and it is the likelier way a member leaves. The broker
now refuses connection_owner_unavailable when the row's owner is
banned or gone. One check in resolveHostedConnection covers the list,
the call and the approved call. The ban route stays unguarded because
a ban can be urgent and can be lifted; lifting it restores the grants
with no reconnect.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…and §8 claims no exclusivity (TASK-172)

§8 said a name on the trail would be the one place a deleted person's
name survives. Activity already stores actor.name and replies.actorName,
and account deletion clears neither, so the claim is dropped. The
column still defers the retention decision without it.

The ban bullet now says why the check has to sit in the broker: auth
is the only reader of banned, and neither the grants route
(agentRuntimeAuth) nor the native runtime passes through it. The
owner check is scoped to hosted rows; a github-app token belongs to
the app installation.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…proval-after-ban witness (TASK-172)

The owner check is TASK-181's precondition, so the plan names it.
§9's table gains the refusal: refused before calling, trailed
refused/connection_owner_unavailable by both call paths' existing
catch, and neither the row nor the grant is touched. The check reads
live state at call time, so nothing is written when the ban is set.

Step 6's witnesses ban or delete a member who owns the row and then
call through the broker, rather than calling the check, and a third
covers a call approved after the ban.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… its cause (TASK-172)

One code covered two causes with different remedies: a banned owner
needs the ban lifted, a missing one needs the row removed and
replaced. The check now reads the owner through sessionAccountService,
the one definition the session verifiers share, and renders its answer
as connection_owner_banned, _missing or _bot.

The plan also says where the refusal is written: both call paths'
existing catch records it as refused with the code as reason
(safeReason). A refused list writes no row, since a list is not a
call; the seat gets the code as a JSON-RPC error.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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