From bbaccd678d5bda6129fe665f275b6793ccb3ac7a Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 16 Apr 2026 18:36:42 +0000 Subject: [PATCH] fix: entrypoint: validate_projects_dir silently exits instead of logging FATAL under set -eo pipefail (#877) `compgen -G ... | wc -l` under `set -eo pipefail` aborts the script on the non-zero pipeline exit (compgen returns 1 on no match) before the FATAL diagnostic branch can run. The container still fast-fails, but operators saw no explanation. Switch to the conditional `if ! compgen -G ... >/dev/null 2>&1; then` pattern already used at the two other compgen call sites in this file (bootstrap_factory_repo and the PROJECT_NAME parser). The count for the success-path log is computed after we've confirmed at least one match. Co-Authored-By: Claude Opus 4.6 (1M context) --- docker/agents/entrypoint.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/docker/agents/entrypoint.sh b/docker/agents/entrypoint.sh index 89a520b..f838c15 100644 --- a/docker/agents/entrypoint.sh +++ b/docker/agents/entrypoint.sh @@ -346,15 +346,19 @@ bootstrap_factory_repo # This prevents the silent-zombie mode where the polling loop matches zero files # and does nothing forever. validate_projects_dir() { - local toml_count - toml_count=$(compgen -G "${DISINTO_DIR}/projects/*.toml" 2>/dev/null | wc -l) - if [ "$toml_count" -eq 0 ]; then + # NOTE: compgen -G exits non-zero when no matches exist, so piping it through + # `wc -l` under `set -eo pipefail` aborts the script before the FATAL branch + # can log a diagnostic (#877). Use the conditional form already adopted at + # lines above (see bootstrap_factory_repo, PROJECT_NAME parsing). + if ! compgen -G "${DISINTO_DIR}/projects/*.toml" >/dev/null 2>&1; then log "FATAL: No real .toml files found in ${DISINTO_DIR}/projects/" log "Expected at least one project config file (e.g., disinto.toml)" log "The directory only contains *.toml.example template files." log "Mount the host ./projects volume or copy real .toml files into the container." exit 1 fi + local toml_count + toml_count=$(compgen -G "${DISINTO_DIR}/projects/*.toml" | wc -l) log "Projects directory validated: ${toml_count} real .toml file(s) found" }