Skip to content

Commit f799ef0

Browse files
committed
Merge branch 'main' of github.com:CodeClash-ai/CodeClash
2 parents 279f532 + 72f81a6 commit f799ef0

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

codeclash/agents/player.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def __init__(
3131
self.game_context = game_context
3232
self.push = config.get("push", False)
3333
# Force the branch push (used on ladder resume, to overwrite an interrupted rung's partial
34-
# pushes). Safe here because a run's push branch has a single writer. Uses --force-with-lease.
34+
# pushes). Safe here because a run's push branch has a single writer.
3535
self._force_push = config.get("force_push", False)
3636
self.logger = get_logger(
3737
self.name,
@@ -151,7 +151,7 @@ def post_run_hook(self, *, round: int) -> None:
151151

152152
if self.push:
153153
token = os.getenv("GITHUB_TOKEN")
154-
force = " --force-with-lease" if self._force_push else ""
154+
force = " --force" if self._force_push else ""
155155
# origin is absent during the agent's turn (see _isolate_git); re-add it only to push,
156156
# then remove it again so the next round's agent still can't reach opponent code.
157157
for cmd in [
@@ -236,9 +236,10 @@ def _isolate_git(self) -> None:
236236
"git for-each-ref --format='%(refname)' refs/remotes refs/tags | xargs -r -n1 git update-ref -d",
237237
"git reflog expire --expire=now --all",
238238
"git gc --prune=now --quiet",
239+
"rm -f .git/FETCH_HEAD .git/ORIG_HEAD",
239240
]:
240241
self.environment.execute(cmd)
241-
self.logger.info("Isolated git: removed origin + opponent branches/tags (anti-cheat)")
242+
self.logger.info("Isolated git: removed origin + opponent branches/tags + FETCH_HEAD (anti-cheat)")
242243

243244
def _commit(self) -> None:
244245
"""Commit changes to the agent's codebase."""

0 commit comments

Comments
 (0)