Skip to content
RasaGet a free license
Menu
Guides for AI teams

Guide · Risk reviewer / domain owner

Refused versus unknown: Rasa transfer error handling

A controlled banking-client test shows why the reply body matters when a transfer error leaves you deciding whether another send is safe.

by Rod Rivera

About 7 minutes to read

Key takeaways (3)
  • Check the reply body before treating a transfer error as a refusal.
  • Test error status and fault contents separately; either can hide a classification mistake.
  • Hold an unknown transfer for reconciliation, and assign someone to resolve it before enabling more transfers.

We gave the client a transfer reply with status 503. It called the transfer refused. We kept that status, changed the fault inside the reply, and got an unknown outcome instead.

These were controlled inputs to the SilverLake example’s actual client. No bank received a transfer. The test supplied replies through a fake transport and skipped vendor schema validation. Within that scope, the result is concrete: the same transport status leads to different transfer decisions.

The reverse held too. Changing only the transport status between 200, 500, and 503 never changed the classification for a fixed fault body. A status of 200 could still leave the transfer unknown.

That distinction matters before an agent offers another attempt. In a hypothetical failure, the first request might have been accepted before its reply became unusable. Calling that outcome “refused” could invite a duplicate request. The experiment below tests classification, not a recorded duplicate transfer or model conversation.

Controlled client comparison at the same HTTP 503 and business code 999999: Client fault is refused, Server fault is unknown. The body fault is parsed before the later status check. Fake contract, mock transport, and no bank request.

Not claimed: Trained agent, model, voice, vendor, or current global release acceptance.

Hold the error status fixed, change the fault

The example carries banking messages using the Simple Object Access Protocol (SOAP), over the Hypertext Transfer Protocol (HTTP). The outer HTTP status and the SOAP fault inside the body are separate inputs.

We crossed three statuses with two fault sides and four business-code choices. That produced 24 authored combinations. Each went through the original client, using the existing test fixture’s StubContract and httpx.MockTransport.

The retained matrix contains every input and result. This table groups the rows by body so you can compare statuses directly:

SOAP fault sideBusiness code in the bodyHTTP 200HTTP 500HTTP 503
ClientAbsentRefusedRefusedRefused
Client100199RefusedRefusedRefused
Client400001RefusedRefusedRefused
Client999999RefusedRefusedRefused
ServerAbsentUnknownUnknownUnknown
Server100199RefusedRefusedRefused
Server400001RefusedRefusedRefused
Server999999UnknownUnknownUnknown

“Unknown” means the client raised UnknownOutcome. These are constructed fault replies, including the faults sent with status 200. The table reports this example’s classifier with authored fault bodies and the existing contract double.

Read down the 503 column. A status-only rule has one input value, but the actual client produces two outcomes. Read across any row. Changing the status alone has no effect. To test this boundary, you need both comparisons.

There is another useful edge: an unlisted code does not always mean unknown. The Client fault with code 999999 is refused because the fault side alone satisfies the client’s rule. A Server fault with that same code stays unknown.

The order of two checks explains the table

The client at the tested revision opens the reply envelope, then checks whether its body is a fault:

        if body.tag == "{%s}Fault" % SOAP_ENV:
            side = (body.findtext("faultcode") or "").rsplit(":", 1)[-1]
            code = None
            detail = body.find("detail")
            if detail is not None:
                code = detail.findtext(q("ErrCode"))
            raise Fault(side, code)
        if reply.status_code != 200 or body.tag != q(operation + "Response"):
            raise (UnknownOutcome("unexpected_reply") if write else Unavailable("invalid_response"))
A parsed fault takes a different branch

The parsed-fault branch raises before the later HTTP status check. The matrix changes the status on that earlier branch; it does not exercise every response shape.

FigureA parsed fault takes a different branch

A parsed fault raises before the status check. The transfer method catches it and makes the refusal decision:

        try:
            body = self._call("XferAdd", request, write=True)
        except Fault as fault:
            if fault.side == "Client" or fault.code in TRANSFER_REFUSALS:
                return "refused"
            raise UnknownOutcome("server_fault") from None
        except Unavailable:
            raise UnknownOutcome("unusable_reply") from None

The refusal list contains 100199 and 400001. Those values explain the two refused Server rows. The other two Server rows reach the unknown branch.

This does not mean the client ignores HTTP status everywhere. A body that is not a SOAP fault reaches the later status check. Missing, malformed, and unexpected replies have their own unknown paths after a write. The matrix isolates parsed faults, where the order above determines the result.

Reproduce the comparison through the client

The experiment script imports the existing response-mapping fixture. It changes the outer status while preserving the fault body produced by that fixture:

