[Bug]: DeepSeek Harness (dsh) fails with INVALID_REQUEST when "CLI default" (default) model is selected

オープン
#461 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@fx-kurumi がすでに取り組んでいます。

2026年11月13日 から。

  • #482 @fx-kurumi による — オープン

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
25/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
go
領域
ai, backend

調査の方向性

Start with the trace the issue gives: the placeholder model in internal/httpapi/assistant_models.go, the splitting in assistantModelEngine in internal/httpapi/assistant.go, and the AgentCLIDeepSeek branch of ApplyAgentCLICredential in internal/runtime/agent_cli.go. Pull request #482 is already open against this issue, so check its diff before starting. Done means a dsh request with the CLI default selected no longer sends model "default" to the DeepSeek API.

索引モデルが issue の本文から書いたものです。

説明

Component / host

Platform — web / API

Edition

Platform

LoopForge version

main at b751e09 (v0.3.6-29-gb751e09)

What happened?

When using DeepSeek Harness (dsh) in AI Chat and selecting the CLI default model option (model ID "default"), every message fails with "AI 助手生成失败,请稍后重试".

Switching the model selector to an explicit model such as DeepSeek V4.1 Flash (deepseek-flash) works immediately with the exact same API key.

Root cause in code:

  1. internal/httpapi/assistant_models.go returns a placeholder entry {ID: "default", Name: "CLI default"} for non-CodeBuddy executors (executor=dsh, etc.).
  2. internal/httpapi/assistant_engines.go (assistantRequestModel) prefixes it to "dsh:default", and internal/httpapi/assistant.go (assistantModelEngine) splits out engineModel = "default" without normalizing "default" to "" for non-CodeBuddy CLIs.
  3. internal/runtime/agent_cli.go (ApplyAgentCLICredential, case AgentCLIDeepSeek) only checks if model != "", so it writes {"id": "agent-default-model", "config": {"provider": "deepseek-official", "model": "default"}} into .dsh/agentflow-model.json via --patch, overriding dsh's own built-in default model.
  4. dsh sends "model": "default" to the DeepSeek API, which rejects it with 400 INVALID_REQUEST, and assistantGenerationFailure maps it to the generic "AI 助手生成失败,请稍后重试" error.

(Note: Other non-CodeBuddy CLIs such as Codex in assistant_engine_codex.go and other AgentCLI branches in agent_cli.go also pass model = "default" through instead of omitting it.)

Reproduction
  1. Configure a valid DeepSeek Harness API Key in personal settings (official endpoint, empty Base URL) and ensure dsh is installed.
  2. In AI Chat, switch the CLI selector to DeepSeek Harness and keep the model selector on CLI default (default).
  3. Send any message (e.g. hello??).
  4. Observe the failure (AI 助手生成失败,请稍后重试), while switching to DeepSeek V4.1 Flash succeeds.
Screenshots
Scenario Screenshot
DeepSeek Harness + CLI default fails 01-dsh-cli-default-failed.png
Switching model to DeepSeek V4.1 Flash 02-dsh-flash-selected.png
DeepSeek V4.1 Flash replies normally 03-dsh-flash-succeeded.png
Sanitized diagnostics
assistant CLI session=<redacted>: DeepSeek Harness 运行结束:error; stderr=[llm-deepseek-api-key] model listing from https://api.deepseek.com/models loaded 2 model(s), skipped 0 row(s) | dsh: INVALID_REQUEST: The supported API model names are deepseek-flash, deepseek-v4-pro, but you passed default. (request_id: <redacted>)
Safety checks
  • I removed credentials, private endpoints, internal identifiers, and personal data.
  • I searched existing issues for duplicates.
中文说明
组件 / 宿主

Platform — web / API

版本形态

Platform

LoopForge 版本

main 提交 b751e09(v0.3.6-29-gb751e09)

现象描述

在 AI 对话中切换为 DeepSeek Harness(dsh) 并保持模型选择器为 CLI default(模型 ID 为 "default")时,发送任意消息都会报错 "AI 助手生成失败,请稍后重试"。

使用同一把 API Key,只要把模型手动切换为 DeepSeek V4.1 Flash(deepseek-flash),即可立即正常回复。

代码根因定位:

  1. internal/httpapi/assistant_models.go 为非 CodeBuddy 执行器(如 executor=dsh)返回了占位模型 {ID: "default", Name: "CLI default"}。
  2. internal/httpapi/assistant_engines.go(assistantRequestModel)将其拼成 "dsh:default",随后 internal/httpapi/assistant.go(assistantModelEngine)拆出 engineModel = "default",但没有为非 CodeBuddy CLI 将 "default" 归一为空字符串 ""。
  3. internal/runtime/agent_cli.go(ApplyAgentCLICredential 的 AgentCLIDeepSeek 分支)只判断了 if model != "",直接把 {"id": "agent-default-model", "config": {"provider": "deepseek-official", "model": "default"}} 写入 .dsh/agentflow-model.json 并通过 --patch 注入,覆盖了 dsh 本身的内置默认模型。
  4. dsh 把 "model": "default" 发给 DeepSeek 接口后触发 400 INVALID_REQUEST,最终被 assistantGenerationFailure 兜底成 "AI 助手生成失败,请稍后重试"。

(附注:同构的非 CodeBuddy CLI 链路,如 assistant_engine_codex.go 与 agent_cli.go 其他分支,同样存在未将 "default" 归一为空字符串的问题。)

复现步骤
  1. 在个人配置中填写有效的 DeepSeek Harness API Key(默认官方端点,Base URL 留空)并确保 dsh 已安装。
  2. 在 AI 对话底部将 CLI 切换为 DeepSeek Harness,模型保持 CLI default(default)。
  3. 发送任意消息(例如 hello??)。
  4. 观察到报错 AI 助手生成失败,请稍后重试;将模型切换为 DeepSeek V4.1 Flash 后同一会话即可正常回复。
复现截图
场景 截图
DeepSeek Harness + CLI default 失败 01-dsh-cli-default-failed.png
切换为 DeepSeek V4.1 Flash 02-dsh-flash-selected.png
DeepSeek V4.1 Flash 正常回复 03-dsh-flash-succeeded.png
脱敏诊断日志
assistant CLI session=<redacted>: DeepSeek Harness 运行结束:error; stderr=[llm-deepseek-api-key] model listing from https://api.deepseek.com/models loaded 2 model(s), skipped 0 row(s) | dsh: INVALID_REQUEST: The supported API model names are deepseek-flash, deepseek-v4-pro, but you passed default. (request_id: <redacted>)
安全检查
  • 已移除所有凭据、私有端点、内部标识符与个人数据。
  • 已检索现有 Issue 确认无重复提交。
主要言語
Go
スター
141
フォーク
28
平均マージ
1日 15時間
マージ済み PR(30日)
113

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

Tencent/LoopForge のほかの issue

Tencent/LoopForge の issue をすべて見る

似ている issue

Go の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。