🤖 tests: backgroundProcessesRepro reads exit_code before the trap writes it (CI flake)
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 72/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- shell, typescript
- Lĩnh vực
- testing
Hướng nghiên cứu
Bắt đầu từ helper spawnExited trong src/node/services/backgroundProcessesRepro.test.ts, khoảng dòng 107, nơi nó chờ tệp mã thoát rồi đọc một lần duy nhất. EXIT trap ghi marker nằm trong src/node/runtime/backgroundCommands.ts, gần dòng 83. Cũng kiểm tra các khối chờ-rồi-đọc tương tự gần dòng 386 và 478 trong cùng tệp kiểm thử. Hoàn thành khi helper chỉ resolve sau khi tệp chứa một số và bài kiểm thử vượt qua nhiều lần dưới tải.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
expectReproFailurereported "repro failed elsewhere". The real error came from the setup helperspawnExited, 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)
- 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. spawnExitedwaits only until the file exists (backgroundProcessesRepro.test.ts:107), then reads it once (line 108). A read in that gap returns "".- 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
- Ngôn ngữ chính
- TypeScript
- Star
- 2.1k
- Fork
- 139
- Merge trung bình
- 3 giờ 35 phút
- Pull request đã merge (30 ngày)
- 950
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Không có mẫu pull request
- Không có hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của coder/xum
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
coder/xum#7733 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
unocss/unocss#5421 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
needs-area
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Azure/typespec-azure#5936 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 Nửa ngày Mức phù hợp với người mới 72/100
vercel-labs/scriptc#2910 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
automation missing-model model-sync provider:fireworks-ai
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
anomalyco/models.dev#12458 ·
Maintainer thường phản hồi trong vòng 1 ngày