Skip to content

Add Unix socket reconnect and Session daemon state restore - #2

Merged
bk203 merged 3 commits into
masterfrom
feature/reconnect-session-restore
Jun 8, 2026
Merged

bk203 merged 3 commits into
masterfrom
feature/reconnect-session-restore

Conversation

@bk203

@bk203 bk203 commented Jun 5, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Add opt-in ReconnectingTransport that reconnects on ConnectionException and invalidates stale socket fds
  • Add ReconnectableTransportInterface so Session replays daemon-side EVENT_REGISTER after reconnect via restoreDaemonState()
  • Retry request() / requireSuccess() once on connection loss; harden streamedRequest() cleanup on disconnect
  • Add ConnectionFailureContext on ConnectionException with getDetailedMessage() for transport diagnostics (stream metadata, endpoint, partial I/O, PHP errors)

Test plan

  • composer test (67 tests)
  • composer stan (PHPStan level 8)
  • Unit tests for transport reconnect, invalidation, and wrapper retry
  • Integration tests for server restart, event replay, mid-command retry, and streamed request fail-fast
  • Unit tests for ConnectionException diagnostics and enriched failure context

Replay EVENT_REGISTER from registration refcounts via ReconnectableTransportInterface, retry request() once on connection loss, and harden streamed command cleanup.
@bk203
bk203 force-pushed the feature/reconnect-session-restore branch from 9074cc8 to 1302dee Compare June 5, 2026 13:10
Capture stream metadata, endpoint state, partial I/O progress, and PHP errors in ConnectionFailureContext so stale socket failures are easier to diagnose.
@bk203

bk203 commented Jun 5, 2026

Copy link
Copy Markdown
Owner Author

Update: Added commit 88f8fb1 — ConnectionException now carries a ConnectionFailureContext with stream metadata, endpoint state (including whether the Unix socket file exists), partial read/write progress, and PHP error text. Use $e->getDetailedMessage() in catch blocks to diagnose stale-socket failures without restarting the app.

@bk203
bk203 merged commit f51d511 into master Jun 8, 2026
1 check passed
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