Skip to content

Studio: optional reply times in Settings > Chat - #14500

Merged
danielhanchen merged 16 commits into
mainfrom
studio-reply-times
Oct 22, 2026
Merged

danielhanchen merged 16 commits into
mainfrom
studio-reply-times

Conversation

@danielhanchen

@danielhanchen danielhanchen commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

Fixes #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 Studio: fix prompt timestamp layout, accessibility, and imported times #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

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

Settings > Chat > Display, before and after

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 21, 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-10-22T12:22:43.426922Z 2d876d4 Manual request
🔒 Security Review ⚠️ Failed 2026-10-21T11:56:41.170540Z
We couldn’t complete this review. Comment @codex security review to try again.
47af19d PR opened
ℹ️ 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.

@danielhanchen danielhanchen self-assigned this Oct 21, 2026
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@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: 47af19d0e8

ℹ️ 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".

const date = new Date(finishedAt);
return (
<time
dateTime={date.toISOString()}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Reject timestamps outside the valid Date range

When a restored Studio backup contains a finite but out-of-range responseDetails.finishedAt value such as 1e20, replyFinishedTimestamp accepts it because Number.isFinite succeeds, but new Date(finishedAt) is invalid and this toISOString() call throws a RangeError. Backup import preserves arbitrary message metadata, so enabling Reply times can make the affected thread fail to render; validate that the resulting Date has a finite getTime() before returning or rendering the timestamp.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Studio never writes a finishedAt outside the Date range; this needs a hand-edited or corrupted backup, so leaving it.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@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: 3f4f8d2ab4

ℹ️ 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".

const end = timing.streamStartTime + timing.totalStreamTime;
if (Number.isFinite(end)) return end;
}
return messageTimestamp(message);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Persist timing for tab-close interruptions

Fresh evidence beyond the earlier Stop/failure case is the legacy tab-close path: for browser-tool, attachment, and other nondurable runs, chat-adapter.ts deliberately retains the last streamed yield and skips the terminal yield when the tab closes. That streamed yield puts timing in top-level metadata.timing, while the history adapter persists only metadata.custom, so after reopening there is no responseDetails or custom timing and this fallback stamps a long partial reply with its creation time rather than when it was interrupted. Persist the live timing in custom metadata or otherwise record the interruption time before relying on this fallback.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Out of scope here: this is the legacy non-durable tab-close path, and fixing it means changing what the history adapter persists. The time falls back to creation for those few replies.

const end = timing.streamStartTime + timing.totalStreamTime;
if (Number.isFinite(end)) return end;
}
return messageTimestamp(message);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Record completion metadata for audio replies

For output-only audio models, the special branch in chat-adapter.ts yields a “Generating audio...” placeholder, awaits generateAudio, then yields the final audio player and returns without adding either responseDetails or timing metadata. Once that message becomes complete, this fallback therefore displays the assistant message's creation time—the start of audio generation—as its finish time, which can be minutes early. Attach a finish timestamp or stream timing to the final audio yield rather than falling back to creation.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Output-only audio replies are a small set and the difference is the audio generation time; not worth new adapter metadata for this opt-in display.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@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: 72ad368a33

ℹ️ 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".

const locale = useLocale();
const showReplyTimes = useChatPreferencesStore((state) => state.showReplyTimes);
const finishedAt = useAuiState(({ message }) => replyFinishedTimestamp(message));
const [currentYear] = useState(() => new Date().getFullYear());

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P3 Badge Refresh the year used to shorten timestamps

When a thread remains mounted across New Year's Day, this state retains the previous year indefinitely, so existing replies from that year continue to render without a year even after they are no longer from the current year (for example, Dec 31, 11:55 PM after January 1). Because ordinary rerenders reuse the captured value, either include the year unconditionally or update the comparison year at the calendar boundary.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Only a thread left open across New Year is affected, and the hover title still carries the full date with the year; leaving it.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@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: 72ad368a33

ℹ️ 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".

export const AssistantMessageTime: FC = () => {
const locale = useLocale();
const showReplyTimes = useChatPreferencesStore((state) => state.showReplyTimes);
const finishedAt = useAuiState(({ message }) => replyFinishedTimestamp(message));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Track live research runs when showing reply times

When a failed or cancelled Deep Research run is retried, ResearchActions writes the retried snapshot only to useResearchRunStore and follows it there, while the assistant message metadata still holds the terminal snapshot from the preceding attempt. This selector reads only that stale message metadata, so the old completedAt remains visible throughout the retry and never advances when the new attempt finishes, even though ResearchMessage renders the store's live run. Subscribe the timestamp to the live run by researchRunId, hiding it for nonterminal statuses.

Useful? React with 👍 / 👎.

@danielhanchen danielhanchen Oct 21, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Only a retried failed or cancelled research run is affected, which is rare; leaving it for this opt-in display.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

Reviewed commit: 8c3918df71

ℹ️ 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".

@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 21, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 21, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 21, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 21, 2026
danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 21, 2026
danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 21, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

Reviewed commit: 5a9ccca5b6

ℹ️ 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".

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: e4b771364b

ℹ️ 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".

danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 22, 2026
danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 22, 2026
# Conflicts:
#	studio/frontend/scripts/check-bundle-budget.ts
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: b79ec87257

ℹ️ 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".

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

Reviewed commit: dabba05fa3

ℹ️ 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".

# Conflicts:
#	studio/frontend/scripts/check-bundle-budget.ts
chatgpt-codex-connector[bot]

This comment was marked as resolved.

@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 22, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 22, 2026
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

Reviewed commit: 2d876d4938

ℹ️ 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".

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.

[Feature] give option to add timestamp on prompt responses

1 participant