Skip to content

Refactor v2 session events as schemas#24512

Open
thdxr wants to merge 9 commits intodevfrom
refactor/session-event-schema-definitions
Open

Refactor v2 session events as schemas#24512
thdxr wants to merge 9 commits intodevfrom
refactor/session-event-schema-definitions

Conversation

@thdxr
Copy link
Copy Markdown
Member

@thdxr thdxr commented Apr 26, 2026

Summary

  • Rework v2 session events from schema classes into const schema definitions with session.* event types and sync metadata.
  • Add shared prompt attachment schemas and update session entry projection/stepper matching for the new prompted event shape.
  • Simplify session-entry-stepper tests by removing FastCheck and custom adapter coverage in favor of deterministic memory reducer cases.

Tests

  • bun typecheck from packages/opencode
  • bun test test/session/session-entry-stepper.test.ts from packages/opencode
  • push hook: bun turbo typecheck

Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

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

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@thdxr thdxr force-pushed the refactor/session-event-schema-definitions branch 2 times, most recently from d723f1e to 8bf098c Compare April 27, 2026 20:02
@thdxr thdxr added the beta label Apr 27, 2026
@thdxr thdxr force-pushed the refactor/session-event-schema-definitions branch from a1118de to c11cb8f Compare April 28, 2026 22:36
@thdxr thdxr force-pushed the refactor/session-event-schema-definitions branch from f444aff to b4dc1a8 Compare April 30, 2026 21:45
@thdxr thdxr force-pushed the refactor/session-event-schema-definitions branch from adcadf0 to 41bf671 Compare May 1, 2026 03:31
@thdxr thdxr force-pushed the refactor/session-event-schema-definitions branch from 41bf671 to 0983235 Compare May 1, 2026 04:03
thdxr added 9 commits May 1, 2026 18:47
Replace separate before/after query parameters with a single cursor that
carries direction info. Chat clients can now use 'start' or 'end' keywords
to jump to the beginning or newest messages, and navigate history with a
single cursor parameter instead of managing multiple pagination states.
…avigation

Enables loading messages in chunks for better performance with long conversations.
Users can now navigate through large session histories without loading all messages at once.
Includes before/after cursors for bi-directional pagination.
Users can now browse sessions through the new /api/session endpoint with filters for directory, workspace, date range, and title search. Pagination cursors are now labeled 'previous' and 'next' instead of 'before' and 'after' to make navigation direction clearer. Both session lists and message history now support explicit 'asc' or 'desc' ordering so users can choose between newest-first or oldest-first views. The TUI session view now displays messages with the newest at the bottom, matching standard chat interfaces.
… handling

This change removes the predefined fields from Session.Info to allow more
dynamic event-driven session data. Instead of fixed schema fields, session
information will be populated through the event system, enabling better
support for evolving session states without schema migrations.

The empty struct serves as a base that can be extended through the event
model, making it easier to add new session attributes without modifying
core schema definitions.
Store the active agent and model in the session table so users can see which configuration was used when browsing session history. This helps identify sessions that used specific agents or models for easier filtering and organization.
Events now include unique identifiers at the payload level, making it easier to trace event flow through the system and debug issues. Session events have been restructured so IDs are consistent across the event bus, database projections, and API responses.

Sessions now persist which agent and model were used, preserving this context in session history. Agent and model switches are now tracked as dedicated message types in sessions, providing a clearer timeline of how the conversation evolved.
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.

1 participant