fix: reuse managed desktop across batches with isolated leases

This commit is contained in:
阿白叔 committed 2026-11-18 10:38:11 +08:00
1 parent d08a940afe
commit cdbc92fab8
15 files changed
+999 -26

No files matched your search

+3 -3
View File
@@ -107,9 +107,9 @@ def probe(output):
candidate = BatchCadRuntime(root, 'fresh_batch', cad_factory=forbidden_cad)
with candidate:
fresh = candidate._ensure_desktop()
assert fresh.name != desktop.name
assert fresh.name == desktop.name
report['fresh_desktop'] = fresh.name
report['events'].append({'phase': 'new_batch', 'blocked': False, 'fresh_desktop_created': True})
report['events'].append({'phase': 'new_batch', 'blocked': False, 'managed_desktop_reused': True})
restart_code = '''import json,sys
from pathlib import Path
sys.path.insert(0,sys.argv[2])
@@ -121,7 +121,7 @@ assert rows and all(row['state']=='isolated' and row['blocking'] is False for ro
assert not blocking_resources(root)
with BatchCadRuntime(root,'restart_admission') as runtime:
desktop=runtime._ensure_desktop()
assert desktop.name != rows[0]['desktop']
assert desktop.name == rows[0]['desktop']
print(json.dumps({'restart_isolation_validated':True,'fresh_desktop':desktop.name}))
'''
restarted = subprocess.run((sys.executable, '-c', restart_code, str(root),