[BUG] ListTasks is not sorted by last update time, newest first

未关闭 适合新手
#3,789 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
80/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
go, sql
领域
database

调研方向

从 go/core/internal/database/agent_tasks.go 中 L45-52 附近开始,ListTasks 在这里构建页游标和 ORDER BY t.position, t.id 查询。阅读游标元组如何构造并用于分页,然后将排序和游标都改为按状态时间戳降序的 (t.status_timestamp, t.id)。完成意味着最近更新的任务最先返回,并且分页在各页之间保持一致;如果存在相关数据库测试,请运行它们。

由索引模型根据 Issue 内容生成。

描述

📋 Prerequisites
  • I have searched the existing issues to avoid creating a duplicate
  • By submitting this issue, you agree to follow our Code of Conduct
  • I am using the latest version of the software (checked against main at e8cd153)
  • I have tried to clear cache/cookies or used incognito mode (if ui-related)
  • I can consistently reproduce this issue
🎯 Affected Service(s)

Controller (A2A gateway)

🚦 Impact/Severity

Minor

🐛 Bug Description

ListTasks orders tasks by history position (agent_tasks.go L52, ORDER BY t.position, t.id). A2A 1.0.1 §3.1.4 says tasks MUST be sorted by last update time in descending order.

🔄 Steps To Reproduce
  1. Create two tasks in one context, then update the first one again.
  2. Call ListTasks for that context.
🤔 Expected Behavior

The most recently updated task comes first.

📱 Actual Behavior

The oldest task comes first.

🔍 Additional Context

The page cursor is also (t.position, t.id) (L45-48), so the cursor has to move to (t.status_timestamp, t.id) together with an ORDER BY t.status_timestamp DESC, t.id; changing only the ORDER BY breaks pagination. §3.1.4 names the status timestamp as the sort key.

主要语言
Go
星标
4.5k
派生
937
平均合并
1 天 10 小时
30 天内合并 PR
150

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

kagent-dev/kagent 的其他 Issue

查看 kagent-dev/kagent 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。