A stop is cooperative. A human asks, the engine reads the request at checkpoints and ends the run cleanly.
Prerequisites
Section titled “Prerequisites”- A run that has not ended, and its id.
nuramesh status --team my-teamlists the unfinished runs. - The team folder the run belongs to.
- Your id as
human:<id>, so the ledger names who asked.
- Find the run:
nuramesh status --team my-team. - Ask for the stop with your id and a reason (Ask for a stop).
- Wait for the next checkpoint. A model call already in flight finishes first.
Ask for a stop
Section titled “Ask for a stop”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.
What the engine does
Section titled “What the engine does”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_finishedover the API).
Ctrl-C twice
Section titled “Ctrl-C twice”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.
Exit codes
Section titled “Exit codes”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 |
Check it worked
Section titled “Check it worked”nuramesh status <id> --team my-teamnuramesh report <id> --team my-teamThe 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.
Troubleshooting
Section titled “Troubleshooting”| 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) |
Next steps
Section titled “Next steps”- Stop an organization, a role or a rule: stop more than one run.
- Exit codes: the full table.
- Audit a task: read what a stopped task did.
Was this page helpful?