--- id: INT-24 family: RT-INT level: core profiles: [runtime] posture: normative-target added: "1.1" changed: "1.1" source: https://flowdrop.io/spec/rules/rt-int/int-24 specification: FlowDrop Workflow Specification 1.0 licence: CC BY 4.0 --- # INT-24 — An interrupt settles once, and only someone who could cancel its run may cancel it *RT-INT (Part II) · level: core · profiles: runtime · added in 1.1* An interrupt waits in one status and settles into one of three others, exactly once. Cancelling one is an act on the run it belongs to, so it takes the authority to cancel that run, and a remote answering a call can never use its route to do it. ## The rule > **Normative.** This is the rule. > > 1. An interrupt is either an outward interrupt, raised by a node of a run to ask a person or a remote system, or an inward signal, a cancel or pause addressed to a run (INT-16). > > 2. Its status MUST be one of four values, the interrupt status vocabulary STORE-11 closes: `pending` (raised and not yet settled), `resolved` (answered, or for an inward signal, acted on), `cancelled` (settled without an answer) and `expired` (its expiry passed before it was answered, INT-23). > > 3. An interrupt MUST leave `pending` at most once. > > 4. It MUST NOT leave `resolved`, `cancelled` or `expired`. > > 5. The change from `pending` MUST be atomic, so that of an answer, a cancel and an expiry racing for one interrupt, exactly one takes effect. > > 6. On every route, an answer or a cancel that the caller is authorised to make, but that finds the interrupt no longer `pending`, having lost that race or arrived after it, MUST be refused with `409` and the code `INTERRUPT_NOT_PENDING`. > > 7. An implementation MAY let a caller cancel a pending interrupt, on the route API-9 names `interrupt_cancel`. > > 8. Where it does, the request MUST be authorised before anything about the interrupt's state is checked, so a caller without authority learns nothing about it. > > 9. Cancelling an interrupt that belongs to a run, raised by it or addressed to it, requires the authority to cancel that run, because cancelling an outward interrupt ends the run it holds open (INT-18). > > 10. A caller who lacks it MUST be refused with `403` and the code `ACCESS_DENIED`. > > 11. A cancel naming an interrupt that does not exist MUST be answered `404` with the code `NOT_FOUND` for a caller holding blanket authority over runs, since existence is no secret from them. > > 12. For every other identified caller it MUST be answered with the same `403` as a caller without authority, indistinguishable from it, so the route cannot be used to enumerate interrupts (INT-16 answers unknown runs alike). > > 13. A pending pause signal of a paused run MUST NOT be cancelled by a caller: it is that run's resume key (INT-5), and only a resume (INT-16) or a cancel of the run (INT-25) settles it. > > 14. A cancel of one MUST be refused with `409` and the code `PAUSE_SIGNAL_NOT_CANCELLABLE`. > > 15. A pending cancel signal MUST NOT be cancelled by a caller either: withdrawing it would undo a cancellation already accepted for the run (INT-16), which a run that is not paused observes at its next job boundary (INT-5). > > 16. A cancel of one MUST be refused with `409` and the code `CANCEL_SIGNAL_NOT_CANCELLABLE`. > > 17. A pending pause signal of a run that is not paused MAY be cancelled: it withdraws a request the run has not yet observed. > > 18. A cancel that takes effect MUST set the interrupt `cancelled` and MUST answer `200` with the interrupt's new status, `cancelled`, as `data.status` in the standard `{success: true, data}` envelope. > > 19. The callback route (INT-19) MUST NOT cancel an interrupt: whatever a remote posts there is an answer, a refusal included. > > 20. A declined confirmation gate is an answer too (RT-GATE-4), and leaves its interrupt `resolved`. > > 21. A node that withdraws its own interrupt where a rule tells it to (INT-20, RT-GATE-3) MUST set it `cancelled`. > > 22. That withdrawal is not a caller's cancel. > > 23. When a run reaches a terminal outcome, its outward interrupts still pending MUST be set `cancelled`, so no question stays answerable for a run that can no longer use the answer. > > 24. Settling them MUST NOT end or announce the run a second time. ## What it means An interrupt has one way in and three ways out. It is raised `pending`, and it leaves `pending` once: answered (`resolved`), withdrawn without an answer (`cancelled`), or left until its expiry passed (`expired`). Nothing brings it back, so a client that sees anything but `pending` knows the question can no longer be answered. Leaving `pending` is a single atomic change, because three things can reach for it at once: a person or a remote answering, someone cancelling, and a sweep expiring it. Exactly one wins. Whoever arrives second, whether by a millisecond or by a week, is told `409`, and nothing they asked for happens. Cancelling is the one exit a caller chooses, and it is not a small act. An outward interrupt is the only thing that can resume the run that raised it, so cancelling it ends that run (INT-18). That is why it takes the authority to cancel the run itself, and why a remote system answering through its callback route can never cancel anything: what it posts there is an answer, even when the answer is "no". The same holds for an operator declining a confirmation gate. A decline is a verdict the workflow handles, not a withdrawn question. Two kinds of withdrawal are not a caller's cancel, though they leave the same status behind. A node withdraws its own question when the call it was waiting on never went out, or when the arguments it asked about have changed, and a run that ends some other way withdraws every question it left open. None of these ends a run a second time. Inward signals are mostly off limits to this cancel. A paused run's pause signal is its resume key, and a pending cancel signal is a cancellation already accepted: withdrawing either would strand the run or quietly undo a cancel, so both are refused with codes of their own. Only a pause request that a running run has not yet acted on can be withdrawn. The cancel route checks who is asking before it looks at anything else. A caller who may not cancel the run gets the same `403` whether the interrupt is settled, pending, or does not exist at all, so the route says nothing about interrupts to someone who could not act on them. Only a caller with authority over every run is told `404` for an identifier that does not exist. ## Example An approval prompt, answered and cancelled at the same moment. ```json title="The cancel wins the change from pending" verdict="200 cancelled" { "success": true, "data": { "id": "…", "status": "cancelled" } } ``` The cancel is sent to the route API-9 names `interrupt_cancel`. ```json title="The answer that arrived second, on whichever route it came" verdict="409 INTERRUPT_NOT_PENDING" {"value": true} ``` Had the answer won, the interrupt would be `resolved`, the run would resume, and the cancel would have been the request refused with `409` and `INTERRUPT_NOT_PENDING`. ## Why Recorded under [OPEN-46](https://flowdrop.io/spec/rulings/open-46), [OPEN-48](https://flowdrop.io/spec/rulings/open-48), [OPEN-65](https://flowdrop.io/spec/rulings/open-65). ## Related rules - Names: INT-16, INT-17, INT-18, INT-19, INT-20, INT-22, RT-GATE-3, RT-GATE-4, STORE-11, INT-25, API-9 - Referenced by: STORE-11, INT-17, INT-18, INT-19, INT-22, INT-23, INT-25, API-9 --- Rule identifiers are permanent and are never renumbered. This specification carries no implementation status: each implementation publishes its own standing against these rules. Licensed CC BY 4.0.