open-standards/wai/changes/2026-11-05-job-service-writes-program-for-task.md
Transaction Science 655b366aa1
Some checks failed
wai-quantum command line / does this change touch it (push) Successful in 25s
wai-quantum docs, course and locales / does this change touch it (push) Successful in 23s
WAI operation catalogue / does this change touch it (push) Successful in 28s
wai-quantum editors / does this change touch it (push) Successful in 23s
wai-quantum service / does this change touch it (push) Successful in 17s
wai-quantum for Python / does this change touch it (push) Successful in 18s
wai-quantum extension points / does this change touch it (push) Successful in 18s
wai-quantum error correction and mitigation / does this change touch it (push) Successful in 18s
wai-quantum variational and algorithm library / does this change touch it (push) Successful in 21s
wai-quantum studio and desktop / does this change touch it (push) Successful in 24s
wai-quantum views in agent hosts / does this change touch it (push) Successful in 19s
wai-quantum verdicts and repairs / does this change touch it (push) Successful in 21s
wai-sink-android native sink library / does this change touch it (push) Successful in 11s
WAI Studio / does this change touch it (push) Successful in 12s
wai-sink-swift native sink package / does this change touch it (push) Successful in 13s
wai-quantum resource estimation / does this change touch it (push) Successful in 2m1s
wai-quantum OpenQASM reader / does this change touch it (push) Successful in 2m22s
wai-quantum pulse and dynamics / does this change touch it (push) Successful in 2m22s
wai-quantum for JavaScript / does this change touch it (push) Successful in 2m25s
wai-quantum contract / does this change touch it (push) Successful in 2m32s
wai-quantum other formats / does this change touch it (push) Successful in 2m26s
joule-moq-room room service / joule-moq-room · does this change touch it (push) Successful in 2m46s
wai-audit collector and player integration / does this change touch it (push) Successful in 2m39s
wai-quantum command line / command line · macos (push) Successful in 2m38s
wai-quantum service / service energy · linux packages (push) Successful in 2m19s
wai-quantum editors / editors · macos (push) Successful in 4m22s
WAI breaking changes and the conformance runner / WAI breaking · does this change touch WAI (push) Successful in 12s
wai-quantum service / service · macos (push) Successful in 6m19s
wai-quantum studio and desktop / desktop app · macos (push) Successful in 4m50s
wai-quantum wasmQ / does this change touch it (push) Successful in 10s
wai-quantum for Python / python · macos (push) Successful in 6m32s
wai-quantum pulse and dynamics / the same bits · macos (push) Successful in 1m17s
wai-quantum docs, course and locales / the Studio's words in every locale · linux (push) Successful in 22s
wai-audit collector and player integration / collector, player integration and the browser end to end · macos (push) Successful in 1m26s
WAI operation catalogue / the catalogue and every door · linux (push) Failing after 45s
wai-quantum wasmQ / profile, engines, reference modules, adversarial, vectors · macos (push) Successful in 2m6s
wai-quantum service / service · linux (push) Failing after 36s
wai-quantum extension points / the registry under wasm32-wasip2 (wasmtime) (push) Failing after 33s
wai-quantum error correction and mitigation / codes, decoders, texts and mitigation · linux, release (push) Failing after 22s
wai-quantum studio and desktop / desktop app · linux (push) Failing after 4s
wai-quantum studio and desktop / studio · browser (push) Failing after 4s
wai-quantum variational and algorithm library / parameters, gradients, optimisers, VQE, QAOA and builders · linux, release (push) Failing after 2s
wai-quantum verdicts and repairs / verdicts, repairs and the intent set · linux (push) Failing after 2s
wai-sink-android native sink library / every ABI, the AAR, and the instrumented tests in a headless emulator · macos (push) Successful in 6m54s
wai-quantum docs, course and locales / the course and the command line's languages · linux (push) Successful in 2m58s
wai-quantum verdicts and repairs / the intent set and the verdict under wasm32-wasip2 (wasmtime) (push) Failing after 18s
wai-quantum views in agent hosts / views · the page and its engine (push) Failing after 6s
WAI Studio / Studio in WebKit · linux (push) Failing after 1m24s
WAI Studio / the catalogue's actions, the unit tests and the core · linux (push) Successful in 1m28s
wai-quantum extension points / the registry and the example · linux (push) Failing after 4m4s
WAI Studio / Studio in Chromium and Firefox · macos (push) Successful in 7m39s
wai-quantum OpenQASM reader / corpus under wasm32-wasip2 (wasmtime) (push) Successful in 1m6s
wai-quantum OpenQASM reader / reader and corpus · linux (push) Successful in 2m23s
wai-quantum editors / editors · linux (push) Successful in 6m26s
wai-quantum for JavaScript / javascript · linux (push) Successful in 3m35s
wai-quantum for Python / python · linux (push) Successful in 6m26s
wai-quantum views in agent hosts / views · a scripted host (push) Failing after 5m32s
wai-quantum other formats / the set under wasm32-wasip2 (wasmtime) (push) Successful in 2m45s
wai-quantum contract / the policy is linked, and the deprecations page reads (push) Successful in 11s
wai-quantum pulse and dynamics / reader, simulator and pulse jobs · linux, release (push) Successful in 1m43s
wai-quantum pulse and dynamics / reader, simulator and pulse jobs under wasm32-wasip2 (wasmtime) (push) Successful in 2m6s
wai-audit collector and player integration / collector · linux (push) Successful in 1m18s
wai-quantum wasmQ / the reference modules rebuild to their modules of record · linux (push) Successful in 40s
wai-quantum other formats / readers, writers and the set · linux (push) Successful in 5m23s
WAI breaking changes and the conformance runner / WAI breaking · wire, record and API against main · linux (push) Successful in 2m33s
repository checks / lockfiles, advisories, tests in CI, workflow hygiene, spec and section references, public text (push) Successful in 4m49s
wai-quantum extension points / the registry and the example · linux-arm64 (push) Failing after 3m4s
wai-quantum variational and algorithm library / parameters, gradients, optimisers, VQE, QAOA and builders · linux-arm64, release (push) Successful in 2m52s
wai-quantum wasmQ / interpreter and vectors under wasm32-wasip2 (wasmtime) (push) Successful in 2m50s
wai-quantum wasmQ / profile, engines, reference modules, adversarial, vectors · linux (push) Successful in 3m45s
wai-sink-swift native sink package / libwai slices, desktop tests, simulator tests · macos (push) Successful in 16m1s
WAI breaking changes and the conformance runner / WAI breaking and conform · their tests, and the independent verifiers through wai conform · linux (push) Successful in 6m20s
wai-quantum contract / API compatibility · linux (push) Successful in 7m48s
wai-quantum contract / schemas and the committed tool lists · linux (push) Successful in 7m49s
wai-quantum resource estimation / estimation and calibration · linux, release (push) Successful in 12m15s
joule-moq-room room service / joule-moq-room, every target (push) Successful in 5m29s
wai-sink-android native sink library / the JNI layer and the platform-free half on the host JVM · linux-arm64 (push) Successful in 10m57s
wai-quantum pulse and dynamics / the same bits · linux-arm64 (push) Successful in 11m28s
wai-quantum studio and desktop / desktop app · windows (push) Successful in 12m28s
wai-quantum docs, course and locales / every command and snippet in the docs · linux (push) Successful in 40m54s
wai-quantum command line / command line · linux (push) Successful in 53m9s
wai-quantum-service: POST /v1/write and write_circuit, a program written for a task on the service's own model
A caller sends a task in the course's exercise form; the service's own code model
writes an OpenQASM program for it with the writer's loop, the engine checks each
attempt as it checks a lesson's answer, and the answer is the transcript, sealed
with the service's receipt so POST /v1/verify checks it. Re-landed from #648.

