Skip to content

feat(agents): Add session comments to agent timelines#4529

Open
samwillis wants to merge 3 commits into
mainfrom
codex/session-comments
Open

feat(agents): Add session comments to agent timelines#4529
samwillis wants to merge 3 commits into
mainfrom
codex/session-comments

Conversation

@samwillis

@samwillis samwillis commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

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:

  • stable key and timeline order
  • body, sender principal, and timestamp metadata
  • optional reply_to target metadata
  • optional target_snapshot preview data for rendering historic reply context
  • edit/delete metadata for future lifecycle support

reply_to can 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

useEntityTimeline now 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:

  • in the full timeline, clicking a preview scrolls to and briefly highlights the target row
  • in the comments-only view, clicking a preview switches the tile back to the full chat timeline and scrolls to the target

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=hidden view 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 typecheck
  • pnpm --filter @electric-ax/agents-server run typecheck
  • pnpm --filter @electric-ax/agents-server-ui run typecheck

Also added a patch changeset for all touched packages:

  • @electric-ax/agents-runtime
  • @electric-ax/agents-server
  • @electric-ax/agents-server-ui

@samwillis samwillis changed the title [codex] Add session comments to agent timelines feat(agents): Add session comments to agent timelines Jun 7, 2026
@github-actions

github-actions Bot commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

Electric Agents Desktop Builds

Build artifacts for commit 968f24c.

Platform Status Artifact
macOS Apple Silicon Passed DMG
macOS Intel Passed DMG
Windows x64 Passed Installer
Linux x64 Passed AppImage / deb

Workflow run

@codecov

codecov Bot commented Jun 7, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 39.34708% with 353 lines in your changes missing coverage. Please review.
✅ Project coverage is 55.34%. Comparing base (146f238) to head (968f24c).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...agents-server-ui/src/components/EntityTimeline.tsx 0.00% 140 Missing ⚠️
...s/agents-server-ui/src/components/MessageInput.tsx 0.00% 73 Missing ⚠️
.../agents-server-ui/src/components/CommentBubble.tsx 1.88% 52 Missing ⚠️
...agents-server-ui/src/components/views/ChatView.tsx 44.44% 50 Missing ⚠️
...s-server-ui/src/components/workspace/SplitMenu.tsx 0.00% 12 Missing ⚠️
packages/agents-server/src/entity-manager.ts 74.07% 7 Missing ⚠️
.../agents-server-ui/src/components/AgentResponse.tsx 0.00% 6 Missing ⚠️
...gents-server-ui/src/components/InlineEventCard.tsx 69.23% 3 Missing and 1 partial ⚠️
...s/agents-server-ui/src/components/ToolCallView.tsx 0.00% 3 Missing ⚠️
...es/agents-server-ui/src/components/UserMessage.tsx 0.00% 2 Missing ⚠️
... and 3 more
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     
Flag Coverage Δ
packages/agents 71.62% <ø> (?)
packages/agents-mobile 84.09% <ø> (ø)
packages/agents-runtime 82.42% <100.00%> (?)
packages/agents-server 73.00% <81.08%> (+0.04%) ⬆️
packages/agents-server-ui 7.91% <19.90%> (+1.82%) ⬆️
packages/electric-ax 46.42% <ø> (?)
typescript 55.34% <39.34%> (+23.57%) ⬆️
unit-tests 55.34% <39.34%> (+23.57%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@samwillis samwillis marked this pull request as ready for review June 7, 2026 17:25
@github-actions

github-actions Bot commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

Electric Agents Mobile Build

Local mobile checks ran for commit 968f24c.

The EAS Android preview build was skipped because the mobile-eas-build label is not present.
Add the mobile-eas-build label to this PR to produce an installable preview build.

Workflow run

Base automatically changed from samwillis/agents-ui-improvments to main June 7, 2026 17:55
@samwillis samwillis force-pushed the codex/session-comments branch from 9d4087d to c128a61 Compare June 7, 2026 17:57
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