fix(cost): worker crash incremenental case#3885
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview Updates the affected unit test to pass cost data in the new nested shape so cost flush draining behavior is still exercised. Written by Cursor Bugbot for commit b540775. Configure here. |
Greptile SummaryThis PR fixes a bug in Key changes:
Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Executor
participant LoggingSession
participant DB
Executor->>LoggingSession: onBlockComplete(blockId, name, type, { endedAt, output: { cost, tokens, model, error } })
Note over LoggingSession: Extract blockOutput = output?.output
alt blockOutput.cost exists and > 0
LoggingSession->>LoggingSession: accumulatedCost += cost/tokens/model
LoggingSession-->>DB: flushAccumulatedCost() [fire-and-forget]
else no cost
LoggingSession-->>Executor: return (early exit)
end
alt Crash / completion failure
Executor->>LoggingSession: safeComplete() / safeCompleteWithError()
LoggingSession->>LoggingSession: completeWithCostOnlyLog() [fallback]
Note over LoggingSession: Uses accumulatedCost (now correctly populated)
LoggingSession->>DB: completeExecutionWithFinalization(costSummary)
end
Reviews (1): Last reviewed commit: "fix(cost): worker crash incremenental ca..." | Re-trigger Greptile |
Summary
Incremental cost tracking for crash case was incorrect. Only affects crash fallback.
Type of Change
Testing
Tested manually
Checklist