package e2e import ( "encoding/json" "os" "path/filepath" "time" ) // agentDebugLog appends one NDJSON line for debug-mode hypothesis testing. // Best-effort only — never fails the suite. func agentDebugLog(hypothesisID, location, message string, data map[string]any) { // #region agent log payload := map[string]any{ "sessionId": "816647", "hypothesisId": hypothesisID, "location": location, "message": message, "data": data, "timestamp": time.Now().UnixMilli(), "runId": "pre-fix", } b, err := json.Marshal(payload) if err != nil { return } b = append(b, '\n') // Prefer repo-root log (workspace); also try cwd-relative for CI artifacts. paths := []string{ filepath.Join("..", "..", "debug-816647.log"), "debug-816647.log", } if wd, err := os.Getwd(); err == nil { paths = append([]string{filepath.Join(wd, "..", "..", "debug-816647.log")}, paths...) } for _, p := range paths { f, err := os.OpenFile(p, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0o644) if err != nil { continue } _, _ = f.Write(b) _ = f.Close() return } // #endregion }