fix: screenshot tool is not read-only (raises/focuses window)#5
Conversation
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.
There was a problem hiding this comment.
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.
| destructive_hint = false, | ||
| idempotent_hint = true, | ||
| open_world_hint = false | ||
| idempotent_hint = false, |
There was a problem hiding this comment.
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.
The
screenshottool raises the target window to the front before capturing — a desktop focus side effect — so the read-only/idempotent annotations were wrong.read_only_hinttrue→false,idempotent_hinttrue→false,open_world_hintfalse→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).