DEV Community

Cover image for An input changes mid-run: what four task tools do
VX
VX

Posted on Edited on Originally published at vznjs.github.io

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

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 inputStability

Turborepo 2.11.7

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

Inputs are not checked again
(save_outputs).

Nx 23.3.0

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).

Vite Task (vite-plus 1.1.0)

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).

vx

$ 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 writes it, declare it in cache.outputs
└─ packages/api#build ── (6ms) success
  cache     1 not saved
Enter fullscreen mode Exit fullscreen mode

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.

cache.inputStability relaxes it per task
(how).

Each one is a trade

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.


Originally published on the vx blog. vx is open-source (MIT) task orchestration with a build cache: vznjs.github.io/vx · GitHub.

Written with AI assistance.

Top comments (0)