pi-mono/packages/durable/src
Mario Zechner 35dfa75737 fix(durable): idle checks and wake() without per-commit scans
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.
2026-10-30 23:17:56 +00:00
..
codemode fix(durable): rank tool search like the coding agent (#11631) 2026-10-30 23:08:57 +01:00
env feat(chord,durable): failures are watch calls; one vocabulary for watches, observers and reports 2026-10-27 20:38:08 +00:00
harness fix(durable): idle checks and wake() without per-commit scans 2026-10-30 23:17:56 +00:00
images feat(durable): prepare images in a worker thread in /images/node 2026-10-11 08:16:47 +00:00
session feat(durable): group commit and batch Storage.commit 2026-10-30 10:41:11 +00:00
storage feat(durable): group commit and batch Storage.commit 2026-10-30 10:41:11 +00:00
testing feat(durable): group commit and batch Storage.commit 2026-10-30 10:41:11 +00:00
tool-search fix(durable): rank tool search like the coding agent (#11631) 2026-10-30 23:08:57 +01:00
tools fix(durable): return image blocks from read in Code Mode scripts (#11606) 2026-10-30 12:23:48 +01:00
documents.ts feat: checkpointWhen is required on Durable document definitions 2026-10-19 18:17:42 +00:00
entries.ts feat(durable): compaction and overflow (Package 20) 2026-09-30 18:23:25 +02:00
errors.ts feat(durable): admit submissions inside the caller's commit with submit(tx, draft) 2026-10-28 13:09:00 +00:00
ids.ts feat(durable): add typed IDs and explicit ownership 2026-09-25 17:58:29 +02:00
index.ts feat(durable): group commit and batch Storage.commit 2026-10-30 10:41:11 +00:00
search.ts fix(durable,coding-agent): support Unicode word segmentation in tool search (#11037) 2026-10-30 23:34:00 +01:00
tasks.ts feat(durable): add durable task runtime 2026-09-28 23:55:24 +02:00
timers.ts fix(durable): arm before resume in the Durable Object example; timer wording 2026-10-17 23:41:24 +00:00
truncate.ts feat(chord,durable): move OutputBuffer and Progress to @earendil-works/chord/output 2026-10-15 09:59:46 +00:00
types.ts feat(durable): group commit and batch Storage.commit 2026-10-30 10:41:11 +00:00