mirror of
https://github.com/vxcontrol/pentagi.git
synced 2026-07-20 23:57:11 -04:00
[PR #158] [CLOSED] fix(browser): treat screenshot failure as non-critical warning #198
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/158
Author: @haosenwang1018
Created: 3/1/2026
Status: ❌ Closed
Base:
master← Head:fix/browser-screenshot-non-critical📄 Description
Summary
Treat screenshot capture failures as non-critical warnings instead of aborting the entire browser tool operation.
Problem
Fixes #149
In
ContentMD,ContentHTML, andLinks, page content fetching and screenshot capture run concurrently. If the screenshot fails (scraper unavailable, timeout, image too small, etc.), the function returns an error even though the page content was successfully fetched. This causes the AI agent to receive an error like:The agent then interprets the URL as unreachable and wastes tool calls retrying.
Root Cause
The screenshot is a non-critical side-effect — its only purpose is to write a PNG to disk and log it via
PutScreenshot, whose return value is already ignored:Yet screenshot errors abort the operation that produced the content.
Fix
In all three methods (
ContentMD,ContentHTML,Links), when content fetch succeeds but screenshot fails:logrus.WithError(...).Warnf(...)screenshotNameto empty stringBefore / After
Before: Screenshot failure → content discarded → agent receives error
After: Screenshot failure → warning logged → agent receives content normally
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.