Skip to content

[bugfix] assistant: truncate long reference names in sent bubbles (#348) - #376

Open
Birfy wants to merge 2 commits into
ThinkFlowLab:mainfrom
Birfy:fix/348-long-reference-name-overflow
Open

Birfy wants to merge 2 commits into
ThinkFlowLab:mainfrom
Birfy:fix/348-long-reference-name-overflow

Conversation

@Birfy

@Birfy Birfy commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Sent user-message bubbles did not apply the composer chip's .cw-chat-reference-label truncation, so a long asset name wrapped inside a fixed 1.5em chip and spilled onto the next line and the attachment toggle.

  • Sent bubbles now use the same label class as the composer, with a hover title and the existing assistant.reference.chip accessible name.
  • .cw-chat-reference also sets overflow: hidden so a missing label class cannot leak text again.
  • A new gate browser fixture renders the real chip in dark/light themes, zh-CN/en-US, and 420/280px sidebars.

Linked issue

  • Fixes #348

Labels

  • type:bug, area:agent

Change

The composer already created a .cw-chat-reference-label (min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap). AssistantPanel rendered <span>{part.name}</span> without that class. Combined with white-space: pre-wrap on the bubble text and a chip height of 1.5em with no clipping, an 84-character Chinese name wrapped and covered adjacent content — matching the report on #348.

ChatReferenceChip is the sent-bubble path. Display names still go through assetDisplayName (same as the composer; it only strips a repeated extension). No new copy was added. Short names, icon-only chips, and composer truncation are unchanged.

Test plan

Local

Linux, Node 24.22.1, Chromium 1248, Vite http://127.0.0.1:5579. Isolated fixture only; no user project and no provider credentials.

  • The new check fails on the pre-fix markup (label white-space: pre-wrap, 6 overflow rects, overlapToggle: 1094 with the「收起素材」row, empty title).
  • After the fix it passes. Five consecutive runs: 5/5 passed.
    • PLAYWRIGHT_MODULE=... CHROMIUM_PATH=... BROWSER=chromium CREATION_WEB_URL=http://127.0.0.1:5579 node tests/browser/assistant_reference_overflow.mjs
  • The fixture covers: the 84-character Chinese name from [bug] agent: 长素材名在对话气泡中溢出,遮挡正文与素材栏 #348, a long English name, a short name that must not ellipsize, an icon-only chip, composer-chip regression, zh-CN/en-US, dark/light, 420px and 280px panel widths.
  • tests/browser/assistant_activity.mjs (same Vite fixture style) passed.
  • npx tsc --noEmit passed.
  • npm run check:i18n — 3033 keys, 0 problems.
  • npm run check:browser-manifest — 80 entries, gate=24.
  • npm test — 831 passed, 1 failed: tests/browserHost.test.ts ("installed server env removes source imports…") expects shutil.which('node') to be null when PATH is only dirname(process.execPath), but this box still finds /usr/bin/node. The test file is unchanged from main (729b49bc); not caused by this PR.
  • npm run build (tsc --noEmit && vite build) passed.

Left to CI

Release checks (static, python, frontend, browser isolated/voice/assistant). The new script is in the gate lane of tests/browser/manifest.json and scripts/run-browser-suite.mjs. It needs the Vite dev server (not vite preview).

Evidence that it works

  • Media attached, or N/A because: verified in Chromium against the real ChatReferenceChip fixture (screenshots below). The issue's original overlap screenshot is the before; after the fix the long name stays on one line with an ellipsis, and「收起素材」/ following text stay unobstructed in dark 420px, dark 280px, and light 420px. Hover title is asserted in the test; the native tooltip does not always paint in headless screenshots.

Provider verification

  • Real-provider calls are described honestly, or none were made

No live or paid provider calls. The fixture mounts production UI components through Vite with in-memory names only.

Bilingual UI

  • Both locales are updated, or no user-facing copy changed

No new strings. The chip reuses assistant.reference.chip. The browser check runs zh-CN and en-US.

Not verified / out of scope

  • I did not re-run this in a full workspace session against a real project or a live assistant turn (the isolated fixture uses the same chip AssistantPanel now renders).
  • I did not run the Python suite; this change is frontend-only.
  • Firefox / WebKit / Windows / macOS browsers were not run here.

…inkFlowLab#348)

Sent user bubbles rendered the asset name without the composer chip's
.cw-chat-reference-label class, so long names wrapped and leaked out of
the fixed-height chip onto the next line and the attachment toggle.
@github-actions github-actions Bot added area:agent Agent runtime, assistant chat and tools type:bug Something is broken labels Nov 17, 2026
@github-actions
github-actions Bot requested review from FayeSpica and wuzhf9 November 17, 2026 01:00
check:browser-locale treats the script as English because it does not
select Chinese Playwright UI text. The fixture still switches zh-CN and
en-US itself via setActiveLocale.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:agent Agent runtime, assistant chat and tools type:bug Something is broken

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant