Arcp::Runtime::JobManager#list rebuilds the entire filtered job list and sorts it every time a page is requested. lib/arcp/runtime/job_manager.rb:132 through lib/arcp/runtime/job_manager.rb:143 converts all jobs to an array, applies chained filters, sorts by created_at, slices by an offset cursor, and then repeats the same work for the next cursor. This is acceptable for small in-memory test fixtures, but a long-running runtime with many retained jobs pays O(n log n) work and extra allocation per page, while offset cursors can skip or duplicate rows if jobs are added between page reads.
Fix prompt: Replace offset pagination over a freshly sorted array with a stable cursor strategy that can walk jobs in creation order without sorting the full collection for every page. For the in-memory manager, maintain an insertion-ordered per-principal or global index and use a cursor based on creation time plus job id, or snapshot the ordered ids once and page over that snapshot. Keep the public Client#list_jobs lazy enumerator behavior, preserve existing filters, and add tests for pagination stability when new jobs are submitted between page requests.
Arcp::Runtime::JobManager#listrebuilds the entire filtered job list and sorts it every time a page is requested.lib/arcp/runtime/job_manager.rb:132throughlib/arcp/runtime/job_manager.rb:143converts all jobs to an array, applies chained filters, sorts bycreated_at, slices by an offset cursor, and then repeats the same work for the next cursor. This is acceptable for small in-memory test fixtures, but a long-running runtime with many retained jobs pays O(n log n) work and extra allocation per page, while offset cursors can skip or duplicate rows if jobs are added between page reads.Fix prompt: Replace offset pagination over a freshly sorted array with a stable cursor strategy that can walk jobs in creation order without sorting the full collection for every page. For the in-memory manager, maintain an insertion-ordered per-principal or global index and use a cursor based on creation time plus job id, or snapshot the ordered ids once and page over that snapshot. Keep the public
Client#list_jobslazy enumerator behavior, preserve existing filters, and add tests for pagination stability when new jobs are submitted between page requests.