Skip to content

Validate printed invoice subtotals in document review - #3090

Open
barry166 wants to merge 1 commit into
openai:mainfrom
barry166:codex/validate-invoice-subtotal
Open

Validate printed invoice subtotals in document review#3090
barry166 wants to merge 1 commit into
openai:mainfrom
barry166:codex/validate-invoice-subtotal

Conversation

@barry166

Copy link
Copy Markdown

Summary

  • Validate that extracted invoice line items add up to the printed subtotal.
  • Require the subtotal in the expense-review report schema and verify subtotal plus shipping against the calculated total.

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.py
  • git diff --check

The repository's runtime dependencies are not installed in this environment, so the full document-review application was not run.

@barry166
barry166 requested a review from a team as a code owner September 12, 2026 07:01

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

Copy link
Copy Markdown
Contributor

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: 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".

Comment on lines +109 to +110
sum(amounts) != stated_subtotal
or stated_subtotal + shipping != calculated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Badge 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 👍 / 👎.

@jazzypayne1997-hub

jazzypayne1997-hub commented Sep 12, 2026 via email

Copy link
Copy Markdown

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.

Document review example does not validate the printed invoice subtotal

2 participants