fix: stabilize Runtime workflows for 0.12.3

OpenCode status checks could cold-start throwaway servers, unrelated
conversations could block each other, and model, Continue, or remote paths
could replay or duplicate work under failure and backlog conditions. Settings
could also lose edits or overwrite unrelated model fields.

This update makes status checks passive, keeps per-conversation ordering while
allowing concurrency, preserves native long-running work with bounded display
capture and backpressure, narrows retries to known pre-dispatch failures, and
aligns remote Ask permissions without reducing Execute. It also keeps
Embedding updates narrow, improves settings and browser guidance, removes the
unused legacy Main gateway state, and records the validated Desktop 0.12.3 and
Agent 0.11.17 release metadata.

Release note: 改善 OpenCode 切换、多会话长任务、模型重试、远程 Ask/Execute 与设置保存可靠性,并完成 Desktop 0.12.3 / Agent 0.11.17 发布准备。
This commit is contained in:
mesalogo
2026-09-04 08:05:29 +08:00
parent 374968d50b
commit 4490e5fd15
60 changed files with 1639 additions and 3839 deletions
+25 -17
View File
@@ -332,9 +332,9 @@ function usageEvent(
* Generic ACP runtime over an authenticated remote virtual channel.
*
* The class deliberately does not claim confinement from ACP itself. Ask
* permits only one-shot native reads, while the injected channel's read-only
* sandbox remains the filesystem boundary. Execute follows the user's full
* authorization for the selected SSH account.
* permits only one-shot native reads in addition to the OpenCode Ask
* permission profile. Execute follows the user's full authorization for the
* selected SSH account.
*/
export class AcpRemoteRuntime implements AgentRuntime {
readonly requiresToolApproval = false
@@ -1833,15 +1833,6 @@ export class AcpRemoteRuntime implements AgentRuntime {
return
}
const bytes = utf8JsonBytes(notification.update)
const maximumItems = Math.max(
1,
this.options.maxPendingUpdates ?? DEFAULT_MAX_PENDING_UPDATES
)
const maximumBytes = Math.max(
1,
this.options.maxPendingUpdateBytes ??
DEFAULT_MAX_PENDING_UPDATE_BYTES
)
let consume: (() => void) | undefined
const consumed = new Promise<void>((resolve) => {
consume = resolve
@@ -1856,10 +1847,7 @@ export class AcpRemoteRuntime implements AgentRuntime {
prompt.wake = undefined
if (
!prompt.inboundPaused &&
(
prompt.updates.length >= maximumItems ||
prompt.pendingUpdateBytes >= maximumBytes
)
this.pendingUpdateLimitReached(prompt)
) {
prompt.inboundPaused = true
await this.awaitOperation(
@@ -1881,7 +1869,11 @@ export class AcpRemoteRuntime implements AgentRuntime {
prompt.pendingUpdateBytes - queued.bytes
)
queued.consumed()
if (prompt.inboundPaused && !prompt.interruption) {
if (
prompt.inboundPaused &&
!prompt.interruption &&
!this.pendingUpdateLimitReached(prompt)
) {
prompt.inboundPaused = false
void this.awaitOperation(
prompt.context,
@@ -1892,6 +1884,22 @@ export class AcpRemoteRuntime implements AgentRuntime {
return queued.update
}
private pendingUpdateLimitReached(prompt: ActivePrompt): boolean {
const maximumItems = Math.max(
1,
this.options.maxPendingUpdates ?? DEFAULT_MAX_PENDING_UPDATES
)
const maximumBytes = Math.max(
1,
this.options.maxPendingUpdateBytes ??
DEFAULT_MAX_PENDING_UPDATE_BYTES
)
return (
prompt.updates.length >= maximumItems ||
prompt.pendingUpdateBytes >= maximumBytes
)
}
private discardUpdates(prompt: ActivePrompt): void {
for (const queued of prompt.updates.splice(0)) {
queued.consumed()