Skip to content

feat(tui): show timestamps on assistant messages - #43246

Closed
AndyS77 wants to merge 4 commits into
anomalyco:devfrom
AndyS77:chat-timestamps
Closed

AndyS77 wants to merge 4 commits into
anomalyco:devfrom
AndyS77:chat-timestamps

Conversation

@AndyS77

@AndyS77 AndyS77 commented Aug 18, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #43243

Type of change

  • New feature

What does this PR do?

The TUI already has a /timestamps toggle that shows timestamps on user messages. This PR extends it to also show time.created in the assistant message footer, so both sides of the conversation get timestamps when the toggle is on.

The change is 3 lines in AssistantMessage — a <Show when={ctx.showTimestamps()}> block that renders Locale.todayTimeOrDateTime(props.message.time.created) alongside the existing model name and duration. No new mode, no config changes, no data model changes. The toggle still defaults to "hide" (backward compatible).

How did you verify your code works?

4 tests in packages/tui/test/util/timestamps.test.ts covering todayTimeOrDateTime, time, and datetime formatting with locale-agnostic assertions.

Screenshots / recordings

N/A

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

I found related PRs that may be worth reviewing:

Related PRs:

  1. feat(tui): show per-part timestamps for thinking and tool blocks #42499 - feat(tui): show per-part timestamps for thinking and tool blocks

  2. feat(tui): show assistant turn completion time #37929 - feat(tui): show assistant turn completion time

    • This PR shows assistant turn completion time, which is related to displaying time-based information on assistant messages in the TUI.

These PRs are working on similar timestamp/time-display features in the TUI and may have relevant code patterns or logic that could affect the current PR.

@AndyS77

AndyS77 commented Aug 19, 2026

Copy link
Copy Markdown
Author

Thanks for the pointers. I reviewed both PRs:

No duplication — all three cover different timestamp surfaces.

@Enough1122

Copy link
Copy Markdown

AI code review — automated review for reference; please use your judgment.

  • packages/tui/test/util/timestamps.test.ts:1 — the test imports todayTimeOrDateTime, time, and datetime from src/util/locale, but this diff never touches that file. If those exports don't already exist, both the tests and the new <Show> block will fail to compile — please confirm they're pre-existing (or add them here).
  • packages/tui/src/routes/session/index.tsx:1568 — same for ctx.showTimestamps(): no change here wires up that flag. If it's new, its definition/config plumbing seems missing from this PR.
  • packages/tui/test/util/timestamps.test.ts:15 — asserting toContain("·") couples the test to the exact separator glyph used by datetime; prefer asserting on digits/date pattern so formatting tweaks don't break tests.
  • packages/tui/test/util/timestamps.test.ts:8 — todayTimeOrDateTime(now) near midnight could race between "today" and "yesterday" in CI; consider injecting a fixed clock or tolerating both outputs.

- Replace toContain('·') with toMatch on digit patterns so formatting
  tweaks don't break tests
- Use fixed date with setHours instead of Date.now() to avoid
  midnight race in CI

Co-Authored-By: zai-glm-52 <[email protected]>
Agent: @test
Scope: anomalyco#43243
@AndyS77

AndyS77 commented Sep 14, 2026

Copy link
Copy Markdown
Author

Thanks for the review. All points addressed:

  1. todayTimeOrDateTime, time, datetime exports — these are pre-existing in packages/tui/src/util/locale.ts (lines 5, 10, 17). No changes needed.
  2. ctx.showTimestamps() wiring — pre-existing in packages/tui/src/routes/session/index.tsx:278 as createMemo(() => timestamps() === 'show'), exposed via context at line 163. No changes needed.
  3. Test asserting on separator glyph — replaced toContain('·') with toMatch on digit patterns so formatting tweaks don't break tests.
  4. Midnight race in CI — replaced Date.now() with a fixed date using setHours(14, 30, 0, 0) to avoid the today/yesterday boundary.

@ntcho

ntcho commented Oct 1, 2026

Copy link
Copy Markdown

Any updates on this? I need this info to see whether the session KV cache is still alive or not 😅

@thdxr

thdxr commented Oct 10, 2026

Copy link
Copy Markdown
Member

This branch has been upgraded to V2. We're no longer taking PRs for V1. If you think this is still relevant, please port it over and open it for V2.

— from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊

@thdxr thdxr closed this Oct 10, 2026
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.

[FEATURE]: Show timestamps on AI assistant messages in TUI

4 participants