Skip to content

fix(sandbox): retain active fallback across concurrent calls - #2854

Open
Oxygen56 wants to merge 3 commits into
agentscope-ai:mainfrom
Oxygen56:fix/2849-sandbox-fallback-lifecycle
Open

fix(sandbox): retain active fallback across concurrent calls#2854
Oxygen56 wants to merge 3 commits into
agentscope-ai:mainfrom
Oxygen56:fix/2849-sandbox-fallback-lifecycle

Conversation

@Oxygen56

@Oxygen56 Oxygen56 commented Aug 26, 2026

Copy link
Copy Markdown

AgentScope-Java Version

2.0.3-SNAPSHOT

Description

Fixes #2849.

When concurrent calls shared one agent, the context-free filesystem fallback remembered only the
latest sandbox. If that call released while an earlier call was still active, it cleared the
fallback and caused the remaining call's internal filesystem work to fail.

This change retains every active fallback binding in acquisition order. Releasing a call removes
one matching binding and restores the most recently acquired binding that is still active. It also
removes non-current bindings so they cannot be restored after release, and preserves repeated
bindings to the same sandbox until every matching call has released. Per-call context binding
remains authoritative and unchanged. Startup cleanup also records whether the current call
actually registered a fallback, so a failed startup cannot remove an identical sandbox binding
that belongs to another active call.

This follow-up is intentionally limited to the reported empty-fallback window. Context-free
callers still use the most recently acquired active fallback and do not gain session routing;
per-call context remains the isolation mechanism.

The failed-start regression was run against both versions: it reaches the reported missing-sandbox
failure before this follow-up and passes afterward. The existing release-order regressions and
focused lifecycle checks also pass locally.

The null-binding regression confirms that a rejected null update leaves both the current and previous active bindings intact.

Local clean verify passes for the Harness module and its dependencies, including formatting and the full relevant test suites. GitHub CI runs the complete cross-platform build and remaining repository checks.

Checklist

Please check the following items before code is ready to be reviewed.

  • Code has been formatted with mvn spotless:apply
  • All tests are passing (mvn test)
  • Javadoc comments are complete and follow project conventions
  • Related documentation has been updated (not applicable; behavior is internal)
  • Code is ready for review

@CLAassistant

CLAassistant commented Aug 26, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@codecov

codecov Bot commented Aug 26, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.33333% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...nt/filesystem/sandbox/SandboxBackedFilesystem.java 90.90% 0 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@xiaoyuuuuuupeng

Copy link
Copy Markdown
Contributor

LGTM Fixes the #2849 empty-fallback window: fallbackBindings stack + fallbackBound look correct. Concurrent lifecycle tests pass; per-call binding unchanged. One non-blocking nit on setSandbox(null) clearing the whole stack — doesn't block merge.

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

Labels

None yet

Projects

None yet

3 participants