Repository navigation
fix(backend): render screen activity search timestamps in UTC instead of host-local time (#4643) - #8588
Conversation
… of host-local time (BasedHardware#4643)
|
Thanks @ZachL111 — good catch on the underlying bug. Rendering an epoch via One consistency note before this lands, though. The description says the change "matches how conversation search and the other timestamp renderings handle epoch values," but that's not quite accurate: conversation search renders match timestamps in the user's timezone via I'd like a maintainer to confirm the intended direction here:
The code change itself is correct and minimal, and the structural source-level test is reasonable given the heavy import graph (though a behavioral assertion on the rendered output would be stronger if feasible later). No security/data-handling concerns on this change. Tagging for product/maintainer review on the UTC-vs-user-timezone consistency question. |
…timezone for chat consistency (BasedHardware#4643)
|
Good point, thanks. You are right that conversation_tools renders match timestamps in the user's timezone (via notification_db.get_user_time_zone(uid)), so UTC here would have made the two surfaces disagree within the same chat answer. My description's "matches conversation search" line was about the host-dependence fix rather than the destination timezone, so it was misleading. Updated in bd9e325 to render in the user's timezone like conversation_tools, via a small _resolve_display_tz(uid) helper that falls back to UTC when the user has no timezone set or the value is not a valid IANA name. Both surfaces now render the same way, addressing the #4643 consistency you flagged. I also corrected the PR description. The helper is covered behaviorally (a set timezone resolves to that zone, unset and invalid both fall back to UTC), with a source-level check on the wiring. |
There was a problem hiding this comment.
1 issue found across 2 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
…n screen activity search
|
Fixed: _resolve_display_tz now wraps the whole resolution, including the notification_db.get_user_time_zone(uid) Firestore read, in the try/except so a transient lookup error falls back to UTC instead of failing the search (matching the fail-soft pattern in the other retrieval tools). Added test_resolve_display_tz_falls_back_to_utc_when_lookup_raises to cover it. |
kodjima33
left a comment
There was a problem hiding this comment.
Backend bug fix with regression test; CI green. Approving.
Problem
search_screen_activity_toolrenders each matching screenshot's timestamp for the chat model with a naivedatetime.fromtimestamp(ts). Without atz, the epoch is interpreted in the host's local timezone, so the time shown depends on where the backend runs.The companion chat tool
conversation_toolsalready renders match timestamps in the user's timezone (vianotification_db.get_user_time_zone(uid)). Rendering screen-activity matches in a fixed timezone would make the two surfaces disagree within a single chat answer, which is the inconsistency #4643 is about.Fix
Render screen-activity match timestamps in the user's timezone, matching
conversation_tools. A small_resolve_display_tz(uid)helper readsnotification_db.get_user_time_zone(uid)and returns the correspondingZoneInfo, falling back to UTC when the user has no timezone set or the value is not a valid IANA name.Test
tests/unit/test_screen_activity_search_utc.py(registered intest.sh) loads the tool with its heavy leaves stubbed and exercises_resolve_display_tzbehaviorally: a set timezone resolves to that zone, an unset timezone falls back to UTC, and an invalid name falls back to UTC. A source-level check confirms the render uses the resolved timezone and no longer uses the naive form.