Skip to content

test(hosts): wait for killed hosts before deleting the update-worker temp dir - #379

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

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

Conversation

@andrebrait

Copy link
Copy Markdown
Collaborator

Fixes a Windows-only flake in lib/hosts/update-worker.test.mjs that fails the whole Verify (windows-latest) job with an unhandled error after every test has passed:

# Unhandled error between tests
EBUSY: resource busy or locked, rm 'C:\Users\RUNNER~1\AppData\Local\Temp\host-update-worker-…'
  at lib/hosts/update-worker.test.mjs:32:3

It hit #372 twice (runs 41549034406 and 41594672526), with 2438 and 2445 tests passing and 0 failing.

Cause: update-worker.ts relaunches the host with cwd: d.cwd, a directory inside the suite's temp dir. The after hook sent SIGTERM to those hosts and called rmSync on the same tick. On Windows the kill returns before the process has exited, and a running process keeps its cwd locked, so the delete failed with EBUSY.

Fix (test only): the hook now waits up to 5 s for every killed process (the spawned "old daemons" and the relaunched hosts) to exit. It then deletes the directory with rmSync's built-in maxRetries/retryDelay for any handle Windows releases late.

Verification: the file passes on Linux (27 pass, 0 fail) and leaves no host-update-worker-* directory behind. The EBUSY itself only happens on Windows, so this PR's Windows CI job is the real check.

@coderabbitai

coderabbitai Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 37 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available.

Learn how review limits work.

Review configuration:

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: 1aa81eee-4799-4765-8a1c-d46ac0515a97
Commits

Reviewing files that changed from the base of the PR and between 88ee1c5 and e262747.

Files selected for processing: 2
  • graphify-out/graph.json
  • lib/hosts/update-worker.test.mjs
  • 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

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.

@andrebrait

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-03T07:54:01.972168Z 1a9c785 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

Reviewed commit: 1a9c785b52

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@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.

This incremental bump doubles the rmSync retry budget from 10 to 20 attempts, which is exactly the right lever for a Windows teardown where antivirus and the search indexer keep holding handles a beat after the process exits. The 5 s liveness wait before the delete is still there, so the two mechanisms compose sensibly.

📊 Overall: Like a second pancake — the first one stuck to the pan, but this one slid out clean.

Files Reviewed (1 file)
  • lib/hosts/update-worker.test.mjs - maxRetries 10 → 20 in the after() cleanup
Previous Review Summaries (2 snapshots, latest commit d1df0a4)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit d1df0a4)

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.

This is a thoughtful fix for Windows file locking issues in tests, and the upload resume logic is well-implemented. The state machine handles transport changes, deadlines, backoffs correctly. Tests cover the edge cases nicely.

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

Files Reviewed (13 files)
  • lib/hosts/update-worker.test.mjs
  • components/ChatInput.tsx
  • components/ChatInput-uploads.tsx
  • components/ChatInput.uploads.test.mjs
  • docs/specs/2026-11-02-file-uploads-design.md
  • graphify-out/graph.json
  • lib/event-stream-worker.test.mjs
  • lib/event-stream-worker.ts
  • lib/event-stream.test.mjs
  • lib/event-stream.ts
  • lib/i18n/locales/en.json
  • lib/i18n/locales/ja.json
  • lib/i18n/locales/zh-CN.json
  • lib/upload-limits.ts

Fix these issues in Kilo Cloud

Previous review (commit 1a9c785)

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 (2 files)
  • graphify-out/graph.json
  • lib/hosts/update-worker.test.mjs

Fix these issues in Kilo Cloud


Reviewed by free · Input: 247.3K · Output: 21.8K · Cached: 192K

@andrebrait
andrebrait force-pushed the fix/update-worker-teardown branch from 1a9c785 to d1df0a4 Compare November 3, 2026 08:03
…temp dir

The suite's teardown SIGTERMed the relaunched hosts (cwd inside the temp dir) and
deleted the dir at once. Windows keeps a process's cwd locked until it exits, so
the delete failed with EBUSY as an unhandled error between tests (twice on
#372's Windows runs). Wait up to 5 s for every killed process, then
delete with rmSync's EBUSY retries.
@andrebrait

Copy link
Copy Markdown
Collaborator Author

Rebased onto #381, which landed the same Windows fix as a 2 s rmSync retry. This PR now keeps #381's retry line and adds only the part it does not cover: the teardown waits (up to 5 s) for the killed hosts to exit before deleting, so the delete no longer races a process that is still running with its cwd inside the temp dir. The retry stays for handles released just after exit. lib/hosts/update-worker.test.mjs: 27 pass, 0 fail.

@andrebrait
andrebrait force-pushed the fix/update-worker-teardown branch from d1df0a4 to e262747 Compare November 3, 2026 08:15
@andrebrait
andrebrait merged commit 97468ba into ompweb-dev:main Nov 3, 2026
5 checks passed
@andrebrait
andrebrait deleted the fix/update-worker-teardown branch November 3, 2026 13:00
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