Skip to content

Commit 5b1e357

Browse files
fix: surface lock contention for trailing-mode updateData
Per CodeRabbit review, trailing-mode triggers carrying updateData are user-visible (latest payload/metadata/tags). Silently dropping them on lock contention would change run inputs in a way the user can observe. Re-throw on contention for that subset so the SDK can retry; the fast-path + quantization changes mean the herd collapses on its own before we get here. Co-Authored-By: Eric Allam <eallam@icloud.com>
1 parent 293de56 commit 5b1e357

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

internal-packages/run-engine/src/engine/systems/debounceSystem.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -656,6 +656,22 @@ return 0
656656
throw error;
657657
}
658658

659+
if (debounce.mode === "trailing" && debounce.updateData) {
660+
// Trailing-mode triggers carrying updateData are user-visible: dropping
661+
// them silently would mean the eventual run executes against stale
662+
// payload/metadata/tags. Surface the lock failure instead so the SDK can
663+
// retry and (with the fast-path + quantization in place) the herd
664+
// collapses on its own without us hiding data loss.
665+
this.$.logger.warn(
666+
"handleExistingRun: lock contention with trailing updateData - rethrowing to avoid silently dropping update",
667+
{
668+
existingRunId,
669+
debounceKey: debounce.key,
670+
}
671+
);
672+
throw error;
673+
}
674+
659675
this.$.logger.warn(
660676
"handleExistingRun: lock contention, returning existing run without rescheduling",
661677
{

0 commit comments

Comments
 (0)