Skip to content

Fix CPM hallucination: remove fallbacks, add pricing provenance, LLM guardrails#79

Open
atc964 wants to merge 4 commits intomainfrom
feature/cpm-hallucination-fix
Open

Fix CPM hallucination: remove fallbacks, add pricing provenance, LLM guardrails#79
atc964 wants to merge 4 commits intomainfrom
feature/cpm-hallucination-fix

Conversation

@atc964
Copy link
Copy Markdown
Collaborator

@atc964 atc964 commented Mar 31, 2026

Summary

Fixes the buyer agent fabricating CPM pricing when sellers have not provided any. Three layers of fix:

  • Layer 2a (P0 bug fix): Removed hardcoded $20 and $15 CPM fallbacks in request_deal.py, campaign_pipeline.py, discover_inventory.py, and quote_flow.py. When no pricing exists, the system now returns "pricing unavailable — negotiation required."
  • Layer 2b (pricing provenance): Added PricingSource enum (seller_quoted/negotiated/unavailable) to PricingResult. Made PricingInfo fields Optional. QuoteNormalizer short-circuits on null pricing. Multi-seller orchestration handles mixed priced/unpriced quotes.
  • Layer 3 (LLM guardrails): Added "NEVER estimate or fabricate CPM pricing" to all 12 agent backstories. Updated crew expected_output templates to allow null CPM.

Test Results

  • Layer 2a: 2686 passed, 14 new tests
  • Layer 2b: 2708 passed, 22 new tests
  • Layer 3: 2723 passed, 37 new tests
  • Combined branch: 2745 passed
  • All layers Quinn VERIFIED independently
  • Cross-repo smoke test: 6/6 scenarios PASS

Beads

  • Epic: ar-rrgw
  • ar-na3i (Layer 2a), ar-r76d (Layer 2b), ar-8opr (Layer 3)

Companion PR

Seller-side fix (pricing_type enum + quote validation) in separate PR on ad_seller_system.

🤖 Generated with Claude Code

atc964 and others added 4 commits March 31, 2026 11:39
When sellers provide no pricing, the buyer agent was silently
substituting hardcoded values ($20 in request_deal, $15 in
campaign_pipeline, $0 in discover_inventory/quote_flow). This
caused the agent to present fabricated CPMs as if they came from
the seller.

Changes:
- request_deal.py: return error string instead of $20 fallback
- discover_inventory.py: show "Pricing unavailable" instead of $0
- quote_flow.py: return None instead of PricingResult with $0
- campaign_pipeline.py: require explicit CPM, default to None

bead: ar-na3i

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Append CRITICAL pricing discipline instruction to all 12 agent backstories
preventing CPM hallucination. Update channel_crews.py expected_output
template to show cpm as "Y or null" with explicit instruction that cpm
must be null when no seller pricing was provided. Add 37 parametrized
tests verifying guardrails are present in every agent.

bead: ar-8opr

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Every pricing value now carries a source (seller_quoted, negotiated,
or unavailable). The system refuses to produce a CPM when the seller
has not provided pricing, and unpriced quotes flow through
normalization and orchestration without crashing.

bead: ar-r76d

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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