What awaiting actually does
Explain promises, futures and coroutines and what happens when one is never awaited. In Python the coroutine never runs. In Rust the future is lazy and does nothing. In JS/TS the work runs but its failure goes unobserved and ordering is lost.
The audit line that never ran
You asked the agent to record an audit entry every time an order is placed. The diff adds one line, the tests are green, and the summary says "orders are now audited". A week later the audit table is empty. Nothing errored, and the new line executes on every order.
What did that line actually do? The answer depends on what calling an async function gives you, and that differs by language.
A call that hands you a ticket, not a result
Calling an async function does not return its result. It returns an object that stands for the work: a **coroutine** (Python), a **future** (Rust) or a **promise** (JS/TS). `await` means: pause here until that work finishes, then give me its value or raise its error on this line. Without `await`, the line still looks like a normal call and runs without an error. Tests that never check the effect stay green, and the agent treats that green run as done.
No await: what each language does
- **Python**: the call builds a coroutine, and none of its body runs. It runs only when it is awaited or scheduled as a task (for example with `asyncio.create_task`). Tell: `RuntimeWarning: coroutine '...' was never awaited`.
- **Rust**: futures are lazy. Nothing happens until something polls them (asks them to make progress): either `.await`, or an executor such as Tokio after you hand the future over with `tokio::spawn`. The compiler warns about an unused future, and `let _ =` silences that warning.
- **JS/TS**: the body runs at once until its first `await`. The caller moves on, so ordering is lost, and a rejection (the promise failing with an error) never reaches the caller's `try/catch`.
Python: a coroutine created and dropped
`audit.record` is an `async def`. The added line builds a coroutine object and discards it, so not one line of `record` runs and no row is written. The tell is a call to an async function with no `await` in front. The test run may also show a "never awaited" warning that nobody read. Later cost: an audit trail that silently does not exist. BETTER: `await audit.record(order.id, "placed")`.
// Python
--- a/orders/service.py
+++ b/orders/service.py
@@ -10,3 +10,4 @@
async def place_order(db, audit, order):
await db.save(order)
+ audit.record(order.id, "placed")
return order.id
TS: the work runs, the error escapes
The agent writes `try { sendReceipt(order) } catch (e) { log.error(e) }` and then `res.json({ ok: true })`. Because `sendReceipt` is async, the email request starts, but the response goes out before it finishes. If its promise rejects (fails with an error), the `catch` never runs, because the `try` block ended long before. The failure becomes an unhandled rejection. Since v15, Node crashes the process on these by default. Browsers only log them. Tell: an async call inside `try` with no `await`. Later cost: the client is told "ok" while receipts silently fail, nothing is logged, and in Node the server can crash. BETTER: `await sendReceipt(order)` inside the `try`.
Await is what makes it happen, in order
`await` runs the work to completion at that point and brings its result and its error back to your line. With no `await`, Python and Rust never run the work at all. JS/TS runs it, but you lose the ordering and the failure. Every call to an async function in a diff should be awaited, or be run in the background on purpose with its errors handled.
On Bytewise this lesson comes in small steps with a check at the end, and the app brings it back right before you would forget it.