Skip to content

Add optional host-side timestamps before every output block in Codex CLI #27203

Open

Description

@simfor99

What variant of Codex are you using?

Codex CLI / Codex in terminal, running in WSL on Linux.

What feature would you like to see?

Please add an optional mode that prefixes every visible output block with the local host-side timestamp generated by the Codex UI/CLI layer, not by the model.

For example:

[2026-06-09 17:38:12 CEST] assistant update ...
[2026-06-09 17:38:40 CEST] tool call started ...
[2026-06-09 17:39:03 CEST] tool output ...
[2026-06-09 17:39:20 CEST] assistant update ...

Ideally this would be configurable, e.g. a CLI flag or config option such as:

show_output_block_timestamps = true
timestamp_source = "host"
timestamp_format = "%Y-%m-%d %H:%M:%S %Z"

The key point is that the timestamp should come from the Codex client process / host clock, not from assistant text generation.

Why this matters

Agents do not have a reliable internal sense of wall-clock time. Even with explicit AGENTS.md instructions telling the agent to run date before any visible timestamp, assistant messages can still display incorrect times after long turns, context compaction, resume, or UI replay.

In one real session, the visible assistant output jumped to 18:31, 18:32, 18:33, 18:35, and 18:37, while the actual local system time checked via shell was around 17:38-17:39 CEST. From the user perspective, the transcript made it look as if ~37 minutes had passed, when only about 10 minutes had passed.

This makes long-running agent work hard to supervise:

  • The user cannot tell how much real time elapsed between output blocks.
  • The agent may accidentally present fabricated or stale timestamps as status evidence.
  • Context compaction/resume can make prior timestamps look authoritative even when they are not.
  • The existing final "Worked for ..." line is useful but not enough to reconstruct timing across multiple assistant updates, tool blocks, compaction, or resumed turns.

Proposed behavior

Add a display-layer timestamp mode where Codex annotates output blocks itself. This should be treated like terminal/UI metadata, similar to log timestamps, not as assistant-authored content.

Suggested scope:

  • Prefix assistant output blocks.
  • Prefix tool call start/end or tool output blocks where feasible.
  • Preserve timestamps through transcript replay/export.
  • Make the mode opt-in to avoid visual noise for users who do not want it.
  • Consider also showing monotonic elapsed time since user submit, e.g. +00:02:31, next to wall-clock time.

Relationship to existing timing requests

This is related to #24240, but different: #24240 asks for user-side timing metrics between turns. This request is specifically for host-generated timestamps before each visible output block so users can audit elapsed time during one long agent action and after compaction/resume.

Activity

  1. added
    enhancement
    CLI
    TUI
    on Jun 9, 2026
  2. simfor99 commented on Jun 9, 2026

    @simfor99
    Author

    Related existing timing issues:

    This request is complementary: it asks for opt-in host-generated timestamps before visible output blocks, so elapsed wall-clock time remains auditable even when assistant-authored timestamps are stale or wrong.

  3. papastanb commented on Jul 27, 2026

    @papastanb

    I strongly support this request. I use several long-running Codex CLI sessions across different projects inside many terminals. When I return to a project, the lack of timestamps makes it difficult to determine when a message, tool call, or action occurred. Host-side timestamps on every visible output block, including tool calls, would significantly improve traceability for multi-project workflows.

  4. rjorgenson commented on Aug 24, 2026

    @rjorgenson

    I wanted this for the same reason: when scrolling through a long TUI transcript, I need to know when each message was sent.

    I tested a small implementation against Codex CLI 0.149.0. It adds an opt-in setting:

    [tui]
    show_message_timestamps = true

    With the setting enabled, the existing separator renders the user message's local send time on the right:

    ──────────────────────────── 2026-08-23 14:05:09 ─
    

    Codex already records the required value in Turn.started_at as a Unix timestamp in seconds, so this does not require a session format or protocol change. The implementation passes that value to the turn-completion path, converts it to local time, and adds it to FinalMessageSeparator.

    A few behavior details from the prototype:

    • The setting defaults to false, preserving the current display.
    • Timestamps appear for conversational turns as well as turns that ran tools.
    • Resumed conversations use the timestamp already stored in the turn history.
    • Existing duration and runtime metrics remain on the left side of the separator.
    • The timestamp is truncated safely when the terminal is narrower than the full label.

    I built and used the patched 0.149.0 binary, and the display works as expected. I also added an insta snapshot covering the right-aligned timestamp and regenerated core/config.schema.json for the new setting.

    The code change is fairly contained. The main changes are config plumbing, passing notification.turn.started_at into the completion handler, and extending the separator renderer. No new dependency is needed because the TUI already depends on chrono.

    Since the repository does not accept external pull requests, I am posting the implementation notes here in case they are useful to the Codex team.

  5. felix314159 commented on Aug 27, 2026

    @felix314159

    yeah please add this, such an obviously useful feature that is still missing for some reason

  6. david-lai-jpg commented on Sep 8, 2026

    @david-lai-jpg

    This feels like one of those tiny observability features that becomes disproportionately important once Codex is used for long-running autonomous work.

    My typical sessions are not 2–5 minute interactive coding bursts. I run /goal workflows for many hours, often with subagents, CI checks, deploy verification, waiting states, and multiple repositories involved. When I come back to a session, Codex currently gives me output like:

    Ran integration tests
    Waiting for agents
    Analyzing CI pipeline
    Verifying deployment
    

    But there is no way to tell whether those events happened 20 seconds apart or whether Codex sat between two of them for three hours.

    The current elapsed timer on the active task does not solve this. What matters is historical timing in the transcript:

    [11:02:14] Ran integration tests
    [11:04:03] Waiting for agents
    [13:47:51] Agent returned
    [13:48:12] Analyzing CI pipeline
    

    That immediately answers basic questions like:

    • Is the agent still making progress?
    • Where did a long-running workflow actually stall?
    • Did a subagent/tool call take 30 seconds or 3 hours?
    • When did CI/deployment activity occur?
    • Was Codex idle for a long period before continuing?

    This is especially important as Codex moves further toward autonomous, multi-agent, long-duration workflows. At that point timestamps are not cosmetic UI—they are basic execution observability.

    What makes this particularly frustrating is that the CLI already knows when events occur and session logs contain timing information. The missing piece is simply rendering an optional host-side timestamp in the TUI.

    I understand that every UI feature carries some maintenance cost, but it is genuinely surprising that something this basic is still unavailable in a tool designed to run unattended for hours. Even a simple opt-in config such as:

    [tui]
    timestamps = true

    with HH:MM:SS local-time prefixes would solve the problem.

    Please consider prioritizing this. The longer Codex sessions become, the more painful the lack of temporal context gets.

  7. ractive commented on Sep 10, 2026

    @ractive

    Adding a concrete use case and display contract from an existing Claude Code setup, checked against Codex CLI 0.153.4.

    The desired result is a subtle local-time prefix on each assistant message, including progress updates during long-running work:

    [16:45:38] The console regression is fixed; running the closing tests.
    

    The timestamp should be generated by the host/client at the start of the message, with these properties:

    • Opt-in, with HH:MM:SS as a useful default and a configurable date/time format.
    • A mid-gray prefix in the terminal (256-color palette index 242), with configurable color. Reset the foreground afterward and append one space.
    • Emit the prefix exactly once per message, on its first streamed chunk; do not repeat or change it as later chunks arrive.
    • Keep it display-only: do not prepend it to assistant content stored in the transcript, model context, copied code, or machine-readable output. If timestamps are retained for replay, keep them as separate metadata and use the original time on replay.
    • Desktop/IDE clients should render the timestamp natively or as plain text; never display literal terminal escape codes.

    The terminal styling in the existing setup is:

    \033[38;5;242m[16:45:38]\033[39m 
    

    Claude Code's MessageDisplay hook makes this possible by returning a modified displayContent only for the first streamed batch (index == 0), while leaving subsequent deltas unchanged. That setup also permits color and date-format overrides via environment variables.

    Related: #33420 requests a MessageDisplay hook. Its proposed observational streaming event would help consumers, but this timestamp use case additionally needs a safe display-only prefix/transformation capability, or an equivalent built-in renderer option. A hook that only observes output would not itself add the prefix.

    A prompt instruction to print the time is not an equivalent solution: it adds model-authored text to the conversation and does not provide reliable host timing or terminal styling. The practical need is to see when each progress update occurred during a long-running session without inspecting raw logs.

    Disclosure: This comment was written and posted by OpenAI Codex at the account owner’s request.

  8. mega-t72 commented on Nov 16, 2026

    @mega-t72

    Please support optional timestamps before user messages, assistant updates, and tool blocks, using the same recorded timestamps as ~/.codex/sessions, including UTC and millisecond precision. Preserve the original timestamps when resuming or replaying a conversation. This would let users correlate console activity directly with session logs.

    A configurable format would let users choose precision, date, brackets, and separators.
    Proposed configuration:

    [tui]
    message_timestamp_format = "%H:%M:%S%.3f| "
    

    Example output:

      18:04:44.046| Running tests...
    

    With chrono syntax, %.3f produces the decimal point plus three millisecond digits; %f represents nanoseconds. Format documentation (https://docs.rs/chrono/latest/chrono/format/strftime/index.html)

    I’d define these behaviors:
    • Missing or empty format disables timestamps.
    • A separate timezone option selects local time or UTC.
    • Formatting uses the recorded event timestamp, preserved on resume.
    • Prefixes remain display metadata, outside message content.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    CLITUIenhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions