mirror of
https://github.com/badlogic/pi-mono.git
synced 2026-11-05 23:37:25 +00:00
After every commit that changed a task, the scheduler re-checked every conversation with a kept context range (every conversation read in the last contextRetentionMs) by walking its subtree, scanned them again for the next expiry, and wake() scanned every live task. CPU per run grew linearly with the number of conversations. Now a commit re-checks only the conversations above tasks that became live or ended (collected before the sweep; a chain load that resolves an unknown for a live unloaded task falls back to a full check), idle context ranges expire from an index ordered by idleSince (re-sorted when the clock goes back; zero retention drops all idle ranges; reconcile passes still expire for hosts that decline timers), and wake() takes the earliest sleep from the sleeping tasks and scans live tasks only while nothing runs. One Session, one-tool runs, no storage latency: 2048 conversations 100 -> 805 runs/s, 4096: 46 -> 772; local SQLite at 2048: 88 -> 459; CPU per run flat at about 1.6 ms. |
||
|---|---|---|
| .. | ||
| agent | ||
| ai | ||
| chord | ||
| codemode | ||
| coding-agent | ||
| durable | ||
| env | ||
| evals | ||
| mcp | ||
| telemetry | ||
| tui | ||