Skip to content

Commit cfbc3e8

Browse files
committed
improvement(mothership): let a code call run for up to fifteen minutes
A render or build that needs more than five minutes was cut off at the ceiling and failed, and the model started over in smaller pieces or escaped the call with a background process the paused workbench then stalled. Mothership code calls now run up to 900 seconds. The worker's schema still decides what a model may request, so this is inert until the worker raises its own maximum.
1 parent eb6bcdb commit cfbc3e8

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

‎apps/sim/lib/mothership/tools/handlers/function-execute-session.test.ts‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ describe('executeFunctionExecute session plumbing', () => {
146146
expect(mockExecuteTool.mock.calls[1][1].timeout).toBe(90_000)
147147

148148
await executeFunctionExecute({ code: 'x', language: 'python', timeout: 45_000 }, BASE_CONTEXT)
149-
expect(mockExecuteTool.mock.calls[2][1].timeout).toBe(300_000)
149+
expect(mockExecuteTool.mock.calls[2][1].timeout).toBe(900_000)
150150
})
151151
})
152152

@@ -187,8 +187,9 @@ describe.each([
187187
{ timeout: 7, expected: 7_000 },
188188
{ timeout: '90', expected: 90_000 },
189189
{ timeout: 300, expected: 300_000 },
190-
{ timeout: 601, expected: 300_000 },
191-
{ timeout: 45_000, expected: 300_000 },
190+
{ timeout: 900, expected: 900_000 },
191+
{ timeout: 901, expected: 900_000 },
192+
{ timeout: 45_000, expected: 900_000 },
192193
{ timeout: 0, expected: 60_000 },
193194
{ timeout: 'invalid', expected: 60_000 },
194195
])('maps $timeout seconds to $expected milliseconds once', async ({ timeout, expected }) => {

‎apps/sim/lib/mothership/tools/handlers/function-execute.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,11 @@ const logger = createLogger('CopilotFunctionExecute')
7676
const MAX_MOUNTED_FILES = 500
7777
/** The call budget includes cold allocation and mounting, before the user's code starts. */
7878
const DEFAULT_TIMEOUT_SECONDS = 60
79-
const MAX_TIMEOUT_SECONDS = 300
79+
/**
80+
* The longest call the worker may request. Long renders and builds need it whole: cut off at
81+
* five minutes, they fail and start over. The worker's schema decides what a model may ask for.
82+
*/
83+
const MAX_TIMEOUT_SECONDS = 900
8084

8185
/** An input the run asked for that was not mounted, and why; paths are the model's own. */
8286
export interface ExcludedInput {

0 commit comments

Comments
 (0)