Repository navigation
fix(request): pin strict: false on function tools missing Responses strictness - #294
Conversation
…trictness OpenCode's AI SDK adapter omits `strict` when serializing function tools for the Responses API, and the backend treats an omitted flag as strict mode: every schema property becomes effectively required. Models then fabricate values for optional parameters — notably `sessionID` on OpenCode's subagent tool — and fresh subagent creation fails with "Subagent session not found" / "not a child of the current session". Fill in `strict: false` on function tools that don't set it, at the single choke point in transformRequestForCodex so both the native and legacy transform modes are covered. Explicitly set values are preserved; hosted (non-function) tools are untouched. This matches Codex CLI, which hardcodes strict: false on every function tool (codex-rs/tools/src/responses_api.rs), and OpenCode's own fix for its native providers (anomalyco/opencode#33392). Fixes ndycode#293
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to The change appears ready to merge after normal checks; no actionable risk remains from this review. Pre-merge checks |
|
|
Shipping verdict: PASS — verified independently against head 6498691 with CI green and no unresolved threads. |
Summary
strict: falsewhen the host left strictness unset, applied at a single choke point intransformRequestForCodexso both thenative(default) andlegacyrequest-transform modes are covered.@ai-sdk/openai) omitsstrictwhen serializing function tools, and the Responses backend treats an omitted flag as strict mode — every schema property becomes effectively required. Models then fabricate values for optional parameters, most visiblysessionIDon OpenCode'ssubagenttool, and fresh subagent creation fails withSubagent session not found/Session <id> is not a child of the current session. This is the same mechanism behind the GitLab Duo failures in anomalyco/opencode#51464, which GitLab fixed provider-side by defaulting unspecified Responses tool strictness tofalse(gitlab-ai-provider MR 48).strict: falseon every function tool (codex-rs/tools/src/responses_api.rs), and OpenCode's own parity fix for its native providers (anomalyco/opencode#33392). Explicitly setstrictvalues are preserved; hosted (non-function) tools are untouched.Testing
npm run lintnpm run buildnpm run typechecknpm test(5126 passed; 2 failures inrequest-hardening/storage-io-migrationreproduce on unmodifiedmainin this environment and are unrelated)npm test -- test/doc-parity.test.tsNew coverage:
test/tool-utils.test.ts— unit tests for the newensureFunctionToolStrictFalsehelper: Responses flat shape, Chat Completions nested shape, explicit-value preservation, hosted-tool passthrough, non-array input.test/fetch-helpers.test.ts— wire-level tests fortransformRequestForCodex: native mode (classic shape), native mode on the responses-lite shape (tools inside theadditional_toolsinput item), and legacy mode; all assertstrict: falsereaches the serialized body withrequiredarrays intact.End-to-end verification on a live install (OpenCode v2.0.26, plugin built from this branch): before the change,
gpt-6-lunafabricated session IDs (ses_not_needed, …) and every fresh subagent call failed; after the change, fresh subagent delegation completes successfully.Docs and Governance Checklist
docs/getting-started.mdupdated (if onboarding flow changed) — not neededdocs/tools-and-cli.mdupdated (if thecodex-*tool or CLI surface changed) — not neededdocs/configuration.md/docs/development/CONFIG_FIELDS.mdupdated (if config keys or env vars changed) — not needed: no new config keys or env varsdocs/upgrade.mdupdated (if migration or rename behavior changed) — not neededSECURITY.mdandCONTRIBUTING.mdreviewed for alignmentCompliance Confirmation
Notes
stricton the current release line; this plugin-side fix is version-independent and matches Codex CLI behavior, so it stays correct even if OpenCode later fixes its adapter (an explicitstrict: falsefrom the host would simply be preserved as-is).Summary by CodeRabbit
note: greptile review for oc-chatgpt-multi-auth. cite files like
lib/foo.ts:123. confirm regression tests + windows concurrency/token redaction coverage.
Confidence Score: 5/5
this change appears safe to merge.Summary
defaults missing function-tool
strictvalues tofalsebefore both request-transform modes.Reviews (1) · Last reviewed commit: "fix(request): pin strict: false on funct..." · Reviewed by Greptile