chore: aligned blocked-todo test, added robomp sandbox scaffolding
- Aligned the blocked-todo reconciliation test with the debounced subagent-lifecycle observer on main (fake timers + 100ms advance). - Carries in-progress robomp queue/sandbox/config scaffolding from the shared worktree (.env.example, config.py, queue.py, sandbox.py).
This commit is contained in:
@@ -91,6 +91,12 @@ class WorkerPool:
|
||||
|
||||
async def start(self) -> None:
|
||||
await self._reap_all_slots()
|
||||
if self.settings.reclaim_workspace_caches:
|
||||
# Crash leftovers: strip dependency caches from every workspace
|
||||
# before the dispatcher can touch any of them again.
|
||||
swept = await asyncio.to_thread(self.sandbox.reclaim_all_caches)
|
||||
if swept:
|
||||
log.info("workspace cache sweep", extra={"workspaces": swept})
|
||||
recovered = self.db.reset_stuck_running()
|
||||
if recovered:
|
||||
log.info("recovered stuck events", extra={"count": recovered})
|
||||
@@ -329,9 +335,32 @@ class WorkerPool:
|
||||
_reap_slot(slot_uid)
|
||||
finally:
|
||||
self._slot_pool.release(slot_uid)
|
||||
await self._reclaim_event_caches(row)
|
||||
await self._release(row)
|
||||
clear_current_event(token)
|
||||
|
||||
async def _reclaim_event_caches(self, row: EventRow) -> None:
|
||||
"""Drop the workspace's dependency caches now that its event is over.
|
||||
|
||||
Runs before `_release` so the issue key is still in `_inflight`:
|
||||
nothing can re-enter `ensure_workspace` for this issue mid-reclaim.
|
||||
Skipped during shutdown (the row resumes right after restart and the
|
||||
startup sweep covers it). Best-effort: a reclaim failure never fails
|
||||
the event.
|
||||
"""
|
||||
if not self.settings.reclaim_workspace_caches or self._shutting_down:
|
||||
return
|
||||
repo, sep, number = (row.issue_key or "").rpartition("#")
|
||||
if not sep or not repo or not number.isdigit():
|
||||
return
|
||||
try:
|
||||
reclaimed = await asyncio.to_thread(self.sandbox.reclaim_workspace_caches, repo=repo, number=int(number))
|
||||
except OSError as exc:
|
||||
log.warning("workspace cache reclaim failed", extra={"key": row.issue_key, "err": str(exc)})
|
||||
return
|
||||
if reclaimed:
|
||||
log.info("workspace caches reclaimed", extra={"key": row.issue_key})
|
||||
|
||||
async def _dispatch_and_mark(self, row: EventRow, *, slot_uid: int | None = None) -> None:
|
||||
await self._dispatch(row, slot_uid=slot_uid)
|
||||
if row.delivery_id in self._cancelled:
|
||||
|
||||
Reference in New Issue
Block a user