From c2f1b437808184368179978358c7c9c6e6749163 Mon Sep 17 00:00:00 2001 From: marius-kilocode Date: Fri, 4 Sep 2026 17:08:52 +0200 Subject: [PATCH 1/2] fix(vscode): retry marketplace publishing --- packages/kilo-vscode/script/publish.ts | 19 +++++++--- .../kilo-vscode/tests/unit/publish.test.ts | 38 +++++++++++++++++++ 2 files changed, 51 insertions(+), 6 deletions(-) create mode 100644 packages/kilo-vscode/tests/unit/publish.test.ts diff --git a/packages/kilo-vscode/script/publish.ts b/packages/kilo-vscode/script/publish.ts index 9f324249a849..cca3a9cdb1d8 100755 --- a/packages/kilo-vscode/script/publish.ts +++ b/packages/kilo-vscode/script/publish.ts @@ -43,15 +43,22 @@ const flag = prerelease ? ["--pre-release"] : [] for (const target of targets) { const vsixPath = join(outDir, `kilo-vscode-${target}.vsix`) console.log(`\nšŸš€ Publishing ${target} to VS Code Marketplace${prerelease ? " (pre-release)" : ""}...`) - await $`vsce publish ${flag} --packagePath ${vsixPath}` - console.log(` āœ… Published ${target} to VS Code Marketplace`) - - console.log(`\nšŸ“¤ Publishing ${target} to Open VSX${prerelease ? " (pre-release)" : ""}...`) - await retry(() => $`npx ovsx publish ${flag} --pat ${process.env.OPENVSX_TOKEN} --packagePath ${vsixPath}`, { + await retry(() => $`vsce publish ${flag} --skip-duplicate --packagePath ${vsixPath}`, { attempts: 3, delay: 10_000, - label: `ovsx publish ${target}`, + label: `vsce publish ${target}`, }) + console.log(` āœ… Published ${target} to VS Code Marketplace`) + + console.log(`\nšŸ“¤ Publishing ${target} to Open VSX${prerelease ? " (pre-release)" : ""}...`) + await retry( + () => $`npx ovsx publish ${flag} --skip-duplicate --pat ${process.env.OPENVSX_TOKEN} --packagePath ${vsixPath}`, + { + attempts: 3, + delay: 10_000, + label: `ovsx publish ${target}`, + }, + ) console.log(` āœ… Published ${target} to Open VSX`) } diff --git a/packages/kilo-vscode/tests/unit/publish.test.ts b/packages/kilo-vscode/tests/unit/publish.test.ts new file mode 100644 index 000000000000..9ef31a5602f3 --- /dev/null +++ b/packages/kilo-vscode/tests/unit/publish.test.ts @@ -0,0 +1,38 @@ +import { expect, test } from "bun:test" +import { Project, SyntaxKind } from "ts-morph" + +const project = new Project({ useInMemoryFileSystem: true }) +const source = project.createSourceFile( + "publish.ts", + await Bun.file(`${import.meta.dir}/../../script/publish.ts`).text(), +) + +test.each(["vsce publish", "npx ovsx publish"])("%s retries the same package and skips duplicates", (command) => { + const retry = source + .getDescendantsOfKind(SyntaxKind.CallExpression) + .find( + (call) => call.getExpression().getText() === "retry" && call.getArguments().at(0)?.getText().includes(command), + ) + expect(retry).toBeDefined() + + const shell = retry + ?.getArguments() + .at(0) + ?.asKind(SyntaxKind.ArrowFunction) + ?.getBody() + .asKind(SyntaxKind.TaggedTemplateExpression) + expect(shell?.getTag().getText()).toBe("$") + expect(shell?.getTemplate().getText()).toContain("${flag} --skip-duplicate") + expect(shell?.getTemplate().getText()).toContain("--packagePath ${vsixPath}") + + const options = retry?.getArguments().at(1)?.asKind(SyntaxKind.ObjectLiteralExpression) + const value = (name: string) => + options + ?.getProperty(name) + ?.asKind(SyntaxKind.PropertyAssignment) + ?.getInitializer() + ?.asKind(SyntaxKind.NumericLiteral) + ?.getLiteralValue() + expect(value("attempts")).toBe(3) + expect(value("delay")).toBe(10_000) +}) From c538f9e090902d573e9f388c295183689d35ae81 Mon Sep 17 00:00:00 2001 From: marius-kilocode Date: Fri, 4 Sep 2026 17:45:27 +0200 Subject: [PATCH 2/2] fix(vscode): back off between publish retries --- packages/kilo-vscode/script/publish.ts | 9 +++++---- packages/kilo-vscode/tests/unit/publish.test.ts | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/kilo-vscode/script/publish.ts b/packages/kilo-vscode/script/publish.ts index cca3a9cdb1d8..aef1e5fab43f 100755 --- a/packages/kilo-vscode/script/publish.ts +++ b/packages/kilo-vscode/script/publish.ts @@ -45,7 +45,7 @@ for (const target of targets) { console.log(`\nšŸš€ Publishing ${target} to VS Code Marketplace${prerelease ? " (pre-release)" : ""}...`) await retry(() => $`vsce publish ${flag} --skip-duplicate --packagePath ${vsixPath}`, { attempts: 3, - delay: 10_000, + delay: 30_000, label: `vsce publish ${target}`, }) console.log(` āœ… Published ${target} to VS Code Marketplace`) @@ -55,7 +55,7 @@ for (const target of targets) { () => $`npx ovsx publish ${flag} --skip-duplicate --pat ${process.env.OPENVSX_TOKEN} --packagePath ${vsixPath}`, { attempts: 3, - delay: 10_000, + delay: 30_000, label: `ovsx publish ${target}`, }, ) @@ -76,8 +76,9 @@ async function retry(fn: () => Promise, opts: { attempts: number; delay: n return await fn() } catch (err) { if (i === opts.attempts) throw err - console.warn(` āš ļø ${opts.label} failed (attempt ${i}/${opts.attempts}), retrying in ${opts.delay / 1000}s...`) - await new Promise((r) => setTimeout(r, opts.delay)) + const delay = opts.delay * 2 ** (i - 1) + console.warn(` āš ļø ${opts.label} failed (attempt ${i}/${opts.attempts}), retrying in ${delay / 1000}s...`) + await new Promise((r) => setTimeout(r, delay)) } } throw new Error("unreachable") diff --git a/packages/kilo-vscode/tests/unit/publish.test.ts b/packages/kilo-vscode/tests/unit/publish.test.ts index 9ef31a5602f3..ef6d78a88454 100644 --- a/packages/kilo-vscode/tests/unit/publish.test.ts +++ b/packages/kilo-vscode/tests/unit/publish.test.ts @@ -34,5 +34,5 @@ test.each(["vsce publish", "npx ovsx publish"])("%s retries the same package and ?.asKind(SyntaxKind.NumericLiteral) ?.getLiteralValue() expect(value("attempts")).toBe(3) - expect(value("delay")).toBe(10_000) + expect(value("delay")).toBe(30_000) })