Fix booking payment schemas for Responses API - #19
Merged
Liang-Chun Tsai (ltsai-dev) merged 1 commit intoAug 19, 2026
Merged
Conversation
Expose payment amounts as finite JSON numbers for Responses API compatibility while preserving Decimal-based monetary rounding internally. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: e32fcb7b-348e-4ff3-8c78-6b5416eb0f73
Liang-Chun Tsai (ltsai-dev)
requested review from
a team
and
a lite review from Copilot
August 19, 2026 00:42
Copilot started reviewing on behalf of
Liang-Chun Tsai (ltsai-dev)
August 19, 2026 00:43
View session
There was a problem hiding this comment.
Pull request overview
This PR updates the external booking payment tools’ request schemas to avoid Pydantic Decimal JSON-schema regex features (lookarounds) that Azure OpenAI Responses rejects, while keeping internal monetary handling in Decimal with consistent ROUND_HALF_UP quantization.
Changes:
- Switch
charge_amount,refund_amount, anddispute_amounttool inputs fromDecimalto finitefloat(allow_inf_nan=False) to emit Responses-compatible JSON schemas. - Convert validated float inputs via
Decimal(str(value))and quantize to 2 decimal places usingROUND_HALF_UPbefore persisting. - Add tests covering schema shape (
type: number, nopattern), rejection of non-finite inputs, and rounding behavior regression.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| servers/tb_business_ops_servers_202606/tb_business_ops_servers_202606/toolslib/external_booking/payment_api/tools/process_refund.py | Makes refund amount a finite JSON number while preserving internal Decimal rounding. |
| servers/tb_business_ops_servers_202606/tb_business_ops_servers_202606/toolslib/external_booking/payment_api/tools/process_charge.py | Makes charge amount a finite JSON number and converts to Decimal for validation/rounding. |
| servers/tb_business_ops_servers_202606/tb_business_ops_servers_202606/toolslib/external_booking/payment_api/tools/process_charge_dispute.py | Makes dispute amount a finite JSON number and quantizes via Decimal. |
| servers/tb_business_ops_servers_202606/tests/external_booking/payment_api/test_process_refund.py | Adds schema + non-finite validation coverage and pins float->Decimal rounding behavior. |
| servers/tb_business_ops_servers_202606/tests/external_booking/payment_api/test_process_charge.py | Adds schema + non-finite validation coverage and pins float->Decimal rounding behavior. |
| servers/tb_business_ops_servers_202606/tests/external_booking/payment_api/test_process_charge_dispute.py | Adds schema + non-finite validation coverage and pins float->Decimal rounding behavior. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Azure OpenAI Responses rejects the regex lookaround emitted by Pydantic for
Decimaltool inputs, preventing external booking evaluations from starting. This change exposes payment amounts as finite JSON numbers while preservingDecimalconversion and monetary rounding inside each tool.Changes
floatvalues with Responses-compatible JSON schemas.Decimal(str(value))before two-decimalROUND_HALF_UPquantization.Test plan
PYTHONPATH=servers\\tb_business_ops_servers_202606 python -m pytest --quiet servers\\tb_business_ops_servers_202606\\tests\\external_booking\\payment_api\\test_process_charge.py servers\\tb_business_ops_servers_202606\\tests\\external_booking\\payment_api\\test_process_charge_dispute.py servers\\tb_business_ops_servers_202606\\tests\\external_booking\\payment_api\\test_process_refund.pyRelated issues
N/A