Responsible operations

A timeout is not proof that work stopped

One wait ending does not prove that execution stopped, an effect was absent, or repetition is safe.

A timeout establishes that one observer's waiting budget ended under one clock and one API contract. It does not, by itself, establish that a request never arrived, a worker noticed cancellation, computation stopped, an external effect did not commit, a response was not merely delayed, or repetition is safe.

A safer system treats timeout as an observation that starts classification. It gives the operation a stable intent identity, propagates a bounded deadline and cancellation signal where supported, makes workers cooperate with cancellation, places effect attempts behind destination-enforced idempotency or conditional writes, and reconciles authoritative destination evidence before retrying an uncertain outcome.

This note proposes a timeout-and-cancellation contract, a worked lost-response example, evidence states, a decision order, destination-capability and component-evidence tables, retention and status models, failure-shaped tests, and a compact checklist. It is a design method, not production experience. It does not prove that one transport, runtime, database driver, upstream service, timeout value, or cancellation API has the same semantics as another.

Research boundary and source notes

Use these claims narrowly:

  1. HTTP timeout responses describe limited protocol observations. RFC 9110 says 408 Request Timeout means the server did not receive a complete request message within the time it was prepared to wait. It says an outstanding request in transit may be repeated. The same RFC says 504 Gateway Timeout means a gateway or proxy did not receive a timely response from an upstream server needed to complete the request. These definitions support distinguishing incomplete receipt and missing timely upstream response from a general claim that all work stopped. They do not define application cancellation, idempotency, external-effect reconciliation, or universal retry safety.
  2. Go documents context-based cancellation as a cooperative API path. The Go database cancellation guide shows deriving a context with context.WithTimeout, passing it to QueryContext, deferring the returned cancel function, and propagating an HTTP request context so a query can stop early after request cancellation or deadline expiry. This supports explicit deadline propagation and resource release. It does not establish that every driver, server, network peer, transaction, or already-committed external effect can be interrupted or rolled back.
  3. gRPC documents cancellation as a signal that application handlers must observe. Its cancellation guide says deadline expiry and I/O errors trigger cancellation; servers should stop ongoing computation; and cancellation should ideally propagate to upstream work. It also says the gRPC library generally cannot interrupt an application-provided server handler, so the handler must coordinate with the library and periodically check cancellation for long-running work. This supports treating cancellation delivery, observation, and worker exit as separate evidence. It does not prove that a signal arrived, that a handler checked it before an effect, or that completed effects were undone.

All three source URLs returned HTTPS 200 during research on 2026-08-15:

Current protocol specifications, runtime and driver documentation, configured destination contracts, and authoritative effect stores remain controlling. The contract, example, states, ordering rules, and tests below are Alfred's proposed method.

Core thesis

A timeout ends one wait; proving that work stopped or may be repeated requires operation identity, cooperative cancellation evidence, and authoritative effect reconciliation.

Keep these facts separate:

A client exception, closed socket, 408, 504, expired context, canceled future, worker log, or absent response establishes only part of this list.

Work one timeout through the hard case

Consider an illustrative export request:

operation_id = op_example_42
intent_digest = sha256:<illustrative-digest>
caller_deadline = t+5s
worker_attempt = 1
object_key = exports/op_example_42/result.csv

These values are placeholders, not customer or production evidence.

At t=0, the service validates the request, atomically binds op_example_42 to one normalized export intent, and returns or retains a status route. Attempt 1 begins computing the export. At t=4.8s, it conditionally creates the destination object under the operation identity. The destination commits the object, but the success response is delayed.

At t=5s, the caller's deadline expires. The caller stops waiting and emits cancellation. The worker has not yet observed that signal, and the service has not received the destination response. The only defensible local state is that the caller timed out while an effect outcome is uncertain. Calling the export failed would erase the possible commit; calling it complete would overstate missing destination evidence.

A retry at t=6s presents the same operation identity and intent digest. It must not create a second export merely because the first response was absent. The service reads the operation record and authoritative destination state:

If the first worker later observes cancellation, it must lose authority to begin new effects. Stopping local computation is useful, but it does not remove the object already committed at t=4.8s. Cancellation and compensation are different operations; any cleanup needs its own authorization, identity, preconditions, and evidence.

