fix(engine-runner): terminate requests for missing actors - #5573
Open
Sms1818 wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes a request leak in the TypeScript engine runner tunnel path by ensuring that a ToClientRequestStart for an actor that is no longer loaded receives a terminal response (instead of returning early and leaving the gateway to time out). This aligns the tunnel behavior with the existing missing-actor retry semantics already present in the runner’s fetch path.
Changes:
- Update
Tunnel.#handleRequestStart()to send a retryable503response withx-rivet-error: runner.actor_not_foundwhengetAndWaitForActor()returns no actor. - Add a regression test verifying that missing-actor tunnel requests receive the expected non-streaming terminal response.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| rivetkit-typescript/packages/engine-runner/src/tunnel.ts | Sends a terminal 503 + x-rivet-error: runner.actor_not_found response when a request arrives for an unloaded actor. |
| rivetkit-typescript/packages/engine-runner/tests/tunnel-missing-actor.test.ts | Adds a focused regression test for the missing-actor tunnel request response semantics. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
Fixes a request leak in the TypeScript engine runner when a request arrives for an actor that is no longer loaded.
Previously,
#handleRequestStart()logged that the request would leak and returned without sending a terminal response. This left the gateway waiting for a response until its response-start timeout.The runner now sends a retryable
503 Service Unavailableresponse with thex-rivet-error: runner.actor_not_foundheader when the actor cannot be found. This follows the existing missing-actor retry semantics used elsewhere in the runner and allows Guard to retry the request instead of waiting for the timeout.A regression test was added to verify that requests for unloaded actors receive the expected terminal response.
Type of change
How Has This Been Tested?
Added a focused regression test covering a
ToClientRequestStartreceived for an unloaded actor.Verified with:
pnpm exec vitest run tests/tunnel-missing-actor.test.tspnpm --filter @rivetkit/engine-runner check-typespnpm --filter @rivetkit/engine-runner buildgit diff --checkThe regression test verifies that the runner returns:
503x-rivet-error: runner.actor_not_foundChecklist: