@@ -53,6 +53,8 @@ def main():
5353 parser .add_argument ("--guest-dependencies" , type = Path , required = True )
5454 parser .add_argument ("--output" , type = Path , required = True )
5555 parser .add_argument ("--image" , default = "python:3.12-slim" )
56+ parser .add_argument ("--context-delivery" , choices = ("off" , "on" ), default = "off" ,
57+ help = "Qualify the existing opt-in context transport through source and fresh receivers" )
5658 parser .add_argument ("--reuse-point" , type = Path , help = "Reuse an already sealed synthetic source; never count its source test as passed" )
5759 parser .add_argument ("--captured-config" , type = Path , help = "The reused point's matching native fixture configuration" )
5860 args = parser .parse_args ()
@@ -103,6 +105,7 @@ def main():
103105 "LOOPX_NATIVE_CHECKPOINT_BIN" : "/native/codex" }
104106 client = docker .from_env (timeout = 30 )
105107 image = client .images .get (args .image ).id # Caller-prepared image, no implicit pull.
108+ context_results = {}
106109
107110 def guest (command , volumes , env , log , * , capture_supervisor = None ):
108111 container = client .containers .create (image , command , platform = "linux/amd64" ,
@@ -117,6 +120,12 @@ def guest(command, volumes, env, log, *, capture_supervisor=None):
117120 log .write_bytes (container .logs ())
118121 assert status ["StatusCode" ] == 0 , f"Qualification failed; inspect { log } "
119122 require_one_pass (log .parent / log .stem / "junit.xml" )
123+ if env .get ("LOOPX_CONTEXT_DELIVERY" ) == "on" :
124+ reports = list ((log .parent / log .stem ).rglob ("context-delivery-result.json" ))
125+ assert len (reports ) == 1
126+ context_results [log .stem ] = json .loads (reports [0 ].read_bytes ())
127+ assert context_results [log .stem ]["context_delivery" ] == "on"
128+ assert context_results [log .stem ]["reads" ][0 ]["mode" ] == "full"
120129 finally :
121130 if capture_supervisor :
122131 capture_supervisor .close ()
@@ -153,11 +162,19 @@ def guest(command, volumes, env, log, *, capture_supervisor=None):
153162 script = ("from pathlib import Path; import time,pytest; "
154163 "p=Path('/opt/loopx-benchmark/control'); p.mkdir(parents=True); "
155164 f"(p/'phase-deadline').write_text(str(int(time.time())+{ SYNTHETIC_PHASE_SECONDS } )); "
156- "raise SystemExit( pytest.main(["
165+ "code= pytest.main(["
157166 "'/source/benchmark/tests/test_native_checkpoint_handoff.py::"
158- "test_actual_worker_captures_pending_replan_before_native_model[planning]',"
167+ f "test_actual_worker_captures_pending_replan_before_native_model[{ args . context_delivery } - planning]',"
159168 "'-q','-rs','-p','no:cacheprovider','--basetemp=/qualification/source-tmp',"
160- "'--junitxml=/qualification/source.xml']))" )
169+ "'--junitxml=/qualification/source.xml']); " )
170+ if args .context_delivery == "on" :
171+ # Copy the declared report while the source writer is alive;
172+ # its root-owned pytest directory stays private to that guest.
173+ script += ("\n if code == 0:\n "
174+ " reports=list(Path('/qualification/source-tmp').rglob('controller-result.json'))\n "
175+ " assert len(reports) == 1\n "
176+ " Path('/qualification/context-delivery-source.json').write_bytes(reports[0].read_bytes())\n " )
177+ script += "\n raise SystemExit(code)"
161178 container = client .containers .create (image , ["python" , "-c" , script ],
162179 platform = "linux/amd64" , network_disabled = True ,
163180 volumes = {** base , str (source_files ): {"bind" : "/qualification" , "mode" : "rw" }},
@@ -172,6 +189,18 @@ def guest(command, volumes, env, log, *, capture_supervisor=None):
172189 supervisor .close ()
173190 assert status ["StatusCode" ] == 0 , f"Inspect { output / 'source.log' } "
174191 require_one_pass (source_files / "source.xml" )
192+ if args .context_delivery == "on" :
193+ # The real source writer may be root. Its private pytest
194+ # directory is intentionally unreadable to this controller;
195+ # stage only the declared result through the daemon seam.
196+ from benchmark .edgebench .checkpoint_worker import _archive
197+ report = _archive (container , "/qualification/context-delivery-source.json" ,
198+ output / "source-context-result.json" )
199+ report .chmod (0o600 )
200+ context_results ["source" ] = json .loads (report .read_bytes ())
201+ assert context_results ["source" ]["context_delivery" ] == "on"
202+ reads = context_results ["source" ]["context_reads" ]
203+ assert reads [0 ]["mode" ] == "full" and any (row ["mode" ] == "delta" for row in reads [1 :])
175204 points = [p for p in (output / "points" ).iterdir () if p .is_dir () and not p .name .startswith ("." )]
176205 assert len (points ) == 1 and len (grades ) == 1
177206 point = points [0 ]
@@ -222,6 +251,7 @@ def guest(command, volumes, env, log, *, capture_supervisor=None):
222251 str (results ): {"bind" : "/results" , "mode" : "rw" }, ** extra_volumes },
223252 {"LOOPX_JOINT_RECEIVER_POINT" : "/point" , "LOOPX_JOINT_RECEIVER_CONFIG" : "/captured-config.toml" ,
224253 "LOOPX_RUNTIME_ROOT" : "/results/transport-runtime" ,
254+ "LOOPX_CONTEXT_DELIVERY" : args .context_delivery ,
225255 ** ({"LOOPX_JOINT_RECEIVER_STRIDE" : "1" } if stride else {}),
226256 ** extra_env },
227257 output / f"{ name } .log" , capture_supervisor = capture_supervisor )
@@ -245,7 +275,8 @@ def guest(command, volumes, env, log, *, capture_supervisor=None):
245275 str (third ): {"bind" : "/results" , "mode" : "rw" }},
246276 {"LOOPX_JOINT_RECEIVER_POINT" : "/point" , "LOOPX_JOINT_RECEIVER_CONFIG" : "/captured-config.toml" ,
247277 "LOOPX_JOINT_RECEIVER_GOAL" : "joint-grandreceiver" , "LOOPX_JOINT_RECEIVER_AGENT" : "joint-grandresearcher" ,
248- "LOOPX_RUNTIME_ROOT" : "/results/transport-runtime" },
278+ "LOOPX_RUNTIME_ROOT" : "/results/transport-runtime" ,
279+ "LOOPX_CONTEXT_DELIVERY" : args .context_delivery },
249280 output / "grandreceiver.log" )
250281 assert not grades if args .reuse_point else len (grades ) == 1
251282 # The same native provider must also complete the public Core journey
@@ -262,6 +293,8 @@ def guest(command, volumes, env, log, *, capture_supervisor=None):
262293 assert not subprocess .check_output (["git" , "-C" , str (source ), "status" , "--porcelain" ], text = True ).strip (), "Source changed during qualification"
263294 receipt = {"passed" : True , "controller_uid" : os .getuid (), "provider_revision" : args .provider_revision ,
264295 "source_revision" : source_revision , "source_tree_dirty" : False ,
296+ "context_delivery" : args .context_delivery ,
297+ "native_context_reads" : context_results ,
265298 "qualification_sha256" : {p .name : hashlib .sha256 (p .read_bytes ()).hexdigest () for p in
266299 [Path (__file__ ), source / "benchmark/tests/test_native_checkpoint_handoff.py" ,
267300 source / "benchmark/tests/test_checkpoint_joint_receiver.py" ,
0 commit comments