Skip to content

fix(desktop): render chat execute_sql datetime columns in local time with zone label (#12321) - #12349

Merged
kodjima33 merged 1 commit into
mainfrom
watchdog/issue-12321-chat-sql-datetime-localtime
Aug 28, 2026
Merged

kodjima33 merged 1 commit into
mainfrom
watchdog/issue-12321-chat-sql-datetime-localtime

Conversation

@kodjima33

@kodjima33 kodjima33 commented Aug 28, 2026 •

Copy link
Copy Markdown
Collaborator

Bug

Desktop chat's execute_sql tool renders SQLite DATETIME columns (timestamp, createdAt, startedAt, completedAt) as raw naive-UTC text, and the chat model presents that text as if it were already local time — a 3:59:51 PM EDT event shows as 7:59:51 PM. Fixes #12321.

Root cause

SQLQueryResultProjection.renderedValue copies GRDB Date cell values verbatim. GRDB stores Date columns as naive UTC text (yyyy-MM-dd HH:mm:ss.SSS, no zone marker), so nothing in the pipeline ever applies the UTC→local offset before the string reaches the model.

Fix

SQLQueryResultProjection.swift: datetime-shaped columns (timestamp, or a name ending [a-z]At, e.g. createdAt/startedAt/completedAt) are parsed as naive UTC and re-rendered in TimeZone.current with an explicit zone abbreviation, mechanically, rather than relying on the model to apply the offset itself. Non-datetime string columns are untouched.

What I tested

Rebased onto current main (2f2be5a) and ran the full ChatToolExecutorSQLTests suite via xcrun swift test --package-path Desktop --filter ChatToolExecutorSQLTests: 14/14 passing, including the new regression test testExecuteSQLRendersDatetimeColumnsInLocalTimeWithZoneLabel (exact UTC instant from the reported repro, asserted against the local-zone rendering).

Product invariants affected

  • INV-CHAT-1

Failure-Class: new

🤖 automated by hourly watchdog — tested and merged

Review in cubic

@kodjima33
kodjima33 merged commit 08a304b into main Aug 28, 2026
30 checks passed
@kodjima33
kodjima33 deleted the watchdog/issue-12321-chat-sql-datetime-localtime branch August 28, 2026 11:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Desktop chat shows UTC screenshot timestamps as local time

1 participant