mirror of
https://gh-proxy.org/https://github.com/klinsmaya/multica.git
synced 2026-11-08 01:16:45 +08:00
* fix(daemon): don't count host sleep as agent silence in idle watchdog (#9024) The idle watchdog stamped activity in wall-clock unix nanos, so a laptop that slept past the idle window woke up with every in-flight run already over budget and force-stopped them all on the first tick. Detect host suspend from the wall-clock gap between watchdog ticks and credit that time back to lastActivityAt before each check, clamped to now. Works the same on macOS/Linux (monotonic clock pauses in sleep) and Windows (monotonic clock keeps counting), and covers the tool-in-flight budget too since both read the same stamp. MUL-7851 Co-authored-by: multica-agent <[email protected]> * fix(daemon): measure idle watchdog on an awake-only clock (#9024) Review on #9201 showed the tick-gap heuristic still charges sleep to the agent: a sleep shorter than one tick is never credited, and when the overdue tick fires on wake (Windows) only gap−tick is credited. Replace it with pkg/awakeclock, a clock that only advances while the host is awake: Go's monotonic clock on Linux/macOS (already stops in suspend), minus host sleep on Windows (GetTickCount64 − QueryUnbiasedInterruptTime). lastActivityAt, the drain loop stamp, and Cursor's native tool activity (Session.ToolActivity now returns an awakeclock reading) all share it. Regression tests cover both review boundaries plus a long sleep, each with a wall-clock control that proves the scenario reproduces the bug. MUL-7851 Co-authored-by: multica-agent <[email protected]> --------- Co-authored-by: multica-agent <[email protected]>