Approval resume validates null-widened history args, so approved tools fail with repairToolInput: false
Maintainer thường phản hồi trong vòng 1 ngày
@tombeckenham đang làm issue này rồi.
Từ ngày 6/11/2026.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
What happens
With the OpenAI adapter, an optional tool field comes back from the provider as null (strict-mode null widening). The live tool path undoes that before it validates. The approval resume path does not. It validates the arguments from the message history as they are.
So with repairToolInput: false, an approved tool fails its own input check on resume:
Input validation failed for tool bookFlight: #/date: Instance type "null" is invalid. Expected "string"., #: Property "date" does not match additional properties schema., #/date: False boolean schema.
Received arguments: {"destination":"Tokyo","date":null}
With the default repairToolInput it passes, because the repair step happens to coerce the null away.
The two events for one tool call also disagree:
TOOL_CALL_ARGSdeltas, joined:{"destination":"Tokyo","date":null}TOOL_CALL_END.input:{"destination":"Tokyo"}
An AG-UI client rebuilds the assistant tool call from the TOOL_CALL_ARGS deltas. That is the history it sends back on resume.
Expected
The resume path undoes null widening on the history arguments the same way the live path does, whatever repairToolInput is set to. Or TOOL_CALL_ARGS streams the same arguments that TOOL_CALL_END.input reports.
Repro
@tanstack/ai 1.2.0, @tanstack/ai-openai 1.1.1, Node 22, OPENAI_API_KEY set.
import { chat, toolDefinition, maxIterations } from "@tanstack/ai";
import { openaiText } from "@tanstack/ai-openai";
const bookFlight = toolDefinition({
name: "bookFlight",
description: "Book a flight",
inputSchema: {
type: "object",
properties: { destination: { type: "string" }, date: { type: "string" } },
required: ["destination"],
additionalProperties: false,
},
needsApproval: true,
}).server(async () => ({ booked: true }));
const threadId = `repro-${Date.now()}`;
const user = { role: "user", content: "Book a flight to Tokyo. I have no date yet." };
// Run 1: pauses for approval.
const run1 = [];
for await (const chunk of chat({
adapter: openaiText("gpt-4o-mini"),
messages: [user],
tools: [bookFlight],
threadId,
runId: "r1",
})) run1.push(chunk);
const { toolCallId } = run1.find((e) => e.type === "TOOL_CALL_START");
const streamedArgs = run1
.filter((e) => e.type === "TOOL_CALL_ARGS" && e.toolCallId === toolCallId)
.map((e) => e.delta)
.join(""); // {"destination":"Tokyo","date":null}
// Run 2: approve, with the history a client rebuilt from the stream.
for await (const chunk of chat({
adapter: openaiText("gpt-4o-mini"),
messages: [
user,
{
role: "assistant",
content: "",
toolCalls: [
{ id: toolCallId, type: "function", function: { name: "bookFlight", arguments: streamedArgs } },
],
},
],
tools: [bookFlight],
threadId,
runId: "r2",
parentRunId: "r1",
resume: [{ interruptId: `approval_${toolCallId}`, status: "resolved", payload: { approved: true } }],
repairToolInput: false,
agentLoopStrategy: maxIterations(3),
})) {
if (chunk.type === "TOOL_CALL_RESULT") console.log(chunk.content); // input validation error
}
Results:
| Run 2 history args | repairToolInput |
Result |
|---|---|---|
from TOOL_CALL_ARGS deltas |
false |
input validation error, tool does not run |
from TOOL_CALL_ARGS deltas |
default | tool runs |
from TOOL_CALL_END.input |
false |
tool runs |
Where it shows up
CopilotKit's built-in agent runs on chat() and sets repairToolInput: false, so tool argument errors go back to the model. Every approved tool with an optional field fails on resume there.
- Ngôn ngữ chính
- TypeScript
- Star
- 3.3k
- Fork
- 378
- Merge trung bình
- 1 ngày 3 giờ
- Pull request đã merge (30 ngày)
- 253
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của TanStack/ai
-
openai-base: a Responses max_output_tokens cutoff ends as RUN_ERROR without usage instead of finishReason 'length'Có thể đã có người làm @tombeckenham đã nhận 9 ngày trước. Đang mởhas-pr waiting-on: maintainer
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
TanStack/ai#1916 · 1 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
feat(ai-anthropic): support native on-demand compactionCó thể đã có người làm @tombeckenham đã nhận hôm nay. Đang mởwaiting-on: maintainer
TanStack/ai#2081 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
@tanstack/openai-base: strict structured output skips $defs/definitions, so recursive zod schemas are rejectedCó thể đã có người làm @jherr đã nhận hôm nay. Đang mởhas-pr waiting-on: maintainer
TanStack/ai#2076 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
ai-sandbox: encrypt snapshot blobs at rest with an encrypting blob store wrapperCó thể đã có người làm @AlemTuzlak đã nhận 1 ngày trước. Đang mởwaiting-on: maintainer
TanStack/ai#2062 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Sandbox takeover: the saved transcript loses everything the first host delivered before the restartCó thể đã có người làm @tombeckenham đã nhận 1 ngày trước. Đang mởwaiting-on: maintainer
TanStack/ai#2061 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
binding:python bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
coollabsio/orbit#72 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug needs-triage potential-regression
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
aws/aws-sdk-js-v3#8408 ·
Maintainer thường phản hồi trong vòng 1 ngày