fix: Disable strict mode tools for non-native openai-completions compatible APIs#41457
fix: Disable strict mode tools for non-native openai-completions compatible APIs#41457sahancava wants to merge 21 commits intoopenclaw:mainfrom
Conversation
Greptile SummaryThis PR extends the Production logic: The implementation in Test coverage: While the new functionality is tested indirectly in existing tests (particularly the "does not mutate" and "does not override explicit compat false" cases), the newly added Confidence Score: 4/5
Last reviewed commit: 60af3fe |
a502149 to
73c1785
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 18f4a131d7
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6f2e7ac79a
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
4bb729e to
e522e12
Compare
1a40d97 to
c1a6780
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c1a6780b35
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
Closing this PR because it looks dirty (too many unrelated or unexpected changes). This usually happens when a branch picks up unrelated commits or a merge went sideways. Please recreate the PR from a clean branch. |
5 similar comments
|
Closing this PR because it looks dirty (too many unrelated or unexpected changes). This usually happens when a branch picks up unrelated commits or a merge went sideways. Please recreate the PR from a clean branch. |
|
Closing this PR because it looks dirty (too many unrelated or unexpected changes). This usually happens when a branch picks up unrelated commits or a merge went sideways. Please recreate the PR from a clean branch. |
|
Closing this PR because it looks dirty (too many unrelated or unexpected changes). This usually happens when a branch picks up unrelated commits or a merge went sideways. Please recreate the PR from a clean branch. |
|
Closing this PR because it looks dirty (too many unrelated or unexpected changes). This usually happens when a branch picks up unrelated commits or a merge went sideways. Please recreate the PR from a clean branch. |
|
Closing this PR because it looks dirty (too many unrelated or unexpected changes). This usually happens when a branch picks up unrelated commits or a merge went sideways. Please recreate the PR from a clean branch. |
|
Closing this PR because it looks dirty (too many unrelated or unexpected changes). This usually happens when a branch picks up unrelated commits or a merge went sideways. Please recreate the PR from a clean branch. |
14 similar comments
|
Closing this PR because it looks dirty (too many unrelated or unexpected changes). This usually happens when a branch picks up unrelated commits or a merge went sideways. Please recreate the PR from a clean branch. |
|
Closing this PR because it looks dirty (too many unrelated or unexpected changes). This usually happens when a branch picks up unrelated commits or a merge went sideways. Please recreate the PR from a clean branch. |
|
Closing this PR because it looks dirty (too many unrelated or unexpected changes). This usually happens when a branch picks up unrelated commits or a merge went sideways. Please recreate the PR from a clean branch. |
|
Closing this PR because it looks dirty (too many unrelated or unexpected changes). This usually happens when a branch picks up unrelated commits or a merge went sideways. Please recreate the PR from a clean branch. |
|
Closing this PR because it looks dirty (too many unrelated or unexpected changes). This usually happens when a branch picks up unrelated commits or a merge went sideways. Please recreate the PR from a clean branch. |
|
Closing this PR because it looks dirty (too many unrelated or unexpected changes). This usually happens when a branch picks up unrelated commits or a merge went sideways. Please recreate the PR from a clean branch. |
|
Closing this PR because it looks dirty (too many unrelated or unexpected changes). This usually happens when a branch picks up unrelated commits or a merge went sideways. Please recreate the PR from a clean branch. |
|
Closing this PR because it looks dirty (too many unrelated or unexpected changes). This usually happens when a branch picks up unrelated commits or a merge went sideways. Please recreate the PR from a clean branch. |
|
Closing this PR because it looks dirty (too many unrelated or unexpected changes). This usually happens when a branch picks up unrelated commits or a merge went sideways. Please recreate the PR from a clean branch. |
|
Closing this PR because it looks dirty (too many unrelated or unexpected changes). This usually happens when a branch picks up unrelated commits or a merge went sideways. Please recreate the PR from a clean branch. |
|
Closing this PR because it looks dirty (too many unrelated or unexpected changes). This usually happens when a branch picks up unrelated commits or a merge went sideways. Please recreate the PR from a clean branch. |
|
Closing this PR because it looks dirty (too many unrelated or unexpected changes). This usually happens when a branch picks up unrelated commits or a merge went sideways. Please recreate the PR from a clean branch. |
|
Closing this PR because it looks dirty (too many unrelated or unexpected changes). This usually happens when a branch picks up unrelated commits or a merge went sideways. Please recreate the PR from a clean branch. |
|
Closing this PR because it looks dirty (too many unrelated or unexpected changes). This usually happens when a branch picks up unrelated commits or a merge went sideways. Please recreate the PR from a clean branch. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b656019a35
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
Branch cleanup is complete.
I force-pushed GitHub now rejects reopening this PR with: Replacement clean PR: #45497 |
Summary
Describe the problem and fix in 2–5 bullets:
openai-completionsAPI type andcompat.supportsTools: true, tool calling fails natively. The model receives an invalid payload and outputs raw Markdown blocks instead (e.g.bash exec --command...).@mariozechner/pi-ailibrary natively injects"strict": falseinto all tool schemas by default due to newer OpenAI API constraints.normalizeModelCompatinterceptor insrc/agents/model-compat.tsto automatically default tosupportsStrictMode: falsefor all non-nativeopenai-completionsendpoints.compat.supportsStrictMode: true) are now preserved, allowing an escape hatch for true API native proxies masquerading under vanity URLs.src/agents/model-compat.test.tsto assert that non-native proxies (like DashScope, proxy URLs, etc) natively drop the"strict"schema wrapper, while preserving explicit true overrides.@mariozechner/pi-aiupstream payload generator behavior remains unmodified.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
User-visible / Behavior Changes
Users configuring third-party OpenAI-compatible providers in their
openclaw.json(such as DashScope, MoonShot, DeepSeek APIs) withcompat.supportsTools: truewill now see the models effectively utilizing configured agent tools correctly via the nativetool_callsparameter finish reasons instead of plaintext.Security Impact (required)
Yes, explain risk + mitigation: N/ARepro + Verification
Environment
openai-completionsviabailian(Alibaba DashScope) /qwen3-coder-plushttps://coding.dashscope.aliyuncs.com/v1withcompat.supportsTools: true.Steps
openclaw agent --agent main --local -m "Run echo test".Expected
Actual
strict: false) sent by pi-ai and defaulted back to treating tools purely as string context.Evidence
Attach at least one:
(Note: Unit assertions were added into
src/agents/model-compat.test.tssuccessfully validating flag fallback propagation).Human Verification (required)
What you personally verified (not just CI), and how:
@mariozechner/pi-ai, demonstrating that omittingstrictsuccessfully forces the compatible API to accept tool mappings.api.openai.comnative domains maintainstrict: falseschema logic correctly. Explicitly verified that test cases assertingcompat.supportsStrictMode: trueoverrides are correctly preserved.Review Conversations
Compatibility / Migration
YesFailure Recovery (if this breaks)
Risks and Mitigations
baseUrlis unrecognized."compat": { "supportsStrictMode": true }inside their custom configuration to force overrides back on. This PR explicitly implemented checking for this escape-hatch to make it safe.