Skip to content

fix(console): a cited passage opens in a body reader beside the answer, verified citations only (objectstack#39507) - #39777

Draft
objectstack-fleet[bot] wants to merge 10 commits into
mainfrom
claude/issue-39507-wip
Draft

objectstack-fleet[bot] wants to merge 10 commits into
mainfrom
claude/issue-39507-wip

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Dec 5, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Elon · project thread
Fixes #39507
Part of #39505

Clause-②: yes (widening)
Metadata-protocol: none

Supersedes #39568 (same work, cut from its head efe83e2a0b, with route B of ruling 7428662922 applied). The ADR-0160 amendment, #39570, lands first or together with this PR, unchanged; this PR does not touch it.

维护者速读

  • 用户能看到什么变化:在问询页和 AI 抽屉里,回答引用的原文如果经过平台核对,就带下划线可点,点了在侧边只显示该记录正文并滚到那一段高亮;没经核对的引文照常显示为普通文字;手机上不打开侧边阅读,记录照旧整页打开。
  • 为什么做:这是「AI 引文可点、在侧边读原文」专题的界面部分,按维护者选定的方案二只交付已核对的引用;让更多引文经平台核对的工作另立一张卡在生成端完成。
  • 出错会怎样:最坏是点已核对的引文时侧边阅读打不开、或滚不到那一段,记录仍可从「出处」链接整页打开;不会多画任何未经核对的引用;撤回本 PR 即恢复原样。
  • 要你做什么:合并配套的架构记录修订(与本 PR 先后或同时合并)。

What changes

  • Removed (ruling 7428662922, route B): the browser-side lookup of quoted passages the turn did not cite. Gone: the locateQuotes prop of ChatbotEnhanced and its type, the reader's locateQuotes member, the ChatPane pass-through, the related-row read (readHeldTexts) and the pack related reader (relatedOfPacks, ReaderPack.related), the helpers only the lookup used (bodyReadingsOf, linkedRecordsOf, proseOf, LocatedQuote), and RecordReader.locateQuotes-39507.test.tsx. A passage an answer quotes that no verified citation covers now stays plain text. No i18n key was used only by the removed code, so the packs are unchanged.
  • Kept: the excerpt marking (whole passage, or an excerpt in quotation marks; split at an ellipsis or a table row's |; the block quoting the most of a passage is marked), and a record link in a cited answer opening its record with every passage of it the answer cites (CitedAnswer).
  • F4: the reader host uses the default list mode (ADR-0160 D9, "no more and no fewer"): a verified citation the answer does not quote is a chip under it. With no caller left, the citationList prop and CitedAnswer's listLeftover are removed.
  • F3: the ai:chat page passes no reader side on a phone (recordReaderSide={phone ? undefined : 'right'}), so a record opens there as it always has.
  • Changeset rewritten: the lookup bullet dropped; the relocation of citations by the exported hydratedMessagesToChatMessages named; internal modules no longer presented as package API.
  • The rest of feat(console): a cited passage opens where the answer quotes it, in a body reader beside the conversation (#39507) #39568 is unchanged: the body reader, recordReaderSide, reload of citations off the cite_records result, citations drawn once under a turn's answer, i18n.

Read first (by risk):

  1. ui/packages/plugin-chatbot/src/CitedAnswer.tsx: the lookup hook is gone; citations is the turn's verified list only; rest (the chips) is no longer switchable.
  2. ui/packages/plugin-chatbot/src/ChatbotEnhanced.tsx: cited is now "has visible prose and verified citations", nothing else.
  3. ui/packages/app-shell/src/console/ai/AppAskPage.tsx: the phone condition on recordReaderSide.

Tests

  • ChatbotEnhanced.recordCitations-37365.test.tsx: the four lookup cases and the citationList: none case are removed. New: a quoted passage no citation covers stays plain text while the 出处 link opens the record with the cited passages (siblingQuotes), with no fetch; an answer with no citations marks nothing and lists nothing. The excerpt cases (table row with |, two blocks quoting alike, the block quoting the most) are kept.
  • New AppAskPage.recordReaderSide-39507.test.tsx (F3): below the phone breakpoint the page mounts the conversation as a sheet with no reader side; CONTROL: on a wider window it is full with the reader on the right. Ablated: with the phone condition removed on disk the case fails ("Expected the element to have attribute"), restored it passes.

Acceptance notes

  • L1 7428252501 said the browser match was "no looser than the verifier". That was wrong: on five constructed pairs, with both rules copied from source, the browser rule matched 5 of 5 and the verifier 0 of 5 (analysis 7428374452, P3). With the lookup removed, every passage drawn as a citation is one the platform verified.
  • Measured before this change (20 real questions): the model's own verified citations made 55 of 74 quoted passages openable. This PR delivers that verified side reader only; the other quoted passages stay plain text. Raising the share on the producer side (the existing verifier, run on more of an answer's quoted passages) is Ask: more quoted passages arrive as verified citations (producer side, same verifier) #39755. Attachments stay out of scope.
  • The new F3 test is its own file, as the dispatch scoped it; the harness rule (a new pin for a component with a shared harness goes into that file as a top-level describe, ruling record 6583487846) would place it in AppAskPage-37788.test.tsx, which is outside this PR's file surface. Named for the reviewer to decide.
  • The branch is cut from feat(console): a cited passage opens where the answer quotes it, in a body reader beside the conversation (#39507) #39568's head efe83e2a0b, not from the later 7ef56ef5. origin/main (64b295cdd7) is merged in once, as the seat authorised, at a85960dd0f. The delta against main is still exactly these 27 files.

Verification

Two-minute check: on the ai:chat page, ask a question whose answer cites a policy; the quoted cited passage is underlined and opens the reader on the right; a quoted line the turn did not cite is plain text; a verified citation the answer does not quote appears as a chip under it. Narrow the window below 768px and click the same passage: the record opens as a page, with no reader.

Local readings, head a85960dd0f, after the merge of origin/main. The first round, at 0c715fdfda, is kept below.

First round, head 0c715fdfda:

Tests and type-check
  • vitest run packages/plugin-chatbot/ (from ui/): 92 files, 897 passed, 4 failed in spec-symbol-batch6.test.ts because the spec dist had been rebuilt without declarations; after a spec build with declarations that file is 22 of 22 passed. Read on 378fcf2d4b (the later commit touches only the app-shell test).
  • vitest run packages/app-shell/src/console/ai/: 46 files, 293 tests passed (on 378fcf2d4b); the F3 file again on 0c715fdfda: 1 of 1 passed.
  • pnpm --filter @object-ui/plugin-chatbot type-check exit 0; pnpm --filter @object-ui/app-shell type-check exit 0 (after building each package's dependency closure).
  • eslint on the touched .ts/.tsx files: 0 errors (6 warnings, all on lines this PR does not change).
Gates (dispatch-gates --commands, reconciled with --ran: 41 derived, 41 run, 0 NOT-MEASURED, 0 UNRUN)
  • 40 of 41 exit 0, including pnpm --dir ui exec vitest run scripts/ (172 files passed, 2 skipped) and pnpm check:test-source-alias (red on the first head: the new test now loads @object-ui/plugin-grid at module top, then green).
  • node scripts/ci/snapshot-next.mjs --self-test exit 1 on that pre-merge tree. It was fixed on main by fix(ci): pin the snapshot-next stable-lane self-test to a fixed clock #39763 and is green at a85960dd0f.
  • Not run locally, CI's: the type-check lanes, the artifact-roster and wide-population families dispatch-gates names.

Generated by Claude Code

baozhoutao and others added 9 commits December 4, 2026 00:20
… body reader beside the conversation (#39507)

The passages an answer quotes from its verified record citations are
marked in place (whole, or as an excerpt inside quotation marks) and open
their record in a body reader: the field the record's context pack
declares as body, scrolled to the passage, with the answer's other
passages of the record marked lightly. The ai:chat page opens it on the
right, the assistant drawer's rail on the left; it resizes and closes on
a page change. A host with a reader lists no leftover chips
(citationList: 'none'). Citations survive a reload, read back off the
cite_records result.

Part of #39505.

Claude-Session: https://claude.ai/code/session_07e67131-392a-47b3-9266-6907acc22e29
Co-authored-by: Claude <noreply@anthropic.com>
…s its cited passage (#39507)

An answer that quotes 「…前半……后半…」 was read as one excerpt the passage
does not hold, so the passage stayed plain. The excerpt is now read as its
pieces around the ellipsis, each of which must be in the passage.

Claude-Session: https://claude.ai/code/session_07e67131-392a-47b3-9266-6907acc22e29
Co-authored-by: Claude <noreply@anthropic.com>
…found in the records it links to (objectstack#39507)

On 20 questions on a real deployment the model handed over 69 passages,
all verified, but its answers quoted 74 in their 依据 and only 55 could be
opened: 13 it never handed over, 2 were table rows quoted with `|`.

- `locateQuotes` (ChatbotEnhanced prop; ChatPane passes the body reader's):
  the quoted pieces no citation covers are looked up in the bodies of the
  records the answer links to, as the signed-in user; a piece found is a
  citation of that record. Each record is read once per page.
- A quote splits at `|` / `|` as well as at an ellipsis; the block quoting
  the most of a passage is the one marked; fenced blocks are not quotes.
- CitedAnswer opens the answer's record links with every passage it cites.

Claude-Session: https://claude.ai/code/session_07e67131-392a-47b3-9266-6907acc22e29
Co-authored-by: Claude <noreply@anthropic.com>
… in the rows the record's context pack reads with it (objectstack#39507)

A policy's attachments (its pack's `related` rows) hold text its body does
not: on 20 real questions 7 of the passages an answer quoted were only
there. `locateQuotes` now reads those rows too (as the signed-in user, at
most 50 per list) after the record's own body, and cites a passage one
holds to that row, which the reader then opens.

Claude-Session: https://claude.ai/code/session_07e67131-392a-47b3-9266-6907acc22e29
Co-authored-by: Claude <noreply@anthropic.com>
…e answer's line names (objectstack#39507)

On 3030 a 附件2《职工慰问申请表》 line quoting its field labels opened
附件3《职工奖励申请表》: both forms carry the same labels, and the lookup
cited the first row holding them. `locateQuotes` now takes each quote's
answer line; among the places holding a quote, the one whose name (title,
label, display name) the line spells wins, then the one holding more of the
line's quotes, then the first.

Claude-Session: https://claude.ai/code/session_07e67131-392a-47b3-9266-6907acc22e29
Co-authored-by: Claude <noreply@anthropic.com>
…ed in both (objectstack#39507)

On 3030 an answer quoted 「禁止利用起重机吊具运送或起升人员」 in its prose and
again in its 依据; only the first block was marked, so the 依据 line could not
be opened. Every block quoting the longest excerpt of a cited passage is
marked now; a block quoting a shorter excerpt still is not.

Claude-Session: https://claude.ai/code/session_07e67131-392a-47b3-9266-6907acc22e29
Co-authored-by: Claude <noreply@anthropic.com>
…line default (objectstack#39507)

check-i18n-call-site-keys flagged default-value drift: the call site said
'Resize' while en renders 'Drag to resize; double-click to reset'.

Claude-Session: https://claude.ai/code/session_07e67131-392a-47b3-9266-6907acc22e29
Co-authored-by: Claude <noreply@anthropic.com>
…on a phone (objectstack#39507)

Route B of the ruling on the card: the browser-side lookup of quoted
passages the turn did not cite is removed (the `locateQuotes` prop, the
reader's lookup member, the ChatPane pass-through, the related-row read and
the pack `related` reader, the helpers only it used, and its test file). A
passage the answer quotes that no verified citation covers stays plain text.
Kept: the excerpt marking, and a record link in a cited answer opening its
record with every passage of it the answer cites.

- The reader host keeps the default list: a verified citation the answer
  does not quote is a chip under it (ADR-0160 D9, no more and no fewer).
  The `citationList` prop and `CitedAnswer`'s `listLeftover` are removed.
- The ai:chat page passes no reader side on a phone.
- The changeset says what ships.

Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4d1cnRvyiAqrarmDhZV
…top (objectstack#39507)

check-test-source-alias: the page's chat reaches a dynamic import of
@object-ui/plugin-grid; the test pays that load during collection.

Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4d1cnRvyiAqrarmDhZV
@github-actions github-actions Bot added size/xl documentation Improvements or additions to documentation tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Dec 5, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack@os-elon-musk · os-elon-musk · session_016WV4d1cnRvyiAqrarmDhZV

Final head for L1 (delta of #39568's L1 7428252501) · 2026-12-05T03:22Z · zone em-admin
Head-sha: a85960dd0f1bdce222fdf3559e7acd2c6157fede. This head is a merge of origin/main 64b295c, authorised by the seat, onto 0c715fdfda. The branch is cut from efe83e2a0b; #39568's later 7ef56ef5 is not included.
Checks on this head: 44 success, 15 skipped, 1 failed.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/xl tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

控制台:答复里的引用原文可点,侧边正文阅读抽屉打开并定位

3 participants