Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

docs: record why the requeue stamp comparison is skew-free (#3376)

[._.]/ Adam Eivy7758ca6713dc
diff --git a/server/lib/taskRequeue.js b/server/lib/taskRequeue.js
index e9c6810ed9..d4696c3c24 100644
--- a/server/lib/taskRequeue.js
+++ b/server/lib/taskRequeue.js
@@ -41,6 +41,15 @@ const stampMs = (task, key) => {
* older peer behaves exactly as it does today.
*
* Depends only on the pair, so both peers compute the same answer.
+ *
+ * Both stamps are wall-clock, but the comparison that matters is not cross-peer:
+ * a machine only ever requeues a run of its OWN (`releaseRetryHold` is scoped to
+ * this instance's agent, and the orphan sweep leaves a task alone while a peer
+ * holds a live lease — `isHeldByOther`), so the spawn and the requeue it must
+ * outrank were written by the same clock. The peer's copy is a replica of that
+ * record, stamps included. Clock skew between peers therefore does not enter, and
+ * the failure mode if it somehow did is the benign one: fall back to the rank, and
+ * the next orphan sweep requeues the task again.
*/
export function isPostSpawnRequeue(pendingTask, inProgressTask) {
if (pendingTask?.status !== 'pending' || inProgressTask?.status !== 'in_progress') return false;