Skip to content

Conversation

@rumpl
Copy link
Member

@rumpl rumpl commented Feb 9, 2026

Remove too-specific methods from the session store

  • BranchSession
  • GetSessionByOffset

These are not really needed in the store interface

rumpl added 2 commits February 9, 2026 23:14
ResolveSessionID now uses the existing GetSessionSummaries method,
which already returns root sessions sorted by created_at DESC.

Also fixes InMemorySessionStore.GetSessionSummaries to filter out
sub-sessions and sort by CreatedAt descending, matching the SQLite
implementation.

Assisted-By: cagent
Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
Export buildBranchedSession as session.BranchSession so callers
compose it with GetSession and AddSession directly, rather than
having the store own branching logic.

Also removes the now-unused collectSessionIDs helper.

Assisted-By: cagent
Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
@rumpl rumpl requested a review from a team as a code owner February 9, 2026 22:20
Copy link

@docker-agent docker-agent bot left a comment

Choose a reason for hiding this comment

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

Review Summary

I've completed a thorough review of this PR. The refactoring successfully removes the BranchSession and GetSessionByOffset methods from the Store interface and moves them to more appropriate locations:

  • BranchSession is now an exported function in the session package
  • GetSessionByOffset logic is inlined into ResolveSessionID

No bugs found in the changed code. All call sites have been correctly updated:

  • Tests now call BranchSession directly and manually save via AddSession
  • TUI handler follows the same pattern: load parent → branch → save
  • ResolveSessionID correctly inlines the offset logic with proper bounds checking
  • GetSessionSummaries now filters out subsessions and sorts by creation time

The refactoring improves the architecture by:

  1. Making the Store interface simpler and more focused
  2. Moving branching logic to the domain layer where it belongs
  3. Reducing unnecessary coupling between the store and session branching

Looks good! ✅

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.

2 participants