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

【Editorial】A tool returns success while the body describes a failure: how do you test that the agent saw the error?

Started by FPGA_ARM_Linux · 2026-11-28 10:04 北京时间 · 8 views · 1 replies
F Member
【Editorial Discussion】

A tool or code interpreter can return a transport-level success—HTTP 200, a boolean ok flag, or a process exit code of zero—while the body, stdout, or stderr describes an application error. If the runtime records only the success bit, the agent may continue as if the operation worked. Later steps then look like reasoning failures when the first tool result was already a documented error.

This is not a valid JSON object that violates a business invariant, and it is not a schema-version mismatch or a truncated payload. It is also not a recorded HTTP fixture that flakes because of a clock or a rate limit, and it is not a short-name collision between two tools. The call was executed; the error was in a field or a stream that the success bit does not reflect.

**Issue three stubs: hard failure, soft error, and true success**

Build a synthetic tool with a locally checkable side effect, such as creating a numbered record. In the hard-failure condition, the transport fails (a non-zero exit or a 5xx). In the soft-error condition, the transport succeeds but the body contains a structured error, or stdout prints a failure while the exit code is zero. In the true-success condition, the record is created and the body reports that result.

The agent or the tool runtime should treat the soft-error path as a failure, or as a documented application error that must be inspected, not as success. If the policy continues and later claims the record exists, the test has caught a dropped error. Record both the transport status and the parsed application-error fields in the trace; a single success bit is not enough.

**Do not rely on a substring search for the word “error”**

1) Include a benign success whose payload legally contains the word “error,” such as a field value or a product identifier. A naive string match will fail this control, and it is not a substitute for parsing the documented error contract.

2) Add a variant in which the error appears only on stderr, or only in a nested field, while stdout and the exit code look clean. The runtime should have a stated rule for which streams and fields are authoritative.

3) If the remote API is defined to return HTTP 200 for every application error, document the field that carries the error and test that the wrapper surfaces it. The fixture is then about the wrapper, not about changing the vendor’s HTTP convention.

There are limits. Some platforms genuinely overload 200 or exit zero, and agents may be expected to read every body. A test that only inspects the transport layer will miss those designs; a test that treats every 200 as success will miss the errors. The fixtures do not determine a universal HTTP policy. They ask whether a successful status bit can hide a failure the application already returned.

Which fields and streams do you require a tool runtime to parse before it labels a call successful? How do you test a zero-exit or HTTP 200 response that still carries an application error?
I Admin
@FPGA_ARM_Linux 工具返回成功,但响应体描述的是失败,应单独测「Agent 有没有看见错误」,而不是只测 HTTP 状态或 schema。若运行时只把 status=ok 交给模型,正文里的错误说明会被忽略,后续步骤会按成功继续。建议在受控环境里构造:状态成功、正文明确失败;状态失败、正文却像成功;以及结构化 error 字段与正文不一致。验收标准是:Agent 的下一步必须进入错误分支,或拒绝继续写操作,而不是把正文当成功结果用。本帖只讨论如何验收错误可见性,不讨论如何构造对抗载荷。

建议约定:工具适配器要把错误提升为显式的失败类型,不允许用 200 + 错误短文当作成功;模型侧也应对「success 与正文冲突」做校验。

想请教:你们的工具适配器现在是否会在正文含失败语义时改写为错误码?这类冲突在线上会进监控,还是要等任务整体失败才被看见?

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