Skip to content

Commit 071ec00

Browse files
fix(dedupe): allow duplicates to pass when confirmation pending
Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 7d62865 commit 071ec00

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

webhook_server_fastapi.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3473,6 +3473,17 @@ def _check_signal_id_duplicate(signal_id: str, signal: str, request_id: str) ->
34733473
f"[{request_id}] DUPLICATE SIGNAL: signal_id={signal_id}, signal={signal_upper}, cache_key={cache_key} "
34743474
f"(age={cache_age:.1f}s, TTL={_signal_id_cache_ttl_seconds}s) - SKIPPED"
34753475
)
3476+
# If confirmation flow is enabled, allow duplicate to proceed if it's awaiting confirmation
3477+
try:
3478+
if getattr(settings, "WINRATE_UPGRADE_ENABLED", False) and getattr(settings, "REQUIRE_CONFIRMATION", False):
3479+
conf_key = f"{signal_id}|{signal_upper}"
3480+
if hasattr(_confirmation_store, "_data") and conf_key in _confirmation_store._data:
3481+
logger.info(f"[{request_id}] DUPLICATE SIGNAL but confirmation pending: allowing for confirmation (key={conf_key})")
3482+
# refresh cache timestamp and allow processing so confirmation handling can run
3483+
_signal_id_cache[cache_key] = current_time
3484+
return False, "duplicate_allowed_for_confirmation"
3485+
except Exception:
3486+
pass
34763487
return True, "duplicate"
34773488
else:
34783489
# Expired entry, remove it

0 commit comments

Comments
 (0)