Repository navigation
fix(e2b): fail calls when snapshots cannot be restored - #3609
Merged
jujn merged 8 commits intoOct 19, 2026
Merged
Conversation
chcodex
marked this pull request as draft
October 16, 2026 09:27
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
A sandbox created from the template cannot hold the workspace this session had, yet the TAR / no-snapshot path left the persisted workspace-ready flag set. start() then probed the fresh sandbox, found the workspace root and applied ephemeral entries only, so the TAR archive was never restored and the empty workspace was written back on the next stop. Clear the workspace-ready flags on every template-created path, keeping them only for the sandbox created from the native snapshot. Also stop relabeling existing SandboxExceptions (e.g. a missing API key) as snapshot restore failures, and tighten the signatures of createSandboxForRestore()/peekNativeSnapshot() to what they actually throw.
tarResumeHydratesSnapshotWhenPreviousWorkspaceWasReady asserted an exact request count and a per-request order, so harmless hydrate refinements (merging the temp-file cleanup into the extract, extra validation calls) would fail it without any semantic change. Serve responses through a Dispatcher keyed by path, drain all requests, and assert what the fix guarantees: the template create happened, the archive was uploaded and unpacked, workspace setup ran, and no workspace-preserved probe ran.
Collect the requests start() issued by reading the server-side count once instead of looping on a one-second read timeout. The timeout loop made every caller wait a full second and made the collected set depend on inter-request timing; start() issues its requests synchronously, so the count is final. Also assert the request set is non-empty before indexing it.
chcodex
marked this pull request as ready for review
October 18, 2026 11:28
Contributor
Author
jujn
approved these changes
Oct 19, 2026
chcodex
added a commit
to chcodex/agentscope-java
that referenced
this pull request
Oct 20, 2026
…#3609) - Treat only confirmed-missing native snapshots (HTTP 404 or `isRestorable() == false`) as cold starts, with an explicit warning. - Fail the current call on snapshot-store/read/restorability errors, corrupt references, and non-404 snapshot creation failures, without mutating session state — the next call retries the same snapshot instead of silently starting empty. - Hydrate the persisted TAR archive whenever a sandbox is recreated from the template: a template-created sandbox can never hold the previous workspace, so the workspace-ready flags are now cleared on every template path. Previously a resume whose persisted state still marked the workspace ready skipped the archive and overwrote it with an empty workspace on the next stop. - Carry platform HTTP status codes in typed exceptions and base retries on those codes (408/429/502/503); 404 is never retried. - Keep the successful restore path to a single sandbox creation and reuse the peeked archive (`restoreCount() == 1`). - Document the failure behavior in English and Chinese. Related: follow-up to agentscope-ai#3562; related closed issue agentscope-ai#3555. (Not using `Fixes agentscope-ai#3555` because it is closed.) (cherry picked from commit 9ea0540)
chickenlj
pushed a commit
that referenced
this pull request
Nov 13, 2026
Backport the verified fix to the 2.0.x implementation and retain its existing public contracts where the upstream kernel differs. (cherry picked from commit 9ea0540) Backport-review-patch: fb2278d693ba0fc2e41d416f900b9dd773fd0851 Constraint: No AgentScope Service or SDK migration Confidence: high Not-tested: Whole-repository verification pending after lane integration
5 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
isRestorable() == false) as cold starts, with an explicit warning.restoreCount() == 1).Related: follow-up to #3562; related closed issue #3555. (Not using
Fixes #3555because it is closed.)Verification
mvn -T1 -pl agentscope-extensions/agentscope-extensions-sandbox/agentscope-extensions-sandbox-e2b -am test— passed (1,245 Harness tests, 10 skipped; 129 E2B tests).mvn -T1 -pl agentscope-extensions/agentscope-extensions-sandbox/agentscope-extensions-sandbox-e2b spotless:check— passed.