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
maxEvents parameter to cap total fetched events
- Accept an
AbortSignal parameter for cancellation
- Make
start/end work 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.
Problem
RemoteEventsList.getEvents()fetches ALL events from the server with no upper bound:For long conversations with thousands of events, this creates an unbounded waterfall of HTTP requests with no way to cancel. The
start/endparameters only slice after all events are fetched.Proposed Fix
maxEventsparameter to cap total fetched eventsAbortSignalparameter for cancellationstart/endwork server-side (pass as query params if the API supports it)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.