Skip to content

fix(api): recover cold worker initialization - #599

Merged
Makisuo merged 1 commit into
mainfrom
codex/api-stack-review-fixes
Aug 23, 2026
Merged

fix(api): recover cold worker initialization#599
Makisuo merged 1 commit into
mainfrom
codex/api-stack-review-fixes

Conversation

@Makisuo

@Makisuo Makisuo commented Aug 23, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • evict and dispose the exact cached HTTP handler when its real first request exposes a lazy layer-acquisition failure
  • acquire the ManagedRuntime context before caching RPC initialization, disposing failed builds so later calls can retry
  • add a small recoverable promise memo with identity-guarded eviction for overlapping requests
  • add regression coverage for concurrent memoization, rejected-build eviction, lazy HTTP layer acquisition, and lazy ManagedRuntime acquisition

Context

Follow-up to #594. Effect rc.108 acquires both HttpRouter.toWebHandler layers and ManagedRuntime layers lazily. The previous outer promise memoizers resolved before that work happened, so their rejection handlers could not evict a failed inner build; one first-acquisition defect could pin the isolate until eviction.

HTTP recovery now happens only when a real application request rejects during lazy handler acquisition. That exact cached wrapper is evicted and disposed, allowing the next request to rebuild it. RPC initialization awaits runtime.context() so acquisition failure remains inside the recoverable build promise.

The existing inline health and OPTIONS fast paths are unchanged.

Validation

  • API focused tests: 5 passed
  • API typecheck through the Turbo dependency graph
  • oxlint on all changed files
  • Wrangler deploy dry-run bundle succeeded

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

@Makisuo
Makisuo force-pushed the codex/api-stack-review-fixes branch from d645a08 to 80e4b32 Compare August 23, 2026 14:10
@Makisuo
Makisuo merged commit 7c2533d into main Aug 23, 2026
24 checks passed
@Makisuo
Makisuo deleted the codex/api-stack-review-fixes branch August 23, 2026 14:14
@Makisuo
Makisuo deployed to pr-preview August 23, 2026 14:14 — with GitHub Actions Active
@github-actions

Copy link
Copy Markdown

🍁 Maple PR preview

Note

Preview resources were removed when this pull request closed.

Final commit 80e4b32 · View workflow run

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