Skip to content

Client transaction test fixture has no child timeout or failure cleanup #4003

Closed

Description

@luvs01

Client or integration

Other

Area

Other

Summary

The client connection transaction fixture in tests/clients/client-connect.test.ts launches its Bun child with spawnSync without a timeout. A child that prints valid final JSON but remains alive can keep the test worker blocked; fixture cleanup is only returned after the synchronous call and JSON parsing succeed.

The fixture should enforce an internal child deadline, reject unsuccessful child completion before interpreting output, and remove both temporary homes when child execution or output parsing fails.

Reproduction

  1. Use dev commit 402be7c1f88283eb8465c3aec8437ccecd2542ec with the project-pinned Bun 1.4.0.
  2. Add a test-only script/deadline override to runTransactionScenario, leaving its existing spawnSync behavior unchanged. The injected child records its PID and the two fixture homes, prints {"ok":true}, and keeps a five-second timer alive. Request a two-second internal deadline.
  3. The baseline returns successfully after the five-second timer instead of reporting a timeout. The regression fails because no process error was raised. A child without that finite test fuse would have no deadline inside this fixture.
  4. With a bounded synchronous call, require timeout failure before a natural-exit marker is written, absence of the exact child PID, and removal of both homes. Also check valid output followed by nonzero exit and malformed output.

The mock uses temporary directories and local child processes only. It does not contact a provider or change production configuration. This identifies a fixture safety gap; it does not establish which test caused the earlier macOS CI cancellation.

Version

402be7c; Bun 1.4.0 (34cbb9a40)

Operating system

Microsoft Windows 11 Pro, version 10.0.26200 (build 26200)

Provider and model

Not provider-specific; local test fixture only.

Logs or error output

Expected constructor: ClientStateProbeError
Received value: undefined
(fail) transaction fixture stops a child retained after valid output [5090.21ms]
0 pass / 1 fail / 2 assertions

Screenshots and supporting files

The regression and bounded fixture change will be linked in a focused pull request.

Redacted configuration

No production configuration is required. The existing fixture supplies isolated OPENCODEX_HOME and CODEX_HOME directories and mocked network responses.

Checks

  • I searched existing issues and documentation.
  • I removed secrets, tokens, account details, request credentials, and personal data.

Activity

  1. lidge-jun commented on Sep 8, 2026

    @lidge-jun
    Owner

    리뷰 · 우선순위 55 / 80

    이 이슈는 프로덕션 프록시 버그가 아니라, tests/clients/client-connect.test.ts의 클라이언트 연결 트랜잭션 픽스처 안전 문제입니다. 지금 dev 402be7c1f에서 runTransactionScenario는 자식을 spawnSync로 띄운 뒤 타임아웃 없이 기다리고, stdout 마지막 줄을 JSON으로 파싱한 다음에야 임시 홈을 지울 cleanup을 돌려줍니다. 그래서 자식이 {"ok":true}를 이미 찍고도 살아 있으면 테스트 워커가 막히고, 실패·파싱 오류 경로에서는 홈 정리가 보장되지 않을 수 있습니다.

    재현 설명도 구체적입니다. Bun 1.4.0과 HEAD SHA를 고정했고, 유효 JSON 뒤 5초 타이머를 남긴 자식을 넣어 기본 동작이 5초 뒤에 성공으로 돌아온다는 실패 로그(Expected ClientStateProbeError / Received undefined)까지 붙여 두었습니다. “이 구멍이 예전 macOS CI 취소의 원인”이라고 단정하지 않은 점도 좋습니다. 픽스처 계약만 요구합니다. 원하는 계약은 (1) 내부 child deadline, (2) 비정상 종료·시그널·타임아웃은 파싱 전에 거절, (3) 실행/파싱 실패 시 양쪽 임시 홈 삭제입니다.

    같은 파일에는 이미 더 엄격한 본보기가 있습니다. readStateProbe는 비동기 spawn에 deadline과 SIGKILL을 쓰고, 파일 하단 다른 spawnSync도 timeout: INTERNAL_DEADLINE_MS와 killSignal: "SIGKILL"을 씁니다. tests/helpers/test-budget.ts의 INTERNAL_DEADLINE_MS = 15_000, SPAWN_BUDGET_MS = 45_000가 그 기준입니다. 즉 이 이슈는 새 설계를 요구하는 게 아니라, 트랜잭션 헬퍼만 같은 규칙으로 맞추라는 요청입니다. 런타임 경로(src/cli/connect, src/client/connect) 변경이 필요하지 않습니다.

    짝 PR #4004(test(clients): bound transaction fixture child completion)가 이미 열려 있고, 본문에 Closes #4003이 있습니다. 그 PR은 기본 15초 예산·실패 시 홈 정리·유지 자식/nonzero/invalid JSON 회귀를 넣었습니다. 다만 아직 draft이고 전체 CI 확인이 남아 있습니다. 이슈 자체에 더 손볼 내용은 거의 없고, 추적 단위는 PR 쪽으로 옮기는 편이 맞습니다.

    경로 tests/clients/client-connect.test.ts / runTransactionScenario - 현재 dev에서 spawnSync에 timeout/killSignal이 없고, 실패 시 홈 강제 정리도 없다.
    재현 절차 - 픽스처만 겨냥한 로컬 자식·임시 디렉터리라서 제공자/설정 오염 없이 검증 가능하다. 좋은 버그 리포트다.
    이슈 범위 - “모든 descendant-pipe 수명 문제를 해결한다”가 아니라 이 헬퍼 계약만 요구하므로, 과잉 스코프 위험이 작다.

    메인테이너의 판단이 필요한 지점

    너의 추천
    이슈는 open으로 두고 #4004 머지에 맡긴다. #4004가 초록·Ready가 되면 머지하고 이 이슈를 닫는다. 중복 이슈나 types/config 분할과 충돌하지 않으니 닫을 이유는 없다.

    이 댓글은 grok-bot이 작성했습니다

  2. added a commit that references this issue on Sep 8, 2026
    cfff026
  3. lidge-jun commented on Sep 8, 2026

    @lidge-jun
    Owner

    Fixed on dev in cfff026 (via #4049, carrying #4004 by @luvs01).

    The transaction fixture in tests/clients/client-connect.test.ts now bounds child completion, so a hung child fails the case instead of holding the suite. Verified at the merged head: bun test tests/clients/client-connect.test.ts passes, and the full Cross-platform CI run 34256853348 was green across 19 jobs.

    Closing manually because pull requests here target dev, and GitHub only auto-closes on merge into main.

  4. lidge-jun commented on Sep 8, 2026

    @lidge-jun
    Owner

    Landed via #4049 at cfff026

  5. added a commit that references this issue on Sep 17, 2026
    3568058
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinglanded-via-maintainerOriginal PR closed after landing via a maintainer merge train

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions