iterate.com / kernel

git clone https://git.iterate.com/repos/kernel

The reviewer's third finding: ten a second needs changes of the activity stack

Appends alone do not start the 100 ms wait: a change of the activity stack
does, or an itx/described. One long activity that only appends has its
summary sent on the 15 s path while it stays busy. The text of CatalogRow now
ties "about ten times a second" to many short pieces of work that each add to
the log, and says what one long piece of work does. The header of awake.ts
says the same.

Comments only.

Session: agy b859a067-e1f8-4f91-8d14-337c9a19b40b on beelink
Worker: claude 02c7d409-d06c-4792-af54-c1861507c2e0 on beelink

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

Jonas Templestein, 2026-11-27 00:06 UTC · 4932b0c164abfa8c158f3cdc2c0f7edffc77bc02 · parent e8088d5

2 files changed

M core/itx/src/context/awake.ts
@@ -18,11 +18,12 @@
 // - `AWAKE_ACTIVITY_DEBOUNCE_MS` after its activity stack changed or it said what it is. That
 //   wait gathers a burst of such changes into one summary. It is no least time between two
 //   summaries;
-// - at a recheck, each `AWAKE_QUIET_MS` while it is busy, when its activity stack changed since
-//   the last summary or the last summary is `AWAKE_SUMMARY_EVERY_MS` old;
+// - at a recheck, each `AWAKE_QUIET_MS` while it is busy, when such a change is not yet said or
+//   the last summary is `AWAKE_SUMMARY_EVERY_MS` old;
 // - before it closes.
 // A summary whose text equals the last one sent is not sent, so a wake can send none. A context
-// with much activity sends about ten summaries a second. The accepting context keeps the durable
+// whose activity stack changes often sends about ten summaries a second; one long activity that
+// only appends sends one per `AWAKE_SUMMARY_EVERY_MS`. The accepting context keeps the durable
 // part of each summary that comes in one SQLite row (context-catalog.ts `store`). It writes that
 // row at each summary of an equal or later offset and does not compare the two: a summary that
 // differs in its activities alone writes the same row again. These rows are beside the rows
M core/lib/src/api.ts
@@ -1876,9 +1876,11 @@
  *  catalog's revision at which the row last changed. A ROW CHANGES WHEN ITS CONTEXT SENDS A
  *  SUMMARY THAT DIFFERS in something the row holds: the counts and times of its events, its
  *  storage, what it says of itself. A context that works sends a summary shortly after each
- *  burst of its activity, and one when it goes quiet. It gathers a burst for 100 ms, and that is
- *  no least time between two summaries. So the row of a context whose log grows fast changes
- *  about ten times a second: a watcher that draws should not draw at each frame. */
+ *  burst of changes of its activity stack, once in 15 s with no such change, and once when it
+ *  goes quiet. It gathers a burst for 100 ms, and that is no least time between two summaries.
+ *  So the row of a context that does many short pieces of work, each of which adds to its log,
+ *  changes about ten times a second: a watcher that draws should not draw at each frame. One
+ *  long piece of work that only adds to the log changes the row once in 15 s. */
 export type CatalogRow = Omit<ContextListing, "awake" | "activities"> & {
   /** What the order `active` sorts by, in milliseconds: when the context was last active
    *  (`lastActivityAt`, or `lastEventAt` when it has had no activity of its own). */