Validate printed invoice subtotals in document review - #3090
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5e0f9a49b0
ℹ️ 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".
| sum(amounts) != stated_subtotal | ||
| or stated_subtotal + shipping != calculated |
There was a problem hiding this comment.
Permit reports to describe subtotal mismatches
For an invoice whose printed subtotal differs from the sum of its line items—the financial discrepancy this change is intended to surface—the specialist must report the printed value as stated_subtotal, but this check rejects that factual report and aborts the entire batch in validate_review. The policy instead needs to let the report retain both values and produce an escalated decision; otherwise invoices with an incorrect printed subtotal cannot be reviewed or returned to the human approver.
Useful? React with 👍 / 👎.
|
Reread
…On Sat, Sep 12, 2026, 3:06 AM chatgpt-codex-connector[bot] < ***@***.***> wrote:
***@***.***[bot]* commented on this pull request.
💡 Codex Review
Here are some automated review suggestions for this pull request.
*Reviewed commit:* 5e0f9a4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo
<https://chatgpt.com/codex/cloud/settings/general>. Reviews are triggered
when you
- Open a pull request for review
- Mark a draft as ready
- Comment ***@***.*** <https://github.com/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 ***@***.***
<https://github.com/codex> address that feedback".
------------------------------
In examples/agents_api/apps/document_review/agent.py
<#3090 (comment)>
:
> + sum(amounts) != stated_subtotal
+ or stated_subtotal + shipping != calculated
*[image: P1 Badge]
<https://camo.githubusercontent.com/c595229c0ecb6ee85b9c7804144d495f131a495ec87091fea2b262d954c9a92d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f50312d6f72616e67653f7374796c653d666c6174>
Permit reports to describe subtotal mismatches*
For an invoice whose printed subtotal differs from the sum of its line
items—the financial discrepancy this change is intended to surface—the
specialist must report the printed value as stated_subtotal, but this
check rejects that factual report and aborts the entire batch in
validate_review. The policy instead needs to let the report retain both
values and produce an escalated decision; otherwise invoices with an
incorrect printed subtotal cannot be reviewed or returned to the human
approver.
Useful? React with 👍 / 👎.
—
Reply to this email directly, view it on GitHub
<#3090?email_source=notifications&email_token=CJDCFOCAJDIFFN3ETXTUQCT5OTYWRA5CNFSNUABKM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UKJSXM2LFO4XTKMJYGU3DSNJRGU22M4TFMFZW63VKON2WE43DOJUWEZLEUVSXMZLOOSWGM33PORSXEX3DNRUWG2Y#pullrequestreview-5185695155>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/CJDCFODLLCIN5PEZANQJ22T5OTYWRAVCNFSNUABFKJSXA33TNF2G64TZHM2DMOBVG43DANRQHNEXG43VMU5TKNBTGE4DKNRQGMZ2C5QC>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Summary
Motivation
The document-review example previously checked only the final calculated total. A report could therefore pass even when its line items disagreed with the invoice's printed subtotal, as long as the final total was internally consistent.
Fixes #3086
Testing
python3 -m py_compile examples/agents_api/apps/document_review/agent.pygit diff --checkThe repository's runtime dependencies are not installed in this environment, so the full document-review application was not run.