diff --git a/.gitignore b/.gitignore index b8ccde8b..55c3a25f 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/internal/server/workflow_governance_piagent_pg_test.go b/internal/server/workflow_governance_piagent_pg_test.go index 1a185db3..88bdf74c 100644 --- a/internal/server/workflow_governance_piagent_pg_test.go +++ b/internal/server/workflow_governance_piagent_pg_test.go @@ -266,7 +266,7 @@ func TestWorkflowGovernance_PiAgent_PG_FullChain(t *testing.T) { WfKey: workflowdef.OfficialKeyMain, TaskKey: "intake", StageKey: "V0.1_triage", - ProjectName: "PG PiAgent 治理链中文项目", + ProjectName: fmt.Sprintf("PG PiAgent 治理链 %d", time.Now().UnixNano()%1_000_000), Materials: []bizdev.MaterialInput{{ Filename: "project_brief.md", Content: []byte("# 项目简报\n\n- 产品:超声软组织手术系统\n- 目标:NMPA III 类注册路径摸底\n- 关键需求:双频刀头、灌注与负压吸引\n"), @@ -280,7 +280,7 @@ func TestWorkflowGovernance_PiAgent_PG_ProductManager_FullChain(t *testing.T) { WfKey: workflowdef.OfficialKeyProductManager, TaskKey: "system_reqs", StageKey: "requirements_baseline", - ProjectName: "PG PiAgent 产品经理治理链", + ProjectName: fmt.Sprintf("PG PiAgent 产品经理 %d", time.Now().UnixNano()%1_000_000), ExpectPlanningDone: true, Materials: []bizdev.MaterialInput{{ Filename: "intake_summary.md", @@ -295,7 +295,7 @@ func TestWorkflowGovernance_PiAgent_PG_TestManager_FullChain(t *testing.T) { WfKey: workflowdef.OfficialKeyTestManager, TaskKey: "test_manager", StageKey: "system_verification_planning", - ProjectName: "PG PiAgent 测试经理治理链", + ProjectName: fmt.Sprintf("PG PiAgent 测试经理 %d", time.Now().UnixNano()%1_000_000), ExpectPlanningDone: true, Materials: []bizdev.MaterialInput{{ Filename: "verification_scope.md", diff --git a/scripts/run-nightly-real-pi.sh b/scripts/run-nightly-real-pi.sh index 1a751965..acb530ed 100755 --- a/scripts/run-nightly-real-pi.sh +++ b/scripts/run-nightly-real-pi.sh @@ -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.