Repository navigation
LLM errors preserve their response bodies - #538
Conversation
Signed-off-by: Ben Younes <2910651+ousamabenyounes@users.noreply.github.com>
4e13015 to
da5c53e
Compare
|
Merged. This is the fix #527 asked for, in the shape it asked for: the body is read once as text, the status is checked before anything is parsed as JSON, the three JSON shapes are tried and the raw text is quoted otherwise, capped at 500 characters, and a body that cannot be read at all stays The tests are the useful part: one raw-socket server per case, every request path covered for the non-JSON body, the incomplete body pinned as unreachable, and the multibyte truncation counted in characters. Thanks for reading the issue's test list and writing to it. One habit to mention for next time, not a blocker: the constants pulled out of the tests and the production code ( |
|
One thing you could not have seen from Linux: the raw-socket servers in the tests wrote their answer and closed without reading the request. Windows answers an unread socket with RST, so the client got "connection aborted" (os error 10053) instead of the body, and two of the six tests failed on a Windows checkout while passing on CI. #542 has them read the request first and shut down cleanly; behaviour under test is unchanged. Worth knowing for the next fake server. The same PR puts the literals back at their point of use, as mentioned above. |
Summary
Closes #527.
Test verification (RED → GREEN)
On unmodified
dev, a local endpoint returning502 Bad Gatewaywithproxy says the model context is too longfailed as:The same regression test passes after the patch and includes the endpoint diagnosis in the error.
Validation
cargo test -p utopia-llm: 17 passed, 0 failed.Unreachableclassification.devatcb996aa: migrations twice, formatting, workspace clippy with warnings denied, workspace tests, required DB-backed store tests, workspace build, and frozen-lockfile web tests/build all passed.