Repository navigation
fix(relay): recover dead-owner serve locks and expose connection failures - #144
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A crashed relay left a serve lock behind, so restarting a channel could fail with an opaque
fetch failed. Recover a lock only when the OS positively reports its owner PID as dead (ESRCH), and expose actionable, redacted transport/startup errors through MCP and stderr.Recovery and release serialize through a persistent SQLite sidecar mutex; fresh acquisition still uses plain exclusive creation before opening the application DB. Live, unknown, or malformed owners fail closed. Ownership comparison prevents an old release from removing another owner's lock. Authentication and protocol semantics remain unchanged.
Validation: full
pnpm verifyPASS — 131 files, 1172 tests. Includes independent-process crash/recovery, three competing recoverers, killed mutex holder, real auth-v2 restart, structured MCP diagnostics, supervisor failure categories, and preservation of both errors when rollback fails. Architecture and independent dev2 review approved; the nonblocking rollback comment is addressed in a separate commit with a regression test.Review limitation: dev2 reported one initial test failure without a retained log or identifiable test, followed by a passing test run and two passing full verify runs. Our full runs passed, including the final logged run after the rollback fix; the unidentified failure has not been diagnosed.
Limitations: an alive but unresponsive owner is not stolen; malformed records require operator inspection. PID reuse can cause a conservative refusal. The mutex sidecar must remain persistent. Retire external helpers that directly delete serve locks when rolling out this fix; production relay and the temporary keepalive task were not changed here.
Closes #141.