Skip to content
Source
Sign inSign up
TanStack/ai

fix(ai-harness): give a log back with a wake after a failed write #2270

Mergedpcbeingused33(GitHub profile, opens in a new tab)merged 3 commits intomain fromrefs/pull/2270/headmerged by AlemTuzlak View on GitHub

Showing 3 changed files with 78 additions and 5 deletions.

x
0 of 3 viewed, 3 left
5 additions and 0 deletions.changeset/harness-failed-write-wake.mdAdded
View file
@@ -0,0 +1,5 @@
+---
+'@tanstack/ai-harness': patch
+---
+​
+A log that stops after a failed write, or after a failed read before the first write, now goes back with a wake of 30 seconds. Before, it was released with no wake, so no later `resumePending` or worker sweep listed it again.
9 additions and 5 deletionspackages/ai-harness/src/log.tsModified
View file
@@ -7,7 +7,7 @@
NO_OWNER_EPOCH,
} from '@tanstack/ai-persistence'
import { gapEvent } from './feed'
-import { LogOwnedElsewhereError } from './ownership'
+import { LogOwnedElsewhereError, OPEN_RETRY_MS } from './ownership'
import { EventRing } from './ring'
import {
THREAD_RECORD_TYPES,
@@ -2491,8 +2491,11 @@
try {
await this.catchUp()
} catch (error) {
- // Not caught up, so it does not write: the log goes back.
- await this.ownership.release(this.logId, epoch).catch(() => {})
+ // Not caught up, so it does not write: the log goes back, with a
+ // wake, so a sweep after the wait tries again.
+ await this.ownership
+ .release(this.logId, epoch, OPEN_RETRY_MS)
+ .catch(() => {})
throw error