- A write is a job (Work::Write): admitted in #676's order (the client's window
  first, then a reading turn, its programs read in the capped reading child),
  kept, reloaded and run again as a job is. A queued write keeps the plan it was
  admitted with across a restart and fails only if the service has no model.
- The writer process starts with the service from its kept binary copy, in the
  worker's sandbox on macOS, in its own process group, carrying the parent pid,
  first in line for the kernel under memory pressure. WAI_QSVC_WRITER_GB and
  WAI_QSVC_WRITE_SECS bound it; one client holds one queued or running write.
- Refusals J080 (no model, 503), J081 (task) and J082 (options); main's contracts
  hold J070 to J074. A write carries no contract, so the energy ceilings do not
  apply; its energy figure is built on the engine's own functions.
- Discovery (GET /v1, quantum_service_info), OpenAPI, the MCP task write_circuit,
  an attempt event per attempt, and its own label in GET /metrics.
- WAI_QSVC_WRITER_SCRIPT runs the scripted model in the model's place for tests;
  smoke.sh writes a Bell pair's program with SMOKE_WRITE=1 and otherwise checks
  that a service with no model refuses a write.
- offload.rs: each client counts the reading turns its requests actually hold,
  so no turn is lent past its share while one passes between its requests. The
  new test no_turn_is_lent_while_one_passes_between_a_client_s_requests fails
  3 of 3 on main and passes 3 of 3 here.

