Skip to content

fix: treat SQLite timestamps as UTC when computing elapsed time - #14

Open
anshusaurav wants to merge 1 commit into
aaif-goose:mainfrom
anshusaurav:fix/elapsed-time-utc-13
Open

anshusaurav wants to merge 1 commit into
aaif-goose:mainfrom
anshusaurav:fix/elapsed-time-utc-13

Conversation

@anshusaurav

Copy link
Copy Markdown

Summary

  • Dashboard showed wrong elapsed time for subagents (hours instead of minutes) because datetime.fromisoformat() on a naive SQLite timestamp produces a naive datetime, and .timestamp() assumes local time — but time.time() returns UTC epoch seconds. The difference equals the user's UTC offset.
  • Added _utc_epoch() helper that tags naive datetimes as UTC before converting to epoch. Applied to both elapsed_seconds (from created_at) and infer_status (from updated_at).
  • Added 4 regression tests in tests/test_elapsed.py.

Test plan

  • test_naive_timestamp_treated_as_utc — naive ISO string → UTC epoch
  • test_aware_timestamp_preserved — timezone-aware string keeps its offset
  • test_elapsed_is_small_for_recent_session — a just-created session shows ~0s, not hours
  • test_space_separator_handled — SQLite space separator handled correctly

Closes #13

datetime.fromisoformat() on a naive timestamp produces a naive
datetime; .timestamp() then assumes local time.  time.time()
returns UTC epoch seconds, so the subtraction was off by the
user's UTC offset — showing hours instead of minutes.

Add a _utc_epoch() helper that tags naive datetimes as UTC before
converting.  Apply it to both elapsed_seconds (created_at) and
infer_status (updated_at).

Closes aaif-goose#13
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.

[Bug] The time shown in the dashboard for how long agents have been operating is wrong

1 participant