Skip to content

[Bug]: onOutput callback is called twice when errors occurs during DevEngine build #7835

@leegeunhyeok

Description

@leegeunhyeok

Reproduction link or steps

StackBlitz

What is expected?

The onOutput callback should be invoked only once with the error when the build fails.

What is actually happening?

When performing the initial build via devEngine.run(), if the build fails due to incorrect code or other errors, the build is re-triggered, causing an unnecessary rebuild and the onOutput callback to be invoked again.

Image

System Info

System:
    OS: macOS 15.1.1
    CPU: (8) arm64 Apple M1 Pro
    Memory: 141.39 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.21.1 - /Users/ghlee/.local/share/mise/installs/node/22.21.1/bin/node
    Yarn: 4.12.0 - /Users/ghlee/.nvm/versions/node/v22.12.0/bin/yarn
    npm: 11.7.0 - /Users/ghlee/.local/share/mise/installs/node/22.21.1/bin/npm
  Browsers:
    Chrome: 143.0.7499.193
    Safari: 18.1.1

Any additional comments?

I've identified that this is caused by the BundleCoordinator implementation (Code): when a build fails, a full build task is queued again, causing the build process to run a second time.

CoordinatorState::FullBuildFailed | CoordinatorState::Failed => {
  // Clear all queued tasks and schedule a new full build
  self.queued_tasks.clear();
  self.queued_tasks.push_back(TaskInput::FullBuild); // 👈 Re-build task queued here
  let schedule_result = self.schedule_build_if_stale().await;
  schedule_result.map(|ret| EnsureLatestBundleOutputReturn {
    future: ret.future,
    is_ensure_latest_bundle_output_future: true,
  })
}

Metadata

Metadata

Assignees

Labels

Type

Priority

None yet

Effort

None yet

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions