Skip to content

fix sandbox reap session#463

Merged
rayrayraykk merged 2 commits intoagentscope-ai:mainfrom
rayrayraykk:weirui/dev/fix_sandbox0319v3
Mar 19, 2026
Merged

fix sandbox reap session#463
rayrayraykk merged 2 commits intoagentscope-ai:mainfrom
rayrayraykk:weirui/dev/fix_sandbox0319v3

Conversation

@rayrayraykk
Copy link
Copy Markdown
Member

Description

[Describe what this PR does and why]

Related Issue: Fixes #[issue_number] or Relates to #[issue_number]

Security Considerations: [If applicable, especially for sandbox changes]

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation
  • Refactoring

Component(s) Affected

  • Engine
  • Sandbox
  • Tools
  • Common
  • Documentation
  • Tests
  • CI/CD

Checklist

  • Pre-commit hooks pass
  • Tests pass locally
  • Documentation updated (if needed)
  • Ready for review

Testing

[How to test these changes]

Additional Notes

[Optional: any other context]

@rayrayraykk rayrayraykk requested review from a team and Copilot March 19, 2026 09:54
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adjusts sandbox session restore behavior to keep “old” recycled container records around for compatibility, while redirecting lookups from those old identities to the newly restored containers.

Changes:

  • Add a new container lifecycle state REPLACED plus a redirect_to field on ContainerModel.
  • Update sandbox restore flow to mark old recycled container records as REPLACED (instead of deleting them) and have get_info() follow redirects.
  • Treat REPLACED as a terminal/cleanup-eligible state in relevant manager flows (cleanup, heartbeat recycle marking, released-record GC).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

File Description
src/agentscope_runtime/sandbox/model/container.py Adds REPLACED state and redirect_to metadata on container records.
src/agentscope_runtime/sandbox/manager/sandbox_manager.py Implements redirect-following in get_info(), marks old records as REPLACED during restore, and updates cleanup/GC logic for the new state.
src/agentscope_runtime/sandbox/manager/heartbeat_mixin.py Ensures heartbeat recycle logic and restore checks treat REPLACED appropriately.

Comment thread src/agentscope_runtime/sandbox/manager/sandbox_manager.py
Comment thread src/agentscope_runtime/sandbox/manager/sandbox_manager.py
Comment thread src/agentscope_runtime/sandbox/manager/sandbox_manager.py
Comment thread src/agentscope_runtime/sandbox/manager/sandbox_manager.py Outdated
Comment thread src/agentscope_runtime/sandbox/manager/sandbox_manager.py
@rayrayraykk rayrayraykk linked an issue Mar 19, 2026 that may be closed by this pull request
@rayrayraykk rayrayraykk merged commit ea219c9 into agentscope-ai:main Mar 19, 2026
7 checks passed
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.

[Bug] restore_session 后客户端持有的 sandbox_id 失效

2 participants