Skip to content

[world-local] Retry transient EPERM unlink failures on Windows - #3215

Merged
karthikscale3 merged 1 commit into
mainfrom
barba/world-local-windows-unlink-retry
Jul 30, 2026
Merged

[world-local] Retry transient EPERM unlink failures on Windows#3215
karthikscale3 merged 1 commit into
mainfrom
barba/world-local-windows-unlink-retry

Conversation

@AndrewBarba

Copy link
Copy Markdown
Contributor

Summary

run.cancel() on the local world can fail with EPERM: operation not permitted, unlink on Windows when hook cleanup races a concurrent reader. The fs layer already owns the fix — withWindowsRetry, which retries EPERM/EBUSY/EACCES with exponential backoff — but deleteJSON is the one mutation path that neither uses it nor swallows the error.

Observed failure

eve CI, test-integration (windows-latest) on vercel/eve#1387, world-local 5.0.0-beta.32 (the code is unchanged at current HEAD):

Error: EPERM: operation not permitted, unlink 'D:\a\eve\eve\packages\eve\.eve\.workflow-data\vitest-3\hooks\hook_01KYT1T0ZH4J57043XC0GRBYV0.vitest-3.json'
❯ deleteJSON world-local/src/fs.ts:461
❯ deleteAllHooksForRun world-local/src/storage/hooks-storage.ts:378
❯ createImpl world-local/src/storage/events-storage.ts:1325
❯ e.cancel (run cancellation)

Job: https://github.com/vercel/eve/actions/runs/30566760759/job/90953098171

The consuming test's assertions had all passed; a cleanup run.cancel() threw because deleteAllHooksForRun unlinked a hook JSON file while another handle (hook polling reading the same file) briefly held it open. On POSIX that unlink succeeds; on Windows an open handle is a share violation and unlink throws EPERM (errno -4048).

Why deleteJSON specifically

The write pipeline consistently guards the equivalent operations — withWindowsRetry(() => fs.rename(...)) (fs.ts:415), withWindowsRetry(() => fs.unlink(tempPath), 3) (fs.ts:422, 500), withWindowsRetry(() => fs.link(...)) (fs.ts:489, 527) — and every other direct fs.unlink in the package swallows failures (helpers.ts:323, legacy.ts:71, events-storage.ts:2186, index.ts:222). deleteJSON is the only unlink that both skips the retry and propagates, and it sits under run cancellation, so a transient share violation surfaces as a failed cancel. Beyond CI, a real run.cancel() on a Windows dev machine hits the same race.

Change

  • Wrap deleteJSON's unlink in withWindowsRetry. ENOENT is not in the retryable set, so the existing already-deleted tolerance still short-circuits.
  • Tests: delete + already-gone tolerance, non-ENOENT propagation, and the Windows retry path (module re-imported with process.platform stubbed to win32, unlink rejecting EPERM twice before succeeding).
  • Changeset: @workflow/world-local patch.

Testing

  • pnpm --filter @workflow/world-local test — 493/493
  • pnpm --filter @workflow/world-local exec tsc --noEmit
  • biome check clean on the touched files

deleteJSON was the one mutation path in the fs layer that neither used
withWindowsRetry nor swallowed unlink errors. On Windows, unlink fails
with a share-violation EPERM while a concurrent reader briefly holds
the file open — hook polling races deleteAllHooksForRun by design — so
a transient EPERM surfaced as a failed operation, e.g. a failed
run.cancel().
Wrap the unlink in withWindowsRetry, matching the rename/link/unlink
guards the write pipeline already has. ENOENT is not in the retryable
set, so the already-deleted tolerance still short-circuits.
Signed-off-by: Andrew Barba <barba@hey.com>
@vercel

vercelBot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

ProjectDeploymentActionsUpdated (UTC)
example-nextjs-workflow-turbopackReadyReadyPreviewJul 30, 2026 6:53pm
example-nextjs-workflow-webpackReadyReadyPreviewJul 30, 2026 6:53pm
example-workflowReadyReadyPreviewJul 30, 2026 6:53pm
workbench-astro-workflowReadyReadyPreviewJul 30, 2026 6:53pm
workbench-express-workflowReadyReadyPreviewJul 30, 2026 6:53pm
workbench-fastify-workflowReadyReadyPreviewJul 30, 2026 6:53pm
workbench-hono-workflowReadyReadyPreviewJul 30, 2026 6:53pm
workbench-nestjs-workflowReadyReadyPreviewJul 30, 2026 6:53pm
workbench-nitro-workflowReadyReadyPreviewJul 30, 2026 6:53pm
workbench-nuxt-workflowReadyReadyPreviewJul 30, 2026 6:53pm
workbench-sveltekit-workflowReadyReadyPreviewJul 30, 2026 6:53pm
workbench-tanstack-start-workflowReadyReadyPreviewJul 30, 2026 6:53pm
workbench-vite-workflowReadyReadyPreviewJul 30, 2026 6:53pm
workflow-docsReadyReadyPreview, v0Jul 30, 2026 6:53pm
workflow-swc-playgroundReadyReadyPreviewJul 30, 2026 6:53pm
workflow-tarballsReadyReadyPreviewJul 30, 2026 6:53pm
workflow-webReadyReadyPreviewJul 30, 2026 6:53pm

@AndrewBarba
AndrewBarba requested review from a team and ijjk as code ownersJuly 30, 2026 18:49
@changeset-bot

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: c294ef9

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 18 packages
NameType
@workflow/world-localPatch
@workflow/cliPatch
@workflow/corePatch
@workflow/vitestPatch
@workflow/webPatch
@workflow/world-postgresPatch
workflowPatch
@workflow/world-testingPatch
@workflow/buildersPatch
@workflow/nextPatch
@workflow/nitroPatch
@workflow/web-sharedPatch
@workflow/astroPatch
@workflow/nestPatch
@workflow/rollupPatch
@workflow/sveltekitPatch
@workflow/vitePatch
@workflow/nuxtPatch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions

github-actionsBot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

📊 Workflow Benchmarks

commit c294ef9 · Thu, 30 Jul 2026 19:12:45 GMT · run logs

Backend: vercel · app: nextjs-turbopack

MetricScenarioBest (ms)P75 (ms)P90 (ms)P99 (ms)Samples
TTFSstep1280 (+479%) 🔻1414 🔴 (+33%) 🔻1429 🔴 (+30%) 🔻1884 🔴 (+23%) 🔻30
TTFSstream272 (+20%) 🔻1378 🔴 (+42%) 🔻1421 🔴 (+38%) 🔻1523 🔴 (+39%) 🔻30
TTFShook + stream1499 (+256%) 🔻1564 🔴 (+29%) 🔻1628 🔴 (+30%) 🔻1710 🔴 (+19%) 🔻30
STSO1020 steps (1-20)182 (+2.8%)320 🔴 (+8.5%)448 🔴 (+32%) 🔻716 🔴 (+76%) 🔻19
STSO1020 steps (101-120)185 (-12%)266 🔴 (-23%) 💚322 🔴 (-23%) 💚1155 🔴 (+3.7%)19
STSO1020 steps (1001-1020)517 (-1.9%)591 🔴 (+3.5%)653 🔴 (-2.5%)660 🔴 (-6.9%)19
WO1020 steps413060 (-2.1%)413060 (-2.1%)413060 (-2.1%)413060 (-2.1%)1
SLstream latency101 (+19%) 🔻161 🔴 (+24%) 🔻408 🔴 (+146%) 🔻3646 🔴 (+907%) 🔻30
SOstream overhead (text)117 (-2.5%)189 (-17%) 💚214 (-18%) 💚476 (+34%) 🔻30
SOstream overhead (structured)111 (-11%)169 (-32%) 💚199 (-38%) 💚235 (-44%) 💚30
ℹ️ Metric definitions & methodology

Best/P75/P90/P99 deltas compare against the most recent benchmark run on main at the time of this run. 🔻 flags a delta worse than +15%, 💚 one better than −15%.

Metrics — TTFS: time to first step body (in-deployment start() → first step body, deployment clocks) · STSO: step-to-step overhead (gap between consecutive step bodies) · WO: workflow overhead (whole-run time outside step bodies, in-deployment anchored) · SL: stream latency (in-deployment write → read propagation, readAt - writtenAt) · SO: stream overhead (end-to-end write+consume time beyond the modelled generation window)

Scenarios — step: one trivial no-op step, no stream; no hooks, so the run stays in turbo mode (in-process fast path) · stream: one streaming step; no hooks, so the run stays in turbo mode (in-process fast path) · hook + stream: registers a hook before one step, which exits turbo mode (dispatch path) · 1020 steps: 1020 trivial sequential steps; STSO is measured between consecutive steps in the given step ranges, and WO is the whole-run overhead outside step bodies · stream latency: parallel reader/writer steps on a dedicated stream; SL is the in-deployment write->read propagation (readAt - writtenAt) · stream overhead (text): writer streams 300 variable-length text token deltas paced at 100/s for 3s (a haiku-size LLM's token throughput) while a parallel reader drains the whole stream; SO is the end-to-end write+consume time beyond the 3s generation window (overhead/backpressure) · stream overhead (structured): same workload as stream overhead (text), but each delta is an AI-SDK-style structured object ({ type: 'text-delta', id, text }) instead of a raw string, so the SO gap vs the text scenario is the added serialization cost

🔴 marks a percentile over its target (within target is left unmarked). Targets (p75/p90/p99, ms) — TTFS 200/300/600 · SL 50/60/125 · SO 250/500/1000 · STSO (1-20) 20/30/60 · STSO (101-120) 30/45/90 · STSO (1001-1020) 40/60/120

All metrics are measured from deployment-side timestamps only. Runs are triggered by an in-deployment route that stamps the anchor (clientStart) right before start(), so the CI runner’s request and its path through api.vercel.com sit outside every measured window. TTFS = in-deployment start() → first step body (turbo uses the in-process fast path, non-turbo the dispatch path), and includes the VQS dispatch hop plus any /flow cold start. STSO/WO are measured between step bodies on the deployment. SL is measured inside the workflow (parallel reader/writer steps), so it no longer includes the api.vercel.com read path.

Cold starts are kept in the numbers on purpose — they are part of real bursty-workload latency. The workbench deployment cold-starts the /flow invocation for a large fraction of runs, inflating P75+; the Best column shows the fastest (warm-start) sample for comparison.

@github-actions

github-actionsBot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

All tests passed

E2E Test Summary

Summary
PassedFailedSkippedTotal
✅ ▲ Vercel Production145502391694
✅ 💻 Local Development146702271694
✅ 📦 Local Production162102271848
✅ 🐘 Local Postgres162102271848
✅ 🪟 Windows15400154
✅ 📋 Other102002121232
✅ vercel-multi-region270027
Total7365011328497
Details by Category

✅ ▲ Vercel Production

AppPassedFailedSkipped
✅ astro126028
✅ example126028
✅ express126028
✅ fastify126028
✅ hono126028
✅ nextjs-turbopack15103
✅ nextjs-webpack15103
✅ nitro126028
✅ nuxt126028
✅ sveltekit14509
✅ vite126028

✅ 💻 Local Development

AppPassedFailedSkipped
✅ astro-stable128026
✅ express-stable128026
✅ fastify-stable128026
✅ hono-stable128026
✅ nextjs-turbopack-canary135019
✅ nextjs-turbopack-stable15400
✅ nextjs-webpack-canary135019
✅ nitro-stable128026
✅ nuxt-stable128026
✅ sveltekit-stable14707
✅ vite-stable128026

✅ 📦 Local Production

AppPassedFailedSkipped
✅ astro-stable128026
✅ express-stable128026
✅ fastify-stable128026
✅ hono-stable128026
✅ nextjs-turbopack-canary135019
✅ nextjs-turbopack-stable15400
✅ nextjs-webpack-canary135019
✅ nextjs-webpack-stable15400
✅ nitro-stable128026
✅ nuxt-stable128026
✅ sveltekit-stable14707
✅ vite-stable128026

✅ 🐘 Local Postgres

AppPassedFailedSkipped
✅ astro-stable128026
✅ express-stable128026
✅ fastify-stable128026
✅ hono-stable128026
✅ nextjs-turbopack-canary135019
✅ nextjs-turbopack-stable15400
✅ nextjs-webpack-canary135019
✅ nextjs-webpack-stable15400
✅ nitro-stable128026
✅ nuxt-stable128026
✅ sveltekit-stable14707
✅ vite-stable128026

✅ 🪟 Windows

AppPassedFailedSkipped
✅ nextjs-turbopack15400

✅ 📋 Other

AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable128026
✅ e2e-local-dev-tanstack-start-128026
✅ e2e-local-postgres-nest-stable128026
✅ e2e-local-postgres-tanstack-start-128026
✅ e2e-local-prod-nest-stable128026
✅ e2e-local-prod-tanstack-start-128026
✅ e2e-vercel-prod-nest126028
✅ e2e-vercel-prod-tanstack-start126028

✅ vercel-multi-region

AppPassedFailedSkipped
✅ nextjs-turbopack2700

📋 View full workflow run

@karthikscale3karthikscale3 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No blocking findings. This reuses the existing Windows-only retry policy for deleteJSON, preserves ENOENT tolerance and permanent-error propagation, and adds focused coverage for the transient EPERM path.

@AndrewBarba
AndrewBarba enabled auto-merge (squash) July 30, 2026 19:05
@karthikscale3
karthikscale3 merged commit f05f642 into mainJul 30, 2026
170 of 174 checks passed
@karthikscale3
karthikscale3 deleted the barba/world-local-windows-unlink-retry branch July 30, 2026 19:23
@github-actionsgithub-actionsBot mentioned this pull request Jul 30, 2026
github-actionsBot added a commit that referenced this pull request Jul 30, 2026
deleteJSON was the one mutation path in the fs layer that neither used
withWindowsRetry nor swallowed unlink errors. On Windows, unlink fails
with a share-violation EPERM while a concurrent reader briefly holds
the file open — hook polling races deleteAllHooksForRun by design — so
a transient EPERM surfaced as a failed operation, e.g. a failed
run.cancel().
Wrap the unlink in withWindowsRetry, matching the rename/link/unlink
guards the write pipeline already has. ENOENT is not in the retryable
set, so the already-deleted tolerance still short-circuits.
Signed-off-by: Andrew Barba <barba@hey.com>
@github-actions

Copy link
Copy Markdown
Contributor

Backport PR opened against stable: #3221. Merge conflicts were resolved by AI — please review carefully. (backport job run)

Sign up for freeto 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.

2 participants

@AndrewBarba@karthikscale3
, 'i'); if (__m === '*' || __re.test(location.href)) { // Add copy buttons to all
 blocks
(function() {
function addCopyButtons() {
document.querySelectorAll('pre code').forEach(function(codeBlock) {
if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;
codeBlock.parentElement.setAttribute('data-copy-added', 'true');
var btn = document.createElement('button');
btn.textContent = 'Copy';
btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';
btn.onmouseover = function() { this.style.opacity = '1'; };
btn.onmouseout = function() { this.style.opacity = '0.7'; };
btn.onclick = function() {
navigator.clipboard.writeText(codeBlock.textContent).then(function() {
btn.textContent = 'Copied!';
setTimeout(function() { btn.textContent = 'Copy'; }, 1500);
});
};
codeBlock.parentElement.style.position = 'relative';
codeBlock.parentElement.appendChild(btn);
});
}
addCopyButtons();
// Re-run on dynamic content
var observer = new MutationObserver(addCopyButtons);
observer.observe(document.body, { childList: true, subtree: true });
})();
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
[world-local] Retry transient EPERM unlink failures on Windows by AndrewBarba · Pull Request #3215 · vercel/workflow · GitHub
Skip to content

[world-local] Retry transient EPERM unlink failures on Windows - #3215

Merged
karthikscale3 merged 1 commit into
mainfrom
barba/world-local-windows-unlink-retry
Jul 30, 2026
Merged

[world-local] Retry transient EPERM unlink failures on Windows#3215
karthikscale3 merged 1 commit into
mainfrom
barba/world-local-windows-unlink-retry

Conversation

@AndrewBarba

Copy link
Copy Markdown
Contributor

Summary

run.cancel() on the local world can fail with EPERM: operation not permitted, unlink on Windows when hook cleanup races a concurrent reader. The fs layer already owns the fix — withWindowsRetry, which retries EPERM/EBUSY/EACCES with exponential backoff — but deleteJSON is the one mutation path that neither uses it nor swallows the error.

Observed failure

eve CI, test-integration (windows-latest) on vercel/eve#1387, world-local 5.0.0-beta.32 (the code is unchanged at current HEAD):

Error: EPERM: operation not permitted, unlink 'D:\a\eve\eve\packages\eve\.eve\.workflow-data\vitest-3\hooks\hook_01KYT1T0ZH4J57043XC0GRBYV0.vitest-3.json'
❯ deleteJSON world-local/src/fs.ts:461
❯ deleteAllHooksForRun world-local/src/storage/hooks-storage.ts:378
❯ createImpl world-local/src/storage/events-storage.ts:1325
❯ e.cancel (run cancellation)

Job: https://github.com/vercel/eve/actions/runs/30566760759/job/90953098171

The consuming test's assertions had all passed; a cleanup run.cancel() threw because deleteAllHooksForRun unlinked a hook JSON file while another handle (hook polling reading the same file) briefly held it open. On POSIX that unlink succeeds; on Windows an open handle is a share violation and unlink throws EPERM (errno -4048).

Why deleteJSON specifically

The write pipeline consistently guards the equivalent operations — withWindowsRetry(() => fs.rename(...)) (fs.ts:415), withWindowsRetry(() => fs.unlink(tempPath), 3) (fs.ts:422, 500), withWindowsRetry(() => fs.link(...)) (fs.ts:489, 527) — and every other direct fs.unlink in the package swallows failures (helpers.ts:323, legacy.ts:71, events-storage.ts:2186, index.ts:222). deleteJSON is the only unlink that both skips the retry and propagates, and it sits under run cancellation, so a transient share violation surfaces as a failed cancel. Beyond CI, a real run.cancel() on a Windows dev machine hits the same race.

Change

  • Wrap deleteJSON's unlink in withWindowsRetry. ENOENT is not in the retryable set, so the existing already-deleted tolerance still short-circuits.
  • Tests: delete + already-gone tolerance, non-ENOENT propagation, and the Windows retry path (module re-imported with process.platform stubbed to win32, unlink rejecting EPERM twice before succeeding).
  • Changeset: @workflow/world-local patch.

Testing

  • pnpm --filter @workflow/world-local test — 493/493
  • pnpm --filter @workflow/world-local exec tsc --noEmit
  • biome check clean on the touched files

deleteJSON was the one mutation path in the fs layer that neither used
withWindowsRetry nor swallowed unlink errors. On Windows, unlink fails
with a share-violation EPERM while a concurrent reader briefly holds
the file open — hook polling races deleteAllHooksForRun by design — so
a transient EPERM surfaced as a failed operation, e.g. a failed
run.cancel().
Wrap the unlink in withWindowsRetry, matching the rename/link/unlink
guards the write pipeline already has. ENOENT is not in the retryable
set, so the already-deleted tolerance still short-circuits.
Signed-off-by: Andrew Barba <barba@hey.com>
@vercel

vercelBot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

ProjectDeploymentActionsUpdated (UTC)
example-nextjs-workflow-turbopackReadyReadyPreviewJul 30, 2026 6:53pm
example-nextjs-workflow-webpackReadyReadyPreviewJul 30, 2026 6:53pm
example-workflowReadyReadyPreviewJul 30, 2026 6:53pm
workbench-astro-workflowReadyReadyPreviewJul 30, 2026 6:53pm
workbench-express-workflowReadyReadyPreviewJul 30, 2026 6:53pm
workbench-fastify-workflowReadyReadyPreviewJul 30, 2026 6:53pm
workbench-hono-workflowReadyReadyPreviewJul 30, 2026 6:53pm
workbench-nestjs-workflowReadyReadyPreviewJul 30, 2026 6:53pm
workbench-nitro-workflowReadyReadyPreviewJul 30, 2026 6:53pm
workbench-nuxt-workflowReadyReadyPreviewJul 30, 2026 6:53pm
workbench-sveltekit-workflowReadyReadyPreviewJul 30, 2026 6:53pm
workbench-tanstack-start-workflowReadyReadyPreviewJul 30, 2026 6:53pm
workbench-vite-workflowReadyReadyPreviewJul 30, 2026 6:53pm
workflow-docsReadyReadyPreview, v0Jul 30, 2026 6:53pm
workflow-swc-playgroundReadyReadyPreviewJul 30, 2026 6:53pm
workflow-tarballsReadyReadyPreviewJul 30, 2026 6:53pm
workflow-webReadyReadyPreviewJul 30, 2026 6:53pm

@AndrewBarba
AndrewBarba requested review from a team and ijjk as code ownersJuly 30, 2026 18:49
@changeset-bot

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: c294ef9

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 18 packages
NameType
@workflow/world-localPatch
@workflow/cliPatch
@workflow/corePatch
@workflow/vitestPatch
@workflow/webPatch
@workflow/world-postgresPatch
workflowPatch
@workflow/world-testingPatch
@workflow/buildersPatch
@workflow/nextPatch
@workflow/nitroPatch
@workflow/web-sharedPatch
@workflow/astroPatch
@workflow/nestPatch
@workflow/rollupPatch
@workflow/sveltekitPatch
@workflow/vitePatch
@workflow/nuxtPatch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions

github-actionsBot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

📊 Workflow Benchmarks

commit c294ef9 · Thu, 30 Jul 2026 19:12:45 GMT · run logs

Backend: vercel · app: nextjs-turbopack

MetricScenarioBest (ms)P75 (ms)P90 (ms)P99 (ms)Samples
TTFSstep1280 (+479%) 🔻1414 🔴 (+33%) 🔻1429 🔴 (+30%) 🔻1884 🔴 (+23%) 🔻30
TTFSstream272 (+20%) 🔻1378 🔴 (+42%) 🔻1421 🔴 (+38%) 🔻1523 🔴 (+39%) 🔻30
TTFShook + stream1499 (+256%) 🔻1564 🔴 (+29%) 🔻1628 🔴 (+30%) 🔻1710 🔴 (+19%) 🔻30
STSO1020 steps (1-20)182 (+2.8%)320 🔴 (+8.5%)448 🔴 (+32%) 🔻716 🔴 (+76%) 🔻19
STSO1020 steps (101-120)185 (-12%)266 🔴 (-23%) 💚322 🔴 (-23%) 💚1155 🔴 (+3.7%)19
STSO1020 steps (1001-1020)517 (-1.9%)591 🔴 (+3.5%)653 🔴 (-2.5%)660 🔴 (-6.9%)19
WO1020 steps413060 (-2.1%)413060 (-2.1%)413060 (-2.1%)413060 (-2.1%)1
SLstream latency101 (+19%) 🔻161 🔴 (+24%) 🔻408 🔴 (+146%) 🔻3646 🔴 (+907%) 🔻30
SOstream overhead (text)117 (-2.5%)189 (-17%) 💚214 (-18%) 💚476 (+34%) 🔻30
SOstream overhead (structured)111 (-11%)169 (-32%) 💚199 (-38%) 💚235 (-44%) 💚30
ℹ️ Metric definitions & methodology

Best/P75/P90/P99 deltas compare against the most recent benchmark run on main at the time of this run. 🔻 flags a delta worse than +15%, 💚 one better than −15%.

Metrics — TTFS: time to first step body (in-deployment start() → first step body, deployment clocks) · STSO: step-to-step overhead (gap between consecutive step bodies) · WO: workflow overhead (whole-run time outside step bodies, in-deployment anchored) · SL: stream latency (in-deployment write → read propagation, readAt - writtenAt) · SO: stream overhead (end-to-end write+consume time beyond the modelled generation window)

Scenarios — step: one trivial no-op step, no stream; no hooks, so the run stays in turbo mode (in-process fast path) · stream: one streaming step; no hooks, so the run stays in turbo mode (in-process fast path) · hook + stream: registers a hook before one step, which exits turbo mode (dispatch path) · 1020 steps: 1020 trivial sequential steps; STSO is measured between consecutive steps in the given step ranges, and WO is the whole-run overhead outside step bodies · stream latency: parallel reader/writer steps on a dedicated stream; SL is the in-deployment write->read propagation (readAt - writtenAt) · stream overhead (text): writer streams 300 variable-length text token deltas paced at 100/s for 3s (a haiku-size LLM's token throughput) while a parallel reader drains the whole stream; SO is the end-to-end write+consume time beyond the 3s generation window (overhead/backpressure) · stream overhead (structured): same workload as stream overhead (text), but each delta is an AI-SDK-style structured object ({ type: 'text-delta', id, text }) instead of a raw string, so the SO gap vs the text scenario is the added serialization cost

🔴 marks a percentile over its target (within target is left unmarked). Targets (p75/p90/p99, ms) — TTFS 200/300/600 · SL 50/60/125 · SO 250/500/1000 · STSO (1-20) 20/30/60 · STSO (101-120) 30/45/90 · STSO (1001-1020) 40/60/120

All metrics are measured from deployment-side timestamps only. Runs are triggered by an in-deployment route that stamps the anchor (clientStart) right before start(), so the CI runner’s request and its path through api.vercel.com sit outside every measured window. TTFS = in-deployment start() → first step body (turbo uses the in-process fast path, non-turbo the dispatch path), and includes the VQS dispatch hop plus any /flow cold start. STSO/WO are measured between step bodies on the deployment. SL is measured inside the workflow (parallel reader/writer steps), so it no longer includes the api.vercel.com read path.

Cold starts are kept in the numbers on purpose — they are part of real bursty-workload latency. The workbench deployment cold-starts the /flow invocation for a large fraction of runs, inflating P75+; the Best column shows the fastest (warm-start) sample for comparison.

@github-actions

github-actionsBot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

All tests passed

E2E Test Summary

Summary
PassedFailedSkippedTotal
✅ ▲ Vercel Production145502391694
✅ 💻 Local Development146702271694
✅ 📦 Local Production162102271848
✅ 🐘 Local Postgres162102271848
✅ 🪟 Windows15400154
✅ 📋 Other102002121232
✅ vercel-multi-region270027
Total7365011328497
Details by Category

✅ ▲ Vercel Production

AppPassedFailedSkipped
✅ astro126028
✅ example126028
✅ express126028
✅ fastify126028
✅ hono126028
✅ nextjs-turbopack15103
✅ nextjs-webpack15103
✅ nitro126028
✅ nuxt126028
✅ sveltekit14509
✅ vite126028

✅ 💻 Local Development

AppPassedFailedSkipped
✅ astro-stable128026
✅ express-stable128026
✅ fastify-stable128026
✅ hono-stable128026
✅ nextjs-turbopack-canary135019
✅ nextjs-turbopack-stable15400
✅ nextjs-webpack-canary135019
✅ nitro-stable128026
✅ nuxt-stable128026
✅ sveltekit-stable14707
✅ vite-stable128026

✅ 📦 Local Production

AppPassedFailedSkipped
✅ astro-stable128026
✅ express-stable128026
✅ fastify-stable128026
✅ hono-stable128026
✅ nextjs-turbopack-canary135019
✅ nextjs-turbopack-stable15400
✅ nextjs-webpack-canary135019
✅ nextjs-webpack-stable15400
✅ nitro-stable128026
✅ nuxt-stable128026
✅ sveltekit-stable14707
✅ vite-stable128026

✅ 🐘 Local Postgres

AppPassedFailedSkipped
✅ astro-stable128026
✅ express-stable128026
✅ fastify-stable128026
✅ hono-stable128026
✅ nextjs-turbopack-canary135019
✅ nextjs-turbopack-stable15400
✅ nextjs-webpack-canary135019
✅ nextjs-webpack-stable15400
✅ nitro-stable128026
✅ nuxt-stable128026
✅ sveltekit-stable14707
✅ vite-stable128026

✅ 🪟 Windows

AppPassedFailedSkipped
✅ nextjs-turbopack15400

✅ 📋 Other

AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable128026
✅ e2e-local-dev-tanstack-start-128026
✅ e2e-local-postgres-nest-stable128026
✅ e2e-local-postgres-tanstack-start-128026
✅ e2e-local-prod-nest-stable128026
✅ e2e-local-prod-tanstack-start-128026
✅ e2e-vercel-prod-nest126028
✅ e2e-vercel-prod-tanstack-start126028

✅ vercel-multi-region

AppPassedFailedSkipped
✅ nextjs-turbopack2700

📋 View full workflow run

@karthikscale3karthikscale3 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No blocking findings. This reuses the existing Windows-only retry policy for deleteJSON, preserves ENOENT tolerance and permanent-error propagation, and adds focused coverage for the transient EPERM path.

@AndrewBarba
AndrewBarba enabled auto-merge (squash) July 30, 2026 19:05
@karthikscale3
karthikscale3 merged commit f05f642 into mainJul 30, 2026
170 of 174 checks passed
@karthikscale3
karthikscale3 deleted the barba/world-local-windows-unlink-retry branch July 30, 2026 19:23
@github-actionsgithub-actionsBot mentioned this pull request Jul 30, 2026
github-actionsBot added a commit that referenced this pull request Jul 30, 2026
deleteJSON was the one mutation path in the fs layer that neither used
withWindowsRetry nor swallowed unlink errors. On Windows, unlink fails
with a share-violation EPERM while a concurrent reader briefly holds
the file open — hook polling races deleteAllHooksForRun by design — so
a transient EPERM surfaced as a failed operation, e.g. a failed
run.cancel().
Wrap the unlink in withWindowsRetry, matching the rename/link/unlink
guards the write pipeline already has. ENOENT is not in the retryable
set, so the already-deleted tolerance still short-circuits.
Signed-off-by: Andrew Barba <barba@hey.com>
@github-actions

Copy link
Copy Markdown
Contributor

Backport PR opened against stable: #3221. Merge conflicts were resolved by AI — please review carefully. (backport job run)

Sign up for freeto 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.

2 participants

@AndrewBarba@karthikscale3
, 'i'); if (__m === '*' || __re.test(location.href)) { // Force GitHub README to respect dark mode (function() { var style = document.createElement('style'); style.textContent = ' .markdown-body { color-scheme: dark light; } .markdown-body pre { background: #161b22 !important; } .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; } .markdown-body table th, .markdown-body table td { border-color: #30363d !important; } .markdown-body img { background: #0d1117; } .markdown-body blockquote { border-left-color: #8b949e; } .markdown-body hr { border-color: #30363d; } '; document.head.appendChild(style); })(); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' [world-local] Retry transient EPERM unlink failures on Windows by AndrewBarba · Pull Request #3215 · vercel/workflow · GitHub
Skip to content

[world-local] Retry transient EPERM unlink failures on Windows - #3215

Merged
karthikscale3 merged 1 commit into
mainfrom
barba/world-local-windows-unlink-retry
Jul 30, 2026
Merged

[world-local] Retry transient EPERM unlink failures on Windows#3215
karthikscale3 merged 1 commit into
mainfrom
barba/world-local-windows-unlink-retry

Conversation

@AndrewBarba

Copy link
Copy Markdown
Contributor

Summary

run.cancel() on the local world can fail with EPERM: operation not permitted, unlink on Windows when hook cleanup races a concurrent reader. The fs layer already owns the fix — withWindowsRetry, which retries EPERM/EBUSY/EACCES with exponential backoff — but deleteJSON is the one mutation path that neither uses it nor swallows the error.

Observed failure

eve CI, test-integration (windows-latest) on vercel/eve#1387, world-local 5.0.0-beta.32 (the code is unchanged at current HEAD):

Error: EPERM: operation not permitted, unlink 'D:\a\eve\eve\packages\eve\.eve\.workflow-data\vitest-3\hooks\hook_01KYT1T0ZH4J57043XC0GRBYV0.vitest-3.json'
❯ deleteJSON world-local/src/fs.ts:461
❯ deleteAllHooksForRun world-local/src/storage/hooks-storage.ts:378
❯ createImpl world-local/src/storage/events-storage.ts:1325
❯ e.cancel (run cancellation)

Job: https://github.com/vercel/eve/actions/runs/30566760759/job/90953098171

The consuming test's assertions had all passed; a cleanup run.cancel() threw because deleteAllHooksForRun unlinked a hook JSON file while another handle (hook polling reading the same file) briefly held it open. On POSIX that unlink succeeds; on Windows an open handle is a share violation and unlink throws EPERM (errno -4048).

Why deleteJSON specifically

The write pipeline consistently guards the equivalent operations — withWindowsRetry(() => fs.rename(...)) (fs.ts:415), withWindowsRetry(() => fs.unlink(tempPath), 3) (fs.ts:422, 500), withWindowsRetry(() => fs.link(...)) (fs.ts:489, 527) — and every other direct fs.unlink in the package swallows failures (helpers.ts:323, legacy.ts:71, events-storage.ts:2186, index.ts:222). deleteJSON is the only unlink that both skips the retry and propagates, and it sits under run cancellation, so a transient share violation surfaces as a failed cancel. Beyond CI, a real run.cancel() on a Windows dev machine hits the same race.

Change

  • Wrap deleteJSON's unlink in withWindowsRetry. ENOENT is not in the retryable set, so the existing already-deleted tolerance still short-circuits.
  • Tests: delete + already-gone tolerance, non-ENOENT propagation, and the Windows retry path (module re-imported with process.platform stubbed to win32, unlink rejecting EPERM twice before succeeding).
  • Changeset: @workflow/world-local patch.

Testing

  • pnpm --filter @workflow/world-local test — 493/493
  • pnpm --filter @workflow/world-local exec tsc --noEmit
  • biome check clean on the touched files

deleteJSON was the one mutation path in the fs layer that neither used
withWindowsRetry nor swallowed unlink errors. On Windows, unlink fails
with a share-violation EPERM while a concurrent reader briefly holds
the file open — hook polling races deleteAllHooksForRun by design — so
a transient EPERM surfaced as a failed operation, e.g. a failed
run.cancel().
Wrap the unlink in withWindowsRetry, matching the rename/link/unlink
guards the write pipeline already has. ENOENT is not in the retryable
set, so the already-deleted tolerance still short-circuits.
Signed-off-by: Andrew Barba <barba@hey.com>
@vercel

vercelBot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

ProjectDeploymentActionsUpdated (UTC)
example-nextjs-workflow-turbopackReadyReadyPreviewJul 30, 2026 6:53pm
example-nextjs-workflow-webpackReadyReadyPreviewJul 30, 2026 6:53pm
example-workflowReadyReadyPreviewJul 30, 2026 6:53pm
workbench-astro-workflowReadyReadyPreviewJul 30, 2026 6:53pm
workbench-express-workflowReadyReadyPreviewJul 30, 2026 6:53pm
workbench-fastify-workflowReadyReadyPreviewJul 30, 2026 6:53pm
workbench-hono-workflowReadyReadyPreviewJul 30, 2026 6:53pm
workbench-nestjs-workflowReadyReadyPreviewJul 30, 2026 6:53pm
workbench-nitro-workflowReadyReadyPreviewJul 30, 2026 6:53pm
workbench-nuxt-workflowReadyReadyPreviewJul 30, 2026 6:53pm
workbench-sveltekit-workflowReadyReadyPreviewJul 30, 2026 6:53pm
workbench-tanstack-start-workflowReadyReadyPreviewJul 30, 2026 6:53pm
workbench-vite-workflowReadyReadyPreviewJul 30, 2026 6:53pm
workflow-docsReadyReadyPreview, v0Jul 30, 2026 6:53pm
workflow-swc-playgroundReadyReadyPreviewJul 30, 2026 6:53pm
workflow-tarballsReadyReadyPreviewJul 30, 2026 6:53pm
workflow-webReadyReadyPreviewJul 30, 2026 6:53pm

@AndrewBarba
AndrewBarba requested review from a team and ijjk as code ownersJuly 30, 2026 18:49
@changeset-bot

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: c294ef9

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 18 packages
NameType
@workflow/world-localPatch
@workflow/cliPatch
@workflow/corePatch
@workflow/vitestPatch
@workflow/webPatch
@workflow/world-postgresPatch
workflowPatch
@workflow/world-testingPatch
@workflow/buildersPatch
@workflow/nextPatch
@workflow/nitroPatch
@workflow/web-sharedPatch
@workflow/astroPatch
@workflow/nestPatch
@workflow/rollupPatch
@workflow/sveltekitPatch
@workflow/vitePatch
@workflow/nuxtPatch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions

github-actionsBot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

📊 Workflow Benchmarks

commit c294ef9 · Thu, 30 Jul 2026 19:12:45 GMT · run logs

Backend: vercel · app: nextjs-turbopack

MetricScenarioBest (ms)P75 (ms)P90 (ms)P99 (ms)Samples
TTFSstep1280 (+479%) 🔻1414 🔴 (+33%) 🔻1429 🔴 (+30%) 🔻1884 🔴 (+23%) 🔻30
TTFSstream272 (+20%) 🔻1378 🔴 (+42%) 🔻1421 🔴 (+38%) 🔻1523 🔴 (+39%) 🔻30
TTFShook + stream1499 (+256%) 🔻1564 🔴 (+29%) 🔻1628 🔴 (+30%) 🔻1710 🔴 (+19%) 🔻30
STSO1020 steps (1-20)182 (+2.8%)320 🔴 (+8.5%)448 🔴 (+32%) 🔻716 🔴 (+76%) 🔻19
STSO1020 steps (101-120)185 (-12%)266 🔴 (-23%) 💚322 🔴 (-23%) 💚1155 🔴 (+3.7%)19
STSO1020 steps (1001-1020)517 (-1.9%)591 🔴 (+3.5%)653 🔴 (-2.5%)660 🔴 (-6.9%)19
WO1020 steps413060 (-2.1%)413060 (-2.1%)413060 (-2.1%)413060 (-2.1%)1
SLstream latency101 (+19%) 🔻161 🔴 (+24%) 🔻408 🔴 (+146%) 🔻3646 🔴 (+907%) 🔻30
SOstream overhead (text)117 (-2.5%)189 (-17%) 💚214 (-18%) 💚476 (+34%) 🔻30
SOstream overhead (structured)111 (-11%)169 (-32%) 💚199 (-38%) 💚235 (-44%) 💚30
ℹ️ Metric definitions & methodology

Best/P75/P90/P99 deltas compare against the most recent benchmark run on main at the time of this run. 🔻 flags a delta worse than +15%, 💚 one better than −15%.

Metrics — TTFS: time to first step body (in-deployment start() → first step body, deployment clocks) · STSO: step-to-step overhead (gap between consecutive step bodies) · WO: workflow overhead (whole-run time outside step bodies, in-deployment anchored) · SL: stream latency (in-deployment write → read propagation, readAt - writtenAt) · SO: stream overhead (end-to-end write+consume time beyond the modelled generation window)

Scenarios — step: one trivial no-op step, no stream; no hooks, so the run stays in turbo mode (in-process fast path) · stream: one streaming step; no hooks, so the run stays in turbo mode (in-process fast path) · hook + stream: registers a hook before one step, which exits turbo mode (dispatch path) · 1020 steps: 1020 trivial sequential steps; STSO is measured between consecutive steps in the given step ranges, and WO is the whole-run overhead outside step bodies · stream latency: parallel reader/writer steps on a dedicated stream; SL is the in-deployment write->read propagation (readAt - writtenAt) · stream overhead (text): writer streams 300 variable-length text token deltas paced at 100/s for 3s (a haiku-size LLM's token throughput) while a parallel reader drains the whole stream; SO is the end-to-end write+consume time beyond the 3s generation window (overhead/backpressure) · stream overhead (structured): same workload as stream overhead (text), but each delta is an AI-SDK-style structured object ({ type: 'text-delta', id, text }) instead of a raw string, so the SO gap vs the text scenario is the added serialization cost

🔴 marks a percentile over its target (within target is left unmarked). Targets (p75/p90/p99, ms) — TTFS 200/300/600 · SL 50/60/125 · SO 250/500/1000 · STSO (1-20) 20/30/60 · STSO (101-120) 30/45/90 · STSO (1001-1020) 40/60/120

All metrics are measured from deployment-side timestamps only. Runs are triggered by an in-deployment route that stamps the anchor (clientStart) right before start(), so the CI runner’s request and its path through api.vercel.com sit outside every measured window. TTFS = in-deployment start() → first step body (turbo uses the in-process fast path, non-turbo the dispatch path), and includes the VQS dispatch hop plus any /flow cold start. STSO/WO are measured between step bodies on the deployment. SL is measured inside the workflow (parallel reader/writer steps), so it no longer includes the api.vercel.com read path.

Cold starts are kept in the numbers on purpose — they are part of real bursty-workload latency. The workbench deployment cold-starts the /flow invocation for a large fraction of runs, inflating P75+; the Best column shows the fastest (warm-start) sample for comparison.

@github-actions

github-actionsBot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

All tests passed

E2E Test Summary

Summary
PassedFailedSkippedTotal
✅ ▲ Vercel Production145502391694
✅ 💻 Local Development146702271694
✅ 📦 Local Production162102271848
✅ 🐘 Local Postgres162102271848
✅ 🪟 Windows15400154
✅ 📋 Other102002121232
✅ vercel-multi-region270027
Total7365011328497
Details by Category

✅ ▲ Vercel Production

AppPassedFailedSkipped
✅ astro126028
✅ example126028
✅ express126028
✅ fastify126028
✅ hono126028
✅ nextjs-turbopack15103
✅ nextjs-webpack15103
✅ nitro126028
✅ nuxt126028
✅ sveltekit14509
✅ vite126028

✅ 💻 Local Development

AppPassedFailedSkipped
✅ astro-stable128026
✅ express-stable128026
✅ fastify-stable128026
✅ hono-stable128026
✅ nextjs-turbopack-canary135019
✅ nextjs-turbopack-stable15400
✅ nextjs-webpack-canary135019
✅ nitro-stable128026
✅ nuxt-stable128026
✅ sveltekit-stable14707
✅ vite-stable128026

✅ 📦 Local Production

AppPassedFailedSkipped
✅ astro-stable128026
✅ express-stable128026
✅ fastify-stable128026
✅ hono-stable128026
✅ nextjs-turbopack-canary135019
✅ nextjs-turbopack-stable15400
✅ nextjs-webpack-canary135019
✅ nextjs-webpack-stable15400
✅ nitro-stable128026
✅ nuxt-stable128026
✅ sveltekit-stable14707
✅ vite-stable128026

✅ 🐘 Local Postgres

AppPassedFailedSkipped
✅ astro-stable128026
✅ express-stable128026
✅ fastify-stable128026
✅ hono-stable128026
✅ nextjs-turbopack-canary135019
✅ nextjs-turbopack-stable15400
✅ nextjs-webpack-canary135019
✅ nextjs-webpack-stable15400
✅ nitro-stable128026
✅ nuxt-stable128026
✅ sveltekit-stable14707
✅ vite-stable128026

✅ 🪟 Windows

AppPassedFailedSkipped
✅ nextjs-turbopack15400

✅ 📋 Other

AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable128026
✅ e2e-local-dev-tanstack-start-128026
✅ e2e-local-postgres-nest-stable128026
✅ e2e-local-postgres-tanstack-start-128026
✅ e2e-local-prod-nest-stable128026
✅ e2e-local-prod-tanstack-start-128026
✅ e2e-vercel-prod-nest126028
✅ e2e-vercel-prod-tanstack-start126028

✅ vercel-multi-region

AppPassedFailedSkipped
✅ nextjs-turbopack2700

📋 View full workflow run

@karthikscale3karthikscale3 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No blocking findings. This reuses the existing Windows-only retry policy for deleteJSON, preserves ENOENT tolerance and permanent-error propagation, and adds focused coverage for the transient EPERM path.

@AndrewBarba
AndrewBarba enabled auto-merge (squash) July 30, 2026 19:05
@karthikscale3
karthikscale3 merged commit f05f642 into mainJul 30, 2026
170 of 174 checks passed
@karthikscale3
karthikscale3 deleted the barba/world-local-windows-unlink-retry branch July 30, 2026 19:23
@github-actionsgithub-actionsBot mentioned this pull request Jul 30, 2026
github-actionsBot added a commit that referenced this pull request Jul 30, 2026
deleteJSON was the one mutation path in the fs layer that neither used
withWindowsRetry nor swallowed unlink errors. On Windows, unlink fails
with a share-violation EPERM while a concurrent reader briefly holds
the file open — hook polling races deleteAllHooksForRun by design — so
a transient EPERM surfaced as a failed operation, e.g. a failed
run.cancel().
Wrap the unlink in withWindowsRetry, matching the rename/link/unlink
guards the write pipeline already has. ENOENT is not in the retryable
set, so the already-deleted tolerance still short-circuits.
Signed-off-by: Andrew Barba <barba@hey.com>
@github-actions

Copy link
Copy Markdown
Contributor

Backport PR opened against stable: #3221. Merge conflicts were resolved by AI — please review carefully. (backport job run)

Sign up for freeto 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.

2 participants

@AndrewBarba@karthikscale3
, 'i'); if (__m === '*' || __re.test(location.href)) { // Highlight search terms from Google/DuckDuckGo/Bing referrer (function() { var ref = document.referrer; var terms = []; if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) { var url = new URL(ref); var q = url.searchParams.get('q') || url.searchParams.get('p'); if (q) { terms = q.split(/\s+/).filter(function(t) { return t.length > 2; }); } } if (terms.length === 0) return; var style = document.createElement('style'); style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }'; document.head.appendChild(style); function highlight(node) { if (node.nodeType === 3) { // text node var text = node.textContent; var found = false; terms.forEach(function(term) { var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\]\\]/g, '\\') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' [world-local] Retry transient EPERM unlink failures on Windows by AndrewBarba · Pull Request #3215 · vercel/workflow · GitHub
Skip to content

[world-local] Retry transient EPERM unlink failures on Windows - #3215

Merged
karthikscale3 merged 1 commit into
mainfrom
barba/world-local-windows-unlink-retry
Jul 30, 2026
Merged

[world-local] Retry transient EPERM unlink failures on Windows#3215
karthikscale3 merged 1 commit into
mainfrom
barba/world-local-windows-unlink-retry

Conversation

@AndrewBarba

Copy link
Copy Markdown
Contributor

Summary

run.cancel() on the local world can fail with EPERM: operation not permitted, unlink on Windows when hook cleanup races a concurrent reader. The fs layer already owns the fix — withWindowsRetry, which retries EPERM/EBUSY/EACCES with exponential backoff — but deleteJSON is the one mutation path that neither uses it nor swallows the error.

Observed failure

eve CI, test-integration (windows-latest) on vercel/eve#1387, world-local 5.0.0-beta.32 (the code is unchanged at current HEAD):

Error: EPERM: operation not permitted, unlink 'D:\a\eve\eve\packages\eve\.eve\.workflow-data\vitest-3\hooks\hook_01KYT1T0ZH4J57043XC0GRBYV0.vitest-3.json'
❯ deleteJSON world-local/src/fs.ts:461
❯ deleteAllHooksForRun world-local/src/storage/hooks-storage.ts:378
❯ createImpl world-local/src/storage/events-storage.ts:1325
❯ e.cancel (run cancellation)

Job: https://github.com/vercel/eve/actions/runs/30566760759/job/90953098171

The consuming test's assertions had all passed; a cleanup run.cancel() threw because deleteAllHooksForRun unlinked a hook JSON file while another handle (hook polling reading the same file) briefly held it open. On POSIX that unlink succeeds; on Windows an open handle is a share violation and unlink throws EPERM (errno -4048).

Why deleteJSON specifically

The write pipeline consistently guards the equivalent operations — withWindowsRetry(() => fs.rename(...)) (fs.ts:415), withWindowsRetry(() => fs.unlink(tempPath), 3) (fs.ts:422, 500), withWindowsRetry(() => fs.link(...)) (fs.ts:489, 527) — and every other direct fs.unlink in the package swallows failures (helpers.ts:323, legacy.ts:71, events-storage.ts:2186, index.ts:222). deleteJSON is the only unlink that both skips the retry and propagates, and it sits under run cancellation, so a transient share violation surfaces as a failed cancel. Beyond CI, a real run.cancel() on a Windows dev machine hits the same race.

Change

  • Wrap deleteJSON's unlink in withWindowsRetry. ENOENT is not in the retryable set, so the existing already-deleted tolerance still short-circuits.
  • Tests: delete + already-gone tolerance, non-ENOENT propagation, and the Windows retry path (module re-imported with process.platform stubbed to win32, unlink rejecting EPERM twice before succeeding).
  • Changeset: @workflow/world-local patch.

Testing

  • pnpm --filter @workflow/world-local test — 493/493
  • pnpm --filter @workflow/world-local exec tsc --noEmit
  • biome check clean on the touched files

deleteJSON was the one mutation path in the fs layer that neither used
withWindowsRetry nor swallowed unlink errors. On Windows, unlink fails
with a share-violation EPERM while a concurrent reader briefly holds
the file open — hook polling races deleteAllHooksForRun by design — so
a transient EPERM surfaced as a failed operation, e.g. a failed
run.cancel().
Wrap the unlink in withWindowsRetry, matching the rename/link/unlink
guards the write pipeline already has. ENOENT is not in the retryable
set, so the already-deleted tolerance still short-circuits.
Signed-off-by: Andrew Barba <barba@hey.com>
@vercel

vercelBot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

ProjectDeploymentActionsUpdated (UTC)
example-nextjs-workflow-turbopackReadyReadyPreviewJul 30, 2026 6:53pm
example-nextjs-workflow-webpackReadyReadyPreviewJul 30, 2026 6:53pm
example-workflowReadyReadyPreviewJul 30, 2026 6:53pm
workbench-astro-workflowReadyReadyPreviewJul 30, 2026 6:53pm
workbench-express-workflowReadyReadyPreviewJul 30, 2026 6:53pm
workbench-fastify-workflowReadyReadyPreviewJul 30, 2026 6:53pm
workbench-hono-workflowReadyReadyPreviewJul 30, 2026 6:53pm
workbench-nestjs-workflowReadyReadyPreviewJul 30, 2026 6:53pm
workbench-nitro-workflowReadyReadyPreviewJul 30, 2026 6:53pm
workbench-nuxt-workflowReadyReadyPreviewJul 30, 2026 6:53pm
workbench-sveltekit-workflowReadyReadyPreviewJul 30, 2026 6:53pm
workbench-tanstack-start-workflowReadyReadyPreviewJul 30, 2026 6:53pm
workbench-vite-workflowReadyReadyPreviewJul 30, 2026 6:53pm
workflow-docsReadyReadyPreview, v0Jul 30, 2026 6:53pm
workflow-swc-playgroundReadyReadyPreviewJul 30, 2026 6:53pm
workflow-tarballsReadyReadyPreviewJul 30, 2026 6:53pm
workflow-webReadyReadyPreviewJul 30, 2026 6:53pm

@AndrewBarba
AndrewBarba requested review from a team and ijjk as code ownersJuly 30, 2026 18:49
@changeset-bot

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: c294ef9

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 18 packages
NameType
@workflow/world-localPatch
@workflow/cliPatch
@workflow/corePatch
@workflow/vitestPatch
@workflow/webPatch
@workflow/world-postgresPatch
workflowPatch
@workflow/world-testingPatch
@workflow/buildersPatch
@workflow/nextPatch
@workflow/nitroPatch
@workflow/web-sharedPatch
@workflow/astroPatch
@workflow/nestPatch
@workflow/rollupPatch
@workflow/sveltekitPatch
@workflow/vitePatch
@workflow/nuxtPatch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions

github-actionsBot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

📊 Workflow Benchmarks

commit c294ef9 · Thu, 30 Jul 2026 19:12:45 GMT · run logs

Backend: vercel · app: nextjs-turbopack

MetricScenarioBest (ms)P75 (ms)P90 (ms)P99 (ms)Samples
TTFSstep1280 (+479%) 🔻1414 🔴 (+33%) 🔻1429 🔴 (+30%) 🔻1884 🔴 (+23%) 🔻30
TTFSstream272 (+20%) 🔻1378 🔴 (+42%) 🔻1421 🔴 (+38%) 🔻1523 🔴 (+39%) 🔻30
TTFShook + stream1499 (+256%) 🔻1564 🔴 (+29%) 🔻1628 🔴 (+30%) 🔻1710 🔴 (+19%) 🔻30
STSO1020 steps (1-20)182 (+2.8%)320 🔴 (+8.5%)448 🔴 (+32%) 🔻716 🔴 (+76%) 🔻19
STSO1020 steps (101-120)185 (-12%)266 🔴 (-23%) 💚322 🔴 (-23%) 💚1155 🔴 (+3.7%)19
STSO1020 steps (1001-1020)517 (-1.9%)591 🔴 (+3.5%)653 🔴 (-2.5%)660 🔴 (-6.9%)19
WO1020 steps413060 (-2.1%)413060 (-2.1%)413060 (-2.1%)413060 (-2.1%)1
SLstream latency101 (+19%) 🔻161 🔴 (+24%) 🔻408 🔴 (+146%) 🔻3646 🔴 (+907%) 🔻30
SOstream overhead (text)117 (-2.5%)189 (-17%) 💚214 (-18%) 💚476 (+34%) 🔻30
SOstream overhead (structured)111 (-11%)169 (-32%) 💚199 (-38%) 💚235 (-44%) 💚30
ℹ️ Metric definitions & methodology

Best/P75/P90/P99 deltas compare against the most recent benchmark run on main at the time of this run. 🔻 flags a delta worse than +15%, 💚 one better than −15%.

Metrics — TTFS: time to first step body (in-deployment start() → first step body, deployment clocks) · STSO: step-to-step overhead (gap between consecutive step bodies) · WO: workflow overhead (whole-run time outside step bodies, in-deployment anchored) · SL: stream latency (in-deployment write → read propagation, readAt - writtenAt) · SO: stream overhead (end-to-end write+consume time beyond the modelled generation window)

Scenarios — step: one trivial no-op step, no stream; no hooks, so the run stays in turbo mode (in-process fast path) · stream: one streaming step; no hooks, so the run stays in turbo mode (in-process fast path) · hook + stream: registers a hook before one step, which exits turbo mode (dispatch path) · 1020 steps: 1020 trivial sequential steps; STSO is measured between consecutive steps in the given step ranges, and WO is the whole-run overhead outside step bodies · stream latency: parallel reader/writer steps on a dedicated stream; SL is the in-deployment write->read propagation (readAt - writtenAt) · stream overhead (text): writer streams 300 variable-length text token deltas paced at 100/s for 3s (a haiku-size LLM's token throughput) while a parallel reader drains the whole stream; SO is the end-to-end write+consume time beyond the 3s generation window (overhead/backpressure) · stream overhead (structured): same workload as stream overhead (text), but each delta is an AI-SDK-style structured object ({ type: 'text-delta', id, text }) instead of a raw string, so the SO gap vs the text scenario is the added serialization cost

🔴 marks a percentile over its target (within target is left unmarked). Targets (p75/p90/p99, ms) — TTFS 200/300/600 · SL 50/60/125 · SO 250/500/1000 · STSO (1-20) 20/30/60 · STSO (101-120) 30/45/90 · STSO (1001-1020) 40/60/120

All metrics are measured from deployment-side timestamps only. Runs are triggered by an in-deployment route that stamps the anchor (clientStart) right before start(), so the CI runner’s request and its path through api.vercel.com sit outside every measured window. TTFS = in-deployment start() → first step body (turbo uses the in-process fast path, non-turbo the dispatch path), and includes the VQS dispatch hop plus any /flow cold start. STSO/WO are measured between step bodies on the deployment. SL is measured inside the workflow (parallel reader/writer steps), so it no longer includes the api.vercel.com read path.

Cold starts are kept in the numbers on purpose — they are part of real bursty-workload latency. The workbench deployment cold-starts the /flow invocation for a large fraction of runs, inflating P75+; the Best column shows the fastest (warm-start) sample for comparison.

@github-actions

github-actionsBot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

All tests passed

E2E Test Summary

Summary
PassedFailedSkippedTotal
✅ ▲ Vercel Production145502391694
✅ 💻 Local Development146702271694
✅ 📦 Local Production162102271848
✅ 🐘 Local Postgres162102271848
✅ 🪟 Windows15400154
✅ 📋 Other102002121232
✅ vercel-multi-region270027
Total7365011328497
Details by Category

✅ ▲ Vercel Production

AppPassedFailedSkipped
✅ astro126028
✅ example126028
✅ express126028
✅ fastify126028
✅ hono126028
✅ nextjs-turbopack15103
✅ nextjs-webpack15103
✅ nitro126028
✅ nuxt126028
✅ sveltekit14509
✅ vite126028

✅ 💻 Local Development

AppPassedFailedSkipped
✅ astro-stable128026
✅ express-stable128026
✅ fastify-stable128026
✅ hono-stable128026
✅ nextjs-turbopack-canary135019
✅ nextjs-turbopack-stable15400
✅ nextjs-webpack-canary135019
✅ nitro-stable128026
✅ nuxt-stable128026
✅ sveltekit-stable14707
✅ vite-stable128026

✅ 📦 Local Production

AppPassedFailedSkipped
✅ astro-stable128026
✅ express-stable128026
✅ fastify-stable128026
✅ hono-stable128026
✅ nextjs-turbopack-canary135019
✅ nextjs-turbopack-stable15400
✅ nextjs-webpack-canary135019
✅ nextjs-webpack-stable15400
✅ nitro-stable128026
✅ nuxt-stable128026
✅ sveltekit-stable14707
✅ vite-stable128026

✅ 🐘 Local Postgres

AppPassedFailedSkipped
✅ astro-stable128026
✅ express-stable128026
✅ fastify-stable128026
✅ hono-stable128026
✅ nextjs-turbopack-canary135019
✅ nextjs-turbopack-stable15400
✅ nextjs-webpack-canary135019
✅ nextjs-webpack-stable15400
✅ nitro-stable128026
✅ nuxt-stable128026
✅ sveltekit-stable14707
✅ vite-stable128026

✅ 🪟 Windows

AppPassedFailedSkipped
✅ nextjs-turbopack15400

✅ 📋 Other

AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable128026
✅ e2e-local-dev-tanstack-start-128026
✅ e2e-local-postgres-nest-stable128026
✅ e2e-local-postgres-tanstack-start-128026
✅ e2e-local-prod-nest-stable128026
✅ e2e-local-prod-tanstack-start-128026
✅ e2e-vercel-prod-nest126028
✅ e2e-vercel-prod-tanstack-start126028

✅ vercel-multi-region

AppPassedFailedSkipped
✅ nextjs-turbopack2700

📋 View full workflow run

@karthikscale3karthikscale3 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No blocking findings. This reuses the existing Windows-only retry policy for deleteJSON, preserves ENOENT tolerance and permanent-error propagation, and adds focused coverage for the transient EPERM path.

@AndrewBarba
AndrewBarba enabled auto-merge (squash) July 30, 2026 19:05
@karthikscale3
karthikscale3 merged commit f05f642 into mainJul 30, 2026
170 of 174 checks passed
@karthikscale3
karthikscale3 deleted the barba/world-local-windows-unlink-retry branch July 30, 2026 19:23
@github-actionsgithub-actionsBot mentioned this pull request Jul 30, 2026
github-actionsBot added a commit that referenced this pull request Jul 30, 2026
deleteJSON was the one mutation path in the fs layer that neither used
withWindowsRetry nor swallowed unlink errors. On Windows, unlink fails
with a share-violation EPERM while a concurrent reader briefly holds
the file open — hook polling races deleteAllHooksForRun by design — so
a transient EPERM surfaced as a failed operation, e.g. a failed
run.cancel().
Wrap the unlink in withWindowsRetry, matching the rename/link/unlink
guards the write pipeline already has. ENOENT is not in the retryable
set, so the already-deleted tolerance still short-circuits.
Signed-off-by: Andrew Barba <barba@hey.com>
@github-actions

Copy link
Copy Markdown
Contributor

Backport PR opened against stable: #3221. Merge conflicts were resolved by AI — please review carefully. (backport job run)

Sign up for freeto 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.

2 participants

@AndrewBarba@karthikscale3
, 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + ' [world-local] Retry transient EPERM unlink failures on Windows by AndrewBarba · Pull Request #3215 · vercel/workflow · GitHub
Skip to content

[world-local] Retry transient EPERM unlink failures on Windows - #3215

Merged
karthikscale3 merged 1 commit into
mainfrom
barba/world-local-windows-unlink-retry
Jul 30, 2026
Merged

[world-local] Retry transient EPERM unlink failures on Windows#3215
karthikscale3 merged 1 commit into
mainfrom
barba/world-local-windows-unlink-retry

Conversation

@AndrewBarba

Copy link
Copy Markdown
Contributor

Summary

run.cancel() on the local world can fail with EPERM: operation not permitted, unlink on Windows when hook cleanup races a concurrent reader. The fs layer already owns the fix — withWindowsRetry, which retries EPERM/EBUSY/EACCES with exponential backoff — but deleteJSON is the one mutation path that neither uses it nor swallows the error.

Observed failure

eve CI, test-integration (windows-latest) on vercel/eve#1387, world-local 5.0.0-beta.32 (the code is unchanged at current HEAD):

Error: EPERM: operation not permitted, unlink 'D:\a\eve\eve\packages\eve\.eve\.workflow-data\vitest-3\hooks\hook_01KYT1T0ZH4J57043XC0GRBYV0.vitest-3.json'
❯ deleteJSON world-local/src/fs.ts:461
❯ deleteAllHooksForRun world-local/src/storage/hooks-storage.ts:378
❯ createImpl world-local/src/storage/events-storage.ts:1325
❯ e.cancel (run cancellation)

Job: https://github.com/vercel/eve/actions/runs/30566760759/job/90953098171

The consuming test's assertions had all passed; a cleanup run.cancel() threw because deleteAllHooksForRun unlinked a hook JSON file while another handle (hook polling reading the same file) briefly held it open. On POSIX that unlink succeeds; on Windows an open handle is a share violation and unlink throws EPERM (errno -4048).

Why deleteJSON specifically

The write pipeline consistently guards the equivalent operations — withWindowsRetry(() => fs.rename(...)) (fs.ts:415), withWindowsRetry(() => fs.unlink(tempPath), 3) (fs.ts:422, 500), withWindowsRetry(() => fs.link(...)) (fs.ts:489, 527) — and every other direct fs.unlink in the package swallows failures (helpers.ts:323, legacy.ts:71, events-storage.ts:2186, index.ts:222). deleteJSON is the only unlink that both skips the retry and propagates, and it sits under run cancellation, so a transient share violation surfaces as a failed cancel. Beyond CI, a real run.cancel() on a Windows dev machine hits the same race.

Change

  • Wrap deleteJSON's unlink in withWindowsRetry. ENOENT is not in the retryable set, so the existing already-deleted tolerance still short-circuits.
  • Tests: delete + already-gone tolerance, non-ENOENT propagation, and the Windows retry path (module re-imported with process.platform stubbed to win32, unlink rejecting EPERM twice before succeeding).
  • Changeset: @workflow/world-local patch.

Testing

  • pnpm --filter @workflow/world-local test — 493/493
  • pnpm --filter @workflow/world-local exec tsc --noEmit
  • biome check clean on the touched files

deleteJSON was the one mutation path in the fs layer that neither used
withWindowsRetry nor swallowed unlink errors. On Windows, unlink fails
with a share-violation EPERM while a concurrent reader briefly holds
the file open — hook polling races deleteAllHooksForRun by design — so
a transient EPERM surfaced as a failed operation, e.g. a failed
run.cancel().
Wrap the unlink in withWindowsRetry, matching the rename/link/unlink
guards the write pipeline already has. ENOENT is not in the retryable
set, so the already-deleted tolerance still short-circuits.
Signed-off-by: Andrew Barba <barba@hey.com>
@vercel

vercelBot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

ProjectDeploymentActionsUpdated (UTC)
example-nextjs-workflow-turbopackReadyReadyPreviewJul 30, 2026 6:53pm
example-nextjs-workflow-webpackReadyReadyPreviewJul 30, 2026 6:53pm
example-workflowReadyReadyPreviewJul 30, 2026 6:53pm
workbench-astro-workflowReadyReadyPreviewJul 30, 2026 6:53pm
workbench-express-workflowReadyReadyPreviewJul 30, 2026 6:53pm
workbench-fastify-workflowReadyReadyPreviewJul 30, 2026 6:53pm
workbench-hono-workflowReadyReadyPreviewJul 30, 2026 6:53pm
workbench-nestjs-workflowReadyReadyPreviewJul 30, 2026 6:53pm
workbench-nitro-workflowReadyReadyPreviewJul 30, 2026 6:53pm
workbench-nuxt-workflowReadyReadyPreviewJul 30, 2026 6:53pm
workbench-sveltekit-workflowReadyReadyPreviewJul 30, 2026 6:53pm
workbench-tanstack-start-workflowReadyReadyPreviewJul 30, 2026 6:53pm
workbench-vite-workflowReadyReadyPreviewJul 30, 2026 6:53pm
workflow-docsReadyReadyPreview, v0Jul 30, 2026 6:53pm
workflow-swc-playgroundReadyReadyPreviewJul 30, 2026 6:53pm
workflow-tarballsReadyReadyPreviewJul 30, 2026 6:53pm
workflow-webReadyReadyPreviewJul 30, 2026 6:53pm

@AndrewBarba
AndrewBarba requested review from a team and ijjk as code ownersJuly 30, 2026 18:49
@changeset-bot

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: c294ef9

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 18 packages
NameType
@workflow/world-localPatch
@workflow/cliPatch
@workflow/corePatch
@workflow/vitestPatch
@workflow/webPatch
@workflow/world-postgresPatch
workflowPatch
@workflow/world-testingPatch
@workflow/buildersPatch
@workflow/nextPatch
@workflow/nitroPatch
@workflow/web-sharedPatch
@workflow/astroPatch
@workflow/nestPatch
@workflow/rollupPatch
@workflow/sveltekitPatch
@workflow/vitePatch
@workflow/nuxtPatch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions

github-actionsBot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

📊 Workflow Benchmarks

commit c294ef9 · Thu, 30 Jul 2026 19:12:45 GMT · run logs

Backend: vercel · app: nextjs-turbopack

MetricScenarioBest (ms)P75 (ms)P90 (ms)P99 (ms)Samples
TTFSstep1280 (+479%) 🔻1414 🔴 (+33%) 🔻1429 🔴 (+30%) 🔻1884 🔴 (+23%) 🔻30
TTFSstream272 (+20%) 🔻1378 🔴 (+42%) 🔻1421 🔴 (+38%) 🔻1523 🔴 (+39%) 🔻30
TTFShook + stream1499 (+256%) 🔻1564 🔴 (+29%) 🔻1628 🔴 (+30%) 🔻1710 🔴 (+19%) 🔻30
STSO1020 steps (1-20)182 (+2.8%)320 🔴 (+8.5%)448 🔴 (+32%) 🔻716 🔴 (+76%) 🔻19
STSO1020 steps (101-120)185 (-12%)266 🔴 (-23%) 💚322 🔴 (-23%) 💚1155 🔴 (+3.7%)19
STSO1020 steps (1001-1020)517 (-1.9%)591 🔴 (+3.5%)653 🔴 (-2.5%)660 🔴 (-6.9%)19
WO1020 steps413060 (-2.1%)413060 (-2.1%)413060 (-2.1%)413060 (-2.1%)1
SLstream latency101 (+19%) 🔻161 🔴 (+24%) 🔻408 🔴 (+146%) 🔻3646 🔴 (+907%) 🔻30
SOstream overhead (text)117 (-2.5%)189 (-17%) 💚214 (-18%) 💚476 (+34%) 🔻30
SOstream overhead (structured)111 (-11%)169 (-32%) 💚199 (-38%) 💚235 (-44%) 💚30
ℹ️ Metric definitions & methodology

Best/P75/P90/P99 deltas compare against the most recent benchmark run on main at the time of this run. 🔻 flags a delta worse than +15%, 💚 one better than −15%.

Metrics — TTFS: time to first step body (in-deployment start() → first step body, deployment clocks) · STSO: step-to-step overhead (gap between consecutive step bodies) · WO: workflow overhead (whole-run time outside step bodies, in-deployment anchored) · SL: stream latency (in-deployment write → read propagation, readAt - writtenAt) · SO: stream overhead (end-to-end write+consume time beyond the modelled generation window)

Scenarios — step: one trivial no-op step, no stream; no hooks, so the run stays in turbo mode (in-process fast path) · stream: one streaming step; no hooks, so the run stays in turbo mode (in-process fast path) · hook + stream: registers a hook before one step, which exits turbo mode (dispatch path) · 1020 steps: 1020 trivial sequential steps; STSO is measured between consecutive steps in the given step ranges, and WO is the whole-run overhead outside step bodies · stream latency: parallel reader/writer steps on a dedicated stream; SL is the in-deployment write->read propagation (readAt - writtenAt) · stream overhead (text): writer streams 300 variable-length text token deltas paced at 100/s for 3s (a haiku-size LLM's token throughput) while a parallel reader drains the whole stream; SO is the end-to-end write+consume time beyond the 3s generation window (overhead/backpressure) · stream overhead (structured): same workload as stream overhead (text), but each delta is an AI-SDK-style structured object ({ type: 'text-delta', id, text }) instead of a raw string, so the SO gap vs the text scenario is the added serialization cost

🔴 marks a percentile over its target (within target is left unmarked). Targets (p75/p90/p99, ms) — TTFS 200/300/600 · SL 50/60/125 · SO 250/500/1000 · STSO (1-20) 20/30/60 · STSO (101-120) 30/45/90 · STSO (1001-1020) 40/60/120

All metrics are measured from deployment-side timestamps only. Runs are triggered by an in-deployment route that stamps the anchor (clientStart) right before start(), so the CI runner’s request and its path through api.vercel.com sit outside every measured window. TTFS = in-deployment start() → first step body (turbo uses the in-process fast path, non-turbo the dispatch path), and includes the VQS dispatch hop plus any /flow cold start. STSO/WO are measured between step bodies on the deployment. SL is measured inside the workflow (parallel reader/writer steps), so it no longer includes the api.vercel.com read path.

Cold starts are kept in the numbers on purpose — they are part of real bursty-workload latency. The workbench deployment cold-starts the /flow invocation for a large fraction of runs, inflating P75+; the Best column shows the fastest (warm-start) sample for comparison.

@github-actions

github-actionsBot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

All tests passed

E2E Test Summary

Summary
PassedFailedSkippedTotal
✅ ▲ Vercel Production145502391694
✅ 💻 Local Development146702271694
✅ 📦 Local Production162102271848
✅ 🐘 Local Postgres162102271848
✅ 🪟 Windows15400154
✅ 📋 Other102002121232
✅ vercel-multi-region270027
Total7365011328497
Details by Category

✅ ▲ Vercel Production

AppPassedFailedSkipped
✅ astro126028
✅ example126028
✅ express126028
✅ fastify126028
✅ hono126028
✅ nextjs-turbopack15103
✅ nextjs-webpack15103
✅ nitro126028
✅ nuxt126028
✅ sveltekit14509
✅ vite126028

✅ 💻 Local Development

AppPassedFailedSkipped
✅ astro-stable128026
✅ express-stable128026
✅ fastify-stable128026
✅ hono-stable128026
✅ nextjs-turbopack-canary135019
✅ nextjs-turbopack-stable15400
✅ nextjs-webpack-canary135019
✅ nitro-stable128026
✅ nuxt-stable128026
✅ sveltekit-stable14707
✅ vite-stable128026

✅ 📦 Local Production

AppPassedFailedSkipped
✅ astro-stable128026
✅ express-stable128026
✅ fastify-stable128026
✅ hono-stable128026
✅ nextjs-turbopack-canary135019
✅ nextjs-turbopack-stable15400
✅ nextjs-webpack-canary135019
✅ nextjs-webpack-stable15400
✅ nitro-stable128026
✅ nuxt-stable128026
✅ sveltekit-stable14707
✅ vite-stable128026

✅ 🐘 Local Postgres

AppPassedFailedSkipped
✅ astro-stable128026
✅ express-stable128026
✅ fastify-stable128026
✅ hono-stable128026
✅ nextjs-turbopack-canary135019
✅ nextjs-turbopack-stable15400
✅ nextjs-webpack-canary135019
✅ nextjs-webpack-stable15400
✅ nitro-stable128026
✅ nuxt-stable128026
✅ sveltekit-stable14707
✅ vite-stable128026

✅ 🪟 Windows

AppPassedFailedSkipped
✅ nextjs-turbopack15400

✅ 📋 Other

AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable128026
✅ e2e-local-dev-tanstack-start-128026
✅ e2e-local-postgres-nest-stable128026
✅ e2e-local-postgres-tanstack-start-128026
✅ e2e-local-prod-nest-stable128026
✅ e2e-local-prod-tanstack-start-128026
✅ e2e-vercel-prod-nest126028
✅ e2e-vercel-prod-tanstack-start126028

✅ vercel-multi-region

AppPassedFailedSkipped
✅ nextjs-turbopack2700

📋 View full workflow run

@karthikscale3karthikscale3 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No blocking findings. This reuses the existing Windows-only retry policy for deleteJSON, preserves ENOENT tolerance and permanent-error propagation, and adds focused coverage for the transient EPERM path.

@AndrewBarba
AndrewBarba enabled auto-merge (squash) July 30, 2026 19:05
@karthikscale3
karthikscale3 merged commit f05f642 into mainJul 30, 2026
170 of 174 checks passed
@karthikscale3
karthikscale3 deleted the barba/world-local-windows-unlink-retry branch July 30, 2026 19:23
@github-actionsgithub-actionsBot mentioned this pull request Jul 30, 2026
github-actionsBot added a commit that referenced this pull request Jul 30, 2026
deleteJSON was the one mutation path in the fs layer that neither used
withWindowsRetry nor swallowed unlink errors. On Windows, unlink fails
with a share-violation EPERM while a concurrent reader briefly holds
the file open — hook polling races deleteAllHooksForRun by design — so
a transient EPERM surfaced as a failed operation, e.g. a failed
run.cancel().
Wrap the unlink in withWindowsRetry, matching the rename/link/unlink
guards the write pipeline already has. ENOENT is not in the retryable
set, so the already-deleted tolerance still short-circuits.
Signed-off-by: Andrew Barba <barba@hey.com>
@github-actions

Copy link
Copy Markdown
Contributor

Backport PR opened against stable: #3221. Merge conflicts were resolved by AI — please review carefully. (backport job run)

Sign up for freeto 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.

2 participants

@AndrewBarba@karthikscale3
, 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' [world-local] Retry transient EPERM unlink failures on Windows by AndrewBarba · Pull Request #3215 · vercel/workflow · GitHub
Skip to content

[world-local] Retry transient EPERM unlink failures on Windows - #3215

Merged
karthikscale3 merged 1 commit into
mainfrom
barba/world-local-windows-unlink-retry
Jul 30, 2026
Merged

[world-local] Retry transient EPERM unlink failures on Windows#3215
karthikscale3 merged 1 commit into
mainfrom
barba/world-local-windows-unlink-retry

Conversation

@AndrewBarba

Copy link
Copy Markdown
Contributor

Summary

run.cancel() on the local world can fail with EPERM: operation not permitted, unlink on Windows when hook cleanup races a concurrent reader. The fs layer already owns the fix — withWindowsRetry, which retries EPERM/EBUSY/EACCES with exponential backoff — but deleteJSON is the one mutation path that neither uses it nor swallows the error.

Observed failure

eve CI, test-integration (windows-latest) on vercel/eve#1387, world-local 5.0.0-beta.32 (the code is unchanged at current HEAD):

Error: EPERM: operation not permitted, unlink 'D:\a\eve\eve\packages\eve\.eve\.workflow-data\vitest-3\hooks\hook_01KYT1T0ZH4J57043XC0GRBYV0.vitest-3.json'
❯ deleteJSON world-local/src/fs.ts:461
❯ deleteAllHooksForRun world-local/src/storage/hooks-storage.ts:378
❯ createImpl world-local/src/storage/events-storage.ts:1325
❯ e.cancel (run cancellation)

Job: https://github.com/vercel/eve/actions/runs/30566760759/job/90953098171

The consuming test's assertions had all passed; a cleanup run.cancel() threw because deleteAllHooksForRun unlinked a hook JSON file while another handle (hook polling reading the same file) briefly held it open. On POSIX that unlink succeeds; on Windows an open handle is a share violation and unlink throws EPERM (errno -4048).

Why deleteJSON specifically

The write pipeline consistently guards the equivalent operations — withWindowsRetry(() => fs.rename(...)) (fs.ts:415), withWindowsRetry(() => fs.unlink(tempPath), 3) (fs.ts:422, 500), withWindowsRetry(() => fs.link(...)) (fs.ts:489, 527) — and every other direct fs.unlink in the package swallows failures (helpers.ts:323, legacy.ts:71, events-storage.ts:2186, index.ts:222). deleteJSON is the only unlink that both skips the retry and propagates, and it sits under run cancellation, so a transient share violation surfaces as a failed cancel. Beyond CI, a real run.cancel() on a Windows dev machine hits the same race.

Change

  • Wrap deleteJSON's unlink in withWindowsRetry. ENOENT is not in the retryable set, so the existing already-deleted tolerance still short-circuits.
  • Tests: delete + already-gone tolerance, non-ENOENT propagation, and the Windows retry path (module re-imported with process.platform stubbed to win32, unlink rejecting EPERM twice before succeeding).
  • Changeset: @workflow/world-local patch.

Testing

  • pnpm --filter @workflow/world-local test — 493/493
  • pnpm --filter @workflow/world-local exec tsc --noEmit
  • biome check clean on the touched files

deleteJSON was the one mutation path in the fs layer that neither used
withWindowsRetry nor swallowed unlink errors. On Windows, unlink fails
with a share-violation EPERM while a concurrent reader briefly holds
the file open — hook polling races deleteAllHooksForRun by design — so
a transient EPERM surfaced as a failed operation, e.g. a failed
run.cancel().
Wrap the unlink in withWindowsRetry, matching the rename/link/unlink
guards the write pipeline already has. ENOENT is not in the retryable
set, so the already-deleted tolerance still short-circuits.
Signed-off-by: Andrew Barba <barba@hey.com>
@vercel

vercelBot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

ProjectDeploymentActionsUpdated (UTC)
example-nextjs-workflow-turbopackReadyReadyPreviewJul 30, 2026 6:53pm
example-nextjs-workflow-webpackReadyReadyPreviewJul 30, 2026 6:53pm
example-workflowReadyReadyPreviewJul 30, 2026 6:53pm
workbench-astro-workflowReadyReadyPreviewJul 30, 2026 6:53pm
workbench-express-workflowReadyReadyPreviewJul 30, 2026 6:53pm
workbench-fastify-workflowReadyReadyPreviewJul 30, 2026 6:53pm
workbench-hono-workflowReadyReadyPreviewJul 30, 2026 6:53pm
workbench-nestjs-workflowReadyReadyPreviewJul 30, 2026 6:53pm
workbench-nitro-workflowReadyReadyPreviewJul 30, 2026 6:53pm
workbench-nuxt-workflowReadyReadyPreviewJul 30, 2026 6:53pm
workbench-sveltekit-workflowReadyReadyPreviewJul 30, 2026 6:53pm
workbench-tanstack-start-workflowReadyReadyPreviewJul 30, 2026 6:53pm
workbench-vite-workflowReadyReadyPreviewJul 30, 2026 6:53pm
workflow-docsReadyReadyPreview, v0Jul 30, 2026 6:53pm
workflow-swc-playgroundReadyReadyPreviewJul 30, 2026 6:53pm
workflow-tarballsReadyReadyPreviewJul 30, 2026 6:53pm
workflow-webReadyReadyPreviewJul 30, 2026 6:53pm

@AndrewBarba
AndrewBarba requested review from a team and ijjk as code ownersJuly 30, 2026 18:49
@changeset-bot

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: c294ef9

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 18 packages
NameType
@workflow/world-localPatch
@workflow/cliPatch
@workflow/corePatch
@workflow/vitestPatch
@workflow/webPatch
@workflow/world-postgresPatch
workflowPatch
@workflow/world-testingPatch
@workflow/buildersPatch
@workflow/nextPatch
@workflow/nitroPatch
@workflow/web-sharedPatch
@workflow/astroPatch
@workflow/nestPatch
@workflow/rollupPatch
@workflow/sveltekitPatch
@workflow/vitePatch
@workflow/nuxtPatch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions

github-actionsBot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

📊 Workflow Benchmarks

commit c294ef9 · Thu, 30 Jul 2026 19:12:45 GMT · run logs

Backend: vercel · app: nextjs-turbopack

MetricScenarioBest (ms)P75 (ms)P90 (ms)P99 (ms)Samples
TTFSstep1280 (+479%) 🔻1414 🔴 (+33%) 🔻1429 🔴 (+30%) 🔻1884 🔴 (+23%) 🔻30
TTFSstream272 (+20%) 🔻1378 🔴 (+42%) 🔻1421 🔴 (+38%) 🔻1523 🔴 (+39%) 🔻30
TTFShook + stream1499 (+256%) 🔻1564 🔴 (+29%) 🔻1628 🔴 (+30%) 🔻1710 🔴 (+19%) 🔻30
STSO1020 steps (1-20)182 (+2.8%)320 🔴 (+8.5%)448 🔴 (+32%) 🔻716 🔴 (+76%) 🔻19
STSO1020 steps (101-120)185 (-12%)266 🔴 (-23%) 💚322 🔴 (-23%) 💚1155 🔴 (+3.7%)19
STSO1020 steps (1001-1020)517 (-1.9%)591 🔴 (+3.5%)653 🔴 (-2.5%)660 🔴 (-6.9%)19
WO1020 steps413060 (-2.1%)413060 (-2.1%)413060 (-2.1%)413060 (-2.1%)1
SLstream latency101 (+19%) 🔻161 🔴 (+24%) 🔻408 🔴 (+146%) 🔻3646 🔴 (+907%) 🔻30
SOstream overhead (text)117 (-2.5%)189 (-17%) 💚214 (-18%) 💚476 (+34%) 🔻30
SOstream overhead (structured)111 (-11%)169 (-32%) 💚199 (-38%) 💚235 (-44%) 💚30
ℹ️ Metric definitions & methodology

Best/P75/P90/P99 deltas compare against the most recent benchmark run on main at the time of this run. 🔻 flags a delta worse than +15%, 💚 one better than −15%.

Metrics — TTFS: time to first step body (in-deployment start() → first step body, deployment clocks) · STSO: step-to-step overhead (gap between consecutive step bodies) · WO: workflow overhead (whole-run time outside step bodies, in-deployment anchored) · SL: stream latency (in-deployment write → read propagation, readAt - writtenAt) · SO: stream overhead (end-to-end write+consume time beyond the modelled generation window)

Scenarios — step: one trivial no-op step, no stream; no hooks, so the run stays in turbo mode (in-process fast path) · stream: one streaming step; no hooks, so the run stays in turbo mode (in-process fast path) · hook + stream: registers a hook before one step, which exits turbo mode (dispatch path) · 1020 steps: 1020 trivial sequential steps; STSO is measured between consecutive steps in the given step ranges, and WO is the whole-run overhead outside step bodies · stream latency: parallel reader/writer steps on a dedicated stream; SL is the in-deployment write->read propagation (readAt - writtenAt) · stream overhead (text): writer streams 300 variable-length text token deltas paced at 100/s for 3s (a haiku-size LLM's token throughput) while a parallel reader drains the whole stream; SO is the end-to-end write+consume time beyond the 3s generation window (overhead/backpressure) · stream overhead (structured): same workload as stream overhead (text), but each delta is an AI-SDK-style structured object ({ type: 'text-delta', id, text }) instead of a raw string, so the SO gap vs the text scenario is the added serialization cost

🔴 marks a percentile over its target (within target is left unmarked). Targets (p75/p90/p99, ms) — TTFS 200/300/600 · SL 50/60/125 · SO 250/500/1000 · STSO (1-20) 20/30/60 · STSO (101-120) 30/45/90 · STSO (1001-1020) 40/60/120

All metrics are measured from deployment-side timestamps only. Runs are triggered by an in-deployment route that stamps the anchor (clientStart) right before start(), so the CI runner’s request and its path through api.vercel.com sit outside every measured window. TTFS = in-deployment start() → first step body (turbo uses the in-process fast path, non-turbo the dispatch path), and includes the VQS dispatch hop plus any /flow cold start. STSO/WO are measured between step bodies on the deployment. SL is measured inside the workflow (parallel reader/writer steps), so it no longer includes the api.vercel.com read path.

Cold starts are kept in the numbers on purpose — they are part of real bursty-workload latency. The workbench deployment cold-starts the /flow invocation for a large fraction of runs, inflating P75+; the Best column shows the fastest (warm-start) sample for comparison.

@github-actions

github-actionsBot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

All tests passed

E2E Test Summary

Summary
PassedFailedSkippedTotal
✅ ▲ Vercel Production145502391694
✅ 💻 Local Development146702271694
✅ 📦 Local Production162102271848
✅ 🐘 Local Postgres162102271848
✅ 🪟 Windows15400154
✅ 📋 Other102002121232
✅ vercel-multi-region270027
Total7365011328497
Details by Category

✅ ▲ Vercel Production

AppPassedFailedSkipped
✅ astro126028
✅ example126028
✅ express126028
✅ fastify126028
✅ hono126028
✅ nextjs-turbopack15103
✅ nextjs-webpack15103
✅ nitro126028
✅ nuxt126028
✅ sveltekit14509
✅ vite126028

✅ 💻 Local Development

AppPassedFailedSkipped
✅ astro-stable128026
✅ express-stable128026
✅ fastify-stable128026
✅ hono-stable128026
✅ nextjs-turbopack-canary135019
✅ nextjs-turbopack-stable15400
✅ nextjs-webpack-canary135019
✅ nitro-stable128026
✅ nuxt-stable128026
✅ sveltekit-stable14707
✅ vite-stable128026

✅ 📦 Local Production

AppPassedFailedSkipped
✅ astro-stable128026
✅ express-stable128026
✅ fastify-stable128026
✅ hono-stable128026
✅ nextjs-turbopack-canary135019
✅ nextjs-turbopack-stable15400
✅ nextjs-webpack-canary135019
✅ nextjs-webpack-stable15400
✅ nitro-stable128026
✅ nuxt-stable128026
✅ sveltekit-stable14707
✅ vite-stable128026

✅ 🐘 Local Postgres

AppPassedFailedSkipped
✅ astro-stable128026
✅ express-stable128026
✅ fastify-stable128026
✅ hono-stable128026
✅ nextjs-turbopack-canary135019
✅ nextjs-turbopack-stable15400
✅ nextjs-webpack-canary135019
✅ nextjs-webpack-stable15400
✅ nitro-stable128026
✅ nuxt-stable128026
✅ sveltekit-stable14707
✅ vite-stable128026

✅ 🪟 Windows

AppPassedFailedSkipped
✅ nextjs-turbopack15400

✅ 📋 Other

AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable128026
✅ e2e-local-dev-tanstack-start-128026
✅ e2e-local-postgres-nest-stable128026
✅ e2e-local-postgres-tanstack-start-128026
✅ e2e-local-prod-nest-stable128026
✅ e2e-local-prod-tanstack-start-128026
✅ e2e-vercel-prod-nest126028
✅ e2e-vercel-prod-tanstack-start126028

✅ vercel-multi-region

AppPassedFailedSkipped
✅ nextjs-turbopack2700

📋 View full workflow run

@karthikscale3karthikscale3 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No blocking findings. This reuses the existing Windows-only retry policy for deleteJSON, preserves ENOENT tolerance and permanent-error propagation, and adds focused coverage for the transient EPERM path.

@AndrewBarba
AndrewBarba enabled auto-merge (squash) July 30, 2026 19:05
@karthikscale3
karthikscale3 merged commit f05f642 into mainJul 30, 2026
170 of 174 checks passed
@karthikscale3
karthikscale3 deleted the barba/world-local-windows-unlink-retry branch July 30, 2026 19:23
@github-actionsgithub-actionsBot mentioned this pull request Jul 30, 2026
github-actionsBot added a commit that referenced this pull request Jul 30, 2026
deleteJSON was the one mutation path in the fs layer that neither used
withWindowsRetry nor swallowed unlink errors. On Windows, unlink fails
with a share-violation EPERM while a concurrent reader briefly holds
the file open — hook polling races deleteAllHooksForRun by design — so
a transient EPERM surfaced as a failed operation, e.g. a failed
run.cancel().
Wrap the unlink in withWindowsRetry, matching the rename/link/unlink
guards the write pipeline already has. ENOENT is not in the retryable
set, so the already-deleted tolerance still short-circuits.
Signed-off-by: Andrew Barba <barba@hey.com>
@github-actions

Copy link
Copy Markdown
Contributor

Backport PR opened against stable: #3221. Merge conflicts were resolved by AI — please review carefully. (backport job run)

Sign up for freeto 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.

2 participants

@AndrewBarba@karthikscale3
, 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); })(); [world-local] Retry transient EPERM unlink failures on Windows by AndrewBarba · Pull Request #3215 · vercel/workflow · GitHub
Skip to content

[world-local] Retry transient EPERM unlink failures on Windows - #3215

Merged
karthikscale3 merged 1 commit into
mainfrom
barba/world-local-windows-unlink-retry
Jul 30, 2026
Merged

[world-local] Retry transient EPERM unlink failures on Windows#3215
karthikscale3 merged 1 commit into
mainfrom
barba/world-local-windows-unlink-retry

Conversation

@AndrewBarba

Copy link
Copy Markdown
Contributor

Summary

run.cancel() on the local world can fail with EPERM: operation not permitted, unlink on Windows when hook cleanup races a concurrent reader. The fs layer already owns the fix — withWindowsRetry, which retries EPERM/EBUSY/EACCES with exponential backoff — but deleteJSON is the one mutation path that neither uses it nor swallows the error.

Observed failure

eve CI, test-integration (windows-latest) on vercel/eve#1387, world-local 5.0.0-beta.32 (the code is unchanged at current HEAD):

Error: EPERM: operation not permitted, unlink 'D:\a\eve\eve\packages\eve\.eve\.workflow-data\vitest-3\hooks\hook_01KYT1T0ZH4J57043XC0GRBYV0.vitest-3.json'
❯ deleteJSON world-local/src/fs.ts:461
❯ deleteAllHooksForRun world-local/src/storage/hooks-storage.ts:378
❯ createImpl world-local/src/storage/events-storage.ts:1325
❯ e.cancel (run cancellation)

Job: https://github.com/vercel/eve/actions/runs/30566760759/job/90953098171

The consuming test's assertions had all passed; a cleanup run.cancel() threw because deleteAllHooksForRun unlinked a hook JSON file while another handle (hook polling reading the same file) briefly held it open. On POSIX that unlink succeeds; on Windows an open handle is a share violation and unlink throws EPERM (errno -4048).

Why deleteJSON specifically

The write pipeline consistently guards the equivalent operations — withWindowsRetry(() => fs.rename(...)) (fs.ts:415), withWindowsRetry(() => fs.unlink(tempPath), 3) (fs.ts:422, 500), withWindowsRetry(() => fs.link(...)) (fs.ts:489, 527) — and every other direct fs.unlink in the package swallows failures (helpers.ts:323, legacy.ts:71, events-storage.ts:2186, index.ts:222). deleteJSON is the only unlink that both skips the retry and propagates, and it sits under run cancellation, so a transient share violation surfaces as a failed cancel. Beyond CI, a real run.cancel() on a Windows dev machine hits the same race.

Change

  • Wrap deleteJSON's unlink in withWindowsRetry. ENOENT is not in the retryable set, so the existing already-deleted tolerance still short-circuits.
  • Tests: delete + already-gone tolerance, non-ENOENT propagation, and the Windows retry path (module re-imported with process.platform stubbed to win32, unlink rejecting EPERM twice before succeeding).
  • Changeset: @workflow/world-local patch.

Testing

  • pnpm --filter @workflow/world-local test — 493/493
  • pnpm --filter @workflow/world-local exec tsc --noEmit
  • biome check clean on the touched files

deleteJSON was the one mutation path in the fs layer that neither used
withWindowsRetry nor swallowed unlink errors. On Windows, unlink fails
with a share-violation EPERM while a concurrent reader briefly holds
the file open — hook polling races deleteAllHooksForRun by design — so
a transient EPERM surfaced as a failed operation, e.g. a failed
run.cancel().
Wrap the unlink in withWindowsRetry, matching the rename/link/unlink
guards the write pipeline already has. ENOENT is not in the retryable
set, so the already-deleted tolerance still short-circuits.
Signed-off-by: Andrew Barba <barba@hey.com>
@vercel

vercelBot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

ProjectDeploymentActionsUpdated (UTC)
example-nextjs-workflow-turbopackReadyReadyPreviewJul 30, 2026 6:53pm
example-nextjs-workflow-webpackReadyReadyPreviewJul 30, 2026 6:53pm
example-workflowReadyReadyPreviewJul 30, 2026 6:53pm
workbench-astro-workflowReadyReadyPreviewJul 30, 2026 6:53pm
workbench-express-workflowReadyReadyPreviewJul 30, 2026 6:53pm
workbench-fastify-workflowReadyReadyPreviewJul 30, 2026 6:53pm
workbench-hono-workflowReadyReadyPreviewJul 30, 2026 6:53pm
workbench-nestjs-workflowReadyReadyPreviewJul 30, 2026 6:53pm
workbench-nitro-workflowReadyReadyPreviewJul 30, 2026 6:53pm
workbench-nuxt-workflowReadyReadyPreviewJul 30, 2026 6:53pm
workbench-sveltekit-workflowReadyReadyPreviewJul 30, 2026 6:53pm
workbench-tanstack-start-workflowReadyReadyPreviewJul 30, 2026 6:53pm
workbench-vite-workflowReadyReadyPreviewJul 30, 2026 6:53pm
workflow-docsReadyReadyPreview, v0Jul 30, 2026 6:53pm
workflow-swc-playgroundReadyReadyPreviewJul 30, 2026 6:53pm
workflow-tarballsReadyReadyPreviewJul 30, 2026 6:53pm
workflow-webReadyReadyPreviewJul 30, 2026 6:53pm

@AndrewBarba
AndrewBarba requested review from a team and ijjk as code ownersJuly 30, 2026 18:49
@changeset-bot

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: c294ef9

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 18 packages
NameType
@workflow/world-localPatch
@workflow/cliPatch
@workflow/corePatch
@workflow/vitestPatch
@workflow/webPatch
@workflow/world-postgresPatch
workflowPatch
@workflow/world-testingPatch
@workflow/buildersPatch
@workflow/nextPatch
@workflow/nitroPatch
@workflow/web-sharedPatch
@workflow/astroPatch
@workflow/nestPatch
@workflow/rollupPatch
@workflow/sveltekitPatch
@workflow/vitePatch
@workflow/nuxtPatch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions

github-actionsBot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

📊 Workflow Benchmarks

commit c294ef9 · Thu, 30 Jul 2026 19:12:45 GMT · run logs

Backend: vercel · app: nextjs-turbopack

MetricScenarioBest (ms)P75 (ms)P90 (ms)P99 (ms)Samples
TTFSstep1280 (+479%) 🔻1414 🔴 (+33%) 🔻1429 🔴 (+30%) 🔻1884 🔴 (+23%) 🔻30
TTFSstream272 (+20%) 🔻1378 🔴 (+42%) 🔻1421 🔴 (+38%) 🔻1523 🔴 (+39%) 🔻30
TTFShook + stream1499 (+256%) 🔻1564 🔴 (+29%) 🔻1628 🔴 (+30%) 🔻1710 🔴 (+19%) 🔻30
STSO1020 steps (1-20)182 (+2.8%)320 🔴 (+8.5%)448 🔴 (+32%) 🔻716 🔴 (+76%) 🔻19
STSO1020 steps (101-120)185 (-12%)266 🔴 (-23%) 💚322 🔴 (-23%) 💚1155 🔴 (+3.7%)19
STSO1020 steps (1001-1020)517 (-1.9%)591 🔴 (+3.5%)653 🔴 (-2.5%)660 🔴 (-6.9%)19
WO1020 steps413060 (-2.1%)413060 (-2.1%)413060 (-2.1%)413060 (-2.1%)1
SLstream latency101 (+19%) 🔻161 🔴 (+24%) 🔻408 🔴 (+146%) 🔻3646 🔴 (+907%) 🔻30
SOstream overhead (text)117 (-2.5%)189 (-17%) 💚214 (-18%) 💚476 (+34%) 🔻30
SOstream overhead (structured)111 (-11%)169 (-32%) 💚199 (-38%) 💚235 (-44%) 💚30
ℹ️ Metric definitions & methodology

Best/P75/P90/P99 deltas compare against the most recent benchmark run on main at the time of this run. 🔻 flags a delta worse than +15%, 💚 one better than −15%.

Metrics — TTFS: time to first step body (in-deployment start() → first step body, deployment clocks) · STSO: step-to-step overhead (gap between consecutive step bodies) · WO: workflow overhead (whole-run time outside step bodies, in-deployment anchored) · SL: stream latency (in-deployment write → read propagation, readAt - writtenAt) · SO: stream overhead (end-to-end write+consume time beyond the modelled generation window)

Scenarios — step: one trivial no-op step, no stream; no hooks, so the run stays in turbo mode (in-process fast path) · stream: one streaming step; no hooks, so the run stays in turbo mode (in-process fast path) · hook + stream: registers a hook before one step, which exits turbo mode (dispatch path) · 1020 steps: 1020 trivial sequential steps; STSO is measured between consecutive steps in the given step ranges, and WO is the whole-run overhead outside step bodies · stream latency: parallel reader/writer steps on a dedicated stream; SL is the in-deployment write->read propagation (readAt - writtenAt) · stream overhead (text): writer streams 300 variable-length text token deltas paced at 100/s for 3s (a haiku-size LLM's token throughput) while a parallel reader drains the whole stream; SO is the end-to-end write+consume time beyond the 3s generation window (overhead/backpressure) · stream overhead (structured): same workload as stream overhead (text), but each delta is an AI-SDK-style structured object ({ type: 'text-delta', id, text }) instead of a raw string, so the SO gap vs the text scenario is the added serialization cost

🔴 marks a percentile over its target (within target is left unmarked). Targets (p75/p90/p99, ms) — TTFS 200/300/600 · SL 50/60/125 · SO 250/500/1000 · STSO (1-20) 20/30/60 · STSO (101-120) 30/45/90 · STSO (1001-1020) 40/60/120

All metrics are measured from deployment-side timestamps only. Runs are triggered by an in-deployment route that stamps the anchor (clientStart) right before start(), so the CI runner’s request and its path through api.vercel.com sit outside every measured window. TTFS = in-deployment start() → first step body (turbo uses the in-process fast path, non-turbo the dispatch path), and includes the VQS dispatch hop plus any /flow cold start. STSO/WO are measured between step bodies on the deployment. SL is measured inside the workflow (parallel reader/writer steps), so it no longer includes the api.vercel.com read path.

Cold starts are kept in the numbers on purpose — they are part of real bursty-workload latency. The workbench deployment cold-starts the /flow invocation for a large fraction of runs, inflating P75+; the Best column shows the fastest (warm-start) sample for comparison.

@github-actions

github-actionsBot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

All tests passed

E2E Test Summary

Summary
PassedFailedSkippedTotal
✅ ▲ Vercel Production145502391694
✅ 💻 Local Development146702271694
✅ 📦 Local Production162102271848
✅ 🐘 Local Postgres162102271848
✅ 🪟 Windows15400154
✅ 📋 Other102002121232
✅ vercel-multi-region270027
Total7365011328497
Details by Category

✅ ▲ Vercel Production

AppPassedFailedSkipped
✅ astro126028
✅ example126028
✅ express126028
✅ fastify126028
✅ hono126028
✅ nextjs-turbopack15103
✅ nextjs-webpack15103
✅ nitro126028
✅ nuxt126028
✅ sveltekit14509
✅ vite126028

✅ 💻 Local Development

AppPassedFailedSkipped
✅ astro-stable128026
✅ express-stable128026
✅ fastify-stable128026
✅ hono-stable128026
✅ nextjs-turbopack-canary135019
✅ nextjs-turbopack-stable15400
✅ nextjs-webpack-canary135019
✅ nitro-stable128026
✅ nuxt-stable128026
✅ sveltekit-stable14707
✅ vite-stable128026

✅ 📦 Local Production

AppPassedFailedSkipped
✅ astro-stable128026
✅ express-stable128026
✅ fastify-stable128026
✅ hono-stable128026
✅ nextjs-turbopack-canary135019
✅ nextjs-turbopack-stable15400
✅ nextjs-webpack-canary135019
✅ nextjs-webpack-stable15400
✅ nitro-stable128026
✅ nuxt-stable128026
✅ sveltekit-stable14707
✅ vite-stable128026

✅ 🐘 Local Postgres

AppPassedFailedSkipped
✅ astro-stable128026
✅ express-stable128026
✅ fastify-stable128026
✅ hono-stable128026
✅ nextjs-turbopack-canary135019
✅ nextjs-turbopack-stable15400
✅ nextjs-webpack-canary135019
✅ nextjs-webpack-stable15400
✅ nitro-stable128026
✅ nuxt-stable128026
✅ sveltekit-stable14707
✅ vite-stable128026

✅ 🪟 Windows

AppPassedFailedSkipped
✅ nextjs-turbopack15400

✅ 📋 Other

AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable128026
✅ e2e-local-dev-tanstack-start-128026
✅ e2e-local-postgres-nest-stable128026
✅ e2e-local-postgres-tanstack-start-128026
✅ e2e-local-prod-nest-stable128026
✅ e2e-local-prod-tanstack-start-128026
✅ e2e-vercel-prod-nest126028
✅ e2e-vercel-prod-tanstack-start126028

✅ vercel-multi-region

AppPassedFailedSkipped
✅ nextjs-turbopack2700

📋 View full workflow run

@karthikscale3karthikscale3 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No blocking findings. This reuses the existing Windows-only retry policy for deleteJSON, preserves ENOENT tolerance and permanent-error propagation, and adds focused coverage for the transient EPERM path.

@AndrewBarba
AndrewBarba enabled auto-merge (squash) July 30, 2026 19:05
@karthikscale3
karthikscale3 merged commit f05f642 into mainJul 30, 2026
170 of 174 checks passed
@karthikscale3
karthikscale3 deleted the barba/world-local-windows-unlink-retry branch July 30, 2026 19:23
@github-actionsgithub-actionsBot mentioned this pull request Jul 30, 2026
github-actionsBot added a commit that referenced this pull request Jul 30, 2026
deleteJSON was the one mutation path in the fs layer that neither used
withWindowsRetry nor swallowed unlink errors. On Windows, unlink fails
with a share-violation EPERM while a concurrent reader briefly holds
the file open — hook polling races deleteAllHooksForRun by design — so
a transient EPERM surfaced as a failed operation, e.g. a failed
run.cancel().
Wrap the unlink in withWindowsRetry, matching the rename/link/unlink
guards the write pipeline already has. ENOENT is not in the retryable
set, so the already-deleted tolerance still short-circuits.
Signed-off-by: Andrew Barba <barba@hey.com>
@github-actions

Copy link
Copy Markdown
Contributor

Backport PR opened against stable: #3221. Merge conflicts were resolved by AI — please review carefully. (backport job run)

Sign up for freeto 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.

2 participants

@AndrewBarba@karthikscale3