fix(subagent): harden continuable persistence

This commit is contained in:
Dudu-0223
2026-07-24 12:39:07 +08:00
committed by imccyu
parent bb8ea2be51
commit 1ab3cbf673
23 changed files with 412 additions and 56 deletions

View File

@@ -0,0 +1,14 @@
import type { Context } from 'cordis'
export const name = 'subagent-durability-failure'
/** Fail a continuable child's provider-owned final durability confirmation. */
export function apply(ctx: Context): void {
const flushedTurnEnds = new WeakSet<object>()
ctx.on('session/flush', (session) => {
if (session.header.parentSession === undefined) return
if (session.events.at(-1)?.type !== 'turn/end') return
if (flushedTurnEnds.has(session)) throw new Error('snapshot disk full')
flushedTurnEnds.add(session)
})
}