Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): runs no longer get stuck #15048

Mergedt3dotgg(GitHub profile, opens in a new tab)merged 3 commits intomain fromrefs/pull/15048/headmerged by t3dotgg(GitHub profile, opens in a new tab) View on GitHub

Showing 9 changed files with 80 additions and 35 deletions (loading 7).

x
0 of 9 viewed, 9 left
21 additions and 3 deletionsapps/server/src/orchestration-v2/EffectOutbox.tsModified
View file
@@ -278,9 +278,16 @@
available,
Array.from({ length: Math.min(64, Math.max(0, Math.floor(count))) }, () => undefined),
).pipe(Effect.asVoid);
+ // Each thread runs its effects one at a time, in enqueue (rowid) order. An earlier
+ // effect waiting out a retry backoff still blocks later ones, so a turn
+ // cannot start while a failed rollback is about to restore files. A claim
+ // that skips restart continuations is not blocked by them either.
// Title generation is correlated metadata work, so it has its own
// per-thread lane and cannot delay provider lifecycle effects.
- const claimableCandidatePredicate = (availableBefore?: string) =>
+ const claimableCandidatePredicate = (
+ availableBefore?: string,
+ excludeRestartContinuations = false,
+ ) =>
sql`
availableBefore === undefined
@@ -292,7 +299,18 @@
SELECT 1
FROM orchestration_v2_effect_outbox AS active
WHERE active.thread_id = candidate.thread_id
- AND active.status = 'running'
+ AND (
+ active.status = 'running'
+ OR (
+ active.status = 'pending'
+ AND active.rowid < candidate.rowid
+ AND ${