PR: AI User as reviewer causes error #2746
jbauer opened 2 months ago

AI user uses Mistral.ai with model devstral-2512 and only a very basic system prompt.

Adding the AI user as a reviewer results in the exception below. Before 15.0.1 I got "empty response" comments on the PR instead of the exception:

2026-04-27 18:31:17,333 ERROR [pool-3-thread-99] i.o.s.s.impl.DefaultUserService Error running AI task
dev.langchain4j.exception.InvalidRequestException: {"object":"error","message":"Assistant message must have either content or tool_calls, but not none.","type":"invalid_request_assistant_message","param":null,"code":"3240","raw_status_code":400}
	at dev.langchain4j.internal.ExceptionMapper$DefaultExceptionMapper.mapHttpStatusCode(ExceptionMapper.java:71)
	at dev.langchain4j.internal.ExceptionMapper$DefaultExceptionMapper.mapException(ExceptionMapper.java:44)
	at dev.langchain4j.internal.ExceptionMapper.withExceptionMapper(ExceptionMapper.java:31)
	at dev.langchain4j.internal.RetryUtils.lambda$withRetryMappingExceptions$2(RetryUtils.java:325)
	at dev.langchain4j.internal.RetryUtils$RetryPolicy.withRetry(RetryUtils.java:207)
	at dev.langchain4j.internal.RetryUtils.withRetry(RetryUtils.java:262)
	at dev.langchain4j.internal.RetryUtils.withRetryMappingExceptions(RetryUtils.java:325)
	at dev.langchain4j.internal.RetryUtils.withRetryMappingExceptions(RetryUtils.java:308)
	at dev.langchain4j.model.openai.OpenAiChatModel.doChat(OpenAiChatModel.java:149)
	at dev.langchain4j.model.chat.ChatModel.chat(ChatModel.java:46)
	at io.onedev.server.service.impl.DefaultUserService.lambda$execute$7(DefaultUserService.java:659)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at io.onedev.server.security.SecurityUtils.lambda$inheritSubject$1(SecurityUtils.java:648)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:840)
Caused by: dev.langchain4j.exception.HttpException: {"object":"error","message":"Assistant message must have either content or tool_calls, but not none.","type":"invalid_request_assistant_message","param":null,"code":"3240","raw_status_code":400}
	at dev.langchain4j.http.client.jdk.JdkHttpClient.execute(JdkHttpClient.java:53)
	at dev.langchain4j.model.openai.internal.SyncRequestExecutor.execute(SyncRequestExecutor.java:20)
	at dev.langchain4j.model.openai.internal.RequestExecutor.executeRaw(RequestExecutor.java:44)
	at dev.langchain4j.model.openai.OpenAiChatModel.lambda$doChat$0(OpenAiChatModel.java:150)
	at dev.langchain4j.internal.ExceptionMapper.withExceptionMapper(ExceptionMapper.java:29)
	... 14 common frames omitted
  • OneDev commented 2 months ago

    State changed as build OD-7309 (15.0.3) is successful

  • OneDev changed state to 'Closed' 2 months ago
    Previous Value Current Value
    Open
    Closed
  • jbauer commented 2 months ago

    @robin Thanks for fixing. I now have "empty reponse" comments again with the mentioned model. I temporarly switched back to OpenAI with some GPT variant to check if the AI user then creates a proper review and well..it does.

    I noticed that GPT first creates a reaction with "request for changes" or "approve" and after that the code review comment is added. With Mistral I directly receive a comment with "empty response" text. Could it be that Mistral might not call the tool for "request for changes / approve" correctly or only provides review text without any tool call and OneDev code logic might swallow the review text?

    I know prompt writing is super annoying with all the models and their different behaviors and I would be fine if your stance is that you cannot satisfy everyone with their model choice as long as internal prompts are not configurable. But I have a hard time to imagine that Mistral really doesn't respond back anything useful as the model has 123 billion parameters (https://docs.mistral.ai/models/model-cards/devstral-2-25-12)

  • Robin Shen commented 2 months ago

    I tested devstral-2512 via openrouter with some example PRs and it works quite solid.

    In 15.0.5, review action is placed under comments like normal user review. Also LLM is allowed to leave comment only if it needs more context for review. And later it can be mentioned again to review the PR.

1/1
Type
Bug
Priority
Normal
Assignee
Affected Versions
15.0.1
Labels
No labels
Issue Votes (0)
Watchers (3)
Reference
OD-2746
Please wait...
Connection lost or session expired, reload to recover
Page is in error, reload to recover