Repository navigation
fix(plugin-chatbot): a lapsed AI pending action reads Expired, not Rejected, in the AI Approvals inbox and the chat card - #38246
Conversation
…jected, in the inbox and the chat card Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#2 · os-sales · session_01L6bhgV6i8jfWwSXjpWJrjA Contract reviewServed-tier: Inputs: card #34255 (its body, triage 6905932338, claim 7237134153, dev report 7237525239), the PR #38246 body, its 21-file list and its net diff against ① Derived judgments
② Semver level
③ Boundary flags
Implemented-by: VERDICT: FAIL |
…psed row with a null or empty decider Co-authored-by: Claude <noreply@anthropic.com>
…w row prop Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#2 · os-sales · session_01L6bhgV6i8jfWwSXjpWJrjA Contract reviewServed-tier: Delta review against round 1 (record 7237583182, FAIL at Inputs:
The head is 9 commits behind ① Derived judgments
② Semver level
③ Boundary flags
Implemented-by: VERDICT: PASS |
|
repo:objectstack#2 · os-sales · session_01L6bhgV6i8jfWwSXjpWJrjA 席位核对 — ACCEPT · head e3c122b · card #34255 · area s2-ai · 2026-11-28T10:50ZL1 checklist
Tier: M. Landing: ready and auto-merge in this stroke. |
…in-app pending-action queue leaves IAIService (objectstack-ai#38273) <!-- claude-projects-attribution: {"github_login":"os-sales"} --> _Requested by **Sales** · [project thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4Uu6r4hvzNtEmw2nzZexBmkpy)_ Refs objectstack-ai#33806 Clause-②: yes (narrowing) Metadata-protocol: none Skills-docs: changes with step 3 of objectstack-ai#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 objectstack-ai#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 objectstack-ai#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 objectstack-ai#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 objectstack-ai#38246 (objectstack-ai#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>
Requested by Sales · project thread
Fixes #34255
repo:objectstack#2 · os-sales · session_01L6bhgVC7KKvrgZyWpM75L8
Clause-②: yes (widening)
Metadata-protocol: none
Widened:
@object-ui/plugin-chatbot's exportedToolDecisionStategains the memberexpired(read fromuseHitlInChat().decisions, passed in throughChatbotEnhancedProps.toolDecisions);@object-ui/i18ngainsaiApprovals.statusExpiredandaiApprovals.expiredDetailin every locale pack. The changeset says the same; it stayspatch.维护者速读
What changes
ui/packages/plugin-chatbot/src/pendingActionLapse.ts(new, not on the package barrel): the one test both surfaces use.isLapsedPendingAction(row)isstatus === 'rejected' && rejection_reason === 'lapsed' && !decided_by;isPendingActionLapsedConflict(status, body)is HTTP409witherror.details.reason === 'pending_action_lapsed'. Any other409keeps its error.AiPendingActionsInbox.tsx(theai:approvalsinbox):StatusBadgetakes the row, so a lapsed row reads "Expired" in the table, the phone card and the drawer. The drawer drops the "Decided by" cell for a lapsed row and shows the Expired reason in place of the rawlapsedrejection reason. An approve or reject answered by the lapse409sets a neutral outcome line ("… Expired · reason") instead of the destructive conflict alert and closes the reject sheet; the hook already re-reads the list after every decision, so the row turns "Expired" on that read.useHitlInChat.ts+chat/types.ts+chat/toolDetail.tsx+ChatbotEnhanced.tsx(the chat's inline approval card): a decision answered by the lapse409sets a newToolDecisionStatevalue,{ state: 'expired', decision }; both the generic approval strip and the record-write card draw "Expired · reason" in the muted style with a clock icon, and the buttons stay gone. No continuation turn is sent.ui/packages/i18n/src/locales/*.ts: two keys,aiApprovals.statusExpiredandaiApprovals.expiredDetail, in all 11 packs (zh-Hant regenerated withgen-zh-hant.mjs); the inbox defaults map repeats theenvalues.ui/e2e/ai-approvals-inbox-phone-35449.spec.ts: the phone-layout spec reads the inbox source by regex; its badge extractor now matches the new call<StatusBadge row={row}(wasstatus={row.status}). Same class string, sameshrink-0requirement. Not run locally (it builds the console first); all 23 of its inbox extractors were tried against the new source by script and each matched, and CI'sBuild & E2E UIpassed at e3c122b..changeset/34255-ai-approvals-lapsed-expired.md: patch for@object-ui/plugin-chatbotand@object-ui/i18n.Small calls this PR made (listed for review)
ToolDecisionStategainsexpired(public type, additive; declared above asClause-②: yes (widening), as theheldmember was). In this repocountWritesAwaitingApprovalcounts it as settled and the pending-question reader as answered, both by their existing tests onundefined/error/pending.onDecidedon a lapse gets the same synthesized envelope as any other non-2xx,{ id, status: 'failed', error }, witherror: 'pending_action_lapsed', so a host can tell the two apart without a contract change (the open question on that envelope stays with objectui#3790).outcomeApprove/outcomeRejectsentence with the message "Expired · reason", in the default (not destructive) alert style.Read first
ui/packages/plugin-chatbot/src/pendingActionLapse.ts: the two predicates; a wrong one either hides a person's rejection or misses the lapse.ui/packages/plugin-chatbot/src/AiPendingActionsInbox.tsx:StatusBadge,isLapsedConflict/expiredOutcome, and theselectedLapseddrawer branches.ui/packages/plugin-chatbot/src/useHitlInChat.ts: the new branch at the top ofif (!response.ok).Tests
New tests (local, head a867146)
ui/packages/plugin-chatbot/src/__tests__/AiPendingActionsInbox.lapsed-34255.test.tsx(zh): a lapsed row reads 已过期 with no 处理人 cell and the reason in the drawer; a row withdecided_byand reasonlapsedreads 已拒绝; a lapsed row whosedecided_byisnullor''reads 已过期 too; an approve answered by the lapse409shows the Expired outcome, not the server's conflict message, the list is read again and the row reads 已过期.ui/packages/plugin-chatbot/src/__tests__/ChatbotEnhanced.lapsedApproval-34255.test.tsx(zh,useHitlInChatandChatbotEnhancedrun together through the real button): the lapse409drawsdata-state="expired"with 已过期 and the reason, no409text, no buttons, andonDecidedgetserror: 'pending_action_lapsed'; a person's reject still draws the rejection; the record-write card draws Expired.Ablation
pendingActionLapse.tsmutated on disk so both predicates answer false (return false && (…),if (true || status !== 409 …)), the two files re-run at a91ac87: 3 failed / 2 passed (the lapsed-row, inbox-409 and chat-409 cases; the person-rejection and record-write cases do not read the predicates), exit 1. Restored withgit checkout.The
null/''decider case, separately:!row.decided_bymutated torow.decided_by === undefined, the inbox file re-run: 1 failed / 2 passed (that case), exit 1. Restored withgit checkout.Package runs, type-check, lint
The package runs are at a91ac87; a867146 adds only the new inbox test case and the changeset's declaration lines. At a867146
pnpm --filter @object-ui/plugin-chatbot run type-checkandeslint --no-inline-configon the changed test file both exit 0 again.pnpm exec vitest run --maxWorkers=3 packages/plugin-chatbot/ packages/i18n/ packages/app-shell/src/console/ai/ packages/app-shell/src/assistant/: 226 files passed, 2 failed on a missing@objectstack/clientdist while the dependency build was still running; afterturbo run build --filter='@object-ui/plugin-chatbot^...' --filter='@object-ui/app-shell^...'(exit 0) those 2 files re-run: 2 passed, 49 tests. Thepackages/i18n/run includesall-locales-key-parityandzh-hant-generated; the plugin-chatbot run includes the defaults-map-against-encomparison inAiPendingActionsInbox.i18n.test.tsx.pnpm --filter @object-ui/plugin-chatbot run type-checkandpnpm --filter @object-ui/i18n run type-check: exit 0 (bothtsc --noEmitandtsc -p tsconfig.test.json).eslint --no-inline-configon the 9 changed plugin-chatbot files: exit 0, 0 errors, 1 warning on an existing re-export line this PR does not touch.Derived gate families (local)
node scripts/pm/dispatch-gates.mjs --commandsat head e3c122b derived 41 families (the same list as at a91ac87 and a867146); each run locally, exit code captured before any pipe:dispatch-gates --ran:41 derived famil(ies) accounted for — 41 run, 0 NOT-MEASURED (a DERIVED zero — all 41 recorded an exit code and none of them is 3).At a91ac87 the same 41 were run;
pnpm --dir ui exec vitest run scripts/was SIGKILLed once inside that loop and passed alone. Also run there (outside the derived list):pnpm --dir ui run check:i18n-keys,check:i18n-drift,check:i18n-dead-keys, each exit 0 (neither new key is listed as dead).CI at e3c122b: 13 skipped, 45 success (58 check-runs), including all 16
Test UIshards,Build & E2E UIandType Check UI.Acceptance notes
pending_action_lapsedinpackages/), so on a self-hosted open-edition server nothing reads differently until it does; the hosted service already answers this shape.ChatPane.tsxor the component it renders;ChatPane.tsxis untouched, the change is in theplugin-chatbotcard and hook it renders.test:repo(vitestrepoproject) not run locally: this diff touches none of its tests; CI'sTest Coreruns it.pnpm check:i18n,check:i18n-coverage,check:i18n-walk-parityanswer exit 3 (prerequisite: a full build) here; they read the server-side bundles, not these packs, and are not in the derived list.check:i18n-stale-fillexit 0.Verification
Two minutes: run the two new test files above from
ui/; expect 6 passing tests, the lapsed rows and both409paths reading 已过期.Generated by Claude Code