Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Tasks: API: Add pagination and granular message control to logs endpoint

未关闭
#1,247 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
35/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
停滞
领域
api, backend

调研方向

首先查看任务日志端点、coderd 现有的分页模式以及 codersdk.Pagination。确定活动日志和暂停快照的分页应如何工作,同时允许未来的 ACP 消息类型。完成的标准是:该方案已实现并记录文档,已针对两种状态进行测试,并且 CLI 已在需要时更新。

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

描述

Problem

The task logs API (GET /api/v2/tasks/{user}/{task}/logs) currently returns the entire conversation history. This is not ideal for tasks with long-running conversations:

  • Large response payloads for tasks with hundreds of messages
  • No way to fetch specific message ranges
  • Inefficient for clients that only need recent messages or want to implement infinite scroll

Current Behavior

The API returns all messages in a single response:

{
  "logs": [...],  // All messages
  "snapshot": false,
  "total_count": 250
}

When a task is paused (post-implementation of pause/resume functionality), it returns the last 10 messages from the snapshot:

{
  "logs": [...],  // Last 10 messages
  "snapshot": true,
  "snapshot_at": "2025-01-18T10:00:00Z",
  "total_count": 10
}

Proposed Enhancement

Add pagination support to the logs endpoint. The exact implementation will depend on the message model after ACP integration, which may introduce more granular message types, status updates, and metadata beyond the current large text blocks.

Pagination should follow coderd's existing patterns (using limit, offset, and after_id query parameters as defined in codersdk.Pagination).

Key considerations:

  • With ACP, messages may be split into multiple granular events rather than 500-line text blocks
  • The message structure and metadata may evolve significantly
  • Pagination design should accommodate future message model changes

Context

Raised during RFC review for Task Start/Pause/Resume Lifecycle. Deferred from Beta/GA as it's an enhancement rather than blocking issue.

Acceptance Criteria

  • Design pagination approach that accommodates future ACP message model changes
  • Works for both active tasks (live logs) and paused tasks (snapshots)
  • Follows coderd's existing pagination patterns
  • Document pagination behavior
  • Update CLI if needed to support fetching message ranges

Related

  • RFC: Task Start/Pause/Resume Lifecycle
  • Future: ACP integration for message-level control
主要语言
没有语言数据
星标
3
派生
0
PR 合并指标
30 天内没有已合并 PR

贡献指南

这个仓库没有索引到贡献指南

从这里开始

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

coder/internal 的其他 Issue

查看 coder/internal 的全部 Issue

相似的 Issue

更多 Backend & API Design Issue

把新 issue 发到你的邮箱

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