You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 3af12d0
Browse filesBrowse the repository at this point in the historyBrowse files
hzq
committed
Reject impossible tool plans before dispatch
Preserve completed model usage and output without handing out tools whose empty replies cannot fit. Continue accepting the results of calls already issued.
Improvement-Round: 2/10 after v0.0.73
Copy file name to clipboardExpand all lines: docs/harness.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -163,6 +163,7 @@ Key points:
163
163
- For kernel agents, each result written to the model conversation is limited to **1 MiB of encoded JSON (UTF-8)**. An API may impose a smaller input limit. Caller text that parses as an object or array is measured after normalization; other text is returned unquoted but measured with JSON quotes and escapes. An oversized result fails the run with `payload_too_large` before another model call. None of that batch's tool replies are appended to the conversation; completed tool steps remain recorded.
164
164
- The kernel also checks the batch against the **2,000,000-byte conversation limit** before saving it. This includes the existing history, escaped replies, and the pinned system prompt or its mandatory prefix. A batch that cannot fit is not appended. When available tools or files change the final prompt, the exact request is checked again before dispatch.
165
165
- The final check includes the actual system prompt for that route. If the request does not fit, already completed steps remain recorded, but no new model attempt is saved or sent. At handoff the worker request must still match the admitted conversation; the byte count and digest used for that check are not recorded in public run events.
166
+
- A newly returned tool plan must also leave room for the assistant message and **one empty reply per call**, including the call IDs. If even this minimum cannot fit, the kernel does not run a tool, ask for approval, or hand the call to a client. The model turn, its reported usage and already produced output are retained; its rejected arguments are not saved as pending work. A plan that fits can still receive a larger result later. Already accepted calls, including those restored after an upgrade, follow the normal result and recovery paths. A final answer without tools needs no further turn.
166
167
- Only a valid return with new results can change the run to `tool_choice: "none"`. A bad batch or read-only replay leaves the option and output position unchanged. If storage cannot confirm a return, inspect the original run ID rather than executing the caller tools again.
167
168
- Streaming (`stream: true`): when the run parks, the frames are sent in this order: the role frame (with `content: null`, if one has not been sent before), one `tool_calls` delta frame per call (`index` starting at 0), the closing frame with `finish_reason: "tool_calls"`, then (if `include_usage` was requested) the usage frame and `[DONE]`. After continuation, the stream starts from where the last one ended and does not replay earlier text.
168
169
- When the arguments the model produces do not match the caller's schema, the call is not handed to the caller. Instead `{"error":"invalid_arguments","detail":...}` is returned to the model as the tool result so that it can fix the call and try again. This differs from argument errors of published tools (`invalid_tool_arguments`, where the run fails outright): the caller's schema is not under the publisher's control.
- 模型新提出工具计划时,还必须放得下这条助手消息,以及**每个调用带原 ID 的一条空回复**。连这个下限都超出时,内核不会运行工具、发起审批或将调用交给客户端。已发生的模型轮次、已上报用量和已产生的输出仍保留;拒绝的参数不会存为待执行工作。计划放得下,不代表实际返回的大结果一定放得下。已经受理的调用(包括升级后恢复的调用)仍按原流程接收结果;不再调用工具的最终答案无需预留下一轮。
166
167
- 只有包含新结果的有效回传才能把原运行改为 `tool_choice: "none"`。无效批次和只读重试都不会更改选项或输出位置。存储暂时不能确认回传时,请按原运行 ID 检查,不要重新执行调用方工具。
0 commit comments