Skip to content

fix(ui): show original filename on chat history attachment cards instead of managed UUID suffix - #118628

Merged
steipete merged 4 commits into
openclaw:mainfrom
ml12580:fix/issue-118621
Aug 3, 2026
Merged

steipete merged 4 commits into
openclaw:mainfrom
ml12580:fix/issue-118621

Conversation

@ml12580

@ml12580 ml12580 commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

[AI-assisted] This PR was generated using Claude Code.

What Problem This Solves

Fixes an issue where users viewing uploaded files in the Control UI chat history would see collision-safe managed storage basenames (such as report---43007e90-2ade-43f2-a781-42b843e9eca3.pdf) as the attachment card label instead of the original upload filename (report.pdf). The canonical transcript already persists an authoritative __openclaw.media[].fileName, but the history-media projection dropped it before rendering, so the card fell back to the managed URI basename with its UUID suffix exposed.

Closes #118621

Why This Change Was Made

Carry the optional canonical fileName through readTranscriptMediaEntries() and prefer it for the attachment label in extractTranscriptAttachments(). For older transcript records that lack a persisted fileName, apply a narrowly scoped UUID-suffix restoration only to media://inbound/ paths, removing only the terminal ---<uuid> storage segment (the generated suffix the store appends immediately before the extension) so an original filename that itself contains a ---<uuid>-shaped part is preserved. This is a UI projection-only repair: stored files, managed URIs, transcript identity, provider input, and attachment resolution are all left unchanged.

User Impact

Users viewing uploaded documents (PDF/DOCX/PPTX/XLSX/TXT/etc.) in Control UI chat history now see the familiar original filename on each attachment card instead of an internal collision-safe identifier. Normal upload, storage, and retrieval behavior is unchanged; only the displayed label improves. Legacy transcripts without a persisted original name also get the managed UUID suffix removed from media://inbound/ labels.

Evidence

  • Repro environment (os): Windows 10 / PowerShell
  • Repro steps (commands): pnpm exec tsx scripts/proof-attachment-uuid-label.mjs (loads production UI projection code extractTranscriptAttachments / readTranscriptMediaEntries and renders attachment labels from canonical persisted __openclaw.media facts)
  • Expected (after fix): attachment card label is the original filename (report.pdf, openclaw-attachment-test.docx); managed UUID suffix is not shown
  • Actual (before fix): attachment card label is the managed storage basename with UUID suffix (report---<uuid>.pdf, openclaw-attachment-test---<uuid>.docx)
  • Evidence type (real): production-path terminal output

Base commit (main): 8d1fe4f0910; fix commits: 2bdb636065d (carry fileName + strip terminal UUID), c78c131acf9 (anchor UUID removal to the terminal storage suffix per review, plus regression case)

Before fix (main db7c48478f8, predates the fix):

# Issue #118621 attachment card label proof
# commit: db7c48478f8

## modern record with persisted fileName (pdf)
  persisted fileName: undefined
  stored path:       media://inbound/report---43007e90-2ade-43f2-a781-42b843e9eca3.pdf
  rendered label:    "report---43007e90-2ade-43f2-a781-42b843e9eca3.pdf"

## legacy record without fileName, managed inbound docx
  persisted fileName: undefined
  stored path:       media://inbound/openclaw-attachment-test---43007e90-2ade-43f2-a781-42b843e9eca3.docx
  rendered label:    "openclaw-attachment-test---43007e90-2ade-43f2-a781-42b843e9eca3.docx"

After fix (c78c131acf9, rebased onto 8d1fe4f0910):

# Issue #118621 attachment card label proof
# commit: c78c131acf9

## modern record with persisted fileName (pdf)
  persisted fileName: "report.pdf"
  stored path:       media://inbound/report---43007e90-2ade-43f2-a781-42b843e9eca3.pdf
  rendered label:    "report.pdf"

## legacy record without fileName, managed inbound docx
  persisted fileName: undefined
  stored path:       media://inbound/openclaw-attachment-test---43007e90-2ade-43f2-a781-42b843e9eca3.docx
  rendered label:    "openclaw-attachment-test.docx"

## legacy record, original name contains a uuid-shaped segment before terminal managed suffix
  persisted fileName: undefined
  stored path:       media://inbound/report---a1b2c3d4-e5f6-7890-abcd-ef1234567890-final---43007e90-2ade-43f2-a781-42b843e9eca3.docx
  rendered label:    "report---a1b2c3d4-e5f6-7890-abcd-ef1234567890-final.docx"

Non-regression (unchanged on purpose, no false positives): https://example.com/files/...---old.docx stays ...---old.docx (not a managed inbound UUID), and media://inbound/plain-name.docx stays plain-name.docx (no UUID to strip).

