Skip to content

feat(console): read the in-app pending_confirmation answer beside the stored pending_approval one - #38446

Merged
objectstack-fleet[bot] merged 4 commits into
mainfrom
claude/issue-38322-console-pending-confirmation
Nov 29, 2026
Merged

objectstack-fleet[bot] merged 4 commits into
mainfrom
claude/issue-38322-console-pending-confirmation

Conversation

@objectstack-fleet

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

Copy link
Copy Markdown
Contributor

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

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

维护者速读

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

What changes

Step 1 (PR #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 #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: review follow-ups of PR #38446: the console chat cache still writes the retired pending_approval answer #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.

Tests (local, under the shared verify lock)
  • 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.
Ablation (on-disk mutation via scripts/ablation-replace.mjs, restored to the HEAD blob each time)

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

  • Removed the pending_confirmation arm (toolResultParsers.ts blob 9e4f1504 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 9e4f1504 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.
Gates
  • 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.

Human Minimum

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

Generated by Claude Code

… pending_approval one

One recogniser, detectPendingApproval, reads the current in-app pending
answer (pending_confirmation with pendingId) and the retired one a stored
conversation still carries (pending_approval with pendingActionId); each
literal pairs with its own id key only. The chat cache re-mints the current
answer. Docblocks that named only the old literal now name both.

Claude-Session: https://claude.ai/code/session_01FEkQ5nvFivDeQyYgTFkZhi
Co-authored-by: Claude <noreply@anthropic.com>
The cache writer's minted shape is pinned by a console test outside this
card's file surface, so the writer stays as it was; the one recogniser reads
both answers either way.

Claude-Session: https://claude.ai/code/session_01FEkQ5nvFivDeQyYgTFkZhi
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/m 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 29, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-project-manager · session_01FEkQ5nvFivDeQyYgTFkZhi

Final green head for L1 · 2026-11-29T02:34Z · area o5-ai

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-project-manager · session_01FEkQ5nNJM8FQkBco82NDFb

Contract review

Served-tier: TIER_DEFAULT
Head-sha: d4d20ddc3bf7e9482d4c8b838e87fa8ee32c62b6
Local-runs: none

This is the declaration face only: the review owed by the Clause-②: yes (widening) line, since the diff touches no published schema, no governed path and no narrowing. It is rendered by the L1-a thread, a session independent of the one that dispatched the dev (session_01FEkQ5nvFivDeQyYgTFkZhi), as l1-a.md allows for a TIER_DEFAULT-only face. Read: the PR's net diff against main, its body, card #38322, ruling 7237978621 on #33806, and the spec contract on main (packages/spec/src/contracts/action-confirmation-contract.pin.test.ts).

① Derived judgments

  • The widening is real and is the only change to the accept set. detectPendingApproval is a public export, from the root entry (src/index.tsx) and from ./core (src/core.ts:54, exports["./core"] in package.json). Before, it accepted status: 'pending_approval' with a non-empty string pendingActionId. Now pendingAnswerIdKey maps pending_confirmation → pendingId and pending_approval → pendingActionId. Every input accepted before is still accepted with the same result, and one shape is newly accepted. Its signature and return type are unchanged: { pendingActionId, raw }, with the id returned under the old name for either shape.
  • No narrowing hides in it. The crossed pairs (pending_confirmation with only pendingActionId, pending_approval with only pendingId) were refused before and are refused now. So are empty, non-string and unknown-status inputs, including a prototype-key status ('toString'). All of these are pinned at mapMessages.test.ts:306–313.
  • It agrees with the contract it implements. The spec's ActionConfirmationPending is status: 'pending_confirmation' with pendingId, and its pin refuses pending_approval as that type's discriminant. The contract prose pinned there says a stored pending_approval answer is read "through the SAME recogniser … taking pendingActionId as the pendingId; ⛔ there is no second reader of the retired literal". In ui/ source at this head the literals are compared in exactly one place, toolResultParsers.ts:154–155. The other two hits are a docblock and the cache writer (see ③). This is ruling A's step 2 as recorded (7237978621: "read by the same recogniser, with no second reader").

② Semver level

patch on @object-ui/plugin-chatbot and @object-ui/app-shell is right. Metadata-protocol: none, and AGENTS.md's level rule is that "a non-protocol change, widening or breaking, ships patch". The changeset and the PR body both carry Clause-②: yes (widening) and Metadata-protocol: none, and l1-face reads the pair from the body. The changeset says what widens, and that no export is added or removed.

③ Boundary flags

  • Dev Q2 (does the grown input set count as widening?): answered by the seat's routing, B. It is re-declared yes (widening) in both places, and this record is the review that declaration owes.
  • Dev Q1 (the cache writer still mints pending_approval): the writer is useChatConversation.ts:279. It writes a retired literal, which is no second reader, and the one recogniser restores it. Carrier review follow-ups of PR #38446: the console chat cache still writes the retired pending_approval answer #38448 (open). No contract effect at this head.
  • The SDK half of the card: packages/client and usePendingActions.ts call the REST routes and name none of the four retired IAIService members, as the body states. Nothing is owed.
  • SQL push-down: no finding. The diff is client-side parsing, with no query, id materialisation or join.
  • Author: the PR is authored through the relay under the seat account. No other login to name.

Implemented-by: claude/issue-38322-console-pending-confirmation
Reviewed-by: session_01FEkQ5nNJM8FQkBco82NDFb

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-project-manager · session_01FEkQ5nNJM8FQkBco82NDFb

席位核对

L1 (thread L1-a, area o5-ai) · read 2026-11-29T02:38Z · Head-sha: d4d20ddc3bf7e9482d4c8b838e87fa8ee32c62b6 · verdict REWORK (body only, one carrier)

This is the first L1 record on this PR, a full review. The code, the tests and the declaration are accepted. The declaration-face contract review is a separate record on this same head: PASS, comment 7249553723. One body line names a residual without its card.

Checklist (l1-face --pr 38446 at d4d20dd: CLEAN, 13 items)

  • Shape: open, draft, base main. Fixes #38322 is right: the card's three Expected items are delivered. One recogniser reads both answers, with a test for each and for a stored conversation. The SDK half has nothing to move (packages/client and usePendingActions.ts call the REST routes and name no retired IAIService member). No runtime, route or spec change. Part of: #33806 (step 2 of 4) is a plain pointer and does not close.
  • Scope: 9 files, +286/−31, under ui/packages/plugin-chatbot and ui/packages/app-shell, plus one changeset (both packages patch). Clause-②: yes (widening) · Metadata-protocol: none, in the body and the changeset alike. Not governed, so the area lands it.
  • Gates at d4d20dd: 41 success, 15 expected skip, 0 failed, 0 pending; mergeable_state clean.

My readings, at this head

  • detectPendingApproval now asks pendingAnswerIdKey(status): pending_confirmation → pendingId, pending_approval → pendingActionId, anything else undefined. It returns the id as pendingActionId either way, so every caller (mapMessages, app-shell toUIMessages, aiChatHydration) is unchanged.
  • One reader: in ui/ source at this head the two literals are compared only at toolResultParsers.ts:154–155. The other code hit is the cache writer at useChatConversation.ts:279, which writes and does not read.
  • Crossed pairs, empty or non-string ids, unknown statuses and 'toString' are each refused (mapMessages.test.ts:306–313). The body's ablations pin both arms: removing the pending_confirmation arm turns 4 cases red, and removing the pending_approval arm turns 6 red, with the restore shown.
  • Docblocks in chat/types.ts, useHitlInChat.ts, useObjectChat.ts, mapMessages.ts and useChatConversation.ts now name both answers, and none teaches a second reader.

Must-fix (body only)

  1. The cache-writer residual needs its card. The body's line on pendingApprovalToCachedResult, which still mints pending_approval, ends with "is reported to the seat". The seat has since filed review follow-ups of PR #38446: the console chat cache still writes the retired pending_approval answer #38448 (open, "the console chat cache still writes the retired pending_approval answer"). Put #38448 on that line as its carrier. "Reported to the seat" is not a carrier.

After the fix: a delta L1 on the body. The head does not move, so the contract record 7249553723 still covers it.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-project-manager · session_01FEkQ5nNJM8FQkBco82NDFb

席位核对

L1 (thread L1-a, area o5-ai) · read 2026-11-29T02:42Z · Head-sha: d4d20ddc3bf7e9482d4c8b838e87fa8ee32c62b6 · verdict ACCEPT (delta, body only)

This is a delta from my REWORK 7249565960 on this same head. The head did not move, and only the body changed.

Everything accepted in 7249565960 stands. Owed: nothing. The area lands it (not governed).

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-project-manager · session_01FEkQ5nvFivDeQyYgTFkZhi

Landing · 2026-11-29T02:43Z · area o5-ai · head d4d20ddc3bf7e9482d4c8b838e87fa8ee32c62b6

Probe Reading
check-governed-merges.mjs --pr 38446 NOT governed; 317 changed lines, under 3000
pr-state.mjs --pr 38446 43 success, 17 expected skip, 0 failed, 0 pending; mergeable_state clean
K landing-k.mjs cannot answer (no Test Core shard ran on this UI head, so no Affected-set diff base). By hand: merge base 28c2fe8, 7 first-parent commits to origin/main, none under ui/packages/plugin-chatbot, ui/packages/app-shell/src/hooks or ui/packages/app-shell/src/console/ai; under 15

L1 ACCEPT → PR #38446 comment 7249605340 (delta of 7249565960, thread L1-a). Declaration-face review of record (Clause-②: yes (widening), TIER_DEFAULT) PASS → 7249553723, by L1-a, independent of the dispatching session.
Status: ready for review and auto-merge through the queue; #38322 closes on merge (Fixes). Follow-up #38448 stays queued.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 29, 2026 02:44
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 29, 2026
Merged via the queue into main with commit e4a02be Nov 29, 2026
61 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-38322-console-pending-confirmation branch November 29, 2026 03:05
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/m 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.

console: read the in-app pending_confirmation answer beside the old pending_approval one (#33806 step 2, UI and SDK)

2 participants