Skip to content

Business rejections answer 'failed': 'rejected' is unwritable and the Postgres CHECK forbids it #2797

Description

@LukasGoTom

Verified against the pinned vendor/adcp-sdk
(@adcp/sdk@14.0.0-beta.12, AdCP 3.2.0-beta.6). SDK issue, not a protocol
one — the spec already models this correctly.

Title

Business rejections answer 'failed': 'rejected' is unwritable and the Postgres CHECK forbids it

Body

Three layers of the SDK disagree about whether rejected exists.

  • decisioning/runtime/task-registry.ts:45, :63rejected is a documented
    terminal status carrying a result artifact.
  • task-registry.ts:247, postgres-task-registry.ts:322 — the only terminal
    writers are complete() and fail(), and fail() hardcodes failed.
    Nothing writes rejected.
  • postgres-task-registry.ts:174 — CHECK allows only
    submitted, working, completed, failed (4 of the spec's 9), so an adopter
    willing to write the record directly still cannot.
  • enums/task-status.jsonfailed is "an error during execution",
    rejected is a structured decline, "not a transport failure".

Net effect: an adopter declining a well-formed request from a handoffToTask
function answers failed on the wire, which is the wrong spec status. Buyers
cannot tell an execution error from a business decision.

Adopter context

We are a sales-guaranteed seller whose media buy waits on a human converting
an offer into a booking, which is the case submitted is defined for
("long-running execution (hours to days)"). When that offer is archived or
expires, the correct terminal answer is rejected — and we cannot emit it.

Our workaround is a custom TaskRegistry via opts.taskRegistry
(from-platform.ts:2525) that resolves status on read, which works because
get_task_status reads only through taskRegistry.getTask()
(create-adcp-server.ts:7464). It means we cannot use the shipped
createPostgresTaskRegistry, and list_tasks has to be wrapped too or it
serves stale rows.

Related

task-registry.ts:31 and postgres-task-registry.ts:171 point adopters at a
taskRegistry.transition() API "(v6.1)" for exactly these states. ## 6.1.0
is at CHANGELOG.md:10497 and the package is at 14.0.0-beta.12; transition
appears nowhere in src/ outside those two comments. Happy to file that
separately if you'd rather keep this issue single-concern.

Ask

  1. Widen the Postgres CHECK to the full nine-state enum, with the migration.
  2. Add a way to end a task as rejected — a reject() sibling of fail(), or
    fail() honouring a business-decline marker on AdcpError.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions