[Bug]: Task Center misclassifies running tasks and misses status-filtered results
Issue Origin / 问题来源
中文
已在真实环境中观察或复现。
状态显示问题通过已部署的 Studio 页面和受控 GET 任务接口响应复现。200 条结果限制问题通过调用实际前端任务列表函数复现,Mock 接口遵循后端现有的“先筛选、再限制返回数量”规则。这些验证不依赖实际运行模型工作进程。
English
Observed or reproduced in a real environment.
The status-display issue was reproduced in the deployed Studio page using controlled GET task-response fixtures. The result-limit issue was reproduced by calling the actual Studio task-list function with a mock implementing the existing server filter-before-limit contract. These checks do not depend on running model workers.
Bug Description / 问题描述
中文
Web Studio 任务中心的状态显示和状态筛选结果可能与任务 API 不一致:
- API 返回 12 条
running任务时,页面显示 8 条运行中、4 条等待中;选择等待中后,这 4 条任务的标签又变成运行中。 - 页面先获取最多 200 条未按状态筛选的记录,再在本地筛选。当 200 条较新的已完成任务占满响应时,更早且仍被后端保留的失败任务会被漏掉,即使现有 API 使用
status=failed就能返回它。
受影响入口:/studio/tasks;所属模块:web-studio/src/routes/tasks。
English
The Web Studio Task Center can disagree with the task API in both its displayed statuses and its status-filtered results:
- With 12 tasks whose API status is
running, it shows 8 running and 4 pending. Selecting Pending then shows those four tasks with Running labels. - Status filtering happens after fetching at most 200 unfiltered records. An older failed task is omitted when 200 newer completed tasks fill that response, even though the existing API can return it with
status=failed.
Affected entry point: /studio/tasks; owner module: web-studio/src/routes/tasks.
Steps to Reproduce / 复现步骤
中文
运行中任务被重新标记为等待中
- 打开
/studio/tasks,将 GET/api/v1/tasks响应替换为下方 12 条任务的测试数据。每条记录使用不同的资源 ID,确保按资源分组后仍保留 12 行。 - 选择全部状态:接口记录都是
running,但运行中 / 等待中计数为8 / 4。 - 选择等待中:出现 4 条标记为运行中的记录,因为页面在筛选后的较小列表上重新推算状态。
状态筛选漏掉仍被保留的旧任务
- 准备同一任务类型的 1 条失败任务和 200 条较新的已完成任务,确保它们仍被后端保留。
- 在 Studio 选择该任务类型和失败状态。
- 请求包含
limit=200和task_type,但没有status;200 条已完成任务占满响应后,客户端筛选得到空列表。 - 对同一数据源请求
/api/v1/tasks?limit=200&task_type=session_commit&status=failed:后端先按条件筛选,可以返回该失败任务。
English
Running tasks are reclassified as pending
- Open
/studio/tasksand supply the GET/api/v1/tasksresponse with the 12-record fixture below. Use distinct resource IDs so resource grouping retains all 12 rows. - Select All statuses: observe the Running / Pending count of
8 / 4, although every returned record isrunning. - Select Pending: observe four rows labeled Running. The status is recomputed against the smaller filtered list.
A status filter misses an older retained task
- Use a task source containing one failed task and 200 newer completed tasks, all of the same task type and still retained by the server.
- Select that task type and Failed in Studio.
- Observe that the request has
limit=200andtask_type, but nostatus. The returned completed tasks fill the limit and the client produces an empty list. - Request
/api/v1/tasks?limit=200&task_type=session_commit&status=failedagainst the same source: the existing server contract filters first and returns the failed task.
Expected Behavior / 预期行为
中文
任务标签以及运行中 / 等待中计数应反映 API 返回的状态。选择状态时,应将条件传给 API,在限制返回数量之前完成筛选。12 条运行中记录应显示 12 / 0,等待中列表为空;即使有超过 200 条较新的其他状态任务,仍被后端保留的失败记录也应能通过失败筛选找到。
English
Task labels and Running / Pending counts reflect the statuses returned by the API. Selecting a status sends that filter to the API before the result limit is applied. Twelve running records produce 12 / 0 and no pending rows; a retained failed record is discoverable even when more than 200 newer records have another status.
Actual Behavior / 实际行为
中文
前端将超过 8 条的运行中记录推算为等待中,筛选后又改变它们的显示状态;即使 API 能返回匹配任务,状态筛选后的列表也可能为空。
English
The UI invents pending states beyond eight running records, changes their displayed status after filtering, and can report an empty status-filtered list despite matching tasks being available through the API.
Minimal Reproducible Example / 最小复现示例
中文
下方 JavaScript 数据用于第一个场景的任务接口响应。
第二个场景可用 records.filter(matchesTypeAndStatus).sort(newestFirst).slice(0, limit) 模拟后端规则。调用实际的 fetchTasks('session_commit', 'failed') 时,由于请求没有传递 status,旧失败记录会被漏掉。
English
Task-response fixture for the first case:
const tasks = Array.from({ length: 12 }, (_, i) => ({
task_id: `task-${i + 1}`,
task_type: i < 8 ? 'session_commit' : 'add_resource',
resource_id: `resource-${i + 1}`,
status: 'running',
created_at: 100 + i,
}));
const response = { status: 'ok', result: tasks };
For the second case, a mock task source can reproduce the server contract with records.filter(matchesTypeAndStatus).sort(newestFirst).slice(0, limit). Calling the actual fetchTasks('session_commit', 'failed') loses the old failure because its request omits status.
Error Logs / 请求表现与根因
中文
任务接口请求能够成功,错误结果产生在前端:
task-list.ts:getEffectiveTaskStatus将排序索引大于等于 8 的运行中任务改为等待中;fetchTasks对已被数量限制截断的结果做本地筛选。route.tsx:另一处独立的 8 条任务上限改变运行中 / 等待中计数,行渲染又在筛选后的列表上重新计算状态。- 后端现有的
TaskTracker._list_tasks_on_owner已经在排序和数量限制之前执行状态筛选。
English
The task requests succeed. The incorrect results are produced in the frontend:
task-list.ts:getEffectiveTaskStatusreclassifies running records with index >= 8;fetchTasksfilters the limited response locally.route.tsx: a separate eight-task cap changes the Running / Pending count, and row rendering recomputes effective status against the filtered list.- The existing server
TaskTracker._list_tasks_on_owneralready applies status filtering before sorting and limiting.
OpenViking Version / OpenViking 版本
中文
浏览器复现环境:官方 v0.4.17.1 镜像,源码版本 420d4074f74070bc6fe7151aa54527cf1ff15152。
也已在上游 main 的 d3bdd5494e679b5775f8ca9087ad6e2bb2af42f3 版本确认。
English
Browser reproduction: official v0.4.17.1 image, source revision 420d4074f74070bc6fe7151aa54527cf1ff15152.
Also verified in upstream main at d3bdd5494e679b5775f8ca9087ad6e2bb2af42f3.
Python Version / Python 版本
中文
本地服务容器使用 Python 3.13。受影响逻辑位于 Studio 的 TypeScript 代码中。
English
Python 3.13 in the local server container. The affected logic is TypeScript in Studio.
Operating System / 操作系统
中文
macOS 主机,OpenViking 服务运行在 Docker(Linux)中;浏览器复现使用 Chrome。
English
macOS host with the OpenViking server running in Docker (Linux); Chrome for the browser reproduction.
Model Backend / 模型后端
中文
受控任务接口响应复现不需要模型后端。
English
Not required for the controlled task-response reproduction.
Additional Context / 补充说明
中文
计数仍以当前任务列表为范围,包括现有筛选条件和按资源分组规则。修复可以复用 API 已有的 status 查询参数和规范化后的任务记录。
English
The expected count remains scoped to the current task list, including its existing filtering and resource grouping. The fix can reuse the existing API status query parameter and normalized task records.
Taking this — will send status on the existing GET /api/v1/tasks query and stop inventing pending from the Studio-side 8-slot running cap (getEffectiveTaskStatus / KPI recount).