Skip to content

The LLM client's literals read at the point of use, and its test servers answer politely - #542

Merged
WaylandYang merged 2 commits into
devfrom
chore/llm-errors-read-plainly
Sep 9, 2026
Merged

WaylandYang merged 2 commits into
devfrom
chore/llm-errors-read-plainly

Conversation

@WaylandYang

@WaylandYang WaylandYang commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #538, no behaviour change in the client.

  • Every literal that LLM errors preserve their response bodies #538 had pulled into a named constant is back at its point of use: "LLM", "Embedding" and "unknown error" in the client, and the twenty test fixtures ("hi", "user", "502 Bad Gateway", "界", the number one). A name earns its place when the value means something beyond itself or has to stay in step across sites; none of these did, and in a test the literal is the documentation. MAX_ERROR_DETAIL_CHARS keeps its name and gains the reason for 500 and for counting characters.
  • response_failure and err_detail get doc comments in this repository's voice: what changed, the LM Studio 400 that motivated it, and why a body that cannot be read is still Unreachable.
  • The six tests and three helpers get one-line comments saying what each pins, and the Unreachable doc sentence reads in one breath.
  • The raw-socket test servers now read the request (headers, then the body by Content-Length) before writing their answer and shut down cleanly. Written as they were, they closed the socket with the request unread; Windows answers that with RST and the client sees "connection aborted" (os error 10053) instead of the response, so two of the six tests failed on a Windows checkout while passing on the Linux CI. Same behaviour under test, now the same on both.

cargo test -p utopia-llm passes, three runs in a row on Windows.

🤖 Generated with Claude Code

WaylandYang and others added 2 commits September 9, 2026 17:51
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Signed-off-by: WaylandYang <wayland0916@gmail.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Signed-off-by: WaylandYang <wayland0916@gmail.com>
@WaylandYang
WaylandYang merged commit 1029a14 into dev Sep 9, 2026
4 checks passed
@WaylandYang
WaylandYang deleted the chore/llm-errors-read-plainly branch September 9, 2026 09:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant