mirror of
https://github.com/Comfy-Org/comfy-swift-sdk.git
synced 2026-11-04 23:47:26 +00:00
[PR #8] [MERGED] fix(transport): migrate job-status fetch off tombstoned /api/prompt to /api/jobs #13
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#13
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?
📋 Pull Request Information
Original PR: https://github.com/Comfy-Org/comfy-swift-sdk/pull/8
Author: @mattmillerai
Created: 6/19/2026
Status: ✅ Merged
Merged: 6/19/2026
Merged by: @mattmillerai
Base:
main← Head:matt/be-1615-comfyswiftsdk-migrate-http-job-status-fetch-off-the📝 Commits (1)
f2d636cfix(transport): migrate job-status fetch off tombstoned /api/prompt to /api/jobs📊 Changes
9 files changed (+781 additions, -222 deletions)
View changed files
📝
Sources/ComfySwiftSDK/Internal/DTOs/JobStatusDTO.swift(+77 -46)📝
Sources/ComfySwiftSDK/Internal/PollingFallback.swift(+43 -35)📝
Sources/ComfySwiftSDK/Internal/ReattachCoordinator.swift(+19 -9)📝
Sources/ComfySwiftSDK/Internal/Transport.swift(+6 -6)➕
Tests/ComfySwiftSDKTests/JobStatusEndpointMigrationTests.swift(+434 -0)📝
Tests/ComfySwiftSDKTests/OutputFetchTransientRetryTests.swift(+21 -18)📝
Tests/ComfySwiftSDKTests/PollingFallbackTests.swift(+164 -94)📝
Tests/ComfySwiftSDKTests/ReattachCoordinatorTests.swift(+16 -13)📝
Tests/ComfySwiftSDKTests/ReattachTransientRetryTests.swift(+1 -1)📄 Description
ELI5
The app was checking an old job-status URL that Cloud deliberately turns into a 404 — so whenever the live WebSocket dropped and the SDK fell back to polling, every backgrounded job looked permanently failed. This PR points the polling and reattach paths at the real
/api/jobs/{id}endpoint and decodes its current response shape, so jobs that were running in the background actually recover when connectivity returns.What
performFetchJobStatusURL changed fromapi/prompt/{id}toapi/jobs/{id}.JobStatusDTOrewritten asJobDetailResponsemirroring theJobDetailResponseschema from the ingest OpenAPI spec. Fields decoded:id,status,outputs,execution_error(asJobDetailExecutionError),create_time,update_time. Atypealias JobStatusDTO = JobDetailResponsekeeps existing internal call sites compiling.pending→ active/queued;in_progress→ active/progress;completed→ terminal success;failed→ terminal failure;cancelled→ cancelled. The old legacy values (queued,running,success,error) are gone from the switch statements.derivePhasenow operates onstatusalone (the HTTP endpoint carries no per-node progress hints); onfailed, it readsexecution_error.node_typeto derive a phase label.deriveFractionalways returns0.0(progress fraction is WebSocket-only)./api/prompt/{id}in Transport, ReattachCoordinator, PollingFallback, and the DTO file updated to/api/jobs/{id}.Why
GET /api/prompt/{id}is a deliberate 404 tombstone in Cloud (legacyNotFoundHandler). The previously-merged retry PRs hardened the symptom (transient backoff on network errors); this is the root-cause fix that points the SDK at the endpoint that actually exists.Testing
JobStatusEndpointMigrationTestssuite covers all five status values on both the reattach and polling paths, the URL regression guard asserting the path is/api/jobs/{id}and never/api/prompt/{id}, and unchanged auth/rate-limit error classifications.PollingFallbackTests,ReattachCoordinatorTests,ReattachTransientRetryTests, andOutputFetchTransientRetryTestsupdated to use the new status enum values and DTO shape.swift buildclean;swift testgreen — 143 tests across 17 suites, 0 failures.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.