Skip to content

fix(local): fail RpcSpawner POST when sidecar exits before reporting its address - #3877

Open
jasonkuhrt wants to merge 1 commit into
alchemy-run:mainfrom
jasonkuhrt:uw/rpc-exit
Open

jasonkuhrt wants to merge 1 commit into
alchemy-run:mainfrom
jasonkuhrt:uw/rpc-exit

Conversation

@jasonkuhrt

Copy link
Copy Markdown
Contributor

Written by an AI agent (Antigravity) on behalf of @jasonkuhrt.

Local.RpcSpawner now returns HTTP 500 with the child's exit code as soon as a sidecar exits before announcing its RPC address, releases the failed attempt's child scope immediately, and lets a later POST for the same serverEntryUrl retry instead of serving a cached failure.

// packages/alchemy/src/Local/RpcSpawner.ts
const url = yield* Effect.raceFirst(
  Deferred.await(stdout.address),
  handle.exitCode.pipe(
    Effect.flatMap(
      (code) =>
        new RpcServerExitedBeforeReady({
          message: `RPC server "${serverEntryUrl}" exited with code ${code} before reporting its address.`,
        }),
    ),
  ),
);
  • Fork a child scope per spawn attempt (Scope.fork(scope)) and close it when spawn fails so failed starts do not retain finalizers in the spawner's long-lived scope.
  • Switch the entry cache to Cache.makeWith with Duration.zero TTL on failed exits so repaired entries can start on retry.
  • Map RpcServerExitedBeforeReady to an HTTP 500 response on the spawner POST route.
  • Add a regression case to packages/alchemy/test/Local/RpcSpawner.test.ts covering repeated early exits (code 17) and recovery after repairing the entry.

Closes #3875

@alchemy-version-bot

Copy link
Copy Markdown
Contributor

Install the packages built from this commit:

alchemy

