[Flaky test] TestBackgroundWorktreeIsolationAndMerge
Les mainteneurs répondent en général sous 1 jour
Évaluation
- Difficulté
- 3/5
- Temps estimé
- Une demi-journée
- Accessibilité débutants
- 20/100
Piste de recherche
Start with the concurrent launch in pkg/runtime/background_worktree_test.go (lines 134-139) and the completed assertion at line 156, then find where the background agent path runs git worktree add. Run the repro loop from the issue to see the commondir failure. Done means the flaky subtest passes reliably, either by serializing per-repo creation or retrying transient failures. PR #4923 is already open against this, so check it before starting.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Description
Failed once on PR #4907's test-linux (run 43133474124, first attempt, Nov 12). The linked=false subtest launches two background agents that create their git worktrees concurrently in the same repo (pkg/runtime/background_worktree_test.go:134-139); task first failed with
creating background worktree: creating git worktree: exit status 128:
Preparing worktree (new branch 'worktree-agent-bb8bc299-...')
fatal: failed to read .git/worktrees/agent-788eb22e-.../commondir: Success
while task second completed normally — its worktree is exactly the admin entry first's git worktree add stumbled on. A short read of a half-written commondir (errno 0 ⇒ "Success") means one git worktree add read another's in-flight administrative entry and exited 128, so the task was marked failed and the test's completed assertion (background_worktree_test.go:156) failed.
I reproduced the git-level race locally (linux/amd64, git 2.51.0), independently of the test harness: 16 concurrent git worktree add in a fresh repo, 400 rounds — 51 rounds hit exactly this error (fatal: failed to read .git/worktrees/<name>/commondir: Success, plus an ENOENT variant), with several concurrent adds stumbling over the same half-written entry within one round. The test itself only races 2 concurrent adds, which matches its low flake rate; CI runner I/O widens the window.
Expected Behavior
Concurrent background worktree creation in one repo is safe; a transient git failure of this kind doesn't fail a task the test expects to complete.
Actual Behavior
Intermittently, one concurrent creation fails on a half-written admin entry and the task is recorded as failed.
Steps to Reproduce
- Run the repro script (pasted under Error output) on Linux
- It races 16 concurrent
git worktree addin a fresh repo, 400 rounds - Measured here: 51/400 rounds hit the error below
Docker Agent version
No response
OS & terminal
No response
Model used
No response
Error output
hits=0
for r in $(seq 1 400); do
base=$(mktemp -d)
git init -q $base/repo
git -C $base/repo commit -q --allow-empty -m i
for i in $(seq 1 16); do
( git -C $base/repo worktree add $base/w$i HEAD >/dev/null 2>$base/err$i ) &
done
wait
grep -q commondir $base/err* 2>/dev/null && hits=$((hits+1))
rm -rf $base
done
echo "rounds with a commondir failure: $hits/400" # measured: 51/400
Screenshots
No response
Additional context
report-main-failures only auto-files flakes seen on main, so this PR-run failure isn't in the tracker yet. Suggested direction:
serialize per-repo worktree creation in the background-agent path, or retry a creation that fails with a transient commondir read error.
Happy to work on the fix.
- Langage dominant
- Go
- Étoiles
- 4.7k
- Forks
- 565
- Merge moyen
- 18 h 52 min
- PR mergées (30 j)
- 221
Préparer son environnement
Lance le conteneur de développement du projet dans votre navigateur, avec votre propre compte GitHub.
- Fournit un Dockerfile ou un fichier Docker Compose
- Aucun modèle de pull request
- Aucun guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de docker/docker-agent
-
edit_file diff rendering panics on invalid UTF-8 textPeut-être pris @TDnorthgarden l’a pris aujourd’hui. Ouvertearea/tui
Difficulté 2/5 1-3 heures Accessibilité débutants 85/100
docker/docker-agent#4955 ·
Les mainteneurs répondent en général sous 1 jour
-
A setting to turn off the models.dev catalog download (offline and strict-network use)Peut-être pris @3431481073 l’a pris il y a 19 jours. Ouvertearea/config area/models
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
docker/docker-agent#4714 ·
Les mainteneurs répondent en général sous 1 jour
-
Error when trying to run sandbox example?Peut-être à nouveau libre @dgageot l’a pris il y a 28 jours, et aucune pull request n’est ouverte. Ouvertearea/cli
Difficulté 2/5 1-3 heures Accessibilité débutants 62/100
docker/docker-agent#4672 · 1 commentaire · 1 réaction · 1 personne assignée ·
Les mainteneurs répondent en général sous 1 jour
-
`edit_file` silently edits the first match when `oldText` occurs more than oncePeut-être pris @dwin-gharibi l’a pris il y a 103 jours. Ouvertearea/tools
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
docker/docker-agent#3929 · 2 commentaires ·
Les mainteneurs répondent en général sous 1 jour
-
area/api area/runtime
Difficulté 4/5 3-5 jours Accessibilité débutants 48/100
docker/docker-agent#4951 ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de docker/docker-agent
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
IBM-Cloud/terraform-provider-ibm#7115 ·
Les mainteneurs répondent en général sous 2 jours
-
Difficulté 2/5 1-3 heures Accessibilité débutants 86/100
fluxcd/notification-controller#1441 ·
Les mainteneurs répondent en général sous 1 jour
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 66/100
volcengine/volcengine-go-sdk#163 · 1 commentaire ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
OneBusAway/maglev#2145 ·
Les mainteneurs répondent en général sous 2 jours
-
priority/medium status/ready type/chore
Difficulté 2/5 1-3 heures Accessibilité débutants 84/100
discobox-ai/discobox#1357 ·
Les mainteneurs répondent en général sous 1 jour