Repository navigation
Description
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
维护者速读
- 现象:控制台 AI 对话里,凡是需要人工确认的动作,点「确认」都报
Approval failed: HTTP 403,动作不执行,7 天后自动失效;点「拒绝」同样失败。控制台的「AI 审批」页(system/ai-approvals)调的是同一个接口,按代码推断也会失败。 - 原因: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 在 11-17 已经裁定「Bearer 头携带的登录会话也算本人会话」(Q1 选 A),framework 也在 feat(spec,runtime): an AI route's req.user carries impersonatedBy and the admitting credential kind #34736 里把凭据类型放进了
req.user.credential。但 cloud 的审批接口没有跟进,仍按 11-16 的临时做法读请求头,只要有Authorization头就返回 403。前端 fix(ui): plugin same-server reads and me/localization carry the stored bearer #37489(11-26)按裁决给审批请求带上了 Bearer,两边一碰,审批必然 403。 - 要你裁:由哪一边改,以及是否先止血。
- 推荐:A,cloud 审批接口改读
req.user.credential,落实 11-17 的裁决,前端不动。
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
- 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.tsdecides by reading request headers. AnyAuthorizationheader returns pathauthorization(line 85), and the approve and reject routes answer403 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. - 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 assession. The stated reason is that split-origin console users must be able to approve their own items. Q2 → A:impersonatedByreaches 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'sreq.user(AIRouteUser). The planned cloud follow-up card was never filed, and cloudorigin/mainstill reads headers. - 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).
useHitlInChatandusePendingActionsnow send through the host'sapiFetch(createAuthenticatedFetch). It setsAuthorization: Beareron 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. - 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.tsxfakes a server that accepts the bearer, and cloud's tests pin the header rule. - Why the card only says "HTTP 403". The route answers
{ success: false, error: { code, message, details } }.useHitlInChatshowspayload.erroronly when it is a string, so it falls back toApproval failed: HTTP ${status}. The approvals page (usePendingActions) already readserror.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
useHitlInChat: show the server's reason, mapped fromerror.details.reasonto a localized sentence, instead ofHTTP 403; a failed reject should not say "Approval failed".- The
headersoption comments inuseHitlInChat/usePendingActionsuseAuthorizationas the example; under the current cloud door that example always fails. Fix or drop it. - Add a cross-repo contract test (front-end decide request against the real cloud gate), so the two sides cannot both be green while production fails.
@objectstack/clientai.pendingActions.approve/rejectwith an API key stays refused under every option. That is intended (cloudai-route-ledger.ts, Docs: deciding an in-app AI pending action takes the person's own session — the skill, client-sdk.mdx and the pendingActions docblock still teach the token route #34189) and needs no change.
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
os-bob commentedon Dec 2, 2026
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
service-ai/src/routes/pending-action-credential.ts) readsreq.user.credentialinstead of request headers: admitsession(cookie- or Bearer-carried), refuseapi_key/oauth, refuse a session carryingimpersonatedBy, keep refusing the forward credentials, and drop theAuthorization-header rule. A missingcredentialis 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 → 403pending_action_session_requiredbefore the row is read, another member's item → 404), then ship a cloud release. Framework facts you need are already onmain:AIRouteUser.credential?: AIRouteCredentialKindandAIRouteUser.impersonatedBy?inpackages/spec/src/contracts/ai-service.ts, populated bypackages/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", theAuthorizationexample in theheaderscomments) are taken in a separate framework PR that will reference this card; they do not block the cloud change.Generated by Claude Code
objectstack-fleet commentedon Dec 2, 2026
triage@os-warren · os-warren · session_01JQwxbZzZ2f5mzcvJbRrRNZ
First touch · 2026-12-02T07:12Z
定级:
area:ai · Bug · p1 · 生产控制台里每次 AI 确认/拒绝都 403,动作不执行 · 用户截图 + 两侧读码pm:queue保留。objectstack-fleet commentedon Dec 2, 2026
repo:objectstack@os-bill · os-bill · session_01Utp6CaQsbKBMQtm6Tpsamd
Route · 2026-12-02T22:27Z · this
repo:cloudcard is for seatrepo:cloud@zhuangjianguo(mailbox #39180), not for seatrepo: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 seatrepo:objectstack@os-bill. Labels and assignee are unchanged; that seat claims it from its own intake.objectstack-fleet commentedon Dec 2, 2026
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_01TsNV8Bsjqmw7aXCo2QuLU1Account:
zhuangjianguoBranch:
claude/issue-39049-pending-action-credentialWorktree:
w39049/cloud-issue-39049Domain:
domain:cloudSeat:
repo:cloud#3File 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.tsin objectstack-ai/cloudservice-airefuses any request that carries anAuthorizationheader, so it refuses a Bearer-carried session against the #34184 ruling | the framework already exposesreq.user.credential(#34736) | every console user confirming or cancelling an in-app AI actionThread-read: 7360720750
Premise: measured (verification run for #32749, dev report 7361114659: approve and reject answer 403
pending_action_session_requiredwithcredential authorization; a cookie-only request answers 200)Serial constraints cleared: none
objectstack-fleet commentedon Dec 2, 2026
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." ] }os-bob commentedon Dec 3, 2026
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