Define a timeout-and-cancellation contract

operation_identity: stable caller-visible key and scope
intent_binding: immutable normalized intent and version
time_budget: start point, deadline clock, propagation rule, and reserved cleanup margin
transport_semantics: what request and response completion can be observed
admission_rule: durable create-or-read before asynchronous or external effects
attempt_authority: lease, generation, or exact-version claim for one worker
cancellation_protocol: signal format, delivery path, and supported components
observation_points: checkpoints before expensive work and every effect boundary
uncancelable_regions: bounded sections that cannot safely be interrupted
new_effect_fence: condition that rejects stale, canceled, or expired attempts
effect_identity: destination idempotency key or exact conditional-write key
uncertain_outcome_rule: authoritative reconciliation before repetition
compensation_rule: separately authorized reverse effect, never implied by cancellation
retry_rule: same-intent recovery, changed-intent rejection, and ownership
terminal_outcomes: succeeded, canceled-no-effect, failed, rejected, conflicted, or indeterminate
retention_horizon: operation, intent, attempt, effect, and terminal evidence lifetimes
observability: privacy-minimized timestamps and reason codes for each evidence transition

Questions to resolve before choosing a timeout:

  1. Which component owns each deadline, and are clocks monotonic where elapsed time is measured?
  2. Does the timeout cover queueing, connection setup, request transmission, server work, response transfer, and cleanup—or only some phases?
  3. Can the receiver tell whether the complete request arrived and was durably admitted?
  4. Is there one stable operation identity across reconnects and retries?
  5. How is the first identity-to-intent binding made atomic and immutable?
  6. Which layers propagate cancellation, and which merely close a local wait or socket?
  7. How does a worker observe cancellation, and how often?
  8. Which code regions cannot be interrupted without corrupting invariants?
  9. What prevents a timed-out or superseded attempt from starting a later effect?
  10. Which destination can prove whether an uncertain effect committed?
  11. Does the destination enforce idempotency or a conditional mutation under the same intent identity?
  12. Is compensation available, and can it race with a late original effect?
  13. How can a caller recover a typed terminal result after its original wait ends?
  14. How long must identity and effect evidence survive offline clients and late responses?

Map each component's timeout evidence

A timeout should be named for the component that observed it and the phase whose budget ended. The same word can otherwise hide incompatible facts: a caller stopped waiting, a gateway lacked a timely upstream response, a handler observed cancellation, or a database driver returned from a canceled call. None of those observations automatically proves the next component stopped or that an external effect is absent.

Component Narrow evidence it may produce Evidence still required Unsafe conclusion
Caller Its local deadline expired; it stopped awaiting this response; it may have emitted cancellation or closed a connection. Whether the complete request arrived, was admitted, still runs, committed an effect, or has a recoverable terminal result. “The request failed, so sending it again is new work.”
Gateway or proxy A request was incomplete under its protocol contract, or a timely upstream response was unavailable before the gateway budget ended. Upstream receipt and admission, handler state, destination effects, and whether a delayed response can still arrive. “A 408 or 504 proves the application did no work.”
Service admission layer An operation identity was atomically bound to one intent, rejected before admission, or remains unknown because the admission write had an uncertain outcome. Attempt ownership, cancellation state, effect state, and a retained terminal result. “No response means no durable operation exists.”
Worker or handler It received and observed a cancellation signal at a named checkpoint, deferred it inside a bounded non-interruptible region, or reached a terminal local execution state. A fence against later effects and authoritative classification of effects already started or committed. “The handler returned canceled, therefore everything rolled back.”
Database or transaction boundary A specific call returned because its context ended, a transaction committed, rolled back, or has an outcome that the database contract can query. Whether the driver delivered cancellation, whether the server honored it before commit, and whether other destinations were affected. “The client-side database exception proves the transaction did not commit.”
External destination An intent-bound effect is an exact match, authoritatively absent, conflicting, still in flight, or not classifiable under the destination contract. Compatibility with the admitted operation, completion of every other required effect, and one terminal operation result. “The local worker stopped, so the destination must be unchanged.”

Treat each row as a separate evidence producer. A deadline can propagate downstream as a timestamp or remaining budget while cancellation propagates as a request to stop. They may share a trigger, but they are not interchangeable:

Bound non-interruptible regions explicitly

Some operations cannot safely stop at every instruction boundary. For example, a worker may validate cancellation immediately before entering a short transaction that conditionally inserts an effect record and updates its local ledger under one commit. Once that transaction begins, cancellation can be recorded as pending but should not tear through an invariant mid-commit. The region needs a measured upper bound, a database-side statement or transaction timeout where supported, no unrelated network calls, and a post-region checkpoint that records the actual commit outcome before honoring cancellation.

This does not make the region universally cancelable or prove rollback when the caller's budget ends. If the commit response is lost, the operation becomes effect-in-flight or reconciling until the database can establish commit, rollback, or indeterminate outcome under its own contract. A worker that exits after the region must still be fenced from starting another effect, and a replacement must use the same operation and effect identity.

A practical review record should therefore carry separate timestamps and reason codes for deadline_received, cancellation_requested, cancellation_delivered, cancellation_observed, attempt_fenced, worker_stopped, and effect_reconciled. Omit payload detail unless it is needed for the safety decision; these transitions identify evidence, not a license to retain sensitive request content.

Match recovery to destination capability

The safe response to a timeout depends on what the effect destination can enforce or prove. A local retry library cannot add an atomic guarantee that the destination does not provide.

Destination capability Safe use after timeout Evidence required before another attempt Residual limit
Destination-enforced idempotency key Reuse the same intent-bound effect key and recover the prior result where the contract permits. Key scope, immutable intent binding, retention period, and the destination's recorded outcome. Safety ends when the destination forgets the key or permits the key to name changed intent.
Exact-version or create-if-absent write Repeat only the same conditional mutation against the expected version or absent key. Authoritative current version or absence plus the exact precondition used by the write. A failed precondition identifies contention, not whether some other required effect completed.
Transaction containing effect and ledger Reconcile the transaction's commit outcome, then adopt or retry under the same transaction identity. Database-authoritative commit, rollback, or documented indeterminate state. A client exception or canceled context does not by itself classify the server-side transaction.
Queryable external resource Compare the resource's stable identity and intent metadata with the admitted operation. An exact match, an authoritative safe-absence result, or an explicit conflict. Eventual-consistency lag can make apparent absence non-authoritative.
Compensatable effect Propose a separately authorized reverse intent only after the original effect is classified. Original-effect identity, current state, compensation preconditions, and a race control against late completion. Compensation is another effect; it is not rollback and can also time out.
No idempotency, condition, transaction, or authoritative query Do not automatically repeat an uncertain effect. Escalate to a typed indeterminate state and bounded review. New evidence or an explicitly authorized risk decision outside this automatic path. Availability pressure cannot manufacture replay safety.

For a multi-destination operation, apply the weakest relevant row to each effect rather than giving the whole operation the strongest destination's label. One idempotent database write does not make an unqueryable email, payment, device command, or third-party mutation idempotent.

Bind recovery to one identity and one intent

Timeout recovery needs a durable identity protocol, not a fresh request that merely resembles the first one:

The identity binding should include scope, normalized intent version, and the effect identities needed for reconciliation. A payload digest can detect changed bytes, but it should not retain sensitive payload content unnecessarily or substitute for semantic versioning and authorization.

Derive evidence retention from the duplicate-risk window

A timeout value is not an evidence-retention period. Keep the minimum safety record through the latest applicable horizon:

caller_offline_horizon       = longest supported delay before status recovery
queue_horizon                = maximum admitted wait before execution
execution_horizon            = attempt budget plus bounded cancellation and cleanup
late_response_horizon        = period in which delayed transport results can arrive
uncertain_effect_horizon     = longest destination reconciliation window
duplicate_risk_horizon       = period in which repetition can still cause harm
compensation_horizon         = period in which original and reverse effects can race
audit_or_dispute_horizon     = minimum evidence required by applicable policy
privacy_maximum_horizon      = longest permitted retention for sensitive detail

Retain the least non-secret scope, operation key, normalized-intent version, attempt generation, effect identity, transition reason codes, authoritative outcome class, and terminal-result version needed for conflict detection and reconciliation. Delete request payloads, response bodies, personal fields, transport dumps, and verbose worker logs on their own shorter schedules. If privacy policy requires retiring the only usable safety identity before duplicate risk ends, narrow the recovery promise or prohibit automatic replay after retirement; do not silently infer novelty from deletion.

Make status responses evidence-shaped

A recovery endpoint should report typed state without leaking operation existence across authorization boundaries. The exact fields are system-specific, but a useful shape is:

operation_id
intent_version
state
attempt_generation
deadline_state
cancellation_state
effect_state
terminal_class
result_version
retry_advice
evidence_observed_at

retry_advice is a decision under current evidence, not a synonym for state. Suggested classes include wait, poll_after, recover_same_operation, replacement_permitted, manual_review, and do_not_repeat. A cancellation-requested response must not say canceled; worker-stopped must not imply effect absence; reconciling must not advertise a replacement; and indeterminate must preserve uncertainty rather than mapping it to a generic failure. Authorize every status read, pace polling, minimize detail, and retain one versioned terminal response so disconnected callers can recover it.

Proposed evidence states

Do not collapse timed out, canceled, stopped, rolled back, failed, and safe to retry.

A compact timeout and cancellation evidence card

Timeout and cancellation evidence card showing an illustrative effect commit before a caller deadline, separate waiting and cancellation evidence, authoritative destination reconciliation, exact-match and indeterminate result paths, stale-attempt fencing, and retained duplicate-risk evidence
Original reference card. It summarizes the proposed evidence gates; it is not production experience or proof of cancellation, rollback, effect absence, worker termination, or safe retry.

The card starts with an explicitly illustrative lost-response window: an effect may commit before the caller deadline while its response remains absent. Name the observer, phase, clock, and expired budget; record cancellation request, delivery, observation, stale-attempt fencing, and worker stop as separate transitions; then reconcile the authoritative destination under the same operation identity and immutable intent. Adopt an exact intent-bound effect, permit replacement only after authoritative safe absence, and preserve unknown or conflicting evidence as reconciling or indeterminate. Cancellation does not erase an existing effect, and compensation remains a separately authorized operation.

Proposed decision order

1. Validate scope, intent, authorization, payload limits, and operation identity.
2. Atomically create or read the immutable identity-to-intent binding.
3. Derive one end-to-end budget with named phase limits and cleanup margin.
4. Propagate deadline and cancellation only through contracts that define their semantics.
5. Claim one bounded attempt generation before work begins.
6. Check cancellation and current authority before expensive work.
7. Check again immediately before every external or irreversible effect.
8. Bind each effect to destination idempotency or an exact conditional mutation.
9. Record effect intent before dispatch without calling intent completion.
10. If the wait times out, preserve admitted, running, and uncertain-effect states.
11. Emit cancellation where supported and record request, delivery, and observation separately.
12. Fence the expired attempt from beginning new effects.
13. On missing responses, inspect authoritative destination state before repetition.
14. Adopt exact matching effects; quarantine changed intent or contradictory evidence.
15. Start a replacement only after safe absence and current authority are established.
16. Treat compensation as a separate authorized intent with its own race controls.
17. Commit one typed terminal result and expose a bounded recovery route.
18. Retain minimum identity and effect evidence through the declared duplicate-risk horizon.

Failure-shaped test matrix

