Skip to content

馃Л fix: Coerce Schema-Guided Tool Arguments - #471

Merged
danny-avila merged 3 commits into
mainfrom
danny-avila/schema-aware-tool-arg-coercion
Aug 26, 2026
Merged

馃Л fix: Coerce Schema-Guided Tool Arguments#471
danny-avila merged 3 commits into
mainfrom
danny-avila/schema-aware-tool-arg-coercion

Conversation

@danny-avila

Copy link
Copy Markdown
Owner

Summary

I added conservative schema-guided normalization for recoverable model-generated tool argument mistakes before event-driven tools reach their host handlers.

  • Normalize canonical string integers, finite numeric strings, and exact boolean strings only when the matching JSON Schema field explicitly declares that type.
  • Recurse through declared object properties and array item schemas while leaving unknown, ambiguous, and unsafe values untouched for host validation.
  • Apply the same normalization to both regular event dispatch and speculative eager execution so they use identical arguments.
  • Cover valid coercion, ambiguous-value preservation, nested schemas, and request-plan dispatch behavior.

Change Type

  • Bug fix (non-breaking change which fixes an issue)

Testing

  • npx jest src/tools/__tests__/eagerEventExecution.session.test.ts --runInBand
  • npx tsc --noEmit
  • npx eslint src/tools/eagerEventExecution.ts src/tools/ToolNode.ts src/stream.ts src/tools/__tests__/eagerEventExecution.session.test.ts

Checklist

  • My code adheres to this project's style guidelines
  • I have performed a self-review of my own code
  • I have commented in any complex areas of my code
  • I have made pertinent documentation changes
  • My changes do not introduce new warnings
  • I have written tests demonstrating that my changes are effective or that my feature works
  • Local unit tests pass with my changes
  • Any changes dependent on mine have been merged and published in downstream modules.

@danny-avila

Copy link
Copy Markdown
Owner Author

@codex review

Please review the current PR head 7cd8649. Confirm that this exact commit is the reviewed commit and ignore findings that apply only to earlier heads.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

馃挕 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7cd8649908

鈩癸笍 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".

If Codex has suggestions, it will comment; otherwise it will react with 馃憤.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/tools/eagerEventExecution.ts Outdated
Comment thread src/tools/eagerEventExecution.ts
Comment thread src/tools/eagerEventExecution.ts
Comment thread src/stream.ts Outdated
@danny-avila

Copy link
Copy Markdown
Owner Author

@codex review

Please review the current PR head 5833ca4. Confirm that this exact commit is the reviewed commit and ignore findings that apply only to earlier heads.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

馃挕 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5833ca4fcf

鈩癸笍 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".

If Codex has suggestions, it will comment; otherwise it will react with 馃憤.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/tools/ToolNode.ts
@danny-avila

Copy link
Copy Markdown
Owner Author

@codex review

Please review the current PR head 2f54352. Confirm that this exact commit is the reviewed commit and ignore findings that apply only to earlier heads.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

Reviewed commit: 2f543524ff

鈩癸笍 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".

If Codex has suggestions, it will comment; otherwise it will react with 馃憤.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danny-avila
danny-avila merged commit 6e7632c into main Aug 26, 2026
13 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.

1 participant