Skip to content

fix(relay): recover dead-owner serve locks and expose connection failures - #144

Merged
OBenner merged 2 commits into
mainfrom
codex/141-relay-resilience
Nov 17, 2026
Merged

OBenner merged 2 commits into
mainfrom
codex/141-relay-resilience

Conversation

@OBenner

@OBenner OBenner commented Nov 17, 2026

Copy link
Copy Markdown
Owner

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 verify PASS — 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.

@OBenner
OBenner merged commit a6aa22b into main Nov 17, 2026
5 checks passed
@OBenner
OBenner deleted the codex/141-relay-resilience branch November 17, 2026 17:41
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.

Relay resilience: stale-lock recovery (dead-PID verified) + fail-loud diagnostics instead of silent fetch failed

1 participant