feat(agents): Add session comments to agent timelines#4529
Open
samwillis wants to merge 3 commits into
Open
Conversation
Contributor
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #4529 +/- ##
===========================================
+ Coverage 31.76% 55.34% +23.57%
===========================================
Files 213 313 +100
Lines 18202 36489 +18287
Branches 6418 10535 +4117
===========================================
+ Hits 5782 20195 +14413
- Misses 12402 16273 +3871
- Partials 18 21 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Contributor
Electric Agents Mobile BuildLocal mobile checks ran for commit The EAS Android preview build was skipped because the |
9d4087d to
c128a61
Compare
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.
Summary
Adds session comments as first-class timeline events for Electric Agents sessions. Comments sync in the same entity stream as the rest of the timeline, can reply to comments or existing timeline items, and can be displayed either inline with the full session or in a comments-only view.
This PR is stacked on #4527 (
samwillis/agents-ui-improvments).Screen.Recording.2026-06-07.at.18.20.51.mov
Design
Stream and schema
Comments are modeled as a timeline collection on the entity stream rather than a separate Postgres shape. That keeps comment sync coupled to the session timeline and avoids a second client subscription path for the same session.
The runtime schema adds comment rows with:
keyand timelineorderbody, sender principal, and timestamp metadatareply_totarget metadatatarget_snapshotpreview data for rendering historic reply contextreply_tocan point either to another comment or to a timeline item such as an inbox message, run, tool call, wake, signal, or manifest entry.Server write path
The server exposes a session comments endpoint that writes comment events into the entity stream and preserves the same ordering/sync model used by the rest of the timeline. The UI sends comments through an optimistic TanStack DB action, then relies on the synced stream row to reconcile the local optimistic insert.
Client timeline model
useEntityTimelinenow projects comment rows into the same timeline row list as messages, assistant runs, tool calls, wakes, signals, and manifests. This keeps rendering order derived from the stream order rather than computing a separate grouped comments model on every render.Rows receive their previous and next render neighbors so comment grouping can be decided locally while rendering. Consecutive plain comments from the same principal collapse metadata until the final comment in the run, while reply comments break the grouping because their preview belongs to that specific message.
Reply UX
The full timeline adds reply affordances to user messages, assistant responses, tool calls, and inline timeline events. When replying, the composer switches to comment mode and shows a reply banner above the input.
Reply previews render above the comment bubble, iMessage-style. They are clickable:
Tool-call replies resolve to their parent run row when needed so virtualized rows can still be revealed efficiently.
Display controls
Tile display options now live under the top-right tile menu. The chat view can show or hide comments per tile via a
comments=hiddenview param. Comments-only view renders only comment rows, while preserving original timeline adjacency for grouping decisions.Visual behavior
Comment bubbles are right aligned for the current principal and left aligned for other users. All comment bubbles use the inverted treatment requested for comments: black bubbles in light mode and white bubbles in dark mode. Bubble edges align with the prompt/input message column, while sender/time/reply metadata remains inset and aligns to the comment bubble rather than to wider reply previews.
Validation
Ran after the final rebase:
pnpm --filter @electric-ax/agents-runtime run typecheckpnpm --filter @electric-ax/agents-server run typecheckpnpm --filter @electric-ax/agents-server-ui run typecheckAlso added a patch changeset for all touched packages:
@electric-ax/agents-runtime@electric-ax/agents-server@electric-ax/agents-server-ui