Skip to content

Commit fe0c2a9

Browse files
committed
fix(google-drive): keep the page token an agent passes
1 parent 07330ae commit fe0c2a9

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

‎apps/sim/blocks/blocks/google_drive.test.ts‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,4 +106,17 @@ describe('GoogleDriveBlock agent tool calls', () => {
106106
it('drops a list page token left over on the canvas under search', () => {
107107
expect(buildParams({ operation: 'search', pageToken: 'stale' }).pageToken).toBeUndefined()
108108
})
109+
110+
it('drops a list page token left over on the canvas under a non-paginating operation', () => {
111+
expect(buildParams({ operation: 'get_file', pageToken: 'stale' }).pageToken).toBeUndefined()
112+
})
113+
114+
/** A stored agent tool keeps its operation on the tool, not in the args the mapper receives. */
115+
it.each(['list', 'search', 'list_permissions', 'list_revisions', 'list_comments'])(
116+
'keeps the model pageToken on %s when the args carry no operation',
117+
(operation) => {
118+
const args = { fileId: 'f-1', pageToken: 'next' }
119+
expect({ ...args, ...buildParams(args, { operation }) }.pageToken).toBe('next')
120+
}
121+
)
109122
})

‎apps/sim/blocks/blocks/google_drive.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1704,7 +1704,8 @@ Return ONLY the comment text - no explanations, no quotes, no extra formatting.`
17041704
effectivePageToken = revisionsPageToken || agentPageToken
17051705
else if (params.operation === 'list_comments')
17061706
effectivePageToken = commentsPageToken || agentPageToken
1707-
else if (params.operation !== 'list') effectivePageToken = undefined
1707+
// The canvas list token is stale for every other operation; an agent's own token is not
1708+
else if (params.operation !== 'list') effectivePageToken = agentPageToken
17081709

17091710
const effectiveQuery =
17101711
params.operation === 'search'

0 commit comments

Comments
 (0)