csharp/sandbox/v0.1.4

cjpais/Handycsharp/sandbox/v0.1.4Jul 8, 2026by Pangjiping

AI Summary

Introduces isolation helpers and endpoint caching to the C# SDK while removing the `Ports` field from credential vault bindings.

Key Highlights

  • Removal of the `Ports` field from credential vault binding matches.
  • `RunOnceAsync` and `WithSessionAsync` isolation convenience helpers added.
  • LRU + TTL endpoint cache with in-flight request deduplication.
  • Sandbox lifecycle responses now surface `extensions` data.
  • Optional `resourceRequests` field for Kubernetes sandboxes.

Breaking Changes

  • The credential vault binding match no longer carries a `Ports` field.

New Features

  • `RunOnceAsync` and `WithSessionAsync` isolation convenience helpers
  • LRU + TTL endpoint cache with in-flight request deduplication
  • Sandbox lifecycle responses now surface `extensions`
  • Optional `resourceRequests` field for Kubernetes sandboxes

Full Release Notes

## What's New

### Breaking Changes

- The credential vault binding match no longer carries a `Ports` field. Port is now derived from the scheme (`https` → 443, `http` → 80), matching what the intercept layer (iptables/nft) actually redirects. If your C# code constructs credential vault bindings and sets `Match.Ports`, remove that field on upgrade — port selection is now implicit from the scheme. This removes a field that never provided real flexibility (only 80/443 were ever intercepted). #1189

### Features

- Added `RunOnceAsync` and `WithSessionAsync` isolation convenience helpers to the C# SDK. `RunOnceAsync(code, workspace, ...)` wraps create → run → delete into a single call with guaranteed cleanup, and `WithSessionAsync(req, fn)` scopes a multi-run isolated workflow with auto-delete on exit. They are exposed as extension methods on `IIsolatedSessions` in the root `OpenSandbox` namespace (so callers only need `using OpenSandbox;`), and cleanup is best-effort so it never masks the original exception. These build on the execd-backed isolation support added to the C# SDK (`IsolatedSessionsAdapter`, `IIsolatedSessions`, `Isolated` models). #1008 #1222
- Added an LRU + TTL endpoint cache with in-flight request deduplication. The SDK now caches `(sandbox_id, port, use_server_proxy) → Endpoint` to avoid repeated resolution round-trips. It is enabled by default (TTL 600s, max size 1024) and tunable via `ConnectionConfig`; killing a sandbox actively invalidates its cached entries. #1133
- Sandbox lifecycle responses now surface `extensions`. The C# SDK response models expose `opensandbox.extensions.*` data returned by create/get/list so callers can read extension values round-tripped from the server. #1112
- Added the optional `resourceRequests` field to sandbox creation. Kubernetes-backed sandboxes can now set resource requests separately from limits (enabling Burstable QoS). Omitting the field preserves the existing behavior where requests equal limits. #1074

### Bug Fixes

- Clarified `deleteOnSandboxTermination` semantics in the C# sandbox model: auto-created Kubernetes PVCs are now actually deleted on sandbox termination when opted in (previously the field was documented as Docker-only). Default remains `false` (opt-in), so existing behavior is unchanged. #880

### Misc

- Updated the C# SDK project (`.csproj`) repository metadata to the new `opensandbox-group/OpenSandbox` org so package pages and issue links point to the current repo (package names and namespaces unchanged). #1139
- Bumped the C# Sandbox SDK package version to `0.1.4` and fixed the default User-Agent string, which had drifted behind at `0.1.2`; a regression test now locks the User-Agent to the package version. #1248

### Contributors

- @GreenShadeZhang
- @Gujiassh
- @Pangjiping
- @xfgong