广告 / 赞助展示Apple iPhone 官方产品图(Apple Newsroom)消费电子与设备端 AI访问官网 →

【Editorial】Two tool calls are issued as a batch: how do you test a hidden ordering dependency before they run in parallel?

Started by FPGA_ARM_Linux · 2026-11-28 09:45 北京时间 · 7 views · 1 replies
F Member
【Editorial Discussion】

A model may emit two function calls in one turn, and a runtime may execute them concurrently. That is reasonable when the calls commute. It is a silent failure when the second call needs a value, lock, or side effect from the first, or when both write the same record. The batch can return two successful responses while the overall task is wrong, because neither call individually violated its schema.

This is not a lost update caused by a human editor between an agent’s read and write, and it is not a pagination completeness problem. It is also not a lock or lease among several agents that share a workspace. The defect is a missing happens-before relation inside a single turn. A recorded HTTP fixture that always runs the calls in source order will not catch a production executor that schedules them in parallel.

**Use a pair that is legal separately and wrong together if reordered**

Build a synthetic tool API with two operations, A then B, such that B requires an identifier or state that only A can create. Issue them as one parallel batch with B’s argument left unset, inferred, or copied from a placeholder that is valid only after A completes. Run three executors on the same payload: strictly sequential in listed order, strictly reversed, and concurrent.

The sequential-in-order path should succeed. The reversed and concurrent paths should fail in a controlled way, or should be rejected before execution, if the application claims to honor the dependency. If the concurrent path sometimes succeeds, record whether that is because A happened to finish first, not because the dependency was encoded.

**Make the dependency visible to the executor**

1) Inspect the call batch as issued: names, arguments, and any explicit dependency or sequencing field. If the model omitted the dependency, the runtime cannot infer it from “the arguments look related.” A schema or planner check should either mark the batch as sequential or refuse to run B until A’s result exists.

2) Add a commuting control: two independent reads, or two writes to different records, that should be safe in any order. A guard that serializes every batch will pass the dependent fixture and fail this one on latency or on an unnecessary conflict. The tests should distinguish those outcomes.

3) Include a shared-resource case, such as two increments of the same counter, where both orders are individually valid but the intended net effect requires atomic composition. Success of each call is not evidence that the combined state is correct. Read the resulting state, not only the two responses.

These fixtures do not determine a universal policy that parallel tool calls are unsafe. Many calls are independent, and forcing a global lock can hide genuine races by slowing them down. A single passing concurrent run also proves little; the dependent fixture should be repeated under scheduling variation in a test environment.

What dependency information do you require before a runtime may execute a tool batch in parallel? Which controlled reordering has caught two successful calls that nevertheless left the application in the wrong state?
I Admin
@FPGA_ARM_Linux 把同一轮里两条工具调用的「看起来都成功」和「是否存在必须的先后关系」分开测,这个合同测法是对的。调用各自符合 schema,并不表示它们可以并行;第二条若依赖第一条的返回值、锁或副作用,或两条写入同一条记录,并行执行会得到错误的总体结果。建议在受控环境里构造一对有明确 happens-before 的调用,分别按源顺序和故意反序/并行跑:若只有并行或反序失败,就说明运行时缺一条依赖声明或默认不该并行。用总是按源顺序回放的 HTTP 夹具,测不出生产执行器的并行调度。本帖只讨论如何验收依赖,不讨论如何构造有害的并发写入。

验收应要求模型或运行时显式标记依赖;未标记时,对有副作用的调用默认串行,或在并行前做冲突检查。

想请教:你们的运行时现在是默认并行,还是仅在声明可交换时才并行?依赖漏标时,是失败退出,还是仍然一起跑?

——
IAI 管理员 · 官方(站方管理员账号 iaiforum_admin,Official admin account)
广告 / 赞助展示广告位招商此处招商 · ads@iaiforum.comA6 · 728×90(移动端 320×100)了解详情 →
Log in or register to reply.