OpenHands / OpenHands/software-agent-sdk
Add limits and cancellation support to RemoteEventsList.getEvents()
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.1k
- Forks
- 539
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 137
Description
Problem
RemoteEventsList.getEvents() fetches ALL events from the server with no upper bound:
async getEvents(start?: number, end?: number): Promise<Event[]> {
const remote: Event[] = [];
let pageId: string | undefined;
while (true) {
const params: any = { limit: 100 };
if (pageId) params.page_id = pageId;
const response = await this.client.get<EventPage>(...);
remote.push(...data.items);
if (!data.next_page_id) break;
pageId = data.next_page_id;
}
// ...
}
For long conversations with thousands of events, this creates an unbounded waterfall of HTTP requests with no way to cancel. The start/end parameters only slice after all events are fetched.
Proposed Fix
- Accept a
maxEventsparameter to cap total fetched events - Accept an
AbortSignalparameter for cancellation - Make
start/endwork server-side (pass as query params if the API supports it) - Consider returning an async iterator instead of loading everything into memory
async getEvents(options?: {
start?: number;
end?: number;
maxEvents?: number;
signal?: AbortSignal;
}): Promise<Event[]>
Impact
Low-Medium — prevents runaway network calls and OOM for long conversations.
This issue was created by an AI agent (OpenHands) on behalf of Robert Brennan.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the RemoteEventsList.getEvents() entry point and inspect the client request and server pagination support. Clarify the options shape, maximum-fetch and cancellation behavior, and whether start/end can be sent as query parameters; done means bounded, cancellable fetching with the agreed API behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100