Skip to content

Commit 840b798

Browse files
committed
docs(agent): note the residual append race the delivery fence accepts
1 parent 9c8c6e0 commit 840b798

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

internal-packages/dashboard-agent/src/watch-tick.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,13 @@ function wakeAction(watch: Watch, facts: Record<string, unknown>): WatchWakeActi
331331
* Both of those writes carry the claim's `claimId`, so they only ever touch the
332332
* claim this call owns: a deliverer that hung long enough to be taken over comes
333333
* back to a row holding a different token, and its release and its mark do nothing.
334+
*
335+
* Known residual race: the token fences the DB writes, not the session append
336+
* itself — an owner that hung PAST the stale window can still fire its append
337+
* late, concurrently with the takeover's. Accepted because every layer has to
338+
* fail at once for a duplicate to surface: the claim goes stale only after
339+
* WATCH_DELIVERY_CLAIM_STALE_MS (minutes, vs a delivery that takes seconds),
340+
* the action id is stable across deliverers, and the transcript dedups on it.
334341
*/
335342
async function deliverWake(deps: WatchDeliveryDeps, watch: Watch): Promise<boolean> {
336343
const now = deps.now?.() ?? new Date();

0 commit comments

Comments
 (0)