Skip to content

fix(v2): pin strict:false on function tools that omit it - #295

Merged
ndycode merged 3 commits into
mainfrom
fix/subagent-sessionid-strict-293
Oct 11, 2026
Merged

ndycode merged 3 commits into
mainfrom
fix/subagent-sessionid-strict-293

Conversation

@ndycode

@ndycode ndycode commented Oct 11, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • What changed? The V2 adapter's language-model wrapper now defaults strict:false onto function tools that don't declare strict, before @ai-sdk/openai serializes them into the Responses request body. Explicit strict values are preserved.
  • Why is this needed? The SDK only writes strict when a tool declares it, and the Codex backend treats an omitted flag as strict-mode structured output: every declared schema property becomes required. OpenCode's task tool marks sessionID optional, so the model fabricates one and fresh subagent calls die with Subagent session not found. Reported against OpenCode 2.0.24 + plugin 6.28.0; the reporter verified a local strict:false patch restores subagent round-trips.
 doGenerate / doStream options
   providerOptions.openai   store:false, drop previousResponseId/conversation   (existing)
+  tools[]                  function tools get strict:false when unset

Testing

  • npm run lint

  • npm run build

  • npm run typecheck

  • npm test

  • npm test -- test/doc-parity.test.ts

  • Not applicable

  • Before: new it.each(doGenerate, doStream) case fails — the captured Responses body serializes task with no strict field:

expect(tools.find((tool) => tool.name === "task")).toMatchObject({ strict: false })
  → received { type: "function", name: "task", description, parameters, /* no strict */ }
Tests  2 failed | 24 skipped
  • After: same run passes — the wire body carries strict:false on the unmarked tool and keeps strict:true on an explicitly-strict tool:
Test Files  1 passed (1)   test/opencode-v2.test.ts
Tests  26 passed (26)

Note on npm test: this Windows dev box shows 25 pre-existing failures in storage/paths/installer/stress suites (POSIX mode bits, FIFOs, ADMINI~1 8.3 realpath, fsync/lock semantics). Reproduced identically on clean main — unrelated to this diff. The touched suite is fully green.

Docs and Governance Checklist

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

No docs touched — internal request-shaping fix, no user-visible surface change beyond the bug being gone.

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

Merge Danger

Door: two-way — a one-line default inside the existing options transform; revert restores prior behavior.

Blast Radius: V2 function-tool serialization only. V1 path untouched; tools that explicitly set strict keep their value; provider-defined tools are passed through unmodified.

Summary by CodeRabbit

  • Bug Fixes
    • Function tools without an explicitly configured strictness setting are now sent with strictness disabled, for both generated and streamed responses.
    • Explicit strictness settings are preserved, and tool definitions 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

the pr appears safe to merge; the previous coverage gap is addressed.

Summary

the v2 adapter adds strict:false to function tools that omit it. explicit values stay unchanged, and provider tools pass through.

  • V2 requests keep optional function arguments optional.

Reviews (2) · Last reviewed commit: "test(v2): cover explicit strict:false an..." · Reviewed by Greptile

The Codex backend reads an omitted strict flag as strict-mode structured
output: every declared schema property becomes required, so the model
fabricates values for optional args like the task tool's sessionID and
fresh subagent calls die with "Subagent session not found".

Closes #293
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 11, 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-11T13:21:29.703428Z 1c3c3a5 New commits
ℹ️ 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 11, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 39 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Repository: ndycode/oc-codex-multi-auth/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4505b48c-f746-403a-a55c-ddc30c0891b7

📥 Commits

Reviewing files that changed from the base of the PR and between 8872f77 and 1c3c3a5.


📒 Files selected for processing (1)
  • test/opencode-v2.test.ts

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: 3d436e14-5296-436c-8217-887da8a407a8


📥 Commits

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



📒 Files selected for processing (2)
  • lib/opencode-v2.ts
  • test/opencode-v2.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

Walkthrough

The OpenCode V2 adapter now sets strict: false for function tools when strict is nullish. Generation and streaming apply this adjustment before the existing stateless-option transformation. Tests cover serialized options and confirm the input tool definition remains unchanged.

Changes

OpenCode V2 tool strictness

Layer / File(s) Summary
Default strictness for function tools
lib/opencode-v2.ts, test/opencode-v2.test.ts
Generation and streaming default nullish function-tool strict values to false, while preserving explicit values. Tests verify request serialization and input immutability.

Priority: ➖ Normal

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

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: lubshad



Merge Risk: ⚪ Minimal · up to 8872f

No actionable merge-blocking risk is identified; the change is mergeable after normal checks.

Pre-merge checks | Passed 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check Passed The title clearly identifies the main change: defaulting omitted function-tool strictness to false in the V2 path.
Description check Passed The description follows the required template, explains the change and rationale, documents testing results and known unrelated failures, completes governance and compliance sections, and records issu…
Linked Issues check Passed Issue #293 requires fresh V2 subagent calls to omit fabricated sessionID values. lib/opencode-v2.ts applies strict: false to function tools with nullish strict values before both doGenerate …
Out of Scope Changes check Passed The reviewed changes are limited to V2 request shaping and its automated regression test. The implementation changes only function-tool strictness in the existing doGenerate and doStream transform…
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 1 functions across 2 files.



✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR



🧪 Generate unit tests (beta)
  • Commit to this branch
  • 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.

Comment thread test/opencode-v2.test.ts Resolved
@ndycode

ndycode commented Oct 11, 2026

Copy link
Copy Markdown
Owner Author

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

@ndycode
ndycode merged commit 1824085 into 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