You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit b503291
Browse filesBrowse the repository at this point in the historyBrowse files
feat(spec)!: one pending-confirmation service for every AI door, the in-app pending-action queue leaves IAIService (#38273)
<!-- claude-projects-attribution: {"github_login":"os-sales"} -->
_Requested by **Sales** · [project
thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4Uu6r4hvzNtEmw2nzZexBmkpy)_
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 #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 #38246 (#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](https://claude.ai/code/session_01L6bhgTrYJvLJfdjfWhNMMV)_
<!-- signed: repo:objectstack#2 · os-sales ·
session_01L6bhgTrYJvLJfdjfWhNMMV -->
---------
Co-authored-by: Claude <noreply@anthropic.com>
**BREAKING** contract change in `@objectstack/spec/contracts`, inside the 19 prerelease window and before 19.0.0. A confirmation rule had two seams: the in-app assistant's pending-action queue on `IAIService` (answering the model `pending_approval`) and the AI-door hand-off `IActionConfirmationService` (answering `pending_confirmation`, with only a `submit` member). They are now one: `IActionConfirmationService`, still registered under `ACTION_CONFIRMATION_SERVICE` (`'ai.actionConfirmation'`), carries the whole lifecycle, and every AI door hands its gated calls to it and answers `pending_confirmation`. No metadata changes: `ai.requiresConfirmation` and every other key an author writes mean what they meant.
13
+
14
+
| FROM | TO |
15
+
|:--|:--|
16
+
|`aiService.proposePendingAction({ objectName, actionName, toolName, toolInput, conversationId, messageId, proposedBy })`, answering `{ id }`|`confirmations.submit({ actionName, objectName, recordId, params: toolInput, door: 'assistant', toolName, conversationId, messageId }, context)`, answering `{ pendingId }` (`context` = the person the call runs as) |
| (none) |`confirmations.get(pendingId, context)`, one item's row or `null`|
19
+
|`aiService.approvePendingAction(id, actorId)`|`confirmations.approve(id, context)` (`context` = the deciding person; still answers `executed`, `held` or `failed`) |
The one-line fix: register one `IActionConfirmationService` implementing `submit`, `list`, `get`, `approve` and `reject`, route the in-app assistant's gated tool calls through `submit` instead of `proposePendingAction`, and delete the four `IAIService` members from your implementation. A reader of stored conversations reads an old `pending_approval` answer with the same recogniser that reads `pending_confirmation`, taking `pendingActionId` as the `pendingId`; it never gets a second reader. Keep the ids of items you move from the old queue so those answers still name their item.
25
+
26
+
- **`@objectstack/spec`**: `IActionConfirmationService` gains `list`, `get`, `approve` and `reject` (all required) and states 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) for every item, whichever door handed it off. New types `ActionConfirmationListFilter` and `ActionConfirmationApproveOutcome`. `IAIService` loses `proposePendingAction`, `approvePendingAction`, `rejectPendingAction` and `listPendingActions`; `ProposePendingActionInput` is removed. `PendingActionStatus` (six states, `held` included) and `PendingActionRow` keep their shape and now describe the service's items; the service's docblock says how a hand-off from every door becomes a row (`tool_name` is the tool the call was made through, `run_action` or `resume_run` on an MCP item; `tool_input` is that call's input as JSON, record, namespace and run included; `object_name` is the empty string for an action on no object). The `/api/v1/ai/pending-actions` route schemas (`AiPendingAction*`) are unchanged. The D3 entry `ai-pending-action-queue-merged-into-confirmation-service` lists the hand work for `os migrate meta --from 18`.
Copy file name to clipboardExpand all lines: content/docs/references/kernel/execution-context.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -94,7 +94,7 @@ const result = AuthGateCodeSchema.parse(data);
94
94
|**clientId**|`string`| optional | The OAuth client (`azp`, the client_id of a registered sys_oauth_application) that performed the operation. Set by the /mcp OAuth door only; absent when the in-product AI performed it. |
95
95
|**agentId**|`string`| optional | The in-product AI agent that performed the operation for the signed-in person in userId: the agent the chat runs as (the same value as ToolExecutionContext.agentId). Set by the server-constructed in-product AI path only, and only after the server resolved it as the agent it actually ran; never a sys_user id or an OAuth client id. |
96
96
|**conversationId**|`string`| optional | The AI conversation the operation was performed in (the same id as ToolExecutionContext.conversationId). Set beside agentId by the in-product AI path, and only after the server resolved it as a conversation the person in userId owns. |
97
-
|**confirmationId**|`string`| optional | The confirmation the person gave before the operation ran: the id of the pendingitem their approval decided (the in-app pending action id, or the pending-confirmation service item id). Stamped only after the server resolved it as a pending item the person in userId decided for this operation; absent when the operation needed no confirmation. |
97
+
|**confirmationId**|`string`| optional | The confirmation the person gave before the operation ran: the id of the pending-confirmation service item their approval decided, whichever AI door handed it off. Stamped only after the server resolved it as a pending item the person in userId decided for this operation; absent when the operation needed no confirmation. |
0 commit comments