From 33b61bf2ff7c1dfe6446de7df0e7a6c3379d6fa3 Mon Sep 17 00:00:00 2001 From: fullsend-code <278716306+fullsend-ai-coder[bot]@users.noreply.github.com> Date: Fri, 10 Jul 2026 12:55:15 +0000 Subject: [PATCH 1/2] fix(#235): add fallback path resolution for companion scripts in post-scripts When post-fix.sh or post-prioritize.sh runs from a content-addressed cache path (sha256//content), companion files (process-fix-result.py, lib/github-api-csma.sh) are not co-located with the script. The SCRIPT_DIR computed from BASH_SOURCE[0] points to the cache directory where companions do not exist. Add a fallback: after computing SCRIPT_DIR, check if the companion file exists at that path. If not, fall back to ${FULLSEND_DIR:-.}/scripts where companions are co-located in the standard workspace layout. Scripts fixed: - post-fix.sh: process-fix-result.py resolution - post-prioritize.sh: lib/github-api-csma.sh resolution Closes #235 --- internal/scaffold/fullsend-repo/scripts/post-fix.sh | 7 +++++++ internal/scaffold/fullsend-repo/scripts/post-prioritize.sh | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/internal/scaffold/fullsend-repo/scripts/post-fix.sh b/internal/scaffold/fullsend-repo/scripts/post-fix.sh index e055fd30c..45ef5709f 100644 --- a/internal/scaffold/fullsend-repo/scripts/post-fix.sh +++ b/internal/scaffold/fullsend-repo/scripts/post-fix.sh @@ -301,8 +301,15 @@ fi export GH_TOKEN="${PUSH_TOKEN}" # Locate process-fix-result.py relative to this script. +# When this script runs from a content-addressed cache path +# (sha256//content), companion files are not co-located. +# Fall back to ${FULLSEND_DIR}/scripts if the companion is missing. SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" PROCESS_SCRIPT="${SCRIPT_DIR}/process-fix-result.py" +if [ ! -f "${PROCESS_SCRIPT}" ] && [ -d "${FULLSEND_DIR:-.}/scripts" ]; then + SCRIPT_DIR="${FULLSEND_DIR:-.}/scripts" + PROCESS_SCRIPT="${SCRIPT_DIR}/process-fix-result.py" +fi # Find fix-result.json in the output directory. # RUN_DIR is the original cwd (runDir = /), saved diff --git a/internal/scaffold/fullsend-repo/scripts/post-prioritize.sh b/internal/scaffold/fullsend-repo/scripts/post-prioritize.sh index d51140573..467538fba 100755 --- a/internal/scaffold/fullsend-repo/scripts/post-prioritize.sh +++ b/internal/scaffold/fullsend-repo/scripts/post-prioritize.sh @@ -13,6 +13,12 @@ set -euo pipefail SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +# When this script runs from a content-addressed cache path +# (sha256//content), companion files are not co-located. +# Fall back to ${FULLSEND_DIR}/scripts if the companion is missing. +if [ ! -f "${SCRIPT_DIR}/lib/github-api-csma.sh" ] && [ -d "${FULLSEND_DIR:-.}/scripts/lib" ]; then + SCRIPT_DIR="${FULLSEND_DIR:-.}/scripts" +fi # shellcheck source=lib/github-api-csma.sh source "${SCRIPT_DIR}/lib/github-api-csma.sh" From d949bcf0bddcf7241404e5ffd205ec43bc16bd24 Mon Sep 17 00:00:00 2001 From: fullsend-fix <278716306+fullsend-ai-coder[bot]@users.noreply.github.com> Date: Fri, 10 Jul 2026 17:47:32 +0000 Subject: [PATCH 2/2] fix(#235): use fail-closed FULLSEND_DIR and log fallback path - Replace ${FULLSEND_DIR:-.} with ${FULLSEND_DIR:?...} so the fallback fails with a clear error when FULLSEND_DIR is unset, rather than silently resolving to the current working directory. - Add echo when fallback companion path activates, aiding debugging. Addresses review feedback on #273 --- internal/scaffold/fullsend-repo/scripts/post-fix.sh | 6 ++++-- internal/scaffold/fullsend-repo/scripts/post-prioritize.sh | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/internal/scaffold/fullsend-repo/scripts/post-fix.sh b/internal/scaffold/fullsend-repo/scripts/post-fix.sh index 45ef5709f..afcdfc634 100644 --- a/internal/scaffold/fullsend-repo/scripts/post-fix.sh +++ b/internal/scaffold/fullsend-repo/scripts/post-fix.sh @@ -304,11 +304,13 @@ export GH_TOKEN="${PUSH_TOKEN}" # When this script runs from a content-addressed cache path # (sha256//content), companion files are not co-located. # Fall back to ${FULLSEND_DIR}/scripts if the companion is missing. +# FULLSEND_DIR is required (fail-closed) to avoid silently resolving to cwd. SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" PROCESS_SCRIPT="${SCRIPT_DIR}/process-fix-result.py" -if [ ! -f "${PROCESS_SCRIPT}" ] && [ -d "${FULLSEND_DIR:-.}/scripts" ]; then - SCRIPT_DIR="${FULLSEND_DIR:-.}/scripts" +if [ ! -f "${PROCESS_SCRIPT}" ] && [ -d "${FULLSEND_DIR:?FULLSEND_DIR must be set}/scripts" ]; then + SCRIPT_DIR="${FULLSEND_DIR}/scripts" PROCESS_SCRIPT="${SCRIPT_DIR}/process-fix-result.py" + echo "Using fallback companion path: ${SCRIPT_DIR}" fi # Find fix-result.json in the output directory. diff --git a/internal/scaffold/fullsend-repo/scripts/post-prioritize.sh b/internal/scaffold/fullsend-repo/scripts/post-prioritize.sh index 467538fba..0c5ef645a 100755 --- a/internal/scaffold/fullsend-repo/scripts/post-prioritize.sh +++ b/internal/scaffold/fullsend-repo/scripts/post-prioritize.sh @@ -16,8 +16,10 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" # When this script runs from a content-addressed cache path # (sha256//content), companion files are not co-located. # Fall back to ${FULLSEND_DIR}/scripts if the companion is missing. -if [ ! -f "${SCRIPT_DIR}/lib/github-api-csma.sh" ] && [ -d "${FULLSEND_DIR:-.}/scripts/lib" ]; then - SCRIPT_DIR="${FULLSEND_DIR:-.}/scripts" +# FULLSEND_DIR is required (fail-closed) to avoid silently resolving to cwd. +if [ ! -f "${SCRIPT_DIR}/lib/github-api-csma.sh" ] && [ -d "${FULLSEND_DIR:?FULLSEND_DIR must be set}/scripts/lib" ]; then + SCRIPT_DIR="${FULLSEND_DIR}/scripts" + echo "Using fallback companion path: ${SCRIPT_DIR}" fi # shellcheck source=lib/github-api-csma.sh source "${SCRIPT_DIR}/lib/github-api-csma.sh"