feat(tui): show assistant turn completion time#37929
Conversation
Appends the wall-clock completion time after the duration in the TUI turn-summary line, the scrollback turn-summary commit, and session replay. Uses the existing Locale.time() helper which respects the user's locale settings. Closes anomalyco#35348 Revives anomalyco#32771 (auto-closed by the needs:compliance bot, not rejected on merits — original implementation and tests are preserved here). Co-authored-by: joeyparis <joeyparis@users.noreply.github.com> Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
|
Heads up for reviewers — this is complementary to `/timestamps`, not a duplicate. OpenCode v1.17.13+ shipped the `session.toggle.timestamps` keybind (packages/tui/src/config/keybind.ts:100) which toggles per-message timestamps next to each individual message in the scrollback (packages/tui/src/routes/session/index.tsx:1426). This PR adds the timestamp to a different surface: the turn-summary line itself ( If maintainers prefer, this could alternatively be gated behind the same `timestamps` kv signal so the two surfaces stay consistent — happy to revise in that direction. |
Issue for this PR
Closes #35348
Type of change
What does this PR do?
Appends the wall-clock completion time after the duration in the TUI turn-summary line. The format follows the user's locale settings via the existing
Locale.time()helper.Before:
▣ Build · gpt-5 · 2.8sAfter:
▣ Build · gpt-5 · 2.8s · 3:41 PMThreads an optional
time: stringthrough the turn-summary pipeline:runtime.queue.tscomputestime: Locale.time(end)at the sameDate.now()capture used for duration, and emits it on theturn.durationFooterEvent.types.tsaddstime?: stringtoTurnSummaryandtime: stringto theturn.durationevent variant.footer.tsforwardsnext.timeintowriteTurnSummary.scrollback.surface.tsandturn-summary.tsaccept and append· \${time}to the summary text when present.scrollback.writer.tsxrenders the optional suffix via the same ternary.messageTurnSummaryCommitinturn-summary.tspassestime: Locale.time(completed)so session-replayed history also shows the timestamp.packages/tui/src/routes/session/index.tsxAssistantMessageadds acompletedTimememo and renders it inside the existing<Show when={duration()}>block — this is the path users see for completed turns.This is a faithful revival of #32771, which was auto-closed by the needs:compliance bot within 2 hours of being opened for not matching the template. The original implementation and tests are preserved; attribution retained.
How did you verify your code works?
test/cli/run/turn-summary.test.ts— unit test onturnSummaryCommitwith and withouttime.scrollback.surface.test.ts— exerciseswriteTurnSummarywithtimeand asserts the rendered row.session-replay.test.tsto expect· \${Locale.time(3000)}suffix.inline-tool-wrap-snapshot.test.tsxfixture + snapshot to include the time suffix.33 opencode package tests pass; 17 TUI snapshot tests pass.
Screenshots / recordings
Text-only TUI change. Before/after captured above in What does this PR do?
Checklist
Co-authored-by: joeyparis joeyparis@users.noreply.github.com
Co-authored-by: Sisyphus clio-agent@sisyphuslabs.ai