Fix buyer booking workflow and integrate GAM reporting - #12
Merged
Conversation
aleksUIX
pushed a commit
to aleksUIX/seller-agent
that referenced
this pull request
Jul 26, 2026
… side) Policy: v2's architecture (service layer, per-domain routers) wins structurally; main's capabilities survive functionally. Resolutions: - src/ad_seller/interfaces/api/main.py: kept v2's app-assembly-only main. main's monolith additions (GAM reporting endpoints + rewired get_deal_performance, POST /products/search, placeholder POST /products/avails, hardened submit_proposal) are re-implemented in v2's service/router idiom in follow-up commits — except main's placeholder avails endpoint, which is superseded by v2's honest catalog-backed /products/avails and intentionally dropped. - src/ad_seller/interfaces/mcp_server.py: kept v2's thin-adapter registry; dropped main's httpx-loopback list_gam_orders / get_gam_delivery_report tools here (re-added as service-layer thin adapters in a follow-up commit, keeping the drift-guarded 44-tool inventory true at this commit). - src/ad_seller/tools/gam/book_deal.py: stays deleted (v2 EP-8.2 removed the abandoned CrewAI tools/ subpackages); its gam_order_id persistence intent moves to the service layer in the GAM re-wiring commit. - pyproject.toml: main's crewai[...,openai,gemini] extras don't exist on crewai>=1.15 — adopted origin/fix/crewai-google-genai-extra's spelling crewai[anthropic,bedrock,google-genai] (openai SDK is a core crewai dep). - Clean merges kept from main: src/ad_seller/llm/ (configurable providers, PR IABTechLab#28/IABTechLab#31) + tests/unit/test_llm.py, agents/crews build_llm adoption, GAMSoapClient reporting methods (PR IABTechLab#12), settings LLM+GAM fields, docs/guides/gam-reporting.md + configuration.md provider docs, ProposalHandlingFlow structured-output/async fixes (PR IABTechLab#29), serial product IDs in ProductSetupFlow. Suite after merge: 1128 passed, 26 skipped (baseline 1123 + 5 test_llm). bead: ar-rrkg Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KuoSai9uDgCEkbqYmxQpQ6
aleksUIX
pushed a commit
to aleksUIX/seller-agent
that referenced
this pull request
Jul 26, 2026
TDD: tests/unit/test_deal_performance_gam.py was written first and run RED against the placeholder (3 failures: distinct deals returned identical fabricated stats), then this wiring turned it GREEN. - deal_service.get_deal_performance: when GAM is configured and the deal carries gam_order_id (record field or metadata fallback), fetch real delivery data via GAMSoapClient.get_delivery_report (main PR IABTechLab#12's logic, re-implemented in the v2 service layer so both the REST router and the MCP tool get the real path). Placeholder now only serves the GAM-unconfigured / never-trafficked / GAM-error paths, and GAM errors are logged instead of silently swallowed. - GAMAdServerClient.book_deal: persist gam_order_id back onto the stored deal record after trafficking (setter side; main did this in the since-deleted tools/gam/book_deal.py) — best-effort, never fails the booking. GAM boundary mocked in tests the way main's PR IABTechLab#12 tests mock GAM clients (unittest.mock at the client class/settings seam). bead: ar-j8hl Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KuoSai9uDgCEkbqYmxQpQ6
aleksUIX
pushed a commit
to aleksUIX/seller-agent
that referenced
this pull request
Jul 26, 2026
main PR IABTechLab#12 exposed /gam/orders + /gam/report as monolith endpoints and list_gam_orders / get_gam_delivery_report as httpx-loopback MCP tools. Re-implemented per the reconciliation policy (v2 architecture wins, capability survives): - services/gam_reporting_service.py: list_gam_orders (with agent_created_only resolving deal-storage gam_order_id links) and get_gam_delivery_report over GAMSoapClient; 503 unconfigured / 400 bad ids / 502 ad-server failure semantics preserved from main. - routers/admin.py: GET /gam/orders + GET /gam/report (tags=[Reporting], optional API-key dependency as on main). - mcp_server.py: both tools re-added as thin service adapters (no HTTP loopback), matching the v2 EP-3.2 refactor. - tests/unit/test_gam_reporting_service.py: config gate, storage-link resolution, error mapping, id parsing. - docs/reference regenerated via scripts/generate_inventories.py (85 -> 87 endpoints, 44 -> 46 tools) to keep the drift guard true. bead: ar-rrkg Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KuoSai9uDgCEkbqYmxQpQ6
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.
GAM Delivery Reporting + Buyer Booking Workflow Fix
Adds read/reporting capabilities to the existing GAM SOAP client and exposes delivery data through two new seller-internal endpoints and the existing
deal performance endpoint.
gam_soap_client.py — Added 5 reporting methods: list_orders(), get_order_by_id(), list_line_items_for_order(), run_delivery_report(),
get_delivery_report(). Report jobs poll GAM until complete then parse CSV delivery rows. API version now validates against supported versions and
auto-upgrades retired ones.
main.py — Two new seller-internal endpoints:
GET /api/v1/deals/{deal_id}/performance — replaced placeholder with real GAM data when gam_order_id is present on the deal. Falls back to placeholder
when GAM is not configured or the deal has not been trafficked into GAM — the endpoint always responds.
settings.py — Default GAM_API_VERSION updated to v202505.
Docs — New guides/gam-reporting.md covering setup, both endpoints, deal-to-GAM linking via gam_order_id, fallback behaviour, and sequence diagram.
Stale v202411 references updated in configuration.md and inventory-sync.md.
Note: GAM credentials (GAM_ENABLED, GAM_NETWORK_CODE, GAM_JSON_KEY_PATH) are required for the real data path. Without them all endpoints degrade
gracefully — no breaking changes.
Resolves issues that caused the buyer agent's booking flow to fail when calling the seller.
main.py — Added POST /products/search and POST /products/avails endpoints which the buyer's channel research crews call during inventory discovery.
Without these, crew tool calls returned 404s and recommendations couldn't be generated.
product_setup_flow.py — Product IDs changed from random UUIDs (prod-a3f2c8b1) to stable sequential IDs (prod-001, prod-002, ...) so buyer crews can
reliably reference the same product across calls.
proposal_handling_flow.py — Added handle_proposal_async() using kickoff_async() so proposal evaluation no longer blocks the FastAPI event loop,
fixing timeout issues under concurrent buyer requests.