Skip to content

fix: return Promise from Model.download() to enable await with progress callback#474

Merged
baijumeswani merged 2 commits intosamuel100/fix-model-download-awaitfrom
copilot/sub-pr-467
Feb 28, 2026
Merged

fix: return Promise from Model.download() to enable await with progress callback#474
baijumeswani merged 2 commits intosamuel100/fix-model-download-awaitfrom
copilot/sub-pr-467

Conversation

Copy link
Contributor

Copilot AI commented Feb 28, 2026

Model.download() was discarding the Promise returned by ModelVariant.download(), causing await to resolve immediately. This allowed load() to execute before the download completed, resulting in 'Model path does not exist' errors.

Changes

  • sdk_v2/js/src/model.ts: Changed download() to return the promise from selectedVariant.download() instead of discarding it
  • sdk_v2/js/src/imodel.ts: Updated IModel.download() interface signature from void to Promise<void>

Usage

// Now correctly awaitable — load() only runs after download completes
await model.download((progress) => console.log(`${progress}%`));
await model.load();

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@vercel
Copy link

vercel bot commented Feb 28, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
foundry-local Ready Ready Preview, Comment Feb 28, 2026 0:13am

Request Review

Co-authored-by: baijumeswani <12852605+baijumeswani@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix promise return from Model.download to enable correct await handling fix: return Promise from Model.download() to enable await with progress callback Feb 28, 2026
@baijumeswani baijumeswani marked this pull request as ready for review February 28, 2026 00:13
@baijumeswani baijumeswani merged commit 1b336c3 into samuel100/fix-model-download-await Feb 28, 2026
3 checks passed
@baijumeswani baijumeswani deleted the copilot/sub-pr-467 branch February 28, 2026 00:13
baijumeswani added a commit that referenced this pull request Feb 28, 2026
#467)

* fix: return promise from Model.download() to enable await with progress callback

Model.download() was discarding the Promise returned by ModelVariant.download(),
causing await to resolve immediately. This meant load() could run before the
download completed, resulting in 'Model path does not exist' errors.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix: return Promise from Model.download() to enable await with progress callback (#474)

* Initial plan

* Merge main into branch: resolve conflicts keeping Promise<void> fix

Co-authored-by: baijumeswani <12852605+baijumeswani@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: baijumeswani <12852605+baijumeswani@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: baijumeswani <12852605+baijumeswani@users.noreply.github.com>
prathikr pushed a commit that referenced this pull request Feb 28, 2026
#467)

* fix: return promise from Model.download() to enable await with progress callback

Model.download() was discarding the Promise returned by ModelVariant.download(),
causing await to resolve immediately. This meant load() could run before the
download completed, resulting in 'Model path does not exist' errors.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix: return Promise from Model.download() to enable await with progress callback (#474)

* Initial plan

* Merge main into branch: resolve conflicts keeping Promise<void> fix

Co-authored-by: baijumeswani <12852605+baijumeswani@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: baijumeswani <12852605+baijumeswani@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: baijumeswani <12852605+baijumeswani@users.noreply.github.com>
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