Fix CPM hallucination: pricing_type enum + quote validation#7
Open
Fix CPM hallucination: pricing_type enum + quote validation#7
Conversation
Sellers can now express whether a price is fixed, a floor for negotiation, or unavailable (rate on request). This is the foundation for preventing buyer agent CPM hallucination -- when pricing_type=on_request, pricing fields are None and buyer agents must negotiate rather than fabricate numbers. Changes: - New models/pricing_type.py with PricingType(fixed|floor|on_request) - ProductDefinition: add pricing_type, make base_cpm/floor_cpm Optional - Package: add pricing_type, make base_price/floor_price Optional - QuotePricing: add pricing_type, make base_cpm Optional - Pricing (core): add pricing_type - All default to FIXED for backward compatibility - 18 new tests covering all models and backward compat bead: ar-7rgy Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Records every quote the seller issues to quote_history storage and cross-references incoming buyer proposals against that history. Proposals with CPMs that don't match any active quote are flagged as pricing_verified=false (not rejected — flagged for review). - QuoteHistoryStore: record/find/verify quotes with 1% tolerance - create_quote endpoint: persists to quote_history on issue - submit_proposal endpoint: runs pricing verification, returns result - ProposalResponse: new pricing_verified + pricing_verification_reason - ProposalEvaluation: new pricing_verified field - 10 new tests (9 unit + 1 integration-level) bead: ar-hm9l Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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
Seller-side fix for CPM hallucination. Two layers:
Test Results
Beads
Companion PR
Buyer-side fix (remove fallbacks, pricing provenance, LLM guardrails) in separate PR on ad_buyer_system.
🤖 Generated with Claude Code