Skip to content

fix(chatbot): redraw record-citation chips after a reload; keep the cited-section scroll to new clicks - #37539

Merged
objectstack-fleet[bot] merged 5 commits into
mainfrom
claude/project-thread-6hqn6k
Nov 26, 2026
Merged

objectstack-fleet[bot] merged 5 commits into
mainfrom
claude/project-thread-6hqn6k

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Bill · project thread
Fixes #37487
Clause-②: yes (widening)
Metadata-protocol: none

维护者速读

  • 用户能看到什么变化:使用应用内 AI 的用户,刷新页面或重新打开对话后,回答下方的“引自记录”引用条仍然显示;从引用条打开记录后,再打开命令面板或编辑表单、返回,页面不再被拉回被引的那一节。
  • 为什么做:记录 AI 问询专题的引用条跟进卡,原先引用条只在回答当场可见,刷新就消失,无法回头核对出处。
  • 出错会怎样:引用条刷新后不显示,或页面多滚一次;记录和对话数据不受影响,撤回本次合并即可恢复原样。
  • 要你做什么:无。

What changes

Governing text: ruling Q1 on #37144 (draw the persisted, already-verified list; never verify it again); PR #37485 (merged 276174a) and its scope notes on #37487 (S4 on the card, S5 in 7190147175).

  • One allow-list of kept data parts (plugin-chatbot/src/toolResultParsers.ts): STORED_ANSWER_DATA_PARTS names the data parts a stored answer keeps through a rebuild, keyed by the message field that carries each between rebuilds: charts (data-chart, positional) and recordCitations (data-record-citations). storedAnswerParts(content, data) writes them (the charts through the existing chartAnswerParts, then the citations list as one part with the stream's part id). It stays in the eager /core closure, so the part type is spelled there, not imported from @objectstack/spec/ai; a test pins it to RECORD_CITATIONS_PART_TYPE.
  • Reader (plugin-chatbot/src/mapMessages.ts): storedAnswerData(parts) reads every kept part back (chartsFromParts + extractRecordCitations, the same RecordCitationsSchema parse a live part goes through). A refused list is no list.
  • The three rebuilds now go through those two: the /ai history rebuild hydratedMessagesToChatMessages (app-shell/src/console/ai/AiChatPage.tsx, reader), the message cache sanitizeChatMessagesForCache (app-shell/src/hooks/useChatConversation.ts, writer; CacheableChatMessage gains recordCitations), and the useObjectChat initialMessages store rebuild (plugin-chatbot/src/useObjectChat.ts, writer). The table names the kept parts; a further kept part takes three edits (the entry, its write in storedAnswerParts, its read in storedAnswerData).
  • S5 (app-shell/src/views/RecordDetailView.tsx, recordSectionAnchor.ts): the cited-section effect was keyed on the opened-state value or '', so any navigation that dropped history state re-ran it and scrolled back. Two parts:
    • within one mount, the key holds the last string value the state carried, replaced only when a new string arrives (state adjusted during render);
    • the booted console showed the record-form overlay (?form=) remounts the record page without the state, so a component-local memory is not enough. The page now keeps the section it last opened beside the component (claimCitedSectionOpen, { target: RECORD+ANCHOR, opened: CLICK }), claimed at the moment the page would move (focusRecordSection gains an optional mayScroll callback, asked right before scrolling, so an effect re-run before that does not spend it). A redraw at a section already opened marks it again and scrolls nothing. The memory is dropped once no record page has stayed mounted (a zero-delay check after unmount), so a later visit to the same link opens its section again.
  • Exports (Clause-②: yes (widening), per seat record 7193217253 S1; level stays patch): storedAnswerParts, STORED_ANSWER_DATA_PARTS and the types StoredAnswerData, StoredAnswerPart from @object-ui/plugin-chatbot/core and the root; storedAnswerData from the root. Named in the changeset.
  • Docs: the sentence "a conversation reloaded from history does not redraw them yet" in content/docs/frontend/plugins/plugin-chatbot.mdx and ui/packages/plugin-chatbot/README.md was made false by this change and is rewritten. Changeset .changeset/37487-citations-survive-reload.md (patch, @object-ui/plugin-chatbot, @object-ui/app-shell).

Read first, by risk:

  1. ui/packages/plugin-chatbot/src/toolResultParsers.ts: STORED_ANSWER_DATA_PARTS and storedAnswerParts.
  2. ui/packages/app-shell/src/views/RecordDetailView.tsx: claimCitedSectionOpen (module level, above the component) and the sectionOpened state and effect beside holdsRouteRecord.
  3. ui/packages/app-shell/src/hooks/useChatConversation.ts: sanitizeChatMessagesForCache.

Tests

  • app-shell/src/console/ai/__tests__/AiChatPage.recordCitationsReload-37487.test.tsx (6): server history and cache fallback each restore the chips the live answer draws (same quotes, same order; nothing fetched); a restored server answer re-caches with its list; CONTROL on both paths: a refused part (an alias key) draws nothing and is not cached.
  • plugin-chatbot/src/__tests__/useObjectChat.recordCitationsReload-37487.test.tsx (3): the initialMessages store rebuild draws the live chips; CONTROL: a refused list draws nothing (the store part is re-parsed, so the rebuild is no way round the contract); the allow-list entry equals the spec part type.
  • app-shell/src/views/RecordDetailView.citedSection-37365.test.tsx (+2, 8 total): after a chip click, a state-dropping replace (the useUrlOverlay shape) and a pushed overlay followed by Back do not scroll; a pushed overlay that remounts the page, and Back, marks the section again and does not scroll; CONTROL in both: a new click after them scrolls. afterEach waits one macrotask after cleanup() so the page's memory is dropped between cases. recordSectionAnchor.test.tsx unchanged, 18/18.
  • Ablation, shared allow-list: writer and reader of the citations entry disabled → the three positive path tests fail (3 failed, 6 passed), restored → 9/9. Ablation, S5 in-mount: the key read back off the state as before → that test fails (1 failed, 6 passed). Ablation, S5 remount: claimCitedSectionOpen always claims → the remount test fails (1 failed, 7 passed); restored → 8/8.

Acceptance notes

Verification

  • Local: pnpm run type-check in ui/packages/plugin-chatbot and ui/packages/app-shell, exit 0. The local whole-suite run of both packages (vitest run packages/plugin-chatbot/ packages/app-shell/) was stopped after 61 min with one failure, which was my own ablation edit made while it ran; the narrowing is declared, and CI's Test UI (all shards) is green on e2833f9. Rework head 40bb8ee (changeset, jsdoc only): CI check-runs 46 success, 10 skipped before this body edit; the PR-body guards rerun on the edit.
  • Two-minute check: pnpm --dir ui exec vitest run packages/app-shell/src/console/ai/__tests__/AiChatPage.recordCitationsReload-37487.test.tsx packages/plugin-chatbot/src/__tests__/useObjectChat.recordCitationsReload-37487.test.tsx, expected 9 passed.
  • S4 booted-console check, done on head 039bbc3 (the later head e2833f9 changes one test file only). Showcase app (objectstack dev --seed-admin) with the ui/ console dev server pointed at it, driven by Playwright at 1360x900 and as an iPhone 13. Injected, not produced: no producer emits the part before cloud 10c, so the run serves the conversation-history read (GET /api/v1/ai/conversations/ID) with an answer carrying a data-record-citations part, and, because this boot has no model, serves a one-agent catalog (GET /api/v1/ai/agents) so the assistant shows. The cited record is a Field Zoo record whose markdown, html and richtext bodies each hold a cited heading below several screens of text.
    • Chips drawn: 3 (the three quotes), desktop and phone. After a page reload: the same 3, same order.
    • A chip click opens /apps/com.example.showcase/showcase_field_zoo/record/ID?section=ANCHOR; the cited heading is the one marked and sits just under the sticky record header (top 89 px desktop, 45 px phone): contractor-scope (markdown), html-retention (html), rich-escalation (richtext).
    • Refused part (an alias key): 0 chips.
    • S5: scrolled back to the top of the record, opening the command palette (?palette=1, replace) and closing it leaves the page there; opening the record form (?form=ID, push) and Back leaves the page there (before the remount fix it scrolled back, which is how the remount was found). A probe on scrollIntoView records no call.
    • Screenshots: objectstack-seat5/ai-36996/shots-37487/ in the project files (9 images plus the script).

🤖 Generated with Claude Code

https://claude.ai/code/session_01Utp6CY3qzEGtLEnwjFyRXG


Generated by Claude Code

…ection scroll to new clicks

The /ai history rebuild, the message cache and the useObjectChat store
rebuild now keep the data parts one allow-list names (charts and record
citations). The record section effect re-runs only when a new opened-state
value arrives, not on a navigation that drops the history state.

Claude-Session: https://claude.ai/code/session_01Utp6CY3qzEGtLEnwjFyRXG
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/m 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 Nov 26, 2026
…es not scroll back to the cited section

The browser check showed the record-form overlay remounts the record page
without the click's history state, so the cited-section effect ran again and
scrolled back. The page now remembers the section it last opened beside the
component, claimed when the page would move: a redraw at that section marks
it again and scrolls nothing. The memory is dropped once no record page is
mounted.

Claude-Session: https://claude.ai/code/session_01Utp6CY3qzEGtLEnwjFyRXG
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/l and removed size/m labels Nov 26, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X

Contract-review-claim: session_01Utp6CYtTDvfPQDzMbZnN5X · head e2833f9 · 2026-11-26T13:12Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X

Contract review

Served-tier: TIER_DEFAULT
Head-sha: e2833f914872f06fe35da9f83d996a8127fbb209
Local-runs: none

Read: card #37487 (body; comments 7186889924, 7189270058, 7190147175, claim 7190899980, amendment 7191223613, os-dev report 7192922175), the PR body, git diff origin/main...pr-37539-x (15 files, +502/−27), the head's check-runs (all green: Type Check UI, Test UI 16/16 shards, Lint UI, Check Changeset, Build & E2E UI, Live E2E UI; the rest success or skipped, 0 failed), PR #37485's records 7186860933 and 7190126794 for the Clause-② precedent, and the area's L1 notes as one input. Nothing was built or run.

① Derived judgments

Accept set: unchanged, right. The citations list is read back through extractRecordCitations, which is the same RecordCitationsSchema parse a live part goes through. That schema is a strict object capped at RECORD_CITATIONS_MAX (20), and re-parsing a list that already parsed gives the same list. A refused list is not written to the cache and draws nothing. Nothing is verified again (ruling Q1). There is a control on each of the three paths.

Allow-list: keeps what a reload needs, drops nothing that was kept before. I checked all three paths against main. Each one gains something and loses nothing.

  • Cache writer: it used to write chartAnswerParts(content, charts). It now writes storedAnswerParts, which is that same output plus at most one data-record-citations part. User turns get the same text parts as before.
  • useObjectChat writer: same as the cache writer, with the reasoning part still appended after.
  • History reader: it used to run chartsFromParts. It now runs storedAnswerData, which returns the charts plus the citations.

The other data parts the mapper reads (data-build-progress, data-blueprint-progress) were not kept before this PR and are still not kept, so no reader loses anything a user saw. The share page (SharedRecordPage) also goes through hydratedMessagesToChatMessages. But aiMessageRowsToServerMessages turns an assistant row into text plus tool calls only, so no citations part reaches it and nothing changes there.

Module memory (S5): no leak, bounded, reset correctly. I read claimCitedSectionOpen and the counter of mounted record pages beside it.

  • It holds one slot ({ target, opened }) and one counter, so it cannot grow.
  • It can only hold back a scroll. It never causes one, and the mark always comes from the page's own candidates.
  • target is objectName:recordId plus the anchor. A different record or anchor never matches, so it can never give a second record the first one's section effect.
  • Each click id is unique (Date.now plus a counter). A real chip click always claims and scrolls.
  • It cannot leak across users or sessions. It lives only in this JS realm: a reload or a new tab starts empty. Sign-out unmounts the record page, and the zero-delay check then clears the slot.
  • A remount in the same commit keeps the slot, because the new mount's effect runs before the timer fires. Strict-mode double effects stay balanced.
  • focusRecordSection calls finish() before its single scroll, so asking mayScroll there cannot suppress a second scroll that the page needed.

Public surface: widened. That is right as a change, but it is declared wrong (S1).

  • New on @object-ui/plugin-chatbot, all absent on main:
    • root and ./core: storedAnswerParts, STORED_ANSWER_DATA_PARTS, and the types StoredAnswerData and StoredAnswerPart;
    • root only: storedAnswerData.
  • The package is published. It is not private, it has exports for . and ./core, and it sits in the fixed group with access: public.
  • @object-ui/app-shell is private, so its new CacheableChatMessage.recordCitations field is not public surface.

Pins guard the behaviour.

  • Allow-list: a pin ties the allow-list entry to RECORD_CITATIONS_PART_TYPE. Disabling the citations entry in writer and reader turns 3 tests red.
  • S5 in-mount: reading the key back off the state turns its test red.
  • S5 remount: making claimCitedSectionOpen always claim turns the remount test red.
  • Memory reset: there is no named pin, but it is held in effect. The setext case remounts ?section=scope after cleanup() plus one macrotask, and expects a scroll. Without the reset, that case would fail.

② Semver level

Changeset level: right. patch on @object-ui/plugin-chatbot and @object-ui/app-shell is correct: Metadata-protocol: none takes patch, and a non-protocol widening also ships patch (AGENTS.md, Post-Task Checklist step 3). The two packages are exactly the ones whose src the diff moves. Metadata-protocol: none is right, since no metadata author can write anything new.

S1 (must-fix) — Clause-②: no is wrong; it should read Clause-②: yes (widening).

  • The test is whether the change widens the accept set or the public surface. Five exports are new on a published package's root, and four of them also on ./core (① above).
  • The seat's precedent on PR feat(chatbot): draw verified record citations as chips that open the cited section #37485 graded a new optional member and a new reserved URL parameter as widening, under Clause-②: yes. A new named export is at least as public as either.
  • The amendment 7191223613 left the final line to this review, and the PR body says the same. A wrong no is an auditable false declaration.
  • Fix: put Clause-②: yes (widening) at line start in both the PR body and the changeset body. Name the new exports in the changeset body, as the package's own CHANGELOG did for chartsFromParts / chartAnswerParts. The level stays patch, and no ! is owed.

③ Boundary flags

  • open_questions: none.
  • The PR body's flag ("Clause-②: no kept, for the area to judge at L1"): answered by S1.
  • Out-of-scope finding, phone dock sheet covering the cited heading: carried by 37487 跟进:手机上点 AI 引用后,对话面板仍盖住被引用的段落 #37556 (open). Answered.
  • Out-of-scope finding, N6/N7 of 7190147175: escalated to area ai-36996. Their only carrier is 37365 跟进:刷新或重开对话后,AI 回答下方的引用消失 #37487, and Fixes #37487 closes it on merge. File a carrier card for them before this lands.
  • Deviations: answered.
    • The S4 run injected the history part and a one-agent catalog. The card allowed that (7186889924) and the PR says so.
    • Single-file reruns ran outside the verify lock. That is moot, because CI ran every family green on this head.
  • SQL push-down: not applicable. The diff reads no data and adds no query, id materialisation or join. It only reshapes parts that are already in memory.

Nits (no effect on correctness or the contract):

  • N1 (nit) — STORED_ANSWER_DATA_PARTS names the kept parts, but it does not drive the code.
    • storedAnswerData reads chartsFromParts and the spec constant, and chartAnswerParts writes its own 'data-chart' literal.
    • So "a part added to the allow-list is read wherever it is written" (jsdoc in mapMessages.ts) and "a further kept part is one entry in the allow-list" (PR body) both overstate it. Today a new kept part needs edits in three places.
    • The jsdoc in toolResultParsers.ts also cites storedAnswerParts.recordCitations-37487.test.ts, which does not exist. The pin is in useObjectChat.recordCitationsReload-37487.test.tsx.
  • N2 (nit) — The in-mount sectionOpened and the shared slot both outlive moves between records while a RecordDetailView stays mounted. Embedded drawer or split-pane views count as mounted too.
    • Effect: a stateless in-app link back to a section that was already opened would mark it but not scroll.
    • Today that is not reachable in the app: only chips write ?section=, and each one carries a fresh state value. Same as the area's L1 N1.

Implemented-by: claude/project-thread-6hqn6k
Reviewed-by: session_01Utp6CYtTDvfPQDzMbZnN5X

VERDICT: FAIL

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X

席位核对

Head-sha: e2833f914872f06fe35da9f83d996a8127fbb209
REWORK — L1, seat repo:objectstack#5

  1. Shape: open draft against main, Fixes #37487. 15 files, +502/−27. Not governed. No review face, so the declaration face applies at TIER_DEFAULT.
  2. Premise: one allow-list now governs stored data parts on all three rebuild paths. Each path keeps a superset of what main kept, so a reload loses nothing the user saw. The module-level section memory holds a single slot, is keyed by object, record id and anchor, cannot cause a scroll, and clears once no record page is mounted. The code holds.
  3. Gates: contract record 7193217253 reads FAIL, on a declaration only. CI on this head is green.
  4. Owed for the delta (prose and changeset only):
  5. Out of scope and where it went: 37487 跟进:手机上点 AI 引用后,对话面板仍盖住被引用的段落 #37556, plus the N6/N7 card to be filed.
  6. Next: push, then knock. The delta reads S1. After ACCEPT, area ai-36996 lands it.

…llow-list drives

Claude-Session: https://claude.ai/code/session_01Utp6CY3qzEGtLEnwjFyRXG
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X

Contract-review-claim: session_01Utp6CYtTDvfPQDzMbZnN5X · head 40bb8ee · 2026-11-26T13:46Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X

Contract-review-claim: session_01Utp6CYtTDvfPQDzMbZnN5X · head 40bb8ee · 2026-11-26T13:59Z (re-record after the body-only fix)

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X

Contract review

Served-tier: TIER_DEFAULT
Head-sha: 40bb8ee4a17f20598279e6fcb4cc94d534a8d6c2
Local-runs: none

This record covers the same head as the earlier delta record, after a change to the PR body only. It replaces that record on this head.

I read the current PR body and every check-run on this head. Nothing was built or run.

① Derived judgments

The code is unchanged since the delta record: same head, and the two .ts hunks of the delta are jsdoc only. The accept set, the public surface, the S5 memory and the pins stand as judged in 7193217253.

N1: closed. The jsdoc in toolResultParsers.ts and mapMessages.ts now says the allow-list names the kept parts and takes three edits per new part. It cites the test file that holds the pin.

N2: accepted by the seat (REWORK 7193228908).

② Semver level

S1: closed.

  • Clause-②: yes (widening) stands at line start in the PR body and the changeset body.
  • Metadata-protocol: none stands.
  • The changeset names the five new exports.
  • patch on @object-ui/plugin-chatbot and @object-ui/app-shell is correct.
  • The newest Check Changeset run, job 139953755090 at 13:51Z, is green.

③ Boundary flags

S2: closed.

Check-runs on this head:

  • The newest run of every check name is green: 44 success and 12 skipped, with none failed or pending.
  • Of all 64 runs listed, the only non-green one is the superseded job 139952208807.

The PR body's check counts were refreshed.

Follow-up cards:

SQL push-down does not apply: the diff adds no query.

Implemented-by: claude/project-thread-6hqn6k
Reviewed-by: session_01Utp6CYtTDvfPQDzMbZnN5X

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X

席位核对

Head-sha: 40bb8ee4a17f20598279e6fcb4cc94d534a8d6c2
ACCEPT — L1, seat repo:objectstack#5

  1. Shape: open draft against main, Fixes #37487. 15 files. Not governed, no narrowing. Clause-②: yes (widening): @object-ui/plugin-chatbot gains five exports, named in the changeset (patch). Metadata-protocol: none.
  2. Premise: a single allow-list for stored data parts now covers all three rebuild paths, and each path keeps a superset of what main kept, so citations survive a reload. The module-level section memory is single-slot and keyed by object, record id and anchor. It is cleared once no record page is mounted.
  3. Gates: contract record 7194188712 (same reviewer, same head, after the body-only fix) reads PASS: S1, N1 and S2 are closed. On this head the newest run of every check is green, including PR-body guards (job 139953753736). The red job 139952208807 is the superseded earlier run.
  4. Accepted deviations: N2 (the section memory outlives moves between records while the page stays mounted; no in-app path reaches it).
  5. Out of scope and where it went: 37487 跟进:引用定位在同名标题与空段落两个边角的处理 #37562 (N6/N7), 37487 跟进:手机上点 AI 引用后,对话面板仍盖住被引用的段落 #37556 (phone dock sheet).
  6. Landing terms: ungoverned, default tier, no narrowing. Area ai-36996 lands it with --land.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CbeF2saT6wUBV4E9uc

Landing: ACCEPT 7194202614 (same-head contract record 7194188712, PASS) at head 40bb8ee4a.

Probe Reading
Check-runs on head 49 success, 14 skipped, 0 in progress; 1 failure is PR-body guards job 139952208807 (13:46Z), superseded on the same head by job 139953753736, success at 13:49Z after a body-only patch
Governed / size check-governed-merges --pr 37539: NOT governed, 529 changed lines ≤ 3000; mergeable_state clean

Status: ready + auto-merge (merge queue). On MERGED, #37487 closes by Fixes; #37562 carries N6/N7 of scope note 7190147175; #37556 (phone dock sheet, card thread in flight) carries the class-a finding.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 26, 2026 14:05
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 26, 2026
Merged via the queue into main with commit ebe35f4 Nov 26, 2026
64 of 65 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-6hqn6k branch November 26, 2026 14:35
Nenzyz pushed a commit to Nenzyz/objectstack that referenced this pull request Dec 1, 2026
…nner its height back (objectstack-ai#37588)

<!-- claude-projects-attribution: {"github_login":"os-sales"} -->
_Requested by **Sales** · [project
thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4UuDJAbBe3iTrFcF7GZrucZ32)_

Fixes objectstack-ai#37528

## What changes

- `ChromeBannerSlot` (`app-shell/src/layout/chromeBannerHost.tsx`): when
the console's standing banners (impersonation, read rate, storage) are
drawn **in place** above the routes, a `display: contents` wrapper
measures them (`ResizeObserver` on each child, `MutationObserver` for
banners that come and go) and publishes the summed height as
`--os-chrome-banners` on the document root; cleared on unmount and while
nothing is drawn. Drawn into an app layout's host (desktop, inside an
app, objectstack#36112) nothing is published, as that host sits inside
the content area.
- The console's full-height shells take the viewport less that property,
through `CONSOLE_FULL_HEIGHT` (module-local constants, literal Tailwind
classes): `AppShell` in `@object-ui/layout` (height, and a `min-h-` that
tailwind-merge puts in place of the sidebar wrapper's own `min-h-svh`),
`StudioDesignSurface`, `HomeLayout`, `AiChatPage`, the two organization
layouts, the app-unavailable / no-app screens in `AppContent`, and
`StudioRoute`'s access-required screen. The property is unset outside
the console and on an ordinary session, so every class there computes to
the plain viewport height.
- The banner keeps its place in flow (objectui#4467) and its `sticky`;
nothing about where it is drawn changes.

## Why

While an administrator impersonates a user, the banner sat in flow above
a shell that still took `100svh` / `100vh`, so the document was taller
than the window by the banner's height: list footers and bulk action
bars fell below the fold and the page grew a second scrollbar.

Measured on `main` (4116465) in a local console against
`examples/app-crm` (`--fresh`), impersonating a seeded user,
`document.documentElement.scrollHeight` against `innerHeight`:

| page | 1280×768 before | 1280×768 after | 390×844 before | 390×844
after |
|---|---|---|---|---|
| `/home` | 768 / 768 (redirects into the app) | 768 / 768 | 921 / 844 |
844 / 844 |
| an app list (`crm_lead`) | 768 / 768 (objectstack-ai#36112 host) | 768 / 768 | 921 /
844 | 844 / 844 |
| `/studio` | 821 / 768 | 768 / 768 | 921 / 844 | 844 / 844 |

The first push fixed `/home` only: the sidebar wrapper's own `min-h-svh`
and Studio's access-required screen still overflowed, which the second
commit covers.

## Verification

- New `layout/__tests__/chromeBannerHost.bannerHeight-37528.test.tsx` (5
cases: in place publishes the summed height and clears on unmount; no
banner publishes nothing; a resize and a banner going away republish;
drawn into the host publishes nothing; every full-height class reads the
property with a `0px` fallback). With `chromeBannerHost.tsx` restored
from `main`, 3 of the 5 go red (the two "nothing published" cases are
controls).
- `pnpm --dir ui exec vitest run` over `packages/layout/`,
`packages/app-shell/src/layout/`, `src/console/__tests__/`,
`src/console/home`, `src/console/ai`, `src/console/organizations`,
`src/views/studio-design`, the print stylesheet pin,
`apps/console/src/components` and the boot-redirect pins: all green
(3,325 + 3,862 tests). `ai-surface-unavailable` in `ConsoleShell` is
deliberately left on `h-screen`: `bootRedirectCoverage.test.tsx` reads
that class as the full-viewport cover.
- `type-check` for `@object-ui/app-shell` and `@object-ui/layout`:
clean. `eslint` on the changed files: 0 errors.
- The full UI suite runs in this PR's CI.
- `overlap-check`: exit 0 (shares `StudioDesignSurface.tsx` with objectstack-ai#37546
and `AiChatPage.tsx` with objectstack-ai#37539, both merge cleanly).

Clause-②: no
Metadata-protocol: none

## Human Minimum

- [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic.
(not touched)
- [x] 2. Every name I added uses the casing for its kind.
- [x] 3. No formatter ran; `eslint` on the changed files passes (the
full `pnpm lint` runs in CI).
- [x] 4. One issue, one branch off an up-to-date `main`, one pull
request.
- [x] 5. A change that publishes carries a changeset, and both
declaration lines are filled in here and in the changeset.
- [x] 6. `packages/spec` touched: its generated artifacts are
regenerated and committed. (not touched)
- [x] 7. No hand edits to `content/docs/references/`,
`packages/*/CHANGELOG.md` or `content/docs/releases/`.
- [x] 8. Title, body and comments are in English.
- [ ] The *Before Submitting* list in CONTRIBUTING.md is done. (full
local suite not run; CI carries it)

---
_Generated by [Claude
Code](https://claude.ai/code/session_01L6bhgUuauSMJu1nVSQRQri)_

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01L6bhgUuauSMJu1nVSQRQri

---------

Co-authored-by: Claude <noreply@anthropic.com>
Nenzyz pushed a commit to Nenzyz/objectstack that referenced this pull request Dec 1, 2026
…objectstack-ai#37571)

<!-- claude-projects-attribution: {"github_login":"os-bill"} -->
_Requested by **Bill** · [project
thread](https://claude.ai/code/project/chan_016iMXWSZDzqWRWvWzdNo8wg?thread=cmsg_016iMXWSZDzqWRWvWzdNo8wg8JRuu4biowMGgDVcNVcsSp)_
Fixes objectstack-ai#37556
Clause-②: no
Metadata-protocol: none

## 维护者速读
- 用户能看到什么变化:在手机上用应用内 AI,点回答下方的引用后,AI 对话面板自动收起,直接看到被标出的那一段;再打开 AI
面板,还是原来的对话。电脑上面板照旧留在页面旁边。
- 为什么做:记录 AI 问询专题里引用条的跟进,原先手机上点引用像没反应,要手动关面板才看得到。
- 出错会怎样:手机上点 AI 里的链接后面板该收不收或不该收时收起;对话和数据不受影响,撤回本次合并即可恢复原样。
- 要你做什么:无。

## What changes

- `ui/packages/app-shell/src/layout/useConsoleChatDock.tsx`: on a phone
(the drawer is a bottom sheet over the page), the host closes the sheet
when the location moves by a PUSH or POP away from the history entry
(`location.key`) the sheet was shown open on. A PUSH onto the same URL
counts (a second click on the same citation chip carries fresh section
state to the same URL). A REPLACE never closes it: a page rewriting its
own query, the host's handoff hand-over, and an old `/ai…` link landing
with the drawer armed open all stay as they were.
- The entry the sheet was shown on is kept per tab in sessionStorage
(`ai-chat-dock-sheet-shown-at`, cleared whenever the sheet is closed),
not in the hook: a chip in a sheet opened over Home lands on an app's
record through another layout, which mounts a new dock host that never
saw the navigation (found by the first booted check). Where
sessionStorage throws, a module copy stands in, so the rule still works
for the life of the page.
- Review rework (contract review 7195408408, seat REWORK 7195422188):
- S1: the move away is noted on the navigation itself, before the phone
check. `useIsMobile` answers `false` on a host's first render; an app
named by its alias lands through `AppContent`, which REPLACEs the
address on mount, so a rule judged only once the flag settled saw that
REPLACE and kept the sheet open.
- N1: at a desktop width (read off the window, since `useIsMobile`'s
first-render `false` cannot tell) the entry is dropped, so turning a
tablet portrait, landscape, portrait does not close the drawer on the
turn.
- S2: a POP case is pinned. N3: the storage-failure jsdoc is corrected
and the in-memory fallback added. N2 and N4 accepted as they are.
- The rule lives in the host, not at the chip: every navigation the chat
makes on a phone (citation chip, `open_record`, list link, open-form)
now reveals the page; the chip's click path is not touched.
- The conversation is kept: closing only collapses the sheet; the dock
target is untouched, so reopening shows the same thread. Desktop rail
and the full-window rule are unchanged.
- Changeset `.changeset/37556-phone-dock-closes-on-citation.md` (patch,
`@object-ui/app-shell`).

Read first: `useConsoleChatDock.tsx`, the effect under the full-window
one and the storage helpers above `hasHandoff`.

## Tests

-
`ui/packages/app-shell/src/layout/__tests__/useConsoleChatDock.phoneCollapseOnNavigate-37556.test.tsx`
(9): the real host, `useChatDockState` and router; `useIsMobile` is a
stand-in with the real hook's timing (`false` on the first render,
measured in its mount effect, again on resize); stand-in sheet/rail.
Cases: a phone chip click (PUSH) closes the sheet and reopening with no
target shows the same conversation; a same-URL re-click closes it; Back
(POP) closes it; a chip from Home into an app (two layouts, two hosts)
closes it and reopening shows the same thread; the alias landing (a
parent `AppContent`-shaped redirect REPLACEs on mount while the new
host's flag is held back one task) closes it; with
`window.sessionStorage` throwing, a chip click closes it; a same-page
REPLACE leaves it open; a tablet turn to landscape, a chip click there,
and a turn back leaves the drawer open; CONTROL: at desktop width the
rail stays open after a chip click.
- The new tests against the previous head's hook (b220ce8): 3 failed
(alias landing, storage throwing, tablet turn), 6 passed.
- Ablation (the `collapse()` call replaced by a no-op): 6 failed, 3
passed (every closing case red; the REPLACE case, the tablet turn and
the desktop control green); restored 9/9.

## Acceptance notes

- Acceptance 1 (test): above.
- Acceptance 2 (booted-console phone check): see Verification.

## Verification

- Local on e4692c3: the new test 9/9; `@object-ui/app-shell`
`type-check` exit 0; derived gate families: see the report. The
package's whole suite is left to CI's `Test UI` (test-run scope, not a
Clause-② narrowing).
- Two-minute check: `pnpm --dir ui exec vitest run
packages/app-shell/src/layout/__tests__/useConsoleChatDock.phoneCollapseOnNavigate-37556.test.tsx`,
expected 9 passed.
- Booted-console phone check (iPhone 13 profile). Showcase app
(`objectstack dev --seed-admin`) with the `ui/` console dev server
pointed at it, on `main` (which now carries PR objectstack-ai#37539, so history draws
chips) merged with this branch. **Injected, not produced**: no producer
emits the citations part before cloud 10c, so the run serves the
conversation-history read with an answer carrying a
`data-record-citations` part, and a one-agent catalog because the boot
has no model.
- Package address: the old `/ai/ask/CONVERSATION` link lands on Home
with the sheet open and 3 chips. Chip click:
`/apps/com.example.showcase/showcase_field_zoo/record/ID?section=contractor-scope`,
sheet gone (0 in the DOM), the marked heading `Contractor scope` at top
45 px, in view. Reopening: the same 3 chips. The same chip again: sheet
gone, heading in view.
- Alias path (S1): the object read is served with the app's NAME
(`showcase_app`) as its package, so the chip lands on
`/apps/showcase_app/…` and the app shell REPLACEs it with
`/apps/com.example.showcase/…`. Sheet gone, heading at top 45 px, in
view; reopening shows the same chips; the same chip again closes it
again.
- Screenshots: `objectstack-seat5/ai-36996/shots-37556/` in the project
files (`phone-dock-*.png` and `phone-alias-dock-*.png`, four each, plus
the script).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---
_Generated by [Claude
Code](https://claude.ai/code/session_01Utp6CXDoFxnz75MqdAxLSW)_
<!-- signed: repo:objectstack#5 · os-bill ·
session_01Utp6CXDoFxnz75MqdAxLSW -->

---------

Co-authored-by: Claude <noreply@anthropic.com>
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/l 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.

37365 跟进:刷新或重开对话后,AI 回答下方的引用消失

2 participants