Skip to content

fix(cli): show the old-backend hint when call --preview gets a 400 - #81

Merged
dxiongya merged 1 commit into
devfrom
feature/sandbox-to-preview
Nov 25, 2026
Merged

dxiongya merged 1 commit into
devfrom
feature/sandbox-to-preview

Conversation

@dxiongya

Copy link
Copy Markdown
Collaborator

自查发现:call --preview 连到还不支持 preview 的后端时会返回 400,但输出里没有「后端版本不支持」的提示。list、get 等命令都有这个提示。

原因:call 的报错由 actionErrorDetail 根据响应体重新组装,withPreviewHint 加在 HttpError message 上的提示就丢了。call、--stream、--output 三条路径都受影响。

修复:在 actionErrorDetail 里统一处理。如果是 400 且错误内容提到 include_preview,就在输出里加上 hint 字段。提示文案和 withPreviewHint 共用同一个常量。其他 400 不受影响。

验证:新增回归测试,覆盖带 include_preview 的 400 和普通 400 两种情况;bun test 1540 个通过、0 个失败;tsc --noEmit 通过。

Kanby-Task: KANBY-141

🤖 Generated with Claude Code

call rebuilds its error from the response body in actionErrorDetail, so
the hint withPreviewHint appends to the HttpError message never reached
the output (call, --stream and --output alike). Add it as the detail's
hint field when a 400 mentions include_preview; other 400s are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dxiongya
dxiongya merged commit 094eb48 into dev Nov 25, 2026
1 check 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.

1 participant