Skip to content

AI 对话附文件发送后,用户自己的消息气泡里显示的是给模型看的说明「(Files the user attached (1): image.png — sent as files with this message.)」,看不到附件本身 #39249

Todo

Description

@os-bob

现象

在控制台的 AI 对话里(整页对话和右侧对话面板都一样)附一张图片发送:

  • 用户的消息气泡里出现一行「(Files the user attached (1): image.png — sent as files with this message.)」,中文对话里是「(用户附上了 1 个文件:image.png — 已作为文件随本条消息发送。)」。
  • 气泡里没有图片缩略图,也没有可点开的文件标签。
  • 只发图片、不打字时,气泡里只有这一行说明。

这行字是写给模型的,告诉模型这条消息带了附件。员工看到的是一句不像人话的系统说明,而且看不到自己发了哪张图。

复现步骤

  1. 打开控制台的 AI 对话。
  2. 点「添加附件」,选一张 PNG,可以不打字,直接发送。
  3. 看自己刚发的那条消息气泡。

原因(看过源码)

  • ui/packages/app-shell/src/console/ai/chatAttachments.ts 的 chatAttachmentNotes() 生成这行说明,文字来自 outboundAgentText.ts 的 filesSent。
  • ChatPane.tsx 的 prepareTurn 把说明拼在发给模型的文字后面:text: merged + chatAttachmentNotes(outcome, zh)。同一处还单独留了一份不带说明的 sentText,但只交给了 onSent。
  • 气泡显示的是带说明的 text,附件本身(parts 里的 file part)在气泡里没有显示。

期望

  • 用户气泡里只显示员工自己打的字,不显示给模型的说明。
  • 附件在气泡里显示出来:图片显示缩略图,其他文件显示文件名标签,点开能看。
  • 刷新页面、重新打开历史对话后,显示也一样。
  • 没上传成功、太大、类型不支持的附件,给员工一个看得懂的提示,不要显示写给模型的原文。

环境

  • objectstack b706ec6ed2(cloud a07535698 锁定的版本),单环境 EE
  • 中文对话和英文对话都能复现,只是说明的语言不同

🤖 Generated with Claude Code

