SEO + AEO on AutopilotFrom the team at Stackmatix
The Growth Library

Write Async Job Instructions That Distinguish Cancel Requested From Cancelled

Document asynchronous job states, cancellation races, and terminal evidence so a request receipt is not mistaken for completed work.

An asynchronous job guide should identify the job, define its states, and explain which evidence proves completion. A submission receipt means the request was accepted under the service's contract; it does not necessarily mean the requested work finished.

Treat cancellation with the same discipline. “Cancel requested,” “cancellation accepted,” and “cancelled” can be different observations. A job may complete while a cancellation request is in flight. The guide should state the actual supported outcomes and the safe next action.

The integration prerequisite matrix establishes fit and boundaries. This guide helps an implementer operate one job through its lifecycle. It does not prescribe HTTP behavior, polling performance, or a provider-independent status vocabulary.

Separate identity, state, result, and side effects

Record the submission identity, returned job handle, status source, result location, and any documented side effects. If the service distinguishes an operation record from the business object it creates, preserve both identities.

Google's long-running operations reference defines a done field and separates result or error information for completed operations. The common operation definition separately describes best-effort cancellation without guaranteed success. Those are specific Google contract details, not names every service must adopt.

Learn the actual provider's lifecycle before writing examples. Some services cannot cancel a running task. Others can stop future work without undoing completed effects. Deleting a job record may be different from stopping the work. Do not substitute one action for another because both remove an item from a list.

Keep an unknown state available in the operating record. An unavailable observation does not establish that the job failed, succeeded, or was cancelled.

Work a fictional cancellation race

Imagine a fictional report-generation service. Its published lifecycle includes queued, running, succeeded, failed, and cancelled. A separate flag records that cancellation was requested. These labels and behaviors are invented for the example.

Hypothetical job decisions
ObservationMeaningNext action
Queued, handle returnedWork not confirmed completeInspect the same job
Running, cancel requestedRequest does not prove stopWait for documented terminal evidence
Succeeded after cancel requestCompletion won this raceInspect approved result and effects
CancelledTerminal cancellation under this contractCheck documented residual effects

The successful result should not be relabeled cancelled to match the user's intention. Conversely, a cancellation receipt should not be described as success simply because the request itself returned normally.

Preserve the sequence of observations with timestamps and the same job identity. A new job created during troubleshooting can otherwise be mistaken for a continuation of the first.

Define terminal and recovery conditions

For each terminal state, state which result or error is available, what can remain, and whether resubmission is supported. A failed export might leave a partial artifact that must not be presented as complete. A cancelled import might retain completed records under the actual contract.

Do not recommend blind resubmission when the first job's effects are unknown. Obtain the provider's identity, retry, and duplicate-prevention rules. If a new job is necessary, record its relationship to the previous one rather than overwriting the original handle.

The Google reference distinguishes waiting for an operation from guaranteeing completion by the end of a requested wait. Its wait method is best effort and can return a current state early. A guide should inspect the returned completion state, not treat elapsed waiting as proof.

Keep the learner's expected output explicit: complete report, partial result with a warning, or no usable artifact. A downloadable file can exist before the business task is accepted as complete.

Build lifecycle fixtures instead of timing guesses

Use authorized benign cases for queued cancellation, running cancellation, completion winning the race, documented failure, and an unavailable status observation. Record expected permitted outcomes where the contract allows more than one result.

The acceptance test should verify the next action, not require one lucky timing outcome. A race-sensitive test that passes only when cancellation wins is a weak foundation for documentation. Preserve enough evidence to distinguish a valid alternate outcome from a defect.

Use the acceptance brief to name the exact lifecycle and result checks. Keep credentials, private inputs, and large confidential artifacts out of public logs.

If the actual service supplies no safe cancellation fixture, say that the guide's cancellation section was reviewed against documentation rather than claiming an executed test. Source inspection and execution evidence are different review states.

Close the guide at an observable outcome

Keep result retention separate from completion. A successfully finished job may later lose its downloadable artifact under the service’s retention policy. An unavailable result at that point does not necessarily mean the job never succeeded. Conversely, an early partial file does not establish terminal success. Record both the operation state and the artifact state when the distinction affects the learner.

For a cancelled job, state whether completed effects need a separate cleanup or compensating action under the actual contract. Check cancellation permission separately from submission permission. Do not imply cancellation is a universal rollback. The tutorial should route that decision to verified instructions rather than inventing a reversal command.

The final example should show the terminal evidence and the applicable result or recovery path. Include the job identity and relevant version without exposing access material. Do not end at “your job has started” when the heading promises a finished artifact.

Use the source worksheet to keep provider facts and hypothetical illustrations separate. Recheck when the service changes cancellation, result retention, or supported recovery.

Publish when the learner can distinguish accepted work, ongoing work, and a verified terminal outcome. That contract prevents a common documentation error: treating a successful request about a job as proof that the job itself did what the user wanted.

Sources

Matt Pru

Co-founder and CEO of Stackmatix. Writing about growth, customer acquisition, and the decisions behind useful marketing. Connect on LinkedIn.

Developed with AI assistance under Matt's editorial direction. Our Editorial Approach