wai-quantum-qpu and wai-quantum-cli: a job on a provider outlives what sent it #581

Closed
dcharlot wants to merge 2 commits from wai/quantum-provider-jobs into main
Owner

Replaced by #590: these two commits replayed on main after #578, which conflicted in the changelog, with the desktop app and the Studio on top.

A job on a person's own provider now outlives whatever sent it.

Until now a run waited in its process. A job not finished in two hours was cancelled at the provider, losing its place in the queue. If the process stopped first, the job went on and its id was gone, so its counts could not be read, and it may still have been billed. A device's queue can take days.

What changes

A job is written down before it is sent, and nothing is held while it waits.

Moment What happens now
Before sending The job, its compiled program and what its receipt will say are recorded. If that cannot be written, nothing is sent
The provider takes it Its id is added to the record
The wait runs out The job is left at the provider. Only someone asking cancels it
The process stops The job goes on. Any later process collects it by its handle
Collecting Counts are read against the program that was sent, whatever the device's calibration has become since
A request that did not complete It may have reached the provider, so it is never sent again: that could be a second bill. The record says so

wai-quantum-qpu: job::start, check, follow, cancel and progress_of, and a ledger module. job::run is unchanged: it keeps no record, so it still cancels what outlasts its bound, and nothing goes on being spent with no one to collect it.

wai-quantum-cli: run --provider records its job and says its handle, and --no-wait answers at once. New: providers jobs, providers collect and providers cancel. collect exits 0 done, 1 ended otherwise, 2 still at the provider, and 75 when it could not ask, which says nothing of the job.

MCP: run_on_provider answers within a call (50 s, as the job service does) with the job running and its id, in job.v1's form. New tools: get_provider_job, cancel_provider_job, list_provider_jobs. Their answers use compact schemas: pointing them at job.v1 added about 770 KB to the tool list every host loads, and this adds about 12 KB.

wai.quantum.provider/1: a new §5.7 on what a job outlasting its client asks of a provider and a client. Nothing on the wire changes.

What a caller sees differently

A run --provider that outlasts its two hours now exits 2 with the job still at the provider, where before it cancelled the job and failed. The change is in the changelog. wai breaking reports no unacknowledged breaking change.

Checked

  • wai-quantum-qpu: cargo test --locked, every target passed; clippy clean. The workflow's pinned library count goes from 34 to 46 for the twelve new tests, and five of them are named so CI fails if any stops running; both checks were replayed against the first CI run's log.
  • wai-quantum-cli: cargo test --locked --release, every target passed, including two new end-to-end tests over HTTP: the sending command is killed mid-wait and the job is collected later; an agent comes back to a job by id and cancels it. Clippy clean with and without default features. smoke.sh, every check held.
  • The promises themselves: ten deliberate breakages, each caught by the test that names it. Among them: cancelling when the wait runs out, sending before recording, treating an incomplete request as refused, asking after a job left mid-send, and letting any handle reach a file.
  • A collected job against a run: on a seeded reference provider, the sealed counts, compiled program, provider, calibration, cost and energy are identical to a direct run, and the receipt verifies.
  • A real bug these found: the count of status checks reset between commands, so a job collected over several processes sealed the wrong count.
  • wai breaking, the repository checks and the public-name check are clean. The docs checker passes the changed pages apart from blocks that need the service or Rust options, which CI runs in full.

Not checked

  • No real device. Everything ran against the reference provider. The built-in protocols go through the same code and the same recorded program, but have not collected a job across processes against a live service.
  • API compatibility runs in CI only; cargo-semver-checks is not on the hosts I ran this on.

Not in this change

The desktop app still calls job::run, so it still cancels at two hours. Moving it needs the Studio to show a job still waiting, and it follows once the desktop release in #580 is out.

🤖 Generated with Claude Code

