Skip to catalogue

189

cancellation

When the caller gives up, the work stops. A request that outlived the user still holds a database connection.

What is cancellation?

Cancellation propagates a signal that the result is no longer wanted: client disconnect, timeout, parent task failed. Cooperative cancellation means the code checks the signal and stops. Ignoring it wastes budget and can apply a write nobody is waiting for.

Why does cancellation matter when vibe coding?

Models start work and never pass an abort signal. The user navigates away and the server finishes a heavy query. Name the token.

How do you do cancellation?

Thread a cancellation token from the request to the database and HTTP calls. On cancel, stop. Writes that must finish need an explicit decision, not an accidental continue.

How do you ask a model for cancellation?

Pass cancellation from the request into (downstream calls). When the client disconnects or the timeout fires, abort the work. Do not keep computing a response nobody will read.

What goes wrong with cancellation?

Catching the cancellation and continuing. You swallowed the stop signal. Log it and exit the work.

adjacent