fix(rivetkit): restore hibernatable sockets and hydrate serverless starts#4658
Conversation
PR Review: fix(rivetkit): restore hibernatable sockets and hydrate serverless startsThis PR restores hibernatable WebSocket connections across serverless actor restarts and improves sleep test reliability. The core idea is sound - persisting connection metadata in KV and injecting it into the serverless start payload enables proper socket rebinding after a cold start. Overall quality is good with a few things worth addressing. What This Does
Issues
No comment explains what is being waited for or why 100ms is sufficient. This is a timing assumption that will be flaky in slow CI- A statement explaining the race being guarded against would help; ideally a polling approach (similar to "alarms keep actor awake" test semantics changed The original test verified the actor did NOT sleep while an alarm was active by checking counts mid-way before the alarm fires. The new version removes that intermediate assertion and only checks that a sleep eventually happens. This no longer verifies the alarm's keep-alive effect - it just confirms baseline sleep behavior. The test name no longer matches its intent. Logging field name inconsistency In the dynamic actor start error handler,
In Broad try/catch in dynamic actor start masks which step failed The try/catch wraps rebinding + restoring in one block with a single warning message. If rebinding succeeds but No version validation in The code slices off a 2-byte version prefix and reassembles the payload after re-encoding without validating what those bytes represent. A comment on the expected prefix format or a defensive assertion would help prevent silent corruption if the format changes. Minor Observations
|
26f98bc to
fde1e0b
Compare
ccc38b5 to
8293235
Compare
fde1e0b to
789b9cd
Compare
8293235 to
1ba6a3b
Compare

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: