[Bug]: Dev servers start on page loads with Developer Tools turned off
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 35/100
Línea de trabajo
Start with the shutdown function in server.php, which rewrites herd.json to store lastSite under a lock, and with HerdConfiguration::loadConfigFile(), which reads the same file without one. Run the race.php script from the report against herd.json to reproduce the empty reads. Done means a concurrent reader can never see an empty file and treat aiAssistant as enabled. The fix needs maintainer agreement on the locking approach.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Platform
macOS
Operating system version
macOS Sequoia 15.6.1 (24G90)
System architecture
ARM64 (M1, M2, etc)
Herd Version
2.0.3 (Build: 72)
PHP Version
No response
Bug description
With "Enable Herd Developer Tools" off (aiAssistant.enabled: false in herd.json), Herd still occasionally starts npm run dev for a site I'm browsing, under herd-devtools-helper, and leaves a public/hot behind.
I traced it to a race on herd.json. The shutdown function in server.php rewrites the file on every request to store lastSite, locking it, truncating it and then writing it. But HerdConfiguration::loadConfigFile() reads it with a plain file_get_contents() and no lock. A request that reads it between the truncate and the write gets an empty string, fill() ends up with no aiAssistant key, and since a missing enabled defaults to true, aiAssistantEnabled() returns true. LaravelValetDriver::ensureViteDevServer() then calls /ai/dev-ensure and the dev server boots.
So any site that gets concurrent requests (a page and its XHRs, an Inertia app polling etc.) hits it eventually.
Steps to reproduce
- Save this as
race.php, it readsherd.jsonthe same wayHerdConfigurationdoes:
<?php
$until = microtime(true) + 15;
$reads = $empty = 0;
while (microtime(true) < $until) {
$reads++;
if (file_get_contents($argv[1]) === '') {
$empty++;
}
}
echo "$empty empty reads out of $reads\n";
- Run it while firing concurrent requests at any Laravel site (POSTs, so nothing actually boots):
php race.php ~/Library/Application\ Support/Herd/config/herd.json &
seq 400 | xargs -P 12 -I{} curl -s -k -o /dev/null -X POST https://example.test/
I get 72 empty reads out of ~520k. Each of those would read as AI assistant enabled.
Relevant log output
When it happens the unified log shows:
[HerdDevtools] vite.start skipped for lido: queued until the worktree resolves
[HerdDevtools] ensureRepo path=/Users/jack/Projects/lido nonGit=false
[HerdDevtools] worktree.create useRepoPath=true repoId=49101c7f
[HerdDevtools] worktree.created repoId=49101c7f id=e82bb067 branch=main
And /var/tmp/herd-dev-ensure-<md5 of site> is touched in the same second.
- Lenguaje dominante
- Sin datos de lenguaje
- Estrellas
- 125
- Forks
- 1
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de beyondcode/herd-community
-
fixed-in-next-release macOS
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
beyondcode/herd-community#1774 ·
-
[Bug]: PHP 8.3 php.ini missing auto_prepend_file and herd-ext extension lines (dump() undefined)AbiertomacOS
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
beyondcode/herd-community#1693 ·
-
macOS
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
beyondcode/herd-community#1602 ·
-
macOS
Dificultad 4/5 3-5 días Aptitud para principiantes 15/100
beyondcode/herd-community#1799 · 3 comentarios ·
-
macOS
Dificultad 4/5 3-5 días Aptitud para principiantes 22/100
beyondcode/herd-community#1797 ·
Todos los issues de beyondcode/herd-community
Issues similares
-
ready-for-agent
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
neilsh/stunt-reel#217 ·
Los mantenedores suelen responder en 1 día
-
status:needs-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
Los mantenedores suelen responder en 4 días
-
[Request]: aikonic-clarityPosiblemente ocupada @SirJaye la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
ScoopInstaller/Extras#19254 ·
Los mantenedores suelen responder en 1 día
-
needs triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 71/100
pbakaus/impeccable#1314 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
richardcase/skills#26 ·
Los mantenedores suelen responder en 1 día