pnpm install https://pkg.alchemy.run/alchemy/pr:3877:af5b7b2
@alchemy.run (36)
pnpm install https://pkg.alchemy.run/@alchemy.run/better-auth/pr:3877:af5b7b2
pnpm install https://pkg.alchemy.run/@alchemy.run/git/pr:3877:af5b7b2
pnpm install https://pkg.alchemy.run/@alchemy.run/drizzle/pr:3877:af5b7b2
pnpm install https://pkg.alchemy.run/@alchemy.run/acme/pr:3877:af5b7b2
pnpm install https://pkg.alchemy.run/@alchemy.run/archil/pr:3877:af5b7b2
pnpm install https://pkg.alchemy.run/@alchemy.run/boat/pr:3877:af5b7b2
pnpm install https://pkg.alchemy.run/@alchemy.run/axiom/pr:3877:af5b7b2
pnpm install https://pkg.alchemy.run/@alchemy.run/doppler/pr:3877:af5b7b2
pnpm install https://pkg.alchemy.run/@alchemy.run/infisical/pr:3877:af5b7b2
pnpm install https://pkg.alchemy.run/@alchemy.run/1password/pr:3877:af5b7b2
pnpm install https://pkg.alchemy.run/@alchemy.run/turso/pr:3877:af5b7b2
pnpm install https://pkg.alchemy.run/@alchemy.run/convex/pr:3877:af5b7b2
pnpm install https://pkg.alchemy.run/@alchemy.run/e2b/pr:3877:af5b7b2
pnpm install https://pkg.alchemy.run/@alchemy.run/daytona/pr:3877:af5b7b2
pnpm install https://pkg.alchemy.run/@alchemy.run/modal/pr:3877:af5b7b2
pnpm install https://pkg.alchemy.run/@alchemy.run/planetscale/pr:3877:af5b7b2
pnpm install https://pkg.alchemy.run/@alchemy.run/neon/pr:3877:af5b7b2
pnpm install https://pkg.alchemy.run/@alchemy.run/prisma/pr:3877:af5b7b2
pnpm install https://pkg.alchemy.run/@alchemy.run/hetzner/pr:3877:af5b7b2
pnpm install https://pkg.alchemy.run/@alchemy.run/digitalocean/pr:3877:af5b7b2
pnpm install https://pkg.alchemy.run/@alchemy.run/railway/pr:3877:af5b7b2
pnpm install https://pkg.alchemy.run/@alchemy.run/fly/pr:3877:af5b7b2
pnpm install https://pkg.alchemy.run/@alchemy.run/github/pr:3877:af5b7b2
pnpm install https://pkg.alchemy.run/@alchemy.run/stripe/pr:3877:af5b7b2
pnpm install https://pkg.alchemy.run/@alchemy.run/cloudflare/pr:3877:af5b7b2
pnpm install https://pkg.alchemy.run/@alchemy.run/gcp/pr:3877:af5b7b2
pnpm install https://pkg.alchemy.run/@alchemy.run/aws/pr:3877:af5b7b2
pnpm install https://pkg.alchemy.run/@alchemy.run/domain/pr:3877:af5b7b2
pnpm install https://pkg.alchemy.run/@alchemy.run/kubernetes/pr:3877:af5b7b2
pnpm install https://pkg.alchemy.run/@alchemy.run/docker/pr:3877:af5b7b2
pnpm install https://pkg.alchemy.run/@alchemy.run/redis/pr:3877:af5b7b2
pnpm install https://pkg.alchemy.run/@alchemy.run/sql/pr:3877:af5b7b2
pnpm install https://pkg.alchemy.run/@alchemy.run/cloudflare-runtime/pr:3877:af5b7b2
pnpm install https://pkg.alchemy.run/@alchemy.run/frontend-frameworks/pr:3877:af5b7b2
pnpm install https://pkg.alchemy.run/@alchemy.run/node-utils/pr:3877:af5b7b2
pnpm install https://pkg.alchemy.run/@alchemy.run/pkg/pr:3877:af5b7b2
Transitive Dependencies (30)
pnpm install https://pkg.alchemy.run/@distilled.cloud/aws/pr:3877:af5b7b2
pnpm install https://pkg.alchemy.run/@distilled.cloud/acme/pr:3877:af5b7b2
pnpm install https://pkg.alchemy.run/@distilled.cloud/archil/pr:3877:af5b7b2
pnpm install https://pkg.alchemy.run/@distilled.cloud/core/pr:3877:af5b7b2
pnpm install https://pkg.alchemy.run/@distilled.cloud/boat-dev/pr:3877:af5b7b2
pnpm install https://pkg.alchemy.run/@distilled.cloud/axiom/pr:3877:af5b7b2
pnpm install https://pkg.alchemy.run/@distilled.cloud/doppler/pr:3877:af5b7b2
pnpm install https://pkg.alchemy.run/@distilled.cloud/infisical/pr:3877:af5b7b2
pnpm install https://pkg.alchemy.run/@distilled.cloud/turso/pr:3877:af5b7b2
pnpm install https://pkg.alchemy.run/@distilled.cloud/convex/pr:3877:af5b7b2
pnpm install https://pkg.alchemy.run/@distilled.cloud/e2b/pr:3877:af5b7b2
pnpm install https://pkg.alchemy.run/@distilled.cloud/daytona/pr:3877:af5b7b2
pnpm install https://pkg.alchemy.run/@distilled.cloud/modal/pr:3877:af5b7b2
pnpm install https://pkg.alchemy.run/@distilled.cloud/planetscale/pr:3877:af5b7b2
pnpm install https://pkg.alchemy.run/@distilled.cloud/neon/pr:3877:af5b7b2
pnpm install https://pkg.alchemy.run/@distilled.cloud/s3/pr:3877:af5b7b2
pnpm install https://pkg.alchemy.run/@distilled.cloud/prisma/pr:3877:af5b7b2
pnpm install https://pkg.alchemy.run/@distilled.cloud/hetzner/pr:3877:af5b7b2
pnpm install https://pkg.alchemy.run/@distilled.cloud/digitalocean/pr:3877:af5b7b2
pnpm install https://pkg.alchemy.run/@distilled.cloud/railway/pr:3877:af5b7b2
pnpm install https://pkg.alchemy.run/@distilled.cloud/fly-io/pr:3877:af5b7b2
pnpm install https://pkg.alchemy.run/@distilled.cloud/github/pr:3877:af5b7b2
pnpm install https://pkg.alchemy.run/@distilled.cloud/stripe/pr:3877:af5b7b2
pnpm install https://pkg.alchemy.run/@distilled.cloud/aws4signer/pr:3877:af5b7b2
pnpm install https://pkg.alchemy.run/@distilled.cloud/cloudflare/pr:3877:af5b7b2
pnpm install https://pkg.alchemy.run/@distilled.cloud/iceberg/pr:3877:af5b7b2
pnpm install https://pkg.alchemy.run/@distilled.cloud/gcp/pr:3877:af5b7b2
pnpm install https://pkg.alchemy.run/@alchemy.run/effect-cluster/pr:3877:af5b7b2
pnpm install https://pkg.alchemy.run/@alchemy.run/rivet/pr:3877:af5b7b2
pnpm install https://pkg.alchemy.run/@distilled.cloud/rivet/pr:3877:af5b7b2

Published Nov 30, 2026, 4:32 AM UTC. Expires Dec 7, 2026, 4:32 AM UTC, extended while this pull request is open.

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.

RpcSpawner POST hangs when sidecar exits before reporting its address

1 participant