fix: persist isolated group agent sessions

This commit is contained in:
Ryder Sun committed 2026-09-15 17:10:10 +08:00
1 parent 07396fbf29
commit 3ce8ee4f49
1 file changed
+5 -5
@@ -699,9 +699,9 @@ class LocalWorkspaceAgentInvocation {
} }
: null : null
const idempotencyMode = agent.idempotencyMode === 'durable' ? 'durable' : 'none' const idempotencyMode = agent.idempotencyMode === 'durable' ? 'durable' : 'none'
const resolvedSession = reviewOnly || isolated const resolvedSession = reviewOnly
? { ? {
key: this.sessionKey(group.id, kind, group.conversationType === 'direct' ? '' : taskId), key: this.sessionKey(group.id, kind),
sessionRef: '', sessionRef: '',
sessionMeta: {}, sessionMeta: {},
provenance: createdSessionProvenance(group, taskId, true), provenance: createdSessionProvenance(group, taskId, true),
@@ -1433,7 +1433,7 @@ class LocalWorkspaceAgentInvocation {
onSessionRef: (nextSessionRef, metadata = {}) => { onSessionRef: (nextSessionRef, metadata = {}) => {
if (agentCallbacksClosed || agentController.signal.aborted) return if (agentCallbacksClosed || agentController.signal.aborted) return
noteWatchdogProgress() noteWatchdogProgress()
if (reviewOnly || isolated) return if (reviewOnly) return
const transport = ['legacy', 'acp'].includes(metadata?.transport) const transport = ['legacy', 'acp'].includes(metadata?.transport)
? metadata.transport ? metadata.transport
: '' : ''
@@ -1446,7 +1446,7 @@ class LocalWorkspaceAgentInvocation {
})) }))
}, },
onSessionInvalidated: () => { onSessionInvalidated: () => {
if (kind !== 'hermes' || isolated || resumedPermission) return null if (kind !== 'hermes' || reviewOnly || resumedPermission) return null
return { prompt: rebuildFreshSession() } return { prompt: rebuildFreshSession() }
}, },
signal: agentController.signal, signal: agentController.signal,
@@ -1895,7 +1895,7 @@ class LocalWorkspaceAgentInvocation {
pendingMessage.metadata, pendingMessage.metadata,
) )
: null : null
if (!reviewOnly && !isolated) { if (!reviewOnly) {
this.persistSessionState(key, result.sessionRef || sessionRef, completedSessionMeta( this.persistSessionState(key, result.sessionRef || sessionRef, completedSessionMeta(
sessionMeta, sessionProvenance, taskId, { sessionMeta, sessionProvenance, taskId, {
promptChars: prompt.length, promptChars: prompt.length,