Tested on the Framework (Linux) and the M3 Ultra (macOS): service 140 tests and
clippy with warnings denied; wai-quantum full library 1,517; the engine-only and
engine+receipt builds with warnings denied; the writer leg; the course and docs
legs; check_schemas.py; smoke over HTTP with and without a scripted writer (its
receipt verifies, a changed transcript does not); the shipped image.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-09 20:59:46 -05:00

4.7 KiB

The job service writes a program for a task, on its own model

POST /v1/write and the MCP tool write_circuit: a service started with a model (WAI_QSVC_MODEL) writes an OpenQASM program for a task, an exercise in the course's form, with wai-quantum-writer's loop, the engine checking each attempt.

  • The result is the transcript (wai.quantum.write/1), sealed with the service's receipt as every result is, the writer's energy inside it, so POST /v1/verify checks it. Each attempt's timing is beside it, outside the signed body, and each attempt is an attempt event on GET /v1/jobs/{id}/events as it lands.
  • The writer process (wai-quantum-service writer) starts with the service and serves every write, so the model loads once; one that ends is started again, and a write it was running fails, saying so. It reads every byte of the model against its manifest as it starts, and loads exactly the files the manifest lists, so a transcript's model digest names the weights that ran ("checked": "blake3"). On macOS it runs sandboxed as a worker does, reading its model. Its resident memory is held to WAI_QSVC_WRITER_GB (96), a write to WAI_QSVC_WRITE_SECS (3600), and the engine's checks in it to one job's memory, which the transcript records (check_memory_bytes).
  • Admission. Writes run one at a time, in the queue's order, beside the circuit jobs and holding none of their memory budget; each kind fills the queue up to WAI_QSVC_MAX_QUEUE alone, so a backlog of writes refuses no circuit job. A client holds one queued or running write, checked and taken under one lock, so writes sent at once admit one. A write cancelled while the writer starts is never sent to it, and one cancelled while it runs stops the writer. Idempotency-Key works as for a job, and a write the service was running when it stopped runs again once, to the same transcript.
  • What a task may hold. A task is held to the course's form before it is queued (check_task, through engine::course::exercise_form): every bound whole numbers, every constraint one the course names, a job of shots, seed and noise alone, at most 16 cases and 8 intents in one place, every case giving the same inputs or none. Its canonical form is at most 64 KiB, what the model is first told of it at most 8 KiB, and a program an intent compares with is held to the equivalence bounds a job's intent is (J031). Admitted in a job's order: the cheap checks first, and what refuses whatever is sent (a write held, unread results, a full queue of writes, a spent window) uncounted; then a turn to be read and the client's window (a write refused after it still counts); then the programs, each read once and all within one budget (wai_quantum::qasm::within_steps, 1 000 000 statements), in the reading child a job's programs are read in, its memory and time capped. The writer process starts from the service's kept image, as workers do, and is the first the kernel ends under memory pressure.
  • The queue and its lock. A write cancelled while queued holds no place in it, and no lock is held across the store's writes: a client's write is reserved in memory while it is admitted, and a job's record is kept before it is queued (and taken back if the queue, or the cap on results not yet read, then refuses it).
  • The same transcript, in the same arithmetic. The task reaches the model in its canonical form, so the same model, task, options and engine give the same transcript on a host whose arithmetic the transcript's model names (architecture, operating system, maths library, matmul kernel).
  • Refusals: J080 (no model here, 503), J081 (a task that does not read), J082 (options out of range).
  • Discovery: GET /v1 and quantum_service_info give write: the model's name, licence and digest once it is loaded, or that there is none. The OpenAPI document has the route, and smoke.sh writes a Bell pair's program with SMOKE_WRITE=1.
  • wai-quantum-writer: the scripted model is public (scripted::Scripted, read from a JSON script), write_with hands on each attempt as it lands, and check_task holds a task to having something to check, and its canonical form to the course's form: a case without an intent, in a task with none, or a task a check would read as asking nothing, is refused before the model is asked.
  • wai-quantum: the refusal codes J080 to J082; a course check's lesson may be null, as check_exercise gives it.
  • The verdict get_quantum_job and tasks/result state for a write is the last program's, checked against the task's constraints as well as its intents: a program whose intent holds and whose constraint does not is holds: false, saying which. A write with no attempt yet has no verdict.