You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: Please help to disable SSL for custom LLM provider #229
Node.js 22’s built-in fetch is implemented by undici. Unlike legacy node-fetch, undici ignores the NODE_TLS_REJECT_UNAUTHORIZED environment variable. There is no per-request way to bypass TLS verification without replacing the global undici dispatcher.
Proposed fix
Add tlsRejectUnauthorized?: boolean to ProviderEntrySchema in packages/shared/src/config.ts.
Thread this field through:
provider-settings.ts → connection-ipc.ts and index.ts
Add apps/desktop/src/main/tls-override.ts — a reference-counted helper that swaps the global undici dispatcher before each request and restores it after:
Problem 2 — developer role rejected by non-OpenAI backends
Symptom
CodesignError: 400 service error: ValidationException:
Value 'developer' at 'messages.1.member.role' failed to satisfy constraint:
Member must satisfy enum value set: [user, assistant]
Root cause
pi-ai detects model IDs matching:
/((^|\/)claude-(?:opus|sonnet)-4)/i
…and sets model.reasoning = true, which causes the OpenAI SDK to send system prompts as role: "developer" (OpenAI o-series reasoning convention). Backends that strictly follow OpenAI Chat Completions — including AWS Bedrock — reject this role.
Proposed fix
Expose a capabilities.supportsReasoning field in ProviderEntrySchema. When set to false, inferReasoning() in packages/providers/src/wire-policy.ts returns false regardless of model ID heuristics, suppressing the developer role.
Update — splitting this into two threads so each can land independently.
✅ Part A: developer-role rejected by Bedrock — already solvable today
This path is wired up in the current tree. For any custom / imported provider that doesn't accept the developer role (Bedrock, certain corp gateways), set the capability explicitly in ~/.config/open-codesign/config.toml:
packages/providers/src/wire-policy.ts (inferReasoning()) honors this and falls back to the standard system role rather than developer. Tested at packages/providers/src/index.test.ts:745.
🚧 Part B: TLS bypass via undici setGlobalDispatcher — not implemented
Your proposed approach (ref-counted global dispatcher swap + tlsRejectUnauthorized field on provider schema) is the right shape — Node 22's built-in fetch is undici and does ignore NODE_TLS_REJECT_UNAUTHORIZED. I'm picking this up as a separate PR so it can be reviewed and shipped on its own; will link the PR here when it's open. Closing this issue now since Part A unblocks you immediately; the TLS work will continue on the dedicated PR.
Thanks again for the very thorough write-up — it saved a lot of investigation time.
Part A is indeed already wired – packages/providers/src/wire-policy.ts:75 respects supportsReasoning = false (test coverage at packages/providers/src/index.test.ts:745), so setting capabilities = { supportsReasoning = false } in the provider config will switch from developer to system role and unblock Bedrock users immediately.
Part B (TLS bypass) is correctly noted as not implemented yet. The proposed ref-counted setGlobalDispatcher approach is sound and avoids global state issues. We'll track that in the dedicated PR as you mentioned.
I'll leave the issue open per the plan; once the Part B PR is linked, a maintainer can close this. If the original reporter has any follow-up questions on Part A, feel free to ask.
Activity
github-actions commentedon Apr 25, 2026
感谢反馈,也感谢你把定位思路写得这么具体。
我按当前仓库代码核对了一下,这里可以确认两件事:
capabilities.supportsReasoning = false这条路径当前代码里是存在的,而且会进入实际生成请求。tlsRejectUnauthorized、setGlobalDispatcher()、rejectUnauthorized这类 TLS 绕过实现;目前只能确认到 SSL 诊断文案,没找到对应的配置字段或运行时接线。Relevant code:
packages/shared/src/config.ts:102—ProviderCapabilitiesSchema里包含supportsReasoningapps/desktop/src/main/provider-settings.ts:246— 解析 provider 的 capabilities / explicitCapabilitiesapps/desktop/src/main/index.ts:872— 生成时把active.capabilities和active.explicitCapabilities传到 provider 层packages/providers/src/wire-policy.ts:75—inferReasoning()会尊重自定义 provider 的supportsReasoning: falsepackages/providers/src/index.test.ts:745— 测试覆盖了自定义网关显式关闭 reasoning 的情况packages/shared/src/diagnostics.ts:144— SSL 错误会提示 “Disable TLS verify”,但当前树里我没有核实到对应功能实现按这份代码看,如果你当前的问题是 Bedrock / 自建 OpenAI 兼容网关不接受 reasoning / developer-role,那么
capabilities.supportsReasoning = false确实是现有实现里已经接通的一条规避路径。TLS 关闭开关这部分,在当前仓库里我这里只能确认“提示存在”,功能实现未找到。Need more info:
openai-chat还是openai-responses?baseUrl是什么?capabilities配置片段。补充一句,项目目前还是 pre-alpha,很多路线图里的能力还没完全落地;自定义 provider / 第三方网关兼容性这块还在持续补齐。
open-codesign Bot
skz-2026 commentedon Apr 25, 2026
Issue: Custom OpenAI-compatible providers fail with two compatibility errors
Environment
anthropic::claude-4-6-sonnet(viaopenai-chatwire)Problem 1 — TLS certificate errors with internal/self-signed CA
Symptom
Root cause
Node.js 22’s built-in
fetchis implemented by undici. Unlike legacynode-fetch, undici ignores theNODE_TLS_REJECT_UNAUTHORIZEDenvironment variable. There is no per-request way to bypass TLS verification without replacing the global undici dispatcher.Proposed fix
tlsRejectUnauthorized?: booleantoProviderEntrySchemainpackages/shared/src/config.ts.provider-settings.ts→connection-ipc.tsandindex.tsapps/desktop/src/main/tls-override.ts— a reference-counted helper that swaps the global undici dispatcher before each request and restores it after:Config example
Problem 2 — developer role rejected by non-OpenAI backends
Symptom
Root cause
pi-aidetects model IDs matching:/((^|\/)claude-(?:opus|sonnet)-4)/i…and sets
model.reasoning = true, which causes the OpenAI SDK to send system prompts asrole: "developer"(OpenAI o-series reasoning convention). Backends that strictly follow OpenAI Chat Completions — including AWS Bedrock — reject this role.Proposed fix
Expose a
capabilities.supportsReasoningfield inProviderEntrySchema. When set tofalse,inferReasoning()inpackages/providers/src/wire-policy.tsreturnsfalseregardless of model ID heuristics, suppressing thedeveloperrole.Config example
Files changed
packages/shared/src/config.tstlsRejectUnauthorizedandcapabilities.supportsReasoningto schemaapps/desktop/src/main/tls-override.tsapps/desktop/src/main/provider-settings.tstlsRejectUnauthorizedthrough resolutionapps/desktop/src/main/connection-ipc.tsapps/desktop/src/main/index.tsapps/desktop/src/main/onboarding-ipc.tstlsRejectUnauthorizedvia UIgithub-actions commentedon May 1, 2026
非常感谢您如此详尽的排查和修复方案,这非常有价值。
针对您提到的两个问题,我核对了一下当前仓库代码的状态:
1. Developer role 被 Bedrock 拒绝
这个问题已经在 changeset
fix-reasoning-flag-openai-compat.md中针对类似场景(issue #183)做了修复。涉及的代码路径包括:packages/providers/src/wire-policy.ts中的inferReasoning()会尊重自定义 provider 的supportsReasoning字段。packages/shared/src/config.ts的ProviderCapabilitiesSchema已经包含了supportsReasoning。capabilities = { supportsReasoning = false }时,pi-ai会使用标准的system角色而非developer,从而绕过 Bedrock 的校验。如果您当前的版本尚未包含该修复(该 changeset 还在
.changeset目录中,可能尚未发布),您可以手动应用类似逻辑,或者等待下一个版本(预计是 0.1.5 或 0.2.0)。2. SSL/TLS 绕过(
tlsRejectUnauthorized)我检查了代码树,目前没有找到您提到的
tlsRejectUnauthorized配置项、setGlobalDispatcher调用或相关的 TLS 绕过实现。packages/shared/src/diagnostics.ts中虽然包含 SSL 错误的诊断文案(如 "Disable TLS verify"),但并未提供实际的绕过机制。您的方案——通过 undici 的
setGlobalDispatcher在请求前后动态替换 dispatcher——是合理的。由于当前代码中所有 HTTP 请求都通过pi-ai发出,而pi-ai底层使用的是 Node.js 内置 fetch(即 undici),因此这个方案可以工作。但需要注意全局 dispatcher 的线程安全问题,您提供的引用计数模式是很好的实践。建议:
packages/providers/src/wire-policy.ts中是否存在supportsReasoning的判断逻辑)。如果已包含,直接配置即可;如果未包含,可以等待下一个版本或手动 cherry-pick。再次感谢您如此细致的分析,即使无法提交 PR,这些信息对维护者也极有帮助。我们已将您的方案记录在 issue 中供后续参考。
Relevant code:
packages/providers/src/wire-policy.ts—inferReasoning()逻辑(处理supportsReasoning)packages/shared/src/config.ts—ProviderCapabilitiesSchema定义packages/shared/src/diagnostics.ts:144— SSL 错误诊断文案.changeset/fix-reasoning-flag-openai-compat.md— 类似的 developer 角色修复Open-CoDesign Bot
hqhq1025 commentedon May 23, 2026
Update — splitting this into two threads so each can land independently.
✅ Part A: developer-role rejected by Bedrock — already solvable today
This path is wired up in the current tree. For any custom / imported provider that doesn't accept the
developerrole (Bedrock, certain corp gateways), set the capability explicitly in~/.config/open-codesign/config.toml:packages/providers/src/wire-policy.ts(inferReasoning()) honors this and falls back to the standardsystemrole rather thandeveloper. Tested atpackages/providers/src/index.test.ts:745.🚧 Part B: TLS bypass via undici
setGlobalDispatcher— not implementedYour proposed approach (ref-counted global dispatcher swap +
tlsRejectUnauthorizedfield on provider schema) is the right shape — Node 22's built-in fetch is undici and does ignoreNODE_TLS_REJECT_UNAUTHORIZED. I'm picking this up as a separate PR so it can be reviewed and shipped on its own; will link the PR here when it's open. Closing this issue now since Part A unblocks you immediately; the TLS work will continue on the dedicated PR.Thanks again for the very thorough write-up — it saved a lot of investigation time.
Open-CoDesign Maintainer
github-actions commentedon May 23, 2026
Thanks for the detailed breakdown, @hqhq1025.
Part A is indeed already wired –
packages/providers/src/wire-policy.ts:75respectssupportsReasoning = false(test coverage atpackages/providers/src/index.test.ts:745), so settingcapabilities = { supportsReasoning = false }in the provider config will switch fromdevelopertosystemrole and unblock Bedrock users immediately.Part B (TLS bypass) is correctly noted as not implemented yet. The proposed ref-counted
setGlobalDispatcherapproach is sound and avoids global state issues. We'll track that in the dedicated PR as you mentioned.I'll leave the issue open per the plan; once the Part B PR is linked, a maintainer can close this. If the original reporter has any follow-up questions on Part A, feel free to ask.
Open-CoDesign Bot
feat(desktop): add per-provider TLS verification bypass (#355)