Skip to content

fix(request): pin strict: false on function tools missing Responses strictness - #294

Merged
ndycode merged 1 commit into
ndycode:mainfrom
SteveLTN:fix/responses-tool-strict-false
Oct 11, 2026
Merged

ndycode merged 1 commit into
ndycode:mainfrom
SteveLTN:fix/responses-tool-strict-false

Conversation

@SteveLTN

@SteveLTN SteveLTN commented Oct 10, 2026 •

Copy link
Copy Markdown

Summary

  • Function tools forwarded to the Codex Responses backend now carry an explicit strict: false when the host left strictness unset, applied at a single choke point in transformRequestForCodex so both the native (default) and legacy request-transform modes are covered.
  • Why: OpenCode v2's AI SDK adapter (@ai-sdk/openai) omits strict when 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 visibly sessionID on OpenCode's subagent tool, and fresh subagent creation fails with Subagent 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 to false (gitlab-ai-provider MR 48).
  • The behavior matches Codex CLI, which hardcodes strict: false on every function tool (codex-rs/tools/src/responses_api.rs), and OpenCode's own parity fix for its native providers (anomalyco/opencode#33392). Explicitly set strict values are preserved; hosted (non-function) tools are untouched.
  • Fixes [BUG] OpenCode V2 subagent calls fabricate sessionIDs when Responses tool strictness is omitted #293.

Testing

  • npm run lint
  • npm run build
  • npm run typecheck
  • npm test (5126 passed; 2 failures in request-hardening / storage-io-migration reproduce on unmodified main in this environment and are unrelated)
  • npm test -- test/doc-parity.test.ts
  • Not applicable

New coverage:

  • test/tool-utils.test.ts — unit tests for the new ensureFunctionToolStrictFalse helper: Responses flat shape, Chat Completions nested shape, explicit-value preservation, hosted-tool passthrough, non-array input.
  • test/fetch-helpers.test.ts — wire-level tests for transformRequestForCodex: native mode (classic shape), native mode on the responses-lite shape (tools inside the additional_tools input item), and legacy mode; all assert strict: false reaches the serialized body with required arrays intact.

End-to-end verification on a live install (OpenCode v2.0.26, plugin built from this branch): before the change, gpt-6-luna fabricated session IDs (ses_not_needed, …) and every fresh subagent call failed; after the change, fresh subagent delegation completes successfully.

Docs and Governance Checklist

  • README updated (if user-visible behavior changed) — not needed: internal request fix, no surface change
  • docs/getting-started.md updated (if onboarding flow changed) — not needed
  • docs/tools-and-cli.md updated (if the codex-* tool or CLI surface changed) — not needed
  • docs/configuration.md / docs/development/CONFIG_FIELDS.md updated (if config keys or env vars changed) — not needed: no new config keys or env vars
  • docs/upgrade.md updated (if migration or rename behavior changed) — not needed
  • SECURITY.md and CONTRIBUTING.md reviewed for alignment

Compliance Confirmation

  • This change stays within the repository scope and OpenAI Terms of Service expectations.
  • This change uses official authentication flows only and does not add bypass, scraping, or credential-sharing behavior.
  • I updated tests and documentation when the change affected users, maintainers, or repository behavior.

Notes

Summary by CodeRabbit

  • Bug Fixes
    • Function tools without an explicit strict setting are now sent with strict mode disabled across native, legacy, and lite request formats. Existing strict settings and non-function tools remain unchanged.

note: greptile review for oc-chatgpt-multi-auth. cite files like lib/foo.ts:123. confirm regression tests + windows concurrency/token redaction coverage.

RetriggerConfidence Score: 5/5

this change appears safe to merge.

Summary

defaults missing function-tool strict values to false before both request-transform modes.

  • Function tools without a strict setting keep optional arguments optional.

Reviews (1) · Last reviewed commit: "fix(request): pin strict: false on funct..." · Reviewed by Greptile

…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
@SteveLTN
SteveLTN requested a review from ndycode as a code owner October 10, 2026 07:59
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-10T08:03:43.069330Z 6498691 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: ndycode/oc-codex-multi-auth/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 42d20c65-435e-4645-ae33-4bcb34985446

📥 Commits

Reviewing files that changed from the base of the PR and between 9dd0012 and 6498691.


📒 Files selected for processing (4)
  • lib/request/fetch-helpers.ts
  • lib/request/helpers/tool-utils.ts
  • test/fetch-helpers.test.ts
  • test/tool-utils.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.



📝 Walkthrough

Walkthrough

Function tools without an explicit strict value now receive strict: false before native or legacy request transformation. Existing strictness values and other tool fields remain unchanged.

Changes

Function Tool Strictness

Layer / File(s) Summary
Strictness helper and utility tests
lib/request/helpers/tool-utils.ts, test/tool-utils.test.ts
Added ensureFunctionToolStrictFalse for Responses- and Chat Completions-shaped function tools. Tests cover non-array inputs, non-function tools, and preservation of existing values.
Request transformation integration
lib/request/fetch-helpers.ts, test/fetch-helpers.test.ts
transformRequestForCodex applies the helper before native or legacy transformation. Tests check canonical and serialized bodies, including the lite representation.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~12 minutes

Change: Bug fix · Severity of issue fixed: Medium


Merge Risk: ⚪ Minimal · up to 64986

The change appears ready to merge after normal checks; no actionable risk remains from this review.

Pre-merge checks | Passed 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: setting strict: false on function tools when Responses strictness is missing.
Description check Passed The description is complete. It explains what changed, why it was needed, testing results, new coverage, documentation impact, governance checks, compliance, and the linked issue.
Linked Issues check Passed Issue #293 requires fresh subagent calls to omit sessionID and complete successfully. The PR applies strict: false only when function-tool strictness is unset, before both native and legacy reques…
Out of Scope Changes check Passed The reported changes are limited to the strictness helper, its integration in transformRequestForCodex, and focused unit and wire-level tests. These changes support issue #293 directly. No unrelated…
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 4 files.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@ndycode

ndycode commented Oct 11, 2026

Copy link
Copy Markdown
Owner

Shipping verdict: PASS — verified independently against head 6498691 with CI green and no unresolved threads.

@ndycode
ndycode merged commit 078a26b into ndycode:main Oct 11, 2026
2 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] OpenCode V2 subagent calls fabricate sessionIDs when Responses tool strictness is omitted

2 participants