Skip to content

feat(spec)!: one pending-confirmation service for every AI door, the in-app pending-action queue leaves IAIService - #38273

Merged
os-zhuang merged 4 commits into
mainfrom
claude/project-thread-thpyr7
Nov 28, 2026
Merged

os-zhuang merged 4 commits into
mainfrom
claude/project-thread-thpyr7

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Sales · project thread

Refs #33806

Clause-②: yes (narrowing)
Metadata-protocol: none
Skills-docs: changes with step 3 of #33806 — skills/objectstack-ai/SKILL.md, content/docs/ai/actions-as-tools.mdx (the runtime answer changes there; Tier H then)

维护者速读

  • 用户能看到什么变化:用户无感。这是四步里的第一步,只改平台的规范契约:应用内助手和外部 AI 两条「待本人确认」的登记通道合成一个服务,界面、客户端、云端和文档在后面三步跟着改。
  • 为什么做:你在决策卡上选了「现在合并成一套」,赶在 v19 正式版之前把这次不兼容改动做掉,以后改确认规则只写一处。
  • 出错会怎样:只有自己实现过平台确认服务、或直接读旧答案字面量的宿主代码会编译不过,升级说明和迁移条目写了逐项改法;写应用元数据的人不受影响;本 PR 可整体撤回。
  • 要你做什么:契约审核档评审通过后,由你批准合并(这次是收窄性改动,按 Tier H 走)。

What changes

