Skip to content

fix(server): report LLM task input validation reasons - #112

Merged
l1shen merged 1 commit into
oomol-lab:mainfrom
yanjizhong:fix/llm-input-validation-reason
Sep 7, 2026
Merged

fix(server): report LLM task input validation reasons#112
l1shen merged 1 commit into
oomol-lab:mainfrom
yanjizhong:fix/llm-input-validation-reason

Conversation

@yanjizhong

Copy link
Copy Markdown
Contributor

Summary

Invalid LLM task input (for example a non-positive max_tokens or an unknown message role) failed with the generic llm.unavailable message "The LLM request could not be completed", hiding the actual cause.

Changes

  • apps/server/node/llm.ts: request-body construction moved into a requestBody helper that runs before the network phase. Input validation TypeErrors are mapped to a failed result that keeps the validation message; fetch and response failures keep the generic unavailable result.
  • apps/server/test/llm.test.ts: covers max_tokens and message-role validation failures and asserts fetch is not called for invalid input.

Motivation

The previous single catch conflated task input errors with transport failures. A user configuring an invalid max_tokens saw "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 existing provider-secret-detail test in service.test.ts).

Testing

  • bun run check and bun run test in apps/server.

@coderabbitai

coderabbitai Bot commented Sep 7, 2026

Copy link
Copy Markdown

Warning

Review limit reached

  • Run on-demand review

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.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: 311fde07-70c7-4ca0-8b4b-7cb737f08f4b

📥 Commits

Reviewing files that changed from the base of the PR and between 6f1e960 and c3277fe.

📒 Files selected for processing (2)
  • apps/server/node/llm.ts
  • apps/server/test/llm.test.ts

Comment @coderabbitai help to get the list of available commands.

@l1shen
l1shen merged commit 0d0064c into oomol-lab:main Sep 7, 2026
8 checks passed
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.

2 participants