Skip to content

conversation focus: a pinned record in the chat request, shown as a chip, kept across navigation #36999

Description

@os-bob

maintainer · os-bob · session_012dn2AecKpLaYkUtNRiqtby

Filing gate: ③ maintainer-directed. Source: topic #36996.
Grading: area:cloud · Feature · p2 (topic) · reach: n/a (new capability) · evidence: read.

维护者速读

  • 做什么:对话可以「钉」在一条记录上。输入框上方显示这条记录的名字,可以取消;用户翻到别的页面,对话仍然问的是这条记录。
  • 现在:助手只知道「你正在看哪一页」,一翻页就换了对象。
  • 需要你做的:无。

What

  1. Contract: ToolExecutionContext.focus?: { object: string; id: string }[] beside surfaceContext in packages/spec/src/contracts/ai-service.ts. Docblock: client-reported and advisory, never an access decision; the server re-reads the record as the caller; at most one entry in phase 1. The name is focus: scope already means the conversation cache key in useChatConversation.ts.
  2. Console (ui/packages/app-shell/src/console/ai/AiChatPage.tsx and the dock conversation): every turn's request carries context.focus while a focus is pinned. The request body is the authority; anything stored on the conversation only restores the chip.
  3. Chip: the composer slot that draws the page chip today (console.ai.discussing). A pinned focus replaces it, shows the record's display name (resolved client-side as the user), and has a remove control. Opening another record asks once 「改为问《X》?」; a decline is remembered for the conversation.
  4. Capability gate: the pin UI is drawn and focus is sent only when the AI service advertises that it honours focus (one flag on the discovery the console already reads, named in the PR and mirrored by the cloud child). Without the flag nothing changes: a chip the server ignores would mislead.
  5. Entry point in this card: a pin control on the page chip. The drawer entry and the ask_ai action call the same setter when they land.
    UI contract: the spec key in 1; no product-named widget.

Out of scope

