Skip to content

Commit 4125a35

Browse files
committed
Fix
1 parent bac3672 commit 4125a35

4 files changed

Lines changed: 38 additions & 9 deletions

File tree

apps/sim/lib/copilot/generated/tool-catalog-v1.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2969,7 +2969,8 @@ export const UserTable: ToolCatalogEntry = {
29692969
},
29702970
rowIds: {
29712971
type: 'array',
2972-
description: 'Array of row IDs to delete (for batch_delete_rows)',
2972+
description:
2973+
'Array of row IDs. Used by batch_delete_rows (rows to delete) and run_column (optional row scope — when omitted, runs across the whole table; when provided, only these rows are candidates and the server eligibility predicate still applies).',
29732974
items: { type: 'string' },
29742975
},
29752976
rows: {

apps/sim/lib/copilot/generated/tool-schemas-v1.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2799,7 +2799,8 @@ export const TOOL_RUNTIME_SCHEMAS: Record<string, ToolRuntimeSchemaEntry> = {
27992799
},
28002800
rowIds: {
28012801
type: 'array',
2802-
description: 'Array of row IDs to delete (for batch_delete_rows)',
2802+
description:
2803+
'Array of row IDs. Used by batch_delete_rows (rows to delete) and run_column (optional row scope — when omitted, runs across the whole table; when provided, only these rows are candidates and the server eligibility predicate still applies).',
28032804
items: {
28042805
type: 'string',
28052806
},

apps/sim/lib/copilot/tool-executor/executor.test.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,31 @@ describe('copilot tool executor fallback', () => {
113113
)
114114
})
115115

116+
it('defaults copilot function_execute timeout to 10 seconds when invalid', async () => {
117+
isKnownTool.mockReturnValue(false)
118+
isSimExecuted.mockReturnValue(false)
119+
executeAppTool.mockResolvedValue({ success: true, output: { result: 'ok' } })
120+
121+
await executeTool(
122+
'function_execute',
123+
{ code: 'return 1', timeout: 0 },
124+
{
125+
userId: 'user-1',
126+
workflowId: 'workflow-1',
127+
workspaceId: 'ws-1',
128+
copilotToolExecution: true,
129+
}
130+
)
131+
132+
expect(executeAppTool).toHaveBeenCalledWith(
133+
'function_execute',
134+
expect.objectContaining({
135+
timeout: 10_000,
136+
}),
137+
false
138+
)
139+
})
140+
116141
it('does not let copilot function_execute timeout exceed the default execution limit', async () => {
117142
isKnownTool.mockReturnValue(false)
118143
isSimExecuted.mockReturnValue(false)

apps/sim/lib/copilot/tool-executor/executor.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -106,16 +106,18 @@ function buildAppToolParams(
106106
const result = { ...params }
107107

108108
if (toolId === FUNCTION_EXECUTE_TOOL_ID && context.copilotToolExecution) {
109-
const timeoutSeconds =
109+
const rawTimeoutSeconds =
110110
result.timeout === undefined || result.timeout === null
111111
? DEFAULT_FUNCTION_EXECUTE_TIMEOUT_SECONDS
112112
: Number(result.timeout)
113-
if (Number.isFinite(timeoutSeconds) && timeoutSeconds > 0) {
114-
result.timeout = Math.min(
115-
Math.ceil(timeoutSeconds * MILLISECONDS_PER_SECOND),
116-
DEFAULT_EXECUTION_TIMEOUT_MS
117-
)
118-
}
113+
const timeoutSeconds =
114+
Number.isFinite(rawTimeoutSeconds) && rawTimeoutSeconds > 0
115+
? rawTimeoutSeconds
116+
: DEFAULT_FUNCTION_EXECUTE_TIMEOUT_SECONDS
117+
result.timeout = Math.min(
118+
Math.ceil(timeoutSeconds * MILLISECONDS_PER_SECOND),
119+
DEFAULT_EXECUTION_TIMEOUT_MS
120+
)
119121
}
120122

121123
if (result.credentialId && !result.credential && !result.oauthCredential) {

0 commit comments

Comments
 (0)