path = r"C:\Users\intel\AppData\Local\OptimusRuntime\Labs\AR74\10_ar84_trust_boundary\candidate_workspace\app\remediation\self_repair\promotion_executor.py"
with open(path, "r", encoding="utf-8") as f:
    content = f.read()

old_is_temp = 'is_temp_ws = any(m in ws_str for m in ("temp", "tmp", "pytest", "test_ws"))'
new_is_temp = 'is_temp_ws = any(m in ws_str for m in ("temp", "tmp", "pytest", "test_ws", "brain_ws", "case_", "isolation_ws"))'

if old_is_temp in content:
    content = content.replace(old_is_temp, new_is_temp, 1)
    print("Updated is_temp_ws in promotion_executor.py")
else:
    print("old_is_temp not found")

with open(path, "w", encoding="utf-8") as f:
    f.write(content)

