wai-quantum-service: a job sent again under its key is the same job #607
Loading…
Reference in a new issue
No description provided.
Delete branch "wai/quantum-service-idempotency-2"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Replaces #596: the same commit (same patch id), on main at
2bef11f71. Main had moved by 15 commits, among them #603, which runs each workflow's gate onlinuxrather than behind the arm64 work it gates; a pull request runs its own head's workflows, so #596 would have run the old ones.A client that lost an answer from the job service could not ask again safely: a second submission was a second job, counted against its limits. The three MCP tools that run also declared
idempotentHint: true, which was not so: every call made a new job.What changes
wai-quantum-service
POST /v1/jobsandPOST /v1/runtake anIdempotency-Key, andrun_quantum_circuit,run_quantum_setandrun_on_targettakeidempotency_key. A key is 1 to 255 visible ASCII characters, with no quote or backslash, given as a structured field's string or bare.422and the new codeJ034. The refusal names no job, because a job's id is what reads and cancels it.idempotentHintis nowfalse. Without a key, each call is a new job, and their descriptions say so.GET /v1statesidempotency, the OpenAPI document describes the header on both routes, and the CORS preflight allows it.wai-quantum: the refusal code
J034, in the table and indocs/job-refusals.md.wai-quantum-cli:
submitandtasksend each job under a fresh 128-bit key. Where no answer comes back, they send it again under the same key, twice at most, and only to a service whoseGET /v1says it keeps keys. An older service is never sent a job twice.wai-quantum for Python:
Service.submitandService.rundo the same, and takeidempotency_key. A job the service interrupted now ends the wait; before,_FINISHEDleft it out and the wait ran to its deadline.The tool snapshot (
wai-quantum-cli/docs/service-mcp.json) and the agent docs generated from it are regenerated.Tests
submitandrun), the key with another job is422 J034, and a key with a space is400 J034.Checked
On the build host: wai-quantum's refusal tests; the service's tests and clippy with
-D warnings; the command line's tests and clippy, with and without default features; and the Python package's whole check (ci/check.sh), which builds the command line, the service and the wheel and runs pytest and the notebooks. The public-name check is clean.🤖 Generated with Claude Code