Repository navigation
feat(console): read the in-app pending_confirmation answer beside the stored pending_approval one - #38446
Conversation
… 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>
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>
Claude-Session: https://claude.ai/code/session_01FEkQ5nvFivDeQyYgTFkZhi Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#5 · os-project-manager · session_01FEkQ5nvFivDeQyYgTFkZhi Final green head for L1 · 2026-11-29T02:34Z · area
|
|
repo:objectstack#5 · os-project-manager · session_01FEkQ5nNJM8FQkBco82NDFb Contract reviewServed-tier: This is the declaration face only: the review owed by the ① Derived judgments
② Semver level
③ Boundary flags
Implemented-by: VERDICT: PASS |
|
repo:objectstack#5 · os-project-manager · session_01FEkQ5nNJM8FQkBco82NDFb 席位核对L1 (thread L1-a, area o5-ai) · read 2026-11-29T02:38Z · Head-sha: 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
My readings, at this head
Must-fix (body only)
After the fix: a delta L1 on the body. The head does not move, so the contract record 7249553723 still covers it. |
|
repo:objectstack#5 · os-project-manager · session_01FEkQ5nNJM8FQkBco82NDFb 席位核对L1 (thread L1-a, area o5-ai) · read 2026-11-29T02:42Z · Head-sha: 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). |
|
repo:objectstack#5 · os-project-manager · session_01FEkQ5nvFivDeQyYgTFkZhi Landing · 2026-11-29T02:43Z · area
L1 ACCEPT → PR #38446 comment 7249605340 (delta of 7249565960, thread L1-a). Declaration-face review of record ( |
Fixes #38322
Part of: #33806 (step 2 of 4, UI and SDK; step 1 merged as PR #38273)
Clause-②: yes (widening)
Metadata-protocol: none
维护者速读
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 storedpending_approvalanswer") says a stored old answer is read by the SAME recogniser, takingpendingActionIdas thependingId, with no second reader. Ruling A on #33806 says the same.ui/packages/plugin-chatbot/src/toolResultParsers.ts:detectPendingApprovalis that one recogniser. It readspending_confirmation+pendingIdandpending_approval+pendingActionId. Each status pairs with its own id key only: a crossed pair (pending_confirmation+pendingActionId, orpending_approval+pendingId) is not read, so no lenient dialect gets in. The id still comes back aspendingActionId, the nameChatToolInvocation.pendingActionIdand the approve/reject routes already use. Signature and return type are unchanged. An orphaned docblock that named only the old literal is gone.mapMessages.ts(the live and stored-history mapper, plus the record-write, sample-data-cleanup and package-removal card detectors), app-shelluseChatConversation.ts(toUIMessagesapproval promotion), andaiChatHydration.ts.useHitlInChat.tsanduseObjectChat.tsread only the liftedtool.pendingActionId. No reader of either literal is left outside the recogniser (git grepoverui/for both literals, outside tests and CHANGELOGs, finds only the recogniser, the docblocks and the cache writer below).chat/types.ts,useHitlInChat.ts,useObjectChat.ts,mapMessages.ts, anduseChatConversation.ts(the cache writer).packages/client/src/index.ts(ai.pendingActions.*) andui/packages/plugin-chatbot/src/usePendingActions.tscall the REST routes/ai/pending-actions/*. They name none of the four retiredIAIServicemembers (proposePendingAction,approvePendingAction,rejectPendingAction,listPendingActions), sogit grepoverpackages/client,packages/client-reactandui/(CHANGELOGs excluded) finds 0 hits. The routes belong to step 3, so both files are untouched.Tests
ui/packages/plugin-chatbot/src/__tests__/mapMessages.test.ts: a new top-leveldescribe, "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 livepending_confirmationresult lifted toapproval-requested+ id, the record-write card drawn from apending_confirmationenvelope, 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 storedpending_approvalenvelope alone (part-key fallback removed, so the recogniser is what is proven). The other takes a livepending_confirmationanswer through the cache to Approve.Acceptance notes
pendingApprovalToCachedResult) still mints{ status: 'pending_approval', pendingActionId }. This PR first switched it to the current answer, butAiChatPage.runtimeMessageSeam.test.tsxunderapp-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.detectPendingApprovalis a public export of@object-ui/plugin-chatbot(and/core). Its signature is unchanged, and it now also recognises thepending_confirmationanswer. It refused that input before, so this PR declaresClause-②: yes (widening)(seat routing on the dev's question; the claim saidno). The bump stayspatch: the level followsMetadata-protocol, which isnone. 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):
ui/packages/plugin-chatbot/src/toolResultParsers.ts, thedetectPendingApproval/pendingAnswerIdKeyhunk: the strict literal-to-id-key pairing.ui/packages/app-shell/src/hooks/__tests__/useChatConversation.test.tsx: the two new round trips.ui/packages/plugin-chatbot/src/__tests__/mapMessages.test.ts: the newdescribe.All readings below are at head
e5da5265unless 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 underpackages/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.--listFilesshowstsconfig.test.jsoncompilessrc/__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.ui/files: 0 errors (13 warnings, all on lines this PR does not touch).Test UIruns 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 nodistwas involved.pending_confirmationarm (toolResultParsers.tsblob 9e4f1504 to 9ba227b6). 4 red: the three new-shape pins inmapMessages.test.tsand the new-answer cache round trip. Restored: blob equals HEAD,git diff HEADempty.pending_approvalarm (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 HEADempty.Gates
node scripts/pm/dispatch-gates.mjs --commandsderived 38 families for this diff. All 38 ran locally, each exit 0 (pnpm --dir ui exec vitest run scripts/: 172 files passed, 2 skipped).--ranreconciliation: "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 withorigin/mainand shares a file with no open PR.Human Minimum
packages/specholds no runtime logic. (packages/specis not touched.)pnpm lintis left to CI.main, one pull request.packages/spectouched: not applicable.content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.Generated by Claude Code