fix(agent): 记录 PI runner 数据目录核对结果

启动后第一次核对通过时打一条不含路径的日志,便于确认 test 没有再打到 dev sidecar。
This commit is contained in:
weichen
2026-09-28 03:17:26 +00:00
parent 4f581306d7
commit 3ba15df875
+3
View File
@@ -6,6 +6,7 @@ import (
"encoding/json"
"fmt"
"io"
"log"
"net/http"
"os"
"os/exec"
@@ -191,6 +192,7 @@ func probeRunnerDataRoot(ctx context.Context, runnerURL string) (string, bool) {
return "", false
}
runnerDataRoots.Store(runnerURL, root)
log.Printf("pi runner data_dir check passed")
return root, true
}
@@ -205,6 +207,7 @@ func workDirWithinRunnerRoot(workDir, root string) bool {
func (p *PiAgentBackend) executeRemote(ctx context.Context, runnerURL string, req Request, workDir string, timeout time.Duration) (*Result, error) {
if root, ok := probeRunnerDataRoot(ctx, runnerURL); ok && !workDirWithinRunnerRoot(workDir, root) {
// Do not include either path: the caller classifies this phrase, and paths leak host layout.
log.Printf("pi runner data root mismatch; refusing /v1/run")
return &Result{Success: false, ErrorReason: "pi runner data root mismatch"}, nil
}