You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 36ffca5
Browse filesBrowse the repository at this point in the historyBrowse files
feat(core): the inbound pipeline plans under the lock, delivers in lanes (RMK-93)
The surgery half of the delivery-lanes amendment (roomkit-specs e0aabcc,
engine in d7ecbb6). The room lock now ends at broadcast planning:
_run_precommit commits the trigger through _commit_to_lane — commit,
plan (router.plan against binding state consistent with the commit) and
lane enqueue in one gate — and _process_broadcast is gone. Execution,
the RFC §10.3 mutation trigger, delivery reporting, the ON_ERROR funnel,
side effects and AFTER_BROADCAST all fire from the lane executor
(LaneExecutionMixin); response events re-enter as their own commit
passes under a fresh room lock, their plans queued behind the trigger.
process_inbound/send_event await the full cascade, so the observable
contract — the AI response is committed when the call returns — holds
across the whole suite.
Every committed index reaches the delivery cursor exactly once: the
three commit gates (_persist_committed, _commit_indexed,
_commit_to_lane) are the only paths to store.commit_event in core, a
static guard test enforces it, and no-broadcast commits (BLOCKED events,
injected stored-only, child-room traces, streamed segments) advance the
cursor opportunistically or as lane entries. Injected events keep their
bare delivery shape but ride the lane — no more channel I/O under the
lock. A send_event issued from a sync hook or a tool handler
short-circuits its cascade wait (deadlock-free) and hands stream
consumption to a tracked background task. Broadcast telemetry spans
carry their parent across the lane boundary. The Postgres schema
backfills delivered_index=latest_index once, when the column is first
created — verified against a legacy-schema database with data, and
against a re-init.
New: RoomKit(delivery_gap_timeout=30.0, delivery_claim_lock_manager=...),
framework event delivery_skipped. Full suite 6654 green; PG16 gated
tests (multiprocess advisory locks included) 191 green.
Copy file name to clipboardExpand all lines: CHANGELOG.md
+73Lines changed: 73 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,79 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
8
8
## [Unreleased]
9
9
10
+
### Changed
11
+
12
+
-**The room lock ends at broadcast planning — external delivery moved to
13
+
per-room delivery lanes** (RFC §10.1 steps 12-14, §10.2, §13.5; the
14
+
roomkit-specs amendment `e0aabcc`). Measured on the scale bench: with
15
+
`channel.on_event`/`deliver` (provider round trips, AI generation) inside
16
+
the room's critical section, adding workers made rooms *slower* — 74
17
+
backends parked on advisory locks while 3-4 worked. Now the lock covers
18
+
the pre-commit gates, the atomic commit and the *planning* of the
19
+
delivery set; execution runs off the lock, ordered per room by the
20
+
`Room.delivered_index` cursor (strict CAS) under a delivery claim — a
21
+
derived `__delivery__:{room_id}` key on the existing lock manager. One
22
+
lane per room and per process executes only the plans its process
23
+
enqueued; the shared cursor forces the global order. Observable
24
+
semantics preserved: `process_inbound`/`send_event` still return after
25
+
the full delivery cascade (trigger set + every reentry pass it spawned),
26
+
so "the AI response is committed when the call returns" holds. Response
27
+
events re-enter as their own commit passes (fresh room lock) instead of
28
+
being drained inside the trigger's lock tenure — a concurrent inbound
29
+
MAY now commit between a trigger and its response (the RFC's explicit
30
+
relaxation: index monotonicity and parent linkage, never adjacency).
31
+
AFTER_BROADCAST keeps its contract (fires after the event's delivery
32
+
set completes); its relative order across trigger/reentries follows
33
+
execution order. A worker that commits and crashes before delivering
34
+
leaves a cursor hole: the waiting lane skips it after
35
+
`delivery_gap_timeout` with a `delivery_skipped` framework event —
36
+
the same bounded loss as the previous crash window, now observable and
37
+
without wedging the room. The Postgres store backfills
38
+
`delivered_index = latest_index` once, when the column is first created
39
+
(pre-lane deployments delivered under the lock, so everything stored is
40
+
delivered).
41
+
42
+
### Added
43
+
44
+
-**`RoomKit(delivery_gap_timeout=30.0)`** — how long a lane waits on a
45
+
cursor hole owned by an absent worker before skipping it, and
46
+
**`RoomKit(delivery_claim_lock_manager=...)`** — a dedicated lock manager
47
+
(own pool) for delivery claims, so claim tenures (which span provider
48
+
round trips) cannot starve the room-lock pool commits depend on. New
0 commit comments