Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

docs(plans): record the measured controller-loop SQLite writer inventory (#2769)

Call Whiteb50a5d65437c
diff --git a/docs/plans/controller-loop-sqlite-writers.md b/docs/plans/controller-loop-sqlite-writers.md
index f74f0bc76..139806255 100644
--- a/docs/plans/controller-loop-sqlite-writers.md
+++ b/docs/plans/controller-loop-sqlite-writers.md
@@ -90,7 +90,27 @@ Because producers are gated and the function already yields, moving the remainin
## Other writer sites on the loop (scope only)
-This list holds the sites known so far and is **not exhaustive**: writers are reached through many indirections, and two review rounds each found more. The complete inventory is measured at runtime rather than reviewed by hand (#2710). `storage/loop_writers.py` counts every write transaction the controller loop runs, by code location, and logs the ranked list ("Controller-loop SQLite writers") every five minutes while writes arrive and at shutdown. This section will cite that list after a soak.
+The inventory is measured, not reviewed by hand: writers are reached through many indirections, and two review rounds each found sites a manual read had missed (#2710). `storage/loop_writers.py` counts every write transaction the controller loop runs, by code location, and logs the ranked list ("Controller-loop SQLite writers") every five minutes while writes arrive and at shutdown. It times each transaction from connection checkout to commit or rollback. That log is the inventory of a run's **transactional** loop writes. It does not see SQLite writes that run outside a transaction: DDL such as a store's table or index setup, and the `PRAGMA journal_mode` a new pooled connection runs before its checkout (#2747). This section records what a soak measured.
+
+**Soak 1** (2026-10-17, master 10f6b8d38). The run used a hermetic home with its state on a USB disk, for about ten minutes, with Vibey Turns, Source adds and a Model Hub engine restart running alongside. At shutdown the census reported 83 writes at 19 sites. The leading sites, by total loop time:
+
+| Site (caller) | Writes | Total | Max |
+| --- | --- | --- | --- |
+| `_start_persisted_turn` `:4409` (`recover_runtime_delivery_observation`) | 2 | 5867 ms | 3049 ms |
+| `backfill_agent_session_title` (`_backfill_session_title_once`) | 5 | 234 ms | 135 ms |
+| `_admit_p1` (`deliver`) | 8 | 222 ms | 118 ms |
+| `on_native_start` (`commit_native_start`) | 5 | 211 ms | 123 ms |
+| `persist_agent_message` (`emit_agent_message` `:3286`) | 5 | 184 ms | 120 ms |
+| `persist_agent_message` (`emit_agent_message` `:3387`) | 5 | 77 ms | 19 ms |
+| `_terminalize_durable_turn` (`_finish_durable_terminal_result`, path B) | 8 | 72 ms | 35 ms |
+| `controller.set_agent_status` (the Turn runner) | 8 | 70 ms | 51 ms |
+
+The remaining eleven sites each took under 60 ms of loop time in total and under 50 ms per write.
+
+What it shows:
+- **The only multi-second writes** were `_start_persisted_turn` re-entered by the runtime-work lane's recovery. Each took about 3 s: 2818 ms when first seen, and 3049 ms at its maximum. The loop watchdog's 3.2 s and 4.0 s stalls match them. The census times the whole transaction, so these samples cover reserving the writer, the transaction's reads and its commit together; they do not say which phase took the time. In this run the disk itself was slow: 8 s before the first of these writes, the loop stalled 2.6 s listing the runtime-command directory (#2768), and the same call's next transaction (`:4469`) took 2.9 ms, so the delay was transient. `_start_persisted_turn` holds no boundary, and it is the next candidate in the list below. Only moving the whole transaction off the loop (the door) answers every phase. A never-waiting attempt at the writer answers only a wait for the writer, so choosing it needs the phases measured first.
+- **Every other site stayed under 135 ms per write**, on the same disk and under the same load. That includes `persist_agent_message` (#2725, parked until evidence shows a need) and path B's terminal write.
+- **Coverage.** The soak exercised the Vibey and Model Hub paths. It did not exercise IM transports, the Claude or Codex receivers, or Harness Runs. Sites that review found and that this soak did not reach stay listed below until a soak measures them.
The per-Turn admissions all hold the boundary inside the transaction, so they are loop-side boundary holders and fall under B's split analysis:
- `_admit_p0`, `_admit_p1`, `_admit_p3`, `_promote_fifo_head`;