fix(telegram): preserve sticker media paths#93130
Conversation
|
Codex review: needs changes before merge. Reviewed June 15, 2026, 2:28 AM ET / 06:28 UTC. Summary PR surface: Source +167, Tests +352. Total +519 across 21 files. Reproducibility: yes. at source level: current main removes cached sticker media from inbound context when stickerCacheHit is true, and the PR tests target that path. I did not run a live Telegram reproduction in this read-only review. Review metrics: 1 noteworthy metric.
Stored data model Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Mantis proof suggestion Risk before merge
Maintainer options:
Copy recommended automerge instructionNext step before merge
Security Review findings
Review detailsBest possible solution: Land the Telegram-scoped media preservation fix after the narrow validation blockers are repaired and maintainers accept or capture live Telegram proof for the reply-context media boundary. Do we have a high-confidence way to reproduce the issue? Yes at source level: current main removes cached sticker media from inbound context when stickerCacheHit is true, and the PR tests target that path. I did not run a live Telegram reproduction in this read-only review. Is this the best way to solve the issue? Mostly yes: preserving Telegram-owned media facts and skipping only duplicate sticker understanding is the right layer. As submitted, the best path is to fix the changed-line validation blockers before merge. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against bcb016a528b1. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +167, Tests +352. Total +519 across 21 files. View PR surface stats
Acceptance criteria:
What I checked:
Likely related people:
What the crustacean ranks mean
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. How this review workflow works
|
1f45fed to
46d2ff4
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
46d2ff4 to
defde22
Compare
|
Maintainer repair is pushed at Repairs made:
Verification:
Known proof gap: live Telegram Desktop/Crabbox proof is blocked in this environment because Testbox has no |
|
Maintainer follow-up on head
|
* fix(telegram): preserve sticker media paths * fix(telegram): address PR validation failures * fix(telegram): preserve sticker media context * test(telegram): fix sticker proof checks --------- Co-authored-by: Vincent Koc <[email protected]>
* fix(telegram): preserve sticker media paths * fix(telegram): address PR validation failures * fix(telegram): preserve sticker media context * test(telegram): fix sticker proof checks --------- Co-authored-by: Vincent Koc <[email protected]>
* fix(telegram): preserve sticker media paths * fix(telegram): address PR validation failures * fix(telegram): preserve sticker media context * test(telegram): fix sticker proof checks --------- Co-authored-by: Vincent Koc <[email protected]>
* fix(telegram): preserve sticker media paths * fix(telegram): address PR validation failures * fix(telegram): preserve sticker media context * test(telegram): fix sticker proof checks --------- Co-authored-by: Vincent Koc <[email protected]>
Summary
media://inbound/...references.What problem does this PR solve?
Telegram static stickers could reach the agent as cached sticker text with no usable
MediaPath, so image/media tools could not inspect the underlying sticker media.Why does this matter now?
Issue #83748 is a P2 queued fix for Telegram message-loss behavior where inbound sticker media is not available to the agent.
What is the intended outcome?
Static Telegram sticker media remains available as inbound media for the current turn, and prompt-visible reply/conversation media uses safe
media://inbound/...references instead of raw local paths or provider file ids.What is intentionally out of scope?
Animated TGS/video WEBM sticker support, live Telegram transport changes, and broader Telegram photo behavior outside the sticker/reply-chain path.
What does success look like?
Cached static stickers still provide
MediaPath/MediaPaths, reply-chain media remains attachable through the runtime payload, and prompt chat windows do not expose raw local media-store paths.What should reviewers focus on?
Telegram media context boundaries: cached current-message stickers, direct vs group reply-chain prompt context, and canonicalization of
media_pathvalues ininbound-meta.Summary guidance
This PR description is the contributor's durable explanation of the change. Write it for human maintainers first; ClawSweeper and Barnacle use the same text to understand intent, proof, risk, and current review state.
Describe the intent and outcome in 2-5 bullets. Avoid restating the diff; reviewers and bots can read the changed files.
If this PR fixes a plugin beta-release blocker, title it
fix(<plugin-id>): beta blocker - <summary>and link the matchingBeta blocker: <plugin-name> - <summary>issue labeledbeta-blocker. Contributors cannot label PRs, so the title is the PR-side signal for maintainers and automation.Linked context
Which issue does this close?
Closes #83748
Which issues, PRs, or discussions are related?
Related #84599
Was this requested by a maintainer or owner?
No direct maintainer assignment. This was selected from the #84599 contributor queue context and the #83748 ClawSweeper labels (
queueable-fix,fix-shape-clear,source-repro).Linked context guidance
Link the issue, PR, discussion, maintainer request, or owner request that explains why this PR should exist. Maintainer context helps reviewers and automation distinguish intended work from drive-by churn.
Real behavior proof (required for external PRs)
media://inbound/...locators.<local-node-bin>.PATH="<local-pnpm-shim>:<local-node-bin>:/usr/bin:/bin:/usr/sbin:/sbin:$PATH" corepack pnpm exec tsx --eval '<production buildTelegramMessageContext sticker payload script>'PATH="<local-pnpm-shim>:<local-node-bin>:/usr/bin:/bin:/usr/sbin:/sbin:$PATH" corepack pnpm exec tsx --eval '<production buildInboundUserContextPrefix media_path rendering script>'PATH="<local-node-bin>:/usr/bin:/bin:/usr/sbin:/sbin:$PATH" node scripts/run-vitest.mjs src/auto-reply/reply/inbound-meta.test.ts extensions/telegram/src/bot-message-context.sticker-media.test.ts extensions/telegram/src/bot.test.ts extensions/telegram/src/message-cache.test.ts extensions/telegram/src/bot.media.stickers-and-fragments.e2e.test.ts src/agents/tools/image-tool.test.ts src/auto-reply/media-note.test.tsPATH="<local-node-bin>:/usr/bin:/bin:/usr/sbin:/sbin:$PATH" corepack pnpm tsgo:extensionsPATH="<local-node-bin>:/usr/bin:/bin:/usr/sbin:/sbin:$PATH" corepack pnpm tsgo:corePATH="<local-node-bin>:/usr/bin:/bin:/usr/sbin:/sbin:$PATH" corepack pnpm exec oxfmt --check --threads=1 src/auto-reply/reply/inbound-meta.ts src/auto-reply/reply/inbound-meta.test.ts extensions/telegram/src/bot-handlers.runtime.ts extensions/telegram/src/bot-message-context.session.ts extensions/telegram/src/bot-message-context.ts extensions/telegram/src/bot-message-dispatch.ts extensions/telegram/src/bot-message-context.sticker-media.test.ts extensions/telegram/src/bot.test.ts/usr/bin/git diff --checkPATH="<local-node-bin>:/usr/bin:/bin:/usr/sbin:/sbin:$PATH" .agents/skills/autoreview/scripts/autoreview --mode localbuildTelegramMessageContextin the local OpenClaw checkout:buildInboundUserContextPrefixin the local OpenClaw checkout:[test] passed 5 Vitest shards in 144.81s;tsgo:extensionsandtsgo:coreexited 0; direct oxlint on the changed files exited 0;oxfmt --checkand/usr/bin/git diff --checkexited 0.MediaPath,MediaType,MediaPaths,MediaTypes, andStickerMediaIncluded. Prompt-visible chat-window context rendersmedia://inbound/...instead of the raw local media-store path or provider file ref. RuntimeReplyChain[].mediaPathstays local/attachable, and group chat-window context does not receive pre-visibility local media paths.Real behavior proof guidance
External contributors must show after-fix evidence from a real OpenClaw setup. Unit tests, mocks, lint, typechecks, snapshots, and CI are supplemental only.
Screenshots are encouraged even for CLI, console, text, or log changes. Terminal screenshots, copied live output, redacted runtime logs, recordings, and linked artifacts count.
If your environment cannot produce the ideal proof, explain that under
Proof limitations or environment constraintsso reviewers and ClawSweeper can direct the next step properly.Be mindful of private information like IP addresses, API keys, phone numbers, non-public endpoints, or other private details when providing evidence.
Tests and validation
Which commands did you run?
tsx --evalcommand forbuildTelegramMessageContextsticker payload proof.tsx --evalcommand forbuildInboundUserContextPrefixprompt rendering proof.corepack pnpm tsgo:extensionscorepack pnpm tsgo:corecorepack pnpm exec oxfmt --check --threads=1 .../usr/bin/git diff --check.agents/skills/autoreview/scripts/autoreview --mode localcorepack pnpm exec oxlint src/auto-reply/reply/inbound-meta.ts extensions/telegram/src/bot-handlers.runtime.ts extensions/telegram/src/bot-message-context.session.ts extensions/telegram/src/bot-message-context.sticker-media.test.tsWhat regression coverage was added or updated?
MediaPath,MediaPaths, media type/url fields, andStickerMediaIncluded.media://inbound/...locators.What failed before this fix, if known?
Cached sticker descriptions caused sticker media to be pruned from the dispatch context, leaving no agent-readable saved media path for static sticker inspection.
If no test was added, why not?
Not applicable. Focused regression tests were added and updated.
Testing guidance
List focused commands, not every incidental check. CI is useful support, but external PRs still need real behavior proof above when behavior changes.
Risk checklist
Did user-visible behavior change? (
Yes/No)Yes.
Did config, environment, or migration behavior change? (
Yes/No)No.
Did security, auth, secrets, network, or tool execution behavior change? (
Yes/No)Yes. Prompt-visible media locator handling was tightened so local filesystem paths are not rendered and untrusted
media_pathvalues are canonicalized before transcript rendering. No auth, secrets, network, or tool execution behavior changed.What is the highest-risk area?
Media context boundary handling: keeping runtime attachment paths usable while only exposing safe canonical locators in prompt-visible chat windows.
How is that risk mitigated?
Focused direct/group Telegram tests, cached-sticker media tests, auto-reply path canonicalization tests, TypeScript checks, formatting checks,
git diff --check, and a clean local autoreview pass.Risk guidance
Use this for author judgment that is not obvious from the diff. ClawSweeper can see touched files, but it cannot know which behavior you think is risky, why the risk is acceptable, or what mitigation reviewers should verify.
Current review state
What is the next action?
Maintainer review of the open PR.
What is still waiting on author, maintainer, CI, or external proof?
Waiting on maintainer review, CI, and any maintainer-requested live Telegram proof. Author-side local production-command proof and supplemental source/test proof are complete.
Which bot or reviewer comments were addressed?
Local autoreview findings were addressed before the original commit: chat-window
media_pathrendering support, unused sticker cache plumbing, group visibility for reply-chain media, raw local path prompt exposure, runtime attachment path preservation, untrustedmedia_pathsanitization, and canonical URI double-encoding. PR #93130 CI feedback was addressed after opening:no-control-regexlint failures, theTS2556test mock spread type error, and the Real behavior proof gate's request for non-test copied live output.Review state guidance
Keep this as the durable state for review progress. If useful information appears in comments, fold the current next action or blocker back here so maintainers and ClawSweeper do not need to reconstruct state from comment history.