tools: valid schemas; sse: surface in-stream errors
A judged request sends the whole tool list to the judge. Claude validates the
schemas and rejected the request with 400
"tools.22.function.parameters.type: Field required": delegate_due and
delegate_jobs declared "parameters": {} instead of an object schema. junction
wrapped that 400 in the stream as data: {"error":{...,"code":400}}, but the SSE
parser ignored anything that was not a choice - so the turn ended with
"stream ended with no answer" and the one line explaining it was lost. Three
sessions stopped that way at the same minute.
- delegate_due/delegate_jobs now carry {"type":"object","properties":{}}.
- test_engine walks every registered tool and fails when parameters.type is
not "object"; this catches the next schema before a judge does.
- sp_sse_line recognises a top-level error object, reports its message and
remembers its code; the transport puts the code in the reply status.
- a 4xx from the stream ends the turn with the real message and is not
retried; an empty 2xx stream and a 5xx still are. 402/429/529 stay with the
usage-limit path, which already handles them.
- test_sse feeds the junction 400 event and checks message and code.
- README and docs/PLUGINS say why a tool schema needs type:object.
make check: all tests passed.
This commit is contained in:
1 parent
0f8c5c7e96
commit
ddf0ec5462
9 files changed
+128
-11
No files matched your search
@@ -533,6 +533,8 @@ int sp_sse_line(struct sp_sse *, const char *line, struct sp_buf *out,
|
||||
/* Turn the accumulated state into a reply. Returns 0 or -1. */
|
||||
int sp_sse_finish(struct sp_sse *, struct sp_reply *out, struct sp_buf *err);
|
||||
int sp_sse_done(const struct sp_sse *);
|
||||
/* the code an in-stream error event carried, 0 if none */
|
||||
int sp_sse_error_code(const struct sp_sse *);
|
||||
int sp_sse_usage(const struct sp_sse *, long *in, long *out);
|
||||
const char *sp_sse_tool_start(const struct sp_sse *, size_t index);
|
||||
/* What the last line carried: SP_STREAM_THINK, SP_STREAM_TEXT, SP_STREAM_TOOL,
|
||||
|
||||
Reference in new issue
Block a user