Skip to content

Add timestamps and back-to-top pill to message stream#71

Merged
olsonjeffery merged 10 commits into
mainfrom
task/13-back-to-top---timeline-stamps-
Jul 24, 2026
Merged

Add timestamps and back-to-top pill to message stream#71
olsonjeffery merged 10 commits into
mainfrom
task/13-back-to-top---timeline-stamps-

Conversation

@olsonjeffery

Copy link
Copy Markdown
Owner

Summary

Adds three categories of timestamp pills and a back-to-top navigation pill to the conversation message stream.

Changes

  • Data model: Added timestamp: chrono::NaiveDateTime to every ProviderEvent variant with #[serde(default)] for backward compatibility. Added timestamp column migration to messages table (default Unix epoch). All event creation sites populate Utc::now().naive_utc().
  • Timestamp pills (SSR): Start-of-conversation pill (atop first message), user-message timestamps (prepended before every user message), and newest-message timestamp pill (bottom of stream). Smart formatting — time-only for today, date+time for older entries. All styled as Bulma is-light and occupy ≤10% of stream width.
  • Back-to-top pill: Fixed-position navigation pill with MDI arrow-up icon, appears when scrolling down >200px, scrolls to top on click. Blue bg/white text matching existing jump-to-newest pill.
  • Live updates: JS handler updates newest-message timestamp pill on WS events; user-message timestamps are prepended on arrival.
  • Edge cases: Empty conversations render no timestamps. Old pre-timestamp events deserialize safely via #[serde(default)]. Loading transcript skips malformed events per-event with warning instead of failing entirely.

Commits

9 implementation commits + 1 migration count fix, building incrementally from data model through SSR rendering to JS live updates.

- Add timestamp field to ProviderEvent variants (Text, UserText, ToolUse,
  ToolResult, Thinking, Error, Done, QuestionAsked)
- Add messages_add_timestamp DB migration column
- Update persist_event() to save timestamp to DB
- Backfill missing timestamps on transcript load
- Add format_timestamp_pill() utility with smart date/time formatting
- Render timestamp pills for start-of-conversation, user messages, and newest message
- Add conversation_created_at prop to MessageStream component
- Add back-to-top navigation pill with scroll-to-top JS
- Add live newest-timestamp update on WS events
- Add timestamp-pill CSS classes (left-side, max 10% width)
- Handle edge case: skip newest-pill for single-event conversations
- Update all event construction sites to include timestamps
- Remove backfill_timestamp() function and call site from src/webapp/mod.rs
- Change messages.timestamp column default from '' to '1970-01-01 00:00:00'
- Remove now-unused ProviderEvent import from src/webapp/mod.rs
…p fields

Old events stored before the timestamp field was added to ProviderEvent
would fail to deserialize because the field was required (no serde(default)).
This caused load_transcript() to return Err, and unwrap_or_default() in
chat_handler_with_conv() would produce an empty Vec, showing 'No messages yet'.

Add #[serde(default)] to every timestamp field so missing timestamps
deserialize to NaiveDateTime::default() (year 0001) instead of erroring.
- Back-to-top pill: blue bg/white text matching jump-to-newest,
  positioned at top:1rem instead of near bottom, text wrapped in <span>
- Jump-to-newest pill: text now wrapped in <span> to fix icon overlap
- load_transcript: skip bad events with warning instead of failing all
- chat_handler_with_conv: log error when loading transcript fails
- Add tests verifying old (pre-timestamp) ProviderEvent deserialization
  and serde(default) handling for NaiveDateTime
- Back-to-top pill: moved from chat-input-wrapper (footer) to
  message-stream-container (absolute, top:1rem) so it appears near
  the top of the stream, not overlapping input
- Newest-timestamp pill now includes <hr> separator above it,
  consistent with start/user timestamp layout
- WS live handler: removes old newest-timestamp pill before
  appending new event, adds user-timestamp pill for user_text
  events, appends new newest-timestamp pill below the new event
- Removed unused updateNewestTimestamp JS function
- conversations.rs and agent_runs.rs now include formatted
  timestamp in the WS payload for user_text broadcasts
- JS handler can now create user-timestamp pill immediately
  when user sends a message (no page reload needed)
@olsonjeffery
olsonjeffery merged commit 161b8d5 into main Jul 24, 2026
3 checks passed
@olsonjeffery
olsonjeffery deleted the task/13-back-to-top---timeline-stamps- branch July 24, 2026 19:19
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.

1 participant