Repository navigation
fix(feishu): persist durable attachment reference on inbound message (#108534) - #108588
SymbolStar wants to merge 1 commit into
Conversation
…penclaw#108534) When a Feishu file/image/audio/video message is downloaded, buildFeishuAgentBody previously only carried the inline <media:...> placeholder (or truncated preview) into the agent-facing body. The FeishuMediaInfo entries produced alongside toInboundMediaFacts — including the exact local path under ~/.openclaw/media/inbound — were dropped from the persisted message body. Reporter scenario: a 411 KB SQL file was truncated inline; a follow-up turn had no durable reference and had to scan the shared inbound media directory to guess which file belonged to the message. Fix: append a small <attachments> block listing each downloaded attachment's path, kind, and contentType (when available). Inline preview and toInboundMediaFacts shape are unchanged. Scope is intentionally narrower than openclaw#19330 (shared inbound isolation).
|
Codex review: needs real behavior proof before merge. Reviewed July 31, 2026, 8:47 AM ET / 12:47 UTC. ClawSweeper reviewWhat this changesThe branch passes Feishu’s resolved inbound media list into the agent-body formatter and appends each downloaded attachment’s local path, kind, and content type to the message text. Merge readiness⛔ Blocked until real behavior proof from a real setup is added - 8 items remain Keep this PR open for human review. The branch has not advanced since the prior ClawSweeper cycle, which already identified an unresolved choice between duplicating attachment paths in message text and using the existing structured-media context path; the supplied material does not establish which path current Priority: P1 Review scores
Verification
How this fits togetherFeishu receives an inbound message, downloads any attachment, and constructs agent context for the resulting turn. That context feeds the agent/session transcript and determines whether a later turn can identify the same downloaded file without scanning shared inbound storage. flowchart LR
A[Feishu inbound message] --> B[Attachment download]
B --> C[Resolved media records]
C --> D[Agent turn context]
D --> E[Session transcript]
E --> F[Later agent follow-up]
F --> G[Attachment access decision]
Decision needed
Why: The PR changes the durable representation of attachment authority while the linked open issue identifies shared inbound storage as a privacy boundary; this requires an explicit owner decision rather than a formatter-only merge judgment. Before merge
Findings
Agent review detailsSecurityNeeds attention: The patch introduces a model-visible persisted copy of absolute inbound file paths, so the shared-media trust boundary needs explicit review before merge. PR surfaceSource +32, Tests +40. Total +72 across 3 files. View PR surface stats
Review metricsNone. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Preserve one canonical structured attachment reference from Feishu ingestion through follow-up session context, with an owner-approved policy for any model-visible path or managed-media reference, then prove the large-document follow-up flow in a redacted real Feishu setup. Do we have a high-confidence way to reproduce the issue? No high-confidence current-main reproduction is established in the supplied evidence. The proposed formatter path is source-reproducible from the branch, but the required comparison against current-main structured-media persistence and a real Feishu follow-up run is missing. Is this the best way to solve the issue? No. The formatter block is a plausible local workaround, but the prior review identified a potentially canonical structured-media path; current evidence does not show that duplicating raw paths into transcript text is the narrowest maintainable fix. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 5cd00cfbaa05. LabelsLabel justifications:
EvidenceSecurity concerns:
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)
|
|
This pull request has been automatically marked as stale due to inactivity. |
|
Closing due to inactivity. |
Fixes #108534
What Problem This Solves
Fixes an issue where a Feishu user uploading a file to the bot loses the durable local reference to the file after the inline preview is truncated. In the reporter's scenario a 411 KB SQL file appears in the agent-facing message body only as a
<media:document>placeholder (with the file name), so a follow-up turn has no reliable way to locate the downloaded file without scanning the shared~/.openclaw/media/inbounddirectory.Why This Change Was Made
Root cause:
buildFeishuAgentBodyinextensions/feishu/src/bot-agent-body.tsbuilds the persisted body fromctx.contentand quoted content only. The resolvedmediaList(which already carries the exact downloaded path,contentType, and placeholder kind) is passed totoInboundMediaFactsfor the turn-level media payload but was never surfaced in the message body itself.Minimal fix: thread
mediaListintobuildFeishuAgentBodyand append a small trailing<attachments>block listing each attachment'spath,kind(derived from the existing<media:*>placeholder), and optionalcontentType. The inline<media:...>preview, theFeishuMediaInfo/toInboundMediaFactsshape, and the media directory / dedupe layout are all unchanged. Scope is intentionally narrower than #19330 (shared inbound isolation).User Impact
Agent turns triggered by Feishu file/image/audio/video messages now have a stable, machine-readable pointer (
path:) to each attachment in the persisted message body. Follow-up turns can locate the exact downloaded file without directory scanning, even when the inline preview was truncated.Evidence
New unit tests in
bot.helpers.test.tscover both the populated<attachments>block and the empty-mediaList no-op case. ExistingbuildFeishuAgentBodytests continue to pass because the new block is only emitted when at least one media entry has a resolved path.Local
pnpm --filterrun was skipped (nopnpmon this machine); CI will validate.