Skip to content

[Feature]: feat(gateway): apply cursor pagination to agents.files.list and sessions.list #75236

Description

@Angfr95

Summary

artifacts.list gained cursor pagination in #75208 via src/gateway/util/cursor.ts.
The same pattern should be applied to agents.files.list and sessions list RPCs
to keep the API surface consistent.

Refs #75208.

Problem to solve

agents.files.list and sessions list RPCs return unbounded result sets.
Large workspaces with many files or sessions have no way to paginate results efficiently.

Proposed solution

Import encodeCursor/decodeCursor from src/gateway/util/cursor.ts (introduced in #75208)
and add cursor, limit, nextCursor, total to agents.files.list and sessions list params/results,
following the same pattern as artifacts.list.

Alternatives considered

No response

Impact

Affected: SDK consumers and agents using agents.files.list or sessions RPCs
Severity: Medium
Frequency: Any workspace with large file sets or many sessions
Consequence: Unbounded payloads, slow responses, no way to paginate

Evidence/examples

artifacts.list already supports cursor pagination via #75208.
agents.files.list and sessions list have no equivalent.

Additional information

Reuse src/gateway/util/cursor.ts introduced in #75208. No new dependencies needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal backlog priority with limited blast radius.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.enhancementNew feature or requestimpact:otherThis issue has meaningful maintainer-visible impact outside the owned taxonomy.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.maturity:stableIssue affects a taxonomy feature currently scored M4/M5.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions