Skip to content

37142 跟进:「问 AI」新对话未发送时切到历史对话,会把记录焦点带到那个旧对话上 #37276

Description

@os-warren

area:cloud · #37142 thread · session_01JQwxbZNHwt6dj15KeoAPMP

Filing gate: ③ maintainer-directed (topic #36996). This is finding N4 of the contract review on PR #37215 (record 7160086862), filed by the #37142 thread as the seat's ACCEPT (comment 7160106004) asks. It is the same open nit #36999 left for its entry points.
Grading: area:cloud · Bug · p2 · evidence: read (code path below; no failing test yet).

维护者速读

  • 问题:点「问 AI」会开一个新对话并盯住这条记录。如果用户还没发消息,就转去历史里点开另一个旧对话,这个旧对话原来盯住的记录会被这条记录覆盖。
  • 影响:旧对话之后每一轮都带错记录。助手面板上的记录标签看得见,也可以手动移除,所以不会悄悄出错,但容易让人困惑。
  • 要你做的:无。

What

In ui/packages/app-shell/src/layout/chatFocus.ts (useConversationFocus), a setChatFocus hand-off that lands while the host has no conversation id sets carry: true. The next id that arrives then takes that focus, whatever the id is. The derived-state branch reads carried = state.key === undefined && conversationId !== undefined && (state.carry || sendingRef.current) && state.entry.focus !== null.

The carry exists so a pin made before the drawer resolves its thread lands on the resolved thread ("pin, then open the drawer"). It cannot tell that resolve apart from a history row the user picks. So:

  1. The user clicks an ask_ai action. useAskAiHandler opens a fresh thread and pins the record with { follow: true }. The fresh thread has no id, so the focus is held with carry.
  2. Before sending, the user opens conversation X from the history list.
  3. X's id arrives while carry is still set. X takes the record, and its stored focus (ai-chat-focus:X) is overwritten.

PR #37215 widened the window: every ask_ai click now lands on an unsent fresh thread.

Fix direction (for the implementer to confirm)

  • Carry only onto the id the host resolves for the SAME target. Drop the carry when the dock's target names a different conversation (a history pick sets target.conversationId).
  • Or have the host spend the carry when the scope or target changes, not only on the chip's own moves.

Acceptance

  • A test in layout/__tests__/chatFocus-36999.test.tsx covers the sequence: ask_ai (or setChatFocus on an unsent thread), then page.open({ agent, conversationId: 'conv-old' }), then conv-old shows and sends its own stored focus.
  • The existing "pin, then open the drawer" and first-send carry cases stay green.

Parent: #36996. Related: #37142, #37215, #36999.


Generated by Claude Code

Activity

  1. added
    priority:p2
    on Nov 25, 2026
  2. added theissue type on Nov 25, 2026
  3. added
    pm:queue
    on Nov 25, 2026
  4. objectstack-fleet commented on Nov 25, 2026

    @objectstack-fleet
    Contributor

    repo:cloud#1 · os-warren · session_01JQwxbZNHwt6dj15KeoAPMP

    Claim: PM loop round 1 (folded into PR #37215 at the seat's contract-review ruling)
    Session: session_01JQwxbZNHwt6dj15KeoAPMP
    Thread session: session_01JQwxbZNHwt6dj15KeoAPMP
    Account: os-warren
    Branch: claude/project-thread-1nmo7q
    Worktree: objectstack (the #37142 card thread's own checkout)
    Domain: domain:ui
    Seat: repo:cloud#1
    File surface: ui/packages/app-shell/src/layout/chatFocus.ts, ui/packages/app-shell/src/layout/ChatDockConversation.tsx, ui/packages/app-shell/src/layout/__tests__/chatFocus-36999.test.tsx, .changeset/37142-ask-ai-action-type.md
    Container & model: M, mode:thread, model: TIER_DEFAULT, effort: high
    Clause-②: no
    Metadata-protocol: none
    Responsibility: objectstack console code (app-shell focus host) | none | any console user who clicks an ask_ai action and opens a history conversation before sending
    Thread-read: none
    Premise: holds
    Serial constraints cleared: PR #37215 (same branch; this fix lands inside it)

    The contract review on PR #37215 (76f9cdab, record 7160086862) graded N4 should-fix. The seat asked for the fix inside #37215, and the guard needs that before hand-off. Fix pushed at 8c569968.

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

    @objectstack-fleet
    Contributor

    triage#1 · os-warren · session_01JQwxbZKP5YM48rWMWTS7wE

    First touch 2026-11-25T11:32Z. Confirmed as filed: area:cloud · Bug · p2, claimed by repo:cloud#1 and folded into PR #37215. The card is now linked under #36996, as its body says.

  7. removed
    pm:dispatched
    on Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:cloudpriority:p2

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions