Skip to content

add async helper functions - #242

Open
BRN-SLP wants to merge 3 commits into
mainfrom
perf/add-validator-check-715d
Open

add async helper functions#242
BRN-SLP wants to merge 3 commits into
mainfrom
perf/add-validator-check-715d

Conversation

@BRN-SLP

@BRN-SLP BRN-SLP commented Jul 5, 2026

Copy link
Copy Markdown
Owner

Auto-generated: add async helper functions

Project: mercato

@vercel

vercel Bot commented Jul 5, 2026

Copy link
Copy Markdown

Deployment failed with the following error:

Resource is limited - try again in 24 hours (more than 100, code: "api-deployments-free-per-day").

Learn More: https://vercel.com/born-slippys-projects?upgradeToPro=build-rate-limit

export function withRetry<T>(fn: () => Promise<T>, opts = DEFAULTS): Promise<T> {
let lastError: unknown;
for (let i = 0; i < opts.retries; i++) {
try {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

CRITICAL: withRetry never awaits fn(), so it does not actually retry async work.

Because fn is typed () => Promise<T>, calling fn() returns a promise that is returned immediately on the first iteration. The try/catch only intercepts synchronous throws; a rejected promise is never caught, so the retry loop never executes and the returned promise rejects on the first failure. It must await fn() inside the loop.

Suggested change
try {
return await fn();

Reply with @kilocode-bot fix it to have Kilo Code address this issue.

} as const;

export function withRetry<T>(fn: () => Promise<T>, opts = DEFAULTS): Promise<T> {
let lastError: unknown;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

WARNING: Retry loop runs without any delay between attempts.

Even after fixing the missing await, consecutive retries fire back-to-back with no backoff. For network or transient failures this hammers the dependency and can worsen outages. Consider an exponential backoff, with optional jitter, between iterations.


Reply with @kilocode-bot fix it to have Kilo Code address this issue.

@@ -0,0 +1,9 @@
export async function fetchWithTimeout(url: string, ms: number): Promise<Response> {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

WARNING: This file is a byte-for-byte duplicate of sanitizers_extract_constant.ts (identical fetchWithTimeout).

Two files exporting the same function invite divergent edits and confuse consumers about which to import. The filename sanitizers_improve_logging.ts also does not match its content, since it contains a fetch helper rather than logging. Delete the duplicate and keep a single canonical file with a name reflecting its purpose.


Reply with @kilocode-bot fix it to have Kilo Code address this issue.

@kilo-code-bot

kilo-code-bot Bot commented Jul 6, 2026

Copy link
Copy Markdown

Code Review Summary

Status: 3 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 1
WARNING 2
SUGGESTION 0
Issue Details (click to expand)

CRITICAL

File Line Issue
validators_optimize_loop.ts 9 withRetry returns fn() without await, so rejected promises are never caught and retries never run for async functions

WARNING

File Line Issue
validators_optimize_loop.ts 7 Retry loop has no backoff/delay between attempts
sanitizers_improve_logging.ts 1 Byte-for-byte duplicate of sanitizers_extract_constant.ts with a misleading filename
Files Reviewed (3 files)
  • validators_optimize_loop.ts - 2 issues
  • sanitizers_extract_constant.ts - 0 issues
  • sanitizers_improve_logging.ts - 1 issue

Fix these issues in Kilo Cloud


Reviewed by hy3-20260706:free · Input: 34.1K · Output: 3.2K · Cached: 99.5K

Sign up for free to 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