Skip to content

Include session start timestamp in codex exec --json stream #8620

@hubix2000

Description

@hubix2000

Feature request

When consuming codex exec --json, there is no session creation timestamp in the JSONL stream. If a client cannot process the full stream (or processes it asynchronously), it is hard to later reconcile and synchronize sessions by time across the JSONL rollout files. I need a stable session timestamp so I can query “changes since X” reliably.

Proposed behavior

Emit the session start timestamp (RFC3339, UTC) in the JSON stream as part of the initial thread.started event. Ideally this is the same “locked” timestamp written into the rollout file’s SessionMeta.timestamp and remains stable across resumes.

Example (new field):

{"type":"thread.started","thread_id":"<uuid>","timestamp":"2025-09-05T16:53:11.850Z"}

Rationale

  • Enables offline/partial stream processing and later synchronization.
  • Allows clients to correlate the exec stream with stored JSONL sessions using the canonical session timestamp.
  • Avoids relying on event arrival time, which is not stable across resumptions.

Notes

  • For resumed sessions, the timestamp should come from the existing rollout SessionMeta (not a new clock value).
  • The format can match the existing rollout SessionMeta.timestamp RFC3339 format.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestexecIssues related to the `codex exec` subcommand

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions