Skip to content

fix(openai-chat): strip Responses-only encrypted tool annotation - #1776

Closed
ZHJay wants to merge 1 commit into
lidge-jun:devfrom
ZHJay:fix/openai-chat-encrypted-tool-schema
Closed

ZHJay wants to merge 1 commit into
lidge-jun:devfrom
ZHJay:fix/openai-chat-encrypted-tool-schema

Conversation

@ZHJay

@ZHJay ZHJay commented Aug 15, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Fixes [Bug] openai-chat V2 spawn_agent emits empty arguments when message schema contains encrypted:true #1774: strip the Responses-only encrypted schema annotation when the generic openai-chat adapter translates tools to Chat Completions.
  • Extracts the existing Anthropic marker sanitizer into a shared adapter helper so translated Chat and Anthropic schemas remove the marker consistently while preserving required fields, literal values, and schema names such as encrypted and __proto__.
  • Leaves the native openai-responses passthrough unchanged.
  • Adds a behavior-contract regression covering nested annotations, schema name maps, JSON Schema dependency maps, literal-value keywords, prototype-like names, and input non-mutation.

The root cause is protocol translation: encrypted: true is private Responses metadata, but it was serialized into Chat Completions tool parameters. For the affected V2 collaboration request, the upstream then returned empty spawn_agent arguments; the required message field was absent and no child agent was created.

I am happy to prepare/continue the PR review and follow-up fixes.

Verification

  • bun test tests/openai-chat-hardening.test.ts tests/anthropic-tool-schema.test.ts — 59 passed, 0 failed.
  • bun run typecheck — passed.
  • bun run privacy:scan — passed.
  • bun run test — attempted on the final commit; 12,357 passed, 8 skipped, 18 failed in unrelated existing provider-management/concurrency tests (the focused adapter tests and typecheck remain green).
  • git diff --check origin/dev...HEAD — passed.

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed; this is an internal adapter compatibility fix with no new user-facing configuration.
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults; this change does not touch those paths.

Closes #1774

Review readiness checklist

This PR stays in draft until every box below is ticked. Tick all four boxes once the requirements are met:

  • All CI tests are green on my local testing.

  • I pushed my PR to the latest dev commit.

  • I resolved all correct Codex and CodeRabbit findings.

  • My PR is ready for review.

@github-actions

Copy link
Copy Markdown
Contributor

✅ Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the bug Something isn't working label Aug 15, 2026
@coderabbitai

coderabbitai Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 08a7b58a-fd9e-468f-9633-98a1763462ca

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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

Copy link
Copy Markdown
Contributor

⏳ DRAFT

  • review readiness checklist open (0/4 boxes ticked).

What to do

  • Tick all four boxes in the PR description once you're done (currently 0/4).

Review readiness checklist

  • ⬜ All CI tests are green on my local testing.
  • ⬜ I pushed my PR to the latest dev commit.
  • ⬜ I resolved all correct Codex and CodeRabbit findings.
  • ⬜ My PR is ready for review.

0/4 boxes ticked.

This PR stays in draft until every box above is ticked.

Copy link
Copy Markdown
Owner

Landed on dev as 02728d2 via #1779, with you as co-author — thank you.

Your design was adopted as-is: keyword-only strip, name bags preserved, literal payloads untouched, null-prototype records so a schema named __proto__ stays data. One change was needed before merge: the walk is now iterative over an explicit stack, because tool schemas are caller-supplied and a deep one would have overflowed the stack on the request path. A 50,000-deep regression covers that.

Closing this in favor of the merged commit.

@lidge-jun lidge-jun closed this Aug 15, 2026
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.

2 participants