feat: support async client tools (#332) #428
All Vouch review confidence checks passed
Residual risk 0.23 = Change Risk (0.57) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.57 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.289
Ai Authored
ai_authored
0.050
Real PR Conversation Timeline
1 comments
"Review active on #428"
general
weight: 0.35
franciscojavierarceo
Summary
Closes #332.
Async client tools on the Responses API, matching the recorded OpenAI contract:
async: trueis accepted on function tools, custom tools, and function members of a Codex namespace. On anamespace itself, client
shell, clienttool_search, and every gateway-executed tool it returns400unknown_parameterwithparam: "tools[i].async", as OpenAI does.client calls are async, the gateway runs another round with the calls pending, so the call (marked
async: true)and the answer arrive in one response. A synchronous client call still ends the response. After two async-only
continuations in a row, the response (or multi-agent turn) completes with the calls pending.
and a
developernote after each pending call. Theasyncmarker is stripped upstream. The hints are never storedor returned;
response.createdandresponse.completedecho the client's own declarations. Sampled againstQwen/Qwen3.6-35B-A3B, 24 runs per mode: without hints, 14 of the 19 runs that made the call invented a result;with hints, 0 of 18.
accepted and all reach the model; synchronous calls keep the existing rejection. An output for an unknown
call_idreturns
400with OpenAI's message.async: truein blocking output, in streamedoutput_item.added/output_item.done, in storeditems, and over WebSocket.
compaction_trigger, and/compact) keeps pending async calls; each response stores onlythe pending calls from its own input.
continuation request, and an idle root when it arrives as live WebSocket input.
parallel_tool_calls: truewith an async tool returns400unsupported_valuewithparam: "multi_agent", as OpenAI does.max_tool_callsis unaffected: async calls are client-owned and are not counted.asyncfor some models (unsupported_value,param: "tools"); thegateway accepts it for every model it serves.
Structure.
tool/async_execution.rsholds the hint texts andlower_async_calls, applied inRequestPayload::to_upstream_request.executor/engine/agent_turn/round_policy.rsholdsClientCallsandclassify_round, including the continuation cap.types/io/input/window.rsholds the compaction-window helpers thatkeep open async calls. The
asyncparameter is typed on every declaration:async_executionon function and customtools, and
unsupported_asyncon the others so validation can reject it. Calls carry a typedasync_execution(
FunctionToolCall,CustomToolCall,InputFunctionToolCall), written only when true;nullreads as false.ToolDeclaration::declares_async/declares_unsupported_asyncand the borrowingtool::declares_asyncanswerwhich declarations are async. New errors:
ToolError::UnknownCallOutput,ToolError::UnknownParameter, andExecutorError::UnsupportedValue.ARCHITECTURE.mdanddocs/api/index.md(new "Async client tools" section) areupdated.
Recordings.
tests/cassettes/async_tools/(see its README) holds an OpenAI reference set (gpt-6-astra, 9scenarios) and a gateway set (
Qwen/Qwen3.6-35B-A3B) for every scenario exceptweb-search-mixed. They are driven bythe scripted
record_async_tool_cassettes.pythrough the shared recording proxy, with anx-run-idper step.async_tool_cassette_test.rscompares the gateway with OpenAI step by step: status, and error type, code, param andmessage.
File-size exceptions, for reviewer approval (reasons in
.rust-file-sizes.json):tool/registry.rs567,types/io/output.rs1119,types/tools/params.rs622.Known gaps:
web-search-mixedis not recorded through the gateway; it needs a configured web-search provider.the same with and without the hints.
name. The gateway does not filter reasoning.
Test Plan
cargo fmt -- --check,cargo clippy --all-targets -- -D warnings, andpre-commit run --all-filespass.cargo test --workspace: 98 suites, 2334 passed, 0 failed. New coverage:async_tool_test.rs(end to end throughthe executor with a mock upstream, blocking and streaming),
async_tool_cassette_test.rs(gateway vs. OpenAI, stepby step), and unit tests for the round policy, hints, pending calls, multi-agent, and WebSocket input.
Qwen/Qwen3.6-35B-A3Bbehind the gateway): every recorded step matched OpenAI's status and errorenvelope, no hint text reached the client, and async calls carried
async: true.