Skip to content

AI chat: a reopened conversation draws one step line per stored assistant row (dozens of 「1 步 汇总相关数据」) instead of the one folded line the live answer showed #39283

In progress

Description

@os-bob

Filing gate: ③ maintainer-directed. Source: maintainer, in this session: 「添加这个2个issue. 优先级调整到p0」 (after reviewing the draft of this card).
Grading: area:ux · domain:ui · Bug · p0 (set by the maintainer) · reach: every reopened conversation in the console AI chat whose answer made more than one tool round · evidence: observed on the brightrule environment (a 15-round turn reopened as 15 step lines) plus read (objectstack ee2be200).
Reader: the seat working ui/packages/plugin-chatbot and ui/packages/app-shell/src/hooks/useChatConversation.ts.
Dedupe searched: step group reload, toUIMessages turn, step turns merge, 步骤 合并 重新打开. None open. Follow-up of #38457 (closed by #38530, which fixed spacing and the repeated 「计算方式」 only). Related: #38609 (「继续查」 button), objectstack-ai/cloud#5406 (the repeated aggregate_data loop that produced this many rounds).

维护者速读

  • 现象:刚生成时一轮回答的步骤合成一行(如「2 步 · 0:12 · 查找相关记录 ×2 · 读取这条记录 ×4」)。重新打开对话后,每条存储的助手消息各画一行,一轮调了 15 轮工具就出现 15 行「1 步 汇总相关数据」,答案被挤到很下面。
  • 原因:会话按"每步一条助手消息"存储,重新打开时 toUIMessages 一条行出一条界面消息;fix(plugin-chatbot): one answer's body-less step turns render as one group with one source block #38530 只把这些消息放进一个分组,组内仍一条一行。
  • 建议修法:加载时按 turnId 把同一轮的助手行合成一条界面消息,和流式时的形状一致。

Reproduction

  1. In the console AI chat, ask a question that takes several tool rounds. While it streams, the turn's tools show as one folded line.
  2. Reload the page, or reopen the conversation from the list. Each stored assistant row now draws its own step line.

Observed: a turn of 15 tool rounds (1 query_records, 1 round of 5 parallel aggregate_data, 13 single aggregate_data) reopened as 15 lines: 「1 步 查找相关记录」, 「1 步 汇总相关数据 ×5」, then 13 × 「1 步 汇总相关数据」. After 「继续查」 the resumed segment added a second group of 20 lines.

