Skip to content

bug(decisioning): PlatformHandler issues async task_ids but answers get_task_status with NOT_SUPPORTED #1289

Closed

Description

@bokelley

Summary

On 8.0.0, PlatformHandler writes every TaskHandoff to self._registry and returns status: "submitted" with a task_id. It does not implement get_task_status, though, so a buyer polling that task_id gets NOT_SUPPORTED, and the tool is left out of tools/list. AdCP 3.2 defines get_task_status as the protocol polling tool, and the SDK's own ADCPClient polls it. A decisioning seller that hands off work therefore cannot be polled, unless it patches PlatformHandler.

Reproduction (adcp 8.0.0)

import asyncio
import warnings

warnings.simplefilter("ignore")

from adcp.decisioning import DecisioningCapabilities, DecisioningPlatform, SingletonAccounts
from adcp.decisioning.serve import create_adcp_server_from_platform
from adcp.server.mcp_tools import create_tool_caller, get_tools_for_handler


class Seller(DecisioningPlatform):
    capabilities = DecisioningCapabilities(specialisms=["sales-non-guaranteed"], channels=["display"],
                                           pricing_models=["cpm"])
    accounts = SingletonAccounts(account_id="acct_1")

    def get_products(self, req, ctx): return {"products": []}
    def create_media_buy(self, req, ctx): raise NotImplementedError
    def update_media_buy(self, media_buy_id, patch, ctx): raise NotImplementedError
    def sync_creatives(self, req, ctx): raise NotImplementedError
    def get_media_buy_delivery(self, req, ctx): raise NotImplementedError
    def get_media_buys(self, req, ctx): raise NotImplementedError


async def main():
    handler, executor, registry = create_adcp_server_from_platform(Seller(), validate_at_init=False)
    task_id = await registry.issue(account_id="acct_1", task_type="get_products")
    print("issued:", task_id, (await registry.get(task_id, expected_account_id="acct_1"))["state"])
    print("advertised:", [n for n in ("get_task_status", "list_tasks")
                          if n in {t["name"] for t in get_tools_for_handler(handler)}])
    result = await create_tool_caller(handler, "get_task_status")({"task_id": task_id})
    print("get_task_status:", result)
    executor.shutdown()

asyncio.run(main())

Output:

issued: task_a606e95fbcd7409d submitted
advertised: []
get_task_status: {'supported': False, 'reason': 'get_task_status is not supported by decisioning platform', 'error': {'code': 'NOT_SUPPORTED', 'message': 'get_task_status is not supported by decisioning platform'}, 'status': 'completed'}

Details

  • adcp/server/base.py:703-723: get_task_status and list_tasks default to _not_supported. PlatformHandler (adcp/decisioning/handler.py) doesn't override either one, so get_tools_for_handler filters them out.
  • adcp/server/mcp_tools.py:725-754: both tools are defined.
  • _schemas/3.2/manifest.json: get_task_status is a protocol tool, and the buyer_activation storyboard exercises it.
  • adcp/decisioning/task_registry.py:95-137, 205, 354: the docstrings describe "the wire tasks/get path", which always passes expected_account_id. No such path exists. Nothing in the SDK reads the registry on behalf of a buyer.
  • TaskRecord.to_dict() (task_registry.py:136-160) isn't the wire shape either: it returns state rather than status, epoch floats rather than ISO timestamps, and no protocol. Each adopter has to write that projection too.

Why an adopter hits this

Embedded Sales Agent uses async get_products handoff. To make those tasks pollable, it ships core/task_polling_compat.py (320 LOC). That file:

  • setattrs get_task_status and tasks_get onto PlatformHandler;
  • appends a tool definition to ADCP_TOOL_DEFINITIONS;
  • mutates the private _ALL_TOOL_NAMES, _HANDLER_TOOLS and _PROTOCOL_TOOLS;
  • reimplements account scoping, the record-to-response projection, the TTL/expiry response and the unknown-task response.

The file is installed at startup from core/main.py. Every SDK upgrade risks breaking it silently. Without it, a buyer that receives submitted has no way to fetch the result.

