Skip to content

Cache keys include a host directory's group and other write bits, so checkouts under different umasks share no cache #15034

Open

Description

@yasyf

What is the issue?

Files with the same git content end up with different cache keys when their checkouts were made under different umasks. A file checked out under umask 002 (0664, dirs 0775) and the same file checked out under umask 022 (0644, dirs 0755) share no cache entries, so every check that reads the workspace reruns in full.

Owner and group don't matter. A 0664 tree chowned to another uid/gid still hits the cache, so only the permission bits are keyed.

This makes the cache non-portable between clients that look identical. Two CI agent images with different default umasks never share results. Neither do a cache warmer that unpacks git archive, whose default tar.umask is 0002, and CI agents that git checkout under 022. Nothing in the output says why everything reran; we found it only by bisecting the tree's metadata.

Reproduction

One module whose checks read the workspace (272 test checks), the same engine for every step, the same commit, and identical file contents and mtimes:

  1. Unpack git archive <sha> into a directory, which gives files 0664 and dirs 0775, and run dagger check. Of 272 checks, 271 run, cold.
  2. Run the same command again from the same directory. None of the 272 run.
  3. Unpack the same archive again, chmod -R g-w it to 0644/0755, and run. All 272 run.
  4. Unpack the same archive again, chown -R 1000:1000 it, leaving 0664, and run. None of the 272 run.

"Run" means the check's span took over 3 s; cached checks finish in under 1 s.

Suggestion

For host directory content, normalize the group and other write bits, or ignore them, the way git does, which records only 0644 versus 0755. Mode bits git doesn't track then stop splitting the cache. If they stay keyed on purpose, a note in the caching docs and a debug log naming the input whose digest changed make this findable.

Dagger version

v1.0.0-beta.24 with unrelated local patches, Linux engine, CLI on Linux.

Activity

  1. darshpatel1052 commented on Nov 3, 2026

    @darshpatel1052

    Hi, I’d like to investigate this. I’d compare host-directory digests under different umasks and add tests that distinguish executable permissions from group and other write bits. Before normalizing anything, are those bits intentionally part of Dagger’s directory semantics, or would an opt-in Git-style normalization be appropriate?

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

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions