Skip to content

Add a cancel option when exporting#34

Merged
LeviXIII merged 1 commit into
mainfrom
cancel-export
Jun 15, 2026
Merged

Add a cancel option when exporting#34
LeviXIII merged 1 commit into
mainfrom
cancel-export

Conversation

@TimRl

@TimRl TimRl commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

frontier-authentication — AbortSignal support for LFS downloads

#997

Summary

Adds cooperative cancellation to downloadLFSFile so callers (e.g. a project
export being cancelled in codex-editor) can abort an in-flight LFS download
near-instantly, without breaking unrelated callers that are sharing the same
deduplicated download.

Changes

  • FrontierAPI.downloadLFSFile gains an optional signal?: AbortSignal, threaded
    through getLFSDownloadActiondownloadLFSObjectdoDownloadLFSObject and
    into the underlying batch and file fetches.
  • Refcounted abort for deduplicated downloads: the shared in-flight download
    is driven by its own AbortController; per-caller signals only stop that
    caller's await (via Promise.race). The shared fetch is aborted only once
    every waiter has aborted — so one caller cancelling can't kill a co-waiter
    downloading the same OID.
  • Aborted requests propagate AbortError untouched so callers can distinguish a
    user cancellation from a genuine download failure.
  • Hardened the dedup map cleanup (promise.then(clear, clear)) so a rejected
    shared download can't surface as an unhandled rejection or leave a stale entry.

Testing Checklist

  • Cancel an export while LFS objects are downloading → downloads abort
    promptly and surface as cancellation, not errors.
  • Two callers request the same OID; one aborts → the other still completes.
  • All waiters for an OID abort → the shared fetch is actually cancelled (no
    lingering bandwidth use).
  • An already-aborted signal never joins/starts a shared download.
  • Normal (uncancelled) downloads and the dedup fast-path still work.

@TimRl

TimRl commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator Author

/build

@github-actions

Copy link
Copy Markdown

@LeviXIII LeviXIII merged commit 66bd984 into main Jun 15, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants