Uncertain State / In-Doubt State

A suspended condition where an external caller cannot determine whether an operation succeeded or failed. Resilient systems keep such tasks on hold rather than making reckless assumptions or triggering premature re-executions.

General Meaning

In distributed systems, when Node A sends a command to Node B and the communication cuts out or times out before an answer returns, Node A cannot distinguish between two possibilities: did the packet fail to reach Node B, or did Node B successfully finish processing while only the acknowledgment was lost in transit? This suspended state of indeterminacy is termed 'uncertain' or 'in-doubt'.

Naive systems frequently classify unacknowledged timeouts as immediate failures and trigger aggressive retries or reassign work to other workers. If the original worker was actually still executing or had already finished, this premature assumption triggers catastrophic double-processing, duplicate billing, and state divergence. Robust architectures explicitly preserve the uncertain state and hold active reservations until ground truth is established through reconciliation.

Why It Matters

  • Guarantees prevention of duplicate execution: Blocks arbitrary reassignment or retries when an existing worker might still be running or have finished its assignment.
  • Accurately reflects unverified operational realities: Rejects binary success/failure classification, allowing safe manual audits or automated reconciliations based on truthful telemetry.
  • Eliminates split-brain resource contention: Holding task reservations during lease expirations prevents multiple worker agents from competing for and corrupting the same job.

How the Site Factory Uses It

In the Site Factory, when worker lease heartbeats expire in Cloudflare D1 execution_jobs, or when A2A workflow stages lose connectivity, tasks transition to uncertain instead of being released. In dispatch/src/authority.js and a2a-claim.js, when lease_until < now, the job status is set to status='uncertain'. As explicitly noted in a2a-claim.js (// Expiry never releases the reserved work or reassigns the execution.), lease expiration never forfeits the reservation or hands the task to another machine. Similarly, dispatch/src/workflow.js and honbu/a2a_contract.py call mark_uncertain and halt automated retries until a2a-recovery.js reconciles true worker state.

This principle extends across direct site uploads and external AI dispatches. In ops/operator_reviews/6384926d09e3bb22d789.json, uploads without verifiable production evidence are marked uncertain/superseded to prevent hazardous re-uploads. Furthermore, in dispatch/src/cloud-hand-checkpoint.js, if saving a launch response fails, standby nodes preserve the intent as unverified and refuse to re-dispatch blindly based on elapsed time.

Caveats & Operational Rules

  • A timeout is not a failure: Timeout merely marks the expiration of an observation window without an answer; it does not constitute proof that the remote execution failed.
  • Never decide states by speculation: In accordance with the Site Factory core rule in AGENTS.md (never answer with speculation), the data layer must never force binary judgments without concrete evidence.
  • Mandate reconciliation and recovery paths: Leaving jobs suspended indefinitely causes pipeline blockages; the Site Factory relies on watchdogs and recovery scripts to verify Git commits, PRs, and receipts before resolving status.

Related Terms

References

  • Book: Martin Kleppmann, *Designing Data-Intensive Applications*, Chapter 8 (The Trouble with Distributed Systems: Knowledge, Truth, and Lies) & Chapter 9 (Two-Phase Commit and In-Doubt Transactions)

Verified: 2026-11-08