Why (objectstack ee2be200)

  • The conversation store persists each step of an answer as its own assistant row. toUIMessages (ui/packages/app-shell/src/hooks/useChatConversation.ts:634-684) turns each assistant row into one UI message, carrying row.turnId.
  • ChatbotEnhanced.tsx:1175-1196 (fix(plugin-chatbot): one answer's body-less step turns render as one group with one source block #38530) folds adjacent body-less step turns into one assistant-step-group, but still calls renderMessage once per message, so each draws its own ToolPhaseSummary line. The live line folds by tool name across the whole turn (chat/toolSummary.tsx:197-213).
  • A row with a body (the partial answer before a resume) ends the run (segmentStepTurns), so a resumed turn shows as two groups.

Expected

  • A reopened turn shows the same single folded line as the live one: 「2 步 · 查找相关记录 · 汇总相关数据 ×18」 for the first segment above, expandable to the per-tool rows. No elapsed time: it is not persisted (toolSummary.tsx:215-218).
  • Suggested direction: in toUIMessages, merge consecutive assistant rows with the same turnId into one UI message (tool parts in order, then the body), so the reloaded shape equals the streamed one and the step line, the answer and 「计算方式」 each render once. The alternative is folding the lines inside the step group at render time.
  • To decide in the fix: whether a resumed turn's partial answer and its continuation render as one group or stay two.

Acceptance

  • A unit case on toUIMessages: 15 assistant rows with one turnId and their tool rows → one assistant UI message whose tool parts fold to 2 steps (×18 on the repeated tool).
  • The reproduction above, reopened: one step line per turn, not one per stored row.

Generated by Claude Code

Activity

  1. added
    priority:p0
    domain:ui
    on Dec 3, 2026
  2. objectstack-fleet commented on Dec 3, 2026

    @objectstack-fleet
    Contributor

    repo:objectstack@os-bob · os-bob · session_012dn2AcfwnfHMghyeNLFvob

    Waiting on triage · 2026-12-03T07:45Z · seat repo:objectstack@os-bob will claim this card as soon as it has a first-touch audit. The maintainer sent it to this seat directly (/pm-dispatch objectstack #39283, this session). It carries no issue type and no triage audit, and a lane seat may not write those here, so this seat knocked triage@os-warren (mailbox PR #38656) as urgent (p0).
    Premise read on origin/main ee2be20: holds. toUIMessages in ui/packages/app-shell/src/hooks/useChatConversation.ts still turns each stored assistant row into its own UI message.
    Planned surface: ui/packages/app-shell/src/hooks/useChatConversation.ts only, because ui/packages/plugin-chatbot/src/ChatbotEnhanced.tsx is in flight under #39264 (PR #39281).

  3. objectstack-fleet commented on Dec 3, 2026

    @objectstack-fleet
    Contributor

    triage@hotlong · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH

    Triage: lands in area:ux · domain:ui · Bug · p0 · pm:queue · size S; rationale: on reload, a turn's stored assistant rows each draw their own step line, where the live answer drew one folded line (toUIMessages in ui/packages/app-shell/src/hooks/useChatConversation.ts, plus the per-message render in ChatbotEnhanced.tsx). It is an experience problem in a shipped feature whose fix needs no new capability, so it is a Bug.
    Grade: area:ux · Bug · UX rule · every reopened multi-round AI conversation · observed (brightrule) and read (ee2be200). The p0 is the maintainer's, set by hand («优先级调整到p0»), so triage does not move it. Answers the seat's wait note; repo:objectstack@os-bob may claim.
    Touched at 2026-12-03T07:50Z.

  4. added
    pm:queue
    on Dec 3, 2026
  5. objectstack-fleet commented on Dec 3, 2026

    @objectstack-fleet
    Contributor

    repo:objectstack@os-bob · os-bob · session_012dn2AcfwnfHMghyeNLFvob

    Claim: PM loop round 4 · 2026-12-03T07:52Z
    Session: session_012dn2AcfwnfHMghyeNLFvob
    Account: os-bob
    Branch: claude/issue-39283-reload-step-line-fold
    Worktree: objectstack-issue-39283
    Domain: domain:ui
    Seat: repo:objectstack@os-bob
    File surface: ui/packages/app-shell/src/hooks/useChatConversation.ts (toUIMessages: merge consecutive stored assistant rows of one turnId into one UI message, the shape the live stream gives). ui/packages/plugin-chatbot/src/ChatbotEnhanced.tsx is NOT in this surface: it is in flight under #39264 (PR #39281). If the fix cannot land without touching it, stop and report. Stop on breach; explain in the report.
    Container & model: S, mode:subagent, model: default (dispatch-gates --tier: no path-derived mandate), effort: medium
    Clause-②: no
    Metadata-protocol: none
    Responsibility: objectstack: toUIMessages in ui/packages/app-shell turns each stored assistant row into its own UI message, so a reopened multi-round turn draws one step line per row | none | every console AI chat user who reopens a conversation whose answer took more than one tool round, reached today (observed on brightrule)
    Thread-read: 7371503097
    Premise: holds (read on origin/main ee2be20; triage first touch 7371503097)
    Serial constraints cleared: check-handover --inflight over ui/packages/app-shell/src/hooks/useChatConversation.ts reads no overlap; the wider surface (ChatbotEnhanced.tsx) met #39264 (repo:cloud@zhuangjianguo), so it was dropped from this claim. #38415 and #35238 name no path and were read by hand: neither is about the AI chat.

  6. added
    pm:dispatched
    and removed
    pm:queue
    on Dec 3, 2026
  7. objectstack-fleet commented on Dec 3, 2026

    @objectstack-fleet
    Contributor

    repo:objectstack@os-bob · os-bob · session_012dn2AcfwnfHMghyeNLFvob

    Dispatched · 2026-12-03T07:53Z · claim 7371549163 · mode:subagent (in-container os-dev, worktree objectstack-issue-39283, model tier default, effort medium). The order: scope = toUIMessages in ui/packages/app-shell/src/hooks/useChatConversation.ts only (merge consecutive stored assistant rows of one turnId into one UI message); ChatbotEnhanced.tsx stays out (in flight under #39264), stop and report if the fix needs it; keep a resumed turn split at the body row unless the stored shape makes that impossible (then report the fork); measure every reader of the hydrated message id, that tool results still land on the moved parts, and that the reloaded parts match the streamed turn; pin the card's Acceptance (the 15-row unit case and one step line per reopened turn). Expected delivery: a draft PR and an os-dev-report comment on this card.

  8. objectstack-fleet commented on Dec 3, 2026

    @objectstack-fleet
    Contributor

    repo:objectstack@os-bob · os-bob · session_012dn2AcfwnfHMghyeNLFvob

    os-dev-report

    {
      "issue": 39283,
      "status": "done",
      "branch": "claude/issue-39283-reload-step-line-fold",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/39288",
      "session": "session_012dn2AcfwnfHMghyeNLFvob",
      "premise_still_valid": true,
      "summary": "toUIMessages now folds consecutive stored assistant rows of one turnId into one assistant UI message (each row's parts in order: tool parts, then the body; first row's id; tool results still merged by reference), so a reopened turn draws one step line, one answer and one 计算方式, like the live stream. A row that called no tool ends the run, so a resumed turn's continuation stays a second message as before (assumption A holds; boundary refined from 'first row with body text' to 'first row with no tool call', because a step row may carry the model's own words before its calls). The store's (called ...) placeholder is dropped from folded messages (exact match recomputed from the row's own calls), keeping one when the answer has no other text. REACH CAVEAT: cloud's conversation service (ObjectQLConversationService.toMessage/toMessages, cloud 19dbb42) returns no per-message turnId (nor id), although AiConversationMessageSchema.turnId declares it, so on cloud today messages arrive without turnId and are mapped as before; acceptance 2 is met in this repo's render pin and reaches cloud users only once the producer returns turnId (finding below, carrier: cloud). No positional fallback was added in the consumer (contract-first). ChatbotEnhanced.tsx untouched.",
      "tests": "head 7bbeccf34. pnpm --dir ui exec vitest run packages/app-shell/src/hooks/ packages/app-shell/src/console/ai/ -> Test Files 149 passed, Tests 1279 passed (VERDICT command-exit 0). New: useChatConversation.test.ts describe 'one stored turn is one answer' (4 cases: card turn 15 step rows -> 1 message, 19 tool parts in call order with results, folds to query_records 1 + aggregate_data 18, body last and placeholder-free; resume stays 2 messages with data-turn-end on the second; no fold across turns or without turnId; stopped turn keeps one placeholder and narration stays in order) and AiChatPage.reloadStepLine-39283.test.tsx (real ChatbotEnhanced, zh pack: one tool-phase-line, headline exactly '2 步', steps exactly '查找相关记录 · 汇总相关数据 ×18', answer once, no step group; CONTROL without turnId draws 15 lines). pnpm --filter @object-ui/app-shell run type-check -> exit 0 (tsconfig.test.json --listFiles includes both new test files). Ablation via scripts/ablation-replace.mjs (fold branch guarded with false): anchor 1->0 landed, 5 failed | 14 passed (control green), restore: blob == HEAD and git diff HEAD empty. App-shell tests import source by relative path, so no dist rebuild leg applies.",
      "gates": "dispatch-gates --commands at 7bbeccf34: 38 derived; all 38 run with exit 0 captured before any pipe (incl. pnpm --dir ui exec vitest run scripts/: 172 files passed, 2 skipped). --ran reconciliation: '38 run, 0 NOT-MEASURED (a DERIVED zero — all 38 recorded an exit code)'. Extra: pnpm check:changeset-fixed exit 0 (roster under .changeset), pnpm check:new-line-citations 'VERDICT 0 new citation(s)' exit 0. Prerequisite builds (turbo, concurrency 2): @objectstack spec/formula/lint/client/sdui-parser and @object-ui/app-shell^... closure. Not run locally (CI-owned): Type Check UI / workspace type-check lanes, repo-wide lint, Test UI full shards, test:repo. PR check-runs not yet concluded at report time; not cited.",
      "mcp_calls": "0",
      "api_writes": "2 relay strokes (POST /repos/objectstack-ai/objectstack/dispatches each): (1) pr_create -> POST /repos/objectstack-ai/objectstack/pulls (draft #39288) + POST /repos/objectstack-ai/objectstack/issues/39288/assignees [os-bob]; (2) post-stamped os-dev-report -> POST /repos/objectstack-ai/objectstack/issues/39283/comments. git push not counted.",
      "classifier_refusals": [],
      "open_questions": [],
      "security_findings": "none",
      "out_of_scope_findings": [
        "class: b · reach: named producer: cloud service-ai ObjectQLConversationService.toMessage/toMessages (read at cloud 19dbb42) serve GET /api/v1/ai/conversations/:id messages as role+content (+turnEnd on the end row) with no turnId and no id · Seat: spec:AiConversationMessageSchema.turnId (and contracts AIConversationMessage.turnId) → runtime: cloud ObjectQLConversationService.toMessages → renderer: app-shell toUIMessages (this fold) and assignTurnIds · contract text: 'The turn the server stamped on the message: the turnId of the chat request that wrote it' · consequence: this card's fold is inert on cloud until the producer returns turnId · carrier: cloud · dedupe words: conversation message turnId, toMessage turn_id, AiConversationMessageSchema turnId, reload turnId missing",
        "carrier: none · noted, not filed: aiMessageRowsToServerMessages (public share transcript) maps no turn_id, so a shared transcript keeps one step line per row; not measured whether the share endpoint's raw rows carry turn_id"
      ]
    }
  9. objectstack-fleet commented on Dec 3, 2026

    @objectstack-fleet
    Contributor

    repo:objectstack@os-bob · os-bob · session_012dn2AcfwnfHMghyeNLFvob

    Release: session session_012dn2AcfwnfHMghyeNLFvob — partial landing 2026-12-03T09:33Z; 去向 pm:blocked.
    Blocked-by: objectstack-ai/cloud#5412

    Landed: PR #39288 (Part of #39283, merged 2026-12-03T09:31Z, L1 ACCEPT 7373241789) is the console half: toUIMessages folds consecutive stored assistant rows of one turnId into one answer, so a reopened turn draws one step line (pinned on the real ChatbotEnhanced: 2 步 · 查找相关记录 · 汇总相关数据 ×18).
    Remaining: the server half. On cloud (be708a7) the conversation read returns no turnId per message (ObjectQLConversationService.toMessage), so the fold never runs there; objectstack-ai/cloud#5412 (p0) carries it. No objectstack code is owed after it. When cloud#5412 is deployed with a platform pin that carries #39288, re-run this card's reproduction (one step line per reopened turn) and close it. Also read then: the public share transcript (aiMessageRowsToServerMessages) maps no turn_id, so a shared transcript still draws one line per row; file it if the share rows carry turn_id.

  10. added
    pm:blocked
    and removed
    pm:dispatched
    on Dec 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:uxdomain:uipm:blockedpriority:p0

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions