mirror of
https://github.com/Comfy-Org/comfy-swift-sdk.git
synced 2026-11-04 23:47:26 +00:00
[GH-ISSUE #12] Migrate job cancel onto POST /api/jobs/{job_id}/cancel #2
Labels
No labels
enhancement
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Comfy-Org/comfy-swift-sdk#2
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @mattmillerai on GitHub (Jun 21, 2026).
Original GitHub issue: https://github.com/Comfy-Org/comfy-swift-sdk/issues/12
Background
The OpenAPI contract drift check (added in #11) flags two endpoints the SDK depends on that are on the deprecation path toward
/api/jobs:Transport.fetchJobStatus(reattach / polling status read)GET /api/prompt/{prompt_id}GET /api/jobs/{job_id}(getJobDetail)Transport.cancelJob(cooperative + reattach cancel)POST /api/queue {"delete":[id]}deprecated: truePOST /api/jobs/{job_id}/cancel(cancelJob)Both appear as non-blocking warnings in the
OpenAPI ContractCI job today.Key fact
prompt_idandjob_idare the same identifier.JobHandle.id(aprompt_idfromsubmit) is already the correct path parameter for/api/jobs/{job_id}— no id mapping or extra lookup is required.What changes
GET /api/jobs/{job_id}→JobDetailResponseStatus enum remap (
JobDetailResponse.statusisuser-friendly, not the legacy ComfyUI strings):/api/jobs)/api/prompt/{id})JobEventpendingqueued.queuedin_progressrunning.progresscompletedsuccess.completefailederror.failedcancelledcancelled.cancelledoutputsis unchanged — the spec describes it as the "Full outputs object from ComfyUI", i.e. the same node-keyed{images/videos/...}dict the SDK already decodes viaNodeOutputPayload. The/api/viewbyte-fetch path does not change.execution_error→ExecutionError(structured) for the.failedmapping;execution_statuscarries the timeline/progress.POST /api/jobs/{job_id}/cancel→JobCancelResponse{ "cancelled": boolean }. The SDK fires this best-effort and yields.cancelled, same as today.Affected files
Internal/Transport.swift—fetchJobStatus,cancelJobInternal/DTOs/JobStatusDTO.swift— add the/api/jobsresponse DTO + status normalization (foundation added in the linked PR)Internal/PollingFallback.swift,Internal/ReattachCoordinator.swift— status-string handlingInternal/WebSocketSession.swift— cooperative-cancel POSTScripts/contract/sdk-endpoints.yml(move the two entries onto/api/jobs)Acceptance criteria
fetchJobStatusreadsGET /api/jobs/{job_id}and maps the new status enumcancelJobpostsPOST /api/jobs/{job_id}/cancel/api/viewpath/api/jobs; drift check returns 0 warnings for thesecloud.comfy.orgconfirms a real submit → status → output → cancel round-trip (this is the only thing the unit suite cannot prove)Out of scope
WebSocket
/wsand/oauth/*— not modeled by the contract; unaffected.🤖 Generated with Claude Code
@coderabbitai[bot] commented on GitHub (Jun 21, 2026):
🔗 Related PRs
Comfy-Org/ComfyUI#14493 - Add jobs-namespace cancel endpoints (POST /api/jobs/{job_id}/cancel, POST /api/jobs/cancel) [merged]
Comfy-Org/comfy-cloud-mcp-server#384 - feat: add wait_for_job blocking tool to replace get_job_status polling (BE-1231) [merged]
Comfy-Org/ComfySwiftSDK#5 - fix(reattach): retry transient catch-up GET failures instead of failing the stream [merged]
Comfy-Org/ComfySwiftSDK#8 - fix(transport): migrate job-status fetch off tombstoned /api/prompt to /api/jobs [merged]
Comfy-Org/ComfySwiftSDK#11 - CI: build/test workflow + OpenAPI contract drift check [closed]
🧪 Issue enrichment is currently in open beta.
You can configure auto-planning by selecting labels in the issue_enrichment configuration.
To disable automatic issue enrichment, add the following to your
.coderabbit.yaml:💬 Have feedback or questions? Drop into our discord!
@mattmillerai commented on GitHub (Jun 21, 2026):
Update: the status-read half of this migration already shipped in #8 (
GET /api/prompt/{id}→GET /api/jobs/{job_id}, with the status enum remap). This issue now tracks only the remaining piece:Transport.cancelJob/WebSocketSessioncooperative cancel still post to the deprecatedPOST /api/queue {"delete":[id]}.POST /api/jobs/{job_id}/cancel(prompt_id==job_id), response{ "cancelled": boolean }, fired best-effort, still yielding.cancelled.POST /api/queueentry inScripts/contract/sdk-endpoints.ymlonto/api/jobs/{job_id}/cancel— the contract drift check will go to 0 warnings.Gate: a staging smoke test confirming a real cancel round-trip.