**Replaced by #590**: these two commits replayed on main after #578, which conflicted in the changelog, with the desktop app and the Studio on top. A job on a person's own provider now outlives whatever sent it. Until now a run waited in its process. A job not finished in two hours was **cancelled at the provider**, losing its place in the queue. If the process stopped first, the job went on and its id was gone, so its counts could not be read, and it may still have been billed. A device's queue can take days. ## What changes A job is written down before it is sent, and nothing is held while it waits. | Moment | What happens now | |---|---| | Before sending | The job, its compiled program and what its receipt will say are recorded. If that cannot be written, nothing is sent | | The provider takes it | Its id is added to the record | | The wait runs out | The job is left at the provider. Only someone asking cancels it | | The process stops | The job goes on. Any later process collects it by its handle | | Collecting | Counts are read against the program that was sent, whatever the device's calibration has become since | | A request that did not complete | It may have reached the provider, so it is **never sent again**: that could be a second bill. The record says so | **`wai-quantum-qpu`:** `job::start`, `check`, `follow`, `cancel` and `progress_of`, and a `ledger` module. `job::run` is unchanged: it keeps no record, so it still cancels what outlasts its bound, and nothing goes on being spent with no one to collect it. **`wai-quantum-cli`:** `run --provider` records its job and says its handle, and `--no-wait` answers at once. New: `providers jobs`, `providers collect` and `providers cancel`. `collect` exits 0 done, 1 ended otherwise, 2 still at the provider, and 75 when it could not ask, which says nothing of the job. **MCP:** `run_on_provider` answers within a call (50 s, as the job service does) with the job running and its id, in `job.v1`'s form. New tools: `get_provider_job`, `cancel_provider_job`, `list_provider_jobs`. Their answers use compact schemas: pointing them at `job.v1` added about 770 KB to the tool list every host loads, and this adds about 12 KB. **`wai.quantum.provider/1`:** a new §5.7 on what a job outlasting its client asks of a provider and a client. Nothing on the wire changes. ## What a caller sees differently A `run --provider` that outlasts its two hours now exits 2 with the job still at the provider, where before it cancelled the job and failed. The change is in the changelog. `wai breaking` reports no unacknowledged breaking change. ## Checked - **`wai-quantum-qpu`:** `cargo test --locked`, every target passed; clippy clean. The workflow's pinned library count goes from 34 to 46 for the twelve new tests, and five of them are named so CI fails if any stops running; both checks were replayed against the first CI run's log. - **`wai-quantum-cli`:** `cargo test --locked --release`, every target passed, including two new end-to-end tests over HTTP: the sending command is killed mid-wait and the job is collected later; an agent comes back to a job by id and cancels it. Clippy clean with and without default features. `smoke.sh`, every check held. - **The promises themselves:** ten deliberate breakages, each caught by the test that names it. Among them: cancelling when the wait runs out, sending before recording, treating an incomplete request as refused, asking after a job left mid-send, and letting any handle reach a file. - **A collected job against a run:** on a seeded reference provider, the sealed counts, compiled program, provider, calibration, cost and energy are identical to a direct run, and the receipt verifies. - **A real bug these found:** the count of status checks reset between commands, so a job collected over several processes sealed the wrong count. - `wai breaking`, the repository checks and the public-name check are clean. The docs checker passes the changed pages apart from blocks that need the service or Rust options, which CI runs in full. ## Not checked - **No real device.** Everything ran against the reference provider. The built-in protocols go through the same code and the same recorded program, but have not collected a job across processes against a live service. - **API compatibility** runs in CI only; `cargo-semver-checks` is not on the hosts I ran this on. ## Not in this change The desktop app still calls `job::run`, so it still cancels at two hours. Moving it needs the Studio to show a job still waiting, and it follows once the desktop release in #580 is out. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
wai-quantum-qpu and wai-quantum-cli: a job on a provider outlives what sent it
Some checks failed
wai-quantum studio and desktop / does this change touch it (pull_request) Successful in 21s
wai-quantum-qpu / credentials in the keychain (macos) (pull_request) Successful in 41s
repository checks / lockfiles, advisories, tests in CI, workflow hygiene, spec and section references, public text (pull_request) Successful in 3m56s
wai-quantum views in agent hosts / does this change touch it (pull_request) Successful in 19s
WAI breaking changes and the conformance runner / WAI breaking and conform · their tests, and the independent verifiers through wai conform · linux (pull_request) Successful in 2m48s
wai-quantum editors / editors · macos (pull_request) Successful in 1m39s
wai-quantum command line / command line · linux (pull_request) Successful in 3m8s
wai-quantum docs, course and locales / the Studio's words in every locale · linux (pull_request) Successful in 19s
wai-quantum service / service energy · linux packages (pull_request) Successful in 1m58s
wai-quantum for Python / python · macos (pull_request) Successful in 2m47s
wai-quantum docs, course and locales / the course and the command line's languages · linux (pull_request) Successful in 2m14s
wai-quantum contract / API compatibility · linux (pull_request) Successful in 4m43s
wai-quantum-qpu / clients against their contracts (linux) (pull_request) Failing after 39s
wai-quantum editors / editors · linux (pull_request) Successful in 2m20s
wai-quantum contract / schemas and the committed tool lists · linux (pull_request) Successful in 6m27s
wai-quantum service / service · macos (pull_request) Successful in 4m31s
standards workspaces build + test / macOS energy backends (pull_request) Successful in 7m51s
wai-quantum for Python / python · linux (pull_request) Successful in 2m48s
wai-quantum studio and desktop / desktop app · macos (pull_request) Successful in 5m31s
WAI energy receipts / energy receipts · macos (pull_request) Successful in 8m12s
wai-quantum studio and desktop / studio · browser (pull_request) Successful in 3m50s
wai-quantum views in agent hosts / views · the page and its engine (pull_request) Successful in 3m15s
wai-quantum service / service · linux (pull_request) Successful in 5m5s
wai-quantum studio and desktop / desktop app · windows (pull_request) Successful in 9m50s
wai-quantum studio and desktop / desktop app · linux (pull_request) Successful in 5m27s
wai-quantum views in agent hosts / views · a scripted host (pull_request) Successful in 3m21s
WAI energy receipts / energy receipts · linux (pull_request) Successful in 13m39s
wai-quantum docs, course and locales / every command and snippet in the docs · linux (pull_request) Successful in 20m19s
standards workspaces build + test / joule-code-rs (joule-code/joule-code-rs, joule-code-rs, linux-arm64, true) (pull_request) Successful in 10m0s
WAI energy receipts / energy receipts · linux-arm64 (pull_request) Successful in 12m50s
ebd28a4100
A run on a person's provider waited in its process, and a job that had not
finished in two hours was cancelled at the provider, losing its place in the
queue. If the process stopped first, the job went on and its id was gone, so its
counts could not be read. A device's queue can take days.