What the server does with the focus (cloud child, a row on #36996); more than one record.

Acceptance

  • Tests: a pinned focus is sent on every turn and survives navigation; removal stops it; the first turn of a new conversation carries it; the one-time prompt; no flag ⇒ no chip and no focus key; full-page chat and dock behave the same.
  • API surface baseline regenerated; changeset; all locales.

Blocked-by: none. Same files in flight: #36969 (claim order applies).
Parent: #36996. Reader: domain:ui lane with one spec file.
Dedupe: conversation focus record chat 13 (none on this mechanism) · is:open surfaceContext 1 (seat post only).

Activity

  1. added theissue type on Nov 24, 2026
  2. added
    priority:p2
    on Nov 24, 2026
  3. objectstack-fleet commented on Nov 24, 2026

    @objectstack-fleet
    Contributor

    triage#1 · os-warren · session_01JQwxbZKP5YM48rWMWTS7wE

    Triage: state pm:queue. Grade, area and type stay as the maintainer filed them. The card's Blocked-by: is none. repo:objectstack#1 holds area:cloud.

  4. added
    pm:queue
    on Nov 24, 2026
  5. objectstack-fleet commented on Nov 24, 2026

    @objectstack-fleet
    Contributor

    repo:cloud#1 · os-warren · session_01JQwxbZrXaP3ZXVbM6u2b7S

    Provenance: topic #36996 handed whole to this project by the maintainer (2026-11-24 19:17Z, 「36996 你接手整个专题的任务,现在就开专区派发」), card routed to this seat by the project coordinator.

    Claim: PM loop round 1
    Session: session_01JQwxbZrXaP3ZXVbM6u2b7S
    Account: os-warren
    Branch: claude/issue-36999-conversation-focus
    Worktree: objectstack-issue-36999
    Domain: domain:ui (files) · area:cloud (owner: cloud seat)
    Seat: repo:cloud#1
    File surface: packages/spec/src/contracts/ai-service.ts (the focus key only) and the spec API surface baseline it regenerates; ui/packages/app-shell/src/console/ai/AiChatPage.tsx, ui/packages/app-shell/src/layout/{ChatDock.tsx, ChatDockConversation.tsx, chatSurfaceContext.ts, useConsoleChatDock.tsx} and the AI-capability discovery hook the console already reads; their tests; app-shell / i18n locale strings for the chip and the one-time prompt; one changeset (stop on breach; explain in the report)
    Container & model: M, mode:subagent, model: default (dispatch-gates --tier: "no path-derived mandate"), effort: high
    Clause-②: yes
    Metadata-protocol: none
    Responsibility: n/a — not a defect card
    Thread-read: 7134685877
    Premise: holds (objectstack main e1dee7ae: ToolExecutionContext has surfaceContext and no focus; the page chip is console.ai.discussing in AiChatPage.tsx)
    Serial constraints cleared: #36969 (same files) closed, PR #36989 merged 4c4a6777; sibling #36998 (drawer entry) runs in another thread and will call this card's setter; ADR #36997 records the same focus shape (its item 6) and is being written in parallel

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

    @objectstack-fleet
    Contributor

    repo:cloud#1 · os-warren · session_01JQwxbZrXaP3ZXVbM6u2b7S
    os-dev-report

    {
      "issue": 36999,
      "status": "done",
      "branch": "claude/issue-36999-conversation-focus",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/37123",
      "session": "session_01JQwxbZrXaP3ZXVbM6u2b7S",
      "premise_still_valid": true,
      "summary": "ToolExecutionContext.focus?: {object,id}[] lands beside surfaceContext (packages/spec/src/contracts/ai-service.ts), and the capability flag is capabilities.focus, an optional boolean on the agent catalog row AiAgentCapabilitiesSchema (packages/spec/src/api/protocol.zod.ts, GET /api/v1/ai/agents), read by the console through useAgents (plugin-chatbot AgentCapabilities.focus, never inferred from the agent name); the cloud child mirrors it by serving focus: true. Page and dock share ONE per-turn request builder: both mount ChatPane, whose useObjectChat body.context now spreads buildFocusContext(focus, honoured) (no key at all without a pinned focus or without the flag). Focus state is host-held per conversation (useConversationFocus, carried onto the minted id during render so the first turn carries it; restored per tab from sessionStorage for the chip only; never re-keys the dock thread); the setter for siblings #36998 and the ask_ai card is setChatFocus({object,id}) exported from @object-ui/app-shell (source ui/packages/app-shell/src/layout/chatFocus.ts, chat-code-free), which applies to the chat host on screen or waits for the next one to mount. Mechanism finding: the page chip is drawn by plugin-chatbot ChatbotEnhanced from a text-only prop (outside the claimed surface), so while the flag is on the chip row (page chip + pin, focus chip + remove, the one-time 「改为问《X》?」 offer) is drawn in ChatPane's existing in-flow composer row (promptHeaderSlot) instead of the input frame; without the flag nothing moves.",
      "tests": "head da20d2d1. NEW ui/packages/app-shell/src/layout/__tests__/chatFocus-36999.test.tsx (real ChatDockConversation + real AiChatPage, real ChatPane/useChatConversation/useObjectChat; JSON body of each chat POST): Test Files 1 passed, Tests 11 passed. Affected UI suites (console/ai, layout, plugin-chatbot tests, i18n) at ac2c078b: 430 files passed, 1 failed = de-quote-pairing-3876 census 134->135 for the new de pair; census moved in 6e185ad1, file then 9/9 passed. ui scripts/: 172 passed, 2 skipped. turbo type-check plugin-chatbot+i18n+app-shell (with dep builds): Tasks 71 successful, 71 total. spec typecheck + full spec vitest: Test Files 982 passed, Tests 29839 passed, 1 todo. Ablation 1 (flag check removed in AiChatPage.tsx via scripts/ablation-replace.mjs, anchor 1->0, blob 9e49cac2->cd706fd1): the 2 no-flag cases red; restored blob == HEAD, git diff HEAD empty. Ablation 2 (first-send carry `minted` forced false in chatFocus.ts, blob 9278c7d1->9ba13228): first-turn case red `expected undefined to deeply equal [ { object: 'account', id: 'rec_1' } ]`; restored blob == HEAD.",
      "gates": "local, head da20d2d1: dispatch-gates --commands (repo objectstack-ai/objectstack, merge base 254e396a2, 26 paths) -> 117 families; --ran reconciliation with exit codes: 117 derived, 114 run exit 0, 3 NOT MEASURED exit 3 (prerequisite not met in a partial build): check-plugin-teardown-shape --self-test (shallow clone), spec check:skill-examples (needs client-react dist), check:dual-build-cjs-loads (needs full build). spec check:generated: exit 1 (check:docs stale) -> gen:docs -> committed; other artifacts green. ui check:i18n-keys 0, check:i18n-drift 0, check:i18n-dead-keys 0, check:eager-locale-catalogues 2 = NOT MEASURED (needs console build). CI on PR #37123 at report time: 25 check-runs, all required ones in_progress (Lint * , Type Check *, Governed Surface Queue Guard, Check Changeset, PR-body guards, Spec property liveness) — not awaited per contract.",
      "dogfood_battery": "n/a — no `!` in the PR title and no (narrowing) arm (Clause-②: yes, no arm)",
      "mcp_calls": "0",
      "api_writes": "2 relay dispatches (fleet-write, as objectstack-fleet[bot]): (1) pr_create = POST /repos/objectstack-ai/objectstack/pulls + POST /repos/objectstack-ai/objectstack/issues/37123/assignees (os-warren), read-back identical 10808 bytes; (2) post-stamped os-dev-report = POST /repos/objectstack-ai/objectstack/issues/36999/comments. git push (5) is not REST.",
      "open_questions": [
        {
          "question": "Keep the focus/page chip inside the composer's input frame (where the text-only page chip sits) instead of the in-flow row above the input?",
          "options": [
            "A: follow-up card on @object-ui/plugin-chatbot: a node slot for ChatbotEnhanced's chip (surfaceContextLabel accepts a ReactNode, or a new chip slot) and ChatPane passes ChatFocusRow there; one small component change, outside this claim's file surface",
            "B: keep the in-flow row (promptHeaderSlot) as shipped; the chip sits just above the input frame only where the agent declares capabilities.focus"
          ],
          "recommendation": "A, as a small follow-up: it restores the objectstack#35445 placement (on the input's top edge) for the flag-on case; nothing is user-visible until the cloud child serves the flag, so there is no rush."
        }
      ],
      "security_findings": "none",
      "out_of_scope_findings": [
        "carrier: none · noted, not filed — the exported full-page AiChatPage is no longer routed in the console (every /ai address redirects to the dock filling the window, AiAddressRedirect); observation only, recorded in the PR's Acceptance notes"
      ],
      "deviations": [
        "Commit trailer: the dispatch's model-named co-author trailer was refused by the pre-push check:commit-card-trailers (model-free pair required, os-dev.md / AGENTS.md); commits carry the model-free pair (`Co-authored-by: Claude`, noreply address) + Claude-Session. First commit amended before its first push (unpublished).",
        "PR footer: the os-dev/AGENTS session-URL form `_Generated by [Claude Code](https://claude.ai/code/session_01JQwxbZrXaP3ZXVbM6u2b7S)_` under a rule was used instead of the dispatch's 🤖 line (os-dev.md wins on conflict); the two mandated opening lines are first, then `Fixes #36999`.",
        "File surface: beyond the claim's list — packages/spec/src/api/protocol.zod.ts + spec test ai-agents-envelope.test.ts (authorized by dispatch A2), generated content/docs/references/api/protocol.mdx and packages/spec/authorable-surface/api.json, ui/packages/plugin-chatbot/src/useAgents.ts (+ its test; read as 'the AI-capability discovery hook the console already reads'), two new app-shell files (layout/chatFocus.ts, console/ai/ChatFocusRow.tsx), app-shell index export, i18n de-quote-pairing-3876.test.ts census (+1). ChatDock.tsx, chatSurfaceContext.ts and useConsoleChatDock.tsx needed no change. plugin-chatbot ChatbotEnhanced.tsx NOT edited (stop-on-breach honoured; see open_questions).",
        "Local run: affected UI suites read at ac2c078b, not re-run at da20d2d1 (later commits touched only the re-run de census test and a generated mdx)."
      ],
      "files_changed": [
        ".changeset/36999-conversation-focus.md",
        "content/docs/references/api/protocol.mdx",
        "packages/spec/authorable-surface/api.json",
        "packages/spec/src/api/ai-agents-envelope.test.ts",
        "packages/spec/src/api/protocol.zod.ts",
        "packages/spec/src/contracts/ai-service.ts",
        "ui/packages/app-shell/src/console/ai/AiChatPage.tsx",
        "ui/packages/app-shell/src/console/ai/ChatFocusRow.tsx",
        "ui/packages/app-shell/src/index.ts",
        "ui/packages/app-shell/src/layout/ChatDockConversation.tsx",
        "ui/packages/app-shell/src/layout/__tests__/chatFocus-36999.test.tsx",
        "ui/packages/app-shell/src/layout/chatFocus.ts",
        "ui/packages/i18n/src/__tests__/de-quote-pairing-3876.test.ts",
        "ui/packages/i18n/src/locales/{ar,de,en,es,fr,ja,ko,pt-BR,ru,zh-Hans,zh-Hant}.ts",
        "ui/packages/plugin-chatbot/src/__tests__/agentCapabilities.test.ts",
        "ui/packages/plugin-chatbot/src/useAgents.ts"
      ],
      "line_budget": "n/a — no skills/** in the diff; 26 files, +977/-27 (under the 3000-line human-merge threshold)"
    }
  8. objectstack-fleet commented on Nov 24, 2026

    @objectstack-fleet
    Contributor

    repo:cloud#1 · os-warren · session_01JQwxbZrXaP3ZXVbM6u2b7S
    os-dev-report

    {
      "issue": 36999,
      "status": "done",
      "round": "REWORK round 2 (contract review 7145323961, S1 narrowed)",
      "branch": "claude/issue-36999-conversation-focus",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/37123",
      "head": "f7d9cc141a1d9f5b083fc471490f4ea0125d7190",
      "session": "session_01JQwxbZrXaP3ZXVbM6u2b7S",
      "premise_still_valid": true,
      "summary": "S1 path one (failed create): useConversationFocus now takes the host's createError and spends the send mark when it arrives, and both hosts set the mark only while they have a user to create for; a send made while the host is still resolving keeps its mark, because ensureConversation also returns no id when it only records the request for the resolve to fulfil. S1 path two (unspent hand-off): a chip setFocus to another record, a remove, or a decline now drops carry, so only the setChatFocus hand-off's own focus is carried; pin-then-open-the-drawer is unchanged (pinned by the setter test).",
      "tests": "New: 'a first send whose create fails hands its focus to no conversation opened after it' and 'a chip pin after a setter hand-off is the conversation's own: it does not follow the user into an existing one' (chatFocus-36999.test.tsx). Focus suite 14/14 plus ChatDock.requestContext-30043: 2 files, 21 tests passed. app-shell console/ai + layout: 220 files, 1811 tests passed. turbo type-check app-shell: 69/69 tasks successful. Ablations on the committed fix, each through scripts/ablation-replace.mjs (anchor 1 to 0, blob changed), restore proven by git diff HEAD empty and HEAD blob match: createError effect removed turns exactly the failed-create test red (1 failed, 13 passed); carry kept on chip setFocus turns exactly the hand-off test red (1 failed, 13 passed).",
      "gates": "On f7d9cc14: Check Changeset success; Test UI success (aggregate and all 16 shards).",
      "dogfood_battery": "n/a — no ! in the PR title and no (narrowing) arm",
      "mcp_calls": "0",
      "api_writes": "1 this round: this comment (POST /repos/objectstack-ai/objectstack/issues/36999/comments via the relay). git push is not REST.",
      "security_findings": "none",
      "out_of_scope_findings": []
    }

    Generated by Claude Code

  9. objectstack-fleet commented on Nov 24, 2026

    @objectstack-fleet
    Contributor

    repo:cloud#1 · os-warren · session_01JQwxbZrXaP3ZXVbM6u2b7S

    Maintainer ruling on the chip placement (the open question in the os-dev-report on this card, PR #37123):

    • Who: the maintainer (Warren, os-warren).
    • Words, verbatim: 「先这样上线,也不立卡,我先看效果再说」 ("ship it like this, file no card; I'll look at how it works first").
    • Where: the project thread for this card, 2026-11-24T21:54Z, after screenshots of the flag-on composer.

    Effect: while an agent declares capabilities.focus, the page/focus chip is drawn in the composer's in-flow row above the input (not inside the input frame that item 3 names). This is an accepted deviation from item 3; no follow-up slot card on @object-ui/plugin-chatbot is filed. Recorded in contract review comment 7146371640 on PR #37123.

  10. objectstack-fleet commented on Nov 25, 2026

    @objectstack-fleet
    Contributor

    repo:cloud#1 · os-warren · session_01JQwxbZrXaP3ZXVbM6u2b7S

    ACCEPT → PR #37123 comment 7148048207 (head 47d6faf2; contract review PASS 7146371640). Ready and armed for the merge queue 2026-11-25T00:01Z.

  11. objectstack-fleet commented on Nov 25, 2026

    @objectstack-fleet
    Contributor

    repo:cloud#1 · os-warren · session_01JQwxbZrXaP3ZXVbM6u2b7S

    LANDED · PR #37123 merged as 06c1f545 through the merge queue. A conversation can be pinned to one record: context.focus on every turn, a chip in the composer, shown only where the agent's catalog row declares capabilities.focus: true. No server declares it yet, so nothing changes for users until the cloud child (row 9 on #36996) serves the flag and the cloud pin moves past 06c1f545. Entry-point cards (#36998, the ask_ai row) pin through setChatFocus({ object, id }) from @object-ui/app-shell. Closing state label pm:dispatched removed in this stroke.

  12. 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

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions