Skip to content

test(hosts): retry the update-worker temp cleanup a Windows child still holds - #381

Merged
andrebrait merged 1 commit into
ompweb-dev:mainfrom
andrebrait:fix/update-worker-ebusy
Nov 3, 2026
Merged

andrebrait merged 1 commit into
ompweb-dev:mainfrom
andrebrait:fix/update-worker-ebusy

Conversation

@andrebrait

@andrebrait andrebrait commented Nov 3, 2026 •

Copy link
Copy Markdown
Collaborator

lib/hosts/update-worker.test.mjs's after() only signals its child processes, then removes the temp dir at once. On Windows a child can still hold a handle there, so rmSync throws EBUSY and bun reports "1 error" (an unhandled error between tests) with every test passing. It failed Verify (windows-latest) on #380 twice (run 41597241583, attempts 1 and 2) and on feat/dual-mode-session-fork (run 41578056750). The cleanup now retries (maxRetries: 20, retryDelay: 100).

Summary by CodeRabbit

  • Tests
    • Test runs now retry temporary-file cleanup when the initial attempt does not succeed, helping ensure temporary test data is removed reliably. No changes were made to application behavior.

…ll holds

The after() hook only signals its children; on Windows one can still
hold a handle in the temp dir, so rmSync failed EBUSY as an unhandled
error between tests (seen on several branches).
@coderabbitai

coderabbitai Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Walkthrough

The test teardown now retries recursive removal of its temporary directory up to 20 times, waiting 100 ms between attempts. It still signals child processes and restores the saved environment.

Changes: Test teardown

Layer / File(s) Summary
Temporary-directory cleanup retries
lib/hosts/update-worker.test.mjs
Teardown retries recursive temporary-directory removal up to 20 times, with a 100 ms delay between attempts.

Estimated code review effort: 2 (Simple) | ~5 minutes

Change: Other

Merge Risk: Minimal · up to 5aa18

The change adds bounded retries for temporary-directory cleanup without changing worker behavior. No actionable merge-blocking risk was identified.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the change: retrying the update-worker temp directory cleanup in the test teardown because a Windows child process can still hold a handle. The raw summary confirms the test teardown n…
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the change: retrying the update-worker temp directory cleanup in the test teardown because a Windows child process can still hold a handle. The raw summary confirms the test teardown now retries recursive removal up to 20 times with a 100 ms wait, and the objectives describe the same EBUSY cause. The title is specific and matches the main change.

Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 1 files.

Finishing Touches
Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

A rabbit checks the cleanup trail,
And waits a beat when first attempts fail.
Twenty tries, each pause just right,
The temp dir leaves before the night.
Then hops away, its tests all neat.

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.
Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b22354a8-3cb8-4c66-b9b6-77bac1012a75
Commits

Reviewing files that changed from the base of the PR and between 28fcfee and 5aa18ce.

Files selected for processing: 2
  • graphify-out/graph.json
  • lib/hosts/update-worker.test.mjs

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 0 remain after this review.

Recent review details
Context from checks skipped due to timeout: 4
  • GitHub Check: CodeRabbit
  • GitHub Check: Verify (windows-latest)
  • GitHub Check: Verify (ubuntu-latest)
  • GitHub Check: Kilo Code Review
Additional context used
Code guidelines: 3
docs/specs/2026-10-28-remote-hosts-design.md — auto-discovered
docs/specs/2026-10-29-local-daemon-design.md — auto-discovered
AGENTS.md — auto-discovered
Path-based instructions: 3
Applicability reference: AGENTS.md: # omp-web - Development Notes **Link = one WebSocket per host, dialled by the daemon** (`/api/hosts/link`; design `docs/specs/2026-10-31-websocket-link-design.md`).

CodeRabbit inference engine (docs/specs/2026-10-28-remote-hosts-design.md)

Files:

  • lib/hosts/update-worker.test.mjs
Applicability reference: AGENTS.md: # omp-web - Development Notes Source excerpt: **The local daemon is required.**

CodeRabbit inference engine (docs/specs/2026-10-29-local-daemon-design.md)

Files:

  • lib/hosts/update-worker.test.mjs
Source excerpt: omp-web never imports `@oh-my-pi/*` or `@earendil-works/*` packages, even though the server now runs on Bun: live work goes through the installed `omp` child.

CodeRabbit inference engine (AGENTS.md)

Files:

  • lib/hosts/update-worker.test.mjs

@kilo-code-bot

kilo-code-bot Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Code Review Roast 🔥

Verdict: No Issues Found | Recommendation: Merge

Oh wait, this PR is actually clean. I need to sit down. I had my flamethrower warmed up and everything.

📊 Overall: Like finding a unicorn in production — I didn't think clean PRs existed anymore, but here we are.

Files Reviewed (1 file)
  • lib/hosts/update-worker.test.mjs

Reviewed by free · Input: 41.7K · Output: 1.1K · Cached: 75.7K

@andrebrait
andrebrait merged commit 88ee1c5 into ompweb-dev:main Nov 3, 2026
5 checks passed
andrebrait added a commit that referenced this pull request Nov 3, 2026
…ore removing their temp dir (#383)

On Windows the update-worker test's after() hook failed with EBUSY on
rm 'host-update-worker-XXXX' even with the maxRetries added in #381.

Two causes, both in teardown:
- Bun's fs.rmSync ignores maxRetries/retryDelay (verified: a bind-mounted
  dir fails with EBUSY after 0 ms under bun, after the full backoff under
  node), so the retries never ran.
- after() only signalled processes and went straight to rmSync. A killed
  Windows process keeps its cwd and handles until it is gone, and the
  detached daemons the worker launches (cwd inside `base`) were known only
  by the pid in health.json, which candidates that never acknowledged do
  not write.

Now each fake host appends its pid to a pidfile on its first line (the
fake manager's web already had one), after() signals every recorded pid
plus the stand-ins and waits (10 s) until each is gone, then removes
`base` with its own retry loop. The descriptor's daemon cwd is the OS tmp
dir instead of a directory inside `base`, since no test depends on it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant