Skip to content

Commit 3a5d0d1

Browse files
authored
feat(host): push channel lifecycle through project lobbies (#337)
* feat(host): push channel lifecycle through project lobbies After each successful publish to the directory, a host diffs its channels against its previous publication and sends each change (created, renamed, summarized, archived, resumed, moved, deleted, or a run's end, with the new listing) to that project's lobby. Each stays queued, latest per channel, until the lobby echoes it back, and is resent after a reconnect, since a socket can die unnoticed. A lobby the host no longer needs stays until the next publication, so a project's last deletion still reaches it. Teammates' hosts apply events to their directory listings at once and rebuild listings once per burst, so a replay of thousands of events reads catalogs a few times, not per event; a directory read already in flight reapplies them, and a resync reads the directory again. While every project a host subscribes to has a live lobby and its last publish succeeded, the 30 s directory poll slows to a 5 min read; changes still publish immediately, and a change that arrives during a sync runs another. Activity alone sends no event and reaches teammates through peers or that read. Without lobbies the poll stays at 30 s. Refs #17, #14. Why: apps/host/src/lobby.ts#function published | events must be sent only after the directory PUT succeeds, so a teammate that reads the directory on receipt agrees with the event Why: apps/host/src/directory.ts#function watch | the poll may slow only while every subscribed project's lobby is live and the last publish succeeded; a 404, dropped lobby, or failed PUT must keep the 30 s poll Why: apps/host/src/directory.ts#function apply | a directory read that started before a lifecycle event must reapply it, or the stale read undoes the push Why: apps/host/src/lobby.ts#function receive | this host's events stay queued until the lobby echoes them (same channel and at), since a socket can die unnoticed for up to SILENT Why: apps/host/src/lobby.ts#function update | a lobby no longer wanted must stay until the next publication, or a project's last deletion is never sent Why: apps/host/src/lobby.ts#function listed | teammates' events rebuild listings once per burst; a replay must never re-read catalogs per event * lane: sync lobby-lifecycle memory * lane: sync lobby-lifecycle memory * lane: sync lobby-lifecycle memory * lane: sync lobby-lifecycle memory * lane: sync lobby-lifecycle memory * lane: sync lobby-lifecycle memory
1 parent 812a8fc commit 3a5d0d1

16 files changed

Lines changed: 328 additions & 62 deletions
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
id: 01M4YSX88PD74Z0WQTMNG5FNPJ
3+
anchor: function watch
4+
created: 2026-10-15T03:32:48Z
5+
norm: '1'
6+
sig: 01895e7ff9a47d37
7+
body_hash: e498ff76c7097ccb
8+
raw_hash: e58e16ae5b37f605
9+
lines: 89-148
10+
---
11+
12+
the poll may slow only while every subscribed project's lobby is live; a 404 or dropped lobby must keep the 30 s poll

.lane/memory/apps/host/src/directory.ts/01M4YX72ZF09QKX1XJ0CWEPTZV-refresh-diagnostics-sync-joi.md renamed to .lane/attic/apps/host/src/directory.ts/01M4YX72ZF09QKX1XJ0CWEPTZV-refresh-diagnostics-sync-joi.md

File renamed without changes.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
id: 01M4YSX88YQ6XNNRA7NZD729XT
3+
anchor: function apply
4+
created: 2026-10-15T03:32:48Z
5+
norm: '1'
6+
sig: 952447435beb8f3b
7+
body_hash: aab39324170917ad
8+
raw_hash: 7c1c5d4a8207184b
9+
lines: 58-61
10+
---
11+
12+
a directory read that started before a lifecycle event must reapply it, or the stale read undoes the push
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
id: 01M4YWKAGD3FTMWYWE1KVXT9Q1
3+
anchor: function watch
4+
created: 2026-10-15T04:19:48Z
5+
norm: '1'
6+
sig: 01895e7ff9a47d37
7+
body_hash: 427b4a824965c455
8+
raw_hash: 051c8317452a26a4
9+
vouched: 2026-10-15T10:22:45Z
10+
lines: 89-149
11+
---
12+
13+
the poll may slow only while every subscribed project's lobby is live and the last publish succeeded; a 404, dropped lobby, or failed PUT must keep the 30 s poll
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
id: 01M4ZHBX7QSQ80PQ8ZKSCK37JC
3+
anchor: const sync
4+
created: 2026-10-15T10:22:45Z
5+
norm: '1'
6+
sig: 949f14184cef9b55
7+
body_hash: ebd35c8e35a08bcf
8+
raw_hash: 9df0f7c1d50b6827
9+
lines: 220-223
10+
supersedes: 01M4YX72ZF09QKX1XJ0CWEPTZV
11+
---
12+
13+
Refresh (diagnostics sync), a directory change, and the heartbeat join an in-flight sync for the same URL; only a channel change queues one follow-up sync, since the running one may have read channels before it. A sync for an old URL never holds a directory change, which keeps Join/Change/Leave from waiting on a keychain prompt

‎.lane/memory/apps/host/src/gateway.ts/01M4YT9Z8YJ2ZWZCVB752WDCFF-workers-and-agent-shells-fin.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ anchor: function serve
44
created: 2026-10-15T03:39:45Z
55
norm: '1'
66
sig: 9102a6912d6b112c
7-
body_hash: 6ab7352408aef66a
8-
raw_hash: 263349ca929c8f26
9-
vouched: 2026-10-15T10:17:10Z
7+
body_hash: efe18941bbea238a
8+
raw_hash: 68e7635dd1eeb140
9+
vouched: 2026-10-15T10:22:50Z
1010
lines: 668-751
1111
---
1212

‎.lane/memory/apps/host/src/gateway.ts/01M4ZH1NMBK54TCB970R3AJ1X1-a-loopback-host-must-not-cal.md‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ anchor: function serve
44
created: 2026-10-15T10:17:10Z
55
norm: '1'
66
sig: 9102a6912d6b112c
7-
body_hash: 6ab7352408aef66a
8-
raw_hash: 263349ca929c8f26
7+
body_hash: efe18941bbea238a
8+
raw_hash: 68e7635dd1eeb140
9+
vouched: 2026-10-15T10:22:50Z
910
lines: 830-948
1011
supersedes: 01M4Z2R1HEVDKEA8VEJ7XRJQ8F
1112
---

‎.lane/memory/apps/host/src/lobby.ts/01M4YSPPFHAKTZ9ZN784YH431C-lobby-subscriptions-must-not.md‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ anchor: function update
44
created: 2026-10-15T03:29:13Z
55
norm: '1'
66
sig: 8a0d2e97c61d3b2a
7-
body_hash: 58eec371bac94f06
8-
raw_hash: 9536211278b6a5e1
7+
body_hash: 9d97e7ca6f446b19
8+
raw_hash: 16839cd70b817237
9+
vouched: 2026-10-15T04:19:51Z
910
lines: 135-164
1011
---
1112

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
id: 01M4YSX88ENYGZDM1AWFYJQZCF
3+
anchor: function published
4+
created: 2026-10-15T03:32:48Z
5+
norm: '1'
6+
sig: f41cc449f904a732
7+
body_hash: fc3b5666ab1b7f61
8+
raw_hash: 5c41e63f4e355fb8
9+
vouched: 2026-10-15T04:19:48Z
10+
lines: 163-186
11+
---
12+
13+
events must be sent only after the directory PUT succeeds, so a teammate that reads the directory on receipt agrees with the event
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
id: 01M4YWKAH0WM7TQT3FN8CKNJM5
3+
anchor: function receive
4+
created: 2026-10-15T04:19:48Z
5+
norm: '1'
6+
sig: 75d6998d076e5f0f
7+
body_hash: 7e73e7a02213b7b5
8+
raw_hash: c859d05ea4ef1c3a
9+
lines: 182-206
10+
---
11+
12+
this host's events stay queued until the lobby echoes them (same channel and at), since a socket can die unnoticed for up to SILENT

0 commit comments

Comments
 (0)