Activity

  1. objectstack-fleet commented on Dec 3, 2026

    @objectstack-fleet
    Contributor

    triage@os-warren · os-warren · session_01JQwxbZzZ2f5mzcvJbRrRNZ

    First touch · 2026-12-03T03:16Z

    定级:area:ai · Bug · p2 · AI 对话附文件后,用户自己的气泡显示给模型看的说明,看不到附件本身 · 读码(main 1fe9c62,ChatPane.tsx prepareTurn)

  2. added
    area:ai
    domain:ui
    pm:queue
    priority:p2
    on Dec 3, 2026
  3. objectstack-fleet commented on Dec 3, 2026

    @objectstack-fleet
    Contributor

    repo:objectstack@os-bob · os-bob · session_012dn2AcfwnfHMghyeNLFvob

    Claim: PM loop round 2 · 2026-12-03T04:01Z
    Session: session_012dn2AcfwnfHMghyeNLFvob
    Account: os-bob
    Branch: claude/issue-39249-chat-bubble-attachments
    Worktree: objectstack-issue-39249
    Domain: domain:ui
    Seat: repo:objectstack@os-bob
    File surface: ui/packages/app-shell/src/console/ai/ChatPane.tsx (prepareTurn and the send path: the bubble shows the user's own text), ui/packages/app-shell/src/console/ai/chatAttachments.ts, ui/packages/app-shell/src/console/ai/outboundAgentText.ts, ui/packages/plugin-chatbot/src/ (reason: the user-message bubble that must draw the file parts as a thumbnail or a file chip; the dev names the files), the i18n keys for a user-facing refusal of a failed, too-large or unsupported attachment if none fits (the dev names the file). Not in surface: AppAskPage.tsx (#39239), ui/packages/app-shell/src/hooks/useChatConversation.ts (the reload hydrate; #35081's branch edits it). Stop on breach; explain in the report.
    Container & model: M, mode:subagent, model: default (dispatch-gates --tier: no path-derived mandate), effort: high
    Clause-②: no
    Metadata-protocol: none
    Responsibility: objectstack: ChatPane.tsx prepareTurn returns text = merged + chatAttachmentNotes(...) and the bubble draws that text, not the file parts | none | every console AI chat user who attaches a file, reached today
    Thread-read: 7366396470
    Premise: holds (read on origin/main 1fe9c62, triage knock 7366377102; triage first touch 7366396470)
    Scope of this claim: the live bubble (expected items 1, 2 and 4). Expected item 3 (the same display after a reload or reopening history) is measured, not promised: the cloud conversation store (cloud packages/service-ai/src/chat-files/chat-file-parts.ts, chatFileReferenceLine, cloud c3ed329) stores the user row as the text the client sent plus one line [Attached file "NAME", fileId ID] per attachment, never the file parts. If the reload arm needs the stored row to change, that half is cloud's and this seat routes it; if this card lands only the live half, its PR says Refs #39249 and the card is released with the remainder named.
    Serial constraints cleared: #35081 (claim 7362955565, repo:cloud@zhuangjianguo) claims the whole ui/packages/app-shell/src/console/ai/ directory; its branch claude/issue-35081-ai-history-app at 0363607a touches none of this surface's files (it touches ConversationsSidebar.tsx, useChatConversation.ts, the chat dock). #39239 (this seat, in flight) is fenced out of ChatPane.tsx and chatAttachments.ts. Fold with #39239: no (a different defect).

  4. added
    pm:dispatched
    and removed
    pm:queue
    on Dec 3, 2026
  5. objectstack-fleet commented on Dec 3, 2026

    @objectstack-fleet
    Contributor

    repo:objectstack@os-bob · os-bob · session_012dn2AcfwnfHMghyeNLFvob
    os-dev-report

    {
      "issue": 39249,
      "status": "blocked",
      "branch": "claude/issue-39249-chat-bubble-attachments",
      "pr": null,
      "session": "session_012dn2AcfwnfHMghyeNLFvob",
      "premise_still_valid": true,
      "summary": "Implemented on origin/claude/issue-39249-chat-bubble-attachments at 013aa1c4c (base origin/main 0c5ef9721), no PR opened. The user turn now carries the person's words as its text part, the stored files as file parts, the model-only text (sheet brief, not-sent lines) as a separate text part marked providerMetadata.objectstack.modelNote, and a data-local-attachments part; the mapper drops the marked part from the bubble's content and lifts attachments/localAttachments; a new bubble component draws an image as a thumbnail and any other stored file as a chip, each a link to the stored file, and names files not sent with one readable sentence per reason (reusing chatbot.composer.fileTooLarge and fields.file.typeNotAccepted, adding chatbot.attachment.uploadFailed and chatbot.attachment.notRead in all 11 packs). The 'sent as files' note is gone: measured on cloud c3ed329 (chat-file-parts.ts chatFileReferenceLine, chat-file-turn.ts statusText) the server names every file part to the model itself; refused files and sheets never reach the server, so their lines stay in the model note. BLOCKED by the seat notice that arrived mid-run: the bubble renderer is ChatbotEnhanced.tsx renderMessage (user branch), now fenced for sibling PR 39257. My branch already carries an 11-line hunk there (one import, one UserAttachments block above the user text), pushed in f8aa265e4 before the notice; overlap-check --pr=39257 reads 'merges cleanly'. Without that hunk items 2 and 4 are not drawn and refused files would vanish from the bubble (worse than today), so I stopped rather than open a PR. Ruling needed: authorize the hunk (then PR as is, Refs 39249 since item 3 is out of reach), or hold this branch until 39257 lands and rebase. Card assignee not touched.",
      "tests": "At 013aa1c4c: vitest packages/plugin-chatbot/ packages/i18n/ packages/app-shell/src/console/ai/ -> Test Files 240 passed (240), Tests 3008 passed | 13 skipped (3021), lock VERDICT command-exit 0. New files: plugin-chatbot ChatbotEnhanced.userAttachments-39249.test.tsx (parts order/mark, image+no words -> thumbnail href and no note, text+PDF -> chip href, refused -> chips + sentences and none of the model wording, control), app-shell AiChatPage.bubbleAttachments-39249.test.tsx (real ChatPane/useObjectChat: image-only turn sends exactly one file part and no text; text+PDF text part is the words; refused files' not-read lines ride the marked note while the bubble message gets words + localAttachments; sheet brief in the note; control). Updated pins made false by the change: 34461 (sent-as-files lines now asserted absent; words-less zh turn uses an over-cap file) and 32749 (turn text toBe the words). Ablation (source-resolved, no dist): ablation-replace on mapMessages.ts anchor \"p.type === 'text' && !isModelNotePart(p)\" -> \"p.type === 'text' && true\": 4 failed | 8 passed (the 4 bubble/note assertions), restored blob == HEAD b9eba45c9101, git diff HEAD empty; a first attempt was a no-op refused by the tool (replacement substring already counted) and ran no test.",
      "gates": "Type-check: turbo type-check @object-ui/plugin-chatbot + @object-ui/i18n -> 55/55 successful (lock exit 0); @object-ui/app-shell -> 73/73 successful (exit 0, after one fix of a union type in ChatPane). Derived local families (dispatch-gates --commands at 013aa1c4c, 41): 39 run exit 0 each (captured per command before any pipe); NOT-MEASURED 2: pnpm check:query-options-erasure (exit 124, killed by my 240 s per-command timeout), pnpm --dir ui exec vitest run scripts/ (not run). --ran reconciliation: 41 accounted, 39 run, 2 NOT-MEASURED. overlap-check: origin/main clean, 39257 clean, 39063 clean. CI check-runs: none (no PR).",
      "mcp_calls": "0",
      "api_writes": "1 — POST /repos/objectstack-ai/objectstack/issues/39249/comments (this os-dev-report, via post-stamped.mjs); git push x3 not counted",
      "classifier_refusals": [],
      "open_questions": [
        {
          "question": "The bubble renderer lives in ChatbotEnhanced.tsx, which the mid-run seat notice fenced for PR 39257. May this branch keep its 11-line hunk there (import + UserAttachments block in the user branch of renderMessage), which merges cleanly with 39257?",
          "options": [
            "A: authorize the hunk; dev opens the draft PR now with Refs 39249",
            "B: hold until 39257 lands, then merge origin/main and open the PR",
            "C: split: land everything except the render hunk now"
          ],
          "recommendation": "A, because the hunk is additive, merges cleanly with 39257 per overlap-check, and C would ship a bubble where refused files silently vanish, a regression against today"
        }
      ],
      "security_findings": "none",
      "out_of_scope_findings": [
        "carrier: cloud · item 3 (same display after reload) is not reachable inside this surface: the stored user row is the text parts joined (now the words plus the marked model note) plus one [Attached file NAME, fileId ID] line per file, and the file parts are not kept; a reload therefore shows the note and the reference lines as text. Needed server side: store the words apart from the part marked providerMetadata.objectstack.modelNote and keep each file's fileId, filename, mediaType and governed url structured on the row; needed client side: the hydrate (useChatConversation.ts, card 35081's surface) rebuilds file parts from those fields, after which this branch's mapper and bubble draw them unchanged · dedupe words: chat reload attachments, stored user row, reference line, model note, hydrate file parts"
      ],
      "line_budget": "1090 changed lines (+1009 / -81) over 27 files vs the 3000 human-merge threshold: under; ChatPane.tsx 1000 -> 1016 lines (change kept inside prepareTurn/doSend and the import list)",
      "deviations": [
        "ChatbotEnhanced.tsx edited (commit f8aa265e4, pushed before the seat notice fencing it); left on the branch, no PR opened",
        "Existing tests AiChatPage.attachmentNotesLanguage-34461 and AiChatPage.attachmentsUpload-32749 edited: their sent-as-files pins became false by design",
        "Built the objectstack closure of app-shell (turbo, 46 tasks) and spec to run ui tests locally",
        "First ablation attempt was a no-op refused by ablation-replace; re-run with a distinct replacement"
      ],
      "files_changed": 27
    }
  6. objectstack-fleet commented on Dec 3, 2026

    @objectstack-fleet
    Contributor

    repo:objectstack@os-bob · os-bob · session_012dn2AcfwnfHMghyeNLFvob
    os-dev-report

    {
      "issue": 39249,
      "status": "done",
      "branch": "claude/issue-39249-chat-bubble-attachments",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/39263",
      "session": "session_012dn2AcfwnfHMghyeNLFvob",
      "premise_still_valid": true,
      "summary": "Draft PR 39263 (Part of 39249) at head 013aa1c4c on claude/issue-39249-chat-bubble-attachments, base origin/main 0c5ef9721; overlap-check against origin/main 93e035410 is clean. Expected items 1, 2 and 4 are met in the live bubble. The user turn carries the person's words as its text part, the stored files as file parts, the model-only text (sheet brief and not-sent lines) as a separate text part marked providerMetadata.objectstack.modelNote, and a data-local-attachments part. The mapper keeps the marked part out of the bubble's content. The new UserAttachments bubble draws an image as a thumbnail and any other stored file as a chip, each linking to the stored file, and names refused files with one readable sentence per reason. Two keys are new in all 11 language packs. Model-facing change: the 'sent as files' lines are gone, because the server already names each stored file part (cloud chatFileReferenceLine, measured at c3ed329). Refused files and spreadsheets still reach the model through the marked note. Item 3 (reload) is measured and is the remainder: server half for cloud, hydrate half for useChatConversation.ts, the 35081 surface. The seat ruled option A, so the 11-line ChatbotEnhanced.tsx hunk is kept, and nothing else in that file is touched. PR 39257 was still queued (open, not merged, head 6d72c69) when this PR opened, so no merge of origin/main was needed; the PR body says so. Card assignee not touched; PR assignee is os-bob (claim Account). Worktree /home/user/objectstack-issue-39249 is kept until the seat's L1 review.",
      "tests": "At 013aa1c4c: vitest packages/plugin-chatbot/ packages/i18n/ packages/app-shell/src/console/ai/ -> Test Files 240 passed (240), Tests 3008 passed | 13 skipped (3021), lock VERDICT command-exit 0. New files: plugin-chatbot ChatbotEnhanced.userAttachments-39249.test.tsx (parts order/mark, image+no words -> thumbnail href and no note, text+PDF -> chip href, refused -> chips + sentences and none of the model wording, control), app-shell AiChatPage.bubbleAttachments-39249.test.tsx (real ChatPane/useObjectChat: image-only turn sends exactly one file part and no text; text+PDF text part is the words; refused files' not-read lines ride the marked note while the bubble message gets words + localAttachments; sheet brief in the note; control). Updated pins made false by the change: 34461 (sent-as-files lines now asserted absent; words-less zh turn uses an over-cap file) and 32749 (turn text toBe the words). Ablation (source-resolved, no dist): ablation-replace on mapMessages.ts anchor \"p.type === 'text' && !isModelNotePart(p)\" -> \"p.type === 'text' && true\": 4 failed | 8 passed (the 4 bubble/note assertions), restored blob == HEAD b9eba45c9101, git diff HEAD empty; a first attempt was a no-op refused by the tool (replacement substring already counted) and ran no test.",
      "gates": "Type-check: turbo type-check @object-ui/plugin-chatbot + @object-ui/i18n -> 55/55 successful (lock exit 0); @object-ui/app-shell -> 73/73 successful (exit 0, after one fix of a union type in ChatPane). Derived local families (dispatch-gates --commands at 013aa1c4c, 41): 39 run exit 0 each (captured per command before any pipe); NOT-MEASURED 2: pnpm check:query-options-erasure (exit 124, killed by my 240 s per-command timeout), pnpm --dir ui exec vitest run scripts/ (not run). --ran reconciliation: 41 accounted, 39 run, 2 NOT-MEASURED. overlap-check: origin/main clean, 39257 clean, 39063 clean. CI check-runs on PR 39263: not yet concluded when reported; left to the seat per the dispatch contract. overlap-check re-run at PR open: origin/main 93e035410 clean, 39257 (head 6d72c69) clean, 39063 clean.",
      "mcp_calls": "0",
      "api_writes": "3 — POST /repos/objectstack-ai/objectstack/issues/39249/comments (first os-dev-report, comment 7368326659); POST /repos/objectstack-ai/objectstack/pulls plus POST /repos/objectstack-ai/objectstack/issues/39263/assignees (one relay pr_create action, run 47040024115, body read back identical at 8512 bytes, assignee os-bob); POST /repos/objectstack-ai/objectstack/issues/39249/comments (this report). Relay writes only; git push x3 not counted.",
      "classifier_refusals": [],
      "open_questions": [],
      "security_findings": "none",
      "out_of_scope_findings": [
        "carrier: cloud · item 3 (same display after reload) is not reachable inside this surface: the stored user row is the text parts joined (now the words plus the marked model note) plus one [Attached file NAME, fileId ID] line per file, and the file parts are not kept; a reload therefore shows the note and the reference lines as text. Needed server side: store the words apart from the part marked providerMetadata.objectstack.modelNote and keep each file's fileId, filename, mediaType and governed url structured on the row; needed client side: the hydrate (useChatConversation.ts, card 35081's surface) rebuilds file parts from those fields, after which this branch's mapper and bubble draw them unchanged · dedupe words: chat reload attachments, stored user row, reference line, model note, hydrate file parts"
      ],
      "line_budget": "1090 changed lines (+1009 / -81) over 27 files vs the 3000 human-merge threshold: under; ChatPane.tsx 1000 -> 1016 lines (change kept inside prepareTurn/doSend and the import list)",
      "deviations": [
        "Existing tests AiChatPage.attachmentNotesLanguage-34461 and AiChatPage.attachmentsUpload-32749 edited: their sent-as-files pins became false by design",
        "Built the objectstack closure of app-shell (turbo, 46 tasks) and spec to run ui tests locally",
        "First ablation attempt was a no-op refused by ablation-replace; re-run with a distinct replacement",
        "ChatbotEnhanced.tsx hunk kept under the seat ruling (option A); it was pushed in f8aa265e4 before the fence notice"
      ],
      "files_changed": 27,
      "head_sha": "013aa1c4cb612d2b5b0094791cf7389a226b7c69"
    }
  7. objectstack-fleet commented on Dec 3, 2026

    @objectstack-fleet
    Contributor

    repo:objectstack@os-bob · os-bob · session_012dn2AcfwnfHMghyeNLFvob
    os-dev-report

    {
      "issue": 39249,
      "status": "done",
      "branch": "claude/issue-39249-chat-bubble-attachments",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/39263",
      "session": "session_012dn2AcfwnfHMghyeNLFvob",
      "premise_still_valid": true,
      "summary": "REWORK 1 done at head 8a96d7a77 on PR 39263, pushed with no force; 39257 is still unmerged, so no merge of origin/main was needed, and overlap-check reads clean. (1) extractFileAttachments now reads a file part only when it is a stored chat attachment: providerMetadata.objectstack.fileId must be a non-blank string (as in cloud chatFileRefsOf). Its url must be a same-origin path ('/' but not '//' or a slash-backslash prefix) or an http:/https: URL; data:, blob:, javascript:, other schemes and bare relative paths are skipped. (2) The two stray lines in storedAnswerData are removed. They were never meant to be there: my scripted edit replaced an anchor that also matched in storedAnswerData, and the stored-answer path is not in scope. PR body not edited: os-dev.md lets a subagent write the PR body only at pr_create, so the seat adds the new Tests line. That definition outranks the order that allowed the edit. Suggested line for the Tests section: 'Same file, new describe: only a stored chat attachment with a drawable address is drawn. A file part without objectstack.fileId, or whose url is data:, blob:, javascript:, protocol-relative (// or slash-backslash), another scheme or a bare relative path, draws nothing; a same-origin path and an https url do (control).'",
      "tests": "At 8a96d7a77: vitest packages/plugin-chatbot/ packages/app-shell/src/console/ai/ -> Test Files 130 passed (130), Tests 1143 passed (1143), lock VERDICT command-exit 0. ChatbotEnhanced.userAttachments-39249.test.tsx alone -> Tests 16 passed (16): 7 earlier plus 9 new (no fileId; 7 url schemes via it.each; control). Earlier at 013aa1c4c the same suites plus packages/i18n/ gave 240 files, 3008 passed and 13 skipped; i18n is untouched by this rework.",
      "gates": "At 8a96d7a77: turbo type-check @object-ui/plugin-chatbot + @object-ui/app-shell -> Tasks 74 successful, 74 total (lock exit 0). overlap-check: VERDICT clean (origin/main and open PRs). The derived gate families from 013aa1c4c are unchanged by this rework: 39 ran with exit 0 and 2 were NOT-MEASURED (check:query-options-erasure timeout, ui vitest scripts/). CI check-runs on the new head were not concluded when I reported.",
      "mcp_calls": "0",
      "api_writes": "4 — POST /repos/objectstack-ai/objectstack/issues/39249/comments (first os-dev-report, comment 7368326659); POST /repos/objectstack-ai/objectstack/pulls plus POST /repos/objectstack-ai/objectstack/issues/39263/assignees (one relay pr_create action, run 47040024115, body read back identical at 8512 bytes, assignee os-bob); POST /repos/objectstack-ai/objectstack/issues/39249/comments (second report, 7368391323); POST /repos/objectstack-ai/objectstack/issues/39249/comments (this rework report). Relay writes only; git push x3 not counted.",
      "classifier_refusals": [],
      "open_questions": [],
      "security_findings": "none",
      "out_of_scope_findings": [
        "carrier: cloud · item 3 (same display after reload) is not reachable inside this surface: the stored user row is the text parts joined (now the words plus the marked model note) plus one [Attached file NAME, fileId ID] line per file, and the file parts are not kept; a reload therefore shows the note and the reference lines as text. Needed server side: store the words apart from the part marked providerMetadata.objectstack.modelNote and keep each file's fileId, filename, mediaType and governed url structured on the row; needed client side: the hydrate (useChatConversation.ts, card 35081's surface) rebuilds file parts from those fields, after which this branch's mapper and bubble draw them unchanged · dedupe words: chat reload attachments, stored user row, reference line, model note, hydrate file parts"
      ],
      "line_budget": "1090 changed lines (+1009 / -81) over 27 files vs the 3000 human-merge threshold: under; ChatPane.tsx 1000 -> 1016 lines (change kept inside prepareTurn/doSend and the import list)",
      "deviations": [
        "Existing tests AiChatPage.attachmentNotesLanguage-34461 and AiChatPage.attachmentsUpload-32749 edited: their sent-as-files pins became false by design",
        "Built the objectstack closure of app-shell (turbo, 46 tasks) and spec to run ui tests locally",
        "First ablation attempt was a no-op refused by ablation-replace; re-run with a distinct replacement",
        "ChatbotEnhanced.tsx hunk kept under the seat ruling (option A); it was pushed in f8aa265e4 before the fence notice",
        "PR body not edited for the new pin: os-dev.md lets a subagent write the PR body only at pr_create, so the seat applies the suggested Tests line from summary"
      ],
      "files_changed": 27,
      "head_sha": "8a96d7a77"
    }
  8. objectstack-fleet commented on Dec 3, 2026

    @objectstack-fleet
    Contributor

    repo:objectstack@os-bob · os-bob · session_012dn2AcfwnfHMghyeNLFvob

    Release: session session_012dn2AcfwnfHMghyeNLFvob — partial landing; 去向 pm:blocked.
    Blocked-by: objectstack-ai/cloud#5401

    Landed: PR #39263 (Part of #39249, merged) delivers items 1 and 2: the person's own bubble draws their words, a thumbnail or chip per stored file, and a readable line per file not sent; the model note no longer shows.
    Remaining: item 3, the same display after a reload. The stored user row keeps no file parts, so the reload needs both halves: the server half is objectstack-ai/cloud#5401 (store the words apart from the model note and keep fileId, filename, media type and url structured on the row); the console half rebuilds the file parts from those fields in ui/packages/app-shell/src/hooks/useChatConversation.ts, today inside #35081's claimed surface. When cloud#5401 is installable the card returns to pm:queue; the claim then re-runs the overlap check against #35081.

  9. added
    pm:blocked
    and removed
    pm:dispatched
    on Dec 3, 2026
  10. os-bob commented on Dec 3, 2026

    @os-bob
    ContributorAuthor

    Claim: implementing the remaining reload half (item 3) now that cloud#5401 has landed (cloud#5422)
    Account: os-bob
    Branch: fix/39249-reload-user-turn-parts

  11. removed
    pm:blocked
    on Dec 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:aidomain:uipriority:p2

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions