Skip to content
Docs
Request access

Stop a run

A stop is cooperative. A human asks, the engine reads the request at checkpoints and ends the run cleanly.

  • A run that has not ended, and its id. nuramesh status --team my-team lists the unfinished runs.
  • The team folder the run belongs to.
  • Your id as human:<id>, so the ledger names who asked.
  1. Find the run: nuramesh status --team my-team.
  2. Ask for the stop with your id and a reason (Ask for a stop).
  3. Wait for the next checkpoint. A model call already in flight finishes first.
Terminal window
nuramesh stop <id> --team my-team --human human:you --reason "wrong goal"

This appends run.stop_requested to the run’s ledger. The reason text goes to the content store and the ledger keeps a hash. Pressing Ctrl-C in the terminal that runs nuramesh try records the same request (the actor is service:cli unless you pass --human). The API has POST /v1/runs/{id}/stop for the same thing.

It looks for the request before each task, before each attempt, before each worker model call, before each gate, after each gate result, after the worker returns, and at a short polling interval while tasks run (so a long sandbox command is killed). When it finds the request it cancels running and waiting tasks, makes no further model call, releases open reservations, kills running sandbox work and writes run.ended with status stopped.

  • A model call already in flight finishes. A provider call cannot be cancelled, so it is charged and recorded as usual and the stop takes effect at the next checkpoint. The final spend can include one call made after the click.
  • A second request while the run is stopping returns the first and writes nothing.
  • A finished run cannot be stopped (409 run_finished over the API).

A second Ctrl-C aborts: it stops waiting for workers, kills sandbox commands, cancels unfinished tasks, writes run.ended with aborted: true and exits with code 130. An abort wins over a stop in the status. Reservations held by a call still in flight are left open on purpose; the reconciler closes them later.

A stop produces these codes. The full table for every command is on Exit codes.

Code Meaning
0 The stop command itself worked: it only writes to the ledger
1 The run ended but a task did not finish
3 A stop action was refused (a run in another organization, or a run with no recorded organization)
4 The run was stopped by a human, or the organization halt is in force
130 The run was aborted by a second Ctrl-C
Terminal window
nuramesh status <id> --team my-team
nuramesh report <id> --team my-team

The run’s status is stopped, the unfinished tasks are cancelled and the budget lines show nothing still reserved. The ledger holds run.stop_requested with your id, then run.ended.

You see Do this
Exit code 3 from stop The stop was refused: the run belongs to another organization, or has no recorded organization. Check the id and the team folder
409 run_finished from the API The run had already ended. Nothing was written
The spend rose after the stop One model call was in flight. It cannot be cancelled, so it is charged and recorded; the stop took effect at the next checkpoint
The run does not stop A stop is read at checkpoints. To end it now, press Ctrl-C twice in the terminal that runs it: that aborts (exit code 130)

Was this page helpful?