Skip to content

"Deployment skipped: no changes detected" doesn't work in some circumstances #4126

Description

@hn-bfai

Summary

Observed on modal 1.5.1 and still present on main as of a483eed:

Deploying an app twice from the same commit prints "Deployment skipped: no changes detected" as expected only when all local files use copy=True. If instead I use add_local_dir or add_local_python_source and copy=False on a directory with more than one file, then every deploy creates a new version despite identical file contents and paths.

It looks like it's caused by MountGetOrCreateRequest.files in _Mount._load_mount (modal/mount.py) having non-deterministic ordering: _select_files returns list(set(...)), whose order varies with PYTHONHASHSEED, and the result is passed through two unordered async_map stages, so the mount's content checksum and the function's definition_id change each run.

Sorting files by filename before building the request should fix it.

Relatedly, mount_ids in _functions.py is assigned from a set and has the same non-determinism.

Version

1.5.1

App ID

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions