Skip to content

Studio: fix prompt timestamp layout, accessibility, and imported times - #12173

Merged
mahiatlinux merged 3 commits into
mainfrom
fix/user-message-time-accessibility
Sep 28, 2026
Merged

mahiatlinux merged 3 commits into
mainfrom
fix/user-message-time-accessibility

Conversation

@shimmyshimmer

Copy link
Copy Markdown
Member

Prompt timestamps could be clipped outside narrow chats when the branch picker was visible, and the hover-only footer could not be reached by keyboard or touch. The footer now uses the message's full width, truncates the date while preserving action target sizes, and exposes the full date through the shared accessible tooltip. User messages reuse the existing focus-reveal behavior and can reveal their actions with a touch tap.

Imports that lack a per-message send time now mark their synthetic ordering timestamp as estimated. That marker survives restoration, and both timestamp displays omit estimated values. Existing imported records without provenance cannot be distinguished retroactively.

The timestamp remains unmounted when its actions are hidden, selects only a stable timestamp value, and adds no polling or recurring clock work. Follow-up to #12170.

Validation

  • Frontend suite: 9,207/9,207 passed (node --experimental-strip-types --test --test-concurrency=4 'tests/**/*.test.ts').
  • npm run typecheck passed, including the browser fixture.
  • New tests/studio/playwright_user_message_time.py passed in Chromium with real assistant-ui runtime primitives and application styles: 500 messages, 120 streaming updates with zero additional date-formatting calls; keyboard focus and pointer exit; touch reveal and full-date disclosure; 320/375 px panes, larger text, English/Russian/Arabic; invalid and estimated dates.
  • Import tests cover OpenAI JSONL, ShareGPT, CSV, Open WebUI, and backup provenance.
  • Python Ruff checks and the repository's pinned formatting script passed.

The browser regression is self-contained and starts its own Vite fixture; it needs frontend npm dependencies and Python Playwright/Chromium, with no model or backend required.

@shimmyshimmer

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-28T06:46:56.694411Z 73c180f Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 73c180f41e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@mahiatlinux

Copy link
Copy Markdown
Contributor

Review and verification

Tested source head: e04a8dd4daf785f50e6453e4cbfc8c8644799bfb

I confirmed and repaired three correctness/accessibility defects:

  • Reverse Shift+Tab skipped the autohidden Copy/Edit/Fork/Delete controls. A trailing reveal stop now mounts the controls before reverse traversal enters them.
  • Open WebUI branch reordering could alter a real timestamp but still present it as exact. Any timestamp changed during import is now marked estimated.
  • The reverse-traversal stop initially had no visible focus indicator. It now shares the existing zero-size sentinel focus ring, and the browser test asserts its computed dimensions and 1 px solid outline.

Verification:

  • Full frontend suite: 9,337 passed, 0 failed.
  • Focused timestamp/import tests: 70 passed, 0 failed.
  • Typecheck and production build: passed, including after the focus-ring repair.
  • Browser scenario: passed 500 messages, 120 updates, 375/320 px layouts in English, Russian and Arabic, plus keyboard, visible reverse-focus ring, touch, invalid and estimated timestamps.
  • Independent runtime probe: original head reproduced After chat -> message root -> Before chat; repaired head produced After chat -> reveal stop -> Delete.
  • git diff --check and focused Python lint: passed.

Review convergence completed on mirror head f6cdb846f; its two repair commits have the same stable patch IDs as source commits edb97d122 and e04a8dd4d. The original source review finding was fixed, acknowledged and resolved. Source CI restarted on the repaired head.

UI evidence used isolated Studio installs in Playwright Chromium 151 on Linux at 760 x 720. The pair compares merge base 869af7c62 with equivalent repaired source tree 52a7f5da6. The final focus-ring repair is separately covered by the computed-style browser assertion. Facts changed as expected: message-root tabindex null -> 0, timestamp button false -> true, full-width footer false -> true, reverse reveal stop false -> true, wrapper width 560 -> 700 px, timestamp width 58 -> 552 px.

Before and after user-message timestamp layout

@mahiatlinux mahiatlinux left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Ready to merge, all manually checked.

@mahiatlinux
mahiatlinux merged commit 501b15f into main Sep 28, 2026
42 of 44 checks passed
@mahiatlinux
mahiatlinux deleted the fix/user-message-time-accessibility branch September 28, 2026 21:54
shaojun pushed a commit to shaojun/unsloth that referenced this pull request Sep 29, 2026
unslothai#12173)

* Fix chat timestamp layout, accessibility, and imported-time accuracy

* Fix reverse message actions and imported timestamps

* Show focus on user action sentinel

---------

Co-authored-by: Unsloth <[email protected]>
Co-authored-by: mahiatlinux <[email protected]>
danielhanchen added a commit that referenced this pull request Oct 6, 2026
…x slot (#12781)

* Branch picker chevrons: give back the 24px hit target in the same 20px slot

#12735 shrank .aui-branch-chevron-btn from 24x32 to 20x20 to make the chevrons read
as part of the count. That dropped them under the 24px every footer control keeps
since #12173, which playwright_user_message_time.py checks, so 'Frontend build +
bundle sanity' fails on main once its earlier steps pass (#12770, #12772).

Size the button 24px and take the extra 4px back with a -2px margin. Every footer
element stays where it was and the glyph centres do not move; only the clickable
area grows, and with no hover fill it is not visible.

* Branch picker chevrons: make 24px a floor, not a multiple of the space scale

24px * --ui-space-scale fell to 19.2px at the 12px UI font size (scale 0.8). Size
the target as max(24px, the scaled 20px slot) and hand the difference back with the
margin, so the slot and the glyph centre still follow the scale while the hit area
never drops under 24px. Add the 12px layout to playwright_user_message_time.py,
which only covered 15px and 20px and so could not see it.

* Branch picker chevrons: grow the hit area toward the count, and scale its floor with Interface Scale

The symmetric -extra/2 margin pushed Previous over the Delete/More button beside it:
at the 12px UI font the gap is 1.6px and the extra 8px, and at the browser's 50%
Interface Scale a fixed 24px reached 7px past the slot. In an overlap the later
element wins the click.

Put the extra on the inner side only (toward the count, which is not a control),
with padding keeping the glyph where it was, and make the floor 24px times the
browser Interface Scale, as browser zoom would. The browser check now asserts no
two footer controls overlap and adds the 50% Interface Scale layout; the previous
commit fails the overlap check at 12px.

* Branch picker chevrons: extend the hit area with a ::before so the button and focus ring stay as drawn

Growing the button itself moved its focus ring: a 24px circle off the glyph's
centre and over the count. The button is back to the 20px slot, scaled; an
invisible positioned ::before carries the extra toward the count, and, being
positioned, paints over the count so presses there reach the chevron (the
previous padding never did: the count, painted later, took them).

The layout check now measures each control's real target by hit testing the
middle of every edge, and requires the chevron's own box to stay square and
unpadded so the ring stays centred on the glyph.

* Branch picker: keep the count at least as wide as both chevron extensions

In a narrow custom chat font a short count such as 1/2 can be narrower than
the two ::before extensions together, and Next would then win presses on the
inner edge of Previous. The count now has a minimum width of both extensions
plus 1px, centred; any count wider than that, the usual case, is untouched.
The layout check gains a narrow-count layout at the smallest UI font.

* Branch picker: reserve room above and below for the chevron targets

At 200% Interface Scale and the 12px UI font the target reaches 8px past the
box on each side, more than the footer's 6.4px row gap, so once the picker
wrapped onto its own row it took the lower edge of the action buttons above.
The chevrons now carry block margins of half the extra: inside one row with
the actions they fit in the row's height and nothing moves; a wrapped picker
row grows to hold its targets. The layout check gains 200% layouts at 375 and
320px; the previous head fails them.
danielhanchen added a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 22, 2026
Fixes unslothai#13673

## Summary

Adds an opt-in **Reply times** switch to Settings > Chat > Display. When
it is on, every reply shows when it finished, at the start of the row
under it, so you can tell at a glance whether a long agent or tool run
ended an hour ago or eight hours ago.

- Off by default. With it off, nothing renders and the thread looks
exactly as it does today.
- The time is absolute, e.g. `Oct 13, 11:55 PM`, with the year only when
it is not the current one, in the UI language's format. It is
deliberately not "Today" / "Yesterday": nothing re-renders an old reply,
so a thread left open past midnight would keep calling yesterday's
replies today.
- Hovering the time shows the full date with seconds, e.g. `Monday,
October 13, 2026 at 11:55:01 PM`.
- The time is the reply's recorded finish time
(`responseDetails.finishedAt`). A reply that was stopped or failed
records no `responseDetails`, so its finish is its persisted stream
start plus stream duration, i.e. when it stopped. A Deep Research reply
uses its run's `completedAt`, and shows nothing while the run has not
finished. Replies with none of these fall back to their creation time.
Imported messages whose time is only an ordering estimate still show
nothing, as in unslothai#12173.
- Nothing shows while a reply is still generating, so the row does not
change under a streaming reply.

## Layout and performance

- With the switch off, each reply mounts only a component that reads the
preference from the chat preferences store and returns nothing. No
assistant-ui selector is added, so composer keystrokes cost exactly what
they do today (see `composer-keystroke-subscription-budget.test.ts`).
- The time sits before the branch picker and action bar, outside the bar
that mounts on hover, so hovering an older reply never moves it.
- The footer row already reserves its height, so turning the switch on
adds no vertical space.
- It is a plain `<time>` with a native `title`, not a Tooltip. One
Tooltip per reply would subscribe to the modal layer store on every
message of a long thread, which is the cost the action bar's `autohide`
comment describes.
- No timer, interval or effect; the clock is only read once, for the
current year.

## Changes

- `chat-preferences-store.ts`: `showReplyTimes` (default `false`; a
saved payload without the key rehydrates as off).
- `assistant-message-time.tsx`: the new component;
`message-timestamp.ts`: `replyFinishedTimestamp`.
- `thread.tsx`: renders it first in the reply footer.
- `chat-tab.tsx`, `settings-search.ts`: the switch, searchable by
"timestamp", "time", "clock" and so on.
- Strings for all 14 locales.
- `check-bundle-budget.ts`: the startup budget raised for this PR, about
+1.5 KB raw / +0.4 KB transfer; merged with main at c2f75c4 the build
measures 6,892,776 B raw / 2,076,549 B transfer (Node 24, 98 chunks),
and the limits are that plus about 200 B, as main does.

## Validation

- `npm test` in `studio/frontend`: 13,234 passed, 0 failed, 1 skipped.
- `npm run typecheck`: clean. `eslint` on the new and changed files:
clean except two errors in `chat-tab.tsx` on import lines this PR does
not touch, which also fail on `main`.
- `tests/studio/test_chat_response_details_ui_contract.py`,
`tests/studio/test_en_catalog.py`: 51 passed.
- New `tests/reply-times-preference.test.ts` covers the off default
(fresh and older saved preferences), the Settings wiring, the footer
position outside the autohiding bar, no assistant-ui selector while off,
and the finish time, stopped reply, fallback, running and estimated
cases.

## Screenshots

Two Studios built from main at 6bbe268 (BEFORE) and this branch at
980e663 (AFTER), with the same seeded thread and Reply times turned on.
The reply finished at 23:55:01 UTC; the browser shows it in its own time
zone (US Pacific here). With the switch off, both builds render the
thread identically.

Reply footer: AFTER shows when the reply finished, before the existing
actions.

![Reply footer, before and
after](https://raw.githubusercontent.com/danielhanchen/unsloth-staging-2/pr-media/pr/14500/pr14500_final_pair_00-e88f8a9c6068.png)

Settings > Chat > Display: AFTER adds the Reply times switch below
Response model.

![Settings > Chat > Display, before and
after](https://raw.githubusercontent.com/danielhanchen/unsloth-staging-2/pr-media/pr/14500/pr14500_final_pair_01-28a929c8d917.png)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants