CYGURUACADEMYMy learning ↗
AI & Automation / MODULE 7 / LESSON 4 OF 5

Handle timeouts and unknown external outcomes

10 min read · 2015 words · practice time separate

Extended edition · 7 November 2026

Reading estimate uses 200 words per minute and excludes exercises, self-review and optional book descriptions. Earlier lesson checks are kept; revisit the expanded text if you completed the short edition.

BY THE END OF THIS LESSON

Specify component-level waiting, deadline, cancellation and reconciliation semantics without inferring external failure from a caller timeout.

A timeout belongs to a particular caller and waiting interval. It does not automatically describe the state of every downstream component or prove that an external change failed. This lesson traces delay across the workshop desk's interfaces: intake, draft generation, validation and a hypothetical save of an internal review packet. The focus is an architectural evidence map and bounded waiting policy, rather than repeating a generic instruction to retry. All timings and records are fictional; no service is contacted and no operational timeout settings are prescribed.

In this lesson · 12 sections
  1. Draw the call and message paths before setting timers
  2. Distinguish queue delay, processing and response travel
  3. Allocate a waiting budget without creating a guarantee
  4. Define status ownership after the first response
  5. Preserve the attempt boundary and its parameters
  6. Distinguish known non-start from unknown effect
  7. Treat cancellation as a request with limits
  8. Reconcile the hypothetical saved packet
  9. Prevent retries from multiplying across layers
  10. Design a user status that does not invite duplication
  11. Test a matrix of delay histories
  12. Deliver the deadline and reconciliation specification

1. Draw the call and message paths before setting timers

The desk can acknowledge receipt quickly while drafting and review continue later. Alternatively, one interface might wait for a particular downstream result. Label which path is synchronous, which is queued and what each response means. A response called accepted might establish only receipt, while completed should require evidence for the contract's actual ending state. Ambiguous words create false conclusions when a caller stops waiting.

Draw the hypothetical chain: intake receives R31, the state owner schedules drafting, the worker returns candidate D3, validation inspects it and a separately authorised adapter may save the internal packet. The human review stage need not be hidden inside one long synchronous call. Choose response semantics that match the job. This is a design decision, not a recommendation to introduce queues everywhere. The point is to know which component owns progress and where a caller can obtain a supported status after the first waiting period ends.

2. Distinguish queue delay, processing and response travel

Elapsed time can include waiting to start, doing the work and returning the result. If a caller times out, these possibilities lead to different evidence questions. The draft may not have begun, may still be generating or may already exist while the response is delayed. A single end-to-end timer cannot by itself identify which history occurred.

For the fictional packet save, the destination may have written record K7 before the acknowledgement was lost. The caller's missing response therefore says less than the destination's durable record would, if it can be inspected appropriately. Keep the boundaries explicit. An internal worker's progress record may establish draft completion without establishing external save. A channel acknowledgement may establish receipt without establishing processing. The architecture should preserve these distinct observations rather than collapsing them into one success or failure value. That separation lets a recovery owner ask a specific question about the missing evidence instead of repeating every stage indiscriminately.

3. Allocate a waiting budget without creating a guarantee

Use fictional numbers to examine the relationship between timers: an outer caller waits 200 milliseconds while a downstream component may take 500 milliseconds under the example conditions. The outer timeout can occur while useful work continues. These numbers are teaching assumptions, not proposed production settings. Their value is to expose why mismatched waiting expectations can create predictable uncertainty.

A real design should define the overall task deadline, relevant stage budgets and what happens when a budget is exhausted. Repeated attempts should not silently reset the overall deadline forever. Also distinguish a service target from a guarantee. A target that most drafts finish promptly does not prove that a late draft failed. The architecture dossier should state which timing values need measurement and which deadlines reflect business requirements. Picking a large timeout to make a demonstration appear successful does not solve unclear status ownership or missing recovery evidence; it merely changes when the ambiguity becomes visible.

4. Define status ownership after the first response

If intake returns received, name where the request's subsequent status lives and who may inspect it. The caller should not need to infer progress from whether a screen still spins. A request identifier can link to an authoritative task record under the system's access rules. The design must define that record's states and what evidence supports them.

Do not treat a status lookup as a magical capability every destination provides. In the classroom map, it is a requirement to verify before implementation. If the only available interface cannot establish whether an action occurred after a timeout, the recovery route must preserve uncertainty and involve the appropriate owner. A clean user experience should communicate that limitation honestly rather than display failed and encourage another click. Status ownership is useful because it provides a place to gather observations over time; it does not guarantee that every external fact will be knowable immediately or that an unknown can always be resolved automatically.

5. Preserve the attempt boundary and its parameters

The hypothetical save adapter records operation O31 for candidate D3 at internal destination S. Each attempt has a time, parameter reference and observed response. Keep the logical operation separate from the attempt. A second wait or retry should not create a new business intention merely to obtain a fresh status. A changed candidate or destination requires explicit treatment under the action and approval rules.

Stable identity requires appropriate durable enforcement and a verified external contract where repeated requests can create effects. It is not supplied by asking a model to remember O31. The record should also detect a parameter mismatch rather than reuse an old identity for different content. These requirements matter at the architecture boundary because the adapter may otherwise hide its retry behaviour from the rest of the desk. The state owner needs to know whether it is observing another attempt of the same action or a genuinely different proposal, especially when an earlier outcome remains unknown.

6. Distinguish known non-start from unknown effect

Some evidence may establish that a particular attempt never left an internal validation stage. For example, the adapter rejects a malformed destination before sending under a verified implementation path. That is different from a request whose response was lost after transmission. Define which observations justify known failed or not attempted and which justify outcome unknown. Do not assign certainty merely because a timer or generic error code looks familiar.

In the paper test, one case fails a required-field check before any save attempt is authorised. Its recovery is to correct the input and reassess readiness. Another case passes validation, sends O31 and times out. Its recovery begins with reconciliation because S may already contain K7. The same user-visible word error could conceal both histories. A precise architecture records the boundary reached and the evidence available. This lets the next component avoid treating a safe input correction and a potentially duplicating external retry as equivalent operations.

7. Treat cancellation as a request with limits

A caller may stop waiting or request cancellation, but that does not prove every downstream action was prevented or undone. Define what cancellation means at each component boundary. A queued internal task might be removable before it starts under the system's rules. An external save already accepted by S may require a different authorised action to change or remove it, and no such action should be assumed from the original timeout.

For the classroom exercise, record cancellation requested separately from cancellation confirmed. If O31's outcome is unknown, the task cannot claim no record exists simply because the operator pressed cancel. Preserve the need for reconciliation. This distinction is not an argument against cancellation controls; it makes them meaningful by stating their scope. The architecture should avoid promising a rollback it cannot establish. A waiting caller's intention, a worker's current state and an external system's effect may diverge temporarily, so the record needs room for all three rather than a single reassuring cancelled label.

8. Reconcile the hypothetical saved packet

The exception owner needs evidence linking O31, D3 and S to any destination record. If appropriate authorised inspection shows K7 contains the intended version and operation reference, the state owner can record the supported result without another save. If evidence establishes that no effect occurred and retry is permitted under the verified contract and current approval, the policy can allow another attempt. If neither conclusion is supported, the state stays unknown.

Do not substitute a similar title for a precise association. Two packets may share a title while representing different sources or drafts. The evidence requirement should match the business action. Also inspect whether approval remains current before any new attempt. The source may have changed while the caller waited. An older accepted save may need to be recorded as history without authorising another save of stale content. Reconciliation therefore concerns both external outcome and the current conditions for further action, not merely clearing a red icon in the queue.

9. Prevent retries from multiplying across layers

If intake, the state owner and the adapter each repeat work independently, one user request can generate a surprising number of downstream attempts. Decide which component owns retry policy for each boundary and what other layers should do when they receive a pending or unknown result. The precise implementation varies, but ownership should not be accidental or hidden inside several libraries and interface handlers.

