Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion apps/sim/connectors/google-docs/google-docs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,8 @@ export const googleDocsConnector: ConnectorConfig = {

const maxDocs = sourceConfig.maxDocs ? Number(sourceConfig.maxDocs) : 0
const previouslyFetched = (syncContext?.totalDocsFetched as number) ?? 0
const remaining = maxDocs > 0 ? maxDocs - previouslyFetched : 0
/** Last-page precision: never ask Drive for more files than the cap still allows. */
const remaining = maxDocs > 0 ? Math.max(0, maxDocs - previouslyFetched) : 0
const pageSize = remaining > 0 ? Math.min(PAGE_SIZE, remaining) : PAGE_SIZE

/**
Expand Down
11 changes: 10 additions & 1 deletion apps/sim/lib/logs/execution/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1399,7 +1399,16 @@ export class ExecutionLogger implements IExecutionLoggerService {
actorUserId,
exactBillingContext
)
} catch {}
} catch (recordError) {
/* The safety net is the last thing between a completed run and an unbilled
one. Swallowing it left the only emitted line saying a notification check
had failed and was non-fatal. */
execLog.error('Failed to record execution usage — this run may be unbilled', {
error: recordError,
executionId,
workflowId: updatedLog.workflowId,
})
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Safety-net error log is unreachable dead code

Medium Severity

The new catch (recordError) block and its execLog.error message are unreachable for the described failure scenario. recordExecutionUsage wraps its entire body in an internal try/catch (line 1789) that swallows all errors and only logs via statsLog.error — it never throws to its caller. When the database is degraded, the safety-net call silently returns 0 and the catch (recordError) never fires. The only log emitted remains the misleading "non-fatal" warning at line 1412, so unbilled runs are not actually surfaced at error level as intended.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 9c2a46a. Configure here.

execLog.warn('Usage threshold notification check failed (non-fatal)', { error: e })
}

Expand Down
Loading