core tests: orphan PTY slave fd test fails on Macs where /dev/ttys001 exists
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
- 76/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- node.js, typescript
Direzione di ricerca
Leggi packages/core/src/services/shellExecutionService.test.ts, in particolare i test “Orphan PTY slave FD cleanup” intorno alla riga 1559, e verifica come closeOrphanSlaveFd usa i mock del file system. Esegui npx vitest run src/services/shellExecutionService.test.ts -t "Orphan PTY slave FD cleanup" da packages/core. Il lavoro è completato quando i casi con percorsi reali corrispondenti e non corrispondenti sono mockati intenzionalmente e il test passa indipendentemente dai dispositivi presenti sulla macchina.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
What happened?
ShellExecutionService > Orphan PTY slave FD cleanup > synchronously closes the matching slave fd when platform is darwin in packages/core/src/services/shellExecutionService.test.ts fails on a Mac that has a second terminal tab open:
AssertionError: expected undefined to be 12
❯ src/services/shellExecutionService.test.ts:1559:22
const result = closeOrphanSlaveFd(10, '/dev/ttys001');
expect(result).toBe(12);
The test mocks fs.statSync and fs.fstatSync, but not fs.realpathSync. closeOrphanSlaveFd calls the real fs.realpathSync('/dev/ttys001'):
- On CI (Linux), or a Mac with only one terminal,
/dev/ttys001doesn't exist. The call throws,targetRealPathstaysundefined, and the function matches on the mockedrdevalone, so the test passes. - On a Mac with more than one terminal open,
/dev/ttys001is a real device.targetRealPathgets set, and the function then compares it with the realrealpathSync('/dev/fd/12'). fd 12 in the test process isn't that terminal, so the candidate is skipped and the function returnsundefined.
So the result depends on which terminals happen to be open on the machine running the tests.
To reproduce, on macOS with at least two terminal windows or tabs open:
ls -l /dev/ttys001 # exists
cd packages/core
npx vitest run src/services/shellExecutionService.test.ts -t "Orphan PTY slave FD cleanup"
# × synchronously closes the matching slave fd when platform is darwin
Changing only the path in that test to one that doesn't exist (/dev/ttys999) makes it pass, which confirms it's the real realpathSync call.
What did you expect to happen?
The test should give the same result on every machine. Mocking realpathSync alongside statSync / fstatSync (or using a device name that can't exist) would make it deterministic. Mocking it also lets the test cover the path-verification branch on purpose instead of by accident: one case where the candidate's /dev/fd/N path matches, and one where it doesn't.
I have a small test-only fix ready and can open a PR if this is OK to be marked help wanted.
Client information
Running the unit tests from source, not the installed CLI, so there's no /about output.
mainatd4cb1713f- macOS 27.3, arm64
- Node.js 20.19.0 (the version CONTRIBUTING.md asks for). Same result on Node 24.5.0.
Login information
Not applicable; unit tests only.
Anything else we need to know?
The slave-FD cleanup and this test came in with #29340. The function itself looks fine; it's only the test that reaches the real filesystem.
- Lingua principale
- TypeScript
- Stelle
- 109k
- Fork
- 15k
- Merge medio
- 1g 1h
- PR unite (30g)
- 121
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di google-gemini/gemini-cli
-
status/need-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
google-gemini/gemini-cli#30383 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
gemini mcp add --include-tools/--exclude-tools does not split comma-separated lists, silently inverting tool filteringForse già presa @anujmishra03 l’ha presa 2 giorni fa. Apertastatus/need-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
google-gemini/gemini-cli#30330 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Bug: core.sshCommand="" causes fatal: unable to fork on git pushForse già presa @sakaintp l’ha presa 2 giorni fa. Apertastatus/need-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
google-gemini/gemini-cli#30328 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Padded function-call name is answered under the trimmed name, so the next request fails with 400 INVALID_ARGUMENTForse già presa @arifrhm l’ha presa 6 giorni fa. Apertaarea/agent status/need-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
google-gemini/gemini-cli#30256 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
status/need-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
google-gemini/gemini-cli#30242 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di google-gemini/gemini-cli
Issue simili
-
`@angular/[email protected]` depends on vulnerable Vite 7.3.7 - GHSA-p4f5-76q4-ffq7 (Critical RCE)Apertaarea: @angular/build
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
angular/angular-cli#34764 ·
I maintainer di solito rispondono entro 1 giorno
-
P2
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 84/100
I maintainer di solito rispondono entro 1 giorno
-
bug ready-for-human
Difficoltà 2/5 1-3 ore Idoneità per principianti 60/100
LucasSantana-Dev/Lucky#3150 ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement good first issue priority: low size: XS
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
vercel-labs/scriptc#3979 ·
I maintainer di solito rispondono entro 1 giorno