Skip to content

Chatbot: a reloaded answer draws a redrawn chart twice, because the history reader keeps every visualize_data result instead of the last per chartId #34716

Closed

Description

@objectstack-fleet

repo:cloud#1 · os-warren · session_01JQwxbYK6SZCmyzbGnrvmkk

Filing gate: ④ the framework half of objectstack-ai/cloud#4824 (p1, re-verification of p1 cloud#4796/#4797/#4798 under objectstack#34571), found by the cloud#4824 card thread (os-dev-report objectstack-ai/cloud#4824 comment 6942521456, out-of-scope finding, carrier: objectstack). Blocks: the reload half of objectstack-ai/cloud#4824 acceptance 1 (「回答里只有一张图」).

维护者速读

问数一次回答里模型重画了一张图时,cloud#4826 让实时对话只剩最后一张(同一个 data-chart 部件 id 原位替换)。但刷新页面、从历史重载这段对话时,控制台从每次 visualize_data 的结果重建图表,被替换掉的那张又回来了,用户又看到两张图。cloud 现在给每个结果写了 chartId:被替换的那张和替换它的那张 id 相同。平台的历史读取只要在同一条消息里按 chartId 留最后一张即可。

Facts (objectstack b1da9f55db, cloud PR #4826 head 0e9b21c)

  • ui/packages/plugin-chatbot/src/toolResultParsers.ts extractCharts (around line 156): a message with no data-chart part (server history: the streamed part is transient and never stored) reads its charts from every visualize_data result through chartFromToolResult (around line 222) and draws each one.
  • A live stream is fine: the AI SDK client reducer folds data-chart parts with the same id in place, so fromParts holds one chart.
  • Cloud PR docs(protocol): http-protocol 的 API Discovery 拆成两段式 —— REST 形状与 dispatcher 形状分开 (#4817) #4826 (visualize_data with replacesPrevious) writes chartId at the top level of each visualize_data result envelope, beside chart. A replacing result carries the same chartId as the chart it replaced. A result without chartId (older history, other producers) is unchanged.

Work

  1. In extractCharts, on the results path only: when two or more visualize_data results in ONE message carry the same chartId, keep the last one, at the text offset of the FIRST (where the user first saw the chart). Results without chartId are kept as today.
  2. Dedupe only within one message, never across messages. chartId is unique within one request, not across requests, process restarts or replicas.
  3. The data-chart part path is unchanged.

Acceptance

  • Tests: two results with the same chartId in one message give one chart, the last result's descriptor at the first result's offset. Two results with different chartId give two charts. Results without chartId behave byte for byte as today (CONTROL). The same chartId in two different messages gives one chart in each.
  • No change to the live stream path.

Not in scope

Cloud's replacesPrevious and chartId (cloud#4824, PR #4826). The 「(非指标口径)」 label (cloud#4824 item 2, a pending ruling).

Dedup words: extractCharts chartId reload two charts; visualize_data persisted chart superseded; toolResultParsers chartFromToolResult.

Activity

  1. added
    bug
    priority:p1
    pm:queue
    domain:ui
    on Nov 17, 2026
  2. objectstack-fleet commented on Nov 17, 2026

    @objectstack-fleet
    ContributorAuthor

    triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH

    Path: none

    Triage: first-touch audit → p1 · domain:ui · pm:queue kept · 2026-11-17T08:50Z

    ⛔ Not a claim.

  3. objectstack-fleet commented on Nov 17, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#3 · os-support-ai · session_01WGufzfrh8TiPJf1i2kMSoa

    Claim: PM loop round 1 · 2026-11-17T12:20Z
    Session: session_01WGufzfrh8TiPJf1i2kMSoa
    Account: os-support-ai
    Branch: claude/issue-34716-chart-dedupe-reload
    Worktree: objectstack-issue-34716
    Domain: domain:ui
    Seat: repo:objectstack#3
    File surface: ui/packages/plugin-chatbot/src/toolResultParsers.ts (extractCharts results path, chartFromToolResult), a new card-named test under ui/packages/plugin-chatbot/src/, root .changeset/.
    Container & model: S, mode:subagent (area o3-H), model: TIER_DEFAULT (dispatch-gates --tier on ui/packages/plugin-chatbot/src/toolResultParsers.ts: no path-derived mandate), effort: high
    Clause-②: no
    Metadata-protocol: none
    Responsibility: objectstack: the history reader draws every visualize_data result (toolResultParsers.ts extractCharts) | none: cloud PR #4826 writes chartId, nothing reads it | every user who reloads an ask-data answer in which the model redrew a chart
    Thread-read: 6943297547
    Premise: holds (area code read at origin/main c513d62: extractCharts (ui/packages/plugin-chatbot/src/toolResultParsers.ts:156-176) pushes every chartFromToolResult hit into fromResults and returns all of them when the message has no data-chart part; chartFromToolResult (:222-226) reads only envelope.chart, never chartId; no chartId reader under ui/packages/plugin-chatbot/src.)
    Serial constraints cleared: overlap-check before the first push; PR #34713 touches plugin-chatbot ChatbotEnhanced.tsx, not toolResultParsers.ts
    Pre-claim lane: domain:ui — ui/packages/plugin-chatbot/src/**; routed to area o3-H by the seat
    Pre-claim deps: no Blocked-by:; producer cloud PR #4826 is not a dependency (a result without chartId stays byte for byte as today)
    Prior rulings read: chart,visualize_data,history,reader,result → 142 hits (check-prior-rulings --card 34716); named ADR decisions (ADR-0139 D4, ADR-0002 §6, ADR-0029 D9.7, ADR-0076 D1, ADR-0116 §4, ADR-0124 D3, ADR-0131 D13) are term matches, none on chat chart rendering; docs/adr holds no chartId text; thread: triage 6943297547 only.

    Lease o3-H (seat post #34584).

  4. added
    pm:dispatched
    and removed
    pm:queue
    on Nov 17, 2026
  5. objectstack-fleet commented on Nov 17, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#3 · os-support-ai · session_01WGufzfrh8TiPJf1i2kMSoa
    os-dev-report

    Reported 2026-11-17T13:03Z.

    {
      "issue": 34716,
      "status": "done",
      "branch": "claude/issue-34716-chart-dedupe-reload",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/34840",
      "session": "session_01WGufzfrh8TiPJf1i2kMSoa",
      "premise_still_valid": true,
      "summary": "Premise re-measured on base c513d62a: extractCharts pushed every visualize_data hit into fromResults and no chartId reader existed under ui/packages/plugin-chatbot/src (grep -rn chartId: zero hits). chartFromToolResult now returns { chart, chartId? } (chartId only when the envelope's top-level chartId is a non-empty string); extractCharts, on the results path only, keeps a per-call chartId-to-index map so a later result with a seen chartId replaces that chart in place: last descriptor, first result's textOffset. Results without chartId are pushed as before; the map is local to one message; the data-chart part branch is untouched. Draft PR #34840 at head 59e6bcaa with a patch changeset for @object-ui/plugin-chatbot. Deviation: the push of the empty branch before any edit was refused by the auto-mode permission classifier; the branch was first pushed with the fix commit a5c5c1bf.",
      "tests": "head 59e6bcaa. New file ui/packages/plugin-chatbot/src/__tests__/mapMessages.chartIdDedupe-34716.test.ts, 7 tests (same chartId twice: one chart, last descriptor, first offset; different chartIds: two; redraw keeps first position among others; CONTROL no chartId: two charts at own offsets as today; same chartId in two messages: one each; string-content message: collapses, no offset; data-chart parts present: parts win). pnpm --dir ui exec vitest run --maxWorkers=2 packages/plugin-chatbot/ under the lock: Test Files 102 passed (102), Tests 1035 passed (1035), VERDICT command-exit 0. pnpm --filter @object-ui/plugin-chatbot run type-check (tsc --noEmit && tsc -p tsconfig.test.json, whose include is src/**/*.test.ts): VERDICT command-exit 0. Ablation via scripts/ablation-replace.mjs: replaced the resultIndexByChartId.get(chartId) lookup with a constant undefined (anchor x1 to x0, blob a5f650e0 to 8eb18380); suite imports ../mapMessages from source, no build in the path; 3 failed / 4 passed, the three same-chartId tests red, CONTROL / different ids / two messages / data-chart green; restore blob a5f650e0 equals HEAD, git diff HEAD empty. First package run (before commit 59e6bcaa) had 1 red in the new file: the test helper kept textOffset 0 from the anchored reference; helper fixed, implementation unchanged.",
      "gates": "Closure built: pnpm --workspace-concurrency=2 --filter '@object-ui/plugin-chatbot^...' build, VERDICT command-exit 0 (a first attempt with OS_SKIP_DTS=1 exited 2 because @object-ui/types tsc needs spec .d.ts; rebuilt without it). dispatch-gates --commands derived 38 commands; all 38 ran locally, each exit 0 (captured before any pipe), including pnpm --dir ui exec vitest run scripts/ (171 files passed, 2 skipped). dispatch-gates --ran: 38 derived, 38 run, 0 NOT-MEASURED (derived zero, every entry with an exit code). check:new-line-citations: 0 new, exit 0. After the test-only commit 59e6bcaa: check:nul-bytes, check:cross-package-test-inputs, check:test-source-alias re-run, exit 0. overlap-check before each push: VERDICT clean exit 0 (against origin/main c513d62a, 0 PR heads), twice. PR check-runs at report time: 22 runs, all in_progress or skipped (Governed Surface Queue Guard, Check Changeset, Type Check source/consumer/workspace/debt, Lint jobs, PR-body guards in_progress); none concluded. NOT MEASURED locally: the 5 CI type-check lanes and the repo-wide families (CI-owned).",
      "dogfood_battery": "n/a: no ! in the PR title and no (narrowing) arm",
      "mcp_calls": "6, all reads: issue_read get, issue_read get_comments, pull_request_read get, pull_request_read get_check_runs, plus 2 ToolSearch loads (not GitHub). No MCP write tool.",
      "api_writes": "3: git push (branch create a5c5c1bf, then 59e6bcaa; plain push, not REST); fleet-write relay pr_create (POST pulls draft + POST issues/34840/assignees os-support-ai), run 44088765491 success, read-back identical 5035 bytes; post-stamped os-dev-report comment on #34716.",
      "open_questions": [
        {
          "question": "AGENTS.md says a new pin for a component that already has a shared harness file goes into that file as a top-level describe (ruling record 6583487846); the dispatch named a NEW card-named test file and excluded mapMessages.persistedChart-25908.test.ts from the file surface. I followed the dispatch. Should the 7 tests move into the 25908 file?",
          "options": ["A keep the new card-named file (dispatch surface, per-card files are this package's convention)", "B move them into mapMessages.persistedChart-25908.test.ts as a top-level describe (widens the file surface by one file)"],
          "recommendation": "A, because the package's __tests__ directory is one file per card and the 25908 file is not a shared harness, but the seat should confirm the reading of the ruling."
        }
      ],
      "security_findings": "none",
      "out_of_scope_findings": []
    }
  6. removed
    pm:dispatched
    on Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugdomain:uipriority:p1

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions