`vp config` rewrites unchanged git config on every run, so concurrent runs in linked worktrees fail with "could not lock config file"
Maintainer antworten meist innerhalb von 1 Tag
@naokihaba arbeitet bereits daran.
Seit 05.10.2026.
Bewertung
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Anfängerfreundlichkeit
- 84/100
- Issue-Typ
- Bug
- Klarheit
- Klar beschrieben
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- git, typescript
Rechercherichtung
Beginne in packages/cli/src/config/hooks.ts und lies install() sowie die Hilfsfunktionen gitConfigSet/gitConfigUnset. Reproduziere das mit den Shell-Befehlen für verknüpfte Worktrees und überprüfe anschließend, dass unveränderte Werte Schreibvorgänge überspringen und parallele Aufrufe von vp config --no-agent ohne config-lock-Fehler abgeschlossen werden, während die erstmalige Einrichtung weiterhin schreibt.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Describe the bug
install() in packages/cli/src/config/hooks.ts writes git config on every run, even when every value is already what it would write:
git config core.hooksPath <target>, even whencore.hooksPathalready equals<target>git config --local --unset-all vp.hooks.disabled, even when the key is not setgit config --local vp.hooks.dir …/vp.hooks.prefix …, even when the stored values are equal
Linked worktrees share one .git/config, and each write takes git's config.lock. So two vp config runs at the same time, in different worktrees of one clone, collide and one fails:
error: could not lock config file /path/to/repo/.git/config: File exists
When the run comes from a prepare script, the package manager reports a lifecycle failure (ERR_PNPM_EXECUTOR_LIFECYCLE_SCRIPT_FAILED) and the install fails. This happens whenever worktrees are set up in parallel, for example by several coding agents that each create a worktree and install.
Reproduction
No project files needed, only a clone with a second worktree:
mkdir repro && cd repro && git init -q && git commit -q --allow-empty -m init
git worktree add -q ../repro-wt HEAD
vp config --no-agent # first run: sets core.hooksPath once
for i in $(seq 1 20); do
vp config --no-agent >/dev/null 2>&1 || echo FAIL &
(cd ../repro-wt && vp config --no-agent >/dev/null 2>&1 || echo FAIL) &
wait
done | wc -l
On my machine this prints 18. Nothing needs to change after the first run, so the expected result is 0.
Suggested fix
Compare before writing, so a run that changes nothing never takes the lock (this keeps a relative core.hooksPath verbatim too):
function gitConfigSet(key, value) {
+ if (gitConfigGet(key, { local: true }) === value) return { ok: true };
...
}
function gitConfigUnset(key) {
+ if (gitConfigGet(key, { local: true }) == null) return { ok: true };
...
}
// install()
- const { status, stderr } = spawnSync('git', ['config', 'core.hooksPath', location.target]);
+ const { status, stderr } = existingHooksPath === location.target
+ ? { status: 0, stderr: '' }
+ : spawnSync('git', ['config', 'core.hooksPath', location.target]);
With this applied to the 1.0.0 dist as a local patch, 3 parallel runs × 10 rounds gave 0 failures, against 7/10 failures unpatched with 2 in parallel. A first-ever run in a clone still writes, but that happens once per clone rather than once per worktree setup.
System Info
- vite-plus 1.0.0 (global and local)
- git 2.55.0, macOS (Darwin 27)
Used Package Manager
pnpm (12.8.0)
- Vorherrschende Sprache
- Rust
- Sterne
- 6.5k
- Forks
- 296
- Ø Merge
- 1 T. 12 Std.
- Gemergte PRs (30 T.)
- 229
Entwicklungsumgebung
Startet den Dev-Container des Projekts im Browser, mit Ihrem eigenen GitHub-Konto.
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus voidzero-dev/vite-plus
-
Docker guide: the runtime stage needs libatomic1 for Node.js 25 and laterEvtl. vergeben @kshanxs hat das vor 1 Tag übernommen. Offendocumentation
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 84/100
voidzero-dev/vite-plus#3219 · 1 Kommentar · 1 Reaktion ·
Maintainer antworten meist innerhalb von 1 Tag
-
pending triage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
voidzero-dev/vite-plus#2882 · 2 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
vp run -r executes each package task twice when the root package has a matching recursive scriptEvtl. vergeben @wan9chi hat das vor 1 Tag übernommen. Offenpending triage
voidzero-dev/vite-plus#3221 · 1 Kommentar · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
-
pending triage
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 48/100
voidzero-dev/vite-plus#3218 ·
Maintainer antworten meist innerhalb von 1 Tag
-
LSP loads vite.config.ts with the server's cwd as rootEvtl. vergeben @leaysgur hat das vor 2 Tagen übernommen. Offenpending triage
voidzero-dev/vite-plus#3217 · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in voidzero-dev/vite-plus
Ähnliche Issues
-
area/tools bug session-analysis
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 84/100
nix-community/fenix#262 ·
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 67/100
GabrieleLozupone/kokon#41 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Small glitchOffenpriority: medium
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 66/100
storytold/photocraft#9538 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug P2 rust
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
Maintainer antworten meist innerhalb von 1 Tag