Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions apps/sim/blocks/blocks/google_drive.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,17 @@ describe('GoogleDriveBlock agent tool calls', () => {
it('drops a list page token left over on the canvas under search', () => {
expect(buildParams({ operation: 'search', pageToken: 'stale' }).pageToken).toBeUndefined()
})

it('drops a list page token left over on the canvas under a non-paginating operation', () => {
expect(buildParams({ operation: 'get_file', pageToken: 'stale' }).pageToken).toBeUndefined()
})

/** A stored agent tool keeps its operation on the tool, not in the args the mapper receives. */
it.each(['list', 'search', 'list_permissions', 'list_revisions', 'list_comments'])(
'keeps the model pageToken on %s when the args carry no operation',
(operation) => {
const args = { fileId: 'f-1', pageToken: 'next' }
expect({ ...args, ...buildParams(args, { operation }) }.pageToken).toBe('next')
}
)
})
3 changes: 2 additions & 1 deletion apps/sim/blocks/blocks/google_drive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1704,7 +1704,8 @@ Return ONLY the comment text - no explanations, no quotes, no extra formatting.`
effectivePageToken = revisionsPageToken || agentPageToken
else if (params.operation === 'list_comments')
effectivePageToken = commentsPageToken || agentPageToken
else if (params.operation !== 'list') effectivePageToken = undefined
// The canvas list token is stale for every other operation; an agent's own token is not
else if (params.operation !== 'list') effectivePageToken = agentPageToken

const effectiveQuery =
params.operation === 'search'
Expand Down
Loading