Run the controlled fault comparison

The script imports TransferFaultMapping and fault_reply directly from that fixture. For each combination, it wraps the fixture’s fault body in a response with the chosen status, then invokes the client’s transfer method. It records the return value or exception class.

The full file includes source hashes, the installed version, and assertions for all rows. Unexpected exceptions become their class names, so they fail the expected-result assertion rather than silently counting as unknown.

You need Git, uv and Python 3.12 for the pinned project’s locked dependencies. Start in a directory where you can create a new checkout. The following commands select the captured source instead of the current main branch:

git clone --no-checkout https://github.com/RasaHQ/rasa-community-resources.git bank-component-check
cd bank-component-check
git fetch origin b5a308ecd9acdc795ce56260ec81c21c879aa9c7
git checkout --detach b5a308ecd9acdc795ce56260ec81c21c879aa9c7
cd examples/jack-henry-silverlake
uv sync --locked

Stay in that example directory for the Python commands below. You should see pyproject.toml, uv.lock, tests and .venv. If dependency installation fails, resolve the package or Python-version error before running the comparison. The pinned project README supplies the full demo setup; this fixture comparison stops before starting its server.

Use the example at revision b5a308ec, with its locked environment. Save the script in a fresh directory inside this example checkout, as shown below. The downloadable script is a reader adaptation: its only change from the executed original is to use the current directory for the project root. The export notes retain that distinction.

fault_probe_dir=$(mktemp -d "$PWD/fault-probe.XXXXXX")
curl --fail --location https://rasa.community/receipts/transfer-outcome/fault-matrix.py -o "$fault_probe_dir/fault-matrix.py"
.venv/bin/python -I "$fault_probe_dir/fault-matrix.py" > "$fault_probe_dir/fault-matrix.json"

The command should exit successfully and write 24 rows to fault-matrix.json in that fresh directory. Compare those rows with the retained matrix. The isolated reader invocation excludes the shared temporary directory from Python startup; the retained original run predates this invocation. A missing .venv/bin/python means the locked environment was not created in this directory. The script prints source hashes but does not assert that they match the retained run. Compare the emitted client and fixture hashes with the retained matrix yourself. An expected-result assertion means the result differs; inspect it before treating the comparison as reproduced. The retained run used Rasa Pro 3.21.0.dev5. Its client and fixture hashes are included in the output. Use matching client and fixture hashes, alongside matching result rows, to identify the source and result you reproduced.

The original fixture’s test covers a Client fault and 100199 refusal, plus unlisted or unusable replies. It does not separately exercise 400001. The new matrix exercises that code on both sides and all three statuses. Neither check validates real vendor schemas: StubContract.validate does nothing.

Classification is only the first control

I would keep an unrecognized post-send outcome unknown and block further transfers for that caller until reconciliation. The cost is availability: an unresolved request can stop a later, legitimate transfer. A friendly “try again” removes that friction by assuming something the reply has not established.

The example reserves the operation in a journal before sending. Its hold follows the caller across sessions. Separate tests check this boundary and the local adapter’s wording:

CheckWhat its assertions establish locally
Lost replyA mock loses the transfer reply; the client raises unknown, and the mock transfer count is one.
New session and reopened journalAnother review is refused for the same caller; the reopened journal still holds that caller, and the mock count stays one.
Reply adapterTwo confirming turns yield one fake-host send; the captured message says “Do not retry” and omits “Request a new transfer.”

A retained component run now covers these checks. It used the original project test suite, the native Rasa software development kit, and local fixtures:

.venv/bin/python -m unittest discover -s tests -v

The end of the retained test log reports:

----------------------------------------------------------------------
Ran 77 tests in 22.669s

OK

The component receipt binds that run to the same source revision and Rasa Pro 3.21.0.dev5. No tests were skipped. This supersedes the earlier retained continuous integration run’s skipped archive-dependent checks for this bounded component result.

The adapter check captures local messages; it does not sample a model’s conversation. The reopened-journal check proves the hold survives closing and reopening that journal. It is not a complete production restart drill.

Do not approve a hold without an owner

The journal has no in-place method to clear or reconcile an unknown outcome. The source says so explicitly. The example demonstrates containment; it does not supply a production reconciliation service.

For a bounded release decision, record two separate dispositions. First, have the integration owner supply the interface contract behind each refusal condition, including the broad Client branch. Second, assign an operations owner to reconcile unknown requests against authoritative records and define who may release the hold. Keep further transfers blocked while that outcome remains unresolved.

A passing local classifier test supports the first engineering boundary. It cannot authorize clearing a hold or establish that a real transfer was refused. An accepted reply identifies acceptance; posting is a separate outcome that needs its own evidence.