A job is now written down before it is sent, with everything sealing it will
need, and the provider's id as soon as the provider gives one. Nothing that
cannot be recorded is sent. Any process can come back to the record, and its
counts are read against the program that was sent, whatever the device's
calibration has become. Running out of patience leaves the job where it is. A
request that did not complete may have reached the provider, so it is never sent
again: that could be a second bill.

The command line gains run --no-wait and providers jobs, collect and cancel. The
local MCP server's run_on_provider answers within a call, and gains
get_provider_job, cancel_provider_job and list_provider_jobs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
wai-quantum-qpu.yml: the library has 46 tests, and the record's promises are named
All checks were successful
wai-quantum service / service energy · linux packages (pull_request) Successful in 1m51s
wai-quantum studio and desktop / desktop app · windows (pull_request) Successful in 10m14s
WAI breaking changes and the conformance runner / WAI breaking · wire, record and API against main · linux (pull_request) Successful in 33s
WAI breaking changes and the conformance runner / WAI breaking and conform · their tests, and the independent verifiers through wai conform · linux (pull_request) Successful in 2m42s
wai-quantum command line / command line · macos (pull_request) Successful in 1m50s
wai-quantum command line / command line · linux (pull_request) Successful in 2m24s
wai-quantum editors / editors · macos (pull_request) Successful in 1m46s
wai-quantum contract / the policy is linked, and the deprecations page reads (pull_request) Successful in 4s
wai-quantum-qpu / credentials in the keychain (macos) (pull_request) Successful in 36s
standards workspaces build + test / macOS energy backends (pull_request) Successful in 9m8s
wai-quantum contract / API compatibility · linux (pull_request) Successful in 4m59s
wai-quantum for Python / python · macos (pull_request) Successful in 2m41s
WAI energy receipts / energy receipts · macos (pull_request) Successful in 9m28s
wai-quantum docs, course and locales / the course and the command line's languages · linux (pull_request) Successful in 2m9s
wai-quantum docs, course and locales / the Studio's words in every locale · linux (pull_request) Successful in 19s
wai-quantum contract / schemas and the committed tool lists · linux (pull_request) Successful in 6m8s
wai-quantum service / service · macos (pull_request) Successful in 4m6s
wai-quantum-qpu / clients against their contracts (linux) (pull_request) Successful in 48s
wai-quantum editors / editors · linux (pull_request) Successful in 2m19s
wai-quantum for Python / python · linux (pull_request) Successful in 2m58s
wai-quantum studio and desktop / desktop app · macos (pull_request) Successful in 5m40s
WAI energy receipts / energy receipts · linux (pull_request) Successful in 14m30s
wai-quantum studio and desktop / studio · browser (pull_request) Successful in 4m3s
wai-quantum service / service · linux (pull_request) Successful in 5m3s
wai-quantum views in agent hosts / views · the page and its engine (pull_request) Successful in 3m0s
wai-quantum studio and desktop / desktop app · linux (pull_request) Successful in 5m32s
wai-quantum views in agent hosts / views · a scripted host (pull_request) Successful in 3m27s
wai-quantum docs, course and locales / every command and snippet in the docs · linux (pull_request) Successful in 16m50s
standards workspaces build + test / joule-code-rs (joule-code/joule-code-rs, joule-code-rs, linux-arm64, true) (pull_request) Successful in 8m59s
WAI energy receipts / energy receipts · linux-arm64 (pull_request) Successful in 13m30s
e1857efb53
The library's pinned count goes from 34 to 46, for the twelve tests the provider
job record adds. Five of them are named so CI fails if any stops running: a
recorded job outlives what sent it, running out of patience does not cancel it,
nothing is sent that was not recorded, a job that may have been sent is never
sent again, and a handle reaches no file but a record's.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
dcharlot closed this pull request 2026-11-02 22:33:01 -05:00
All checks were successful
standards workspaces build + test / which workspaces this change touches (pull_request) Successful in 19s
WAI breaking changes and the conformance runner / WAI breaking · does this change touch WAI (pull_request) Successful in 9s
WAI energy receipts / does this change touch it (pull_request) Successful in 28s
wai-quantum command line / does this change touch it (pull_request) Successful in 39s
wai-quantum contract / does this change touch it (pull_request) Successful in 17s
wai-quantum docs, course and locales / does this change touch it (pull_request) Successful in 14s
wai-quantum editors / does this change touch it (pull_request) Successful in 15s
repository checks / lockfiles, advisories, tests in CI, workflow hygiene, spec and section references, public text (pull_request) Successful in 5m1s
wai-quantum-qpu / does this change touch it (pull_request) Successful in 16s
wai-quantum for Python / does this change touch it (pull_request) Successful in 17s
wai-quantum service / does this change touch it (pull_request) Successful in 23s
wai-quantum studio and desktop / does this change touch it (pull_request) Successful in 27s
wai-quantum views in agent hosts / does this change touch it (pull_request) Successful in 20s
wai-quantum service / service energy · linux packages (pull_request) Successful in 1m51s
wai-quantum studio and desktop / desktop app · windows (pull_request) Successful in 10m14s
WAI breaking changes and the conformance runner / WAI breaking · wire, record and API against main · linux (pull_request) Successful in 33s
WAI breaking changes and the conformance runner / WAI breaking and conform · their tests, and the independent verifiers through wai conform · linux (pull_request) Successful in 2m42s
wai-quantum command line / command line · macos (pull_request) Successful in 1m50s
wai-quantum command line / command line · linux (pull_request) Successful in 2m24s
wai-quantum editors / editors · macos (pull_request) Successful in 1m46s
wai-quantum contract / the policy is linked, and the deprecations page reads (pull_request) Successful in 4s
wai-quantum-qpu / credentials in the keychain (macos) (pull_request) Successful in 36s
standards workspaces build + test / macOS energy backends (pull_request) Successful in 9m8s
wai-quantum contract / API compatibility · linux (pull_request) Successful in 4m59s
wai-quantum for Python / python · macos (pull_request) Successful in 2m41s
WAI energy receipts / energy receipts · macos (pull_request) Successful in 9m28s
wai-quantum docs, course and locales / the course and the command line's languages · linux (pull_request) Successful in 2m9s
wai-quantum docs, course and locales / the Studio's words in every locale · linux (pull_request) Successful in 19s
wai-quantum contract / schemas and the committed tool lists · linux (pull_request) Successful in 6m8s
wai-quantum service / service · macos (pull_request) Successful in 4m6s
wai-quantum-qpu / clients against their contracts (linux) (pull_request) Successful in 48s
wai-quantum editors / editors · linux (pull_request) Successful in 2m19s
wai-quantum for Python / python · linux (pull_request) Successful in 2m58s
wai-quantum studio and desktop / desktop app · macos (pull_request) Successful in 5m40s
WAI energy receipts / energy receipts · linux (pull_request) Successful in 14m30s
wai-quantum studio and desktop / studio · browser (pull_request) Successful in 4m3s
wai-quantum service / service · linux (pull_request) Successful in 5m3s
wai-quantum views in agent hosts / views · the page and its engine (pull_request) Successful in 3m0s
wai-quantum studio and desktop / desktop app · linux (pull_request) Successful in 5m32s
wai-quantum views in agent hosts / views · a scripted host (pull_request) Successful in 3m27s
wai-quantum docs, course and locales / every command and snippet in the docs · linux (pull_request) Successful in 16m50s
standards workspaces build + test / joule-code-rs (joule-code/joule-code-rs, joule-code-rs, linux-arm64, true) (pull_request) Successful in 8m59s
WAI energy receipts / energy receipts · linux-arm64 (pull_request) Successful in 13m30s

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Transaction-Science/open-standards!581
No description provided.