Step 1 of 4 of #33806 (maintainer ruling 7237978621, option A): the spec contract only. UI and SDK, cloud storage and routes, and docs are steps 2–4, each its own card.

  • packages/spec/src/contracts/ai-service.ts
    • IActionConfirmationService (still registered under ACTION_CONFIRMATION_SERVICE, 'ai.actionConfirmation') is the ONE pending-confirmation service for every AI door and carries the whole lifecycle: submit (unchanged), list, get, approve, reject, all required. The three deciding points (only the person the call ran as decides, only on a signed-in session, the call runs as that person with every gate re-checked) and the held outcome are stated on the service's members. The decider is the context: ExecutionContext passed in (it was an actorId string on the queue).
    • ActionConfirmationHandOff gains optional toolName, conversationId, messageId for an in-app item; door is mcp or assistant.
    • The service docblock says how a hand-off from every door becomes a PendingActionRow (row shape unchanged): tool_name is the tool the call was made through (the model's tool on an in-app item; run_action, or resume_run when the hand-off carries a run, on an MCP item); tool_input is that call's input as JSON, so the record, the namespace and the run ride there and get no column; object_name is the empty string for an action on no object; the door is not on the row (the host approves from the hand-off it kept).
    • Rule 1 of the confirmation contract now says every door hands off to the same service, the in-app door never eliciting.
    • New types ActionConfirmationListFilter, ActionConfirmationApproveOutcome.
    • IAIService loses proposePendingAction, approvePendingAction, rejectPendingAction, listPendingActions; ProposePendingActionInput is removed.
    • PendingActionStatus (six states, held included, no expired: a lapse stays the host's to define) and PendingActionRow keep their shape and now describe the service's items.
    • The confirmation contract's in-app section now reads "the same rule, the same channel": the in-app door hands off through submit with door: 'assistant' and answers ActionConfirmationPending (pending_confirmation + pendingId). A new paragraph retires the pending_approval + pendingActionId answer and states that a reader of stored conversations reads it through the SAME recogniser that reads pending_confirmation (pendingActionId taken as pendingId), with no second reader. "Its bounds" and "When it binds" are updated (the FROM half of the merge is named).
  • packages/spec/src/api/protocol.zod.ts: comments only. The /api/v1/ai/pending-actions route schemas are unchanged; they now front the pending-confirmation service.
  • packages/spec/src/kernel/execution-context.zod.ts: performedBy.confirmationId describes one store (TSDoc + .describe), regenerated into content/docs/references/kernel/execution-context.mdx.
  • packages/spec/src/migrations/entries/semantic/19.ai-pending-action-queue-merged-into-confirmation-service.ts: the D3 entry, FROM → TO per member.
  • Generated: api-surface/contracts.json, export-origins/contracts.json (+2 ActionConfirmation* interfaces, −ProposePendingActionInput).
  • Tests: ai-service.test.ts re-points the held-outcome and deciding-point pins to the service members and adds type pins (IAIService declares none of the four members; the service's keys are exactly the five; a submit-only service is refused); action-confirmation-contract.pin.test.ts follows the prose; ai-store-caller-context.pin.test.ts re-points the inbox read to list/get (context required).
  • ui/packages/plugin-chatbot/src/usePendingActions.ts: one comment re-pointed from the retired IAIService.proposePendingAction / .listPendingActions to IActionConfirmationService.list / .get (ui's check:spec-symbols reads spec members cited in comments and went red on bf6f12e; AGENTS.md: a removal that breaks ui/ ships with the ui/ fix). Comment only; not a file open PR fix(plugin-chatbot): a lapsed AI pending action reads Expired, not Rejected, in the AI Approvals inbox and the chat card #38246 edits.
  • Changeset .changeset/33806-pending-confirmation-service-one-seam.md: @objectstack/spec patch, BREAKING banner, FROM → TO table, adr-0087: registered.

Shape decisions taken by this thread (no product call; the seat accepted them, the row mapping after the first contract review): extend the existing service rather than a new service name; keep the row, status and route shapes so ui/ does not move in this PR; state the hand-off → row mapping in words instead of making object_name / tool_name optional (which would move the console inbox, the file open PR #38246 edits); no new spec export for the retired literal.

Why

The maintainer ruled the merge now, inside the open 19 prerelease window (@objectstack/spec 19.0.0-next.2), so the breaking change lands before 19.0.0 and a confirmation rule lives in one place.

Acceptance notes

  • Premise check (ruling's step-1 condition): open PR fix(plugin-chatbot): a lapsed AI pending action reads Expired, not Rejected, in the AI Approvals inbox and the chat card #38246 (Console AI approvals: show a lapsed pending action as Expired, not Rejected, in the chat card and the AI Approvals inbox #34255, head e3c122b) touches only ui/** and its own changeset; this PR touches packages/spec/**, its generated docs page, one ui/ comment (usePendingActions.ts) and a changeset. Zero overlap.
  • ui/ imports PendingActionRow, PendingActionStatus and the AiPendingAction* response types from spec and none of the four retired members (git grep over ui/, packages/client), so the removal does not red Type Check UI; packages/runtime uses IActionConfirmationService only to cast and call submit.
  • The 18 D3 entry in-app-pending-action-decided-by-person still names the old members: it is 18's record and is left as written.
  • ADR-0011's revision note ("Merging the two seams was not ruled") is now stale; it is docs/adr/** and belongs to step 4. The docs-drift comment's list (content/docs/ai/actions-as-tools.mdx and the pages that merely share a field name such as messageId) is the docs step's too.
  • Contract review round 1 (7238295862, FAIL) answered at 5d82277: M1 row mapping (above), S1 rule 1, S2 the Skills-docs: line, N1 the { id } → { pendingId } answer in the changeset's FROM → TO table.

Verification

Local, at head 5d82277 unless a line says otherwise (ff98353 adds the ui/ comment only; node ui/scripts/check-spec-symbol-derivation.mjs exit 0 there):

  • pnpm --filter @objectstack/spec build — VERDICT command-exit 0.
  • pnpm --filter @objectstack/spec check:generated --fix — at bf6f12e 3 stale (api-surface, export-origins, docs) regenerated; at 5d82277 none stale.
  • pnpm --filter @objectstack/spec check:test-typecheck and vitest run src/contracts src/migrations — Test Files 62 passed, Tests 719 passed (VERDICT command-exit 0).
  • Derived gate list (dispatch-gates.mjs --commands, 117 commands), full run 11:11–11:53Z (ff98353, a ui/ comment only, was committed during it): 109 exit 0, 1 exit 1, 7 exit 3. All eight non-zero were PREREQUISITE, not findings: the CLI migrate-meta-engine-guidance test (exit 1) could not load the unbuilt @objectstack/lint dist, and seven gates refused on missing built output. After pnpm turbo run build (exit 0) at ff98353, seven of them were re-run there and all exit 0: migrate-meta-engine-guidance (3 tests passed), check:doc-formula-expressions, check:doc-security-posture, check:skill-examples (351 examples), check:docs-transcript-drift, check:dual-build-cjs-loads, check:lean-entry-closure. Total 116 of 117 exit 0. One NOT MEASURED locally: check-plugin-teardown-shape --self-test needs an unshallow clone; read from this PR's check-runs.
  • Dogfood, at ff98353 (final head): the CI Dogfood Regression Gate is green there, but its shards were skipped by the PR filter, so it was run locally: pnpm turbo run build --filter=@objectstack/dogfood exit 0, then pnpm turbo run test --filter=@objectstack/dogfood exit 0 (cache miss, executed): Test Files 491 passed, 3 skipped; Tests 4148 passed, 68 skipped.

CI families: read from this PR's check-runs.


Generated by Claude Code

@github-actions github-actions Bot added size/l documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 28, 2026
@github-actions

github-actions Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/spec, touching 21 documentable anchor(s). ⚠️ 3 changed file(s) yielded no anchor (packages/spec/api-surface/contracts.json, packages/spec/export-origins/contracts.json, packages/spec/src/api/protocol.zod.ts), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

14 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:

  • content/docs/ai/actions-as-tools.mdx (via actionName (symbol, a field of interface ProposePendingActionInput), conversationId (symbol, a field of interface ActionConfirmationHandOff; a field of interface ActionConfirmationListFilter; a field of interface ProposePendingActionInput), pending_approval (literal, a string literal in a comment in IAIService; a string literal in a comment on a changed line))
  • content/docs/ai/index.mdx (via conversationId (symbol, a field of interface ActionConfirmationHandOff; a field of interface ActionConfirmationListFilter; a field of interface ProposePendingActionInput))
  • content/docs/api/client-sdk.mdx (via conversationId (symbol, a field of interface ActionConfirmationHandOff; a field of interface ActionConfirmationListFilter; a field of interface ProposePendingActionInput))
  • content/docs/frontend/plugins/plugin-chatbot.mdx (via conversationId (symbol, a field of interface ActionConfirmationHandOff; a field of interface ActionConfirmationListFilter; a field of interface ProposePendingActionInput), messageId (symbol, a field of interface ActionConfirmationHandOff; a field of interface ProposePendingActionInput), toolName (symbol, a field of interface ActionConfirmationHandOff; a field of interface ProposePendingActionInput))
  • content/docs/kernel/contracts/index.mdx (via IAIService (symbol, a top-level interface))
  • content/docs/kernel/runtime-services/email-service.mdx (via messageId (symbol, a field of interface ActionConfirmationHandOff; a field of interface ProposePendingActionInput))
  • content/docs/kernel/runtime-services/push-service.mdx (via messageId (symbol, a field of interface ActionConfirmationHandOff; a field of interface ProposePendingActionInput))
  • content/docs/kernel/runtime-services/queue-service.mdx (via messageId (symbol, a field of interface ActionConfirmationHandOff; a field of interface ProposePendingActionInput))
  • content/docs/kernel/runtime-services/sms-service.mdx (via messageId (symbol, a field of interface ActionConfirmationHandOff; a field of interface ProposePendingActionInput))
  • content/docs/permissions/system-context.mdx (via ExecutionContextSchema (symbol, a top-level const))
  • content/docs/protocol/kernel/realtime-protocol.mdx (via messageId (symbol, a field of interface ActionConfirmationHandOff; a field of interface ProposePendingActionInput))
  • content/docs/protocol/objectui/record-alert.mdx (via actionName (symbol, a field of interface ProposePendingActionInput))
  • content/docs/ui/actions.mdx (via actionName (symbol, a field of interface ProposePendingActionInput))
  • content/docs/ui/apps.mdx (via actionName (symbol, a field of interface ProposePendingActionInput))

⛔ 2 release-owned page(s) also name something this change touched. These are read-only:

  • content/docs/releases/v17/17-0.mdx (via IAIService (symbol, a top-level interface))
  • content/docs/releases/v18/18-5.mdx (via IActionConfirmationService (symbol, a top-level interface))

content/docs/releases/ is RELEASE-OWNED (AGENTS.md "Documentation Guardrails"): release
notes are written centrally at release time, and a code PR that edits them is the exact PR
that guardrail exists to stop. They are still audited — read-only. If one of them is actually
wrong, file an issue or open a dedicated docs-only PR; do not edit it here.

What this run could not see
  • 3 changed file(s) yielded no anchor (packages/spec/api-surface/contracts.json, packages/spec/export-origins/contracts.json, packages/spec/src/api/protocol.zod.ts) — pages documenting those are invisible to this run
  • 1 anchor(s) matched too much of the corpus to be a work list: objectName (symbol, 60 pages)
  • 5 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 69 of 252 client-bound route-ledger rows — the other 183 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 183: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 124 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 177 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json e2a0e90025059d066dff4b067a8b70d23bca2680 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from e0694a083074bbd444f3abdc06adedff181d0689 — the merge of head ff98353378d743b36b4b3dc88998810e91833f92 into base e2a0e90025059d066dff4b067a8b70d23bca2680, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin e0694a083074bbd444f3abdc06adedff181d0689 && git checkout e0694a083074bbd444f3abdc06adedff181d0689
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin e2a0e90025059d066dff4b067a8b70d23bca2680 ff98353378d743b36b4b3dc88998810e91833f92 && git checkout -B drift-repro e2a0e90025059d066dff4b067a8b70d23bca2680 && git merge --no-ff ff98353378d743b36b4b3dc88998810e91833f92

node scripts/docs-audit/affected-docs.mjs --json e2a0e90025059d066dff4b067a8b70d23bca2680

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs e2a0e90025059d066dff4b067a8b70d23bca2680 → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-sales · session_01L6bhgV6i8jfWwSXjpWJrjA

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: bf6f12eec18bf5e18dfe0e513a8c3e086a7f7f47
Local-runs: none
Scope: packages/spec/src/api/protocol.zod.ts, packages/spec/src/contracts/ai-service.ts, packages/spec/src/kernel/execution-context.zod.ts, packages/spec/src/migrations/entries/semantic/19.ai-pending-action-queue-merged-into-confirmation-service.ts + packages/spec/src/contracts/ai-service.test.ts, packages/spec/src/contracts/action-confirmation-contract.pin.test.ts, packages/spec/src/contracts/ai-store-caller-context.pin.test.ts

PR #38273, Refs #33806, step 1 (spec). Read: the card and its four comments (ruling 7237978621, claim 7238064205, amendment 7238080787), the PR body, the 11-file diff, the head's check-runs, and the cited code on main (read, not reviewed). main is 5 commits ahead of the merge base; none of them touches a file of this diff.

① Derived judgments

  • IActionConfirmationService gains list, get, approve, reject, all required. Right as a narrowing for an implementer (a submit-only service no longer type-checks; the test pins it with a ts-expect-error) and a widening for a caller. Matches the amendment.
  • IAIService loses its four pending members and ProposePendingActionInput leaves the exports. Right, and declared BREAKING. The four members are interface members, so the generated lists carry only the export: api-surface/contracts.json and export-origins/contracts.json each drop ProposePendingActionInput and add ActionConfirmationApproveOutcome and ActionConfirmationListFilter. Every retired export is accounted for.
  • ActionConfirmationHandOff gains optional toolName, conversationId, messageId. Right: additive, optional.
  • list takes context as a required parameter where listPendingActions took it optionally. Right, a narrowing, and the changeset row says "context required".
  • PendingActionStatus (six states, held, no expired), PendingActionRow and the three route schemas keep their shape; protocol.zod.ts moves comments only. Right against the amendment. Whether the unchanged row can carry what the contract now promises of it is M1 below.
  • performedBy.confirmationId: TSDoc and .describe text only, regenerated into content/docs/references/kernel/execution-context.mdx. Accept-set unchanged. Right.
  • Readers of a retired member on main outside packages/spec: none in code. The one hit is a comment (ui/packages/plugin-chatbot/src/usePendingActions.ts:49). packages/runtime/src/action-execution.ts resolves the service by typeof svc.submit === 'function' and calls submit only; the two test doubles (packages/runtime/src/action-confirmation-handoff-33690.test.ts, packages/qa/dogfood/test/action-confirmation-handoff-33690.dogfood.test.ts) are untyped objects. Nothing on main implements either interface by type, so the removal breaks no build before steps 2 and 3. The ui/ readers of pending_approval and pendingActionId read stored tool results, not a spec export.
  • Migration entry: file name and id agree, the registry is generated from the directory, no conversionIds and no relevantWhen, so it is always listed. Right for a host-code change.

② Semver level

Clause-②: yes (narrowing) — on the PR body and in the changeset, as amendment 7238080787 fixes it. Metadata-protocol: none holds: no key, value or metadata type an author writes changes. A non-protocol breaking change ships patch with its BREAKING banner and ADR-0087 disposition (AGENTS.md, changeset rule), and the changeset is @objectstack/spec: patch with the banner, a FROM → TO table, the one-line fix and adr-0087: registered ai-pending-action-queue-merged-into-confirmation-service, the id of the entry file. The table and the entry agree member by member. Check Changeset concluded success on this head.

③ Boundary flags

  • SQL push-down: not applicable. The diff holds no query, no id materialisation and no join.
  • Dev flag, the 18 entry in-app-pending-action-decided-by-person still names the old members: accepted. It is the record of step 18.
  • Dev flag, ADR-0011's revision note is stale: accepted as step 4 (docs), outside this PR's file surface.
  • Dev flag, the derived gates were still running: answered by the check-runs, below.
  • Dev flag, dogfood once on the final head: Dogfood Regression Gate concluded success on this head.
  • S2 (should-fix) — the PR body carries no Skills-docs: line. The line is owed on a (narrowing) arm (scripts/pm/l1-face.mjs flags its absence as REWORK). It is also true that there is something to name: skills/objectstack-ai/SKILL.md:159 and content/docs/ai/actions-as-tools.mdx:252 teach the pending_approval answer and the queue on the AI service, which this contract retires. The fix is the line on the PR body, pointing at the docs step's card; it does not move the head.
  • Escalated to the seat with M1: the claim's premise sends a service-shape question back to the seat before it is written. M1 is one.
  • Check-runs on this head at my read (47): 15 success, 9 skipped, 23 in progress with no conclusion — Build Core, Build Docs, Build UI Deps, Lint · CI, release & engine gates, Lint · docs & code guards, Lint · repo & tooling gates, Lint · scoped · query-options erasure, Lint · scoped · slot lookup & corpus, Live E2E UI, Test Core shards 1 to 10, Type Check · consumer gates, Type Check · debt ledger, Type Check · source gates, Type Check · workspace. None had failed. The build, type-check and test families are therefore unanswered on this head; the verdict below does not rest on them.

④ Design judgment

packages/spec/src/contracts/ai-service.ts

M1 (must-fix) — the row the service answers cannot carry a hand-off the same file declares legal. The service docblock now says PendingActionRow "is the row list and get answer, whichever door handed the item off". The row is unchanged and requires object_name: string and tool_name: string. ActionConfirmationHandOff.objectName is optional ("omitted for object-less actions") and the new toolName is "absent on an MCP hand-off". So an MCP hand-off of an object-less action is a legal submit whose item has no value for two required members of the type get returns; the PR's own test submits exactly that ({ actionName: 'archive_account', params: {}, door: 'mcp' }). The wire mirror AiPendingActionSchema requires both as z.string() too, so the route cannot answer that item without an invented value. The row also has no place for door, recordId, namespace or run, and the contract does not say where a host puts them or what tool_input holds for a resume_run item, whose params is empty. Before this PR the row described in-app items only, so the gap is introduced here. The first consumers are the cloud store of step 3, which must invent the values, and the inbox of step 2, which reads them; two hosts would not agree. The contract has to say how a hand-off from every door becomes a row: either the mapping in words with the row unchanged (what tool_name and object_name hold for an MCP item, where the record and the run go), or the two members optional on the row and its wire mirror. The second changes a shape the amendment says stays, so the choice goes to the seat.

S1 (should-fix) — rule 1 of the contract still says "Rules 2 to 4 below are the MCP doors' channel. The in-app door asks through its own channel, under "The in-app assistant door" below". The section it points to is now titled "the same rule, the same channel" and says every door hands off to one service. The contract contradicts itself in one docblock, and no pin reads rule 1's sentence. Rule 1 should say what still differs (the in-app door does not elicit; it hands off) and no more.

The rest holds. The three deciding points are on approve and reject and absent from list and get; the decider is the passed context; held keeps its meaning; the retired literal's paragraph gives one recogniser and adds no export; "When it binds" names the FROM half for a host that has not moved. submit on main's one caller (handOffActionConfirmation) is unchanged.

N1 (nit) — the FROM → TO rows do not say that proposePendingAction answered { id } and submit answers { pendingId }. The compiler says it; left as an accepted deviation.

packages/spec/src/api/protocol.zod.ts — comments only, and they agree with the service: the routes front the one store, and list accepts the objectName filter the route does not forward. The schema is the wire half of M1.

packages/spec/src/kernel/execution-context.zod.ts — the TSDoc and the .describe text say the same thing, one store. Holds.

packages/spec/src/migrations/entries/semantic/19.ai-pending-action-queue-merged-into-confirmation-service.ts — agrees with the contract and the changeset member by member, and its acceptance criteria are checkable by a host. Holds. It inherits M1: "PendingActionRow ... keep their shape" is true and is where the gap sits.

Implementing files (the three tests) — they pin what the contract says: the four members gone from IAIService, the service's keys exactly five, a submit-only service refused, the deciding points on the members, list and get taking a required context that reaches the engine read. They pin nothing about how a hand-off becomes a row, which is M1, and nothing about rule 1, which is S1.

Implemented-by: claude/project-thread-thpyr7
Reviewed-by: session_01L6bhgV6i8jfWwSXjpWJrjA (isolated contract-review sub-agent)

VERDICT: FAIL

…at rule 1's doors share one channel

Claude-Session: https://claude.ai/code/session_01L6bhgTrYJvLJfdjfWhNMMV
Co-authored-by: Claude <noreply@anthropic.com>
…ing-confirmation service, not the retired IAIService members

Claude-Session: https://claude.ai/code/session_01L6bhgTrYJvLJfdjfWhNMMV
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-sales · session_01L6bhgV6i8jfWwSXjpWJrjA

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 5d82277b341a349b33e7c4ab4f0947ab1eeaef21
Local-runs: none
Scope: packages/spec/src/api/protocol.zod.ts, packages/spec/src/contracts/ai-service.ts, packages/spec/src/kernel/execution-context.zod.ts, packages/spec/src/migrations/entries/semantic/19.ai-pending-action-queue-merged-into-confirmation-service.ts + packages/spec/src/contracts/ai-service.test.ts, packages/spec/src/contracts/action-confirmation-contract.pin.test.ts, packages/spec/src/contracts/ai-store-caller-context.pin.test.ts

Delta review of PR #38273 against the round-1 record (comment 7238295862, FAIL at bf6f12ee). Read: the one commit between the two heads (4 files: the changeset, ai-service.ts, the contract pin test, the migration entry), the PR body as it stands, the seat's ruling on M1 (option A: the row and its wire mirror keep their shape, the service docblock states the mapping), and the check-runs on this head. The PR's file list is the same 11 files; protocol.zod.ts, execution-context.zod.ts and the generated lists did not move, so round 1's reading of them stands.

M1: closed
S1: closed
S2: closed
N1: closed

① Derived judgments

No accept-set or public-surface change in the delta: prose in ai-service.ts, prose in the changeset and the migration entry, and added pins. PendingActionRow and AiPendingActionSchema are unchanged, as the seat ruled. Round 1's judgments stand.

② Semver level

Clause-②: yes (narrowing) — unchanged on the PR body and in the changeset, with Metadata-protocol: none, @objectstack/spec: patch, the BREAKING banner and adr-0087: registered ai-pending-action-queue-merged-into-confirmation-service. The delta adds the { id } to { pendingId } answer to the first FROM → TO row and the row mapping to the package bullet; both agree with the contract. Check Changeset had no conclusion on this head at my read.

③ Boundary flags

  • SQL push-down: not applicable, as in round 1.
  • The M1 shape question was answered by the seat (option A) and the tree follows it; see ④.
  • The PR body now carries Skills-docs: follow-up owed — skills/objectstack-ai/SKILL.md, content/docs/ai/actions-as-tools.mdx ..., and what it says is true: both files teach the pending_approval answer and the queue on the AI service, and stay true of the runtime until the cloud step changes its answer. One thing is left for the seat, not graded here: scripts/pm/l1-face.mjs reads follow-up owed as a flag until the owed card is filed and the line rewritten to its number, before ACCEPT.
  • The thread's account says the migration entry also gained the { id } to { pendingId } answer. It did not; only the changeset table did. N1 named the table alone, so it is closed all the same.
  • Check-runs on this head at my read (45): 13 success, 13 skipped, 2 cancelled (earlier runs of Check Changeset and PR-body guards, each re-run), 17 in progress with no conclusion — Build Core, Build Docs, Build UI Deps, Check Changeset, Lint · CI, release & engine gates, Lint · ESLint, Lint · docs & code guards, Lint · repo & tooling gates, Lint · scoped · query-options erasure, Lint · scoped · slot lookup & corpus, Live E2E UI, Plan Test Core shards, Plan Test UI shards, Type Check · consumer gates, Type Check · debt ledger, Type Check · source gates, Type Check · workspace. The Test Core shards had not been planned yet. None had failed. The build, type-check, lint and test families are unanswered on this head; this record judges the design, and those gates remain to be read before the queue.

④ Design judgment

No must-fix, no should-fix.

packages/spec/src/contracts/ai-service.ts

The mapping, against the ruling, sentence by sentence:

  • tool_name is the tool the call went through: the model's tool on an in-app item, run_action on an MCP item, resume_run when the hand-off carries a run. As ruled. ActionConfirmationHandOff.toolName says the same from its side.
  • tool_input is that call's input as JSON: params on an in-app item; actionName, objectName, namespace, recordId and params on a run_action item; runId, values and screenNodeId on a resume_run item. The record, the namespace and the run ride there, and the docblock says the row has no column for them. As ruled, and every member named is one the service receives on the hand-off (handOffActionConfirmation on main passes exactly these), so a host can build the row from what submit is given.
  • object_name is the empty string for an action on no object. As ruled. The object-less MCP hand-off that had no row in round 1 now has one, and both required members always have a value.
  • The door is not on the row; the host runs the approval from the hand-off it stored. As ruled.
  • action_name, conversation_id, message_id and proposed_by are each given a source.

Rule 1 now says every door hands off to the same service, rules 2 to 4 are how the MCP doors ask, and the in-app door never elicits. It no longer contradicts the section it points to.

N2 (nit) — the mapping calls the run_action row's tool_input "that tool call's input" and lists it by the hand-off's member names. What a host stores is unambiguous from the list; the phrase is loose. Left as an accepted deviation.

packages/spec/src/migrations/entries/semantic/19.ai-pending-action-queue-merged-into-confirmation-service.ts — the added clause restates the mapping for an MCP hand-off and agrees with the docblock. Holds.

packages/spec/src/api/protocol.zod.ts, packages/spec/src/kernel/execution-context.zod.ts — unchanged since round 1; they hold as read there. The wire schema keeps both members required, which the ruled mapping now always satisfies.

Implementing file in the delta, action-confirmation-contract.pin.test.ts — builds a row for an object-less MCP hand-off in the declared type and pins the three mapping sentences in the service docblock; pins rule 1's new sentence and, as a control, the absence of "asks through its own channel". The pins read the text the contract carries.

Implemented-by: claude/project-thread-thpyr7
Reviewed-by: session_01L6bhgV6i8jfWwSXjpWJrjA (isolated contract-review sub-agent)

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-sales · session_01L6bhgV6i8jfWwSXjpWJrjA

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: ff98353378d743b36b4b3dc88998810e91833f92
Local-runs: none
Scope: packages/spec/src/api/protocol.zod.ts, packages/spec/src/contracts/ai-service.ts, packages/spec/src/kernel/execution-context.zod.ts, packages/spec/src/migrations/entries/semantic/19.ai-pending-action-queue-merged-into-confirmation-service.ts + packages/spec/src/contracts/ai-service.test.ts, packages/spec/src/contracts/action-confirmation-contract.pin.test.ts, packages/spec/src/contracts/ai-store-caller-context.pin.test.ts, ui/packages/plugin-chatbot/src/usePendingActions.ts

Second delta review of PR #38273, against the delta record 7238406142 (PASS at 5d82277b). Read: the one commit between the two heads (1 file, 2 lines added, 2 removed), the PR body as it stands, and the check-runs on this head. The file list is now 12 files; the 11 read before did not move, so the earlier readings of them stand.

M1: closed
S1: closed
S2: closed
N1: closed

① Derived judgments

The delta is one comment in ui/packages/plugin-chatbot/src/usePendingActions.ts. No accept-set and no public-surface change. Right.

A correction to round 1: that record said nothing on main outside packages/spec would break before steps 2 and 3, and named this comment as harmless. The PR body says ui's check:spec-symbols reads spec members cited in comments and went red on it. I read the file's compile-time imports and not that gate, so the round-1 sentence was too strong; this commit is the fix it missed.

② Semver level

Clause-②: yes (narrowing) — unchanged on the PR body and in the changeset, with Metadata-protocol: none and @objectstack/spec: patch. The changeset did not move in this delta. The commit edits a comment in a ui/ package and adds no ui/ changeset; whether one is owed for a comment-only edit is the changeset gate's to say, and both Check Changeset runs had no conclusion on this head at my read.

③ Boundary flags

  • SQL push-down: not applicable.
  • The Skills-docs: line on the PR body now reads Skills-docs: changes with step 3 of #33806 — skills/objectstack-ai/SKILL.md, content/docs/ai/actions-as-tools.mdx (the runtime answer changes there; Tier H then). It no longer reads follow-up owed, it names a card by number, and what it says of the two files is true, as read in round 1. The item left for the seat in the last record is answered.
  • The PR body adds the ui/ file to its surface and says it is not a file open PR fix(plugin-chatbot): a lapsed AI pending action reads Expired, not Rejected, in the AI Approvals inbox and the chat card #38246 edits. The claim on the card names packages/spec only; one comment that a spec removal forces is the case AGENTS.md covers (a removal that breaks ui/ ships with the ui/ fix). Whether fix(plugin-chatbot): a lapsed AI pending action reads Expired, not Rejected, in the AI Approvals inbox and the chat card #38246 touches the file I did not read; it is the seat's premise check.
  • Check-runs on this head at my read (45): 10 success, 13 skipped, 2 cancelled (earlier runs of Check Changeset and PR-body guards; the latter's re-run is success), 20 in progress with no conclusion — Build Core, Build Docs, Build UI Deps, Check Changeset (two runs), Lint · CI, release & engine gates, Lint · ESLint, Lint · PM dispatch-gates, Lint · docs & code guards, Lint · repo & tooling gates, Lint · scoped · query-options erasure, Lint · scoped · slot lookup & corpus, Lint · scoped · tooling self-tests, Live E2E UI, Plan Test Core shards, Plan Test UI shards, Type Check · consumer gates, Type Check · debt ledger, Type Check · source gates, Type Check · workspace. The test shards and Type Check UI had not been planned yet. None had failed. The build, type-check, lint, changeset and test families are unanswered on this head, the ui gate this commit exists to turn green among them; this record judges the design, and those gates remain to be read before the queue.

④ Design judgment

No must-fix, no should-fix.

ui/packages/plugin-chatbot/src/usePendingActions.ts (implementing file) — the comment now says @objectstack/spec/contracts declares PendingActionStatus and PendingActionRow as the contract of IActionConfirmationService.list / .get, "which is exactly what the REST route serialises". That agrees with the contract at this head: the service docblock names PendingActionRow as the row list and get answer, and the row's own docblock calls it the wire shape the inbox routes serialise. Both members exist. Comment only; no code moved.

The four hits files and the three spec tests — unchanged since 5d82277b. They hold as the last record read them. N2 of that record stays an accepted deviation.

Implemented-by: claude/project-thread-thpyr7
Reviewed-by: session_01L6bhgV6i8jfWwSXjpWJrjA (isolated contract-review sub-agent)

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-sales · session_01L6bhgV6i8jfWwSXjpWJrjA

席位核对 — ACCEPT · head ff98353 · card #33806 (step 1 of 3) · area s2-ai · 2026-11-28T12:48Z

L1 checklist

  • Shape and checks. Every check on the head is green apart from expected skips (63 success, 13 skipped; two earlier reruns cancelled and superseded); mergeable clean. The PR is a draft. It changes packages/spec only (the AI service and action-confirmation contracts, the protocol and execution-context schemas, the generated api-surface and export-origins lists, a semantic migration entry, pins), the generated reference page content/docs/references/kernel/execution-context.mdx, one comment in ui/packages/plugin-chatbot/src/usePendingActions.ts, and one changeset. Dev report 7239469744 carries the derived gates (116 of 117 exit 0, one left to CI) and a local dogfood build and test on this head (exit 0, 0 failures).
  • Contract review at CONTRACT_REVIEW_TIER. Round 1 (7238295862) was a FAIL on M1 (the row could not carry an MCP hand-off), S1 and S2. The seat ruled M1 option A (row shape unchanged; the service docblock states how each door's hand-off becomes a row). Delta 7238406142 closes M1, S1, S2 and N1 and is a PASS; delta 7238446132 on this head (the one-comment ui edit and body r3) is a PASS. N2 is an accepted deviation. Their transcripts pass verify-review-tier; the seat adopts the record.
  • What changes for an author or host. Per the maintainer's ruling A on the card: the two AI pending-action doors meet in one service. IActionConfirmationService gains list, get, approve and reject, with the decider taken from the passed ExecutionContext; IAIService's four pending members and ProposePendingActionInput retire; the in-app pending_approval answer gives way to pending_confirmation, and an old conversation's pending_approval is still read. The pending-action row, its six states and the three /api/v1/ai/pending-actions route declarations stay. The runtime answer, the console and the cloud routes change in steps 2 and 3.
  • Declarations. Clause-②: yes (narrowing), Metadata-protocol: none, @objectstack/spec patch with the BREAKING banner, the FROM → TO table and adr-0087: registered ai-pending-action-queue-merged-into-confirmation-service. Skills-docs: names the two files that change with step 3. Refs #33806 is right: this step does not close the card.
  • Governance. The narrowing arm makes this Tier H, so the maintainer's approval lands it.

Tier: H. Landing: hand-off to the maintainer follows this record.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-sales · session_01L6bhgV6i8jfWwSXjpWJrjA

Tier H hand-off · 2026-11-28T12:49Z · head ff98353 · approver os-zhuang

维护者速读

  • 改了什么: Contract: merge the in-app pending-action queue into the AI-door confirmation seam (#33689 Q1, option C deferred) #33806 你裁的 A 方案第 1 步,只改规范(spec):AI 待确认操作原来有两扇门(应用内、MCP),现在合到同一个确认服务 IActionConfirmationService 上,它新增列出、查看、批准、驳回四个动作,谁来批由调用时的身份决定;IAIService 上原来那四个待确认成员退役。应用内答复里的 pending_approval 改叫 pending_confirmation,旧对话里的旧写法照样能读。待确认条目的行结构、六种状态和三条接口声明都不变。
  • 为什么要你批: 退役了已导出的接口成员,属于收窄(Clause-② yes (narrowing))。changeset 带 BREAKING、新旧对照表和迁移条目 19.ai-pending-action-queue-merged-into-confirmation-service。
  • 影响: 这一步只动契约和文档;运行时答法、控制台和云端路由在第 2、3 步改,技能与指南里的旧说法也随第 3 步改。仓库里没有代码按类型实现这两个接口,合入后不会打断构建(CI 全绿,本地 dogfood 通过)。
  • 审核: 契约审核(最高档)首轮 FAIL(MCP 交接的条目放不进行结构),席位裁定行结构不变、在服务说明里写清每扇门的条目如何成行;两轮复审 PASS(7238446132 为最新)。席位 L1 ACCEPT 在本评论前一条。
  • 要你做什么: 需要你批准后才能合并。撤回这一次合并即恢复原样。

@objectstack-fleet objectstack-fleet Bot added the pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue label Nov 28, 2026
@os-zhuang
os-zhuang marked this pull request as ready for review November 28, 2026 12:51
@os-zhuang
os-zhuang added this pull request to the merge queue Nov 28, 2026
Merged via the queue into main with commit b503291 Nov 28, 2026
86 of 88 checks passed
@os-zhuang
os-zhuang deleted the claude/project-thread-thpyr7 branch November 28, 2026 13:17
@objectstack-fleet objectstack-fleet Bot removed the pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue label Nov 28, 2026
Nenzyz pushed a commit to Nenzyz/objectstack that referenced this pull request Dec 1, 2026
…action and shows Expired for a lapsed one (objectstack-ai#38326)

<!-- claude-projects-attribution: {"github_login":"os-sales"} -->
_Requested by **Sales** · [project
thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4Uu52iwRDMp8T1eW25d28D4co)_

Fixes objectstack-ai#38250
repo:objectstack#2 · os-sales · session_01L6bhgVC7KKvrgZyWpM75L8

Clause-②: no
Metadata-protocol: none

## 维护者速读

- 控制台用户重新打开一段旧对话时,聊天里的 AI 确认卡片如果对应的操作已经失效,会直接显示「已过期」,不再显示「通过 /
拒绝」按钮;以前要点一下按钮才知道已过期。本人亲手拒绝过的,打开后显示为已拒绝。
- 这是上一张「AI 待确认操作过期显示已过期」留下的后半截,解决恢复对话时按钮还在的问题。
- 只多一次读取:每张还在等确认的卡片打开时,读一次它对应条目的状态(已有的单条读取接口,客户端 SDK 的
pendingActions.get 用的就是它),不改服务端;读不到时按钮照旧,点了仍会显示「已过期」。有问题可直接撤回。
- 无

## What changes

- `ui/packages/plugin-chatbot/src/useHitlInChat.ts`: each card the
messages hold in `approval-requested` with a `pendingActionId` has its
row read once per mount, `GET {apiBase}/pending-actions/:id` through the
same authenticated fetch the decision uses (the item read
`@objectstack/client`'s `pendingActions.get` uses; the AI Approvals
inbox reads the list). `settledDecisionOf(row)`: a lapsed row
(`isLapsedPendingAction`, from objectstack-ai#34255) settles the card on `{ state:
'expired' }`; a row a person rejected settles it on the rejection, drawn
as a rejection made in this session is (`success`, `decision:
'rejected'`, `Rejected: REASON` / `Rejected.`). Any other row, a
non-2xx, or no answer leaves the card as it was. A decision made on the
card before the read lands is never overwritten. The read is
deduplicated by pending-action id, so a streamed message or a new
`headers` object re-reads nothing.
- New test `ChatbotEnhanced.restoredLapsedApproval-38250.test.tsx` (4
cases, one of them the press-before-read race).
- Four existing test files scripted `fetch` in call order (a fifth, the
bearer-session pin, counted requests: see the CI notes below) for the
decision POST, and the row read now comes first:
`useHitlInChat.test.tsx`, `writeApprovalPending-37860.test.tsx` and
`AiChatPage.approvalRehydration.test.tsx` answer the read 404 and keep
their scripted POST replies in order (`decisionReply`);
`useChatConversation.test.tsx`'s `pressApprove` builds a fresh
`Response` per call and counts POST URLs only. Every assertion they made
still holds; `AiChatPage.approvalRehydration` additionally pins that the
read went to `…/pending-actions/pa_44`.
- `AiChatPage.approvalRehydration.test.tsx` also gains a module-top
`import '@object-ui/plugin-grid';` (`check:test-source-alias` asks it of
an edited test whose source reach loads that plugin lazily).
- `app-shell/src/console/rendererFetch.bearerSession-37225.test.tsx`:
the in-chat approval pin now expects the row read too (CI, below).
- `.changeset/38250-restored-approval-card-reads-row.md`: patch for
`@object-ui/plugin-chatbot`.
- CI at 82915a7 (b1f7cfc): `Test UI (5/16)` failed in
`app-shell/src/sameServerFetch.bearer.ratchet.test.ts`, which counted
the row read's inline `(apiFetch ?? fetch)(…)` as a bare cookie-only
fetch. The read now binds `const doFetch = apiFetch ?? fetch;` first,
the renderer-package channel spelling the ratchet reads as the host's
`apiFetch` and the one `decide` already uses: same transport, no
allow-list row. The 8 `*ratchet*` test files under `ui/packages/*/src`
pass locally (89 tests).
- CI at 82915a7 (f97f74c): `Test UI (10/16)` failed in
`app-shell/src/console/rendererFetch.bearerSession-37225.test.tsx`,
which records every request `useHitlInChat` sends and expected the
approve `POST` alone. It now expects the row read first and the `POST`
after, each with the stored bearer, so the pin also shows the read rides
the authenticated channel.
- Every test file under `ui/packages/*/src` and `ui/apps/*/src` that
names `useHitlInChat`, `pending-actions`, `onToolApprove`,
`toolDecisions`, `pendingActionId`, `pending_approval` or
`approval-requested` re-run locally after these fixes: 32 files / 343
tests and 25 files / 257 tests, 0 failed.
- Review 7240110232 (d5fc75e): the press-before-read race gets its own
case (should-fix), and the changeset and hook comment name the item read
rather than the inbox, which reads the list (nit). Restored rows settled
approved/executed/failed/held keep their buttons, as before; the seat
files that separately.

### Small calls this PR made (listed for review)

1. **The read runs for every awaiting card, not only restored ones.**
The hook cannot tell a card restored from a saved conversation from one
that just streamed in, and no host prop says so; a live proposal's read
answers `pending` and changes nothing. Cost: one `GET` per awaiting card
per mount. No new option or prop, so no public surface moves (`Clause-②:
no`, as claimed).
2. **A row a person rejected reads as that rejection** (the card's
second box), with the same English strip text the live reject path
writes. Rows settled any other way (approved, executed, failed, held)
keep their buttons: the card asks for the lapse, and a press on one
still answers.
3. **The answer is read bare or in the `{ success, data }` envelope**,
the two shapes `@objectstack/client`'s `pendingActions.get` reads;
anything without a string `status` is ignored.
4. **A host whose own tests script `fetch` in call order** sees one
extra `GET` before the decision POST; the changeset says so. Four such
files in this repo were adjusted (above).
5. `usePendingActions.ts` is untouched (PR objectstack-ai#38273 edits a comment
there).

## Read first

1. `ui/packages/plugin-chatbot/src/useHitlInChat.ts`: the row-read
effect and `settledDecisionOf`. Risky hunk: the functional update that
must not overwrite a press.
2.
`ui/packages/plugin-chatbot/src/__tests__/ChatbotEnhanced.restoredLapsedApproval-38250.test.tsx`.
3. The four adjusted test files: each change only routes the row read
away from the scripted replies.

## Tests

<details><summary>New test (local, head f97f74c)</summary>

`ChatbotEnhanced.restoredLapsedApproval-38250.test.tsx` (zh,
`useHitlInChat` and `ChatbotEnhanced` run together, nothing pressed): a
lapsed row in the `{ success, data }` envelope draws
`data-state="expired"` with 已过期, no buttons, and exactly one request,
`GET /api/v1/ai/pending-actions/pa_9`; a row with `decided_by` (and
`lapsed` typed as the reason) draws the rejection, never 已过期; a pending
row and a 404 each leave the buttons and draw no strip; with the row
read held open, Approve is pressed and answers `executed`, then the read
answers a lapsed row, and the card still reads the approval, never 已过期
(review 7240110232 should-fix), with exactly `GET …/pa_9` then `POST
…/pa_9/approve` sent.

```
cd ui && pnpm exec vitest run packages/plugin-chatbot/src/__tests__/ChatbotEnhanced.restoredLapsedApproval-38250.test.tsx
 Test Files  1 passed (1)
      Tests  4 passed (4)
```
</details>

<details><summary>Ablation</summary>

`settledDecisionOf` mutated on disk to answer `undefined` for every row
(`if (row) return undefined;` first), the new file re-run at 675654b:
2 failed / 1 passed (the lapsed and person-rejected cases; the
pending/404 case asserts the unchanged path), exit 1. Restored with `git
checkout`.

On the tree committed as d5fc75e, the press guard removed on disk
(`setDecisions((prev) => ({ ...prev, [toolCallId]: settled }))`, no
`toolCallId in prev` check), the new file re-run: 1 failed / 3 passed
(the race case), exit 1. Restored from a copy; `git diff` clean.
</details>

<details><summary>Package runs, type-check, lint</summary>

- `pnpm exec vitest run --maxWorkers=3 packages/plugin-chatbot/
packages/app-shell/src/console/ai/ packages/app-shell/src/assistant/
packages/app-shell/src/hooks/`: before the test adjustments 12 tests in
3 files failed (each on a scripted reply the row read consumed), and
after them 1 more (`useChatConversation.test.tsx`, one `Response` body
read twice). With the adjustments: 223 passed + that file re-run 58/58,
so 224 files, 0 failed.
- At f97f74c (since 82915a7: the new case, a hook comment, the
read's channel binding, the changeset sentence, and the bearer-session
pin): `pnpm exec vitest run --maxWorkers=3 packages/plugin-chatbot/` 81
files / 754 tests passed; plugin-chatbot type-check and app-shell `tsc
-p tsconfig.test.json` exit 0; `eslint --no-inline-config` on the hook,
the new test and the bearer-session pin exit 0. The app-shell runs below
are from 82915a7; no app-shell file changed since.
- `pnpm --filter @object-ui/plugin-chatbot run type-check` exit 0;
`@object-ui/app-shell` `tsc --noEmit` and `tsc -p tsconfig.test.json`
exit 0.
- `eslint --no-inline-config` on `useHitlInChat.ts`, the new test and
the four adjusted tests: exit 0, 0 problems.
</details>

<details><summary>Derived gate families (local)</summary>

`node scripts/pm/dispatch-gates.mjs --commands` derived the same 38
families at d5fc75e and at f97f74c (the run spans those commits: one
line of `useHitlInChat.ts` and one test file moved meanwhile); each run
locally, exit code captured before any pipe:

```
node scripts/check-adr-0087-registration.mjs --base origin/main :: exit 0
node scripts/check-adr-0087-registration.mjs --self-test :: exit 0
node scripts/check-changeset-no-major.mjs --base origin/main :: exit 0
node scripts/check-closing-keyword-parity.mjs :: exit 0
node scripts/check-closing-keyword-parity.mjs --self-test :: exit 0
node scripts/check-comment-mask-corpus.mjs :: exit 0
node scripts/check-empty-changeset.mjs --base origin/main :: exit 0
node scripts/check-empty-changeset.mjs --self-test :: exit 0
node scripts/check-sdui-manifest.mjs :: exit 0
node scripts/check-sdui-manifest.mjs --self-test :: exit 0
node scripts/ci/snapshot-next.mjs --self-test :: exit 0
node scripts/pm/check-governed-queue-guard.mjs --self-test :: exit 0
node scripts/pm/release-rehearsal-clone.mjs --self-test :: exit 0
node scripts/release-pending-publish.mjs --self-test :: exit 0
pnpm --dir ui exec vitest run scripts/ :: exit 0
pnpm --filter @objectstack/spec run check:duration-unit-keys :: exit 0
pnpm check:adr-anchors :: exit 0
pnpm check:changeset-gate-self-tests :: exit 0
pnpm check:closed-ceremony-text :: exit 0
pnpm check:cross-package-test-inputs :: exit 0
pnpm check:dispatcher-error-vocabulary :: exit 0
pnpm check:driver-memory-census :: exit 0
pnpm check:engine-double-contract :: exit 0
pnpm check:gitlink-declared :: exit 0
pnpm check:nul-bytes :: exit 0
pnpm check:published-files :: exit 0
pnpm check:query-options-erasure :: exit 0
pnpm check:refd-timer-probe :: exit 0
pnpm check:registry-log-declared :: exit 0
pnpm check:rest-log-spy-declared :: exit 0
pnpm check:skill-identifier-liveness :: exit 0
pnpm check:test-source-alias :: exit 0
pnpm check:tier-file-adoption :: exit 0
pnpm check:type-check-coverage :: exit 0
pnpm check:type-check-debt :: exit 0
pnpm check:undeclared-dep-imports :: exit 0
pnpm check:watch-hint-literal :: exit 0
pnpm check:where-matcher :: exit 0
```

`dispatch-gates --ran`: `38 derived famil(ies) accounted for — 38 run, 0
NOT-MEASURED (a DERIVED zero — all 38 recorded an exit code and none of
them is 3)`.

At 675654b `pnpm check:test-source-alias` exited 1: editing
`AiChatPage.approvalRehydration.test.tsx` brought it under the gate's
source-reach half (`ChatPane.tsx` imports `@object-ui/plugin-grid`
lazily). 82915a7 adds the module-top `import
'@object-ui/plugin-grid';` the gate names; the file passes (1/1) and the
gate exits 0 above.
</details>

## Acceptance notes

- No server change and no new route: `GET
/api/v1/ai/pending-actions/:id` is the existing read (hosted AI service;
the console's API explorer and `@objectstack/client` list it). The open
edition serves no AI service, so there the read answers non-2xx and the
card is unchanged.
- `test:repo` (vitest `repo` project) not run locally: this diff touches
none of its tests; CI's `Test Core` runs it.

## Verification

Two minutes: run the new test file above from `ui/`; expect 4 passing
tests, the lapsed restored card reading 已过期 with nothing pressed, and a
press made while the read was out standing.

---
_Generated by [Claude
Code](https://claude.ai/code/session_01L6bhgVC7KKvrgZyWpM75L8)_

<!-- signed: repo:objectstack#2 · os-sales ·
session_01L6bhgVC7KKvrgZyWpM75L8 -->

---------

Co-authored-by: Claude <noreply@anthropic.com>
Nenzyz pushed a commit to Nenzyz/objectstack that referenced this pull request Dec 1, 2026
… stored pending_approval one (objectstack-ai#38446)

Fixes objectstack-ai#38322
Part of: objectstack-ai#33806 (step 2 of 4, UI and SDK; step 1 merged as PR objectstack-ai#38273)

Clause-②: yes (widening)
Metadata-protocol: none

## 维护者速读

-
用户能看到什么变化:用户无感。控制台聊天里待确认操作的审批卡片,今后服务端换成新的答复写法后照样出现;按旧写法保存的历史对话也照样出现,批准、拒绝都能用。
-
为什么做:这是「把应用内助手的待确认操作并入统一确认服务」四步中的第二步(界面与客户端),必须在第三步改服务端答复之前落地,否则新提案在聊天里看不到审批卡片。
- 出错会怎样:最坏情况是聊天里某条待确认操作不显示审批按钮,用户可改到 AI 审批收件箱处理;本改动只动控制台识别逻辑,可整体撤回。
- 要你做什么:无

## What changes

Step 1 (PR objectstack-ai#38273) moved the in-app pending answer from `{ status:
'pending_approval', pendingActionId }` to `{ status:
'pending_confirmation', pendingId }` (`ActionConfirmationPending`,
`packages/spec/src/contracts/ai-service.ts`), and its contract text ("A
stored `pending_approval` answer") says a stored old answer is read by
the SAME recogniser, taking `pendingActionId` as the `pendingId`, with
no second reader. Ruling A on objectstack-ai#33806 says the same.

- `ui/packages/plugin-chatbot/src/toolResultParsers.ts`:
`detectPendingApproval` is that one recogniser. It reads
`pending_confirmation` + `pendingId` and `pending_approval` +
`pendingActionId`. Each status pairs with its own id key only: a crossed
pair (`pending_confirmation` + `pendingActionId`, or `pending_approval`
+ `pendingId`) is not read, so no lenient dialect gets in. The id still
comes back as `pendingActionId`, the name
`ChatToolInvocation.pendingActionId` and the approve/reject routes
already use. Signature and return type are unchanged. An orphaned
docblock that named only the old literal is gone.
- Every reader already goes through it: `mapMessages.ts` (the live and
stored-history mapper, plus the record-write, sample-data-cleanup and
package-removal card detectors), app-shell `useChatConversation.ts`
(`toUIMessages` approval promotion), and `aiChatHydration.ts`.
`useHitlInChat.ts` and `useObjectChat.ts` read only the lifted
`tool.pendingActionId`. No reader of either literal is left outside the
recogniser (`git grep` over `ui/` for both literals, outside tests and
CHANGELOGs, finds only the recogniser, the docblocks and the cache
writer below).
- Docblocks that named only the old literal now name both:
`chat/types.ts`, `useHitlInChat.ts`, `useObjectChat.ts`,
`mapMessages.ts`, and `useChatConversation.ts` (the cache writer).
- SDK half of the card: nothing to move. `packages/client/src/index.ts`
(`ai.pendingActions.*`) and
`ui/packages/plugin-chatbot/src/usePendingActions.ts` call the REST
routes `/ai/pending-actions/*`. They name none of the four retired
`IAIService` members (`proposePendingAction`, `approvePendingAction`,
`rejectPendingAction`, `listPendingActions`), so `git grep` over
`packages/client`, `packages/client-react` and `ui/` (CHANGELOGs
excluded) finds 0 hits. The routes belong to step 3, so both files are
untouched.
- No runtime, route or spec change, and no export added or removed.

## Tests

- `ui/packages/plugin-chatbot/src/__tests__/mapMessages.test.ts`: a new
top-level `describe`, "detectPendingApproval reads the current and the
stored pending answer". It covers the new shape (bare, text-wrapped,
JSON string), the old shape (bare, text-wrapped), crossed pairs and
malformed ids refused, a live `pending_confirmation` result lifted to
`approval-requested` + id, the record-write card drawn from a
`pending_confirmation` envelope, and a conversation stored with the old
answer re-drawing its approval card. A lit control checks that an
ordinary result draws no card.
-
`ui/packages/app-shell/src/hooks/__tests__/useChatConversation.test.tsx`:
two new driven round trips that end in the REST call Approve makes. One
restores a cached entry from the stored `pending_approval` envelope
alone (part-key fallback removed, so the recogniser is what is proven).
The other takes a live `pending_confirmation` answer through the cache
to Approve.

## Acceptance notes

- The chat's local cache writer (`pendingApprovalToCachedResult`) still
mints `{ status: 'pending_approval', pendingActionId }`. This PR first
switched it to the current answer, but
`AiChatPage.runtimeMessageSeam.test.tsx` under
`app-shell/src/console/ai/__tests__` pins that exact shape, and that
file is outside this card's claimed file surface, so the writer change
was reverted. The recogniser reads both, so a cached entry restores
either way. Moving the writer to the current answer is a one-line change
plus that one assertion. Carrier: objectstack-ai#38448.
- `detectPendingApproval` is a public export of
`@object-ui/plugin-chatbot` (and `/core`). Its signature is unchanged,
and it now also recognises the `pending_confirmation` answer. It refused
that input before, so this PR declares `Clause-②: yes (widening)` (seat
routing on the dev's question; the claim said `no`). The bump stays
`patch`: the level follows `Metadata-protocol`, which is `none`. The
declaration owes a TIER_DEFAULT review of record.

## Verification

Two-minute check: `pnpm --dir ui exec vitest run
packages/plugin-chatbot/src/__tests__/mapMessages.test.ts`. Expect every
test to pass, including the 7 under "detectPendingApproval reads the
current and the stored pending answer".

Read first (by risk):
1. `ui/packages/plugin-chatbot/src/toolResultParsers.ts`, the
`detectPendingApproval` / `pendingAnswerIdKey` hunk: the strict
literal-to-id-key pairing.
2.
`ui/packages/app-shell/src/hooks/__tests__/useChatConversation.test.tsx`:
the two new round trips.
3. `ui/packages/plugin-chatbot/src/__tests__/mapMessages.test.ts`: the
new `describe`.

All readings below are at head `e5da5265` unless a line says otherwise.

<details><summary>Tests (local, under the shared verify lock)</summary>

- `pnpm --dir ui exec vitest run --maxWorkers=2
packages/plugin-chatbot/` + all 14 `*ratchet*` tests under
`packages/app-shell/src` + `packages/app-shell/src/console/*.test.tsx` +
`packages/app-shell/src/console/ai/` + `packages/app-shell/src/hooks/` +
`packages/app-shell/src/assistant/`: Test Files 238 passed (238), Tests
2086 passed (2086), VERDICT command-exit 0.
- `pnpm --filter @object-ui/plugin-chatbot type-check`: exit 0.
`--listFiles` shows `tsconfig.test.json` compiles
`src/__tests__/mapMessages.test.ts`.
- `pnpm --filter @object-ui/app-shell type-check` (after building the
`@object-ui/app-shell^...` closure, 72/72 tasks): VERDICT command-exit
0.
- eslint over the 8 changed `ui/` files: 0 errors (13 warnings, all on
lines this PR does not touch).
- Narrowing, declared: the full app-shell suite (about 2,459 files) was
not run locally. CI `Test UI` runs it.

</details>

<details><summary>Ablation (on-disk mutation via
scripts/ablation-replace.mjs, restored to the HEAD blob each
time)</summary>

The vitest config aliases the packages under test to `src`, so no `dist`
was involved.

- Removed the `pending_confirmation` arm (`toolResultParsers.ts` blob
9e4f150 to 9ba227b6). 4 red: the three new-shape pins in
`mapMessages.test.ts` and the new-answer cache round trip. Restored:
blob equals HEAD, `git diff HEAD` empty.
- Removed the `pending_approval` arm (blob 9e4f150 to 89c4cedb). 6 red:
the old-shape pin, the stored-conversation re-draw, the new
stored-envelope-only cache restore, and three existing cache round trips
that read the stored literal. Restored: blob equals HEAD, `git diff
HEAD` empty.

</details>

<details><summary>Gates</summary>

- `node scripts/pm/dispatch-gates.mjs --commands` derived 38 families
for this diff. All 38 ran locally, each exit 0 (`pnpm --dir ui exec
vitest run scripts/`: 172 files passed, 2 skipped). `--ran`
reconciliation: "38 derived famil(ies) accounted for — 38 run, 0
NOT-MEASURED (a DERIVED zero)".
- `node scripts/pm/overlap-check.mjs`: "VERDICT clean exit 0". It merges
cleanly with `origin/main` and shares a file with no open PR.
- Families CI runs (repo-wide lint, the full UI test shards, typecheck
lanes): read from this PR's check-runs, not re-run locally.

</details>

## Human Minimum

- [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic.
(`packages/spec` is not touched.)
- [x] 2. Every name I added uses the casing for its kind.
- [x] 3. No formatter ran. eslint on the changed files shows 0 errors;
repo-wide `pnpm lint` is left to CI.
- [x] 4. One issue, one branch off an up-to-date `main`, one pull
request.
- [x] 5. A change that publishes carries a changeset, and both
declaration lines are filled in here and in the changeset.
- [x] 6. `packages/spec` touched: not applicable.
- [x] 7. No hand edits to `content/docs/references/`,
`packages/*/CHANGELOG.md` or `content/docs/releases/`.
- [x] 8. Title, body and comments are in English, apart from the
maintainer quick-read section the fleet contract asks for in Chinese.
- [x] The *Before Submitting* list in CONTRIBUTING.md is done.

---
_Generated by [Claude
Code](https://claude.ai/code/session_01FEkQ5nvFivDeQyYgTFkZhi)_

<!-- signed: repo:objectstack#5 · os-project-manager ·
session_01FEkQ5nvFivDeQyYgTFkZhi -->

---------

Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/l tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants