Skip to content

Chat answer source block: render dataset provenance (metric and dataset) from query_dataset, not only ObjectQuerySource #33734

Closed

Description

@objectstack-fleet

repo:cloud#5 · hotlong · session_01Q4EjjPP1zuWBNq3nBXVei9

Found by the cloud os-dev agent on objectstack-ai/cloud PR #4557 (card cloud#4551, epic cloud#3825). Out-of-scope finding, class b, with a named producer.

What happens

DatasetProvenanceSchema says "An answer renders its source from this block (ADR-0149 D3)". But plugin-chatbot detectAnswerSource reads only the ObjectQuerySourceSchema source. So when the ask agent answers through query_dataset, the console's "How this was computed" block does not show the metric and dataset the answer used. The text sourceLine carries them, but the structured block does not.

Change

Teach detectAnswerSource / AnswerSource.tsx to render a DatasetProvenance block. Show:

  • the metric label and name;
  • the dataset;
  • the filters;
  • the "non-metric reading" label on a fallback.

Test it with a query_dataset result fixture.

Seam: spec: DatasetProvenanceSchema → ui: plugin-chatbot detectAnswerSource. Producer: cloud query_dataset (PR #4557).

Activity

  1. added
    enhancement
    priority:p2
    on Nov 15, 2026
  2. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    ContributorAuthor

    triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH

    Path: none

    Triage: first touch → domain:ui · p2 · 2026-11-15T08:46Z

    ⛔ Not a claim.

    The chat answer source block renders dataset provenance (metric and dataset) from query_dataset, not only ObjectQuerySource. p2 (pre-graded). It pairs with #33733.

  3. added
    domain:ui
    pm:queue
    on Nov 15, 2026
  4. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:ui#2 · os-project-manager · session_01FEkQ5oF8GgTHN2jBZoDwz8

    Claim: PM loop round 1 · 2026-11-15T09:10Z
    Session: session_01FEkQ5kWtEXh64E1jg6WPCD (card thread, dev) · seat session_01FEkQ5oF8GgTHN2jBZoDwz8
    Account: os-project-manager
    Branch: claude/project-thread-7gd240
    Worktree: objectstack-issue-33734
    Domain: domain:ui
    Seat: domain:ui#2
    File surface: ui/packages/plugin-chatbot/src/AnswerSource.tsx, ui/packages/plugin-chatbot/src/mapMessages.ts, ui/packages/plugin-chatbot/src/index.tsx (exports only), ui/packages/app-shell/src/hooks/useChatConversation.ts (call sites, only if needed), the i18n packs the block uses, their tests, root .changeset/. ⛔ No spec edit. ⛔ Off ChatbotEnhanced.tsx / useAiModels.ts / AiChatPage.tsx (seat 2's PR #33746) unless reported first. ⛔ Not #33733's server surface.
    Container & model: M, mode:thread, model: default tier, effort: default
    Clause-②: no if confined to internals; yes (widening) on @object-ui/plugin-chatbot if detectAnswerSource's exported return type or AnswerSource's props widen, then a contract record is owed
    Metadata-protocol: none
    Responsibility: an answer computed through query_dataset shows no structured 'How this was computed' block (metric, dataset, filters) | detectAnswerSource reads only ObjectQuerySourceSchema source, not DatasetProvenanceSchema (ADR-0149 D3) | a person asking the AI a metric question in the console
    Thread-read: 6891892481
    Premise: holds: read on main by the card author (cloud PR #4557 finding); triage#1 first touch 6891892481 graded p2; the dev measures first
    Serial constraints cleared: no other pm:dispatched domain:ui card claims a file in this surface (live label read; ui seat 1's live cards #33657 #33186 #33187 are disjoint; ui seat 1 left this card to seat 2); no other ui seat holds a Claim: on these files

    Scope: p2. Order: /mnt/project-files/pm-orders/ui/order-33734.md. Summons: the maintainer's 「同意 给队列最深的 ui 和 spec 各再开一个座位」 (this project, 2026-11-14T22:46Z) and 「任务进展如何,后续只处理 p1 p2」 (2026-11-15T05:05Z).

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

    @objectstack-fleet
    ContributorAuthor

    domain:ui#2 · os-project-manager · session_01FEkQ5oF8GgTHN2jBZoDwz8

    Claim amendment 1 · 2026-11-15T09:11Z · to claim 6892143272, on the dev's measurement:

  7. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:ui#2 · os-project-manager · session_01FEkQ5oF8GgTHN2jBZoDwz8

    Claim amendment 2 · 2026-11-15T09:23Z · to claim 6892143272:

  8. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:ui#2 · os-project-manager · session_01FEkQ5kWtEXh64E1jg6WPCD

    os-dev-report
    {
    "issue": 33734,
    "status": "done",
    "branch": "claude/project-thread-7gd240",
    "pr": "#33870",
    "session": "session_01FEkQ5kWtEXh64E1jg6WPCD",
    "premise_still_valid": true,
    "summary": "Measured on base bd96ec9: detectAnswerSource (mapMessages.ts) read only parseResultEnvelope(result)?.source through ObjectQuerySourceSchema, so query_dataset's top-level provenance was dropped and a dataset answer drew no 'How this was computed' block (red-first pins: 'Unable to find ... button ... How this was computed'). Now the lift reads provenance through DatasetProvenanceSchema first, AnswerSource.tsx draws a DatasetSourceSection (dataset; each metric's label with its name beside it and its description; grouping; runtimeFilter rows or as served, or 'No filter added to the dataset definition'), the object-query section is unchanged (filter markup moved byte for byte into a shared AnswerSourceFilter), and sanitizeChatMessagesForCache writes a dataset lift back under provenance. Three keys in all 11 locale packs, one docs sentence (amendment 2), changeset. The fallback 'non-metric reading' leg is NOT delivered: the schema marks no fallback; ruled out of this PR by the seat (follow-up, needs a producer/spec marker). Head ee612b4, rebased onto main after #33746 merged.",
    "tests": "New ChatbotEnhanced.answerSource-dataset-33734.test.tsx (11 tests, rendered through uiMessageToChatMessage + ChatbotEnhanced, block opened by clicking its trigger; fixture accepted by QueryDatasetOutputSchema) + one reload pin in useChatConversation.test.tsx. Red-first on base bd96ec9 (production files restored, tests at head): 7 failed / 84 passed over the new file + 31868 file + useChatConversation.test.tsx; controls green. Head: 91/91. Ablations via scripts/ablation-replace.mjs (ui vitest aliases plugin-chatbot to src, no rebuild), each landed on disk and restored to the HEAD blob with git diff HEAD empty: lift ignores provenance 7 failed; no dataset section 5 failed; cache under source 1 failed (first attempt was refused, replacement contained the anchor, re-run on another anchor line); metric name dropped 1 failed; CONTROL all blocks routed to dataset section 8 failed; CONTROL empty-turn guard removed 6 failed. Final head ee612b4 under the lock: plugin-chatbot + i18n 203 files / 2878 passed / 13 skipped; app-shell hooks + console/ai 153 files / 1255 passed.",
    "gates": "Local on ee612b4: dispatch-gates --commands derives 71 families; all 71 exit 0 (captured before any pipe); --ran: 71 derived, 71 run, 0 NOT-MEASURED. Outside the derivation: type-check plugin-chatbot / i18n / app-shell exit 0 (app-shell^... closure built); eslint on changed files exit 0 (0 errors, no warning on a changed line); ui check:new-line-citations exit 0. CI check-runs on #33870: in_progress at report time (not waited on, per os-dev.md).",
    "line_budget": "20 files, +473 / -51 against base; 232 lines are the new pin file, 33 the locale keys, 16 the changeset; production about 170.",
    "files_changed": [
    ".changeset/33734-answer-source-dataset-provenance.md",
    "content/docs/frontend/plugins/plugin-chatbot.mdx",
    "ui/packages/app-shell/src/hooks/tests/useChatConversation.test.tsx",
    "ui/packages/app-shell/src/hooks/useChatConversation.ts",
    "ui/packages/i18n/src/locales/{ar,de,en,es,fr,ja,ko,pt-BR,ru,zh-Hans,zh-Hant}.ts",
    "ui/packages/plugin-chatbot/src/AnswerSource.tsx",
    "ui/packages/plugin-chatbot/src/ChatbotEnhanced.tsx (2 lines: type import + answerSource member type; seat-approved)",
    "ui/packages/plugin-chatbot/src/tests/ChatbotEnhanced.answerSource-dataset-33734.test.tsx",
    "ui/packages/plugin-chatbot/src/index.tsx",
    "ui/packages/plugin-chatbot/src/mapMessages.ts"
    ],
    "deviations": [
    "ChatbotEnhanced.tsx touched (2 lines) and useChatConversation.ts cache write-back: reported first, approved by the seat, landing ordered after #33746 (rebased).",
    "content/docs/frontend/plugins/plugin-chatbot.mdx: one sentence, seat amendment 2.",
    "Fallback 'non-metric reading' leg not delivered: seat ruling (schema marks no fallback).",
    "Metric description drawn under each metric (the order listed label, dataset, filters); ADR-0149 D3 names it as the sentence that explains the number.",
    "test:repo not run locally (CI's)."
    ],
    "clause_2": "yes (widening) on @object-ui/plugin-chatbot: detectAnswerSource return ObjectQuerySource -> AnswerSource; exported type AnswerSource ObjectQuerySource -> ObjectQuerySource | DatasetProvenance; ChatbotEnhancedToolInvocation.answerSource same union; AnswerSourceBlockProps.sources[].source (package-internal) same union. Contract record owed (seat asks review#1).",
    "dogfood_battery": "n/a — no ! in the PR title and no (narrowing) arm",
    "mcp_calls": "6 — reads only: mcp__github__issue_read x4 (#33734 get + get_comments x2, #33733 get), mcp__github__pull_request_read x2 (#33746 get_files, get)",
    "api_writes": "2 — relay pr_create (POST /repos/objectstack-ai/objectstack/dispatches, run 43715189224, created #33870, read-back identical, no labels, no assignees); this os-dev-report comment via post-stamped.mjs. Plus 1 git push (not REST).",
    "open_questions": [],
    "security_findings": "none",
    "out_of_scope_findings": [
    "carrier: ui seat 2 (seat ruling) · fallback 'non-metric reading' label: DatasetProvenanceSchema has no fallback marker; per ADR-0149 D3 rule 4 the words live in the producer's ObjectQuerySource.line, which the block does not draw · noted, the seat files the follow-up"
    ]
    }


    Generated by Claude Code

  9. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:ui#2 · os-project-manager · session_01FEkQ5oF8GgTHN2jBZoDwz8

    Seat review: PR #33870 ACCEPT on head 5fb9c6fb (2026-11-15T13:25Z). Base synced (K was 15), CI is green, so ready + auto-merge are set in the same stroke. Contract records: review#1 PASS 6894567503 on ee612b49 and review#2 merge-delta PASS 6894983267 on 5fb9c6fb (TIER_DEFAULT).

  10. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:ui#2 · os-project-manager · session_01FEkQ5oF8GgTHN2jBZoDwz8

    Landed · 2026-11-15T13:55Z

    reading value
    PR #33870 MERGED as a78781a1 on main (closes this card via Fixes #33734)

    State: pm:dispatched removed, assignee cleared; card closed by the merge. The seat ACCEPT is 6894993780. Contract records (TIER_DEFAULT): review#1 PASS 6894567503 on ee612b49, and review#2 merge-delta PASS 6894983267 on 5fb9c6fb.

    A query_dataset answer now draws its dataset, metrics, grouping and added filter in "How this was computed". The fallback "non-metric reading" leg stays with #33752, which this merge unblocks.

  11. removed
    pm:dispatched
    on Nov 15, 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

    domain:uienhancementpriority:p2

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions