feat(tasks/get): add include_result + result fields for typed completion-payload retrieval (3.1)#3128
Closed
bokelley wants to merge 1 commit into
Closed
feat(tasks/get): add include_result + result fields for typed completion-payload retrieval (3.1)#3128bokelley wants to merge 1 commit into
bokelley wants to merge 1 commit into
Conversation
…field Closes #3123. The 3.0 tasks/get schemas had no typed mechanism for buyers polling a submitted task to retrieve the terminal payload (e.g. media_buy_id, packages from a completed create_media_buy). The docs invited buyers to send include_result: true against a parameter that wasn't in the schema, and the SDK read status.result against a field that wasn't there either. Patch #3127 corrected the 3.0 docs; this change adds the field for 3.1. Request: include_result (boolean, default false). Sellers MUST honor when terminal; no-op for non-terminal statuses. Response: result (object, additionalProperties: true) populated only when status is completed and include_result was true. Shape matches the original task response payload for the task's task_type — for example, task_type: create_media_buy returns result: { media_buy_id, packages, status }. failed/canceled continue to use the existing error field; result is for the success terminal only. Why a typed result instead of flat top-level merge: AdCP's flat structure applies to a single-task response. tasks/get is a meta-call across arbitrary task_types — naming the projection result makes the typed retrieval explicit, parallels MCP tasks/result, and matches what SDK code already attempts to read. Forward compatible: 3.0 sellers ignore unknown request fields per additionalProperties: true, so 3.1 buyers sending include_result against 3.0 sellers degrade gracefully. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
Author
|
Closing in favor of #3126, which does the same schema-additive work but uses a better-typed shape — The 3.0.1 docs patch #3127 is unaffected — they form the same two-PR stack (patch + minor) we discussed on #3123. |
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.
Summary
Closes #3123. Adds the schema-level fix: a typed
include_resultrequest flag and a typedresultresponse field ontasks/get, so buyers polling asubmittedtask can retrieve the terminal payload (e.g.media_buy_id,packagesfrom a completedcreate_media_buy) without depending onadditionalPropertiesundocumented behavior.This is the 3.1 follow-up to #3127 (3.0.1 docs patch). #3127 stops the 3.0 docs from describing a parameter that doesn't exist; this PR makes the parameter exist for 3.1.
Changes
static/schemas/source/core/tasks-get-request.json— addsinclude_result(boolean, defaultfalse). Sellers MUST honor the flag when the task is in a terminal status; for non-terminal statuses the flag has no effect. New example in the schema'sexamplesarray.static/schemas/source/core/tasks-get-response.json— addsresult(object,additionalProperties: true) populated only whenstatus: completedandinclude_result: truewas sent. Shape matches the original task response payload for the task'stask_type. Forfailed/canceled, sellers continue to use the existingerrorfield;resultis for the success terminal only.docs/building/implementation/task-lifecycle.mdx— adds an explanatory paragraph to the polling section. The four other call sites previously stripped by patch #3127 (async-operations.mdx×2,error-handling.mdx,orchestrator-design.mdx) are intentionally left for the rebase post-#3127-merge to keep this PR focused on the schema change.Why a typed
resultinstead of flat top-level mergeAdCP's flat-structure principle ("task fields at top level") applies to the original task response, where the response carries one task.
tasks/getis a meta-call about an arbitrary task whosetask_typeis variable — flat-merging the terminal payload at top level would force progress/error/result fields to share namespace with task-specific fields and would couple thetasks/getresponse shape to the union of every task's response shape. Naming the projectionresultmakes the typed retrieval explicit, parallels MCP'stasks/resultenvelope, and matches what existing SDK code at adcp-client already attempts to read (status.result).Versioning
Per
docs/reference/versioning.mdx:93:And per
docs/reference/versioning.mdx:121:This PR is minor and targets the 3.1 milestone (late June 2026). The 3.0.1 patch is #3127.
Forward compatibility
3.0 sellers ignore unknown request fields per
additionalProperties: true, so a 3.1 buyer sendinginclude_result: trueto a 3.0 seller gets the 3.0 behavior (noresultfield on the response) — no error, no break. Buyers that need 3.1 semantics checkadcp.major_versionsadvertised by the seller.Cross-repo
Unblocks adcp-client#967 (SDK polling-cycle hardening) and the adcp-client-python equivalent. The SDK's
pollTaskCompletionTaskResult.dataextraction will readresponse.resultwhen present, falling back toresponseitself for 3.0 sellers that splat task fields viaadditionalProperties.Test plan
npm run build:schemasproduces a valid bundledtasks-get-request.jsonwithinclude_resultandtasks-get-response.jsonwithresultnpm run test:unitandnpm run typecheckpass via pre-commit hookresultshape semantics ("matches the original task response payload for the task'stask_type") read correctly against working-group expectationsfailed/canceledexclusion ("for failed/canceled useerrorinstead") matches working-group intentinclude_result: trueto the four polling examples that were stripped by the patch🤖 Generated with Claude Code