Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

🤖 tests: backgroundProcessesRepro reads exit_code before the trap writes it (CI flake)

Aperta Adatta ai principianti
#6,504 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
72/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
shell, typescript
Ambito
testing

Direzione di ricerca

Inizia dall'helper spawnExited in src/node/services/backgroundProcessesRepro.test.ts, intorno alla riga 107, dove attende il file con il codice di uscita e poi lo legge una sola volta. Il trap EXIT che scrive il marcatore si trova in src/node/runtime/backgroundCommands.ts, vicino alla riga 83. Controlla anche i blocchi simili di attesa e lettura vicino alle righe 386 e 478 dello stesso file di test. È completato quando l'helper si risolve solo dopo che il file contiene un numero e il test supera ripetutamente sotto carico.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Problem

backgroundProcessesRepro.test.ts failed once in CI and passed on the rerun. The failing test is "terminating a background process that already exited > a stop after a natural exit sends no signal to the process group" (2013 ms).

  • Run: https://github.com/coder/xum/actions/runs/38532297270 (attempt 1, job "Test / Unit (1/6)", PR #6475). Attempt 2 passed.
  • expectReproFailure reported "repro failed elsewhere". The real error came from the setup helper spawnExited, not from the target assertion:
at spawnExited (src/node/services/backgroundProcessesRepro.test.ts:108:63)
expect(received).toBe(expected)
Expected: "3"
Received: ""

Cause (from reading the code, not reproduced yet)

  1. The wrapper's EXIT trap writes the marker with echo $? > "$__MUX_EXIT_CODE_PATH" (src/node/runtime/backgroundCommands.ts:83). The shell creates the file first and writes the digits after that. For a short time the file exists and is empty.
  2. spawnExited waits only until the file exists (backgroundProcessesRepro.test.ts:107), then reads it once (line 108). A read in that gap returns "".
  3. The product reader already treats an empty marker as "no exit code yet" (getExitCodeStrict, src/node/services/backgroundProcessExecutor.ts:654-659). So I think only the test helper is wrong. I did not verify every other reader.

This is not the same cause as #6443 (that one is slow happy-dom matcher output inside waitFor).

Possible fix

Make the helper wait until the file holds a number (for example waitFor(async () => /^\d+$/.test((await fs.readFile(f, "utf-8").catch(() => "")).trim()))), and check other tests that use the same "exists, then read" shape on exit_code (lines 386 and 478 of the same file wait on files too).


Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: high • Cost: $1.26

Lingua principale
TypeScript
Stelle
2.1k
Fork
142
Merge medio
5h 26m
PR unite (30g)
903

Preparare l'ambiente

  • Include un Dockerfile o un file Docker Compose
  • Nessun modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di coder/xum

Tutte le issue di coder/xum

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.