Repository navigation
test(hosts): wait for e2e update processes before deleting their temp directory - #387
Conversation
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 (2 files)
Previous Review Summaries (6 snapshots, latest commit bf9e43f)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit bf9e43f)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 (19 files)
Previous review (commit 8cea299)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)
Previous review (commit ef5d68e)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)
Previous review (commit 44c305d)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)
Previous review (commit 0a5201f)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)
Previous review (commit c6932a8)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)
Reviewed by free · Input: 352.1K · Output: 41.1K · Cached: 160.3K |
|
@codex review |
|
@coderabbitai review |
Action not completed
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Swish! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
|
@coderabbitai review |
Action not completed
|
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 44c305d5c0
ℹ️ 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".
| for (const pid of pids) { | ||
| if (owned.has(pid) || !Number.isSafeInteger(pid) || pid <= 1 || pid === process.pid || !alive(pid)) continue; | ||
| const identity = await processStartIdentity(pid); | ||
| if (identity) owned.set(pid, identity); |
There was a problem hiding this comment.
Capture identities when processes write the PID ledger
If a recorded process exits before the next polling pass and its PID is reused, this loop adopts the unrelated replacement's start identity as its own. The rollback "exit" fixture specifically appends its PID immediately before process.exit(4) (hostScript/hostBody in update-fixture.test-helper.mjs), so the ledger can contain already-dead, never-adopted PIDs. The later identity check in after then matches the replacement and sends it SIGTERM, potentially terminating another test or local process. This is separate from the documented check-to-signal race. Record the start identity alongside the PID in the writer, or retain a process handle, rather than deriving ownership from whoever currently holds the recorded PID.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in ef5d68e: ownership no longer comes from whoever holds a recorded pid. Every process the test starts runs a script from its unique mkdtemp directory, so the after hook signals a recorded pid only while its command line still names that directory (/proc/<pid>/cmdline, Win32_Process.CommandLine, ps). A reused pid runs something else and is skipped, including the rollback fixture's ledger entry for a host that already exited. The start-identity adoption is removed. Locally both relaunched hosts match and are stopped, with no leftover processes; the remaining check-to-signal window is documented.
|
@codex review |
|
Codex Review: Didn't find any major issues. 🚀 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
|
@coderabbitai review |
Action not completed
|
|
@coderabbitai review |
Action performed
|
8cea299 to
bf9e43f
Compare
…orary directory Windows CI passed all tests but the after hook threw EBUSY while deleting a directory still held by a relaunched host. Track shell wrappers, the actual old daemon, detached update worker, and launched hosts. Await termination before removal, treat exited Linux zombies as stopped, and retry only transient filesystem errors. Preserve every update assertion and surface unexpected kill errors.
…ches CodeRabbit review: a recorded pid can be reused after its process exits. Capture each recorded process start identity while the run is in progress (also on failure or timeout), kill the owned ChildProcess handles directly, and send SIGTERM to a recorded pid only while its identity still matches.
CodeRabbit review: identities were captured only once the update finished, so a process that exited during it could hand its pid to another one first. Capture them on every poll, and document the residual check-then-signal window for pid-only entries.
…ded pid Codex review: a recorded pid that exited before it was adopted could be reused, and the replacement adopted as ours. Every process the test starts runs a script from its unique temporary directory, so signal a recorded pid only while its command line still names that directory. This replaces the start-identity adoption.
…identified CodeRabbit review: a failed command-line lookup skipped a live process silently. Retry once, then fail the hook while the process is still alive.
|
Merge approved by the user. Main advanced with #389, so I rebased this cleanup-only branch onto it before landing. No cleanup implementation changed. Local full suite: 2499 pass, 12 skip, 0 fail; typecheck passed. Awaiting this head’s CI, then merging with the head SHA pinned. |
bf9e43f to
f8342d6
Compare
Failure
Windows CI on #385 reports 2449 passed tests, zero failed tests, then an unhandled EBUSY in lib/hosts/host-update-e2e.test.mjs cleanup. The after hook sends termination signals then removes the directory immediately.
Fix
Track each test-owned child, actual old daemon and detached worker from status, and launched hosts via the existing fixture PID ledger. Register the original daemon immediately, before startup can fail. Wait for all recorded live processes to stop before removing the directory. Linux zombies already released handles, so they count as stopped. Ignore only ESRCH when terminating. Retry bounded transient directory-removal errors because Bun ignores rmSync retry options.
Only the e2e test changes; production behavior and all update assertions remain intact. No test skips or swallowed unexpected failures. No changelog entry for this internal test-only repair.
Verification
Real success and rollback update scenarios: 2 pass on Linux, including final cleanup. Full suite: 2475 pass, 12 skip, 0 fail. ESLint and typecheck pass. One adversarial review completed; its cleanup-ownership, zombie and termination-error findings are addressed. Windows confirmation remains for CI.
Summary by CodeRabbit