agentscope-ai / agentscope-ai/agentscope
[Bug]: Lack of a lifecycle recovery mechanism after sandbox expiration.
- Lingua principale
- Python
- Stelle
- 31.5k
- Fork
- 3.5k
- Merge medio
- 1g 23h
- PR unite (30g)
- 95
Descrizione
### Prerequisites
- [x] I have searched the existing [issues](https://github.com/agentscope-ai/agentscope/issues) and [discussions](https://github.com/agentscope-ai/agentscope/discussions), and this is not a duplicate.
- [x] This is a bug, not a usage question. (For questions, please use [Discussions](https://github.com/agentscope-ai/agentscope/discussions/new?category=general) instead.)
### Background / Description
- `OpenSandboxWorkspaceManager.get_workspace()` first checks the in-memory cache;
- If there is a cache hit, it returns the existing `OpenSandboxWorkspace` directly without checking if the Sandbox is still active;
- `OpenSandboxWorkspace.initialize()` is executed only upon a cache miss;
- During initialization, it queries for the same `workspace.id`:
- If found in `Running` state: reconnect;
- If found in `Paused` state: call `resume()`;
- If not found: create a new Sandbox.
- `/D:/a_bot/agentscope/src/agentscope/app/workspace_manager/_opensandbox_workspace_manager.py:247` Returns immediately on cache hit;
- `/D:/a_bot/agentscope/src/agentscope/workspace/_opensandbox/_opensandbox_workspace.py:159` Searches for an existing Sandbox during initialization;
- `/D:/a_bot/agentscope/src/agentscope/workspace/_opensandbox/_opensandbox_workspace.py:276` Connects to or resumes the Sandbox if it is `Running` or `Paused`.
Consequently, the current behavior is:
Sandbox TTL expires and it is destroyed
↓
The workspace remains in the cache
↓
The next message continues using the old connection
↓
`httpx.ConnectError`
Automatic recreation or resumption occurs only if one of the following happens:
- The AgentScope process restarts;
- The workspace is cleared from the manager's idle cache;
- The workspace is manually closed and re-initialized;
- Code is explicitly added to handle reconnection/recreation after a connection failure.
### Error Messages
```shell
The conversation will fail in 5 minutes.
```
### Steps to Reproduce
OPEN_SANDBOX_REQUEST_TIMEOUT=600
OPEN_SANDBOX_TIMEOUT_SECONDS=300
### Environment
- AgentScope Version:
- Python Version:
- OS:windows
Guida per i contributori
Apri la guida per i contributori
Valutazione
Questa issue non è ancora stata valutata.