Repository navigation
fix(channels): attachment filenames disappear from model context - #129140
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs changes before merge. Reviewed August 25, 2026, 4:40 AM ET / 08:40 UTC. ClawSweeper reviewWhat this changesThe PR carries original inbound attachment filenames through shared media facts and channel adapters so agent prompts can identify attachments by name. Merge readinessKeep open: the branch fixes current-turn filename rendering but still drops a hydrated Telegram reply attachment filename before the reply-chain context reaches the model. Priority: P2 Review scores
Verification
How this fits togetherChannel attachments are downloaded and normalized into media facts before being rendered into model context. Telegram also rehydrates retained media for replies through a separate transient reply-chain projection. flowchart LR
A[Channel attachment] --> B[Download and media metadata]
B --> C[Inbound media fact]
C --> D[Current-turn prompt note]
B --> E[Telegram retained reply hydration]
E --> F[Reply-chain projection]
F --> G[Reply context for model]
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource +30, Tests +101. Total +131 across 24 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Mantis proof suggestionTelegram Desktop evidence would materially demonstrate the user-visible named-document reply behavior. A maintainer can ask Mantis to capture proof by posting this exact PR comment: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Carry the already-hydrated filename through Telegram’s transient reply-chain projection without persisting it in the message cache, then demonstrate a named-document reply end to end. Do we have a high-confidence way to reproduce the issue? Yes from source: a retained Telegram reply carries fileName into mediaRef, but the reply-chain projection omits it before model context is built. Is this the best way to solve the issue? No: the current branch preserves the filename during hydration but loses it at the reply-chain owner boundary. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 15e8a6098468. LabelsLabel changes:
Label justifications:
EvidenceAcceptance criteria:
What I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
Mantis Telegram proof — PASSSummary: A real Telegram user uploaded mantis-quarterly-report-2026.txt and asked for its exact original filename on both exact revisions. Main sent only a generated staged filename to the provider; the candidate additionally sent the bounded authoritative filename "mantis-quarterly-report-2026.txt". Telegram Desktop recorded the baseline inability and candidate success. The candidate cache row's resolvedMedia projection contained id, size, contentType, kind, fileUniqueId, and savedAt, with no transient path or fileName.
Motion-trimmed clips: |
|
Merged via squash.
|
…nclaw#129140) * fix(channels): preserve inbound attachment filenames Fixes openclaw#128956 * test(discord): verify names on successfully downloaded media * test(discord): verify referenced attachment filenames * fix(telegram): preserve accepted resolved-media shapes
* fix(mattermost): keep server file name when the download fails #129140 propagates the attachment file name into the model context, but only on the successful-download path. The failed-download fallback already calls /files/{id}/info and reads mime_type while discarding the name the same response carries — and on that branch the name is the only context the model gets about the attachment, since there is no local file. Read it and forward it like the success path does; blank names stay omitted. * fix(mattermost): surface unavailable attachment filenames to agents Preserve server-provided attachment names through the Mattermost-owned unavailable-media notice, safely bound model-visible metadata, and cover the actual posted-event dispatch boundary. Co-authored-by: goffern <[email protected]> --------- Co-authored-by: goffern <[email protected]> Co-authored-by: Peter Steinberger <[email protected]>
…law#129556) * fix(mattermost): keep server file name when the download fails openclaw#129140 propagates the attachment file name into the model context, but only on the successful-download path. The failed-download fallback already calls /files/{id}/info and reads mime_type while discarding the name the same response carries — and on that branch the name is the only context the model gets about the attachment, since there is no local file. Read it and forward it like the success path does; blank names stay omitted. * fix(mattermost): surface unavailable attachment filenames to agents Preserve server-provided attachment names through the Mattermost-owned unavailable-media notice, safely bound model-visible metadata, and cover the actual posted-event dispatch boundary. Co-authored-by: goffern <[email protected]> --------- Co-authored-by: goffern <[email protected]> Co-authored-by: Peter Steinberger <[email protected]>


Fixes #128956
What Problem This Solves
Fixes an issue where users sending documents through Discord, Mattermost, Slack, or Telegram would find that their agent could not identify the original attachment filename when inbound files were saved under opaque local names. A related Telegram cache boundary also unintentionally allowed a downloaded file's local host path to enter its stored cache payload.
Why This Change Was Made
Preserve authoritative filenames only after attachment download succeeds, carry that fact through the shared inbound-media boundary and all relevant Telegram message/reply relays, and render a bounded, sanitized basename in the existing model-visible attachment note. At the Telegram cache owner, project away only the transient filename and previously leaked local host path before storage; preserve all historically accepted partial attachment shapes and retain the existing strict parser exclusively at durable hydration, without changing schemas, history projections, template variables, or persisted canonical fields.
User Impact
Agents can refer to a successfully received attachment by its real name across all four affected messaging channels. Rejected or failed attachments still disclose no untrusted filename; malicious filenames cannot inject prompt lines, expose path components, or grow the bounded attachment note. Telegram's durable cache keeps only its existing canonical metadata.
Evidence
Before the fix, the original operator scenario supplied filename
jj.txtbut produced only[media attached: /tmp/opaque (application/octet-stream)]. After the fix, the actual shared owner produces[media attached: /tmp/opaque (application/octet-stream) "jj.txt"].The shared prompt-renderer, inbound-media owner, primary and referenced-reply Discord transport owners, Telegram album and persisted-media owners, retained Telegram reply hydration, and Discord preflight owner pass: 187 tests across eight files.
A direct source-import scenario exercised the real
createTelegramMessageCacheowner and its actualpersistentStore.registerpayload, then verified prompt rendering and hydration:{"verdict":"PASS","storedKeys":["id","fileUniqueId","size","savedAt","kind","contentType"],"storedLeaksPath":false,"storedLeaksFileName":false,"prompt":"[media attached: media://inbound/saved-report.pdf (application/pdf) \"quarterly-report.pdf\"]","hydratedId":"saved-report.pdf"}Additional regression coverage spans original-name propagation in Discord, Mattermost, Slack, and Telegram; Telegram's direct, album, and reply paths; failed-download suppression; prompt basename sanitization, control-character removal, attachment numbering, and bounded length; and the exact raw persisted Telegram payload. The entire Telegram album-owner suite passes 42/42; the real allowlisted retained-reply case verifies canonical
media://inbound/hydration, not a private local host path; the exact Telegram persistent-row owner regression passes 1/1; and the successful Discord preflight filename case passes 1/1. An earlier broader Telegram invocation was externally terminated under unrelated host pressure before assertions; all affected named owner paths have since passed genuinely. Exact-head hosted CI must cover the broader affected suites before landing. Live external-channel roundtrips across all four services were infeasible without preconfigured authenticated test-channel sessions; the changed transport-owner and persisted-store boundaries were exercised directly instead.Production delta: +56/-26, net +30 across four channel producer boundaries and the canonical privacy-preserving cache projection. Tests: +114/-13. Scope: 24 coherent source/test files. No new dependency, config, breaking public API, template surface, or persistent-store schema.