Skip to content

fix(tasks): paginate Studio task queries - #4104

Open
axiomoth wants to merge 1 commit into
volcengine:mainfrom
axiomoth:fix/web-studio-task-query-limit
Open

fix(tasks): paginate Studio task queries#4104
axiomoth wants to merge 1 commit into
volcengine:mainfrom
axiomoth:fix/web-studio-task-query-limit

Conversation

@axiomoth

Copy link
Copy Markdown

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/tasks rejects 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

  • A human participated in the implementation or review loop
  • This PR was generated entirely by AI agents without human participation in the loop

Related Issue

No linked issue.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Performance improvement
  • Test update

Changes Made

  • Add an optional non-negative offset query parameter to GET /api/v1/tasks and apply it after filtering and newest-first sorting.
  • Apply root-role pagination after merging and deduplicating cached and system task scopes.
  • Fetch Studio tasks in pages of at most 200, deduplicate task IDs, and stop on a short or non-advancing page.
  • Update the generated request type and API test client for the new query parameter.

Testing

  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have tested this on the following platforms:
    • Linux
    • macOS
    • Windows

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 build
  • Ruff checks for all changed Python files
  • ESLint for the new Studio test

The 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

  • My code follows the project's coding style
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

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; offset is optional and defaults to zero.

@axiomoth
axiomoth marked this pull request as ready for review August 18, 2026 16:00
Copilot AI lite review requested due to automatic review settings August 18, 2026 16:00

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 offset support to GET /api/v1/tasks and 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.

Comment thread web-studio/src/routes/tasks/route.test.ts
Comment thread openviking/server/routers/tasks.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

2 participants