2727import sys
2828import urllib .error
2929import urllib .request
30+ from collections .abc import Sequence
3031from concurrent .futures import ThreadPoolExecutor
3132from pathlib import Path
3233
@@ -131,7 +132,7 @@ def check_endpoints(endpoints_path: str, timeout: float = 3.0) -> bool:
131132 print (f" [{ WARN } ] no endpoints listed in { endpoints_path } " )
132133 return True
133134 # Import the canonical constant so this script's "expected" stays in
134- # lockstep with src.sub_agent. SUBAGENT_MODEL (already env-var-aware) .
135+ # lockstep with rewardharness.evaluation.engine. SUBAGENT_MODEL.
135136 # Resolved lazily so check_env.py keeps working even if src/ isn't on
136137 # the path (e.g. running this from outside the repo root).
137138 try :
@@ -163,14 +164,22 @@ def check_endpoints(endpoints_path: str, timeout: float = 3.0) -> bool:
163164 return True # endpoint probe is informational only
164165
165166
166- def main () :
167+ def main (argv : Sequence [ str ] | None = None ) -> int :
167168 parser = argparse .ArgumentParser (description = __doc__ .split ("\n " )[0 ])
168169 parser .add_argument (
169170 "--endpoints" ,
170171 default = "configs/endpoints.txt" ,
171172 help = "Path to endpoints file (default: configs/endpoints.txt)" ,
172173 )
173- args = parser .parse_args ()
174+ parser .add_argument (
175+ "--timeout" ,
176+ type = float ,
177+ default = 3.0 ,
178+ help = "Per-endpoint timeout in seconds (default: 3.0)" ,
179+ )
180+ args = parser .parse_args (argv )
181+ if args .timeout <= 0 :
182+ parser .error ("--timeout must be positive" )
174183
175184 print ("RewardHarness preflight check\n " )
176185
@@ -183,7 +192,7 @@ def main():
183192 print ("\n 4. Service-account credentials" )
184193 ok_creds = check_credentials_file () if ok_env else False
185194 print ("\n 5. vLLM endpoints (informational)" )
186- check_endpoints (args .endpoints )
195+ check_endpoints (args .endpoints , timeout = args . timeout )
187196
188197 print ()
189198 all_required = ok_py and ok_imports and ok_env and ok_creds
0 commit comments