@@ -270,3 +270,76 @@ class Result:
270270 assert (
271271 exported / "requests/requests-00001.jsonl"
272272 ).read_text () == '{"scope":"producer"}\n '
273+
274+
275+ @pytest .mark .asyncio
276+ async def test_wandb_init_failure_is_recorded_in_the_session_artifacts (tmp_path ):
277+ # A sink that cannot start only logs to the sidecar container's stderr, which
278+ # no run artifact captures, so a disabled sink is indistinguishable from a
279+ # healthy run that logged nothing. Leave the reason behind in the session.
280+ trusted = tmp_path / "trusted"
281+ agent = tmp_path / "agent"
282+ _repo (trusted , "VALUE = 1\n " )
283+ _repo (agent , "VALUE = 1\n " )
284+ cases = tmp_path / "cases.json"
285+ cases .write_text ('[{"id":"task","task_name":"org/task"}]' )
286+ evaluation_set = EvaluationSet (name = "benchmark" )
287+ objective = ObjectiveSpec (
288+ selector = MetricSelector (metric = "score" ),
289+ direction = "maximize" ,
290+ )
291+ session_dir = tmp_path / "state/session"
292+ config = {
293+ "repo_path" : str (trusted ),
294+ "agent_repo_path" : str (agent ),
295+ "session_dir" : str (session_dir ),
296+ "backends" : {
297+ "backend" : {
298+ "task_source" : "org/benchmark@1.0" ,
299+ "agent_import_path" : "program:Agent" ,
300+ "cases_path" : str (cases ),
301+ "harbor_requirement" : "harbor==0.1.17" ,
302+ "uv_executable" : sys .executable ,
303+ }
304+ },
305+ "access_policies" : [],
306+ "budgets" : [],
307+ "selection" : {
308+ "mode" : "auto_best" ,
309+ "backend_id" : "backend" ,
310+ "evaluation_set" : evaluation_set .model_dump (mode = "json" ),
311+ "objective" : objective .model_dump (mode = "json" ),
312+ "baseline_version" : "HEAD" ,
313+ },
314+ "targets" : [
315+ {
316+ "reward_key" : "reward" ,
317+ "backend_id" : "backend" ,
318+ "evaluation_set" : evaluation_set .model_dump (mode = "json" ),
319+ "objective" : objective .model_dump (mode = "json" ),
320+ }
321+ ],
322+ "admin_volume" : str (tmp_path / "state/admin" ),
323+ "wandb" : {"project" : "vero-tests" },
324+ }
325+
326+ import vero .runtime .wandb as wandb_module
327+
328+ def _explode (** kwargs ):
329+ raise ValueError ("Input should be a valid URL, relative URL without a base" )
330+
331+ original = wandb_module .SidecarWandbSink
332+ wandb_module .SidecarWandbSink = _explode
333+ try :
334+ components = await build_harbor_components (config )
335+ finally :
336+ wandb_module .SidecarWandbSink = original
337+
338+ # The eval path survives: observability never takes the sidecar down.
339+ assert components .telemetry is None
340+ recorded = json .loads (
341+ (session_dir / "artifacts/wandb/init-error.json" ).read_text ()
342+ )
343+ assert recorded ["project" ] == "vero-tests"
344+ assert recorded ["error_type" ] == "ValueError"
345+ assert "valid URL" in recorded ["error" ]
0 commit comments