Skip to content

Stache watcher ignores file changes made between a Stache warm and the first request #15780

Closed

Description

@AlexJFox

Bug description

After php please stache:refresh, any change to a content file made before the next request is never picked up by the watcher. The old content is served indefinitely until the Stache is refreshed again.

Store::clear() forgets stache::timestamps::{store}, and warm() doesn't write it back. The first call to handleFileChanges() then finds no existing timestamps, caches the current filesystem state as the baseline, and returns early ("If there are no existing file timestamps in the cache, there's nothing to update"). Whatever changed since the warm is now part of the baseline and never compared.

This is easy to hit locally: refresh the Stache, git pull content edited elsewhere, then load a page.

Possible fix (untested)

paths() already traverses the filesystem when it builds the path index. It could cache the timestamps from that same traversal, so the watcher's baseline matches what was indexed:

​php Stache::cacheStore()->forever("stache::timestamps::{$this->key()}", $files->all()); ​

How to reproduce

  1. Watcher enabled (STATAMIC_STACHE_WATCHER=auto, APP_ENV=local).
  2. php please stache:refresh
  3. Without loading any page, rename an entry file keeping its id (as a date change on a dated collection does), or edit its contents.
  4. Load the entry: the old version is served, on every request.

If any request happens between steps 2 and 3, the change is detected normally.

Logs

Environment

Environment
Laravel Version: 13.34.0
PHP Version: 8.4.24
Composer Version: 2.10.3
Environment: local
Debug Mode: ENABLED
Maintenance Mode: OFF
Timezone: Europe/London
Locale: en

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED

Drivers
Broadcasting: log
Cache: file
Database: mysql
Logs: stack / single
Mail: log
Queue: database
Session: file

Storage
D:\Herd\leftfield\public\img: LINKED
D:\Herd\leftfield\public\storage: LINKED

Statamic
Addons: 3
License Key: Set
Sites: 1
Stache Watcher: Enabled (auto)
Static Caching: Disabled
Version: 6.36.0 PRO

Statamic Addons
keyagency/statamic-asset-usage: 1.7.0
mikomagni/statamic-environment: 2.0.1
statamic/seo-pro: 7.15.1

Installation

Fresh statamic/statamic site via CLI

Additional details

No response

Activity

  1. AlexJFox commented on Nov 4, 2026

    @AlexJFox
    Author

    Yes this is a Claude-found bug don't @ me 😢

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions