mirror of
https://github.com/tiennm99/DocsGPT.git
synced 2026-10-04 20:13:04 +00:00
fix: more sandbox protections to terminate plus max pages
This commit is contained in:
1 parent
9f19bc64b5
commit
e4c0c26927
11 files changed
+661
-55
No files matched your search
@@ -26,6 +26,7 @@ class _FakeManager:
|
||||
self._result = result
|
||||
self.closed: list = []
|
||||
self.opened: list = []
|
||||
self.list_calls = 0
|
||||
|
||||
def open(self, session_id, ttl=None):
|
||||
self.opened.append((session_id, ttl))
|
||||
@@ -35,6 +36,7 @@ class _FakeManager:
|
||||
return self._result
|
||||
|
||||
def list_files(self, session_id):
|
||||
self.list_calls += 1
|
||||
return []
|
||||
|
||||
def close(self, session_id):
|
||||
@@ -302,6 +304,25 @@ def test_session_kept_alive_on_positive_ttl(monkeypatch):
|
||||
assert manager.closed == []
|
||||
|
||||
|
||||
def test_invalidated_runtime_skips_post_exec_artifact_capture(monkeypatch):
|
||||
manager = _FakeManager(
|
||||
ExecResult(
|
||||
status="error",
|
||||
error_name="TimeoutError",
|
||||
error_value="execution exceeded 60s",
|
||||
runtime_invalidated=True,
|
||||
)
|
||||
)
|
||||
|
||||
payload = _run_with_fake_manager(monkeypatch, manager, code="while True: pass", persist=True)
|
||||
|
||||
assert payload["status"] == "error"
|
||||
assert "timed out" in payload["error"].lower()
|
||||
# The pre-exec signature snapshot lists files once; a post-exec capture
|
||||
# would issue a second list against the now-destroyed runtime.
|
||||
assert manager.list_calls == 1
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Input materialization: short-ref + uuid resolution (no live sandbox/DB)
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
Reference in new issue
Block a user