fix(server): report LLM task input validation reasons - #112
Merged
Conversation
|
Warning Review limit reached
On-demand reviews are free for the next 13 days. After that, they cost $0.25 per reviewed file. Or wait 59 minutes for your next included review. View limit detailsLimit details: You’ve used the included review currently available. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (2)
Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Invalid LLM task input (for example a non-positive
max_tokensor an unknown message role) failed with the genericllm.unavailablemessage "The LLM request could not be completed", hiding the actual cause.Changes
apps/server/node/llm.ts: request-body construction moved into arequestBodyhelper that runs before the network phase. Input validationTypeErrors are mapped to a failed result that keeps the validation message; fetch and response failures keep the genericunavailableresult.apps/server/test/llm.test.ts: coversmax_tokensand message-role validation failures and assertsfetchis not called for invalid input.Motivation
The previous single
catchconflated task input errors with transport failures. A user configuring an invalidmax_tokenssaw "The LLM request could not be completed" and had no hint the problem was their own input. Validation failures are local and their messages are authored by this code, so surfacing them adds the missing diagnosis without exposing transport details, which stay generic (unchanged behavior asserted by the existingprovider-secret-detailtest inservice.test.ts).Testing
bun run checkandbun run testinapps/server.