Coordinator store work off the event loop; the tool catalog in its own module #22

Manually merged
vinny merged 0 commits from vinny/event-loop into master 2026-10-13 22:07:18 -04:00 AGit
Owner

Closes #12, with the scope decided on 2026-10-13: the event loop first, and only the operational_tools.py schema split. - Event loop. A write's ledger records, fences, checks, reservations and evidence commit about ten SQLite transactions, and these ran on the controller's event loop. Coordinator._db now runs them in a worker thread: each call opens its own connection, and the lock stays with the task. - Three things stay on the loop: the port's guards, the durable submission fence (the gateway calls it synchronously) and the observer callbacks. - tools/perf_coordinator_loop.py, 60 library writes on the synthetic port: the longest stall fell from 275–591 ms to 23–96 ms, and the 95th percentile from 249–437 ms to about 14 ms, at an unchanged 150 ms per write. - tests/stage3/test_coordinator_loop.py guards it: the loop now gets turns during a write, where it got none before. - Split. The 667-line catalog (closed schemas, purposes, definitions) moved from agents/operational_tools.py to agents/operational_catalog.py, and the importers were repointed. - Test stability. The API tests' wait helper allows 20 s instead of 8. Parallel workers on a busy machine once took longer than 8 s to show a collector failure. - docs/stage13/RUNTIME_HARDENING.md records the measurement. 🤖 Generated with Claude Code

Closes #12, with the scope decided on 2026-10-13: the event loop first, and only the `operational_tools.py` schema split. - **Event loop.** A write's ledger records, fences, checks, reservations and evidence commit about ten SQLite transactions, and these ran on the controller's event loop. `Coordinator._db` now runs them in a worker thread: each call opens its own connection, and the lock stays with the task. - Three things stay on the loop: the port's guards, the durable submission fence (the gateway calls it synchronously) and the observer callbacks. - `tools/perf_coordinator_loop.py`, 60 library writes on the synthetic port: the **longest stall fell from 275–591 ms to 23–96 ms**, and the 95th percentile from 249–437 ms to about 14 ms, at an unchanged 150 ms per write. - `tests/stage3/test_coordinator_loop.py` guards it: the loop now gets turns during a write, where it got none before. - **Split.** The 667-line catalog (closed schemas, purposes, definitions) moved from `agents/operational_tools.py` to `agents/operational_catalog.py`, and the importers were repointed. - **Test stability.** The API tests' wait helper allows 20 s instead of 8. Parallel workers on a busy machine once took longer than 8 s to show a collector failure. - `docs/stage13/RUNTIME_HARDENING.md` records the measurement. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
A write's ledger records, fences, policy and oscillation checks,
reservations and evidence commit about ten SQLite transactions, and they
ran on the controller's event loop: each write blocked the API, the
streams and the observer for its whole synchronous stretch.
Coordinator._db now runs that work in a worker thread. Each call opens
its own connection, and the lock stays with the task. The port's guards,
the durable submission fence (the gateway calls it synchronously) and the
observer callbacks stay on the loop.

tools/perf_coordinator_loop.py, 60 library writes on the synthetic port:
- longest stall: 275-591 ms -> 23-96 ms;
- p95: 249-437 ms -> about 14 ms;
- unchanged at 150 ms per write.
tests/stage3/test_coordinator_loop.py guards it: the loop gets turns
during a write, where it got none before.

The 667-line catalog of closed schemas, purposes and definitions moved
from agents/operational_tools.py to agents/operational_catalog.py; the
tools module keeps the read and planning implementations (operator
2026-10-13: the event loop first, and only this split).

The API tests' wait helper allows 20 s instead of 8: parallel workers
on a busy machine once took longer to show a collector failure.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Version 0.7.10 (event-loop)
Some checks failed
check / check (ubuntu-latest) (push) Has been cancelled
check / check (windows-latest) (push) Has been cancelled
check / check (ubuntu-latest) (pull_request) Has been cancelled
check / check (windows-latest) (pull_request) Has been cancelled
3725fca8af
vinny manually merged commit 3725fca8af into master 2026-10-13 22:07:18 -04:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
vinny/CMOnet!22
No description provided.