Title: @IdempotencyStore.wrap incompatible with arg-projected methods (update_media_buy) · Issue #559 · adcontextprotocol/adcp-client-python · GitHub
Open Graph Title: @IdempotencyStore.wrap incompatible with arg-projected methods (update_media_buy) · Issue #559 · adcontextprotocol/adcp-client-python
X Title: @IdempotencyStore.wrap incompatible with arg-projected methods (update_media_buy) · Issue #559 · adcontextprotocol/adcp-client-python
Description: What @IdempotencyStore.wrap (src/adcp/server/idempotency/store.py:131-219) wraps the handler with signature (handler_self, params, context=None, *args, **kwargs). But the framework's arg-projector (src/adcp/decisioning/dispatch.py:~1080)...
Open Graph Description: What @IdempotencyStore.wrap (src/adcp/server/idempotency/store.py:131-219) wraps the handler with signature (handler_self, params, context=None, *args, **kwargs). But the framework's arg-projector ...
X Description: What @IdempotencyStore.wrap (src/adcp/server/idempotency/store.py:131-219) wraps the handler with signature (handler_self, params, context=None, *args, **kwargs). But the framework's arg-projec...
Opengraph URL: https://github.com/adcontextprotocol/adcp-client-python/issues/559
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"@IdempotencyStore.wrap incompatible with arg-projected methods (update_media_buy)","articleBody":"## What\n\n`@IdempotencyStore.wrap` ([`src/adcp/server/idempotency/store.py:131-219`](https://github.com/adcontextprotocol/adcp-client-python/blob/main/src/adcp/server/idempotency/store.py#L131-L219)) wraps the handler with signature `(handler_self, params, context=None, *args, **kwargs)`. But the framework's arg-projector ([`src/adcp/decisioning/dispatch.py:~1080`](https://github.com/adcontextprotocol/adcp-client-python/blob/main/src/adcp/decisioning/dispatch.py)) splits some tools into per-field kwargs:\n\n```python\n# dispatch.py:1085 (arg_projector branch for update_media_buy)\nresult = await method(**arg_projector, ctx=ctx)\n# arg_projector = {\"media_buy_id\": \"...\", \"patch\": {...}}\n```\n\nWhen `update_media_buy` is decorated with `@_IDEMPOTENCY.wrap`, the wrap body **never runs** — Python raises before:\n\n```\nTypeError: MockSellerPlatform.update_media_buy() missing 1 required positional argument: 'params'\n```\n\nStrictly a calling-convention incompatibility. Dispatch passes `media_buy_id=...`, `patch=...`, `ctx=...` as kwargs. None match the `params` positional, no default, the projected kwargs land in `**kwargs`, and Python errors out before `_wrapped`'s body executes. So this isn't a hash collision or cache-key issue — the wrap doesn't get a chance to compute anything.\n\n## Repro\n\nsalesagent's `MockSellerPlatform.update_media_buy` decorated with `@_IDEMPOTENCY.wrap`. Method signature is `(self, media_buy_id, patch, ctx)` per the framework's arg-projector contract. Calling through MCP storyboard runner against `core/` raised the TypeError above on every `update_media_buy` request.\n\nReference: same shape as `examples/v3_reference_seller/src/platform.py:735` which intentionally does NOT wrap `update_media_buy` (presumably for the same reason — neither the example nor the docs spell this out as a known incompatibility).\n\n## Workaround we shipped\n\nDropped `@_IDEMPOTENCY.wrap` from `update_media_buy` on both [`core/platforms/mock.py`](https://github.com/prebid/salesagent/blob/main/core/platforms/mock.py) and [`core/platforms/gam.py`](https://github.com/prebid/salesagent/blob/main/core/platforms/gam.py). **We've lost idempotency on update_media_buy** — buyer retries re-execute side effects. Acceptable for the spike; not for prod.\n\n## What we'd want\n\n**Cleanest fix on the wrap side:** make wrap signature-flexible so it works regardless of how the framework calls it. Detect the arg-projector calling pattern (kwargs that aren't `ctx`/`context`) and synthesize a params dict from those kwargs before hashing:\n\n```python\nasync def _wrapped(handler_self, params=None, context=None, *args, **kwargs):\n if params is None and kwargs:\n # Arg-projector calling pattern — synthesize params from non-ctx kwargs\n ctx_kw = kwargs.pop(\"ctx\", None) or kwargs.pop(\"context\", None)\n params = kwargs\n if ctx_kw is not None:\n context = ctx_kw\n # ... existing logic, then dispatch back via the same calling pattern\n return await handler(handler_self, **params, ctx=context) # for arg-projected\n # OR: return await handler(handler_self, params, context, *args, **kwargs) # for normal\n```\n\n(Sketch only — needs tightening on which calling pattern was used so the inner `handler(...)` invocation matches.)\n\n**Alternative on dispatch side:** detect a wrapped handler and route via `method(params=arg_projector_dict, ctx=ctx)` instead of unpacking. But dispatch is generic and shouldn't know about `@wrap`, so the wrap-side fix is cleaner.\n\n## Filed by\n\nsalesagent kill-nginx/M2 spike — surfaced in [`core/SDK_FEEDBACK.md`](https://github.com/prebid/salesagent/blob/main/core/SDK_FEEDBACK.md) round 3 along with #558 (BearerTokenAuth × transport=both).","author":{"url":"https://github.com/bokelley","@type":"Person","name":"bokelley"},"datePublished":"2026-05-04T09:59:27Z","url":"https://github.com/adcontextprotocol/adcp-client-python/issues/559"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:84a890f2-20bd-ae44-7c9e-6be7d7d19e1f |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B95E:291B58:B9412:E9C09:6B00F69C |
| html-safe-nonce | 9e2f88d53cd1828b373b72f4f6e53453d949715e0cff95999c5601fb8c030849 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCOTVFOjI5MUI1ODpCOTQxMjpFOUMwOTo2QjAwRjY5QyIsInZpc2l0b3JfaWQiOiIxODg5NzMzODg3NzQ0MDc5NTE2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | f00f7d866d6fee07e09c44ef83b0f5092c060a47ead5672860a7837350079feb |
| hovercard-subject-tag | issue:4375601270 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/adcontextprotocol/adcp-client-python/559/issue_layout |
| twitter:image | https://opengraph.githubassets.com/fabd1ac37dfeea1599dfb6f958d5f19cae4d4e5c62aa48643c5223c04d32f83a/adcontextprotocol/adcp-client-python/issues/559 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/fabd1ac37dfeea1599dfb6f958d5f19cae4d4e5c62aa48643c5223c04d32f83a/adcontextprotocol/adcp-client-python/issues/559 |
| og:image:alt | What @IdempotencyStore.wrap (src/adcp/server/idempotency/store.py:131-219) wraps the handler with signature (handler_self, params, context=None, *args, **kwargs). But the framework's arg-projector ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | bokelley |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4ef498cbabcbe3c50befc7a5b743e7072ee770b4daf0e15e54801180d1fa91fc |
| turbo-cache-control | no-preview |
| go-import | github.com/adcontextprotocol/adcp-client-python git https://github.com/adcontextprotocol/adcp-client-python.git |
| octolytics-dimension-user_id | 221690821 |
| octolytics-dimension-user_login | adcontextprotocol |
| octolytics-dimension-repository_id | 1090305973 |
| octolytics-dimension-repository_nwo | adcontextprotocol/adcp-client-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1090305973 |
| octolytics-dimension-repository_network_root_nwo | adcontextprotocol/adcp-client-python |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 9983dd5da06943f833c971dd5b6bc988e2858be5 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width