chore(release): prepare 0.4.1 (#6570)

Prepare version 0.4.1 and document the retained legacy upgrade path.

Avoid false busy update handoffs from disabled or not-yet-due idle scans. Keep real work, maintenance, lease and data-protection checks intact.

Retain safe package-failure diagnostics and cancellable test-controller progress checks. Reduce Windows installer startup contention without changing command deadlines or behavioral assertions.

Validated on the reviewed head with all required PR checks and the exact five-platform candidate. Historical package and recovery coverage remains as documented in the release acceptance record. Publication is separate; this merge does not create a tag, release, upload or feed change.
This commit is contained in:
Xubin Ren authored and GitHub committed 2026-11-06 20:48:57 +08:00
1 parent 1a89a25abd
commit cdaae66c89
15 files changed
+310 -37

No files matched your search

+7 -1
View File
@@ -40,9 +40,13 @@ class AutoCompact:
self._bind_events = bind_events
self._session_lock = session_lock
@property
def enabled(self) -> bool:
return self._ttl > 0
def _is_expired(self, ts: datetime | str | None,
now: datetime | None = None) -> bool:
if self._ttl <= 0 or not ts:
if not self.enabled or not ts:
return False
try:
if isinstance(ts, str):
@@ -65,6 +69,8 @@ class AutoCompact:
active_session_keys: Collection[str] = (),
) -> None:
"""Schedule idle archival without blocking the event loop."""
if not self.enabled:
return
now = datetime.now()
active_keys = set(active_session_keys)
for info in await self.sessions.state.list_sessions():
+10 -4
View File
@@ -1368,11 +1368,17 @@ class AgentLoop:
)
return result
def _idle_compact_check_due(self, now: float) -> bool:
return (
self.auto_compact.enabled
and not self.bus.admission.paused
and not self._idle_compact_check_running
and now >= self._next_idle_compact_check_at
)
async def _check_expired_sessions_if_due(self) -> None:
if self.bus.admission.paused or self._idle_compact_check_running:
return
now = time.monotonic()
if now < self._next_idle_compact_check_at:
if not self._idle_compact_check_due(now):
return
self._next_idle_compact_check_at = now + self._idle_compact_check_interval_s
self._idle_compact_check_running = True
@@ -1402,7 +1408,7 @@ class AgentLoop:
msg = await self.bus.consume_inbound()
except asyncio.TimeoutError:
# Storage may wait behind a turn that /stop needs to cancel.
if not self.bus.admission.paused:
if self._idle_compact_check_due(time.monotonic()):
self.schedule_background(self._check_expired_sessions_if_due())
continue
except asyncio.CancelledError: