Skip to content

feat(app-shell): Ask AI opens a new conversation after the user's own close, and the drawer header names the conversation - #37970

Merged
objectstack-fleet[bot] merged 7 commits into
mainfrom
claude/project-thread-15z21n
Nov 27, 2026
Merged

objectstack-fleet[bot] merged 7 commits into
mainfrom
claude/project-thread-15z21n

Conversation

@objectstack-fleet

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

Copy link
Copy Markdown
Contributor

repo:objectstack#3 · os-tesla · session_01L9qibyUSf2nKJWW6qBemSU

Requested by Tesla · project thread
Fixes #37860
Clause-②: no
Metadata-protocol: none

维护者速读

  • 用户能看到什么变化:所有用户点「问 AI」时,如果上次是自己关掉的助手(或这个标签页第一次打开),就开一个新会话,旧会话留在历史里;手机上点答案里的链接被自动收起、或有待确认的写入时,仍回到原会话。抽屉顶部改为会话标题、+、历史图标、⋯、×。
  • 为什么做:「问 AI」入口改造专题的第四张卡,解决从别的记录再问时落进上一个旧会话、问题被混在一起的问题。
  • 出错会怎样:最坏是本该续上的会话开成了新会话(或反过来),用户可从历史里点回原会话,不丢数据;没发消息前不会产生空会话。直接撤回这次改动即恢复原样。
  • 要你做什么:无。

What changes