The terminal-suffix anchor ((?=\.[^/]*$|$)) removes only the final generated ---<uuid> segment immediately before the extension or end of basename, so a legacy original name that itself contains a ---<uuid>-shaped part (as in the last case above) is preserved while the managed storage suffix is still hidden.

  • pnpm exec vitest run src/pages/chat/chat-history.media.test.ts - 11/11 passed (6 regression assertions including the terminal-suffix preservation case; the fix-asserting ones fail on unfixed main, pass after the fix)
  • pnpm exec vitest run src/pages/chat/components/chat-message.test.ts - 159/159 passed
  • pnpm exec oxfmt --check (changed files) - passed
  • pnpm tsgo:ui - passed
  • pnpm exec oxlint (changed files) - passed

AI-assisted: Codex

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui size: S triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. and removed triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. labels Aug 3, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. P2 Normal backlog priority with limited blast radius. labels Aug 3, 2026
@clawsweeper

clawsweeper Bot commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 3, 2026, 9:03 AM ET / 13:03 UTC.

ClawSweeper review

What this changes

The PR preserves canonical original filenames in Control UI chat-history attachment cards and restores legacy inbound labels by removing only the terminal managed UUID suffix.

Merge readiness

⚠️ Ready for maintainer review - 1 item remains

Keep this active PR open for normal maintainer merge review. It fixes the linked current behavior at the correct UI projection boundary, has sufficient production-path terminal proof and focused regression coverage, and no actionable patch defect was found; wait for the exact-head required checks to finish successfully before merging.

Priority: P2
Reviewed head: 2137dcdf35b273092c5a8189db5c4fe0720866c5

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch is focused, owner-boundary-correct, and supported by direct behavior proof; it is ready for normal merge once exact-head CI completes.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The PR body includes before/after terminal output from the production projection path and focused after-fix regression results; it directly demonstrates the visible label improvement.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The PR body includes before/after terminal output from the production projection path and focused after-fix regression results; it directly demonstrates the visible label improvement.
Evidence reviewed 7 items Canonical media contract: The shared persisted MediaFact schema includes optional fileName, making it the authoritative label source when present.
Current-main projection gap: The checked-out main baseline reads canonical media facts but returns only path and media type, dropping fileName before the attachment renderer can use it.
PR repair preserves the correct owner boundary: The PR head carries fileName through the UI projection and uses it only as the attachment label, leaving the managed URI unchanged.
Findings None None.
Security None None.

How this fits together

Persisted transcript media facts feed the Control UI chat-history projection, which creates visible cards for non-image attachments. The card label is presentation only; the managed media URI remains the identity used for storage and retrieval.

flowchart LR
A[Uploaded file] --> B[Persisted transcript media facts]
B --> C[History media projection]
C --> D[Label preference and legacy fallback]
D --> E[Attachment card]
E --> F[Control UI chat history]
Loading

Before merge

  • Resolve merge risk (P1) - GitHub reports the branch as mergeable but still has required checks in progress for the exact head; merge only after the final merge result and required checks are successful.
Agent review details

Security

None.

PR surface

Source +16, Tests +110. Total +126 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 2 19 3 +16
Tests 1 111 1 +110
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 130 4 +126

Review metrics

Metric Value Why it matters
Production vs test delta production +16 net, tests +110 net The modest production growth establishes the canonical filename projection and bounded legacy fallback; the larger test delta covers the naming-contract edge cases.

Stored data model

Persistent data-model change detected: serialized state: ui/src/pages/chat/chat-history.media.test.ts. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #118621
Summary: This PR is the concrete candidate fix for the linked Control UI attachment-label bug.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Land this focused projection repair after exact-head CI passes, retaining canonical fileName as the preferred label and the managed URI as the unchanged storage identity.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Land this focused projection repair after exact-head CI passes, retaining canonical fileName as the preferred label and the managed URI as the unchanged storage identity.

Do we have a high-confidence way to reproduce the issue?

Yes. The checked-out main source drops canonical fileName from the history-media projection, and the PR supplies before/after production-path terminal output plus focused coverage for the affected label derivation.

Is this the best way to solve the issue?

Yes. The PR fixes the presentation owner rather than renaming stored files or changing URI resolution, and its legacy fallback is constrained to the managed inbound naming contract.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against baeaca2ad4c1.

Labels

Label justifications:

  • P2: This repairs a bounded but user-visible Control UI attachment-label defect without affecting storage or message delivery.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body includes before/after terminal output from the production projection path and focused after-fix regression results; it directly demonstrates the visible label improvement.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes before/after terminal output from the production projection path and focused after-fix regression results; it directly demonstrates the visible label improvement.

Evidence

What I checked:

