"""S4's second half: resume a pending Magentic plan review in a **fresh interpreter**. A resume proved inside the parent process would prove nothing about U12. The whole point of the asynchronous HITL time-scale is that the expert answers days later, in a process that never saw the run — so the only thing allowed to cross the boundary is the checkpoint on disk. Running the resume as its own module, launched by ``subprocess``, is what makes that boundary real (``tests/test_hosting_loadbearing.py`` set this precedent for the hosted shim). Usage (the test supplies the arguments; nothing here is wired into ``src/``):: python -m spikes.e_magentic_resume Writes ONE line of JSON to stdout: the resumed run's manager calls, remaining requests and outputs. Anything else on stdout would make the parent's parse the fragile part of the spike. """ from __future__ import annotations import asyncio import json import sys from spikes.e_magentic import resume_from_checkpoint def main(argv: list[str]) -> int: if len(argv) != 4: print(f"usage: {argv[0]} ", file=sys.stderr) return 2 storage_dir, request_id, checkpoint_id = argv[1], argv[2], argv[3] result = asyncio.run( resume_from_checkpoint(storage_dir, request_id=request_id, checkpoint_id=checkpoint_id) ) print(json.dumps(result, sort_keys=True)) return 0 if __name__ == "__main__": raise SystemExit(main(sys.argv))