Skip to content

[Bug]: agent_browser screenshot result lacks save confirmation, causing agents to report the screenshot wasn't saved #9

Description

@JordanTheJet

Affected component

tools

Severity

S3 - minor issue

Current behavior

The agent_browser browser backend's screenshot action returns the bare path passthrough from the agent-browser CLI — e.g. {"path": "..."} — with no independent save confirmation (no byte count, no saved: true flag, no file-existence check). At least one model (gpt-5.5, driving a headed browser) interpreted this as an unconfirmed/"empty" save and reported it could not confirm the screenshot was written, even though the PNG was written correctly on disk.

This is inconsistent with the rust_native backend, whose screenshot result includes "bytes": png.len() as positive confirmation.

Expected behavior

The agent_browser screenshot ToolResult should include an unambiguous save confirmation (verify the file exists + include a byte count and/or explicit saved: true), mirroring the rust_native backend, so models can reliably tell the screenshot succeeded.

Steps to reproduce

# Agent on any provider, default browser.backend = "agent_browser", headed
echo "Open https://example.com and screenshot it to C:/Users/<user>/AppData/Local/Temp/shot.png, then confirm it saved" \
  | zeroclaw agent -a <agent>

# The file is written, but the tool result is only:
#   {"path": "C:/Users/<user>/AppData/Local/Temp/shot.png"}
# Direct CLI check confirms the path is returned but nothing else:
agent-browser screenshot /tmp/probe.png --json
#   {"success":true,"data":{"path":"C:/Users/<user>/AppData/Local/Temp/probe.png"},"error":null}

Impact

Affected users: anyone using the default agent_browser backend whose agent takes screenshots.
Frequency: consistent for screenshot actions.
Consequence: agents hedge or report failure on successful screenshots; may trigger unnecessary retries or incorrect "couldn't save" conclusions. Cosmetic — no data loss.

Logs / stack traces

Model's final note (gpt-5.5):
"Screenshot note: the screenshot request returned an empty saved-path response,
 so I can't confirm from the tool output that it successfully wrote to
 C:/Users/<user>/AppData/Local/Temp/reddit-shot.png."

agent-browser screenshot --json (all variants return path, no bytes/confirmation):
{"success":true,"data":{"path":"C:/Users/<user>/AppData/Local/Temp/probe-shot.png"},"error":null}

Relevant code (zeroclaw/crates/zeroclaw-tools/src/browser.rs):
- screenshot branch ~L620 (agent_browser: passes CLI JSON through unchanged)
- to_result ~L952 (pretty-prints `data`; empty output when `data` is None)
- rust_native screenshot ~L1316 (includes "bytes": png.len())

ZeroClaw version

v0.8.1 (commit 6ce0473)

Rust version

rustc 1.93.1 (01f6ddf75 2026-02-11)

Operating system

Windows 11 Pro 10.0.26200

Regression?

Unknown

Pre-flight checks

  • I reproduced this on the latest master branch or latest release.
  • I redacted secrets, tokens, and personal data from all submitted content.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions