zai-org / zai-org/feedback

[Bug] 连接测试不发送自定义 provider 的 headers,导致要求自定义请求头的网关测试必然失败(实际可用)

Open
#599 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

priority: P2
Dominant language
No language data
Stars
22
Forks
1
PR merge metrics
No merged PRs in 30d

Description

环境
复现步骤
  1. 设置 → 模型配置 → 添加自定义 OpenAI-Compatible provider,并在 provider 配置(~/.zcode/v2/config.json,provider 对象顶层)中加入 headers 字段:{"x-opencode-session": "<uuid>"}。OpenCode Go 要求每个请求都带 x-opencode-session 头(https://opencode.ai/docs/go/),headers 字段在 provider schema 中有定义(headers: Record<string, string>)。
  2. 完全退出并重启 ZCode,确认配置已加载。
  3. 点击该 provider 的"测试连接"。
实际行为
  • 与该 provider 正常对话完全可用;
  • 但"测试连接"始终失败,HTTP 400:MissingSessionID - Request is missing x-opencode-session

日志(~/.zcode/v2/logs/)中 [testModelConnectivity] request 记录的探针请求头只有:

{"content-type":"application/json","authorization":"Bearer …","User-Agent":"ZCode/unknown","HTTP-Referer":"https://zcode.z.ai","X-Title":"Z Code@electron"}

provider 配置的 headers 字段没有被合并进探针请求(重启后仍复现,可排除缓存)。

期望行为

连接测试探针应将 provider 的自定义 headers 字段合并发送,使测试结果与实际可用性一致。

影响

所有强制自定义请求头的网关(OpenCode Go、部分企业网关)都会出现"测试连接永远失败但实际完全可用",误导用户以为配置有误。

临时方案

无。实际对话使用不受影响(正式请求管线正常)。

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Locate the testModelConnectivity entry point and the provider schema or config loader described in the report. Compare the probe request headers with the normal conversation request, then verify the reported OpenCode Go reproduction; done means a provider-level x-opencode-session header is sent by the connectivity test and the test no longer fails with MissingSessionID.

Written by the indexing model from the issue text.

Assessment

Tech stack
electron
Domain
api, desktop
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.