openclaw - 💡(How to fix) Fix [Feature]: feat(gateway): apply cursor pagination to agents.files.list and sessions.list [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#75236Fetched 2026-05-01 05:36:28
View on GitHub
Comments
1
Participants
2
Timeline
5
Reactions
2
Author
Timeline (top)
commented ×1cross-referenced ×1labeled ×1mentioned ×1

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.

Root Cause

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.

RAW_BUFFERClick to expand / collapse

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.

extent analysis

TL;DR

Apply cursor pagination to agents.files.list and sessions list RPCs by reusing the encodeCursor and decodeCursor functions from src/gateway/util/cursor.ts.

Guidance

  • Import encodeCursor and decodeCursor from src/gateway/util/cursor.ts to handle cursor pagination for agents.files.list and sessions list RPCs.
  • Add cursor, limit, nextCursor, and total parameters to the agents.files.list and sessions list RPCs to support pagination.
  • Follow the same pattern as artifacts.list to maintain API consistency.
  • Verify the changes by testing the RPCs with large workspaces and checking for efficient pagination.

Example

import { encodeCursor, decodeCursor } from '../util/cursor';

// Example usage for agents.files.list
const filesListParams = {
  cursor: encodeCursor('some_cursor_value'),
  limit: 100,
};

const filesListResponse = {
  files: [...],
  nextCursor: encodeCursor('next_cursor_value'),
  total: 1000,
};

Notes

This solution assumes that the encodeCursor and decodeCursor functions are correctly implemented in src/gateway/util/cursor.ts and that the artifacts.list RPC is working as expected with cursor pagination.

Recommendation

Apply workaround by reusing the existing encodeCursor and decodeCursor functions to add cursor pagination to agents.files.list and sessions list RPCs, as this approach maintains API consistency and does not introduce new dependencies.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING