Skip to content

fix(workspaces): retry file processor container provisioning#648

Draft
posthog[bot] wants to merge 1 commit into
mainfrom
posthog-code/workspace-processor-provisioning-retry
Draft

fix(workspaces): retry file processor container provisioning#648
posthog[bot] wants to merge 1 commit into
mainfrom
posthog-code/workspace-processor-provisioning-retry

Conversation

@posthog

@posthog posthog Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Summary

Workspace file preview generation started throwing "there is no container instance that can be provided to this durable object" right after the R2 migration (#643). The WorkspaceFileProcessor Cloudflare Container can't always be provisioned the instant we ask for it — transient provisioning lag (notably just after a deploy) or a fully busy pool — and the error was failing the operation on the first miss.

This makes container acquisition resilient: requestWorkspaceFileProcessor now retries getRandom + startAndWaitForPorts with exponential backoff (4 attempts, ~7s total), scoped to that specific transient error. Any other error still surfaces immediately. The retry wraps only provisioning — which runs before the request body stream is consumed — so it never re-reads a consumed stream. The fix also covers the extraction and PDF-upload-validation paths that share this helper.

Why

A production error was silently failing the workspace file preview flow when it hit, immediately after the R2-migration deploy. Retrying past transient provisioning misses fixes the observed failure without changing container capacity.

Test plan

  • Added workspace-file-processor.test.ts: retries then succeeds on the provisioning error; does not retry unrelated errors; gives up after exhausting attempts.
  • pnpm check and related workspace test suites pass.

Created with PostHog Code from an inbox report.


View with Codesmith Autofix with Codesmith
Need help on this PR? Tag /codesmith with what you need. Autofix is disabled.

Review in cubic

The Containers runtime throws "there is no container instance that can be
provided to this durable object" when no instance is available to back the
WorkspaceFileProcessor durable object (transient provisioning lag or a fully
busy pool). Previously this bubbled straight up through preview generation,
extraction, and PDF upload validation, failing the operation on the first miss.

Retry acquisition (getRandom + startAndWaitForPorts) with exponential backoff,
scoped to that specific transient error; all other errors still surface
immediately. The retry wraps only provisioning, which runs before the request
body stream is consumed, so it never re-reads a consumed stream.

Generated-By: PostHog Code
Task-Id: 66783ae2-2a28-419c-b710-2d31c9526cc2
@github-actions

Copy link
Copy Markdown

React Doctor found no new issues. 🎉

Reviewed by React Doctor for commit 6f5256f.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

0 participants