mirror of
https://github.com/stablyai/orca.git
synced 2026-11-16 02:47:34 +00:00
fix(persistence): keep the whole-row fallback for replaced run lists
A run list replaced outside the run-delta path (catalog import, SSH re-adoption) saves as a whole row again, so histories that can't use the per-run storage still save. A failed in-flight run write restores its pending list only while that list is still current; otherwise it marks the run domain for a whole-row save. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
ca04234c91
commit
69c83f22db
@@ -23,7 +23,15 @@ export async function writeProfileStateInWorker(
|
||||
runtime.dirtyProfileStateDomains.add(domain)
|
||||
}
|
||||
}
|
||||
runtime.pendingAutomationRunsAfter ??= automationRuns
|
||||
if (automationRuns === undefined || runtime.pendingAutomationRunsAfter !== undefined) {
|
||||
return
|
||||
}
|
||||
// A run list replaced while this write was in flight is newer; save it as a whole row instead.
|
||||
if (automationRuns === runtime.state.automationRuns) {
|
||||
runtime.pendingAutomationRunsAfter = automationRuns
|
||||
} else {
|
||||
runtime.dirtyProfileStateDomains?.add('automationRuns')
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
@@ -117,9 +117,12 @@ function scheduleDomainSave(
|
||||
listener(dirtyDomains)
|
||||
}
|
||||
runtime.automationListProjectionCache = null
|
||||
// A named automationRuns save supersedes older run lists, including one a failed in-flight write restores.
|
||||
if (dirtyDomains?.includes('automationRuns')) {
|
||||
runtime.pendingAutomationRunsAfter = runtime.state.automationRuns
|
||||
// A run list replaced outside the run-delta path saves as a whole row; an older pending delta is stale.
|
||||
if (
|
||||
dirtyDomains?.includes('automationRuns') &&
|
||||
runtime.pendingAutomationRunsAfter !== runtime.state.automationRuns
|
||||
) {
|
||||
runtime.pendingAutomationRunsAfter = undefined
|
||||
}
|
||||
const trackedDomains = runtime.dirtyProfileStateDomains
|
||||
if (dirtyDomains === undefined) {
|
||||
|
||||
Reference in New Issue
Block a user