fix: preserve Hermes sessions across transport changes

This commit is contained in:
Ryder Sun committed 2026-09-15 18:05:44 +08:00
1 parent e7c0223bfa
commit eb2234b598
2 files changed
+5 -4

No files matched your search

+4 -3
View File
@@ -73,9 +73,10 @@ function invocation(kind, executable, workdir, sessionRef = '', options = {}) {
}
}
if (kind === 'hermes') {
const legacySessionRef = options.sessionTransport === 'acp' ? '' : sessionRef
// Hermes uses the same native conversation identifier across its ACP and
// legacy transports. Keep it when an attachment requires the legacy path.
const legacySessionRef = sessionRef
const useAcp = options.invocationTransport !== 'legacy'
&& !attachments.length
&& options.hermesAcpAvailable !== false
&& (!sessionRef || options.sessionTransport === 'acp')
if (useAcp) {
@@ -187,7 +188,7 @@ function invocation(kind, executable, workdir, sessionRef = '', options = {}) {
}
}
if (kind === 'mimo') {
if (options.invocationTransport !== 'json') {
if (!attachments.length && options.invocationTransport !== 'json') {
return {
command: executable,
args: ['acp', '--pure', '--cwd', workdir],
@@ -770,7 +770,7 @@ class LocalWorkspaceAgentInvocation {
const hermesNeedsLegacy = kind === 'hermes' && sessionTransport === 'acp'
&& (!HERMES_WORKSPACE_ACP_ENABLED
|| agent.acpAvailable === false
|| (context.attachments || []).length > 0)
)
if (resumedPermission && hermesNeedsLegacy) {
throw new Error('LOCAL_RUN_PERMISSION_RESUME_UNAVAILABLE')
}