Skip to content

Replay your coding agent sessions as a map and a timeline

fix(cli): hold the write lock across autotune off

aiswaryasankartest4110822087d2
diff --git a/python/src/agentplay/cli.py b/python/src/agentplay/cli.py
index 5312ef7..6a49f9d 100644
--- a/python/src/agentplay/cli.py
+++ b/python/src/agentplay/cli.py
@@ -447,10 +447,12 @@ def cmd_autotune(args: argparse.Namespace) -> int:
autotune.save(st.base, cfg)
print(f"Autotune runs at most once a day, when a Claude Code session starts ({path}).")
elif args.action == "off":
- for repo in args.repo or list(autotune.config(st.base)["repos"]):
- autotune.set_repo(st.base, repo, enabled=False)
- if not args.repo:
- autotune.uninstall_hook()
+ # One lock for the whole opt-out, as for `on`: a daily run cannot land halfway through it.
+ with fixes.write_lock(st.base):
+ for repo in args.repo or list(autotune.config(st.base)["repos"]):
+ autotune.set_repo(st.base, repo, enabled=False)
+ if not args.repo:
+ autotune.uninstall_hook()
print("Autotune is off.")
elif args.action == "run":
res = autotune.run(st, force=not args.daily)