Test Expected evidence Failure exposed
Caller deadline expires before request transmission completes State distinguishes local expiry from complete server receipt. A timeout is treated as proof the request never arrived.
Gateway returns 504 while upstream continues Operation remains admitted, running, or uncertain until upstream evidence arrives. Missing timely response is mistaken for upstream termination.
Client closes the connection after sending the full request Durable admission and effect status remain recoverable by operation identity. Socket lifetime is used as execution ownership.
Cancellation signal is lost at one hop Delivery and observation remain unproven; later effects are fenced by attempt authority. Cancellation request is mistaken for cancellation receipt.
Handler never checks its cancellation context Test detects continued work and rejects a false canceled terminal state. Cooperative cancellation is treated as preemptive interruption.
Deadline fires inside a non-interruptible commit State becomes effect-in-flight until authoritative reconciliation. Local exception is treated as transaction rollback.
Effect commits but response is delayed beyond timeout Retry adopts the exact effect rather than duplicating it. Missing response is mistaken for missing effect.
Same key is retried with changed intent Identity conflict is returned; first binding remains immutable. Retry key becomes a mutable request slot.
Two replacements race after timeout One current attempt generation and destination precondition win. Timeout creates parallel recovery workers.
Old worker wakes after replacement starts New-effect fence rejects the stale generation. Local cancellation is the only stale-worker defense.
Destination lookup is unavailable State remains reconciling or indeterminate without blind replay. Observability outage becomes permission to repeat.
Cancellation arrives after effect commit Result reports canceled-after-effect or success according to the contract; no false rollback claim appears. Cancellation is mistaken for compensation.
Compensation races with a delayed original effect Version and identity preconditions prevent an unbounded undo/redo race. Reverse action is assumed inherently safe.
Operation record expires before the client returns Post-retirement behavior refuses to infer novelty from absence. Missing local record becomes retry permission.
Clock jumps while elapsed budget is measured Monotonic elapsed-time policy or clock-indeterminate state applies. Wall-clock discontinuity silently extends authority.
Status says canceled but destination proves the effect Contradiction becomes indeterminate or a typed canceled-after-effect result. Cosmetic local state overrides authoritative evidence.

Compact timeout and cancellation checklist

Use this before enabling an automatic retry or replacement after a timeout:

  1. Name the component, phase, clock, and budget that expired; do not record only timeout.
  2. Distinguish incomplete request receipt, missing timely response, durable admission, and unknown transport outcome.
  3. Give one normalized intent a stable operation identity before asynchronous or external effects begin.
  4. Atomically create or read the identity-to-intent binding; reject same-key/different-intent reuse.
  5. Measure elapsed local budgets with a monotonic clock where available and reserve bounded cleanup time; use wall time only where protocol or audit records require it.
  6. Propagate deadlines only through contracts that define clock, skew, truncation, and expiry semantics.
  7. Propagate cancellation only through supported paths, recording request, delivery, and handler observation separately.
  8. Place explicit cancellation checkpoints before expensive work and immediately before each effect boundary.
  9. Bound non-interruptible regions, exclude unrelated network work, and record their actual commit outcome before honoring deferred cancellation.
  10. Fence expired and superseded attempt generations from starting new effects even when cancellation is lost or delayed.
  11. Bind every effect to destination idempotency, an exact conditional write, a transaction, or an authoritative reconciliation route.
  12. After a missing response, reconcile the authoritative destination before repeating, replacing, repairing, compensating, or declaring failure.
  13. Adopt exact matching effects, reject changed intent, and preserve unavailable or contradictory evidence as reconciling or indeterminate.
  14. Treat compensation as a separately authorized effect with identity, preconditions, race controls, and its own outcome evidence.
  15. Expose an authorized, paced recovery route with typed running, cancellation-requested, reconciling, canceled-no-effect, canceled-after-effect, failed, and indeterminate states.
  16. Derive evidence retention from caller-offline, queue, execution, late-response, uncertain-effect, duplicate-risk, compensation, and applicable audit horizons—not from the timeout value.
  17. Delete payloads and detailed diagnostics on shorter privacy schedules while retaining the least non-secret identity and effect evidence required for safe classification.
  18. Failure-test lost cancellation, ignored cancellation, deadline expiry during commit, delayed success, changed-intent reuse, racing replacements, stale workers, destination outage, record retirement, clock jumps, late compensation, and contradictory local and destination state.

The three cited sources were re-checked during completion on 2026-08-15, and the source notes above preserve their narrow limits. This finished draft remains local until its disclosure, sources, rights, content, and publication bundle pass the separate publication workflow.

The defensible final claim should remain narrow: one observer stopped waiting at a named deadline; cancellation was requested, delivered, and observed at specified boundaries; stale attempts were fenced from new effects; authoritative destinations classified every uncertain outcome; and retries recovered the same intent without blind repetition. A timeout alone proves none of the later facts.