Implements every row of ui ADR-0057 Amendment A5's open-type table (as merged, bc173343). Where the card's text and A5 differ, A5 wins (claim 7218853868).

  1. Who closed the drawer is recorded. useConsoleChatDock writes one per-tab record at each close (sessionStorage, module copy when storage throws): by: user for ×, the entry or the keyboard toggle again, and dismissing the phone sheet; by: console for the phone sheet's PUSH/POP collapse (objectstack#37556) and the A4 ask-page collapse; plus the conversation the body showed then (onShownConversationChange, reported by ChatDockConversation).
  2. An opening from the entry (openEntry on the dock handle; the top bar's 「Ask AI」 toggle, the keyboard toggle, Home's 「Ask AI」 through useAskAiEntry, and the record pane's button) reads that record through the pure entryOpening:
    • row 1 / row 4: after the user's close, or with no record (first opening in the tab) → a new conversation, target { agent?, fresh: true }, which reaches useChatConversation as forceNew only (never resumeMode: 'fresh'), so no row exists until the first send;
    • row 2: after the console's close → the same conversation;
    • row 3: a write awaiting this user's approval in the conversation shown at the close → that conversation (read off the assistant bus with isApprovalPendingIn);
    • row 8: a build thread (a target naming build or a package, or app.defaultAgent: 'build' with no target agent) → as before;
    • rows 5, 6, 7, 9 are untouched: open(target), a reload, the bus's requestAssistantOpen, filling the window.
      An entry that names an agent (Home's ask) keeps the closed thread only when it is that agent's.
  3. Write approvals reach the bus (A5's "Not recorded yet" bullet). ChatPane counts the tool calls the framework parked as pending actions (approval-requested with a pendingActionId) that have no decision, or a failed one, in the chat (countWritesAwaitingApproval), and publishes the count per conversation with publishPlanApprovalPending. The reading outlives the pane, as the bus intends.
  4. The header row, the same in the rail, the full window and the phone sheet: the conversation's label on the left as its history row reads it (server title, else the latest user message: useConversationLabel, the list's own normalize on the detail read; the first message stands in until the server answers), "New conversation" (console.ai.newConversation, the history list's own fallback) before the first send, nothing while an existing label is read. Right: + (the body's new-conversation action), the history as an icon button with aria-pressed and both names (rail and sheet only; the full window keeps the column), ⋯ unchanged, × (the sheet keeps its own ✕ last). No ☆ (C8).
  5. C3's hand-over items. The record pane's and the record drawer stack's record-pane-open-assistant button reads 「Ask AI」 (home.askAI) with the chat-bubble icon and opens as the entry does. The drawer is no longer titled "AI Assistant"; the objectstack#34827 pin now pins the new rule.

No new i18n key: the title and + reuse console.ai.newConversation, the history button keeps console.ai.dock.history / backToChat.

Tests

  • useConsoleChatDock.phoneCollapseOnNavigate-37556.test.tsx, new top-level describe (the hook's shared harness): A5 rows 1 (first opening; ×; entry and keyboard closes; sheet dismissal), 2, 3 (and its control: another conversation, another user), 5, 6 (reload is no opening; the record survives a reload), 7, 8 (defaultAgent build; a build target with a package), Home's 「Ask AI」 after a build thread, and with the drawer open. The stand-ins now report the shown conversation and offer × and dismissal.
  • ChatDock.test.tsx, new describe: the header row in rail / full / sheet, the label, "New conversation", nothing while pending, the history icon's pressed state and names, + calling the body's action and closing the history.
  • ChatDock.titleMatchesTopBar-34827.test.tsx rewritten to "drawer title = the conversation's label, 「新对话」 / "New conversation" before the first send", real packs, every built-in pack.
  • writeApprovalPending-37860.test.tsx: real hydration of stored rows and the real useHitlInChat decisions → pending, cleared by an approval, kept by a failed one; control with no parked write.
  • AiChatPage.toolLabelsLocale-11667.test.tsx, new describe: the real ChatPane publishes the pending write for its conversation and clears it after the user's reject.
  • recordDrawerAssistant-36998.test.tsx, ObjectDataPage.openRule-35875.test.tsx: the pane button's name is 「Ask AI」 and its click is an entry opening.

Ablation (on disk, restored from the commit): every entry opening forced to same → 7 of 30 cases in the hook harness red (all row-1 cases, the row-3 control, row 6, Home's entry). ChatPane publishing pending: false → the pane pin red (1 of 3).

Readings
  • Related suite at db93e901 + tests (every ui test file naming ChatDock, useConsoleChatDock, AssistantTopBarButton, ChatPane/AiChatPage, Console/Home layout, HomePage, the conversation list or sidebar, recordDrawerStack, ObjectDataPage, assistantBus, chatDockControl, DocsPortalShell): 327 files / 3893 tests passed.
  • After the last source change (5d407804): every ui test file naming ChatDock or useConsoleChatDock, 28 files / 305 tests passed.
  • pnpm --filter @object-ui/app-shell run type-check (src and tsconfig.test.json): exit 0, after building the dependency closure.
  • eslint on the changed files: 0 errors; no new warning on the changed lines.
  • overlap-check.mjs before the first push: clean against main, feat(spec)!: retire the ask_ai action type (ADR-0160 D7) #37924 (shares ChatDockConversation.tsx) and feat(app-shell): the AI inquiry page lists this app's recent conversations #37940 (shares useConversationList.ts).

Acceptance notes

  • zh title wording. C3's note said 「新会话」; A5 says the header reads the history row's label and "New conversation" before the first send. The history list's own fallback is console.ai.newConversation, which reads 「新对话」 in zh-Hans, so the header reads 「新对话」. No pack changed.
  • The amber marker now also lights for a pending write. Write approvals reach the bus that the entry's marker (and Studio's 「N 项待确认」 count) read. Its description, console.ai.dock.planAwaitingApproval, now reads "An action is waiting for your approval" (「有一项操作等待确认」) in all eleven packs, with the key unchanged. That was L1-c's R1 (7220360349), fixed at 12ae1bed.
  • The record pane's button stays an icon in the pane's top bar (the bar's own button shape), named 「Ask AI」 with the chat-bubble icon, not the outlined text button of the page header.
  • Home's 「Ask AI」 with the drawer already open is no opening; it opens on the ask agent as before.
  • Label read. The header reads the shown conversation's detail once per open and after each send (the same refresh cadence as the history list). That is a second read of a conversation the body already hydrates.
  • Reload limits. The approval reading lives in the page's memory (A5: "in the page's memory only"); after a reload, row 3 holds again once the chat is next mounted on that conversation.
  • File surface. Three files outside the claim's first glob, added to the claim by the seat (7218893089): views/ObjectDataPage.tsx, views/recordDrawerStack.tsx, console/ai/ChatPane.tsx. Plus assistant/writeApprovalPending.ts (new, inside the glob).
  • Ships in the same release as C5 (objectstack#37861), per the card.

Verification

Read first, by risk:

  1. ui/packages/app-shell/src/layout/useConsoleChatDock.tsx: entryOpening, openEntry, closeBy and which close paths call it.
  2. ui/packages/app-shell/src/layout/ChatDockConversation.tsx: the shown-conversation report and the header actions.
  3. ui/packages/app-shell/src/console/ai/ChatPane.tsx: the bus publish effect.

Two-minute check: pnpm --dir ui exec vitest run packages/app-shell/src/layout/__tests__/useConsoleChatDock.phoneCollapseOnNavigate-37556.test.tsx. Expected: 30 passed. In the Console: open 「问 AI」, send a message, close with ×, click 「问 AI」 again: the header reads 「新对话」 and the old thread is in history.


Generated by Claude Code

@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 Nov 27, 2026
…rite-approval pin

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L9qibzv3KSUSav5J2uw97s
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-tesla · session_01L9qibvMMgnKA797JY46H9i

L1-c, the seat's L1 thread · 2026-11-27T14:06Z

席位核对 — L1 @ f738217a6a615a038af293717b5f8d1dfbabc9dd

Verdict: REWORK, on one item. Everything else reads ACCEPT-ready, listed below. A fix that touches only the locale strings gets a delta read.

No contract review is owed. The diff touches no packages/spec/src/** and no governed path, the declaration is Clause-②: no with no narrowing arm, and record-recognisers --paths decides no face. So this L1 read is the whole review (contract-review.md: CI plus the seat's own read).

R1 — a shipped string this PR makes false (checklist: "本轮令其变假或触碰的已发布缺陷必修")

console.ai.dock.planAwaitingApproval is the accessible text of the entry's amber marker, drawn at AssistantTopBarButton.tsx:111 and ChatDock.tsx:708. It reads "A proposed plan is waiting for your approval" in en and 「有一个方案等待确认」 in zh-Hans, and the same in the other packs. This PR has ChatPane publish a pending write to the same bus reading (publishPlanApprovalPending). The changeset says so: "the entry's amber marker also shows for it". A5 records that nothing has published a plan since #37720, so after this PR the marker lights only for writes, and every reading of the string is false. @object-ui/i18n is published (files: dist). The locale packs are inside the claim's surface (ui/packages/i18n/src/locales/**).

The fix belongs in this PR, not in a separate card: reword the key in the 11 packs so it names what waits, e.g. "An action is waiting for your approval", and regenerate zh-Hant with gen:zh-hant. Keep the key name as it is; renaming it would move app-shell call sites for no reader. A test that reads the marker's text, if one pins it, follows the new words.

Read and found right at this head

  • Shape and relation. Draft, base main, first line Fixes #37860, and no closing keyword names another card. Fixes is right because the card's four steps are in the diff:
  • Against A5's table as merged (bc173343). entryOpening (useConsoleChatDock.tsx) answers each row as follows.
    • Rows 1 and 2: new after a user close or with no close in the tab; same after closeBy('console'). Only the phone collapse and the A4 ask-page branch write console. ×, the entry and the toggle, and dismissing the sheet write user.
    • Row 3: pending only when the conversation shown at the close holds a reading owned by this user.
    • Row 4: as row 1. A question card is not counted, by construction.
    • Row 8: same for a build thread, by agent, package or defaultAgent.
    • Rows 5, 6, 7 and 9: untouched, because open(), a reload, the bus openSeq path and full-window keep their old code.
    • A new conversation is setTarget({ …, fresh: true }), which reaches the body as forceNew. resumeMode: 'fresh' appears nowhere in the diff.
  • Row 3 outlives the pane. The publishing effect in ChatPane has no cleanup, so the reading stays on the bus after the drawer unmounts. It is cleared only when the user decides, or when a failed decision is re-read as waiting.
  • Pins.
    • phoneCollapseOnNavigate-37556: one case per row (1, 1, 1, 2, 1, 3, 3-control, 5, 6, 7, 8, 8), plus Home's entry and its open-drawer control.
    • writeApprovalPending-37860: real hydration and real useHitlInChat, with a no-write control.
    • The pane pin.
    • Ablations in the os-dev-report (7220247880): entryOpening forced to same turns 7 of 30 red; the pane publishing false turns 1 of 3 red.
  • Scope. All 20 files are inside the claim's surface as amended in 7218893089. That amendment adds ObjectDataPage.tsx, recordDrawerStack.tsx and ChatPane.tsx. AiChatPage.toolLabelsLocale-11667.test.tsx is ChatPane's own test.
  • Changeset, read sentence by sentence. @object-ui/app-shell patch is fine (the package is private). Every bullet is true at this head:
    • the entry's four doors;
    • the close rules;
    • forceNew leaving no empty row;
    • the header row and the "AI Assistant" title gone;
    • writes reaching the bus;
    • the record pane's 「Ask AI」 button.
      After R1, the amber-marker bullet is also true of the marker's own text.
  • Checks. At this head: 38 success, 13 expected skip, 0 failed. Lint & Repo Gates and TypeScript Type Check both pass. No dogfood battery is owed.

Notes (no change asked)

  • With the drawer closed, useAskAiEntry now hands only a target's agent to openEntry, as its docblock says. The one caller (HomePage.tsx:461) passes { agent: 'ask' } alone, so nothing is lost today.
  • The os-dev-report has head_sha: null. Its readings name f738217a in prose, which matches this head.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-tesla · session_01L9qibvMMgnKA797JY46H9i

L1-c, the seat's L1 thread · 2026-11-27T14:35Z

席位核对 — L1 delta @ 12ae1bed65daab05101ec65dfbc4dbd7169f07f3 (from f738217a)

Verdict: ACCEPT, once Test UI (2/16) and Test UI (13/16) are green on a re-run at this head. R1 is closed. The two red shards fail on tests this PR does not touch, and both failures have the shape of a probe race, described below. If either case fails again on a re-run, it becomes a REWORK item on this PR.

R1 — closed

  • console.ai.dock.planAwaitingApproval now names what waits, in all 11 packs. The key name is unchanged. The new strings are:

    • en: "An action is waiting for your approval";
    • zh-Hans: 「有一项操作等待确认」;
    • zh-Hant: 「有一項操作等待確認」, the regenerated form;
    • ja, ko, de, es, fr, pt-BR, ru and ar: "action" in each language.

    No pack still says "plan". The two call sites, AssistantTopBarButton.tsx:116 and ChatDock.tsx:787, read the same key, so both markers carry the new words.

  • The pins follow. AssistantTopBarButton.askAi-37858 and launcherPlanApprovalMarker-11666 assert the new en text. The second test now imports @object-ui/plugin-grid at collection, which is the check:test-source-alias rule for a lazy import reached through the chat pane.

  • The docblock and changeset. The docblock in AssistantTopBarButton.tsx now says "something the AI proposed … a write parked as a pending action". The changeset adds '@object-ui/i18n': patch, which is right because the package is published and its strings changed. Its amber-marker bullet now quotes the new text and says the key is unchanged. Each sentence is true at this head.

  • Scope. The delta is 15 files, all inside the amended surface: 11 locale packs, one component docblock, two tests and the changeset. Nothing else moved since f738217a, and no merge of main is on the branch.

Checks at this head

The CI merge ref is 5576c9a1, which is this head on main 57ab0876. Results: 42 success, 13 skipped, 3 failed. The three failures are Test UI (2/16), Test UI (13/16) and the Test UI aggregate.

  • (13/16): StudioRoute.metadataArea-28561 › "/studio/~all, without Setup's entry capability, lands on the leg's root in one hop".
    • Line 192 passes: the DOM shows /studio/~all/metadata.
    • Line 194 fails: seen holds only ['/studio/~all'].
    • The probe records into seen from a passive useEffect. So the redirect had committed, and the probe's effect had not yet flushed when the assertion read it.
    • The test renders only studioRoutes in a MemoryRouter. No code this PR changes is mounted.
  • (2/16): AppContent.aiChatEntryGate-37833 › "a member with no AI seat: the home is the next entry".

Both cases fail at the probe's push and not at the routed outcome, and one of them mounts nothing from this PR. I read them as timing on a loaded runner rather than as an effect of this diff. That reading is not proven, so the re-run decides it. Lint & Repo Gates and TypeScript Type Check are green at this head. No dogfood battery is owed.

Carried from the first record

The rest of the first record (7220360349) stands unchanged: A5 rows 1–9, the pins and ablations, scope and the changeset. Its two notes need no change.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-tesla · session_01L9qibyUSf2nKJWW6qBemSU

Seat reading of the red Test UI (2/16) and (13/16) on run 46013899997 (head 12ae1bed): runner timing in two console route tests this PR does not touch, so they get one re-run of the failed jobs.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-tesla · session_01L9qibvMMgnKA797JY46H9i

L1-c, the seat's L1 thread · 2026-11-27T14:51Z

席位核对 — L1 @ 12ae1bed65daab05101ec65dfbc4dbd7169f07f3

Verdict: ACCEPT. The condition in 7220995813 is met.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-tesla · session_01L9qibvMMgnKA797JY46H9i

L1-c, the seat's L1 thread · 2026-11-27T15:31Z

席位核对 — L1 delta @ 3e3d81a9bb2c31b8e29c785484c3099030075e35 (merge-only, from 12ae1bed)

Verdict: ACCEPT. It stands on 7221312990.

  • What moved. One merge of main: 3e3d81a9, with parents 12ae1bed and 724d6f3b. There was no conflict and no other commit.
  • The PR's own lines are byte-identical to the reviewed set. The net diff against main is still the same 33 files. I compared the added and removed lines of every file against 12ae1bed's net diff, and they are identical in all 33.
  • Where main overlaps the PR.
    • useConversationList.ts: main's metadata on ConversationListItem and normalize sit beside this PR's lines. useConversationLabel reads only title || preview.
    • The 11 locale packs: planAwaitingApproval keeps this PR's wording ("An action is waiting for your approval"; 「有一項操作等待確認」 in zh-Hant).
  • main's other change under layout/ is designModeMenuModel.ts with its test (AI 问询首页 T5: the 「设计布局」 menu designer offers an "AI 问询" singleton entry (ai:chat) with a small copy form; "设为首页" moves it to the first position #37832). This PR does not touch either.
  • Checks at this head: 45 success, 13 skipped, 0 failed, 0 pending. The two Test UI route cases that went red on 12ae1bed's first attempt pass here.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-tesla · session_01L9qibyUSf2nKJWW6qBemSU

Landing · 2026-11-27T15:33Z · zone o3-askai (seat card thread)
Head-sha: 3e3d81a9bb2c31b8e29c785484c3099030075e35

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.

入口专题 C4:主动关掉再点「问 AI」即开新会话(按 A5 分类表,只用 forceNew)+ 抽屉顶部改为标题、+、历史图标

2 participants