fix(tasks): paginate Studio task queries - #4104
Open
axiomoth wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
Adds offset-based pagination support to the Tasks API and updates Studio’s task center to fetch tasks in API-sized pages so large task views (300 / 10,000) no longer fail when the API enforces limit <= 200.
Changes:
- Add
offsetsupport toGET /api/v1/tasksand apply it after newest-first sorting (and after ROOT merges/dedupes scopes). - Update Studio task fetching to page through the API in chunks (<= 200), dedupe by
task_id, and stop safely on short/non-advancing pages. - Extend Python and Studio tests plus the API test client / generated types to cover the new query parameter.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| web-studio/src/routes/tasks/route.tsx | Implements paged task fetching from the API and preserves existing task caps. |
| web-studio/src/routes/tasks/route.test.ts | Adds Studio-side tests validating multi-page fetching behavior. |
| web-studio/src/gen/ov-client/types.gen.ts | Updates generated request typings to include optional offset. |
| openviking/service/task_tracker.py | Adds offset parameter support to task listing after sorting. |
| openviking/server/routers/tasks.py | Exposes offset on GET /api/v1/tasks, including ROOT merge+slice behavior. |
| tests/test_task_tracker.py | Adds unit test ensuring offset is applied after sorting in the tracker. |
| tests/server/test_auth.py | Adds HTTP-level tests for offset behavior for ROOT and USER roles. |
| tests/api_test/api/client.py | Updates API test client helper to send the offset query parameter. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
Description
The Studio task center requested 300 tasks for the 24-hour view and 10,000 tasks for the all-time view, while
GET /api/v1/tasksrejects limits above 200. The rejected request was caught by the UI and presented as an empty task center.This change adds offset pagination to the task API and makes Studio load task data in API-sized pages. It preserves the existing 300/10,000 view caps instead of silently reducing them, and stops safely if cached Studio assets are temporarily paired with an older API that repeats the first page.
Human Involvement
Related Issue
No linked issue.
Type of Change
Changes Made
offsetquery parameter toGET /api/v1/tasksand apply it after filtering and newest-first sorting.Testing
Completed locally:
pytest tests/test_task_tracker.py tests/server/test_auth.py::test_root_task_list_applies_offset_after_merging_task_scopes tests/server/test_auth.py::test_user_task_list_applies_offset_after_sorting -q --no-cov(47 passed)npm test -- src/routes/tasks/route.test.ts(4 passed)npm run buildThe full Python suite was not marked complete because this Windows checkout's installed native vector engine package reports that it has no compatible x86 backend. The pagination-specific lightweight tests do not require that native component.
Checklist
Screenshots (if applicable)
Not applicable; the visible result is that the existing task center renders its task data instead of falling back to an empty state.
Additional Notes
The existing public response shape remains unchanged;
offsetis optional and defaults to zero.