()
| 194 | |
| 195 | |
| 196 | def main(): |
| 197 | ap = argparse.ArgumentParser() |
| 198 | ap.add_argument("--binary", action="append", required=True, help="mode=/absolute/path") |
| 199 | ap.add_argument("--output", required=True) |
| 200 | ap.add_argument("--workers", default="1,4,8") |
| 201 | ap.add_argument("--repetitions", type=int, default=5) |
| 202 | ap.add_argument("--scenarios", default="balanced,read-heavy") |
| 203 | ap.add_argument("--events", type=int, default=16) |
| 204 | ap.add_argument("--turns", type=int, default=2) |
| 205 | ap.add_argument("--serialize-stop", action="store_true") |
| 206 | args = ap.parse_args() |
| 207 | binaries = dict(x.split("=", 1) for x in args.binary) |
| 208 | configs = {"balanced": {"reads_per_event": 1}, "read-heavy": {"reads_per_event": 4}, |
| 209 | "paced": {"reads_per_event": 1, "think_ms": 100}} |
| 210 | result = {"kind": "deterministic real-CLI multi-session replay; no model calls", "platform": platform.platform(), |
| 211 | "binaries": {k: {"path": str(pathlib.Path(v).resolve()), "sha256": hashlib.sha256(pathlib.Path(v).read_bytes()).hexdigest()} for k, v in binaries.items()}, "runs": []} |
| 212 | # Reuse stopped, fully recorded fixture templates. Setup is never timed. |
| 213 | # TemporaryDirectory cleanup also removes copied local owner metadata. |
| 214 | with tempfile.TemporaryDirectory(prefix="atomic-multi-templates-") as templates: |
| 215 | roots = {} |
| 216 | for mode, binary in binaries.items(): |
| 217 | root = pathlib.Path(templates) / mode |
| 218 | root.mkdir() |
| 219 | fixture = SeededFixture(pathlib.Path(binary).resolve(), root) |
| 220 | try: |
| 221 | fixture.start() |
| 222 | fixture.hook("user-prompt-submit", {"session_id": base.SESSION, "prompt": "Prepare fixed benchmark context"}) |
| 223 | fixture.hook("stop", {"session_id": base.SESSION, "reason": "end_turn", "response": "Context prepared"}) |
| 224 | finally: |
| 225 | fixture.close() |
| 226 | roots[mode] = root |
| 227 | execute(args, binaries, configs, result, roots) |
| 228 | |
| 229 | |
| 230 | def execute(args, binaries, configs, result, roots): |
no test coverage detected