Likely related people:

  • joshavant: Current-main blame and feature history attribute the transcript-media projection and attachment label fallback to this area’s introducing commit. (role: current implementation author; confidence: high; commits: 0c9da8c40080; files: ui/src/lib/chat/message-extract.ts, ui/src/pages/chat/components/chat-message-media.ts)
  • steipete: A follow-up commit on the PR branch specifically refined preservation of dotted UUID-shaped attachment names. (role: recent area contributor; confidence: medium; commits: 2148a386e966; files: ui/src/pages/chat/components/chat-message-media.ts, ui/src/pages/chat/chat-history.media.test.ts)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (3 earlier review cycles)
  • reviewed 2026-08-03T11:04:38.339Z sha 9ba757ef4ff132f97548de6080fc8b103e86426f :: needs changes before merge. :: [P2] Anchor the legacy UUID removal to the stored suffix
  • reviewed 2026-08-03T11:23:52.096Z sha a1814ea4f59aeeb4109e1896bc417f436ec9f3ce :: needs maintainer review before merge. :: none
  • reviewed 2026-08-03T11:38:52.413Z sha c78c131 :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 3, 2026
@steipete
steipete merged commit 1acc64b into openclaw:main Aug 3, 2026
96 checks passed
@steipete

steipete commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Merged via squash.

vincentkoc added a commit that referenced this pull request Aug 3, 2026
* origin/main: (57 commits)
  fix(media): fall back when providers return empty output (#118660)
  fix(nextcloud-talk): allow bounded parallel room deliveries (#118692)
  test(state): reuse current agent database fixture (#118677)
  fix(scripts): bound check-file-utils git lookup (#111582)
  fix(slack): scope interactive conversation bindings safely (#118662)
  fix(agents): avoid false compaction after mid-turn precheck (#117963)
  fix(ui): show original filename on chat history attachment cards instead of managed UUID suffix (#118628)
  fix(whatsapp): preserve terminal retry exhaustion lifecycle (#118659)
  fix(doctor): audit every agent workspace (#111840)
  fix(release): skip unavailable Buzz on frozen candidates (#118670)
  fix(ui): surface onboarding and pairing clipboard failures (#118651)
  fix(config): stop plugin schemas rejecting the channel key core writes (#117992)
  test(memory): isolate wiki plugin fixtures (#118654)
  fix(line): clear default access token when removing account (#118055)
  feat: enable rich setup controls in custodian chat (#114631)
  test(ui): reuse responsive browser fixtures (#118655)
  chore(tui): stabilize queued-turn admission in Gateway PTY test (#118638)
  fix(xai): classify exhausted credits as billing (#118615)
  fix(otel): fail closed when configured TLS material is invalid (#118648)
  fix(cli): preserve gateway request errors in health JSON (#118645)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 4, 2026
…ead of managed UUID suffix (openclaw#118628)

* fix(ui): prefer persisted fileName and strip managed UUID suffix from attachment card labels

* fix(ui): anchor managed UUID removal to terminal storage suffix

* fix(ui): preserve dotted UUID-shaped attachment names

---------

Co-authored-by: Peter Steinberger <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 4, 2026
* origin/main: (57 commits)
  fix(media): fall back when providers return empty output (openclaw#118660)
  fix(nextcloud-talk): allow bounded parallel room deliveries (openclaw#118692)
  test(state): reuse current agent database fixture (openclaw#118677)
  fix(scripts): bound check-file-utils git lookup (openclaw#111582)
  fix(slack): scope interactive conversation bindings safely (openclaw#118662)
  fix(agents): avoid false compaction after mid-turn precheck (openclaw#117963)
  fix(ui): show original filename on chat history attachment cards instead of managed UUID suffix (openclaw#118628)
  fix(whatsapp): preserve terminal retry exhaustion lifecycle (openclaw#118659)
  fix(doctor): audit every agent workspace (openclaw#111840)
  fix(release): skip unavailable Buzz on frozen candidates (openclaw#118670)
  fix(ui): surface onboarding and pairing clipboard failures (openclaw#118651)
  fix(config): stop plugin schemas rejecting the channel key core writes (openclaw#117992)
  test(memory): isolate wiki plugin fixtures (openclaw#118654)
  fix(line): clear default access token when removing account (openclaw#118055)
  feat: enable rich setup controls in custodian chat (openclaw#114631)
  test(ui): reuse responsive browser fixtures (openclaw#118655)
  chore(tui): stabilize queued-turn admission in Gateway PTY test (openclaw#118638)
  fix(xai): classify exhausted credits as billing (openclaw#118615)
  fix(otel): fail closed when configured TLS material is invalid (openclaw#118648)
  fix(cli): preserve gateway request errors in health JSON (openclaw#118645)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Chat history attachment cards expose managed UUID filename suffixes

2 participants