Ask

  1. Implement PlatformHandler.get_task_status. It should resolve the account the way other tools do, call self._registry.get(task_id, expected_account_id=account.id) and project the record to GetTaskStatusResponse, including REFERENCE_NOT_FOUND for unknown or cross-account IDs. Advertise the tool whenever the handler can issue handoffs.
  2. Add a list method to TaskRegistry (or an optional protocol for it) so that list_tasks can be served the same way.
  3. Optional: register tasks_get as an alias for buyers still on the legacy tasks/get name. Alternatively, add a public register_tool_alias() so adopters can do it without touching private sets.

Activity

  1. added
    bugSomething isn't working
    claude-triagingTriage routine is actively working on this issue (1-3 min)
    on Oct 2, 2026
  2. bokelley commented on Oct 2, 2026

    @bokelley
    ContributorAuthor

    Triage

    Classification: Bug
    Bucket(s): handlers (note: no handlers label exists in this repo — bucket recorded here only)
    Status: ready-to-implement

    What the experts said:

    • code-reviewer: Confirmed. Item 1 non-breaking; Item 2 breaking as proposed — TaskRegistry is @runtime_checkable, adding a required list method silently breaks existing custom registries at isinstance time. Use a separate ListableTaskRegistry(Protocol) mixin. TaskRecord.to_dict() returns state (not status) and epoch floats (not ISO strings) — the shim must project both; cross-tenant guard requires account resolution before registry.get().
    • dx-expert: P0 severity — async handoff is functionally broken for any buyer that polls. PlatformHandler promises a task_id + submitted then has no supported read-back path, forcing adopters into 320-LOC setattr workarounds. Item 1 must-fix; Item 2 safe only via optional protocol; Item 3 (alias) nice-to-have, defer.

    My take: The bug is confirmed and both experts converge. Items 1 and 2 are implementable non-breakingly; the change is well-scoped, testable, and ready for a PR as soon as someone picks it up.

    Implementation scope:

    • src/adcp/decisioning/handler.py — Add get_task_status override to PlatformHandler:

      1. Resolve account via resolve_account (same pattern as other shims).
      2. Call self._registry.get(task_id, expected_account_id=account.id) — account MUST be resolved first to enforce cross-tenant isolation.
      3. On None return → respond REFERENCE_NOT_FOUND.
      4. Project record["state"] → "status", record["created_at"]/record["updated_at"] → ISO 8601 UTC strings (not epoch floats). Include task_type, progress, result, error, context as the wire schema expects.
      5. Add "get_task_status" to advertised_tools_for_instance unconditionally — PlatformHandler.__init__ always requires registry, so advertising is always appropriate.
      6. For list_tasks: advertise only when isinstance(self._registry, ListableTaskRegistry) (see below); otherwise falls back to base _not_supported.
    • src/adcp/decisioning/task_registry.py — Add ListableTaskRegistry(Protocol) as a separate optional extension (NOT a new method on the existing TaskRegistry Protocol — that would be a breaking change):

      @runtime_checkable
      class ListableTaskRegistry(Protocol):
          async def list(self, *, account_id: str, filters: dict | None = None, ...) -> list[dict]: ...

      PlatformHandler.list_tasks delegates to self._registry.list(account_id=account.id, ...) only when isinstance(self._registry, ListableTaskRegistry).

    • src/adcp/server/base.py — Update docstrings on the get_task_status / list_tasks stubs to note that PlatformHandler overrides them when a TaskRegistry is provided, so adopters don't subclass thinking they must implement it themselves.

    • Tests — Cover: get_task_status round-trip (submitted → polled), cross-tenant probe returns REFERENCE_NOT_FOUND, list_tasks present/absent based on registry type, get_task_status appears in tools/list after fix.

    • Do not include item 3 (tasks_get alias) in this PR — leave as a follow-up. The tool-vs-routing-alias question needs separate resolution.

    Non-breaking rationale: New method override on PlatformHandler (callers going from NOT_SUPPORTED to real data is always safe). ListableTaskRegistry as a separate Protocol doesn't touch isinstance(x, TaskRegistry) checks. No public symbols renamed or removed.

    Required checks: pytest (task registry + handler coverage), mypy src/, ruff check .


    Triaged by Claude Code. Session: https://claude.ai/code/session_01GkJrmKvkuxwvrUrjAReiRk


    Generated by Claude Code

  3. added and removed
    claude-triagingTriage routine is actively working on this issue (1-3 min)
    on Oct 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions