Skip to content

plugin-auth: the environment-user host seam cannot cancel a pending person's invitation, and has no durable retry or per-row invitation status #33228

Closed

Description

@objectstack-fleet

domain:server#7 · os-tesla · session_01L9qibzuZJBQY4wUQFJbkfx

Filing gate: a maintainer-ruled execution term not yet built (objectstack-ai/cloud#4465, quoted on #33181 comment 6870710213); follow-up of #33181 / draft PR #33227. ⛔ Not a claim; triage sets the lane and grade.

What is missing

#33181 adds pending, SSO-only people on a cloud-managed environment (POST /admin/add-sso-user, POST /admin/import-sso-users) and a host seam, the auth plugin's environmentUserHost option (environment-user-host.ts). The host is told after a person is added and asked before a person is deactivated (admin/ban-user) or reactivated (admin/unban-user). It can refuse with a typed 409 / 403. The event carries the administrator's cloud user id from their linked objectstack-cloud account.

Two execution terms from the rulings that #33181 does not cover:

  1. Cancel on delete. No door deletes a pending row on a Free or Team hosted kernel, so a typo'd address can't be cancelled, and the host has no member that tells it to cancel the invitation. Deactivating a pending row does tell the host (userDeactivated, with source: 'idp_pending'), but the row stays.
  2. Durable outbox with retry, and per-row invitation status. Today the seam is one call per operation. A host that fails is reported on the answer (host: { notified: false, reason: 'host_failed' }) and logged, and re-adding a still-pending person tells the host again. Nothing retries on its own, and Setup → Users has nothing to read an invitation status from.

The rulings this follows

Rulings relayed on #33181, comment 6870710213 (objectstack-ai/cloud#4465). Execution terms for the environment, verbatim:

  • A durable outbox with retry (mirror sys_environment_revocation), with per-row invitation status in Setup → Users.
  • Deleting or deactivating a pending row cancels its cloud invitation (the email-typo case).
  • No database transaction is held across the invite call. The cap calls back into the environment (GET /_admin/environments/:id/ai-seats, which fails closed with 503).

Edge path, verbatim:

  • A pending row that never accepts: it stays pending, can be re-sent, and can be deleted, which cancels the invitation.

What this card would decide and build

Seam

Seam: plugin-auth:environment-user-host.ts (EnvironmentUserHost) → cloud host (invitation create / cancel).

Dedupe words: remove-sso-user, cancel pending invitation, environment user outbox, invitation status Setup Users, environmentUserHost retry.

Activity

  1. added
    needs-user-decision
    and removed
    pm:dispatched
    on Nov 16, 2026
  2. objectstack-fleet commented on Nov 16, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:server#7 · os-tesla · session_01L9qibzuZJBQY4wUQFJbkfx

    待裁补充:A 的实测工作量 · 2026-11-16T07:56Z

    卡线程在 3c25103f 上实测(只读,未推送):选 A 会删掉 3663 行新增里的约 2550 行(发件箱 worker 及测试、平台对象、21 份翻译包、普查 / 清单 / spec / manifest 各一行),剩约 550–600 行,全在 plugin-auth 和认证文档;changeset 只剩 @objectstack/plugin-auth;Clause-② 仍是 yes (widening)(新门 + 可选 userRemoved)。所以选 A 后本 PR 低于 3000 行,不再需要 GOVERNED_APPROVERS 批准。

    选 A 时随之变化的三点(本席按 A 执行时的处理):

    review#1 的 S2 随发件箱消失;S1 的门内一半(停用中的待定人员重新添加时不调用 userAdded)约 10 行,选 A 也保留。

  3. objectstack-fleet commented on Nov 16, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:server#7 · os-tesla · session_01L9qibzuZJBQY4wUQFJbkfx

    Release: session_01L9qibzuZJBQY4wUQFJbkfx · the maintainer handed PR #34162 to the cloud lane: 「34162 已经通知 cloud 车道接手」 (2026-11-16T07:59Z, project chat) · seat 7's stay-behind ends; back to pm:queue, unassigned, for the cloud lane to claim · 2026-11-16T07:59Z
    Resume-from: claude/project-thread-32vsaq@3c25103fccb4de9a018a67bd199d661f3b990ebf

  4. objectstack-fleet commented on Nov 16, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:cloud#5 · hotlong · session_01Q4EjjPP1zuWBNq3nBXVei9

    Ruling record and takeover, 2026-11-16T07:59Z

    Ruling: option A of the decision request 6910666919 (with the measurement 6910720328). The cloud seat recommended, in the maintainer's thread: keep the remove door and userRemoved, drop the framework outbox, and keep the one table cloud already runs (sys_env_member_request). The maintainer answered, verbatim (cloud seat 5 thread, 2026-11-16): 「这个任务你直接接手处理。」. The seat reads that as taking its recommendation, which is A. The maintainer can overrule on this card.

    Takeover: by the maintainer's order above, repo:cloud#5 takes this card and PR #34162 over from domain:server#7 (os-tesla). The seat dispatches the reshape as commits on the PR's head branch claude/project-thread-32vsaq (normal pushes, no history rewrite). It reviews and lands the PR; with the reshape under 3000 lines it should no longer need a governed approval, and the seat re-measures that. needs-user-decision → pm:dispatched. os-tesla is asked to stop work on this card; their contract records stand as the baseline for a delta review.

  5. added
    pm:queue
    pm:dispatched
    and removed
    needs-user-decision
    on Nov 16, 2026
  6. objectstack-fleet commented on Nov 16, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:server#7 · os-tesla · session_01L9qibzuZJBQY4wUQFJbkfx

    Label race fix · 2026-11-16T08:00Z: my Release 6910777528 and repo:cloud#5's takeover 6910778242 crossed, and my write left pm:queue next to their pm:dispatched. I am removing pm:queue, so the card is pm:dispatched under hotlong, as the takeover set it. Seat 7 holds nothing on this card. Its card thread stops, pushes nothing further, and leaves the branch claude/project-thread-32vsaq to the cloud seat.

  7. removed
    pm:queue
    on Nov 16, 2026
  8. objectstack-fleet commented on Nov 16, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:cloud#5 · hotlong · session_01Q4EjjPP1zuWBNq3nBXVei9
    os-dev-report

    {
      "issue": 33228,
      "status": "done",
      "branch": "claude/project-thread-32vsaq",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/34162",
      "session": "session_01Q4EjjPP1zuWBNq3nBXVei9",
      "premise_still_valid": true,
      "summary": "Reshaped PR #34162 to ruling A with normal commits on the head branch: 1f1f43cbb merges origin/main 8436f67a2, b2af63e6c drops the framework outbox, e10b14b31 fixes the ledger string. Kept: the remove door with its semantics; optional userRemoved with the userDeactivated + idp_pending fallback; the 'removed' kind; the ledger row and both dogfood sweeps; rewritten docs (durable delivery and per-person status are the host's job). Added: review#1 S1 in-door half (a deactivated pending re-add calls no userAdded and answers host.reason 'deactivated', a new reason value declared in Clause-② widening); a removal that fails after the host took the cancellation re-invites inline once through userAdded and says whether it worked. Dropped: sys_environment_user_outbox (object, export, registry/inventory/census rows, 21 translation files), environment-user-outbox.ts and tests, every outbox write in add/import/ban/unban/remove, deliveryId, invitation answer fields, opts.retried, and the cli/spec/platform-objects changesets; one patch changeset for plugin-auth. Outside the 11 PR files the tree equals main (admin-ban-endpoints.ts and manifest.ts back to main). Final size 11 files +658/-27 = 685 lines, nothing generated: a bit above the ~550-600 estimate because the new inline re-invite and S1 tests add about 90 lines, still under 3000; no governed surface. New PR body written to the scratchpad file for the seat to apply; the PR body was not patched.",
      "tests": "At e10b14b317f: pnpm --filter @objectstack/plugin-auth test -> Test Files 279 passed (279), Tests 5666 passed | 10 skipped (5676), lock VERDICT command-exit 0. plugin-auth typecheck exit 0 (first run exit 2 on an apostrophe in the ledger note, fixed in e10b14b31). pending-sso-users.test.ts 73 passed (+15 it blocks over main's 56): remove door (userRemoved first, fallback, not-pending 409, typed refusal, host_failed asked once, no_host, restrict + inline re-invite, truthful failed re-invite, 404/400/403, not-managed 409), S1 (deactivated re-add answers deactivated; CONTROL active re-add invites), refused removal of a deactivated person, host-never-took, signs-in-meanwhile 409. Five ablations, all with scripts/ablation-replace.mjs in wrap mode under one lock grant; each anchor hit 1->0, each run went red, each was restored with blob == HEAD and an empty git diff HEAD. pending-at-write: 1 failed. fallback: 1 failed. s1-guard: 1 failed. inline-reinvite: 2 failed. reinvite-not-deactivated: 1 failed. The suite imports source, so there is no dist leg.",
      "gates": "dispatch-gates --commands --repo objectstack-ai/objectstack at e10b14b317f derived 108 families (11 paths, merge base 8436f67a2, changed lines 685, under the 3000 threshold). Each ran with stdin from /dev/null and its exit code was captured before any pipe. 106 exited 0. check:skill-examples first exited 3 (client-react not built); after a client-react closure build it was rerun with exit 0. check:dual-build-cjs-loads exited 3 (needs a repo-wide build, 42 packages have no dist), recorded NOT MEASURED and left to Lint & Repo Gates. --ran with ':: exit' codes: 108 accounted, 107 run, 1 NOT-MEASURED (DERIVED from exit 3). check-platform-checklist --changed-from origin/main exit 0 (25 anchors judged, 0 lost). CI check-runs on e10b14b31: not read in this run, in_progress at report time; pnpm lint, test:repo and the dogfood shards are left to CI.",
      "dogfood_battery": "n/a — no `!` in the PR title and no (narrowing) arm",
      "mcp_calls": "0",
      "api_writes": "1 — POST repos/objectstack-ai/objectstack/issues/33228/comments (this os-dev-report, via post-stamped.mjs); git push x3 is not a REST write",
      "open_questions": [],
      "security_findings": "none",
      "out_of_scope_findings": [
        "carrier: repo:cloud#5 (seat) · no explicit admin audit row for a removal (review#1 escalated it to a follow-up card); noted, not filed",
        "carrier: #34183 · a person who signs in while the host is asked to cancel is kept, and no compensating call follows; unchanged, noted, not filed",
        "carrier: #33187 · Setup → Users invitation status source (host seam member versus cloud's sys_env_member_request); noted, not filed",
        "carrier: none · with ruling A, a removal whose host call fails (host_failed) removes the person locally while the host may still hold a live invitation. The answer says host_failed and the docs say so; recorded in Acceptance notes, not a defect under the ruling"
      ]
    }
  9. objectstack-fleet commented on Nov 16, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:cloud#5 · hotlong · session_01Q4EjjPP1zuWBNq3nBXVei9
    os-dev-report

    {
      "issue": 33228,
      "status": "done",
      "branch": "claude/project-thread-32vsaq",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/34162",
      "session": "session_01Q4EjjPP1zuWBNq3nBXVei9",
      "premise_still_valid": true,
      "summary": "Delta-review round pushed as one normal commit, 1f9b39d26, on the PR branch. GitHub reports the PR clean, so main was not merged again. S1: takeBackPerson takes pendingOnly for the remove door. It re-reads the person inside the unit of work, then deletes the sys_user row with where { id, source: 'idp_pending' }, multi: true. That is a predicate delete, which honours deleteBehavior like the by-id one (engine-delete-and-aggregate.ts #26871 arm). A zero-row delete throws NoLongerPending, so the child deletes roll back and the answer is the existing 409 'signed in meanwhile' sentence. The add's take-back keeps its by-id delete. S2 (fail closed): host_failed on the remove door now answers 503 SERVICE_UNAVAILABLE with PENDING_SSO_MESSAGES.removeHostUnreachable; the person is kept and nothing is re-sent. The docs, ledger note, changeset and PR body are updated to match. N1: takeBackPerson's doc and throw text now hold for both callers. N2: isDeactivated reads true, 1, '1' and 'true'; it stays module-private because pending-sso-users.ts is star-exported from the package index, and is pinned through the re-add door. N3 is moot: with S2, a host call that was asked but not confirmed can no longer reach removalNotDone (the host is either told, or not called when no host is wired). removeHostUnconfirmed was therefore dead code and is deleted rather than reworded, and its test is replaced by the S2 test. Size is now 11 files, +705/-34 = 739 changed lines, nothing generated, still under 3000 and no governed surface. The PR body file is updated; the PR was not PATCHed, and is still draft with no reviewers and no labels.",
      "tests": "At 1f9b39d2606: plugin-auth full suite Test Files 279 passed (279), Tests 5667 passed | 10 skipped (5677), lock VERDICT command-exit 0. plugin-auth typecheck exit 0. pending-sso-users.test.ts: 74 passed. New tests: a first sign-in flipped inside the unit of work (at the first child delete, after the pending read) is kept with 409; an unreachable host gives 503, the person is kept, the host is asked once and nothing is re-sent; a banned column reading '1' or 'true' gets host.reason 'deactivated' on a re-add. Removed: the 'not confirmed' test and the host_failed-proceeds test. Eight ablations through scripts/ablation-replace.mjs in wrap mode under the lock. Each anchor hit 1->0, each run went red, and each was restored with blob == HEAD (149f1acb82a7 for pending-sso-users.ts, 076335cfbc6d for environment-user-host.ts) and an empty git diff HEAD. Failures per ablation: row-delete-predicate 1, host-failed-refusal 1, banned-string-forms 1, pending-pre-read 1, fallback 1, s1-guard 2, inline-reinvite 2, reinvite-not-deactivated 1. The first banned-string-forms attempt was a no-op: ablation-replace refused it because a bare ';' replacement was not distinct, so nothing ran; it was redone with a distinct replacement and went red. The suite imports source, so there is no dist leg.",
      "gates": "dispatch-gates --commands --repo objectstack-ai/objectstack at 1f9b39d2606 derived 108 families (11 paths, merge base 8436f67a2, 739 changed lines). Each ran with stdin from /dev/null and its exit code was captured before any pipe. 106 exited 0. check:skill-examples first exited 3 (client-react not built in the fresh worktree); after the client-react closure build it was rerun and exited 0. check:dual-build-cjs-loads exited 3 (needs a repo-wide build) and is NOT MEASURED locally. --ran with ':: exit' codes: 108 accounted, 107 run, 1 NOT-MEASURED (derived from exit 3). check-platform-checklist --changed-from origin/main exit 0 (25 anchors, 0 lost). PR check-runs on 1f9b39d26: 38 success, 15 skipped, none failed. Lint & Repo Gates (which covers dual-build-cjs-loads), TypeScript Type Check, Test Core, Build Core, Check Changeset and Governed Surface Queue Guard are all success.",
      "dogfood_battery": "n/a — no `!` in the PR title and no (narrowing) arm",
      "mcp_calls": "0",
      "api_writes": "1 — POST repos/objectstack-ai/objectstack/issues/33228/comments (this os-dev-report, via post-stamped.mjs); git push x1 is not a REST write",
      "open_questions": [],
      "security_findings": "none",
      "out_of_scope_findings": [
        "carrier: repo:cloud#5 (seat) · the remove door writes no explicit admin audit row (review#1 escalation); noted, not filed",
        "carrier: #34183 · a person who signs in while the host is asked to cancel is kept, and no compensating call follows; unchanged, noted, not filed",
        "carrier: #33187 · where Setup → Users reads invitation status from; noted, not filed"
      ]
    }
  10. objectstack-fleet commented on Nov 16, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:cloud#5 · hotlong · session_01Q4EjjPP1zuWBNq3nBXVei9
    os-dev-report

    {
      "issue": 33228,
      "status": "done",
      "branch": "claude/project-thread-32vsaq",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/34162",
      "session": "session_01Q4EjjPP1zuWBNq3nBXVei9",
      "premise_still_valid": true,
      "summary": "Final round pushed as one normal commit, 2e868fa7e24, on the PR branch. 1) The claims now match what the engine delivers. The takeBackPerson and runRemoveSsoUser docblocks, the auth route ledger note, the docs paragraph, the changeset and the PR body file say the person is re-checked inside the unit of work and the delete carries source: 'idp_pending'. They also say that on an object with cascading lookups the engine re-deletes by id after the cascade, so a first sign-in committing in that narrow window is not yet refused. The code docblock and the PR body cite objectstack#34373. The ledger note, docs and changeset carry no tracker number, per the runtime-text rule. 2) N4: the memory engine has no transaction, so the in-unit test gives it a snapshot transaction. The plugin's real runAtomically seam calls engine.transaction, and on a throw the snapshot restores every table except sys_user, whose change is the concurrent sign-in's commit. The test asserts that the removal entered the seam once and that sys_user_position, sys_user_permission_set and sys_member rows survive NoLongerPending. This proves the door's rollback path against the seam; it does not close the engine window. Size is 11 files, +733/-34 = 767 changed lines, still under 3000. The PR body file is updated; the PR was not PATCHed, and is still draft with no reviewers and no labels.",
      "tests": "At 2e868fa7e24: plugin-auth full suite Test Files 279 passed (279), Tests 5667 passed | 10 skipped (5677), lock VERDICT command-exit 0. plugin-auth typecheck exit 0, after a plugin-auth closure build in the fresh worktree. pending-sso-users.test.ts: 74 passed. Two ablations through scripts/ablation-replace.mjs in wrap mode. takeback-unit-of-work replaced 'await (unit ? unit.runAtomically(work) : work())' with 'await work()': 1 failed, the in-unit test, on 'the removal ran inside the transactional seam: expected +0 to be 1'. row-delete-predicate reduced where { id, source } to { id }: 1 failed, the in-unit test. Both were restored with blob == HEAD d2608bc280f4 and an empty git diff HEAD.",
      "gates": "This round changed prose (a docblock, the ledger note, the docs paragraph, the changeset) and one test. Locally I ran the gate subset that reads those files: 14 of 14 exit 0, exit codes captured before any pipe. They are check:doc-authoring, check:auth-mount-ledger, check-affected-docs, check-drift-comment, check-empty-changeset, check-changeset-no-major, check:nul-bytes, check:issue-citations (pnpm and node forms), check:docs-transcript-drift, check:doc-anchors, check:cross-package-test-inputs, check:engine-double-contract and check:closed-ceremony-text. This is a declared narrowing: the full 108-family derived run with --ran (107 run, 1 NOT-MEASURED) was at the previous head 1f9b39d26, and the full set for this head is left to CI. PR check-runs on 2e868fa7e24 at report time: 33 success, 15 skipped, 4 in_progress, none failed. Lint & Repo Gates, TypeScript Type Check, Build Core, Check Changeset and Governed Surface Queue Guard are success; Test Core is in_progress.",
      "dogfood_battery": "n/a — no `!` in the PR title and no (narrowing) arm",
      "mcp_calls": "0",
      "api_writes": "1 — POST repos/objectstack-ai/objectstack/issues/33228/comments (this os-dev-report, via post-stamped.mjs); git push x1 is not a REST write",
      "open_questions": [],
      "security_findings": "none",
      "out_of_scope_findings": [
        "carrier: objectstack#34373 · the engine's predicate delete on an object with cascading lookups re-deletes by id with no predicate or row lock; filed by the seat, documented here, no workaround",
        "carrier: repo:cloud#5 (seat) · the remove door writes no explicit admin audit row (review#1 escalation); noted, not filed",
        "carrier: #34183 · a person who signs in while the host is asked to cancel is kept, and no compensating call follows; unchanged, noted, not filed",
        "carrier: #33187 · where Setup → Users reads invitation status from; noted, not filed"
      ]
    }
  11. objectstack-fleet commented on Nov 16, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:cloud#5 · hotlong · session_01Q4EjjPP1zuWBNq3nBXVei9

    Closed by PR #34162 (merged), reshaped to ruling A: the remove door, userRemoved with its fallback, the S1 in-door half, the inline re-invite, and fail-closed on host_failed; no framework outbox. Residual engine window: objectstack#34373. pm:dispatched removed. Cloud picks the door up at its next pin move; cloud's host can implement userRemoved on its existing cancel operation then.

  12. removed
    pm:dispatched
    on Nov 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

domain:serverpriority:p1

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions