Skip to content

Conversation

@icecrasher321
Copy link
Collaborator

Summary

Function block timeout for native and remote code execution increased to 3 min.

Type of Change

  • Bug fix

Testing

Manually

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel
Copy link

vercel bot commented Oct 15, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
docs Skipped Skipped Oct 15, 2025 6:51pm

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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: maxDuration 60s → 300s, default timeout 5s → 180s
  • Function handler: default timeout 5s → 180s
  • Tool config: DEFAULT_TIMEOUT 10s → 180s

Issues Found:

  • Critical: maxDuration (300s) exceeds execution timeout (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 execution timeout (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 - maxDuration and timeout values 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
Loading

3 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@waleedlatif1 waleedlatif1 self-assigned this Oct 15, 2025
waleedlatif1
waleedlatif1 previously approved these changes Oct 15, 2025
@icecrasher321 icecrasher321 merged commit fd67fd2 into staging Oct 15, 2025
3 checks passed
@blacksmith-sh
Copy link

blacksmith-sh bot commented Oct 15, 2025

1 Job Failed:

CI / Test and Build / Test and Build failed on "Build application"
[...]
     ✓ optimizeCss
     ⨯ turbopackSourceMaps

   Creating an optimized production build ...
 ✓ Finished writing to disk in 129ms
 ✓ Compiled successfully in 64s
   Linting and checking validity of types ...
   Collecting page data ...
 ⨯ Invalid segment configuration export detected. This can cause unexpected behavior from the configs not being applied. You should see the relevant failures in the logs above. Please fix them to continue.
error: script "build" exited with code 1
[ERROR] command finished with error: command (/home/runner/_work/sim/sim/apps/sim) /home/runner/.bun/bin/bun run build exited (1)

 Tasks:    3 successful, 4 total
Cached:    0 cached, 4 total
  Time:    1m36.404s 
Failed:    sim#build

 ERROR  run failed: command  exited (1)
error: script "build" exited with code 1
Error: Process completed with exit code 1.

Summary: 1 failed workflow
  • CI (1 job failed)

Last updated: 2025-10-15 18:55:30 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants