fix(scripts): force absolute DATA_DIR for nightly real-PI
Relative DATA_DIR from .env resolves under go test package cwd (internal/server/data/dev) and diverges from the pi-agent bind mount, leaving agents without template.md/blackboard.json.
This commit is contained in:
@@ -19,6 +19,8 @@ Thumbs.db
|
||||
|
||||
# Runtime Data, Logs, and Databases
|
||||
/data/
|
||||
# go test cwd=internal/server + relative DATA_DIR writes here by mistake
|
||||
internal/server/data/
|
||||
logs/
|
||||
*.log
|
||||
*.sqlite
|
||||
|
||||
@@ -132,7 +132,20 @@ export RUN_PI_E2E=1
|
||||
export KB_REQUIRE_ONLINE="${KB_REQUIRE_ONLINE:-1}"
|
||||
# Host Go tests must write workspaces into the same tree the runner mounts
|
||||
# (docker-compose.dev.yml: ./data/dev/workspaces → /app/data/workspaces).
|
||||
#
|
||||
# CRITICAL: `go test ./internal/server/...` runs with cwd=internal/server.
|
||||
# A relative DATA_DIR (e.g. ./data/dev from configs/.env.dev) resolves to
|
||||
# internal/server/data/dev and diverges from the pi-agent bind mount, so the
|
||||
# agent sees an empty workspace (missing template.md / blackboard.json) while
|
||||
# PrepareWorkspace wrote a complete tree under the package-local path.
|
||||
if [[ -n "${DATA_DIR:-}" && "${DATA_DIR}" != /* ]]; then
|
||||
echo "warning: ignoring relative DATA_DIR=${DATA_DIR}; forcing ${ROOT}/data/dev" >&2
|
||||
DATA_DIR="${ROOT}/data/dev"
|
||||
fi
|
||||
export DATA_DIR="${DATA_DIR:-${ROOT}/data/dev}"
|
||||
# Absolutize even if caller exported a relative path via other means.
|
||||
DATA_DIR="$(cd "${DATA_DIR}" 2>/dev/null && pwd -P || echo "${ROOT}/data/dev")"
|
||||
export DATA_DIR
|
||||
echo "==> DATA_DIR=${DATA_DIR}"
|
||||
|
||||
# Shared KB preflight (host :5432). Fail closed unless KB_ALLOW_OFFLINE=1.
|
||||
|
||||
Reference in New Issue
Block a user