Skip to content

test: wait for resume daemon before cleanup - #878

Open
EivMeyer wants to merge 1 commit into
mainfrom
fix/resume-detach-cleanup-race
Open

test: wait for resume daemon before cleanup#878
EivMeyer wants to merge 1 commit into
mainfrom
fix/resume-detach-cleanup-race

Conversation

@EivMeyer

@EivMeyer EivMeyer commented Aug 1, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • wait for the winning resume --detach daemon PID to exit after durable cluster completion
  • keep E2E teardown from deleting the isolated home while that daemon can still write under .zeroshot
  • preserve the existing assertion that exactly one daemon wins the concurrent resume claim

Root cause

PR #863 exposed an ENOTEMPTY failure in the test's afterEach cleanup. The test waited for clusters.json to reach stopped, but that is a durable cluster-state boundary, not proof that the detached daemon process has finished its shutdown writes. Teardown could therefore race the daemon inside .zeroshot.

This change waits on the daemon PID already reported by the winning resume command, so teardown starts only after the process boundary is terminal.

Verification

  • exact race case: 5 consecutive post-fix passes
  • mocha tests/e2e/resume-detach-daemon.test.js: 4 passing
  • ESLint: no errors (one pre-existing max-lines warning)
  • Prettier and TypeScript checks pass

@greptile-apps

greptile-apps Bot commented Aug 1, 2026

Copy link
Copy Markdown

Greptile Summary

The PR makes the concurrent resume --detach E2E test wait for the winning daemon process to terminate before teardown.

  • Extracts the daemon PID from the successful resume command’s established output.
  • Polls process liveness after durable cluster completion, preventing isolated-home cleanup from racing final daemon writes.
  • Preserves the existing exactly-one-winner assertions.

Confidence Score: 5/5

The PR appears safe to merge, with the new wait correctly fencing teardown against the detached daemon’s remaining lifetime.

The successful racer reliably reports its detached daemon PID, and waiting for that process to exit before the test returns prevents the subsequent teardown from deleting the isolated home while the daemon may still be shutting down.

Important Files Changed

Filename Overview
tests/e2e/resume-detach-daemon.test.js Adds a correctly ordered daemon-process termination wait before the test returns and triggers isolated-home teardown.

Reviews (1): Last reviewed commit: "test: wait for resume daemon before clea..." | Re-trigger Greptile

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