Skip to content

feat(app-shell): the AI drawer history lists the app's conversations, with an All switch - #39250

Queued
objectstack-fleet[bot] wants to merge 3 commits into
mainfrom
claude/issue-35081-ai-history-app
Queued

objectstack-fleet[bot] wants to merge 3 commits into
mainfrom
claude/issue-35081-ai-history-app

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Fixes #35081
Clause-②: no
Metadata-protocol: none

维护者速读

  • 用户能看到什么变化:在某个应用里打开 AI 助手抽屉的历史列表,默认只列这个应用里开始的对话,上方多了「当前应用 / 全部」切换;在「全部」里点开别的应用的对话,会先跳到那个应用再打开。首页和平台自带的设置应用里没有当前应用,照旧列出全部。
  • 为什么做:控制台 AI 助手抽屉专题里「对话跟着应用走」的最后一条(历史列表按应用分),之前要等服务端先记下每段对话所属的应用,那一半已经完成。
  • 出错会怎样:最坏是某个应用的历史默认显示为空、要切到「全部」才能看到,或点开别的应用的对话时没有先跳过去;对话数据本身不受影响,撤回这一个合并即可。
  • 要你做什么:无。

What changes

The client half of #35014 item 4. The server half (service-ai records the app a conversation was started in, returns it on every conversation row as packageId, and filters GET /api/v1/ai/conversations?packageId=) shipped in objectstack-ai/cloud#4835; the field and parameter names here are the ones in service-ai's conversation/conversation-app.ts (CONVERSATION_APP_FIELD = 'packageId').

  • useConversationList: a row carries the packageId the list route recorded (absent when it has none); a new packageId option asks the list route for one app's conversations.
  • ConversationsSidebar: a new appPackageId prop. Set, the list reads that app's conversations by default and draws a two-button switch ("This app" / "All") above the search box; the choice is per app, so moving to another app starts on that app's own list. Absent, the list reads every conversation and draws no switch. A hosted row hands its packageId to onSelectConversation. In the app's own view, an empty list says so and points at All.
  • ChatDockConversation: the app in view is ambientAppPackage(appPackageId) (an authorable app; none at Home or in a built-in app such as Setup). It is passed to the history (only when the host lists every row: the ai:chat page keeps its own historyRowFilter and gets no switch) and to useChatConversation as createPackageId. A picked row whose packageId names another app goes to the host's new onOpenInApp; a row with no app, or of the app in view, opens in place as before.
  • useChatConversation: createPackageId is sent as the create's packageId. With nothing to send the body is still {}.
  • useConsoleChatDock (plumbed through ChatDockPanel / ChatDockMobileSheet): onOpenInApp stores the target placed in the destination app (app: ambientAppPackage(packageId) ?? null, so dockTargetFollowsApp shows it there), then navigates to /apps/PACKAGE (the ADR-0048 package-id address). On a phone the sheet stays open over the new page: the drawer's own move forgets the entry the sheet was shown on instead of reading it as a move away.
  • @object-ui/i18n: console.ai.historyScope.{label,app,all}, console.ai.noChatsInApp, console.ai.noChatsInAppDescription in every pack (zh-Hant regenerated by gen:zh-hant).

