Skip to content

Organization invitations: a signed-in invitee who opens an already-accepted invitation gets the same not-found answer as an unknown id #33681

Open

Description

@objectstack-fleet

domain:ui#1 · os-project-manager · session_01FEkQ5nWoa1Ze1QzjRTSYXD

Filing gate: ① an out-of-scope finding with a named producer, from the #33650 os-dev report (6890090496, out_of_scope_findings class a). The #33650 contract record on PR #33679 (6890217201) asks for it to be filed before that PR lands. It was read on the vendor code by the dev, not driven live.
Reader: domain:server (plugin-auth, organization invitations). Grade p3, self-graded by the seat under the maintainer's 「定级你可以自己决定」. The console already shows a sentence that covers the accepted case, so nothing breaks; the person just isn't taken into the organization they already joined.
Dedupe: is:issue is:open invitation accepted already member get-invitation finds only #33650.

维护者速读

被邀请人接受邀请后再次打开同一个邀请链接(或接受后刷新页面),服务端返回的和「邀请不存在」完全一样,控制台无法知道「你已加入该组织」,只能显示一句通用提示「该邀请已被使用、已过期或已撤销」。#33650 的期望「已加入就直接带他进去」需要服务端给出区分。

Producer

  • better-auth 1.7.12 GET /organization/get-invitation (dist/plugins/organization/routes/crud-invites.mjs, getInvitation) refuses every invitation whose status is not pending with the same code-less 400 "Invitation not found!" it gives an unknown id.
  • list-user-invitations returns pending invitations only.
  • objectstack's signed-out invitation-preview answers one uniform 404 by design (ADR-0138 D2), so it cannot help either.
  • The console (PR fix(console): invitation refusals read in the console's language #33679) therefore words the not-found sentence to cover used / expired / revoked and points to the organization list.

Expected

When the signed-in person opening an invitation link is the invitation's own recipient and has already accepted it, the server answers so the console can show "you have joined " with a way in. For anyone else, or a signed-out caller, the answer is unchanged, so it reveals nothing the uniform 404 / not-found hides today (ADR-0138 D2).

Acceptance

  • Measure first: the vendor answer for accepted / rejected / canceled / expired and for an unknown id, signed in as the recipient and as someone else.
  • A signed-in recipient's already-accepted invitation gets a distinguishable answer (a code, or a field on a successful read) naming the organization. Every other caller and state reads as today. Pins for both, with a CONTROL for a non-recipient.
  • If this changes a refusal code or a response shape, the PR declares Clause-② and the console follow-up (showing the joined state) is filed as a domain:ui card.
  • ⛔ No better-auth patch unless the server lane rules one in.

Refs #33650

Activity

  1. added
    pm:queue
    domain:server
    on Nov 15, 2026
  2. objectstack-fleet commented on Nov 19, 2026

    @objectstack-fleet
    ContributorAuthor

    triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH

    Triage: lands in domain:server · pm:queue; rationale: area:data · Bug · Impeded (a signed-in invitee opening an already-accepted invitation gets the same not-found answer as a bad link) · rare · read in vendor code → p3 as set; kept open because the answer misleads.

  3. objectstack-fleet commented on Nov 21, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#7 · os-tesla · session_01L9qibvVRcFWKrfWeG5jzPb

    Claim: PM loop round 2
    Session: session_01L9qibvVRcFWKrfWeG5jzPb
    Account: os-tesla
    Branch: claude/issue-33681-accepted-invitation-answer
    Worktree: objectstack-issue-33681
    Domain: domain:server
    Seat: repo:objectstack#7
    Area: d7-C
    File surface: packages/plugins/plugin-auth/src/** except audience-posture.ts, auth-manager-membership-admission.ts and invitation-acceptance-verified-address.test.ts (held by #34971's unlanded work), expected to be invitation-preview.ts or a new sibling module, auth-manager-organization-plugin.ts and auth-route-ledger.ts; the auth docs page under content/docs/** that names the invitation reads; and one .changeset/33681-*.md. On a breach, stop and explain it in the report. If the fix needs packages/spec/**, ui/** or a vendor patch, stop and report before writing.
    Container & model: M, mode:subagent, model: opus (dispatch-gates --tier: no path-derived mandate; default tier), effort: high (an auth read under ADR-0138 D2; measure the vendor first)
    Clause-②: yes (widening, expected): a signed-in recipient opening their own already-accepted invitation gets a distinguishable answer naming the organization; every other caller and state answers as today.
    Metadata-protocol: none
    Responsibility: better-auth 1.7.12 getInvitation (vendor) answers a non-pending invitation with the same code-less 400 as an unknown id; objectstack has no read that tells the recipient they already joined | none: invitation-preview answers one uniform 404 by design (ADR-0138 D2) and list-user-invitations lists pending only | signed-in invitees re-opening an accepted link; rare; the console shows a generic sentence today
    Thread-read: 7013983447
    Premise: holds as read. At origin/main 615d995, invitation-preview.ts :27-31 answers the same 404 for unknown, expired, accepted, rejected and cancelled ids and never reads the session; the vendor answer is to be MEASURED first, as the card's acceptance asks.
    Serial constraints cleared: overlap-check probe over invitation-preview.ts, auth-manager-organization-plugin.ts, auth-route-ledger.ts and invitation-accept-verified-email.ts at origin/main 615d995: VERDICT clean, 0 open PR heads. #34971's unlanded patch files are excluded from the surface.
    Pre-claim lane: packages/plugins/** (domain:server). area:data p3. Seat 7 order 2026-11-21T12:27Z.
    Pre-claim deps: no Blocked-by:. #33650 / PR #33679 (the console half) are the origin; the console change that reads the new answer is a follow-up, not this card.
    Prior rulings read: organization,invitations,signed-in,invitee,opens,already-accepted,invitation,gets,not-found,answer,unknown → 117 hits; ADR-0085 Decision §6, ADR-0105 D5, ADR-0133 D1, ADR-0146 D7; thread: none; repo: objectstack-ai/objectstack. Also stands: ADR-0138 D2 and ruling 6413975861 (the signed-out preview stays uniform and session-blind).
    Owed review: TIER_DEFAULT for Clause-②: yes, plus CONTRACT_REVIEW_TIER (Fable) because it adds an auth answer. L1 by L1-a.
    Pins owed: the signed-in recipient's accepted invitation answers distinguishably with the organization; CONTROLS: another signed-in user, a signed-out caller, and the recipient's rejected / cancelled / expired / unknown ids answer exactly as today; the signed-out preview is unchanged. Ablate each.

  4. added
    pm:dispatched
    and removed
    pm:queue
    on Nov 21, 2026
  5. objectstack-fleet commented on Nov 21, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#7 · os-tesla · session_01L9qibvVRcFWKrfWeG5jzPb

    Release: session session_01L9qibvVRcFWKrfWeG5jzPb (area d7-C) · because the maintainer stopped queued work (quoted below), relayed by seat 7 with the instruction to release this card · to pm:queue, unassigned.
    Maintainer word, in the project timeline at 2026-11-21T15:25Z: 「不接新任务的意思是,后面排着的也不做」.
    Resume-from: claude/issue-33681-accepted-invitation-answer@80f6086807e7526732618ec772ccad70674dad84

    State at the WIP commit:

    • Measured before, on better-auth 1.7.12 with a real AuthManager:
      • get-invitation answers 400 "Invitation not found!" to a signed-in caller for every non-pending state and for an unknown id, both for the recipient and for anyone else.
      • Signed out, it answers 401.
      • invitation-preview answers one uniform 404.
    • Done. A new session-bound GET /api/v1/auth/organization/accepted-invitation?id= (invitation-accepted-answer.ts, wired as an organization-plugin endpoint):
      • It answers 200 with the organization (organizationId, organizationName, organizationSlug, isMember) only for an accepted invitation whose recipient is the verified session user.
      • Every other case answers one 404 after exactly one read, and a signed-out caller gets 401.
      • get-invitation and the preview are untouched.
      • A ledger row, a self-hosting.mdx paragraph and a changeset (Clause-②: yes (widening), Metadata-protocol: none) are written. The pins pass 15/15, and the route-ledger conformance passes 13/13.
    • Owed. The ablation, the full plugin-auth suite and typecheck, the dispatch-gates families, a draft PR, the os-dev report, and a Fable contract review plus L1.
    • Follow-up for domain:ui, not filed. The console AcceptInvitationPage should call the new route when get-invitation answers the code-less 400.
  6. added
    pm:queue
    and removed
    pm:dispatched
    on Nov 21, 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:datadomain:serverpm:queuepriority:p3

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions