feat(tools): add auto-pagination with Redis cache for paginated tool outputs#3945
feat(tools): add auto-pagination with Redis cache for paginated tool outputs#3945abhinavDhulipala wants to merge 5 commits intosimstudioai:mainfrom
Conversation
PR SummaryMedium Risk Overview Introduces a new Wires cache lifecycle cleanup into workflow execution shutdown paths (SSE, streaming API, and queued/direct execution) and migrates Zendesk “Get Tickets” to a new Reviewed by Cursor Bugbot for commit 658038b. Bugbot is set up for automated code reviews on this repo. Configure here. |
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Greptile SummaryThis PR introduces a storage-agnostic auto-pagination framework for paginated tool outputs — pages are flushed individually to Redis as they are fetched, a lightweight The architecture is well-designed (adapter interface, clean key schema, TTL safety-net, scan-based cleanup mirroring the existing base64 cache pattern) and the test coverage is solid. Two issues need attention before merge:
Confidence Score: 4/5Not safe to merge as-is — stale Two P1 findings: (1)
Important Files Changed
Sequence DiagramsequenceDiagram
participant BE as BlockExecutor
participant TI as tools/index
participant AP as autoPaginate
participant RC as RedisPaginatedCache
participant Redis
participant HY as hydrateCacheReferences
BE->>TI: executeTool(zendesk_get_tickets, params)
TI->>TI: HTTP → page 0 result
TI->>AP: autoPaginate(initialResult, params, config)
AP->>RC: storePage(cacheId, 0, items)
RC->>Redis: SET pagcache:page:{cacheId}:0 PX ttl
loop while nextToken != null and pageIndex < maxPages
AP->>TI: executeTool(toolId, nextParams, skipPostProcess=true)
TI-->>AP: pageResult
AP->>RC: storePage(cacheId, N, items)
RC->>Redis: SET pagcache:page:{cacheId}:N PX ttl
end
AP->>RC: storeMetadata(cacheId, {totalPages, totalItems})
RC->>Redis: SET pagcache:meta:{cacheId} PX ttl
AP-->>TI: output with PaginatedCacheReference
TI-->>BE: finalResult with cache ref
Note over BE: Next block execution
BE->>HY: hydrateCacheReferences(resolvedInputs)
HY->>RC: getAllPages(cacheId, totalPages)
RC->>Redis: MGET pagcache:page:{cacheId}:0..N
Redis-->>RC: page data
RC-->>HY: CachedPage[]
HY-->>BE: inputs with tickets=[...all items]
Note over BE: Workflow end
BE->>Redis: SCAN pagcache:{executionId} then DEL
|
a2a3fdd to
69d7249
Compare
69d7249 to
6e39d29
Compare
6e39d29 to
a2972b3
Compare
b7665e8 to
71cedda
Compare
71cedda to
9ae6209
Compare
3fb6e34 to
b71153b
Compare
|
@abhinavDhulipala is attempting to deploy a commit to the Sim Team on Vercel. A member of the Team first needs to authorize it. |
b71153b to
dbae5f7
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit dbae5f7. Configure here.
dbae5f7 to
658038b
Compare

Summary
Tools can now declare a pagination config to automatically fetch all pages
from paginated APIs. Pages are flushed to Redis individually (avoiding
oversized HTTP responses), and a lightweight cache reference is stored in
blockStates instead of the full dataset. Downstream blocks hydrate from
Redis transparently. Zendesk Get Tickets is the first tool to opt in.
Type of Change
Testing
Unit testing done. Staging test will involve running the ZenDesk v2 tool on a previously larger than mem operation and observing a passing execution.
Checklist
Screenshots/Videos
Video of cache ref working e2e:
Screen.Recording.2026-04-04.at.19.23.47.mov