Skip to content

A running calibration can be aborted - #201

Merged
pskeshu merged 1 commit into
developmentfrom
feat/calibration-abort
Sep 26, 2026
Merged

pskeshu merged 1 commit into
developmentfrom
feat/calibration-abort

Conversation

@pskeshu

@pskeshu pskeshu commented Sep 26, 2026

Copy link
Copy Markdown
Collaborator

calibration routine -- while it is running, has no abort feature. in devices > operate > calibration

It runs for a minute or more — sixty to eighty exposures, each judged — behind a disabled button, with no way to stop it short of closing the tab. Now there is an Abort beside Calibrate, shown only while a calibration runs.

What actually stops

The routine runs agent-side — Claude-vision edge search, adaptive focus sweeps — as a long series of short device-layer plans: a snap, a move, a snap. There is nothing on the device layer to abort; each plan is over in a fraction of a second. What has to stop is the tool's task in the web process.

  • The calibrate routes (/embryos/{id}/calibrate and /calibrate/all) now run the tool as a task that POST /api/devices/calibrate/abort can cancel.
  • The routine stops at its next await; the plan in flight completes on its own; every positioner is halted after it.
  • The calibrate request then answers 409 … aborted by operator — a 409 like the pre-flight refusal, because nothing is broken and the operator chose it; the detail says which 409 it is, and the pane shows aborted rather than a failure.
  • A cancellation that is ours (the tab closed) is re-raised unchanged, so that still cancels as it always did rather than reading as an abort. Abort with nothing running answers {aborted: false} — a press a moment too late is not a fault.

HALT covers the piezo

Motion HALT stopped fdrive, XY and Z. The piezo is a stage to MMCore too, and an aborted sweep leaves it wherever it was heading; it's in the list now. The galvo is not a positioner and has no stop.

Tests

tests/test_calibration_can_be_aborted.py drives the real routes over ASGI with a calibration that runs until cancelled: abort cancels it, halts motion, the run answers 409 with aborted, and the finished task is unregistered; nothing running is not an error; the batch route is abortable the same way; a client going away is a plain cancellation, not an abort. Two source guards pin the pane's button (shown only while running, wired in wire(), checked before the refusal branch since both are 409) and the halt list.

Not verified on hardware: the halt of the piezo through core.stop("PiezoStage:P:34") is the one call here the fakes cannot vouch for. If the controller declines it, HALT reports it in errors as it does for any axis, and the abort itself is unaffected.

🤖 Generated with Claude Code

"calibration routine -- while it is running, has no abort feature."

It runs for a minute or more — sixty to eighty exposures, each judged —
behind a disabled button, and there was no way to stop it short of
closing the tab. Now there is an Abort beside Calibrate, shown only
while a calibration runs.

WHAT ACTUALLY STOPS

The routine runs here, agent-side — Claude-vision edge search, adaptive
focus sweeps — as a long series of SHORT device-layer plans: a snap, a
move, a snap. There is nothing on the device layer to abort; each plan
is over in a fraction of a second. What has to stop is the tool's task
in the web process. The calibrate routes now run the tool as a task the
new POST /api/devices/calibrate/abort can cancel: the routine stops at
its next await, the plan in flight completes on its own, and every
positioner is halted after it. Then the calibrate request answers 409
"aborted by operator" — a 409 like the pre-flight refusal, because
nothing is broken and the operator chose it; the detail says which.

A cancellation that is ours — the tab closed — is re-raised unchanged,
so that still cancels the way it always did rather than reading as an
abort. Abort with nothing running answers {aborted: false}: a press a
moment too late is not a fault.

HALT COVERS THE PIEZO

Motion HALT stopped fdrive, XY and Z. The piezo is a stage to MMCore
too, and an aborted sweep leaves it wherever it was heading; it is in
the list now. The galvo is not a positioner and has no stop.

Tests drive the real routes over ASGI with a calibration that runs until
cancelled: abort cancels it, halts motion, the run answers 409, and the
finished task is unregistered; nothing running is not an error; the
batch route is abortable the same way; a client going away is not an
abort. Source guards pin the pane and the halt list.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@pskeshu
pskeshu merged commit e79653c into development Sep 26, 2026
2 checks passed
@pskeshu
pskeshu deleted the feat/calibration-abort branch September 26, 2026 05:09
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.

1 participant