You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bounty proposal] fix(processing-attention): coerce timestamps to UTC and guard null retry maps ($50 proposed) #23169
In �ackend/database/processing_attention.py, attention-item duration calculation, retry-claim lease expiration checks, and retry-state inspection crash with unhandled TypeError or AttributeError when stored conversation or claim documents contain naive datetime / ISO-8601 string timestamps or explicit None
etry fields:
Mixed naive/aware datetime subtraction in iming(row) (lines 29-33):
iming(row) computes (end - start).total_seconds() directly when isinstance(start, datetime) and isinstance(end, datetime).
When started_at/created_at and inished_at mix timezone-naive and timezone-aware datetime objects, (end - start) raises TypeError: can't subtract offset-naive and offset-aware datetimes inside create_in_transaction and pending_conversations.
When timestamps are stored as ISO-8601 strings, isinstance(..., datetime) evaluates to False, silently reporting duration_seconds: 0.
lease_live(operation, now) compares expires > now where
ow = now_utc() (UTC-aware).
If lease_expires_at or created_at is deserialized as a timezone-naive datetime, expires > now raises TypeError: can't compare offset-naive and offset-aware datetimes inside claim_in_transaction and owns_live_claim.
If lease_expires_at or created_at is an ISO-8601 string, isinstance(..., datetime) is False, causing lease_live to return False and allowing an active in-progress retry claim to be prematurely clobbered.
Explicit None
etry field in list_items (line 97) and claim_in_transaction (line 191):
Both functions call item.get('retry', {}).get('state'). When item['retry'] is explicitly None ({'retry': None}), item.get('retry', {}) returns None and .get('state') raises AttributeError: 'NoneType' object has no attribute 'get'.
Proposed Fix
Add _coerce_utc_datetime() in �ackend/database/processing_attention.py to normalize naive datetime, aware datetime, and ISO-8601 strings to UTC-aware datetime in iming() and lease_live().
Guard item.get('retry') with isinstance(..., dict) and use .get() for operation fields in list_items() and claim_in_transaction().
Add unit tests in �ackend/tests/unit/test_processing_attention_timestamp_guards.py.
Activity
huynhnhatquandongnai-source commentedon Oct 22, 2026
Fix submitted in #23170 (huynhnhatquandongnai-source:fix/processing-attention-timestamp-guards).
Bounty settlement address (Base Mainnet USDC): 0xb9f3765aeb1974c27a193463f655a1a57b3aec94
undivisible commentedon Oct 22, 2026
Thanks for putting this together. We aren't doing bounties at the moment, so we're closing the bounty proposal issues for now — thanks for the fix! 🙏
Dimank92 commentedon Oct 28, 2026
Fix submitted in PR #23847: #23847
Payout Address
fix(processing-attention): coerce timestamps to UTC and guard null re…