An agent asks for a payment. The gateway sends the request to the system of record. The system commits the payment, and then the connection drops before the answer arrives.
The gateway now holds a fact that is easy to misread. It does not know that the payment failed. It does not know that the payment succeeded. It knows that it asked and that nothing came back.
Most software has to do something at this point, and the usual somethings are guesses. This article is about that moment: what the state is, why each guess is expensive, and what Sefra does instead.
Three answers, not two
It is tempting to treat a call as either a success or a failure. A network makes a third result possible. A request can reach the server, take effect, and lose its response on the way back. From the caller’s side, that looks the same as a request that never arrived.
Sefra sorts every attempt at a call into one of four classes:
| Class | Example | What it means |
|---|---|---|
| Applied | A status the manifest lists as success, with every mapped output field present | The effect exists |
| Refused | A client error such as a validation failure | Not applied, and repeating will not help |
| Not applied, transient | The connection failed before the request was sent, or the system said it is overloaded | Not applied, worth repeating |
| Ambiguous | A timeout, a connection reset after sending, most server errors, a success answer with a mapped field missing | The effect may or may not exist |
The fourth row is the one that matters here. It is wider than people expect. A server error can be raised after the database commit. A worker that crashes while waiting for an answer shows up as a call that timed out. Neither tells you whether the write happened.
A rule follows from this: a step is declared failed only after a definite answer, from the system, a probe or an operator. An ambiguous last attempt never becomes failed. Neither does a step with an ambiguous earlier attempt whose later attempt was refused, because a refusal such as “already exists” says nothing about whether the earlier attempt committed.
What each guess costs
Take a common plan: create a vendor, raise a purchase order, pay a deposit. The deposit is the last step and cannot be undone. Its answer is lost.
Guess that it failed, and roll back. The vendor is deactivated and the order is cancelled. If the payment did commit, the company has now paid a deposit on a cancelled order to a deactivated vendor, and the record says nothing happened.
Guess that it failed, and retry. If the operation has no idempotency, a retry can pay twice. This is the classic double charge.
Guess that it succeeded. The execution reports success to the agent, which tells its user the deposit is paid. If it was not, a supplier waits for money nobody is sending, and the trail records a payment that does not exist.
Each guess is right some of the time, which is what makes it dangerous. It works in testing and fails on the day the network does.
What can be settled by a machine
Not every ambiguous attempt needs a person. Two mechanisms settle many of them, and both are deterministic.
Repeating safely. Each connector operation declares how it is made idempotent. In mode header, Sefra sends its token in a header such as Idempotency-Key, and the system recognises a repeat. In mode natural, repeating is harmless by nature, as with “set status to cancelled”. For these, Sefra tries again with the same token, up to a fixed limit. If a worker is killed while the system is slow to answer, the execution still ends succeeded, with exactly one purchase order and two calls carrying the same token.
Asking the system. A manifest can declare a probe, a read that tells whether the effect exists, typically a lookup by a natural key. If the probe finds the effect, the step is succeeded and takes its output from the probe’s response. If it finds none, the step is failed. Say the connection drops after a vendor is created. The probe finds the vendor, the plan continues, and exactly one vendor exists.
When an operation has mode none, Sefra never repeats it after an ambiguous attempt. When there is no probe, or the probe gives no definite answer, the machine has run out of things it knows.
The state itself
At that point Sefra marks the step unknown, stops the execution, and enters needs_intervention with the code DOWNSTREAM_OUTCOME_UNKNOWN. If the alert webhook is configured, an operator is alerted.
Stopping includes not compensating. Undoing the earlier steps would be wrong if the unknown step did take effect, so they stay as they are until someone knows. The agent must not submit the action again. It should tell its user and may keep polling slowly.
This is an uncomfortable state to ship. It means a person gets alerted and a workflow sits unfinished. The alternative is a system that always reaches a tidy end state by sometimes being wrong about money.
How a person settles it
Say the ERP commits the payment and then the connection drops. The payment intent has mode none and deliberately no probe.
The execution enters needs_intervention with DOWNSTREAM_OUTCOME_UNKNOWN. At this point the vendor is still active, the order is still open, one payment exists, and exactly one payment call was made. Nothing was compensated and nothing was repeated.
An operator looks at the system of record and supplies the outcome:
POST /v1/executions/{id}/settle-step
{
"step": "deposit",
"outcome": "succeeded",
"output": { "payment_id": "<the id found in the ERP>" },
"note": "Payment found in the ERP."
}
The output is required and must match the intent’s output schema, because later steps and any compensation depend on it. A settlement with no output or a malformed one is refused with INVALID_OUTPUT, and the execution does not move. With a valid output it ends succeeded.
If the operator finds that the payment did not go through, they settle it the other way:
POST /v1/executions/{id}/settle-step
{
"step": "deposit",
"outcome": "failed",
"note": "Payment reversed by the bank."
}
Now the earlier steps are compensated in reverse order. The execution ends rolled_back, the vendor is inactive and the order is cancelled.
What this does not promise
Sefra does not find out what happened by itself when no probe exists. It takes the operator’s word, and the call is audited, so the record shows who settled the step and what they said. If the operator is wrong, the record is wrong in a way you can trace to a name.
An operator can also close an execution with resolve, which ends it as resolved_manually. Sefra then guarantees nothing about the state of the systems.
The narrow claim is this: when Sefra cannot know the outcome of a write, it says so, stops, and leaves the decision with a person. It does not convert missing information into a status.