﻿# Google WaitOperation can return an unfinished operation

Interpret Google WaitOperation as a bounded observation of an existing operation, keeping wait timeout, RPC deadline and terminal operation result separate.

Author: Retrivium editorial team
Updated: 2026-11-04
Canonical URL: https://retrivium.ai/journal/guide-google-waitoperation-unfinished-timeout/
Language: en

## Wait for an existing operation rather than resubmit work

The [Google long-running RPC reference](https://docs.cloud.google.com/service-infrastructure/docs/service-management/reference/rpc/google.longrunning) defines WaitOperation using the name of an existing operation. It observes that operation until completion or at most the requested timeout. A proposed client should preserve the full operation name and originating service, because the name is only unique within that service. Losing a wait response is not a reason to invoke the original creation method again; first restore observation of the known operation identity.

## Inspect done even after an immediate successful response

The reference explicitly makes waiting best effort: a server may return the latest state early, including immediately. An immediate response therefore does not establish completed work. If done is false, retain the in-progress state. If done is true, inspect the operation's response or error according to that service's result contract. Treating every successfully decoded wait response as the business result would convert a valid intermediate observation into a false completion signal.

## Keep wait duration separate from transport deadline

WaitOperation's timeout does not override a shorter underlying HTTP or RPC timeout. The [gRPC deadline guide](https://grpc.io/docs/guides/deadlines/) separately explains when the client stops waiting and receives DEADLINE_EXCEEDED. An editorial client design records both budgets and distinguishes a returned unfinished Operation from a failed wait RPC. Cancelling or timing out this observation should not be represented as an explicit service-level cancellation request for the background operation.

## Fall back only to a documented observation method

The [long-running-operation design guidance](https://google.aip.dev/151) describes operation resources as handles for checking progress and retrieving eventual results. The RPC reference allows WaitOperation to return UNIMPLEMENTED when unsupported, while GetOperation returns the latest state for interval polling. A proposed fallback preserves the same operation identity and uses the API's polling guidance. It should not invent a busy loop or reinterpret lack of waiting support as lack of support for the original asynchronous operation.

## Test the observation states independently

A useful editorial fixture returns unfinished state immediately, unfinished state after bounded waiting, a terminal error and a terminal response. Another fixture interrupts only the wait RPC while leaving the operation record available for subsequent observation. [Golden contract fixtures](/journal/provider-golden-contract-fixtures/) help keep those outcomes distinct, while [request tracing](/journal/provider-request-id-trace-context/) separates the operation identity from each polling attempt. These checks describe a client protocol; they do not claim any background work was created or cancelled by this guide.
