Skip to content

In-app AI approve/reject answer 403 to every console session: the cloud pending-action gate still refuses a Bearer-carried session, against the #34184 ruling #39049

Done

Description

@baozhoutao

Filing gate: ② a decision only the maintainer can make (which side moves, and whether to stop the bleeding first). Source: a production console, measured by the user (screenshot) and read in code on framework origin/main and cloud origin/main.
Grading: area:ai · domain:server · needs-user-decision · p1 suggested (every in-app AI confirmation fails) · evidence: symptom observed, cause read in code, not yet packet-captured.
Related: #33809, #34184 (ruling 2026-11-17), #34736, #37225 / #37489, #37509 / #38360

维护者速读

What happens

In the console's AI chat, an action that needs the person's confirmation (seen with the sys_notification "send in-app message" action) shows the confirmation card. Pressing Confirm shows Approval failed: HTTP 403; the card stays "waiting for confirmation", nothing runs, and the item lapses after 7 days. Reject fails the same way and also says "Approval failed".

Why

  1. cloud, 2026-11-16 (de73dec5d, cloud#4607, for cloud: service-ai pending-action approve/reject routes follow the AI-door confirmation rule (#33689 Q1 ruled B) #33809). service-ai/src/routes/pending-action-credential.ts decides by reading request headers. Any Authorization header returns path authorization (line 85), and the approve and reject routes answer 403 PERMISSION_DENIED, details.reason: pending_action_session_required, before the row is read. Its own comment calls header reading a stopgap until the framework says which credential admitted the caller, and notes the impersonation gap carried by AI routes: req.user carries the session's impersonatedBy and the admitting credential kind, so a person-only door can tell who is acting #34184.
  2. framework, 2026-11-17: the ruling and the field. AI routes: req.user carries the session's impersonatedBy and the admitting credential kind, so a person-only door can tell who is acting #34184 ruled Q1 → A: the admitting credential stays session | api_key | oauth, and a login session carried in a Bearer header counts as session. The stated reason is that split-origin console users must be able to approve their own items. Q2 → A: impersonatedBy reaches the gate unchanged and the gate judges it. feat(spec,runtime): an AI route's req.user carries impersonatedBy and the admitting credential kind #34736 (merged 11-17) puts both on the AI route's req.user (AIRouteUser). The planned cloud follow-up card was never filed, and cloud origin/main still reads headers.
  3. framework, 2026-11-26 (fix(ui): plugin same-server reads and me/localization carry the stored bearer #37489, for Plugin packages' same-server reads stay cookie-only and break under a bearer-only session: the #37080 family outside app-shell and the console (16 files), plus two app-shell reads the #37185 ratchet does not see #37225). useHitlInChat and usePendingActions now send through the host's apiFetch (createAuthenticatedFetch). It sets Authorization: Bearer on every /api/ call when a token is stored, which a normal sign-in does. This matches the ruling. feat(auth): trust the configured server origin on sameOriginOnly fetches (split-origin console) #38360 (11-28) extends the same thing to a split-origin console's configured server origin. Shipped in 19.0.0-next.0 through next.3.
  4. Result. The front end follows the ruling and the cloud door does not, so every in-app approve and reject is refused. Each side's tests are green: rendererFetch.bearerSession-37225.test.tsx fakes a server that accepts the bearer, and cloud's tests pin the header rule.
  5. Why the card only says "HTTP 403". The route answers { success: false, error: { code, message, details } }. useHitlInChat shows payload.error only when it is a string, so it falls back to Approval failed: HTTP ${status}. The approvals page (usePendingActions) already reads error.message.

Ruled out: a non-proposer gets 404, not 403. The other refused paths (no cookie, action-forward, admin session token) are checked after authorization, and a same-origin console sends none of them. A gateway 403 cannot be excluded from code alone; the response body's error.details.credential ("authorization" expected) settles it.

The question

Which side moves, and is a stopgap shipped first?

Option What changes What users see Cost
A (recommended) cloud: the approve/reject gate reads req.user.credential (admit session, refuse api_key / oauth), refuses a session with impersonatedBy (closes the known gap, Q2 A), and keeps refusing the forward headers. Delete the header-reading of Authorization. Front end unchanged. Approve and reject work on same-origin and split-origin consoles, cookie or bearer session. API keys, OAuth/MCP tokens and impersonating admins are still refused. Small, one cloud module and its tests. Needs a cloud release.
B framework: approve/reject go out without the bearer (a host-supplied cookie-only fetch that keeps X-Tenant-ID, Accept-Language, the 401 handling and trustedOrigin). cloud unchanged. Same-origin cookie users can approve again. Bearer-only and split-origin users still cannot, which contradicts the 11-17 ruling and reverts part of #37225 / #38360. Medium; tests from #37489 and #38360 must be reversed.
C B now as a stopgap, then A, then undo B. Same-origin users recover at the next UI release; everyone after A. Both costs, plus a revert.

Recommendation: A. The ruling already exists; the cloud door is the only piece that did not follow it, and A fixes split-origin users too. C only if a framework UI release would reach users well before a cloud release.

Independent of the choice

Acceptance (for A)

  • A same-origin console session (cookie plus stored bearer) approves and rejects its own item: 200.
  • A bearer-only session (no cookie) approves its own item: 200.
  • An API key, an OAuth/MCP token, a forward credential, and an impersonated session are each refused 403 pending_action_session_required, before the row is read.
  • Another member's item: 404, unchanged.

Activity

  1. added
    needs-user-decision
    on Dec 2, 2026
  2. os-bob commented on Dec 2, 2026

    @os-bob
    Contributor

    Ruled. bob (os-bob) chose an option in this project's thread for #39049 at 2026-12-02T06:20:08Z. Option text verbatim: 「A」. Follow-up instruction at 06:20:46Z, verbatim: 「通知 cloud 座位处理」.

    Ruled: A

    • A: the cloud approve/reject gate (service-ai/src/routes/pending-action-credential.ts) reads req.user.credential instead of request headers: admit session (cookie- or Bearer-carried), refuse api_key / oauth, refuse a session carrying impersonatedBy, keep refusing the forward credentials, and drop the Authorization-header rule. A missing credential is refused (fail closed). Front-end request shape unchanged. No stopgap (option C is not taken).

    Cloud seat (repo:cloud): this card is yours. Step: implement A in cloud with the four acceptance cases in the body (cookie+bearer session → 200, bearer-only session → 200, API key / OAuth-MCP token / forward credential / impersonated session → 403 pending_action_session_required before the row is read, another member's item → 404), then ship a cloud release. Framework facts you need are already on main: AIRouteUser.credential?: AIRouteCredentialKind and AIRouteUser.impersonatedBy? in packages/spec/src/contracts/ai-service.ts, populated by packages/runtime/src/domains/ai.ts (#34736). Transfer this card to the cloud repo if you prefer it to live there.

    The framework-side items under "Independent of the choice" (show the server's reason instead of HTTP 403, a failed reject no longer saying "Approval failed", the Authorization example in the headers comments) are taken in a separate framework PR that will reference this card; they do not block the cloud change.


    Generated by Claude Code

  3. added
    area:ai
    domain:cloud
    pm:queue
    repo:cloud
    and removed
    needs-user-decision
    on Dec 2, 2026
  4. objectstack-fleet commented on Dec 2, 2026

    @objectstack-fleet
    Contributor

    triage@os-warren · os-warren · session_01JQwxbZzZ2f5mzcvJbRrRNZ

    First touch · 2026-12-02T07:12Z

    定级:area:ai · Bug · p1 · 生产控制台里每次 AI 确认/拒绝都 403,动作不执行 · 用户截图 + 两侧读码

    • 按卡上建议定 p1;已于 2026-12-02T06:20Z 裁定 A(「通知 cloud 座位处理」),改动在 cloud 审批门。补类型 Bug,pm:queue 保留。
  5. added
    priority:p1
    on Dec 2, 2026
  6. objectstack-fleet commented on Dec 2, 2026

    @objectstack-fleet
    Contributor

    repo:objectstack@os-bill · os-bill · session_01Utp6CaQsbKBMQtm6Tpsamd

    Route · 2026-12-02T22:27Z · this repo:cloud card is for seat repo:cloud@zhuangjianguo (mailbox #39180), not for seat repo:objectstack@os-bill, which has no cloud repository access. Provenance: who = the maintainer (Bill, os-bill); words, verbatim: 「cloud 相关的任务让 jerry 接手」 (2026-12-02T21:53Z), 「jerry 有 cloud 仓库的访问权限,你没有」 (2026-12-02T21:54Z) and 「jerry 信箱:信箱:objectstack#39180,标题「pm:mailbox — repo:cloud@zhuangjianguo · zhuangjianguo」。」 (2026-12-02T22:26Z); where = the fleet project of seat repo:objectstack@os-bill. Labels and assignee are unchanged; that seat claims it from its own intake.

  7. objectstack-fleet commented on Dec 2, 2026

    @objectstack-fleet
    Contributor

    repo:cloud#3 · zhuangjianguo · session_01TsNV8Bsjqmw7aXCo2QuLU1

    Claim: PM loop round 5 · 2026-12-02T22:46Z
    Ruling-ref: 「A」 with 「通知 cloud 座位处理」 (2026-12-02T06:20Z, recorded on this card). The cloud approve/reject gate reads req.user.credential. Routed to this seat by repo:objectstack@os-bill on the maintainer's 「cloud 相关的任务让 jerry 接手」.
    Session: session_01TsNV8Bsjqmw7aXCo2QuLU1
    Account: zhuangjianguo
    Branch: claude/issue-39049-pending-action-credential
    Worktree: w39049/cloud-issue-39049
    Domain: domain:cloud
    Seat: repo:cloud#3
    File surface: packages/service-ai/src/routes/pending-action-credential.ts, packages/service-ai/src/routes/ (reason: the approve and reject doors that call the gate; the fix lands in objectstack-ai/cloud)
    Container & model: S, mode:subagent, model: default (dispatch-gates --tier: no mandate), effort: high (reason: an authorization gate on the AI write path; security fix)
    Clause-②: no
    Metadata-protocol: none
    Responsibility: pending-action-credential.ts in objectstack-ai/cloud service-ai refuses any request that carries an Authorization header, so it refuses a Bearer-carried session against the #34184 ruling | the framework already exposes req.user.credential (#34736) | every console user confirming or cancelling an in-app AI action
    Thread-read: 7360720750
    Premise: measured (verification run for #32749, dev report 7361114659: approve and reject answer 403 pending_action_session_required with credential authorization; a cookie-only request answers 200)
    Serial constraints cleared: none

  8. added
    pm:dispatched
    and removed
    pm:queue
    on Dec 2, 2026
  9. objectstack-fleet commented on Dec 2, 2026

    @objectstack-fleet
    Contributor

    repo:cloud#3 · zhuangjianguo · session_01TsNV8Bsjqmw7aXCo2QuLU1
    os-dev-report

    {
      "issue": 39049,
      "status": "done",
      "branch": "claude/issue-39049-pending-action-credential",
      "pr": "https://github.com/objectstack-ai/cloud/pull/5393",
      "session": "session_01TsNV8Bsjqmw7aXCo2QuLU1",
      "premise_still_valid": true,
      "summary": "Ruling A implemented in objectstack-ai/cloud (draft PR 5393, head bb23e489e, base f9ac419f9). Pin b706ec6e confirmed: AIRouteUser.credential / impersonatedBy are declared in packages/spec/src/contracts/ai-service.ts and set by packages/runtime/src/domains/ai.ts from admittingCredentialKind (session whether cookie- or Bearer-carried), and cloud's route wrapper keeps both (spread). The gate (service-ai routes/pending-action-credential.ts) now reads req.user: admits credential 'session' with no impersonatedBy; refuses 403 pending_action_session_required before the row with details.credential api_key | oauth | forward_credential | action_forward | admin_session_token | impersonated | no_credential (fail closed); the Authorization-header rule and the no-cookie rule are gone. RouteUserContext gains impersonatedBy plus a tsc guard binding both keys to AIRouteUser; prose in the route docblock, AI route ledger and two confirmation comments follows; changeset service-ai patch. Front end unchanged. Live headless-console Confirm/Cancel check NOT MEASURED (rig cost); instead the real-auth tenant-kernel e2e now sends approve as cookie+Bearer (the console's exact shape) -> 200 executed and reject bearer-only -> 200.",
      "tests": "head bb23e489e. New service-ai src/__tests__/pending-action-credential-39049.test.ts: framework HttpDispatcher.dispatch() (real identity step) -> real buildPendingActionRoutes -> real AIService queue; 'Test Files 1 passed (1) Tests 26 passed (26)': cookie+bearer -> 200 and bearer-only -> 200 (approve and reject), API key / key beside cookie / OAuth agent / forward credential / action forward / impersonated (cookie and bearer) -> 403 with engine.find count unchanged and row pending, other member -> 404, no stated credential -> 403 no_credential. objectos-runtime assistant-api-action-door.e2e (real better-auth): 'Tests 9 passed (9)'. Pending-action suites after fixture triage (eight suites re-spelled to carry credential 'session'; one meaning change: no-user approve/reject now 403 before the row, was 404): 'Test Files 11 passed (11) Tests 312 passed (312)'; full service-ai 'Test Files 219 passed (219) Tests 3369 passed (3369)'. Ablation (old Authorization line re-inserted on disk, service-ai rebuilt, reached dist as proven by the e2e 403 body details.credential 'authorization'): unit 'Tests 11 failed | 49 passed (60)' all Bearer-carried-session cases, bearer-only included; e2e 'Tests 1 failed | 8 passed (9)' 'expected 403 to be 200'; restored by git checkout HEAD -- FILE, blob hash == HEAD, git diff HEAD empty, rebuilt, ablated rule count 0 in dist/index.js.",
      "gates": "cloud AGENTS.md item 13, BASE f9ac419f9: (1) turbo run typecheck --filter=...[BASE] on bb23e489e: 'Tasks: 29 successful, 29 total', VERDICT command-exit 0. (2) dry json + tier.mjs select: scope affected, filters objectos / objectos-runtime / cloud / objectos-ee, 37 periodic files kept. (3) CLOUD_TEST_TIER=gate + KEEP, turbo run test --filter=...[BASE] FILTERS at 46d86c12f: 11 packages, 1331 files, 20461 tests green (service-ai 219/3369 re-run after fixing ai-approvals-account-nav fixture, the one red found; service-ai-studio 88/1430; organizations 2/29; ee-group-showcase 5/47; security-enterprise 104/1587; ee-tenant-crm-showcase 1/12; service-cloud 416/7655; objectos-ee 48/540; objectos-runtime 285/3829; objectos 61/606 and cloud 102/1357 re-run per package because the turbo run hit the 10-minute container ceiling: declared narrowing). Later commits touch only service-ai tests, the changeset and the e2e file (re-run at head, 9 passed). check:all on bb23e489e: 'phase pre: 41 guards · 41 passed · 0 failed', 'phase framework: 1 guards · 1 passed · 0 failed', 'phase post: 4 guards · 4 passed · 0 failed', each exit 0. Control-byte self-scan on changed files: no hit. CI: test.yml jobs skip on pull_request by design (AGENTS.md item 7); no CI conclusion cited, report delivered before CI per contract.",
      "mcp_calls": "0",
      "api_writes": "3 — git push (branch, not REST); fleet-write relay pr_create on objectstack-ai/cloud (POST /repos/objectstack-ai/cloud/pulls draft + POST /repos/objectstack-ai/cloud/issues/5393/assignees, read back identical, assignee zhuangjianguo); post-stamped os-dev-report comment POST /repos/objectstack-ai/objectstack/issues/39049/comments. Reads: single-card REST reads of objectstack#39049, its comments and the #32749 report comment.",
      "classifier_refusals": [],
      "open_questions": [
        {
          "question": "The claim's Clause-② line says 'no', copied verbatim into the PR and changeset (bump: patch). The change also narrows two callers: an impersonating administrator (was admitted by cookie, now 403 impersonated) and a caller with no stated credential (now 403). Both are inside the ruling's text; does the seat want the line re-graded as narrowing?",
          "options": ["A keep 'Clause-②: no' (the impersonation refusal closes a gap the 33809 changeset already declared as known; anonymous never reaches the handler)", "B re-grade to 'yes (narrowing)' and bump minor"],
          "recommendation": "A, because the 33809 contract already named impersonation as not the person and no production caller reaches the door without a credential; but it is the seat's grade to own, not mine."
        }
      ],
      "security_findings": "none",
      "out_of_scope_findings": [
        "carrier: objectstack-ai/objectstack#32749 · noted, not filed: the live console Confirm/Cancel click (headless Chrome on the #32749 rig) was not run here; that card already plans the one-click re-check after a cloud release carries this fix.",
        "carrier: none · noted, not filed (ruling consequence, in Acceptance notes): a request with the person's own cookie plus an unrelated bearer the route does not honour is now admitted as the person's session, because the door reads which credential admitted the caller; the old header rule refused it."
      ]
    }
  10. removed
    pm:dispatched
    on Dec 3, 2026
  11. os-bob commented on Dec 3, 2026

    @os-bob
    Contributor

    Follow-up: the production check this card could not measure (live console Confirm/Reject after the cloud release) is filed as maintainer card #39276.


    Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:aidomain:cloudpriority:p1repo:cloud

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions