From 91ee163585a3ae10864d9ca5a003033b1c0ae36f Mon Sep 17 00:00:00 2001 From: Christian Rehm Date: Fri, 30 Jan 2026 23:18:49 +0000 Subject: [PATCH] fix(watcher): skip opentelemetry-instrument when OTEL is disabled When OTEL_SDK_DISABLED=true (set automatically when no OTEL_ env vars are present), the opentelemetry-instrument wrapper does not properly pass through the WATCHFILES_CHANGES environment variable to watcher.py. This causes the filesystem watcher to silently fail - watchfiles detects changes but watcher.py receives an empty WATCHFILES_CHANGES and exits immediately without scheduling any rescans. The fix skips the opentelemetry-instrument wrapper when OTEL is disabled, allowing watchfiles to pass WATCHFILES_CHANGES directly to watcher.py. Fixes automatic rescan on filesystem change for users who don't configure OpenTelemetry (the majority of self-hosted deployments). --- docker/init_scripts/init | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/docker/init_scripts/init b/docker/init_scripts/init index 88444ee4d..34ea60ec8 100755 --- a/docker/init_scripts/init +++ b/docker/init_scripts/init @@ -219,10 +219,19 @@ start_bin_rq_worker() { start_bin_watcher() { info_log "Starting watcher" - watchfiles \ - --target-type command \ - "opentelemetry-instrument --service_name '${OTEL_SERVICE_NAME_PREFIX-}watcher' python3 watcher.py" \ - /romm/library & + if [[ ${OTEL_SDK_DISABLED:-false} == "true" ]]; then + # Skip opentelemetry-instrument when OTEL is disabled to ensure + # WATCHFILES_CHANGES env var is properly passed to watcher.py + watchfiles \ + --target-type command \ + "python3 watcher.py" \ + /romm/library & + else + watchfiles \ + --target-type command \ + "opentelemetry-instrument --service_name '${OTEL_SERVICE_NAME_PREFIX-}watcher' python3 watcher.py" \ + /romm/library & + fi WATCHER_PID=$! echo "${WATCHER_PID}" >/tmp/watcher.pid }