A CometAPI video task reports completed, but the response has no video_url. Should your adapter mark generation as failed?
Not on that evidence alone. CometAPI’s polling and webhooks guide explicitly says to treat video_url as optional. Its completed-response example includes that field, but the surrounding text makes its presence conditional on the model adapter having a result URL. In your CometAPI integration, poll the task through GET /v1/videos/{id}, preserve its documented terminal status, and resolve the output using the selected model’s documented result fields. Use /v1/videos/{id}/content only if that model documents proxied-download support; otherwise report retrieval as unresolved rather than inventing a fallback. This is an adapter recommendation derived from the guide, not a guarantee of download availability.
The integration decision is to separate job completion from finding and retrieving the output. A missing URL should not erase a documented terminal status; equally, a completed status should not make your application claim that it has a playable asset.
Make retrieval a model-contract decision
The guide gives two alternatives to relying on video_url: model-specific result fields, or /v1/videos/{id}/content when the model supports proxied downloads. That last condition matters. It is not an instruction to send every missing-URL result to the content route.
I would give a CometAPI result adapter three separate checks:
| Check | Adapter decision |
|---|---|
| What is the job’s final state? | Interpret the polled response according to the selected model’s documented status contract. |
| Where is its result represented? | Use the documented URL or model-specific result mapping; choose the content route only with documented support for that model. |
| Has the application obtained the asset? | Track retrieval separately, rather than deriving asset availability from completed alone. |
These are proposed application checks, not additional CometAPI response fields. If the task is completed but the adapter cannot resolve a documented retrieval path, preserve that completion and surface an unresolved retrieval condition. Investigate the result mapping instead of automatically classifying the generation as failed or resubmitting the generation request.
The guide does not provide a per-model inventory of alternate result fields or proxy support. Before implementing a particular mapping, check the selected model’s documentation. Neither the example’s model name nor the presence of a content-route link proves that every video model supports the same download behavior.
Keep callback shape out of the success predicate
CometAPI also says callbacks are provider-specific pass-through events, not one universal payload, and advises reconciling final state with polling. The guide illustrates polling with GET /v1/videos/task_example.
Its sample callback nests a URL under result, whereas the polling example shows a top-level video_url. Those examples are a reason to avoid one shared field-presence check—not a guarantee that either layout applies to your selected model. Normalize only the documented mapping and reconcile the task state with polling.
Test the missing-URL branch explicitly
For an adapter test suite, I would include these cases using fixtures based on the selected model’s documented contract:
- Completed with a documented URL: resolve that result, but keep asset retrieval as a separate outcome.
- Completed without
video_url, with a documented alternate result: use the model-specific mapping rather than report generation failure. - Completed without a URL, with documented content-route support: select that retrieval route without assuming a successful download.
- Completed with no supported retrieval path identified: retain the job status and report retrieval as unresolved. Do not invent a fallback endpoint.
These are suggested tests, not reported execution results. The guide establishes optional URL handling and conditional retrieval paths; it does not establish URL lifetime, universal proxy coverage, or a download guarantee.
The useful boundary is simple: CometAPI job completion answers one question; your selected model’s retrieval contract answers another. Keep both visible in the adapter instead of reducing them to status == completed && video_url.