mirror of
https://github.com/Comfy-Org/comfy-typescript-sdk.git
synced 2026-11-04 23:47:27 +00:00
[PR #203] fix(jobs): floor job.events()'s 429 reconnect pause at one second #202
Labels
No labels
audit:ai-readiness
audit:community
audit:github
audit:health-scoring
audit:policy
audit:release
audit:supply-chain
bug
cursor-review-pin
effort:medium
effort:small
effort:trivial
priority:nice-to-have
priority:recommended
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-typescript-sdk#202
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-typescript-sdk/pull/203
Author: @mattmillerai
Created: 10/9/2026
Status: 🔄 Open
Base:
main← Head:matt/be-19930-floor-events-429-pause📝 Commits (1)
26f9f96fix(jobs): floor job.events()'s 429 reconnect pause at one second📊 Changes
5 files changed (+53 additions, -8 deletions)
View changed files
📝
CHANGELOG.md(+4 -0)📝
src/sdk/client.ts(+1 -3)📝
src/sdk/jobs.test.ts(+24 -0)📝
src/sdk/jobs.ts(+14 -5)➕
src/sdk/retry-pause.ts(+10 -0)📄 Description
Summary
Job.events()turned a429carryingRetry-After: 0into a reconnect pause of0 * 1000ms. Only the 60 s ceiling (MAX_RECONNECT_PAUSE_MS) bounded that value, so the loop ran SSE connect (429) →refresh()→abortableSleep(0)→ repeat. It had no retry budget and kept going as long as the job was non-terminal and the caller's signal stayed un-aborted.submit()andlistJobs()already floor the same value atMIN_RETRY_PAUSE_MS = 1_000throughretryThrottled. This PR applies that floor toevents()too.src/sdk/retry-pause.ts(new): a leaf module exportingMIN_RETRY_PAUSE_MS.client.tsimportsjobs.ts, sojobs.tscan't import the constant fromclient.ts.client.tsnow imports it from here, with no change in behaviour.src/sdk/jobs.ts: the 429 pause is nowmin(max(retryAfterMs, MIN_RETRY_PAUSE_MS), MAX_RECONNECT_PAUSE_MS), and the constant comment says the pause is bounded on both sides. The non-429 mid-stream reconnect pause (RECONNECT_PAUSE_MS = 100) is untouched. The omitted-header and invalid-header fallback (2 s) is already above the floor, so it doesn't change.src/sdk/jobs.test.ts:it.each(["0", "1"])asserts the pause is1_000. It also checks request amplification: exactly one SSE connect and one extra poll inside a 300 ms window."1"is the boundary case.CHANGELOG.md: added an entry under Unreleased → Fixed.Comfy Cloud sends
Retry-After: 5today, so this is defence in depth forCOMFY_BASE_URLdeployments and proxies. It follows the same "misbehaving server" reasoning as the existing ceiling.The Python SDK needs no change. Its
Job.events()doesn't retry a 429 at all, so it has no equivalent loop to floor. No public surface or spec change, so the parity and spec-coverage tests are unaffected.Self-review notes
Math.min(Math.max(...)). The floor (1 s) is below the ceiling (60 s), so the clamp order can't invert. Thenull→ 2 s default path is unchanged.parseRetryAfterusesparseInt, so a sub-second value like0.5reaches this code as0and is covered by the"0"case.node scripts/check-public-repo-hygiene.mjsruns the public-repo hygiene check. That script is no longer in the repo; CI now calls a shared reusable workflow. Instead I grepped the diff by hand for the ticket-ID pattern and for internal links, and found nothing. The stale AGENTS.md line is out of scope for this PR.Residual
node scripts/check-public-repo-hygiene.mjslocally. That script was replaced by the shared reusable workflow.github/workflows/public-repo-hygiene.yml, so the documented local command fails withMODULE_NOT_FOUND. A docs follow-up should point it at the new mechanism. This PR doesn't fix that.Provenance
pnpm test)pnpm lint,pnpm format:check,pnpm typecheck)pnpm check:spec-drift)Retry-After: 0test fails and the"1"boundary case passes, as expectedlistJobs()gets the existing floor throughretryThrottled, as the changelog wording says"1"boundary case was included.🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.