feat(opencode): timestamp gutter mode for messages#29398
Open
guysoft wants to merge 2 commits into
Open
Conversation
The /timestamps slash command now cycles hide → footer → gutter → hide.
Gutter mode renders a fixed 5-char HH:MM column to the left of each user
message; clicking the gutter opens a popup with the full local datetime.
Adds a new tui.json key `timestamps_mode` ("hide" | "footer" | "gutter",
default "hide") that seeds the default mode for new users. The kv signal
that backs the toggle was previously "hide" | "show"; "show" is mapped
to "footer" at read time so existing toggles keep working.
1 task
…opup
The gutter mode now renders an HH:MM column on assistant messages too,
not just user messages — closes the original ask in opencode#8634
("Add timestamp next to messages in chat (both agent and user messages)").
Assistant message body is wrapped in flexDirection="row" only when gutter
mode is active; non-gutter modes keep the existing fragment layout
untouched. Assistant text lands at column 9 (gutter 6 + paddingLeft 3),
which is also where user text lands (gutter 6 + border 1 + paddingLeft 2),
so the two sides align visually.
The timestamp popup now shows HH:MM:SS instead of HH:MM, addressing
opencode#20406 ("Add seconds to message timestamp display"). 24-hour
formatting is used consistently for both gutter and popup to avoid
opencode#28804 (Bun ignores system locale → spurious AM/PM on Linux).
Three new unit tests for hourMinuteSecond bring the suite to 14/14.
Author
|
Pushed a follow-up commit (8e3981f) that broadens the scope to address more of the open user requests around message timestamps:
Visual alignment math: user text lands at col 9 (gutter 6 + border 1 + paddingLeft 2), assistant text also at col 9 (gutter 6 + paddingLeft 3). The two sides line up under a single virtual gutter, which is what makes it read as a "timeline column" rather than a per-message tag. Tests now 14/14 (added 3 for Out of scope and deliberately left for follow-up PRs: #22037 (desktop hover), #22144 (tool block timestamps), #16341 (session picker), #27962 (desktop sidebar) — different surfaces. |
This was referenced May 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Refs #29399. Addresses several open user requests:
Screenshot of feature showing the gutter timestamps:
popup window that was requested in #20406
toLocaleTimeStringOut of scope (different surfaces, separate PRs): #22037 desktop hover, #22144 tool block timestamps, #16341 session picker, #27962 desktop sidebar.
Type of change
What does this PR do?
Extends
/timestampsto cycle three modes instead of two:hide → footer → gutter → hide. The newguttermode renders a fixed 5-cellHH:MMcolumn to the left of every message — user and assistant. Clicking the gutter opens a small popup with the full local datetime (HH:MM:SS) and a relative time ("3m ago"). Adds an optionaltui.jsonkeytimestamps_mode(default"hide") that seeds the starting mode. Existing users with the legacy kv value"show"are mapped to"footer"at read time so their toggle keeps working.Why it works:
/timestampsstill toggles immediately without writing totui.json.showTimestamps()(the existing alias used to gate the footer render) now returns true only for"footer"mode — gutter mode draws the time elsewhere, so there's no duplicate render.flexDirection="row"wrapper, so itsonMouseUpdoesn't bubble into the row's existing click handler (which opensDialogMessage). The two interactions stay independent.flexDirection="row"with the gutter on the left only whentimestamps_mode === "gutter"; non-gutter modes keep the existing fragment layout untouched, avoiding regression risk.getHours()/getMinutes()/getSeconds()rather thantoLocaleTimeString— keeps the gutter at exactly 5 cells regardless of locale, and side-steps the AM/PM bug reported in Timestamps always show AM/PM on Linux (Bun ignores system locale) #28804 for the new code paths.Scope deliberately not in v1: mouse-only popup (keyboard support needs a
selectedMessageIDsignal — follow-up).How did you verify your code works?
bun turbo typecheck— clean across all 15 packages.bunx oxlinton the changed files — no new warnings.packages/opencode/test/cli/cmd/tui/timestamps.test.tscovergetTimestampsModeconfig resolution,nextTimestampsModecycle order,normalizeTimestampsModelegacy"show"mapping, and bothhourMinute/hourMinuteSecond24-hour formatters. 14/14 pass; full TUI test directory 64/64 pass.bun run script/build.ts --single --skip-embed-web-uiand ran it locally: cycled the three modes via/timestamps, confirmed gutter appears on both user and assistant messages, clicked both gutters to confirm the popup, restarted to confirm the kv signal persists and the config-seeded default applies on fresh state.Screenshots / recordings
Will attach when I get them off the test machine.
Checklist