Skip to content

graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs

Python

Merge Windows portability checks into release integration

Rach Pradhan84f9d8c3ccc8
diff --cc scripts/eval-cache-affinity.py
index 14a5c67b,ade8cb6c..4ea7e21d
--- a/scripts/eval-cache-affinity.py
+++ b/scripts/eval-cache-affinity.py
@@@ -135,11 -135,7 +135,12 @@@ def run(binary, cwd, artifacts, model,
env = measurement.provider_environment('codegraff', str(artifacts), source_env, model)
env['PWD'] = str(cwd)
env['GRAFF_LEARNING_PRIVACY'] = 'local'
- argv = ([sys.executable] if binary.suffix == '.py' else []) + [str(binary), '--no-local-tools', '--yolo', '--max-model-calls', '2',
+ with binary.open('rb') as executable:
+ shebang = executable.readline(256)
- # Windows cannot launch an extensionless shebang fixture via CreateProcess.
- launcher = [sys.executable] if os.name == 'nt' and shebang.startswith(b'#!') and b'python' in shebang.lower() else []
++ # Windows cannot launch Python scripts through CreateProcess by shebang.
++ launcher = [sys.executable] if os.name == 'nt' and (binary.suffix.lower() == '.py' or
++ (shebang.startswith(b'#!') and b'python' in shebang.lower())) else []
+ argv = [*launcher, str(binary), '--no-local-tools', '--yolo', '--max-model-calls', '2',
'--no-telemetry', '-p', prompt]
expected_hash = digest(binary)
started = time.monotonic_ns()
diff --cc scripts/test-workflow-isolation.py
index 76520a2f,75feeac5..718ef92d
--- a/scripts/test-workflow-isolation.py
+++ b/scripts/test-workflow-isolation.py
@@@ -75,9 -75,23 +75,25 @@@ def check(binary, phases)
trees = list((root/'.graff/worktrees').glob('agent-workflow-*'))
assert len(trees) == len(expected), trees
assert sorted((tree/'result.txt').read_text() for tree in trees) == expected
+ def values(item):
+ if isinstance(item, str):
+ yield item
+ elif isinstance(item, dict):
+ for value in item.values():
+ yield from values(value)
+ elif isinstance(item, list):
+ for value in item:
+ yield from values(value)
+
+ def path_text(value):
- return value.replace(chr(92) * 2, chr(92)).replace(chr(92), '/').casefold()
++ if os.name == 'nt':
++ return value.replace(chr(92) * 2, chr(92)).replace(chr(92), '/').casefold()
++ return value
+
+ delivered = path_text('\n'.join(values(tool_results)))
for tree in trees:
- # Compare the JSON-escaped spelling (Windows paths contain backslashes).
- assert json.dumps(str(tree))[1:-1] in text, 'retained path was not delivered'
+ expected_path = path_text(str(tree))
+ assert expected_path in delivered, 'retained path was not delivered'
branch = subprocess.check_output(['git', '-C', str(tree), 'branch', '--show-current'], text=True).strip()
assert branch in text, 'retained branch was not delivered'
print(f'PASS {"phases" if phases else "pipeline"}: dependent reads, isolated items, committed trees retained and delivered')