fix(rivetkit): add lifecycle error retry and gateway HTTP routing#4666
Conversation
Code Review: fix(rivetkit): add lifecycle error retry and gateway HTTP routingOverviewThis PR introduces two main changes:
The WebSocket listener ordering fix (attach close/error before Positive Aspects
Issues and Suggestions1. URL normalization logic is duplicated across 4 locations The
This should be extracted to a shared utility to keep the normalization rule in one place. 2. The method uses an explicit allowlist of known paths (
3. if (
err instanceof AbortError ||
(err as Error).name === 'AbortError' ||
!this.#shouldRetryConnectionOpenError(err)
) {
logger().info({ msg: 'connection retry aborted' });
}A non-abort, non-retryable error will hit this branch and be logged only as 4. The three exact string matches ( 5. No unit tests for The classification logic has significant branches: structured vs. legacy, actor vs. transport, 6. Agent notes committed to repo
7. PR description is blank The checklist is entirely unchecked and there is no test description. Should be filled out before marking ready (Bug fix + New feature for Minor Notes
SummaryThe core approach is sound. Structured lifecycle errors + client-side retry is the right model, and the gateway routing fix is correct. Main concerns before marking ready: deduplicate the URL normalization logic, add unit tests for |
Preview packages published to npmInstall with: npm install rivetkit@pr-4666All packages published as Engine binary is shipped via Docker images: docker pull rivetdev/engine:slim-c672e53
docker pull rivetdev/engine:full-c672e53Individual packagesnpm install rivetkit@pr-4666
npm install @rivetkit/react@pr-4666
npm install @rivetkit/rivetkit-native@pr-4666
npm install @rivetkit/workflow-engine@pr-4666 |

Description
Please include a summary of the changes and the related issue. Please also include relevant motivation and context.
Type of change
How Has This Been Tested?
Please describe the tests that you ran to verify your changes.
Checklist: