Skip to content

fix(bluebubbles): use UTC epoch for tempGuid instead of naive local time - #79603

Open
webtecnica wants to merge 1 commit into
NousResearch:mainfrom
webtecnica:fix/79511-bluebubbles-tempguid-utc
Open

fix(bluebubbles): use UTC epoch for tempGuid instead of naive local time#79603
webtecnica wants to merge 1 commit into
NousResearch:mainfrom
webtecnica:fix/79511-bluebubbles-tempguid-utc

Conversation

@webtecnica

Copy link
Copy Markdown
Contributor

Summary

gateway/platforms/bluebubbles.py built temporary message GUIDs with datetime.utcnow().timestamp(). utcnow() returns a naive datetime, and calling .timestamp() on a naive datetime interprets it as local time, not UTC — so the embedded epoch was offset by the machine's UTC offset (e.g. −8h on UTC+8, −3h on UTC−3).

Root Cause

Two call sites (line ~513 _create_chat_for_handle and line ~569 chunked send path) used datetime.utcnow().timestamp(), producing a temp-<epoch> GUID whose timestamp is wrong by the local UTC offset.

Change

  • gateway/platforms/bluebubbles.py: both call sites now use datetime.now(timezone.utc).timestamp() (correct UTC epoch); timezone added to the datetime import.
  • tests/gateway/test_bluebubbles.py: new TestBlueBubblesTempGuid class asserting both outbound payloads embed a UTC epoch within a 5s tolerance of time.time() (a local-offset bug drifts by hours, far beyond the window).

Verification

  • tests/gateway/test_bluebubbles.py: 20 passed (18 pre-existing + 2 new).

Closes #79511

@alt-glitch alt-glitch added type/bug Something isn't working comp/gateway Gateway runner, session dispatch, delivery P3 Low — cosmetic, nice to have duplicate This issue or pull request already exists labels Aug 5, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

Duplicate of #23820: both replace datetime.utcnow().timestamp() with datetime.now(timezone.utc).timestamp() at the same two BlueBubbles tempGuid call sites.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery duplicate This issue or pull request already exists P3 Low — cosmetic, nice to have type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: bluebubbles tempGuid uses datetime.utcnow().timestamp() — epoch offset by local UTC offset

2 participants