Skip to content

fix(openai): preserve composed tool schema contracts - #4113

Merged
lidge-jun merged 1 commit into
devfrom
codex/preserve-composed-tool-schemas
Sep 9, 2026
Merged

fix(openai): preserve composed tool schema contracts#4113
lidge-jun merged 1 commit into
devfrom
codex/preserve-composed-tool-schemas

Conversation

@lidge-jun

@lidge-jun lidge-jun commented Sep 9, 2026

Copy link
Copy Markdown
Owner

Summary

Preserve regex-keyed tool schemas instead of dropping patternProperties entries based on local openness. In an allOf subschema, removing the matcher can erase the property-evaluation evidence required by an outer unevaluatedProperties: false; with minProperties: 1, a usable dictionary tool becomes unsatisfiable. This addresses the remaining composition finding on #4096.

The original scalar Artifact pattern repair remains in ordinary positive positions. Negation, exclusive alternatives, conditions, contains, and reusable definitions pass through unchanged because a local relaxation can narrow the containing schema. Both Chat and Responses adapter regression cases preserve the original allOf/not/oneOf argument contract. English and Korean guidance states that unsupported preserved regexes remain the destination's responsibility.

Co-authored-by: itismyfield itismyfield@users.noreply.github.com

Verification

  • Source inspection and JSON Schema's object/composition rules confirmed the evaluation and polarity failure; no new validator or dependency was introduced.
  • Added full buildRequest regressions for both adapter paths and controls for scalar repair beside preserved subtrees. Existing literal-property and deep-walk coverage remains.
  • git diff --check: passed.
  • Local product tests, typecheck, builds and install: NOT RUN under the owner's explicit restriction. Hosted CI on this exact PR head is required before the repaired release candidate is certified.
  • Earlier final-dev CI 34344190221 passed 26/26 jobs at b5c9833; it did not cover these missing composition scenarios and is not proof of this correction.

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed.
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults; this correction changes schema normalization without changing credentials or routing.

Summary by CodeRabbit

  • Bug Fixes

    • Improved handling of Unicode-property regular-expression constraints in tool schemas.
    • Preserves schema patterns and composed constraints in nested conditions and property matchers, allowing the destination service to validate them.
    • Prevents unintended removal of schema rules during OpenAI Chat and Responses requests.
    • Constraints omitted by compatibility processing are not enforced by the proxy.
  • Documentation

    • Updated English and Korean guidance to describe the revised schema-handling behavior.

Keep regex-keyed schemas and nonmonotone subtrees unchanged; retain scalar Artifact compatibility in ordinary positive positions.

Co-authored-by: itismyfield <itismyfield@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 181b7657-821b-4eed-bd64-1aad79bfc750

📥 Commits

Reviewing files that changed from the base of the PR and between b5c9833 and 9240bde.

📒 Files selected for processing (5)
  • docs-site/src/content/docs/guides/claude-code.md
  • docs-site/src/content/docs/ko/guides/claude-code.md
  • src/adapters/responses-tool-schema.ts
  • tests/adapters/openai/openai-chat-hardening.test.ts
  • tests/responses/openai-responses-passthrough.test.ts

📝 Walkthrough

Walkthrough

The schema normalizer now removes only eligible scalar Unicode-property patterns. It preserves patternProperties, composed-schema branches, conditional schemas, and definition subtrees. OpenAI Chat and Responses tests and documentation reflect the updated behavior.

Changes

Unicode schema preservation

Layer / File(s) Summary
Schema normalization rules
src/adapters/responses-tool-schema.ts:15-20, src/adapters/responses-tool-schema.ts:100-115, src/adapters/responses-tool-schema.ts:145-166
The normalizer preserves patternProperties, not, oneOf, if, contains, $defs, and definitions. It walks name-bag values as schemas and removes the prior matcher-dropping logic.
Adapter validation and documentation
tests/adapters/openai/openai-chat-hardening.test.ts:346-616, tests/responses/openai-responses-passthrough.test.ts:1535-1563, docs-site/src/content/docs/guides/claude-code.md:553-567, docs-site/src/content/docs/ko/guides/claude-code.md:435-447
Tests verify matcher preservation, composed-schema passthrough, and input immutability. English and Korean documentation describe the selective stripping rules.

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

Suggested reviewers: invalid-email-address

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/preserve-composed-tool-schemas

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.

@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the bug Something isn't working label Sep 9, 2026
@lidge-jun

Copy link
Copy Markdown
Owner Author

Independent read-only agent re-review of 9240bde returned PASS with no blocking issues. The allOf/outer unevaluatedProperties witness retains its matcher and evaluation annotation; not/oneOf/conditional/reusable subtrees are preserved while ordinary Artifact scalar patterns remain normalized. Both adapter seams carry regression assertions. Hosted CI 34347174190 is still running, and no local product tests were run. This addresses the remaining composed-schema finding on #4096; release readiness will use the repaired final dev, not the previous green baseline.

@lidge-jun
lidge-jun marked this pull request as ready for review September 9, 2026 11:54
@lidge-jun
lidge-jun requested a review from Ingwannu as a code owner September 9, 2026 11:54
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 9, 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-09-09T11:56:26.057089Z 9240bde Draft marked ready
ℹ️ 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.

@lidge-jun

Copy link
Copy Markdown
Owner Author

Maintainer integration into dev at exact head 9240bdec3b010e47761acb327cd75c8685b8f091. Current maintain/admin authority and outstanding maintainer review state were verified with the repository helper. Exact-head Cross-platform CI: https://github.com/lidge-jun/opencodex/actions/runs/34347174190 (success; conditional skipped jobs are not counted as passing tests). The owner explicitly requested immediate serial integration of the prepared PR set. Cumulative lane=all has not yet run; full validation will run on final dev after landing. Independent technical/security review and source carry verification were completed for this delivery. Local product tests/typecheck/build/install were NOT RUN under the owner restriction. Merge uses the original commits and preserves attribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant