Skip to content

fix(cleanup-cron): stale execution cleanup integer overflow - #3113

Merged
icecrasher321 merged 1 commit into
stagingfrom
fix/stale-exec-cleanup
Feb 2, 2026
Merged

fix(cleanup-cron): stale execution cleanup integer overflow#3113
icecrasher321 merged 1 commit into
stagingfrom
fix/stale-exec-cleanup

Conversation

@icecrasher321

Copy link
Copy Markdown
Collaborator

Summary

Integer overflow leading to status update failure for stale executions that failed with network error from model providers, etc

Type of Change

  • Bug fix

Testing

Tested 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

vercelBot commented Feb 2, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
ProjectDeploymentActionsUpdated (UTC)
docsSkippedSkippedFeb 2, 2026 9:20am

Request Review

@greptile-apps

Copy link
Copy Markdown
Contributor

Greptile Overview

Greptile Summary

What changed

This PR adjusts the cleanup-stale-executions cron route to avoid an integer overflow that prevented stale execution status updates (notably for executions that failed due to network/provider errors).

How it fits in

apps/sim/app/api/cron/cleanup-stale-executions/route.ts is part of the Sim app’s scheduled maintenance endpoints. It identifies executions that have become stale and updates their status accordingly; this change makes those updates reliable even for very large age/duration values that previously overflowed numeric bounds.

Confidence Score: 3/5

  • This PR is likely safe to merge, but should be double-checked around date arithmetic and DB query semantics for edge cases.
  • Only one file is changed and the intent (avoiding overflow) is clear, but I could not fully validate the runtime behavior for all providers/status transitions without seeing comprehensive tests or broader call sites; cron routes are also easy to subtly mis-handle time units.
  • apps/sim/app/api/cron/cleanup-stale-executions/route.ts

Important Files Changed

FilenameOverview
apps/sim/app/api/cron/cleanup-stale-executions/route.tsAdjusts stale execution cleanup logic to avoid integer overflow during age/timeout calculations; verify time unit conversions and DB update conditions for edge cases.

Sequence Diagram

sequenceDiagram
autonumber
participant Scheduler as Cron/Scheduler
participant Route as cleanup-stale-executions route
participant DB as Database
Scheduler->>Route: HTTP request (cron invocation)
Route->>DB: Query stale executions
DB-->>Route: Stale execution rows
loop each stale execution
Route->>Route: Compute age/timeout threshold (overflow-safe)
Route->>DB: Update execution status (failed/timeout)
DB-->>Route: Update result
end
Route-->>Scheduler: 200 OK + summary
Loading

@greptile-appsgreptile-appsBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

1 file reviewed, no comments

Edit Code Review Agent Settings | Greptile

@icecrasher321
icecrasher321 merged commit b738550 into stagingFeb 2, 2026
12 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/stale-exec-cleanup branch February 3, 2026 18:04
royceP2 pushed a commit to arenadeveloper02/p2-sim that referenced this pull request Mar 3, 2026
Sign up for freeto 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.

1 participant

@icecrasher321