Skip to content

[BUG] CLI fails after an error is out #474

@edenreich

Description

@edenreich

Summary

The API call is missing reasoning_content and the messages is corrupted when the command that the agent executed fails and the agent is loading until the API sends back 400 error.

We must ensure that the sequence of the messages is correct so the API of the vendor doesn't throw 400.

Steps to reproduce

  1. Ask the agent to run a command that you know it will fail (non-zero status)
  2. The agent will transition into attempting to fix the error, but then it will load forever
  3. The API will throw 400 bad request - bad sequence of messages

Logs

{"level":"info","timestamp":"2026-04-29T19:58:56.099+0200","caller":"middlewares/logger.go:24","msg":"request received","method":"POST","host":"localhost:8080","path":"/v1/chat/completions"}
{"level":"info","timestamp":"2026-04-29T19:58:56.102+0200","caller":"middlewares/logger.go:24","msg":"request received","method":"POST","host":"0.0.0.0:8080","path":"/proxy/deepseek/chat/completions"}
{"level":"error","timestamp":"2026-04-29T19:58:56.537+0200","caller":"core/provider.go:128","msg":"non-200 status code","provider":"Deepseek","statusCode":400,"operation":"Error generating streaming chat completion","error":"{\"error\":{\"message\":\"The `reasoning_content` in the thinking mode must be passed back to the API.\",\"type\":\"invalid_request_error\",\"param\":null,\"code\":\"invalid_request_error\"}}"}
{"level":"error","timestamp":"2026-04-29T19:58:56.537+0200","caller":"api/routes.go:589","msg":"failed to start streaming","provider":"deepseek","error":"{\"error\":{\"message\":\"The `reasoning_content` in the thinking mode must be passed back to the API.\",\"type\":\"invalid_request_error\",\"param\":null,\"code\":\"invalid_request_error\"}}"}
{"level":"info","timestamp":"2026-04-29T19:59:06.542+0200","caller":"middlewares/logger.go:24","msg":"request received","method":"POST","host":"localhost:8080","path":"/v1/chat/completions"}
{"level":"info","timestamp":"2026-04-29T19:59:06.543+0200","caller":"middlewares/logger.go:24","msg":"request received","method":"POST","host":"0.0.0.0:8080","path":"/proxy/deepseek/chat/completions"}
{"level":"error","timestamp":"2026-04-29T19:59:06.909+0200","caller":"core/provider.go:128","msg":"non-200 status code","provider":"Deepseek","statusCode":400,"operation":"Error generating streaming chat completion","error":"{\"error\":{\"message\":\"The `reasoning_content` in the thinking mode must be passed back to the API.\",\"type\":\"invalid_request_error\",\"param\":null,\"code\":\"invalid_request_error\"}}"}
{"level":"error","timestamp":"2026-04-29T19:59:06.909+0200","caller":"api/routes.go:589","msg":"failed to start streaming","provider":"deepseek","error":"{\"error\":{\"message\":\"The `reasoning_content` in the thinking mode must be passed back to the API.\",\"type\":\"invalid_request_error\",\"param\":null,\"code\":\"invalid_request_error\"}}"}
{"level":"info","timestamp":"2026-04-29T19:59:17.452+0200","caller":"middlewares/logger.go:24","msg":"request received","method":"POST","host":"localhost:8080","path":"/v1/chat/completions"}
{"level":"info","timestamp":"2026-04-29T19:59:17.453+0200","caller":"middlewares/logger.go:24","msg":"request received","method":"POST","host":"0.0.0.0:8080","path":"/proxy/deepseek/chat/completions"}
{"level":"error","timestamp":"2026-04-29T19:59:17.940+0200","caller":"core/provider.go:128","msg":"non-200 status code","provider":"Deepseek","statusCode":400,"operation":"Error generating streaming chat completion","error":"{\"error\":{\"message\":\"The `reasoning_content` in the thinking mode must be passed back to the API.\",\"type\":\"invalid_request_error\",\"param\":null,\"code\":\"invalid_request_error\"}}"}
{"level":"error","timestamp":"2026-04-29T19:59:17.940+0200","caller":"api/routes.go:589","msg":"failed to start streaming","provider":"deepseek","error":"{\"error\":{\"message\":\"The `reasoning_content` in the thinking mode must be passed back to the API.\",\"type\":\"invalid_request_error\",\"param\":null,\"code\":\"invalid_request_error\"}}"}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingreleased

    Type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions