Skip to content

[rush] Rewriting a tracked input file with identical content blocks build cache writes and breaks cobuild #6149

Open

Description

Summary

  • Rewriting a tracked input file with identical bytes makes Rush skip the build cache write for that operation and for every operation downstream of it
  • With cobuild, each runner then executes every cobuilt operation itself
  • Seen on 5.181.0, not on 5.169.3

Example

Two projects, gen and app (app depends on gen, and has test shards run through cobuild).

gen/package.json:

{ "scripts": { "_phase:build": "node write-generated.js" } }

gen/write-generated.js (src/generated.txt is committed to git):

require('fs').writeFileSync('src/generated.txt', 'same content\n');

Build cache with writes allowed (S3), cobuild plugin, 3 runners.

What happens

  • gen (build) logs Input files changed after the inputs snapshot was taken; not writing a build cache entry.
  • Only the mtime changes. Inode and size are the same, the bytes are the same
  • No cache entry for gen, and none for the app operations that depend on it
  • All 3 runners run all 10 app test shards. The job hit its 20 minute limit (cancelled at 20m18s). On 5.169.3 it takes about 10 minutes
  • rush --debug test -v shows Failed to acquire lock ... locked by runner shard-N repeating while the runners wait on each other

Workaround

  • The script now writes only when the content differs
  • Result on 5.181.0: the message appears 0 times on all 3 runners, the job takes 10m29s to 11m02s, and each shard runs once

Cause (from reading the source)

  • The check compares a stat signature (size, mtime, inode) of the tracked input files from before and after the operation. Content is never compared
  • Consumers' cache keys embed the producer's pre-edit state, so their writes are blocked too. That explains why dependents lose caching

Not verified

  • Not reproduced locally: macOS, local-only cache, rush rebuild, same rewrite, the message never printed
  • Only seen on Linux CI with an S3 cache and cobuild
  • Not the cobuild plugin version: it fails the same on 5.176.x and 5.181.x

Ask

  1. Hash the content when the stat signature differs, and treat identical content as unchanged
  2. Name the changed file(s) in the log message. Finding the cause meant reading Rush's source

Is the stat-only comparison intentional, or is a content check welcome?

Standard questions

Question Answer
@microsoft/rush globally installed version? 5.181.0
rushVersion from rush.json? 5.181.0
useWorkspaces from rush.json? true
Operating system? Linux (GitHub Actions runner), macOS for the local attempt
Node.js version (node -v)? 24.13.1
pnpm version 10.30.3

Activity

  1. changed the title [-][rush] Rewriting a tracked input file with identical content blocks build cache writes and breaks cobuild (5.181.0)[/-] [+][rush] Rewriting a tracked input file with identical content blocks build cache writes and breaks cobuild[/+] on Oct 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    • Status
      Needs triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions