Draft: feat(tools): add auto-pagination with Redis cache for paginated tool outputs#3945
Draft: 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 Updates Zendesk’s “Get Tickets” operation to use a new Reviewed by Cursor Bugbot for commit 3fb6e34. 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
| await Promise.allSettled([ | ||
| cleanupExecutionBase64Cache(executionId), | ||
| cleanupPaginatedCache(executionId), | ||
| ]) |
There was a problem hiding this comment.
Cleanup error logging silently dropped in queued execution
Low Severity
The original code explicitly caught and logged errors from cleanupExecutionBase64Cache with context including executionId. The replacement using Promise.allSettled discards the settled results entirely, so any rejection reasons are silently swallowed at this call site. While both cleanup functions have internal try/catch that logs at warn level, the original caller-level logging provided additional context (executionId) at error level. This inconsistency also differs from the route.ts cleanup sites which still use explicit .catch() handlers.
Reviewed by Cursor Bugbot for commit 9ae6209. Configure here.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 3fb6e34. Configure here.


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