Skip to content
GitHubBlueskydev.toRSS
Blog

An input changes mid-run: what four task tools do

A file changes while a task runs. Does the cache save the output anyway? We read the source of vx, Turborepo, Nx and Vite Task.

You save a file while a build runs. The output may come from bytes the cache key does not name. Here is what each tool does after the command exits, read from its source.

After the command exits Turborepo 2.11.7 Nx 23.3.0 Vite Task 1.1.0 vx
Inputs looked at again no no (batch: rehash) files the task opened every declared input
Writes it notices none none the task’s own any process’s
What it does on a change saves saves skips the save skips the save, names file
Can be relaxed per task n/a n/a n/a inputs.stability

It takes the hash before the run and saves the outputs under it.

Inputs are not checked again (save_outputs).

It hashes in processTask and saves with cache.put(task.hash, …).

In batch mode, a task that reads its dependencies’ outputs is hashed again (task-orchestrator.js, cache.js).

It traces the files a task opens. If the task wrote a file it also read, it skips the save (InputModified).

Writes by other processes are not traced (cache_update.rs).

Terminal window
$ vx run packages/api#build
┌─ packages/api#build > $ echo "export const r = $RANDOM" > src/routes.gen.ts && mkdir -p out && cp src/index.ts out/
[vx] packages/api#build: `packages/api/src/routes.gen.ts` changed after its key was taken — the result stands, but is not saved under a key that no longer describes it; if the task generates it, declare it in outputs; if it rewrites it in place, set inputs.stability: { strategy: 'mutable' }
└─ packages/api#build ── (6ms) success
cache 1 not saved

One-project workspace · vx c1ad075 · 2026-10-23

vx checks every declared input after the run, whoever wrote it. A changed input keeps the result and saves nothing, and tasks downstream skip their save too.

inputs.stability relaxes it per task (how).

vx pays one lstat per input on a run that saves. Turborepo and Nx skip that work. Vite Task checks what its tracer already saw. Which fits depends on how often your inputs move during a run.

More at vznjs.github.io/vx.

Turborepo, Nx and other product names are trademarks of their owners. vx is not affiliated with or endorsed by them.