Repository navigation
feat(chat): a Continue button for a stopped ask turn — spec resume field and data-turn-end part, plugin-chatbot UI - #38698
Conversation
Claude-Session: https://claude.ai/code/session_01JQwxbYmVBS2cvoZWKGbx92 Co-authored-by: Claude <noreply@anthropic.com>
…e field (WIP) Claude-Session: https://claude.ai/code/session_01JQwxbYmVBS2cvoZWKGbx92 Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JQwxbYmVBS2cvoZWKGbx92 Co-authored-by: Claude <noreply@anthropic.com>
…d its reload (WIP) Claude-Session: https://claude.ai/code/session_01JQwxbYmVBS2cvoZWKGbx92 Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JQwxbYmVBS2cvoZWKGbx92 Co-authored-by: Claude <noreply@anthropic.com>
… module Claude-Session: https://claude.ai/code/session_01JQwxbYmVBS2cvoZWKGbx92 Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 1 package(s): 1 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
What this run could not see
Coarse fallback — 182 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 600e81e662d8a50d0a70561be9a0caea226700f4 && git checkout 600e81e662d8a50d0a70561be9a0caea226700f4
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 751e83941b805879e98a210539d242511021a505 a5a90f9ab02678f69e2544354db9fb5ea92c048e && git checkout -B drift-repro 751e83941b805879e98a210539d242511021a505 && git merge --no-ff a5a90f9ab02678f69e2544354db9fb5ea92c048e
node scripts/docs-audit/affected-docs.mjs --json 751e83941b805879e98a210539d242511021a505
|
… the reload test off the chat pane Claude-Session: https://claude.ai/code/session_01JQwxbYmVBS2cvoZWKGbx92 Co-authored-by: Claude <noreply@anthropic.com>
…ges in the Continue snippet The snippet handed useObjectChat().messages straight to ChatbotEnhanced, which the doc-snippet gate refuses (ObjectChatMessage's role includes 'tool'). The console and the runtime test already convert with toRuntimeMessages; the README and the frontend docs page now do the same. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JQwxbYmVBS2cvoZWKGbx92
|
repo:objectstack#2 · os-warren · session_01JQwxbXyLoBzNYY1U8SNPFu Contract-review-claim: session_01JQwxbXyLoBzNYY1U8SNPFu · head f4fbc45 · 2026-11-30T06:42Z |
|
repo:objectstack#2 · os-warren · session_01JQwxbXyLoBzNYY1U8SNPFu Contract reviewServed-tier: Inputs read: card #38609 (body and its five comments: triage 7258167601, claim 7268992318, dispatch order 7269037719, claim amendment 7269233060, dev report 7270906289), PR #38698 (body, 48-file list, net diff from merge base ① Derived judgments
② Semver level
Clause-②: yes (widening) — on the PR body and the changeset, identical. Verified against the diff: every schema change is an added optional key or a new export, nothing is removed, renamed, required or re-typed. ③ Boundary flags
④ Design judgment
S1 (should-fix) — the request now has two turn ids and the contract does not say which one a resume reads. S2 (should-fix) — "streams the rest of its answer into that turn" holds in the chat only under a stream condition the contract does not state. Read in
Implementing files, sentence by sentence against the contract: N1 (nit) — N2 (nit) — the producer section says a turn replayed by its No must-fix. S1 and S2 are open on this head. Implemented-by: VERDICT: PASS |
…e answer one message Contract review of the Continue control (S1, S2): - A resume request no longer carries the top-level turnId. withTurnId stamps it on every other request; on a resume it was either the id of the turn being resumed (which the D1 dedup answers from store) or, after a reload, a store row id. AiChatRequestSchema.resume and turnId now say the top-level key is not read on a resume. - The resume contract (and the turn-end docblock) states that the resume stream's start chunk carries the request's messageId or none: with ai 7.0.118 a start naming another id pushes a second answer. - Pins: the request the client builds carries resume and messageId and no turnId (CONTROL: without resume it is stamped); through the real chat runtime, a start naming the answer's id keeps one bubble, and a start naming another id draws two (CONTROL). Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JQwxbYmVBS2cvoZWKGbx92
|
repo:objectstack#2 · os-warren · session_01JQwxbXyLoBzNYY1U8SNPFu Contract-review-claim: session_01JQwxbXyLoBzNYY1U8SNPFu · head 1c98384 · 2026-11-30T07:33Z |
|
repo:objectstack#2 · os-warren · session_01JQwxbXyLoBzNYY1U8SNPFu Contract reviewServed-tier: Delta review of record 7271059472 (head ① Derived judgments
② Semver levelUnchanged: Clause-②: yes (widening) — still on the PR body and the changeset, and still what the diff is. ③ Boundary flags
④ Design judgmentS1: closed. S2: closed. S3 (should-fix) — new on this head, in the sentence the S2 fix added.
No must-fix. S3 is open on this head. Implemented-by: VERDICT: PASS |
…o an earlier answer Contract review S3. The chat runtime's send with no message (ai 7.0.118) addresses the newest assistant message holding an approval-responded tool part, not the last message, and restored history keeps that state on purpose. In such a thread a resume would send the earlier answer's id as messageId and stream the rest into it. The runtime offers no public way to name the target, so the hook now offers resumeTurn only while that send addresses the last answer (resumeAddressesLastAnswer in resumeTurn.ts mirrors the runtime's rule); otherwise no Continue is drawn. Pins: the target rule (last answer; an earlier answered approval wins; the last answer holding one is still the last answer), and through the real runtime a restored thread with an earlier approval-responded part draws no Continue and sends nothing (CONTROL: the same thread with the approval already run offers Continue and the resume addresses a1). README and the frontend docs page say so. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JQwxbYmVBS2cvoZWKGbx92
|
repo:objectstack#2 · os-warren · session_01JQwxbXyLoBzNYY1U8SNPFu Contract reviewServed-tier: Delta review of record 7271982421 (head ① Derived judgments
② Semver levelUnchanged: Clause-②: yes (widening) — unchanged on the PR body and the changeset, and still what the diff is. Note, not graded: the changeset's ③ Boundary flags
④ Design judgmentS3: closed, by the second arm. The hook hands out The mirror is the runtime's rule. Tried to break it:
The cost is stated, not hidden: a conversation whose history keeps an answered approval offers no Continue at all, and the person continues by typing. The README and the frontend docs page say so in the same words, and the spec sentence "the chat sends the id of the answer being carried on as the request's N3 (nit) — the turn-end docblock's "What the chat does with it" still gives the offer rule as No must-fix, no should-fix. Implemented-by: VERDICT: PASS |
|
repo:objectstack#2 · os-warren · session_01JQwxbXyLoBzNYY1U8SNPFu 维护者速读
席位核对ACCEPT · L1 · area o2-A · Head-sha
|
|
repo:objectstack#2 · os-warren · session_01JQwxbXyLoBzNYY1U8SNPFu 2026-11-30T08:24Z · Landing · seat ACCEPT 7272862815 at
|
Requested by Warren · project thread
Part of #38609
Clause-②: yes (widening)
Metadata-protocol: added
Skills-docs: none — the added keys are the AI chat route's wire (
resume) and its stream part and stored message field (turnEnd), written by the AI service and read by the console chat; no metadata author writes them and no published skill teaches the chat wire维护者速读
What changes
Spec (
@objectstack/spec) — three additions, all closed shapes:TurnEndSchema+TURN_END_PART_TYPE = 'data-turn-end'in a newpackages/spec/src/ai/turn-end.zod.ts(modelled ondraft-review.zod.ts):{ reason, wrapUp, resumable, resumesLeft, turnId }.reasonis a non-empty string, not an enum: the producer's vocabulary includes every turn-refusal kind and grows with it, and the chat decides nothing from it.resumableis the server's verdict alone.AiChatRequestSchema.resume: optional{ turnId }(closed,turnIdnon-empty). Its text says a resume names its turn itself (the top-levelturnIdis not read on a resume, andturnId's own description says so) and that the resume stream'sstartchunk carries the request'smessageIdor none.AiConversationMessageSchema.turnEnd: optional, nullableTurnEndSchema, on the turn's last message, so a reload knows the turn end too.api-surface,export-origins,declaration-map, references docs, strictness ledger counts, authorable-surface and json-schema manifest projections (check:generated --fix, only the five it proved stale).UI (
@object-ui/plugin-chatbot,@object-ui/app-shell,@object-ui/i18n):mapMessages.extractTurnEndreads the newestdata-turn-endpart throughTurnEndSchemaontoChatbotEnhancedMessage.turnEnd; a refused part is no turn end.chat/ContinueTurnButton.tsx(the control) andchat/resumableTurn.ts(resumableTurnOf, where it is drawn).ChatbotEnhancedtakesonResumeTurn(turnId)and draws Continue under the conversation's last answer only when its turn end isresumablewithresumesLeft > 0, nothing streams, and the view is not read-only. A message sent afterwards makes the answer no longer last, so the control goes.resumeTurn.ts;useObjectChatreturnsresumeTurn(turnId)in API mode: the chat runtime'ssendMessage(undefined, { body: { resume: { turnId } } })sends the conversation as it stands (no user message, no bubble) and streams into the last assistant message, sending the answer's id asmessageId.withTurnIdstamps the turn id on every request except a resume. The runtime's no-message send addresses the newest answer holding anapproval-respondedtool part rather than the last answer, and offers no public way to name the target, so the hook offersresumeTurnonly while that send addresses the last answer (resumeAddressesLastAnswer); otherwise no Continue is drawn.STORED_ANSWER_DATA_PARTS.turnEnd; write instoredAnswerParts, read instoredAnswerData), so it survives API mode's store rebuild and the message cache;toUIMessageswrites a storedturnEndfield back as that part, so server history and cache are read by one reader.ChatPanepassesresumeTurn; the schema renderer passes it in both chat surfaces.chatbot.continueTurn.*strings in all eleven locales (zh-Hant regenerated from zh-Hans by its generator); README and the frontend docs page document the control.Where the stream comes from. The console's ask chat is served by the cloud AI service (agent route + stream encoder), not by this repository. Until it sends
data-turn-endand acceptsresume, nothing is drawn and no resume is sent. That half — persistturnEnd, emit the part, accept and executeresume, and the ADR-0013 D3 amendment — is objectstack-ai/cloud#5239. This PR is thereforePart of: the card's done-when also needs the spec released into the pin cloud consumes and a check against cloud#5239's endpoint.Why
Maintainer-directed (filing gate ③ on the card): a turn that stops on a limit today can only be continued by typing, which starts a new turn that cannot see the tool results the stopped one already read. A server-side resume of the same turn needs the request field, an end-of-turn signal the UI can read live and after a reload, and a button.
Tests
packages/spec/src/ai/turn-end.test.ts— the part name; admits a resumable wrap-up and a finished answer; refuses an unknown key (unrecognized_keys), each missing key by path, a negative or fractional count, an empty reason or turn id;resumeadmitted and kept, refused when empty, missingturnIdor carrying an unknown key;turnEndadmitted, null or absent, and refused through the same closed shape.ui/packages/plugin-chatbot/src/__tests__/continueTurn-38609.test.tsx— the kept-part entry equalsTURN_END_PART_TYPE; lift / refuse / newest wins / stored-part round trip; where Continue is drawn and every hide case (not resumable, none left, streaming, a later user or assistant message, loading, read-only, no handler); the request body (resumeandmessageId, no top-levelturnId; CONTROL: withoutresumeit is stamped); and three tests through the real chat runtime with a stubbed stream: a restored thread draws Continue, the click sendsresume: { turnId }with exactly the two existing messages,messageId: 'a1'and noturnId, the rest of the answer lands in the same bubble with no new user bubble, and the new turn end hides the control; astartnaming the request'smessageIdkeeps one answer bubble; CONTROL: astartnaming another id draws a second answer; the resume-target rule (last answer; an earlier answered approval wins; the last answer holding one is still last); a restored thread with an earlierapproval-respondedpart draws no Continue and sends nothing (CONTROL: with that approval already run, Continue resumesa1).ui/packages/app-shell/src/console/ai/__tests__/AiChatPage.turnEndReload-38609.test.tsx— server history (storedturnEndfield) and cache fallback both restore Continue; CONTROL: a refused, null or absent stored turn end offers nothing.resumebody turns the request pin and the runtime test red (2 failed); not writing the storedturnEndback intoUIMessagesturns the server-history pin red (1 failed); stampingturnIdon a resume again turns the request pin and the runtime test red (2 failed); offeringresumeTurnwhatever the target turns the earlier-approval pin red (1 failed).Local gates: the derived family run (
dispatch-gates.mjs --commands, 119 commands) ran beside the first CI run; its readings, with the head they were taken on, are in the os-dev report comment on #38609. Spec package:pnpm --filter @objectstack/spec test914 files / 28919 tests passed,typecheckexit 0. Speccheck:generated: all 14 artifacts up to date. UItype-check(plugin-chatbot, i18n, app-shell): exit 0. UI tests (plugin-chatbot, i18n, app-shellconsole/ai+hooks): 337 files, 1 failure (zh-Hant not regenerated) fixed by running its generator, then green.Acceptance notes
chatbot.continueTurn.*keys in everyui/packages/i18nlocale (key-parity test), one prop line inChatPane.tsxandui/packages/plugin-chatbot/README.mdare admitted by claim amendment 7269233060; thecontent/docs/frontend/plugins/plugin-chatbot.mdxsection (ui/AGENTS.mdcommandment 2) is admitted by the seat's further amendment after the contract review.Clause-②:is writtenyes (widening)(the claim'syes, with the arm its own text states: additive, optional).Metadata-protocol:isadded, not the claim'snone: measured from the diff, the change moves theauthorable-surfaceshards (ai/TurnEnd:*,api/AiChatRequest:resume,api/AiConversationMessage:turnEnd), andcheck-changeset-no-majorreads that as a key entered.@objectstack/specis gradedminoraccordingly; the UI packages staypatch.packages/spec/llms.txtcounts the new schema module (ai 18, 233 in all) with a Turn End row, ascheck:llms-txtrequires.data-turn-endnor acceptsresumebefore cloud#5239. The runtime-level test above drives the real AI SDK chat with a stubbed stream instead; the card's "verified against cloud#5239's resume endpoint" stays open.extractTurnEndis not re-exported from the package root (only the chat itself reads the part).For cloud#5239
Not fixed here: they belong to the server half, which picks them up from this list (contract review comment 7271059472 on this PR).
AIConversationMessageinpackages/spec/src/contracts/ai-service.tsnamesAiConversationMessageSchemaas its wire shape but carriesturnIdonly, andaddMessagehas no way to write a turn end. How the turn end is stored is the server half's; widen the contract there, so the spec is not released twice for one feature.turnId(ADR-0013 D1, nothing ran) sends no turn end, so a Retry of a wrapped-up answer loses Continue until a reload restores it from the stored field. Declared behaviour and a producer choice.resume: { turnId }tells a network retry of one press from the next press, so one press can spend two resumes. The shape is closed, so any such key is a later widening.Verification
Two minutes:
pnpm --dir ui exec vitest run packages/plugin-chatbot/src/__tests__/continueTurn-38609.test.tsx— 19 passed, including the runtime tests that click Continue, read the sent body and count the answer bubbles.Read first (by risk):
ui/packages/plugin-chatbot/src/useObjectChat.tsresumeTurn+resumeTurn.ts— relies on the AI SDK sending the current messages and streaming into the last assistant message whensendMessagegets no message (ai 7.0.118,AbstractChat.sendMessage/makeRequest).packages/spec/src/api/protocol.zod.ts— the two new keys on published wire schemas.ui/packages/plugin-chatbot/src/chat/resumableTurn.tsresumableTurnOf— the show/hide rule.Human Minimum
packages/specholds no runtime logic.pnpm lintpasses (CI).main, one pull request.packages/spectouched: its generated artifacts are regenerated and committed.content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.🤖 Generated with Claude Code
https://claude.ai/code/session_01JQwxbYmVBS2cvoZWKGbx92
Generated by Claude Code