fix(events): reclaim provably-dead orphaned endpoint claims instead of failing permanently - #229
Conversation
…f failing permanently
🦋 Changeset detectedLatest commit: d02cffc The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d02cffc339
ℹ️ 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".
Summary
<endpoint>.lockand releasing it previously bricked the endpoint: every later startup hitEEXIST, exhausted the bounded retries, and failed until someone manually removed the undocumented lock file./proc/<pid>/statstarttime on Linux) in the lockfile immediately after the exclusive open. OnEEXISTwith a non-live socket, a contender reclaims only when the owner is provably dead — ESRCH, or a live pid whose starttime mismatches (recycled pid, Linux) — deleting the orphan guarded by the same dev+inode identity check the release path already uses, then re-racing thewxopen so exactly one contender wins.Addresses the unresolved P2 Codex finding on #216 (
packages/agent-bundle/src/events/ipc.tsclaim retries).Test plan
pnpm test:unit packages/agent-bundle/tests/event-ipc.test.ts— new coverage: killed-owner reclamation, live-owner fail-closed, garbage-lockfile fail-closed, recycled-pid reclamation (asserts the live child is untouched); 5 failures when the source fix is revertedpnpm typecheck/pnpm lintclean