feat: add get_workflow() to fetch the graph that produced a job - #47
feat: add get_workflow() to fetch the graph that produced a job#47wei-hai wants to merge 1 commit into
Conversation
A caller holding a job — including one rehydrated by id — had no way to see
the workflow behind it. The SDK holds the graph only when it submitted the
job in the same process; otherwise it is gone.
Calls GET /api/v2/jobs/{id}/workflow and returns both the graph and the
format discriminator. "api" is the executed graph, with editor-only
constructs already resolved away; "save" is the authoring workflow at the
version the job ran. Returning the discriminator matters: a caller must be
able to tell which shape it holds.
Written by hand rather than through the generated client, because the
vendored spec does not describe this endpoint yet. It moves onto the
generated client once the spec re-syncs.
Named to match the existing get_download_url(), and mirrored as getWorkflow()
in the TypeScript SDK.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughThe SDK adds synchronous and asynchronous job workflow retrieval. It introduces the public ChangesJob workflow retrieval
Estimated code review effort: 3 (Moderate) | ~20 minutes Mergeability Score: 🟡 Moderate · up to The new accessor fetches a job’s workflow over the network, but the required server endpoint currently returns 404 and the client is awaiting the corresponding specification update. The PR is not merge-ready until that dependency lands. Sequence Diagram(s)sequenceDiagram
participant Caller
participant Job
participant ComfyLow
participant WorkflowEndpoint
Caller->>Job: get_workflow()
Job->>ComfyLow: get_job_workflow(job_id)
ComfyLow->>WorkflowEndpoint: GET /jobs/{id}/workflow
WorkflowEndpoint-->>ComfyLow: workflow envelope or 404
ComfyLow-->>Job: response or translated error
Job-->>Caller: JobWorkflow
Suggested reviewers: [fallback: fixed issue severity unavailable] 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
The required post-sync step: scripts/gen_models.sh against the newly vendored spec, so the drift gate passes. Picks up JobWorkflowResponse and the new job_id/expires_at fields on Asset and Output. Coverage still fails until the two new operations have transport wrappers — getJobWorkflow (#47) and deleteAsset (#41) — since OPERATION_IDS must match the spec exactly. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* feat: add asset delete
* address coderabbit PR comments
* address coderabbit PR comments
* feat: add get_workflow() to fetch the graph that produced a job
A caller holding a job — including one rehydrated by id — had no way to see
the workflow behind it. The SDK holds the graph only when it submitted the
job in the same process; otherwise it is gone.
Calls GET /api/v2/jobs/{id}/workflow and returns both the graph and the
format discriminator. "api" is the executed graph, with editor-only
constructs already resolved away; "save" is the authoring workflow at the
version the job ran. Returning the discriminator matters: a caller must be
able to tell which shape it holds.
Written by hand rather than through the generated client, because the
vendored spec does not describe this endpoint yet. It moves onto the
generated client once the spec re-syncs.
Named to match the existing get_download_url(), and mirrored as getWorkflow()
in the TypeScript SDK.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* chore: sync vendored Comfy API v2 spec from cloud@7c65b1a
* chore: regenerate comfy_low models for the synced spec
The required post-sync step: scripts/gen_models.sh against the newly vendored
spec, so the drift gate passes. Picks up JobWorkflowResponse and the new
job_id/expires_at fields on Asset and Output.
Coverage still fails until the two new operations have transport wrappers —
getJobWorkflow (#47) and deleteAsset (#41) — since OPERATION_IDS must match
the spec exactly.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* chore: wire the synced spec's new operations into comfy_low
Registers getJobWorkflow and deleteAsset in OPERATION_IDS/OPERATION_METHODS,
moves get_job_workflow onto the generated JobWorkflowResponse model, and
fixes six delete-asset test call sites that still passed the base URL
positionally after that constructor argument was replaced by COMFY_BASE_URL.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: jab416171 <jab416171@gmail.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: wei-hai <2936715+wei-hai@users.noreply.github.com>
A caller holding a job — including one rehydrated by id — has no way to see the workflow behind it. The SDK holds the graph only when it submitted the job in the same process; otherwise it's gone.
flowchart LR subgraph B["Before"] J1["job (rehydrated by id)"] -. "?" .-> W1["workflow"] end subgraph A["After"] J2["job"] -- "GET /jobs/{id}/workflow" --> W2["workflow + format"] endWhat it returns
Both the graph and the
formatdiscriminator, never just the graph:api— the executed graph. Editor-only constructs (Note nodes, Get/Set) are already resolved away.save— the authoring workflow at the version the job ran, un-mangled. Only for jobs that pin a workflow version; jobs submitted through this SDK today always getapi.Callers must branch on
format— which shape comes back depends on how the job was submitted, not on anything the caller controls.Server side is merged
GET /api/v2/jobs/{id}/workflowlanded in Comfy-Org/cloud#6642, so this now works against a live server.One follow-up, deliberately not done here
The transport call is written by hand, because the vendored spec didn't describe the operation when this was written. The spec-sync PR carrying it is open in this repo — once that merges, this call should move onto the generated client and the hand-written request dropped. A comment in the code marks the spot.
Keeping the two separate so this PR stays reviewable on its own;
spec/openapi.yamlandspec/VERSIONare untouched here and the drift check passes.Naming
Matches the existing
get_download_url/getDownloadUrlprecedent for a network-fetching accessor, and the two SDKs stay in lockstep.🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Bug Fixes