Skip to content

test(core): flaky AppProcess interruption tests (readiness race) #51951

Closed

Description

@saulalfonsos

Description

packages/core/test/process/process.test.ts is flaky on a loaded machine. The two AppProcess interruption tests ("fiber interruption cleans up the scoped child process after readiness" and the timeout variant) sometimes fail with:

expect(yield* waitForFile(ready)).toMatch(/^\d+$/)
Received: ""

The child script writes the ready file before registering its SIGTERM handler, and writeFileSync creates the file empty before writing the pid. So the test can read an empty file, or send SIGTERM before the handler exists (the child then dies without writing settled).

OpenCode version

dev

Steps to reproduce

  1. cd packages/core
  2. Run bun test test/process/process.test.ts 16 times in parallel, in a loop (I used ~60 rounds).
  3. A few runs fail as above; running the file alone rarely shows it.

Operating System

macOS (arm64)

Activity

  1. github-actions commented on Sep 28, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

  2. saulalfonsos commented on Oct 5, 2026

    @saulalfonsos
    Author

    Related to #37321 but not a duplicate. Besides the empty-read symptom, the child writes ready before registering its SIGTERM handler, so the test can signal it before the handler exists and settled is never written. #48205 only makes waitForFile tolerate empty files; #51952 fixes both at the source (handler first, atomic write via rename).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions