Skip to content

Include MEDIA hint in browser screenshot results - #75762

Closed
sumurtk2 wants to merge 2 commits into
openclaw:mainfrom
sumurtk2:browser-screenshot-media-hint
Closed

sumurtk2 wants to merge 2 commits into
openclaw:mainfrom
sumurtk2:browser-screenshot-media-hint

Conversation

@sumurtk2

@sumurtk2 sumurtk2 commented May 1, 2026

Copy link
Copy Markdown

Summary

This PR makes the agent-facing browser screenshot tool include a MEDIA:<path> text hint alongside the existing image result.

The browser screenshot route already saves screenshots to managed media, and the CLI already prints a MEDIA:<path> line for openclaw browser screenshot. This change aligns the tool result with that CLI behavior so chat/channel delivery layers can reliably discover the saved screenshot path.

Motivation

In a Telegram flow, browser.screenshot successfully captured the screenshot and returned image data internally, but the assistant response did not attach the screenshot to the user. Sending the same browser tab screenshot worked when captured through CDP, saved to a file, and sent explicitly via the channel media parameter.

That suggests capture and channel upload were working; the missing piece was an explicit media path hint in the browser screenshot tool result.

Changes

  • Pass extraText: MEDIA:<result.path> when returning browser screenshot results via imageResultFromFile.
  • Add a regression test to verify screenshot tool results include the media path hint.

Testing

pnpm exec vitest run --config test/vitest/vitest.extension-browser.config.ts extensions/browser/src/browser-tool.test.ts

Result:

✓ extension-browser extensions/browser/src/browser-tool.test.ts (49 tests)

Test Files  1 passed (1)
Tests       49 passed (49)

@clawsweeper

clawsweeper Bot commented May 1, 2026 •

Copy link
Copy Markdown
Contributor

Thanks for the context here. I did a careful shell check against current main, and this is already implemented.

Close: current main already makes browser screenshot paths discoverable through structured tool-result media and the home-relative media path fix shipped in v2026.6.6; adding a visible MEDIA hint is now obsolete and conflicts with the open screenshot privacy/security follow-up.

So I’m closing this as already implemented rather than keeping a duplicate issue open.

Review details

Best possible solution:

Keep the shipped structured media path handling and route any browser screenshot auto-delivery or suppression changes through the open security/product issue, not through a visible MEDIA hint.

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

Yes. Source inspection shows the historical path-discovery problem and current main's structured media extraction path; the remaining auto-delivery privacy question is tracked separately.

Is this the best way to solve the issue?

No. Adding MEDIA text is not the best fix now that current main uses structured media extraction and the browser screenshot privacy decision lives in #44759.

Security review:

Security review needs attention: The PR explicitly adds a browser screenshot media directive, which can auto-deliver sensitive screen contents to chat channels.

  • [high] Browser screenshot MEDIA hint can leak sensitive pages — extensions/browser/src/browser-tool.ts:760
    A browser screenshot may contain credentials, private messages, dashboards, or tokens; adding an explicit MEDIA: line makes channel delivery more likely before the user or agent can suppress it.
    Confidence: 0.91

AGENTS.md: found and applied where relevant.

What I checked:

Likely related people:

  • christianklotz: Commit 68c78c4 added tool-result media delivery when verbose output is off and included the details.path fallback tests relevant to this PR's requested behavior. (role: introduced media delivery behavior; confidence: high; commits: 68c78c4b43a2; files: src/agents/embedded-agent-subscribe.handlers.tools.ts, src/agents/embedded-agent-subscribe.tools.ts, src/agents/embedded-agent-subscribe.handlers.tools.media.test.ts)
  • steipete: Commit 3312ce5 fixed home-relative media paths for the linked browser screenshot delivery failure, and commit 3a7ee20 recently touched browser screenshot behavior. (role: current fix author and browser/media contributor; confidence: high; commits: 3312ce5acba9, 3a7ee209c967; files: src/media/parse.ts, src/media/web-media.ts, extensions/browser/src/browser-tool.ts)
  • drobison00: Commit 52ef423 tightened trusted tool media passthrough on the same extraction and filtering boundary. (role: adjacent media trust hardening contributor; confidence: high; commits: 52ef42302ead; files: src/agents/embedded-agent-subscribe.tools.ts, src/agents/embedded-agent-subscribe.handlers.tools.ts, src/gateway/openresponses-http.ts)

Codex review notes: model internal, reasoning high; reviewed against 66880a5d736c; fix evidence: release v2026.6.6, commit 3312ce5acba9.

@sumurtk2
sumurtk2 force-pushed the browser-screenshot-media-hint branch from cdcb872 to d5cb9b1 Compare May 1, 2026 17:39
@sumurtk2

sumurtk2 commented May 1, 2026

Copy link
Copy Markdown
Author

Thanks for the review. I added the active-version changelog entry crediting @sumurtk2 and reran the requested checks:\n\n- pnpm exec vitest run --config test/vitest/vitest.extension-browser.config.ts extensions/browser/src/browser-tool.test.ts — 49 passed\n- pnpm exec oxfmt --check --threads=1 extensions/browser/src/browser-tool.ts extensions/browser/src/browser-tool.test.ts CHANGELOG.md — passed\n\nPushed in d5cb9b11.

@sumurtk2
sumurtk2 force-pushed the browser-screenshot-media-hint branch from d5cb9b1 to 49e544f Compare May 1, 2026 17:48
@sumurtk2

sumurtk2 commented May 1, 2026

Copy link
Copy Markdown
Author

Quick follow-up on the failing checks: the two failures were check-lint plus the aggregate check job. The actual lint error was on the PR merge commit: src/plugins/bundled-runtime-deps.ts had an unused pluginIds binding from the then-current base branch, not from this browser screenshot diff.

I rebased this PR onto the latest origin/main, where that lint issue is resolved, then reran locally:

  • pnpm exec vitest run --config test/vitest/vitest.extension-browser.config.ts extensions/browser/src/browser-tool.test.ts — 49 passed
  • pnpm exec oxfmt --check --threads=1 extensions/browser/src/browser-tool.ts extensions/browser/src/browser-tool.test.ts CHANGELOG.md — passed
  • node scripts/run-oxlint-shards.mjs --threads=8 — passed

Force-pushed the clean rebased branch. Latest commits are 109e8169 and 49e544f1.

@barnacle-openclaw

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@barnacle-openclaw barnacle-openclaw Bot added the stale Marked as stale due to inactivity label May 30, 2026
@clawsweeper clawsweeper Bot added rating: 🌊 off-meta tidepool PR readiness rating does not apply to this item. and removed mantis: telegram-visible-proof Mantis should capture Telegram visible proof. labels May 30, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the stale Marked as stale due to inactivity label May 31, 2026
@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Jun 14, 2026
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. and removed rating: 🌊 off-meta tidepool PR readiness rating does not apply to this item. labels Jun 14, 2026
@clawsweeper

clawsweeper Bot commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper applied the proposed close for this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: XS stale Marked as stale due to inactivity status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant