improvement(functions): increase function block timeout to 3 min#1641
Merged
icecrasher321 merged 4 commits intostagingfrom Oct 15, 2025
Merged
improvement(functions): increase function block timeout to 3 min#1641icecrasher321 merged 4 commits intostagingfrom
icecrasher321 merged 4 commits intostagingfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
There was a problem hiding this comment.
Greptile Overview
Summary
Increased function execution timeout from 5-10 seconds to 3 minutes (180s) across all execution paths to support longer-running user code
Key Changes:
- Route handler:
maxDuration60s → 300s, defaulttimeout5s → 180s - Function handler: default timeout 5s → 180s
- Tool config:
DEFAULT_TIMEOUT10s → 180s
Issues Found:
- Critical:
maxDuration(300s) exceeds executiontimeout(180s), creating a 2-minute gap where the route stays open but execution has timed out
Confidence Score: 3/5
- This PR has a configuration mismatch that needs to be resolved before merging
- The changes correctly increase timeouts consistently across the codebase, but there's a logical error where
maxDuration(300s) is set higher than the executiontimeout(180s). This means functions will timeout at 3 minutes but the API route stays open for 5 minutes, potentially causing confusing behavior or resource waste. - apps/sim/app/api/function/execute/route.ts -
maxDurationandtimeoutvalues need alignment
Important Files Changed
File Analysis
| Filename | Score | Overview |
|---|---|---|
| apps/sim/app/api/function/execute/route.ts | 5/5 | Increased maxDuration from 60s to 300s (5 min) and default timeout from 5s to 180s (3 min) |
| apps/sim/executor/handlers/function/function-handler.ts | 5/5 | Increased default timeout fallback from 5s to 180s (3 min) |
| apps/sim/tools/function/execute.ts | 5/5 | Updated DEFAULT_TIMEOUT constant from 10s to 180s (3 min) |
Sequence Diagram
sequenceDiagram
participant Client
participant API as /api/function/execute
participant Handler as FunctionBlockHandler
participant Tool as functionExecuteTool
participant VM as Execution Environment
Note over API: maxDuration: 300s (5 min)
Client->>Handler: Execute function block
Handler->>Tool: executeTool('function_execute')
Note over Handler: timeout: 180000ms (3 min)
Tool->>API: POST /api/function/execute
Note over Tool: DEFAULT_TIMEOUT: 180000ms
API->>API: Parse request body
Note over API: Default timeout: 180000ms
alt E2B Execution (Remote)
API->>VM: executeInE2B(code, timeout)
Note over VM: Cloud sandbox execution
VM-->>API: Result/Error
else Local VM Execution
API->>VM: script.runInContext(timeout)
Note over VM: Node.js VM execution
VM-->>API: Result/Error
end
API-->>Tool: Response (success/error)
Tool-->>Handler: CodeExecutionOutput
Handler-->>Client: Execution result
3 files reviewed, 1 comment
waleedlatif1
previously approved these changes
Oct 15, 2025
|
1 Job Failed: CI / Test and Build / Test and Build failed on "Build application" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Function block timeout for native and remote code execution increased to 3 min.
Type of Change
Testing
Manually
Checklist