Skip to content

fix(dsh): document the strict-mode switch for custom Responses providers - #2998

Merged
knqiufan merged 1 commit into
oceanbase:masterfrom
jasper-yl:fix/dsh-responses-tool-strict
Dec 3, 2026
Merged

knqiufan merged 1 commit into
oceanbase:masterfrom
jasper-yl:fix/dsh-responses-tool-strict

Conversation

@jasper-yl

Copy link
Copy Markdown
Contributor

Which issue or RFC does this PR close?

Closes #2996.

Rationale for this change

With the PowerContext plugin loaded in DeepSeek Harness, every request through a custom llm-pi-ai provider with api: openai-responses fails with server_error.

Cause: for a custom provider, pi-ai's openai-responses adapter defaults supportsStrictMode to false and then omits the strict field on function tools. OpenAI applies strict mode to a function tool that omits the field and fails on the 63 MCP tool schemas (129 anyOf nodes). Models that DSH serves from its installed catalog, such as the built-in openai provider, enable the switch and already send strict: false, so they are not affected.

The plugin cannot change the tool definitions DSH puts on the wire: the hooks it can reach are llm/stream (no compat access) and llm-pi-ai/request-headers (headers only), and the adapter maps tools to {name, description, parameters}. The schema-preserving fix is therefore the provider switch that @frf12 pointed to: compat.supportsStrictMode: true, at provider or model level. With it, DSH sends every function tool with strict: false and the schema unchanged.

What changes are included in this PR?

  • docs/{en,zh}/docs/integrations/dsh.md: a new section, "Use a custom Responses API provider", with the symptom, the switch, and which providers need it.
  • The documented PowerContext gateway provider example now sets the switch. It is a custom Responses provider, and the gateway forwards tool definitions as opaque JSON, so the example as previously written fails the same way while the MCP tools are registered.
  • tests/runtime/runtime.test.mjs: a real-host regression test. With a custom Responses provider that sets the switch, real DSH and a real Server, every mcp__powercontext__* tool reaches the model endpoint with strict: false and parameters deep-equal to the Server's MCP inputSchema. fixture.mjs answers the Responses API for this scenario and accepts extra patch rows and a provider/model override.

No plugin or Server code changes.

Are there any user-facing changes?

Documentation only. Users of a custom Responses provider must add compat.supportsStrictMode: true; a profile without it keeps failing. Sending strict: false by default for custom Responses providers would have to change in DSH / pi-ai.

How was this change tested?

Original setup from the issue (DSH 0.2.2-rc.5, pi-ai 1.7.0, headless profile, gpt-4.1-mini on api.openai.com, plugin and Server from master 9e40f8996), requests captured through a logging proxy:

Provider configuration Result Tools on the wire
No switch fails, 2 of 2 (server_error) 89 tools, strict absent
compat.supportsStrictMode: true on the provider passes, 2 of 2 89 tools with strict: false, 129 anyOf kept
Same switch on the model entry passes, 1 of 1 same
Switch on the provider, turn that calls mcp__powercontext__get_scope passes, tool call completes same
Built-in openai catalog provider, no switch passes, 1 of 1 89 tools with strict: false

Replaying the request body captured for the issue: as sent fails 2 of 2; with strict: false on every tool passes 4 of 4; with strict: false on the MCP tools only passes 2 of 2.

Automated:

  • pnpm --dir integrations/dsh/plugins/powercontext test:e2e:runtime: 20 of 20 pass, including the new test. The new test fails when the switch is removed from its provider. The pinned runtime (DSH 0.1.2-rc.1, pi-ai 0.84.4) has the same switch behavior as 0.2.2.
  • make docs-test: passes.
  • uv run prek run --files <changed files>: passes.

Not run: the gateway route end to end with the switch. That the gateway forwards tool definitions unchanged is from reading pc-gateway-protocol (tools: Vec<serde_json::Value>), not from a run.

The new test failed once on its first run in a fresh checkout, in cleanup (e2e Server did not exit, 50 s); four repeated runs and the full suite passed afterwards.

AI usage statement

Investigated, written and verified with Claude Code (Claude Fable 5), reviewed by the author.


中文摘要:自定义的 llm-pi-ai provider(api: openai-responses)发出的函数工具不带 strict 字段,OpenAI 默认按 strict 模式处理,在 PowerContext 的 63 个 MCP 工具 schema 上返回 server_error。插件无法改写 DSH 发出的工具定义,因此修复是 provider 配置 compat.supportsStrictMode: true,schema 不变。本 PR 在中英文文档中新增说明,给 gateway provider 示例加上该开关,并增加真实 DSH 的回归测试。原环境(DSH 0.2.2-rc.5、gpt-4.1-mini)验证:不带开关 2/2 失败,带开关全部通过,129 个 anyOf 保留。gateway 路径未实跑。

🤖 Generated with Claude Code

A custom llm-pi-ai provider with api: openai-responses sends function tools
without a strict field. OpenAI then applies strict mode and fails requests
that carry the PowerContext MCP tool definitions with server_error.

Document compat.supportsStrictMode in both locales, add it to the gateway
provider example, and cover the wire result with a real-host runtime test.

Closes oceanbase#2996

Co-Authored-By: Claude <noreply@anthropic.com>

@frf12 frf12 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documented provider setting preserves the MCP schemas while explicitly sending strict: false, and the runtime regression checks that behavior. No blocking issues found. The remaining CI checks should pass before merging.

@knqiufan knqiufan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@knqiufan
knqiufan merged commit 1a34cdc into oceanbase:master Dec 3, 2026
49 checks 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.

bug(dsh): OpenAI Responses requests fail with server_error once the plugin's MCP tools are registered

3 participants