Learning center

Check a missing await comment against what the call returns

A missing await claim is true when the call returns a coroutine or promise and the code needs its result, effect or error before moving on. Check what the call returns and whether anything awaits it later. If nothing does, add the await, or keep a reference and handle errors if the work is meant to run in the background. Dismiss only when the call is synchronous or the background work is deliberate and already handled.

Find what the call returns#

Read the definition of the function the comment names, not just the call site. The answer usually takes one line:

  • A Python async def function returns a coroutine, and nothing in it runs until something awaits it. The asyncio documentation puts it plainly: "Note that simply calling a coroutine will not schedule it to be executed" (coroutines).
  • A JavaScript async function starts running when called, up to its first await, and returns a promise. The rest of the function still runs if nobody awaits the promise. What the caller loses is ordering and the error.
  • asyncio.create_task schedules the coroutine, but "The event loop only keeps weak references to tasks. A task that isn't referenced elsewhere may get garbage collected at any time, even before it's done." (create_task)

The consequences differ. In Python, an unawaited coroutine does nothing at all. In JavaScript, an unawaited promise does its work at an unknown time, and a rejection with no handler ends the process: Node.js changed the default for --unhandled-rejections to throw in version 15.

A cache reset that never ran#

In August 2025, a vLLM pull request made the engine's sleep method reset the prefix cache first. gemini-code-assist's review found "a critical issue in the v0 engine implementation where an async method call is not awaited, which would prevent the prefix cache from being reset." (review) The author applied the bot's suggestion in a commit that lists gemini-code-assist as co-author, and a maintainer approved with "thanks for the fix!" The merged diff awaits the call in both engines:

     async def sleep(self, level: int = 1) -> None:
+        await self.reset_prefix_cache()
         self.engine.sleep(level)

Diff

The inline comment is resolved and hidden, so the page does not show the line before the fix. The claim is easy to check without it, because reset_prefix_cache is an async def method. A minimal reproduction with the same shape, an async def sleep that calls an async def reset_prefix_cache without await, prints the cache unchanged and a warning:

RuntimeWarning: coroutine 'Engine.reset_prefix_cache' was never awaited
{'prefix': 1}

The warning appears only when the coroutine object is garbage collected, and only if warnings reach a log someone reads. A static checker catches it earlier: Pyright's reportUnusedCoroutine defaults to an error in its basic, standard and strict modes, and typescript-eslint's no-floating-promises reports unhandled promises in TypeScript.

A test that would never have run#

Eleven days later, a vLLM pull request added an async test for a truncation size of zero. gemini-code-assist marked it critical: "However, the new asynchronous test function is missing the necessary @pytest.mark.asyncio decorator, which will prevent it from running correctly." (review) The branch was force-pushed, and the merged test carries the decorator (diff).

This is a missing await in a different place: pytest calls the test function, gets a coroutine back and has to be told to run it. Whether a missing marker matters depends on the plugin's mode and the pytest version, so we checked against the repository. vLLM's pyproject.toml at the merge commit sets no asyncio_mode, and requirements/test.txt pins pytest==8.3.5 and pytest-asyncio==0.24.0. With those versions, a file holding one unmarked async test that asserts False and one marked test reports:

1 passed, 1 skipped, 1 warning

The unmarked test was skipped, and the run stayed green. With pytest 8.4.2 and the same pytest-asyncio, the file reports 1 failed, 1 passed, because pytest 8.4.0 changed async tests without a suitable plugin to "fail, instead of warning+skipping". So the bot's claim was right for the versions vLLM ran, and the evidence that settled it was the pinned versions plus one local run, not the test result in CI.

Decide from the return value and the intent#

What you findAnswer
The call returns a coroutine or promise, and later code needs its result, effect or errorAdd the await, and a test that checks the effect
The work is meant to run in the background, and the code keeps a reference and handles its errorsDismiss, citing where the reference and handler are
The work is meant to run in the background, but nothing keeps the task or catches its errorChange it: store the task, or attach a rejection handler, or use a task group
The call is synchronous, or returns a value that is not awaitableDismiss, citing the definition. In Python, awaiting such a value raises a TypeError
An async test may not be awaited by the test runnerRun it once locally with the repository's pinned versions and an assertion that must fail

The second row is the only common reason to keep an unawaited call. State the intent in the code, for example with void before the call in TypeScript, which no-floating-promises accepts by default, so the next reviewer does not raise the same comment. If the same claim keeps coming back after you have answered it, the guide to review finding follow-through shows how to count that cost.

One month of free code review.

New organizations get one calendar month of hosted code review for private and public GitHub repositories. No card or cloud connection required. Eligibility and fair-use terms.

Start free with GitHub

Related reading