fix: recover remote conversations after uncertain prompts
An interrupted managed SSH prompt could leave its ACP binding as the permanent owner of the conversation, so every later user message failed with the same uncertain-recovery error. A later explicit prompt now retires that binding and starts a fresh ACP session without replaying the uncertain operation. Ask-mode Runtime startup also waited on the wrong bubblewrap executable identity. The Agent now supervises the bounded transition to the signed Runtime or model-bridge executable, and the Agent version advances to 0.11.10. Release note: 修复远程 ACP 请求中断后同一会话无法继续输入,以及 Ask 模式可能在模型调用前启动失败的问题。
This commit is contained in:
@@ -833,7 +833,7 @@ export class AcpRemoteRuntime implements AgentRuntime {
|
||||
return interrupted
|
||||
}
|
||||
|
||||
private async persistRejectedPrompt(
|
||||
private async persistClosedBinding(
|
||||
binding: RuntimeSessionBinding
|
||||
): Promise<RuntimeSessionBinding> {
|
||||
const closed = runtimeSessionBindingSchema.parse({
|
||||
@@ -1198,24 +1198,19 @@ export class AcpRemoteRuntime implements AgentRuntime {
|
||||
request: AgentExecutionRequest,
|
||||
signal: AbortSignal
|
||||
): Promise<SessionRecord> {
|
||||
const old = await this.awaitLocalOperation(
|
||||
let binding = await this.awaitLocalOperation(
|
||||
'读取会话绑定',
|
||||
this.options.bindingStore.getByConversation(conversationId),
|
||||
signal
|
||||
)
|
||||
if (
|
||||
old &&
|
||||
old.state !== 'closed' &&
|
||||
old.state !== 'ready'
|
||||
binding &&
|
||||
binding.state !== 'closed' &&
|
||||
binding.state !== 'ready'
|
||||
) {
|
||||
await this.persistInterrupted(old)
|
||||
throw new Error(
|
||||
old.state === 'prompt-running'
|
||||
? '远端 ACP 会话存在未确认的活动请求,结果未知且不会自动重放'
|
||||
: '远端 ACP 会话恢复状态不确定,已中断且不会自动重放'
|
||||
)
|
||||
await this.persistClosedBinding(binding)
|
||||
binding = undefined
|
||||
}
|
||||
let binding = old
|
||||
let bindingId = binding?.bindingId ?? randomUUID()
|
||||
if (
|
||||
binding?.state === 'ready' &&
|
||||
@@ -1437,7 +1432,7 @@ export class AcpRemoteRuntime implements AgentRuntime {
|
||||
error,
|
||||
'runtime/preparePrompt'
|
||||
)
|
||||
? this.persistRejectedPrompt(binding)
|
||||
? this.persistClosedBinding(binding)
|
||||
: this.persistInterrupted(binding)
|
||||
await persist.catch(() => undefined)
|
||||
}
|
||||
@@ -1483,7 +1478,7 @@ export class AcpRemoteRuntime implements AgentRuntime {
|
||||
error,
|
||||
'runtime/preparePrompt'
|
||||
)
|
||||
? this.persistRejectedPrompt(current.binding)
|
||||
? this.persistClosedBinding(current.binding)
|
||||
: this.persistInterrupted(current.binding)
|
||||
current.binding = await persist.catch(() => current.binding)
|
||||
this.sessions.delete(conversationId)
|
||||
|
||||
Reference in New Issue
Block a user