Use a fictional trace with two outer attempts and two adapter attempts per outer call. That can produce four adapter attempts if the layers are uncoordinated; it is not evidence of four legitimate business intentions. The example is simple arithmetic to expose the interaction. Record attempt limits, overall deadline and escalation ownership in one place or through clearly related contracts. Do not claim that reducing retries to one layer solves every failure. It makes the policy easier to inspect, while duplicate protection and reconciliation still depend on the actual operation and destination behaviour.

10. Design a user status that does not invite duplication

The interface should distinguish received, drafting, awaiting review, action in progress and outcome unknown where those states are supported. An unknown save result can show the operation reference and the next reconciliation step rather than a generic publish-again button. The user needs to understand whether another click would start a new intention or refer to the existing one.

Keep explanations concise and practical. The interface does not need to expose every internal timer, but it should not make an unsupported claim such as nothing was saved. A status can say that confirmation has not yet been established and the responsible owner is checking. In the classroom design, these are proposed messages, not claims that the software currently implements them. User experience is part of the reliability path because misleading feedback can induce repeated actions even when the backend has a careful operation record. The architecture should align the visible state with the evidence it actually holds.

11. Test a matrix of delay histories

Prepare cases for queue delay before start, internal validation failure, completed draft with delayed response, destination save accepted before timeout, genuinely known failure and unresolved external outcome. Add a cancellation request after transmission. Write expected states, evidence, retry eligibility and owner for each. These histories challenge component contracts more precisely than a single artificial timeout added to a happy-path demonstration.

The test pack remains fictional until a reviewed implementation exists. AWS's retry guidance offers broader engineering context about safe repetition and request identity; the workshop timing matrix is original teaching material. Do not treat a successful paper trace as proof of a live exactly-once guarantee. Its value is to show which evidence and enforcement properties need testing. Another reviewer should be able to identify the observation that distinguishes known non-start from unknown effect, and the component that owns the next decision. If those cannot be named, the timeout policy is still too vague.

12. Deliver the deadline and reconciliation specification

The final artefact includes call and queue boundaries, acknowledgement meanings, task and stage deadlines, status ownership, operation and attempt records, cancellation semantics, retry ownership and reconciliation evidence. Mark unverified capabilities clearly. The specification should explain what the caller knows at each point without claiming more about the external world than the evidence supports.

Walk the central O31 case once more: the adapter may have saved K7 before the response timed out. The supported caller state is unknown until appropriate evidence resolves it. A new identifier, a longer timer or a confident model statement does not erase that uncertainty. The next lesson combines the component map, mechanism choices, contracts and this recovery specification into an architecture dossier. Carry forward the distinction between controlling waiting and establishing outcome. A system becomes easier to operate when those are designed separately and connected through inspectable records, rather than being hidden behind a single success flag.

A worked example

Fictional save O31 for D3 may create K7 at destination S before the caller times out. The caller records outcome unknown, not definite failure. Cancellation requested does not prove the effect was prevented. Reconciliation needs appropriate evidence linking operation, version and destination, while any further attempt remains subject to current approval and the verified destination contract.

Put it into practice

Map the workshop desk's call and queue boundaries, acknowledgement meanings, timing budgets and status owner. Write expected handling for validation failure before sending, delayed draft response, accepted save before timeout, unresolved outcome and cancellation after transmission. Name retry ownership and evidence required before a potentially duplicating attempt.

Notes stay in this browser. Avoid sensitive personal information.

Compare your answer · Self-review guide

A strong design separates waiting from outcome, queue delay from execution and cancellation request from confirmed prevention. It preserves operation parameters and attempt records, coordinates retry ownership and routes unknown effects to reconciliation. Timeouts do not establish failure; stable identity requires actual enforcement and does not guarantee exactly-once workflow execution.

This is an indicative answer, not an automatic assessment of your written work. Check your reasoning, units and assumptions.

CHECK YOUR UNDERSTANDING

What can a caller conclude from a timeout alone?

← PreviousNext lesson →