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
chatd waker: follow-ups from the #294 review (stalled reads, slot stall, poke gaps) #347
Coder Agents opened this issue on behalf of @ibetitsmike.
Follow-ups from the Opus pre-merge review of #344 and #345 (#294 waker). None of them is a P1, and the first two predate the waker. Tracking issue: #311.
A read that does not fit the time left re-runs at once with no progress. In coderd/x/chatd/fork_wait_for_events.go, !wakeupReadFits(...) returns nil without writing anything, and fork_waker.go pokes after every nil result. With 3 or more PR watches and a stalled GitHub, PR 1 and 2 time out (30 s each), the delivery returns nil, and the redelivery reads PR 1 and 2 again. Later watches are never read and the wake-up holds a delivery slot until it expires. Fix: return a sentinel that does not poke, or write next_run_at = now + eventsPollInterval, and read watches round-robin from where the last delivery stopped.
Full delivery slots stall the waker loop.dispatch blocks the single loop on k.slots <- struct{}{}. While 8 events wake-ups sit in slow reads, pokes, the timer and the sweep are not handled, so plain wake-ups of other chats wait. Fix: skip and mark the chat for another pass instead of blocking, or reserve slots for non-events kinds.
Children-only events wake-ups rely on pokes and the 60 s sweep (after feat(chatd): make events wake-ups due when a watched child is done #345). A child that becomes done through a commit not published on chatd's wrapped pubsub (for example a descendant question answered over HTTP, or the child's own wake-up finishing) is seen only by the sweep: up to 60 s, against 15 s before. Fix: poke the parent's waker from those paths, or add a test proving each path publishes.
New wake-ups created while the chat is idle do not poke. For example a wake-up created over the API waits for the next sweep (up to 60 s) before the timer is armed. Fix: poke after the create commit.
Nits: the delivery deadline in fork_waker.go uses time.Now/time.Until, not quartz; run is one-shot, so a worker started twice on one Server has no waker (does not happen in production today).
Acceptance: a test for each of 1 to 4 that fails before the fix, plus a negative control.
#376 merged 2026-11-17 08:03Z as ada0207 and resolves item 1 and the quartz nit of item 5. PR #377 covers items 2, 3, 4 and 5b and is being restacked on the new main.
Activity
ibetitsmike commentedon Nov 17, 2026
Delegated to a workstream (Opus 5.5, high) on 2026-11-17 05:50Z. Branch
mike/issue-347-waker-followups, one PR onmainwithCloses #347.fix(coderd/x/chatd): defer poked passes while every slot is taken
fix(coderd/x/chatd): give a freed slot to the chat skipped first
ibetitsmike commentedon Nov 17, 2026
#376 merged 2026-11-17 08:03Z as ada0207 and resolves item 1 and the quartz nit of item 5. PR #377 covers items 2, 3, 4 and 5b and is being restacked on the new main.
fix(coderd/x/chatd): keep the waker loop free of full slots and poke …
ibetitsmike commentedon Nov 17, 2026
Closed by #377, merged 2026-11-17 09:03Z as 1a19c25 (items 2, 3, 4 and 5b). Item 1 and the quartz nit of item 5 were resolved by #376 (ada0207).