Test and harden batch_computer_actions across providers - #3
Conversation
- Add provider-by-provider unit coverage for the batch tool schemas. - Add integration tests (env-gated) that hit each provider live and verify the response contains a parsed batch_computer_actions call. - Tzafon: unwrap stringified nested arrays in tool args and surface the usage counts the API already returns. - Yutori: when callers pass batch_computer_actions, translate the model's native left_click/scroll/etc. calls into a canonical batch call so consumers get uniform output across providers. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…preview The gemini-2.5-computer-use-preview-10-2025 model rejects standard function declarations — it requires Google's special tools.computer_use wrapper, which packages/ai doesn't currently send. The gemini-3-flash-preview preview, which the cua-cli README already recommends, accepts the batch_computer_actions tool directly. CI runs unit tests on every push/PR and runs the integration suite when secrets are available (skipped automatically for fork PRs). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
For each provider, assert whether a click+type sequence ends up packed into a single batch_computer_actions call. Findings encoded in the suite: - openai, anthropic, gemini, tzafon: pack both actions into one batch - yutori: server-side model emits exactly one tool call per response, so the translated batch always carries a single action Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
Firetiger deploy monitoring skipped This PR didn't match the auto-monitor filter configured on your GitHub connection:
Reason: PR modifies provider schemas and tool definitions, not kernel API endpoints (packages/api/cmd/api/) or Temporal workflows (packages/api/lib/temporal). To monitor this PR anyway, reply with |
fb748e1 to
fdf6346
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Native
typeaction missing from Yutori batch translation- Added missing Yutori canonical mappings for
type(plusgoto_url,mouse_down, andmouse_up) so native calls now translate intobatch_computer_actionsactions instead of falling through.
- Added missing Yutori canonical mappings for
Or push these changes by commenting:
@cursor push 50af108f03
Preview (50af108f03)
diff --git a/packages/ai/src/providers/yutori/provider.ts b/packages/ai/src/providers/yutori/provider.ts
--- a/packages/ai/src/providers/yutori/provider.ts
+++ b/packages/ai/src/providers/yutori/provider.ts
@@ -255,6 +255,14 @@
return coords ? [{ type: "double_click", x: coords.x, y: coords.y }] : undefined;
case "mouse_move":
return coords ? [{ type: "move", x: coords.x, y: coords.y }] : undefined;
+ case "mouse_down":
+ return coords ? [{ type: "mouse_down", x: coords.x, y: coords.y }] : undefined;
+ case "mouse_up":
+ return coords ? [{ type: "mouse_up", x: coords.x, y: coords.y }] : undefined;
+ case "type": {
+ const text = typeof args.text === "string" ? args.text : undefined;
+ return text !== undefined ? [{ type: "type", text }] : undefined;
+ }
case "key_press": {
const key = typeof args.key === "string" ? args.key : undefined;
return key ? [{ type: "keypress", keys: [key] }] : undefined;
@@ -279,6 +287,10 @@
return [{ type: "back" }];
case "go_forward":
return [{ type: "forward" }];
+ case "goto_url": {
+ const url = typeof args.url === "string" ? args.url : undefined;
+ return url ? [{ type: "goto", url }] : undefined;
+ }
default:
return undefined;
}You can send follow-ups to the cloud agent here.
Reviewed by Cursor Bugbot for commit fdf6346. Configure here.


Summary
batch_computer_actionsschemas exposed by eachcreateComputerToolDefinitions()(every CUA action present, narrowing preserves order, single-action mode emits a non-union schema, navigation tool is dropped when actions are narrowed, etc.).batch_computer_actionscall with valid coordinates inside the declared coordinate range.arguments.actionsas a JSON-encoded string (the API double-encodes nested arrays) and the usage counters were hard-coded to zero even though the response includesusage.input_tokens/output_tokens/total_tokens. Both are now parsed.left_click/scroll/key_press/mouse_move/ etc. shape regardless of which tools the caller declares. When the caller passesbatch_computer_actions, the provider now translates the native call(s) into a single canonical batch call so consumers see uniform output across all five providers.Test plan
npx vitest --run(31 unit tests pass)OPENAI_API_KEY,ANTHROPIC_API_KEY,TZAFON_API_KEY,YUTORI_API_KEY(5 pass, gemini skipped — no key on hand)🤖 Generated with Claude Code
Note
Medium Risk
Touches provider response parsing/normalization for
tzafonandyutori, which can change downstream tool-call/usage behavior across integrations; changes are mitigated by added unit and live integration coverage.Overview
Adds a GitHub Actions CI workflow that builds
@onkernel/cua-ai, runs a focused unit suite, and (when secrets are available) runs env-gated live integration tests.Hardens
batch_computer_actionsend-to-end:createCuaActionSchemanow emits a single-variant schema when narrowed to one action (instead of a union), and unit tests expand to validate schema coverage, strictness (additionalProperties: false), ordering, and navigation-tool omission when actions are narrowed.Fixes provider output normalization:
tzafonnow reportsresponseId/token usage and unwraps nested JSON-encoded tool arguments, andyutorican translate its native per-action tool calls into a single canonicalbatch_computer_actionscall when that tool is requested. A newbatch-tool.integration.test.tsvalidates parsed batch actions and coordinate ranges across providers and probes whether multi-step tasks actually batch into one call.Reviewed by Cursor Bugbot for commit 14e6446. Bugbot is set up for automated code reviews on this repo. Configure here.