Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ resources or an existing server. The local executor can run directly on a
prepared remote machine; SSH dispatch, distributed leases, automatic planning,
patch generation and Hub publication remain future work.

Local executor commands are noninteractive and receive EOF on standard input.
Supply their inputs through command arguments or files rather than the caller's
input stream.

## Directory map

![Implemented modules mapped to directories](assets/modular-directory-map-en.svg)
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/skill-comparison/cases.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"id": "audit-threshold",
"split": "holdout",
"mode": "audit",
"request": "Audit the fixed input report using its contract.",
"request": "Audit the fixed input report using its contract. Compute the median of per-trial request means, including every request in each trial, and the percentage reduction relative to the baseline aggregate.",
"contract": {"min_reduction_pct": 20},
"evidence_scope": "http_fixed_workload",
"baseline": {
Expand Down
1 change: 1 addition & 0 deletions src/inferrsi/infra/executors/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ def execute_command(command: tuple[str, ...], cwd: Path, trial_dir: Path, deadli
argv,
cwd=cwd,
env=environment,
stdin=subprocess.DEVNULL,
stdout=stdout,
stderr=stderr,
shell=False,
Expand Down
40 changes: 40 additions & 0 deletions tests/test_local_executor.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import json
import os
import subprocess
import sys
from pathlib import Path


def test_local_executor_does_not_inherit_parent_stdin(tmp_path):
child = tmp_path / "child.py"
child.write_text(
"import sys\n"
"from pathlib import Path\n"
"Path('received.txt').write_bytes(sys.stdin.buffer.read())\n",
encoding="utf-8",
)
parent = tmp_path / "parent.py"
parent.write_text(
"import json\n"
"import sys\n"
"import time\n"
"from pathlib import Path\n"
"from inferrsi.infra.executors.local import execute_command\n"
"command = (sys.executable, str(Path(__file__).with_name('child.py')))\n"
"result = execute_command(command, Path.cwd(), Path('trial'), time.monotonic() + 30)\n"
"print(json.dumps({'status': result['status']}))\n",
encoding="utf-8",
)
environment = dict(os.environ, PYTHONPATH=str(Path(__file__).resolve().parents[1] / "src"))
completed = subprocess.run(
(sys.executable, str(parent)),
cwd=tmp_path,
env=environment,
input="Unexpected instructions from the caller's input stream.\n",
text=True,
capture_output=True,
check=True,
timeout=60,
)
assert json.loads(completed.stdout) == {"status": "completed"}
assert (tmp_path / "received.txt").read_bytes() == b""
Loading