-
Notifications
You must be signed in to change notification settings - Fork 3.2k
fix(logging): hitl + trigger dev crash protection #2664
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
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
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
Greptile SummaryThis PR implements three critical improvements to prevent cost leakage and execution state corruption when worker processes crash or timeout: Key Changes:
The changes ensure that costs are always captured and execution state is properly cleaned up, even when Trigger.dev workers experience OOM errors or timeouts. Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Client
participant ExecutionCore
participant LoggingSession
participant Database
participant PauseManager
participant CronJob
Note over Client,CronJob: Normal Execution Flow with Incremental Cost Tracking
Client->>ExecutionCore: Execute Workflow
ExecutionCore->>LoggingSession: start()
LoggingSession->>Database: Create log entry with BASE_EXECUTION_CHARGE
loop For each block execution
ExecutionCore->>ExecutionCore: Execute Block
ExecutionCore->>LoggingSession: onBlockComplete(blockId, output)
LoggingSession->>LoggingSession: Accumulate cost
LoggingSession->>Database: flushAccumulatedCost()
Note over Database: Cost saved incrementally<br/>to prevent loss on crash
end
Note over Client,CronJob: HITL Pause Flow with Error Handling
ExecutionCore->>ExecutionCore: Pause detected
ExecutionCore->>PauseManager: persistPauseResult()
alt Pause persistence succeeds
PauseManager->>Database: Save pause state & snapshot
PauseManager-->>ExecutionCore: Success
else Pause persistence fails
PauseManager-->>ExecutionCore: Error
ExecutionCore->>LoggingSession: markAsFailed("Failed to persist pause state")
LoggingSession->>Database: Update status to 'failed'
Note over Database: Cost already saved<br/>from incremental tracking
end
Note over Client,CronJob: Worker Crash Protection
rect rgb(255, 240, 240)
Note over ExecutionCore: Worker crashes/times out
ExecutionCore->>ExecutionCore: Process terminates
Note over Database: Log remains in 'running' state<br/>Cost partially saved via incremental flush
end
Note over Client,CronJob: Stale Execution Cleanup (Cron)
CronJob->>Database: Query executions in 'running' state > 30 min
Database-->>CronJob: Return stale executions
loop For each stale execution
CronJob->>Database: Update status to 'failed'
CronJob->>Database: Set error message
CronJob->>Database: Set endedAt & totalDurationMs
end
Note over CronJob,Database: Cleanup ensures no executions<br/>remain stuck in running state
|
Collaborator
Author
waleedlatif1
added a commit
that referenced
this pull request
Jan 3, 2026
…ext menu (#2672) * feat(logs-context-menu): consolidated logs utils and types, added logs record context menu (#2659) * feat(email): welcome email; improvement(emails): ui/ux (#2658) * feat(email): welcome email; improvement(emails): ui/ux * improvement(emails): links, accounts, preview * refactor(emails): file structure and wrapper components * added envvar for personal emails sent, added isHosted gate * fixed failing tests, added env mock * fix: removed comment --------- Co-authored-by: waleed <walif6@gmail.com> * fix(logging): hitl + trigger dev crash protection (#2664) * hitl gaps * deal with trigger worker crashes * cleanup import strcuture * feat(imap): added support for imap trigger (#2663) * feat(tools): added support for imap trigger * feat(imap): added parity, tested * ack PR comments * final cleanup * feat(i18n): update translations (#2665) Co-authored-by: waleedlatif1 <waleedlatif1@users.noreply.github.com> * fix(grain): updated grain trigger to auto-establish trigger (#2666) Co-authored-by: aadamgough <adam@sim.ai> * feat(admin): routes to manage deployments (#2667) * feat(admin): routes to manage deployments * fix naming fo deployed by * feat(time-picker): added timepicker emcn component, added to playground, added searchable prop for dropdown, added more timezones for schedule, updated license and notice date (#2668) * feat(time-picker): added timepicker emcn component, added to playground, added searchable prop for dropdown, added more timezones for schedule, updated license and notice date * removed unused params, cleaned up redundant utils * improvement(invite): aligned styling (#2669) * improvement(invite): aligned with rest of app * fix(invite): error handling * fix: addressed comments --------- Co-authored-by: Emir Karabeg <78010029+emir-karabeg@users.noreply.github.com> Co-authored-by: Vikhyath Mondreti <vikhyathvikku@gmail.com> Co-authored-by: waleedlatif1 <waleedlatif1@users.noreply.github.com> Co-authored-by: Adam Gough <77861281+aadamgough@users.noreply.github.com> Co-authored-by: aadamgough <adam@sim.ai>
waleedlatif1
pushed a commit
that referenced
this pull request
Jan 8, 2026
* hitl gaps * deal with trigger worker crashes * cleanup import strcuture
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
Type of Change
Testing
Tested all three improvements manually.
Checklist