Skip to content

Stabilize process streams and releases - #827

Merged
ghostwriternr merged 6 commits into
nextfrom
naresh/stabilize-next-release
Jul 22, 2026
Merged

Stabilize process streams and releases#827
ghostwriternr merged 6 commits into
nextfrom
naresh/stabilize-next-release

Conversation

@ghostwriternr

@ghostwriternr ghostwriternr commented Jul 17, 2026

Copy link
Copy Markdown
Member

Keep process log and port-watch subscriptions connected until they settle. Worker RPC stream capabilities do not reliably preserve retained event delivery, so observations now pull events explicitly and hold runtime control until the local subscription finishes or is canceled.

Serialize branch releases so an older build cannot replace a newer Worker and container deployment. Also clean up partially initialized E2E sandboxes, make the terminal assertion insensitive to asynchronous prompts, and declare the internal execution package version required by preview publishing.

The rewritten history removes the diagnostic probes and reverted experiments used to isolate the Worker RPC stream boundary. Its final tree is unchanged from the previously reviewed branch.

Prevent an older build from replacing a newer Worker and container
release when several commits reach a release branch close together.
Shell prompts can arrive before command output, so collect terminal data
until the expected command result is observed.
@changeset-bot

changeset-bot Bot commented Jul 17, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: e5c529b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@cloudflare/sandbox Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@ghostwriternr
ghostwriternr enabled auto-merge (squash) July 17, 2026 13:18

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

Copy link
Copy Markdown
Contributor

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

Preview publishing resolves workspace dependency versions and requires
every internal package to declare one.
@ghostwriternr ghostwriternr changed the title Serialize branch release workflows Stabilize process streams and releases Jul 17, 2026
@pkg-pr-new

pkg-pr-new Bot commented Jul 17, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@cloudflare/sandbox@827

commit: e5c529b

@github-actions

github-actions Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

🐳 Docker Images Published

Variant Image
Default cloudflare/sandbox:0.0.0-pr-827-e5c529bc
Python cloudflare/sandbox:0.0.0-pr-827-e5c529bc-python
OpenCode cloudflare/sandbox:0.0.0-pr-827-e5c529bc-opencode
Musl cloudflare/sandbox:0.0.0-pr-827-e5c529bc-musl

Usage:

FROM cloudflare/sandbox:0.0.0-pr-827-e5c529bc

Version: 0.0.0-pr-827-e5c529bc


📦 Standalone Binary

For arbitrary Dockerfiles:

COPY --from=cloudflare/sandbox:0.0.0-pr-827-e5c529bc /container-server/sandbox /sandbox
ENTRYPOINT ["/sandbox"]

Download via GitHub CLI:

gh run download 29942111277 -n sandbox-binary

Extract from Docker:

docker run --rm cloudflare/sandbox:0.0.0-pr-827-e5c529bc cat /container-server/sandbox > sandbox && chmod +x sandbox

@ghostwriternr
ghostwriternr force-pushed the naresh/stabilize-next-release branch 3 times, most recently from 31400ef to ffa2892 Compare July 17, 2026 15:04
Destroy partially initialized sandboxes so failed environment setup does
not leak resources into disposable pull request deployments.
@ghostwriternr
ghostwriternr force-pushed the naresh/stabilize-next-release branch from ffa2892 to c285625 Compare July 17, 2026 15:18
@ghostwriternr

Copy link
Copy Markdown
Member Author

Temporarily closing to run the existing privileged cleanup for the saturated disposable E2E environment. Will reopen after cleanup completes.

auto-merge was automatically disabled July 17, 2026 15:24

Pull request was closed

@ghostwriternr ghostwriternr reopened this Jul 17, 2026
@ghostwriternr
ghostwriternr force-pushed the naresh/stabilize-next-release branch from c285625 to 61e6eea Compare July 17, 2026 15:34
Worker RPC stream capabilities can close without delivering retained
process events. Pull each event explicitly and keep runtime control alive
until the local subscription settles.
@ghostwriternr
ghostwriternr marked this pull request as draft July 20, 2026 10:57
@ghostwriternr
ghostwriternr force-pushed the naresh/stabilize-next-release branch from 37f17f9 to 4ea6fba Compare July 21, 2026 14:54
@ghostwriternr
ghostwriternr force-pushed the naresh/stabilize-next-release branch 2 times, most recently from 6da925d to 047dc46 Compare July 21, 2026 15:14
* Establish runtime operation admission

Bind SDK operations to activated runtime incarnations so starts, streams,
handles, forwarding, and teardown cannot cross runtime replacement.

* Fence preview and tunnel operations

Preview and tunnel workflows need one exact runtime authority across
admission, side effects, transport lifetime, and durable publication.
Keep discovery and stale-owner cleanup non-waking while preventing old
sessions and interrupted callbacks from publishing runtime-owned state.

* Fence backup operations to one runtime

Keep archive transfer and cleanup under the same admitted runtime so a
replacement cannot replay side effects or switch controls mid-attempt.
Preserve independent sandbox-lifetime interruptions and durable restore
ownership for explicit caller reconciliation.

* Thread runtime leases through mounts

Keep mount setup and long-lived local sync pinned to one runtime while
making unmount and teardown cleanup non-waking. Exact incarnation and
sandbox-lifetime fences prevent stale registry publication.

* Scope extension workflows to runtimes

Keep extension control, sidecar connection, and callback streaming inside
one admitted runtime so stale remotes cannot reconnect after replacement.

* Remove implicit runtime ownership

Delete transitional identity and transport retry paths so runtime work is
admitted once, scoped to an exact incarnation, and never replayed.

* Add runtime lifecycle regressions

Exercise deterministic real-container replacement and non-waking lookup
paths while ensuring failed WebSocket closure cannot retain runtime
authority.

* Test control server exit recovery

Exercise real control-process replacement without assuming the
container entrypoint is namespace PID 1.

* Fix runtime execution regressions

Restore sandbox environment and workspace defaults that were masked by
cold-start admission failures. Observe completed stop boundaries in
incarnation tests and fully destroy discarded warm containers before
releasing capacity.

* Upgrade container lifecycle handling

Use the upstream fix for stop events racing replacement startup instead
of maintaining SDK-specific lifecycle fencing. Preserve JSON null
environment values as explicit unsets.

* Stabilize sandbox proxy transports

Preserve watches, process logs, and terminal output across Workers RPC
boundaries while retaining the inherited Container request APIs. Keep
runtime replacement and control-plane routing explicit so callers do not
attach resources to stale container incarnations.

* Stabilize lifecycle regression workflows

Explicit restores must reapply committed backups when their destination
has changed. Inactivity expiry must also complete without re-entering
the sandbox stop gate, while E2E workflows synchronize on observable
process and terminal behavior.

* Add Sandbox reconstruction harness

Characterize Durable Object memory loss separately from persisted Sandbox
configuration across eviction and local Worker reloads. Align the local
Cloudflare test toolchain so the real container-backed harness remains
reproducible.

* Reconcile delayed runtime stops

Allow the first waking establishment after a physical stop to clean up the
previous runtime without treating its delayed onStop bookkeeping as
invalidation of the sequential replacement.

* Wire pending stop reconciliation

Route container start and stop hooks through replacement-start marking and
observed-stop reconciliation while keeping explicit stop and destroy as hard
invalidations.

* Accept both terminal container stop statuses

Control-server exit can surface stopped_with_code when the
monitor reports a numeric exit code. Match the wait helper.

* Bump E2E deploy hash for CI rerun

* Bump E2E deploy hash again

* Add isolated browser test containers

* Parallelize isolated browser tests

* Integrate browser container readiness

* Fix browser test import order

* Bound browser test concurrency

* Bootstrap Wrangler in rollout checks

* Reduce browser cold-start pressure

* Limit browser cold starts to one

* Avoid orphaned browser configuration

* Restore parallel browser coverage

* Clarify release notes for callers

Rewrite the PR #833 changesets in plain language so release notes
describe user-visible behavior instead of internal runtime jargon.
@ghostwriternr
ghostwriternr marked this pull request as ready for review July 22, 2026 17:23
@ghostwriternr
ghostwriternr enabled auto-merge (squash) July 22, 2026 17:23
@ghostwriternr
ghostwriternr merged commit 3ded3f2 into next Jul 22, 2026
15 of 17 checks passed
@ghostwriternr
ghostwriternr deleted the naresh/stabilize-next-release branch July 22, 2026 17:26
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