Skip to content

fix: screenshot tool is not read-only (raises/focuses window)#5

Merged
avifenesh merged 2 commits into
mainfrom
fix-screenshot-annotation
May 22, 2026
Merged

fix: screenshot tool is not read-only (raises/focuses window)#5
avifenesh merged 2 commits into
mainfrom
fix-screenshot-annotation

Conversation

@avifenesh
Copy link
Copy Markdown
Collaborator

The screenshot tool raises the target window to the front before capturing — a desktop focus side effect — so the read-only/idempotent annotations were wrong.

read_only_hint true→false, idempotent_hint true→false, open_world_hint false→true.

Mirrors the codex-desktop-linux fix (27d2543, by @ilysenko); keeps the two crates in sync at 0.2.3. No version bump (0.2.3 not yet released).

The screenshot tool raises the target window to the front before capturing,
which mutates desktop focus state. Mark it read_only_hint=false,
idempotent_hint=false, open_world_hint=true. Mirrors the codex-desktop-linux
fix (27d2543); keeps the two crates in sync at 0.2.3.
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the metadata annotations for the screenshot tool in src/server.rs, changing it to be non-read-only, non-idempotent, and an open-world operation. Feedback suggests that the idempotent_hint should remain true to maintain consistency with other tools that perform similar idempotent side effects, such as raising a window, which allows the agent to safely retry the operation.

Comment thread src/server.rs
destructive_hint = false,
idempotent_hint = true,
open_world_hint = false
idempotent_hint = false,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The idempotent_hint is changed to false here, but the side effect of this tool (raising a window via focus_window_target) is idempotent. Other tools in this file that perform the same side effect, such as activate_window (line 174), are marked with idempotent_hint = true. Additionally, observation tools like list_windows and get_app_state are also marked as idempotent despite being open_world_hint = true. For consistency and to allow the agent to safely retry the operation if needed, this should likely remain true.

            idempotent_hint = true,

The contract hardcoded screenshot as read-only/idempotent and excluded it from
open-world. It raises the target window, so move it out of READ_ONLY_TOOLS and
into the open-world set, matching the corrected tool annotation.
@avifenesh avifenesh linked an issue May 22, 2026 that may be closed by this pull request
@avifenesh avifenesh merged commit ee094aa into main May 22, 2026
20 checks passed
@avifenesh avifenesh deleted the fix-screenshot-annotation branch May 22, 2026 06:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sync Computer Use → codex-desktop-linux embedded copy

1 participant