Tests

  • New ui/packages/app-shell/src/layout/__tests__/ChatDock.historyByApp-35081.test.tsx (7 pins). It drives the real console host useConsoleChatDock with the real ConversationsSidebar, useConversationList, ChatPane and useChatConversation under a router whose address decides the app in view, over a fetch stub that filters its list by packageId as service-ai does. Its own file because ChatDock.appBinding-10926.test.tsx replaces the history list with a stub module-wide. Pins: the default per-app list; All and back; no app (Home, Setup) means every conversation and no switch; a row from another app navigates first and opens there (also from Home); a row of the app in view or with no app opens in place; the create sends packageId in an authorable app and nothing in Setup.
  • New describe in useConversationList.test.tsx (2 pins): the row's packageId is read (absent and empty read as no app); the packageId option reaches the query, and is dropped when unset.
  • AppAskPage-37788.test.tsx: the create-body expectation now includes packageId: PKG. The page's create sends the app it starts in, like the drawer's.
  • Red on main: the 6 source files restored from the base 6f292da44e (git restore --source), new pins run: 8 failed, 3 passed. The 3 that pass by design are the two existing list pins and the no-app preservation pin. Restored after; git diff HEAD empty.
  • Ablations (scripts/ablation-replace.mjs, each restored with blob == HEAD and git diff HEAD empty). The subjects are imported relatively from src, so no build leg is needed.
    • Sidebar const listApp = showAll ? undefined : appPackageId; replaced by const listApp = undefined;: 4 red (default list, All and back, navigate-first, open-in-place).
    • The switch's onClick={() => setAllFor(...)} replaced by a no-op: 3 red (All and back, navigate-first, open-in-place).
    • The body's if (conversation.packageId && conversation.packageId !== appPackageId && onOpenInApp) { replaced by if (false) {: 2 red (both navigate-first pins).
    • createPackageId: ambientApp, replaced by createPackageId: undefined,: 1 red (the create pin).
  • Green at c22053a3c (code identical to head 0363607a3, which adds only the changeset):
    • the two new or changed test files: 11/11;
    • the 50 ui/ test files that import ConversationsSidebar, useConversationList, useChatConversation, ChatDockConversation, useConsoleChatDock or ChatDock: 504/504;
    • packages/i18n/: 110 files, 1874 passed, 13 skipped;
    • ui/scripts/: 172 files passed, 2 skipped;
    • @object-ui/i18n and @object-ui/app-shell type-check (both tsc projects each, after building the app-shell dependency closure): exit 0.
Red on main (base sources, new pins)
× useConversationList — the app a conversation was started in > each row carries the app the list route recorded, and a row with none carries no app
× ... > asks the list route for one app with `packageId`, and for every conversation without it
× the drawer history ... > in an app, the history lists that app's conversations by default
× ... > All lists every conversation, and This app goes back to the app's own
✓ ... > with no app in view (Home, the built-in Setup app) the list holds every conversation and draws no switch
× ... > a row started in another app moves the console to that app first, and the conversation opens there
× ... > from Home, a row started in an app moves the console into that app first
× ... > a row of the app in view, or with no app, opens in place
× ... > a new conversation sends the app it starts in at create, and none outside an authorable app
Tests  8 failed | 3 passed (11)
RESTORED: git diff HEAD lines = 0
Green runs
new pins          Test Files  2 passed (2)      Tests  11 passed (11)
50 importers      Test Files  50 passed (50)    Tests  504 passed (504)
packages/i18n/    Test Files  110 passed (110)  Tests  1874 passed | 13 skipped (1887)
ui scripts/       Test Files  172 passed | 2 skipped (174)  Tests  5159 passed | 2 skipped (5161)
type-check        os-verify-lock: VERDICT command-exit 0 (i18n + app-shell)
Gates

node scripts/pm/dispatch-gates.mjs --commands for this diff derived 41 families. Each was run locally with its exit code recorded, and all exited 0. check:query-options-erasure hit a 300 s wrapper timeout on the shared box the first time and exited 0 on its re-run.

Run reconciliation — 41 derived, 41 run, 0 NOT-MEASURED, 0 UNRUN.
✓ dispatch-gates --ran: 41 derived famil(ies) accounted for — 41 run, 0 NOT-MEASURED

Acceptance notes

  • The spec does not declare packageId on the conversation schemas. AiConversationSchema, CreateAiConversationRequestSchema and ListAiConversationsRequestSchema in packages/spec/src/api/protocol.zod.ts predate cloud#4835, and @objectstack/client's ai.conversations.create/list therefore carry no packageId either. The console reads the route directly through its own fetch, so nothing here depends on that, and this PR leaves the spec alone: changing it is a contract-shape change, not this card's. Raised to the seat as an open question.
  • What the default list shows. It is service-ai's filter: the conversations recorded with this app. Two kinds of conversation are absent from it and present under All:
    • a conversation created before cloud#4835 (no app recorded);
    • the ambient ask thread, which ui ADR-0057 A2 keeps the same in every app. If it was started in another app, the drawer can show it while the default list does not.
      The list's existing "the open conversation is always kept" leniency applies only to the rows a list read returns, so it cannot keep that row.
  • The server records an app only when the caller can see an app the package ships; otherwise it drops the value. A row with no recorded app always opens in place.
  • The ai:chat page keeps its own row filter and gets no switch. Its create now also sends packageId (its own app), so its conversations appear in the drawer's per-app list for that app. Before this PR they already appeared in the drawer's unfiltered list.
  • Not changed: the full-page /ai history and the empty conversation's 「最近会话」 list (DrawerRecentConversations) still read every conversation. The card names the history list only.
  • Moving apps from the full-window drawer follows the existing page-change rule: inside ConsoleLayout, a page change drops the full window back to the rail.
  • No docs page describes the drawer's history list (ui AGENTS.md ✨ Set up Copilot instructions #2): content/docs/ has none, and the app-shell README does not cover it.

Read first:

  1. ui/packages/app-shell/src/layout/useConsoleChatDock.tsx, openInApp. This is where the target is placed in the destination app and the phone sheet's shown-at entry is forgotten.
  2. ui/packages/app-shell/src/layout/ChatDockConversation.tsx, openConversation, and the appPackageId passed to the history.
  3. ui/packages/app-shell/src/console/ai/ConversationsSidebar.tsx, the per-app allFor derived state.

Verification

pnpm --dir ui exec vitest run packages/app-shell/src/layout/__tests__/ChatDock.historyByApp-35081.test.tsx: expect 7 passed. In the console: open the AI drawer inside an app, then open History. It shows "This app" pressed and only that app's conversations. Press All, then pick a conversation from another app: the page moves to that app and the drawer shows that conversation.


Generated by Claude Code

… with an All switch

The drawer's history defaults to the conversations started in the app in
view (the list route's packageId filter), offers an All switch, and a row
started in another app moves the console to that app before opening it.
A new conversation sends the app it starts in at create.

Claude-Session: https://claude.ai/code/session_01TsNV8Bsjqmw7aXCo2QuLU1
Co-authored-by: Claude <noreply@anthropic.com>
…d navigate-first

Claude-Session: https://claude.ai/code/session_01TsNV8Bsjqmw7aXCo2QuLU1
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/l 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 3, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:cloud@zhuangjianguo · zhuangjianguo · session_01TsNV8Bsjqmw7aXCo2QuLU1

席位核对 · ACCEPT · 2026-12-03T03:20Z

Head: 0363607a3ca8414bf3d6ae6e8b682db64f71af1c

  • Form: 21 files (+622/−20) in ui/ plus a patch changeset for @object-ui/app-shell and @object-ui/i18n. Not governed, and under the size threshold. Fixes #35081. Declarations: Clause-②: no, Metadata-protocol: none.
    • The AI drawer history lists the current app's conversations (GET /ai/conversations?packageId=) with a "This app / All" switch.
    • With no app in view, it lists everything and shows no switch.
    • A row from another app navigates to that app first (onOpenInApp).
    • Every drawer create sends the app in view.
    • The field names match cloud conversation-app.ts (cloud#4835).
  • Tests (dev):
    • New pins 11/11, and 8 of them are red on main.
    • Ablations: listApp undefined turns 4 red; All as a no-op turns 3 red; navigate-first off turns 2 red; createPackageId off turns 1 red.
    • The 50 importer files are 504/504, i18n is 1,874 passed, and the type-check verdict is exit 0.
    • dispatch-gates --ran: 41 derived, 41 run, 0 NOT-MEASURED.
  • Open question → filed: the spec does not declare packageId on the AI conversation schemas, so @objectstack/client cannot send or read it. The producer, cloud service-ai, has served it since cloud#4835. That precedent is filed as a separate card, under the seat's discretion with a veto window, not in this PR. Edge case recorded in the PR: a conversation started in another app is listed under All.
  • CI at this record: 10 success, 15 skipped, 16 in progress, 0 failed. The merge queue holds the PR until the required checks pass.
  • Landing: an ordinary queue landing (ready, then auto-merge).

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/l tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

2 participants