Skip to content

bug: Sandbox timestamps display UTC instead of local time, causing 2-hour drift #2106

Description

@benoitf

Agent Diagnostic

Investigated timestamp formatting across CLI and TUI crates. Loaded skills: create-github-issue, Explore (codebase search).

Findings:

  • format_epoch_ms() in crates/openshell-cli/src/run.rs:169 performs manual UTC arithmetic (secs / 86400, civil_from_days) to convert epoch milliseconds to YYYY-MM-DD HH:MM:SS. This always produces UTC time-of-day components regardless of the user's local timezone.
  • format_timestamp() in crates/openshell-tui/src/lib.rs:2484 has the same pattern (days_to_ymd helper).
  • format_timestamp_ms() in crates/openshell-cli/src/run.rs:7823 (audit log timestamps) also uses UTC arithmetic.
  • format_age() in the TUI (relative time like "5m", "2h 30m") is not affected — it computes UTC-to-UTC differences correctly.
  • chrono = "0.4" is already a dependency of the CLI crate; the TUI would need it added.
  • JSON output (sandbox_to_json, provider_to_json) also uses format_epoch_ms, producing UTC strings with no timezone indicator.

Description

Actual behavior: openshell sandbox list displays the CREATED column in UTC. For users in non-UTC timezones, timestamps appear to be hours in the past. For example, in UTC+2 (CEST), a sandbox created at 16:56 local time shows as 14:56:41, making it look like it was created 2 hours ago.

NAME         CREATED              PHASE
kaiden-test  2026-07-01 14:51:03  Ready
apt-capelin  2026-07-01 14:56:41  Ready

Expected behavior: The CREATED column should display timestamps in the user's local timezone. JSON output (--output json) should use ISO 8601 with timezone offset (e.g., 2026-07-01T16:56:41+02:00).

Reproduction Steps

  1. Be in a non-UTC timezone (e.g., CEST / UTC+2)
  2. Run openshell sandbox create --from base
  3. Run openshell sandbox list
  4. Compare the CREATED timestamp with your local clock — it will be offset by your timezone difference from UTC

Environment

  • OS: macOS (darwin-arm64)
  • OpenShell: built from main branch

Logs

# Local clock: 16:56 CEST (UTC+2)
# sandbox list shows:
NAME         CREATED              PHASE
apt-capelin  2026-07-01 14:56:41  Ready
# Expected:
apt-capelin  2026-07-01 16:56:41  Ready

Metadata

Metadata

Assignees

No one assigned

    Labels

    state:triage-neededOpened without agent diagnostics and needs triage

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions