mirror of
https://github.com/vxcontrol/pentagi.git
synced 2026-07-20 12:37:04 -04:00
[PR #159] [CLOSED] fix(browser): treat screenshot failure as non-critical warning #201
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/vxcontrol/pentagi/pull/159
Author: @haosenwang1018
Created: 3/1/2026
Status: ❌ Closed
Base:
master← Head:fix/browser-screenshot-non-critical📝 Commits (1)
ee8dcd1fix(browser): treat screenshot failure as non-critical warning📊 Changes
1 file changed (+12 additions, -3 deletions)
View changed files
📝
backend/pkg/tools/browser.go(+12 -3)📄 Description
Summary
Fixes #149
The browser tool's
ContentMD,ContentHTML, andLinksmethods run content fetching and screenshot capture concurrently. Currently, if the screenshot fails for any reason, the entire operation returns an error — discarding successfully-fetched page content.This PR makes screenshot failure non-critical: when content is successfully fetched but the screenshot fails, a warning is logged and the content is returned with an empty screenshot name.
Problem
Screenshot failures can occur due to:
minImgContentSize(2048 bytes)writeScreenshotToFileSince the caller (
wrapCommandResult) already treats the screenshot as optional (_, _ = b.scp.PutScreenshot(...)), the screenshot result is already considered disposable at the call-site. Yet the producing function can abort the entire operation.Changes
In
ContentMD(),ContentHTML(), andLinks():logrus.WithError(...).Warnf()screenshotNameis set to empty string on failureBefore / After
Before: Agent receives
browser tool 'markdown' handled with error: failed to fetch screenshot...even though content was fetched successfully.After: Agent receives the page content. A warning is logged for debugging.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.