Skip to content

test: disable git auto-maintenance in swe workspace diff test - #2469

Open
gavinqii wants to merge 1 commit into
THUDM:mainfrom
gavinqii:fix/swe-workspace-diff-maintenance-race
Open

gavinqii wants to merge 1 commit into
THUDM:mainfrom
gavinqii:fix/swe-workspace-diff-maintenance-race

Conversation

@gavinqii

Copy link
Copy Markdown

Problem

tests/test_agent/test_swe_workspace_diff.py::test_patch_uses_actual_image_baseline_without_changing_git_index is flaky on CI. Example: https://github.com/THUDM/slime/actions/runs/38288879812 (job agent-test (0, test_agent/test_swe_workspace_diff.py)):

shutil.Error: [('.../agent repo/.git/objects/maintenance.lock', '.../grader repo/.git/objects/maintenance.lock', "[Errno 2] No such file or directory: ...")]

The runner has git 2.55. After the test's git commit, git starts auto-maintenance in the background, which creates and then deletes .git/objects/maintenance.lock. The next line, shutil.copytree(repo, fresh), sometimes lists the lock file and then fails because it's gone before the copy reaches it.

Fix

Turn off auto-maintenance and auto-gc in the temporary test repo (maintenance.auto=false, gc.auto=0) right after git init. The test only uses this repo as a fixture, so nothing it checks depends on maintenance.

Testing

Ran pytest tests/test_agent/test_swe_workspace_diff.py locally 3 times with the CI agent-test dependency set on Python 3.10; 3/3 passed each run.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant