fix(logs): logging with error issues for model costs#2169
Merged
icecrasher321 merged 4 commits intostagingfrom Dec 3, 2025
Merged
fix(logs): logging with error issues for model costs#2169icecrasher321 merged 4 commits intostagingfrom
icecrasher321 merged 4 commits intostagingfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
Greptile OverviewGreptile SummaryRestores async execution support and fixes critical cost tracking issues for scheduled workflows.
The changes ensure proper cost tracking for failed executions and restore the ability to run workflows asynchronously for API, webhook, and schedule triggers. Confidence Score: 5/5
Important Files ChangedFile Analysis
Sequence DiagramsequenceDiagram
participant Client
participant API as Workflow Execute API
participant TriggerDev as Trigger.dev
participant Executor as Workflow Executor
participant Logger as Logging Session
participant TraceSpans as Trace Spans Builder
participant DB as Database
Note over Client,DB: Async Execution Flow (Restored)
Client->>API: POST /api/workflows/[id]/execute<br/>X-Execution-Mode: async
API->>API: Check isAsyncMode header
API->>TriggerDev: tasks.trigger('workflow-execution')
TriggerDev-->>API: Return handle with jobId
API-->>Client: 202 Accepted with jobId
Note over Client,DB: Schedule Execution with Error
TriggerDev->>Executor: Execute scheduled workflow
Executor->>Logger: safeStart()
Executor-->>TriggerDev: Execution fails with earlyError
TriggerDev->>TraceSpans: buildTraceSpans(executionResult)
TraceSpans-->>TriggerDev: Return traceSpans with cost data
TriggerDev->>Logger: safeCompleteWithError({traceSpans})
Logger->>Logger: calculateCostSummary(traceSpans)
Logger->>DB: Save execution log with costs
Note over Client,DB: Cost Tracking Fix
Logger->>Logger: Check if traceSpans provided
alt Has trace spans
Logger->>Logger: calculateCostSummary(traceSpans)
Note over Logger: Uses input/output or<br/>prompt/completion tokens
else No trace spans
Logger->>Logger: Use BASE_EXECUTION_CHARGE only
end
Logger->>DB: Save with calculated costs
|
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
Async Executions got removed in new executor
Schedules, Webhooks, API executions are not tracking LLM cost when there's a downstream failure
Schedules execution errors — always surface as workflow error without trace psan
Type of Change
Testing
Tested manually
Checklist