"""Back up fixed HEAD before use. Inject only the delegated stop executor, not its bound."""
from pathlib import Path
import subprocess
root=Path('/home/ubuntu/wt/issue-25636')
p=root/'apps/server/src/orchestration-v2/EffectWorker.ts'
head=subprocess.check_output(['git','show','HEAD:apps/server/src/orchestration-v2/EffectWorker.ts'],cwd=root,text=True)
assert p.read_text()==head,'Source must match fixed HEAD before injection'
Path('/tmp/issue-25636/EffectWorker.fixed-head.ts').write_text(head)
marker='case "delegated-tasks.stop":\n            return threads'
assert head.count(marker)==1
p.write_text(head.replace(marker,'case "delegated-tasks.stop":\n            return Effect.never;\n            return threads',1))
print('Injected Effect.never only at delegated-tasks.stop executor; fixed worker timeout retained.')
