Skip to content

fix(server): apply limit and offset pagination in conversation service - #644

Open
pei711 wants to merge 1 commit into
ValueCell-ai:mainfrom
pei711:fix/conversation-pagination
Open

pei711 wants to merge 1 commit into
ValueCell-ai:mainfrom
pei711:fix/conversation-pagination

Conversation

@pei711

@pei711 pei711 commented Oct 27, 2026

Copy link
Copy Markdown

📝 Pull Request Template

1. Related Issue

Closes #642

2. Type of Change (select one)

Type of Change: Bug Fix

3. Description

In python/valuecell/server/services/conversation_service.py, get_conversation_list accepts limit and offset parameters forwarded from the GET /conversations endpoint. While total = len(conversations) was calculated, the conversation list was never sliced by [offset : offset + limit], causing the endpoint to return all conversations unconditionally regardless of requested pagination parameters.

This PR applies pagination slicing to conversations using [offset : offset + limit] (with non-negative guards) after strategy conversations are filtered, ensuring that:

  1. Only the requested window of conversations is transformed and returned.
  2. total still correctly reflects the total count of non-strategy conversations.
  3. Requests with offsets beyond the total count return an empty list without error.

4. Testing

  • I have tested this locally.
  • I have updated or added relevant tests.

Added unit tests in python/valuecell/server/services/tests/test_server_conversation_service.py:

  • test_get_conversation_list_applies_limit_and_offset: verifies correct window slicing and element order.
  • test_get_conversation_list_offset_beyond_total: verifies graceful handling of offsets exceeding total count.
  • test_get_conversation_list_excludes_strategy_agents_before_pagination: verifies filtering order relative to total count and pagination.

Ran full test suite (uv run pytest: 404 passed), code formatting (ruff format), and linting (ruff check: all checks passed).

5. Checklist

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.

ConversationService.get_conversation_list ignores limit and offset, returning all conversations unconditionally`

1 participant