Skip to content

Fix run command hanging on compile errors for OpenQASM and Q# programs#3155

Merged
minestarks merged 3 commits into
mainfrom
minestarks/fix-openqasm-run
Apr 27, 2026
Merged

Fix run command hanging on compile errors for OpenQASM and Q# programs#3155
minestarks merged 3 commits into
mainfrom
minestarks/fix-openqasm-run

Conversation

@minestarks
Copy link
Copy Markdown
Member

@minestarks minestarks commented Apr 23, 2026

Running a program with compile errors via the Copilot tools (or VS Code) would hang indefinitely. The run WASM function emits Result events via a callback, and the JS caller waits for at least one to resolve its promise. When compilation failed, the error was returned without emitting an event, so the promise never resolved.

This affected two cases:

  • OpenQASM programs with any compile error
  • Q# programs with broken dependencies (errors from into_qsc_args)

Repro — OpenQASM (missing include "stdgates.inc";):

OPENQASM 3.0;
qubit[2] q;
CX q[0], q[1];
bit[2] c;
c = measure q;

Repro — Q# (project references a dependency that doesn't compile):

samples/scratch/
├── qsharp.json              # {"dependencies": {"BrokenDep": {"path": "../scratch/broken_dep"}}}
├── src/Main.qs
└── broken_dep/
    ├── qsharp.json
    └── src/Lib.qs           # has type errors

Changes:

  • get_configured_interpreter_from_openqasm now returns Vec<interpret::Error> instead of a pre-serialized JSON string, giving callers access to structured errors
  • Callers that need the JSON string (get_qir, get_estimates, get_circuit) apply map_err themselves
  • runWithNoise now emits a Result event before returning on compile errors, for both OpenQASM and Q# paths
  • Extract emit_run_error helper to deduplicate the emit-then-return pattern across all error sites
  • Extract run_interpreter to share the shot loop between the Q# and OpenQASM paths
  • Fix DebugService::load_program to call render_errors on OpenQASM compile errors (was returning raw error type)

@minestarks minestarks force-pushed the minestarks/fix-openqasm-run branch from 2fa3f7d to ae315ed Compare April 24, 2026 14:09
@minestarks minestarks changed the title Fix OpenQASM run tool hanging on compilation errors Fix run/debug hanging on compile errors for OpenQASM and Q# programs Apr 24, 2026
@minestarks minestarks changed the title Fix run/debug hanging on compile errors for OpenQASM and Q# programs Fix run command hanging on compile errors for OpenQASM and Q# programs Apr 24, 2026
@minestarks minestarks added this pull request to the merge queue Apr 27, 2026
Merged via the queue into main with commit 5df9f7b Apr 27, 2026
12 checks passed
@minestarks minestarks deleted the minestarks/fix-openqasm-run branch April 27, 2026 13:04
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