fix: make managed SSH sessions fast and resilient
GoodBuddy Agents / Validate Agent source (push) Canceled after 0s
GoodBuddy Agents / Build Linux arm64 Agent (push) Canceled after 0s
GoodBuddy Agents / Build Linux x64 Agent (push) Canceled after 0s
Cross-platform packages / Validate source (push) Canceled after 0s
Cross-platform packages / Authorize desktop packaging (push) Canceled after 0s
Cross-platform packages / linux arm64 (push) Canceled after 0s
Cross-platform packages / macos arm64 (push) Canceled after 0s
Cross-platform packages / windows arm64 (push) Canceled after 0s
Cross-platform packages / linux x64 (push) Canceled after 0s
Cross-platform packages / macos x64 (push) Canceled after 0s
Cross-platform packages / windows x64 (push) Canceled after 0s
Cross-platform packages / Publish GitHub and OSS release (push) Canceled after 0s

Managed SSH project selection repeatedly activated the remote Host and could
leave idle ACP bindings rejected as stale-controller after a controller
generation change. Host environment updates also coupled project state to
component installation evidence and presented a crowded control surface.

Project selection is now local-only, one Host connection serves compatible
project and conversation callers, idle bindings are safely replaced only
after proven controller takeover, and active prompts keep exact resume/replay.
Remote environment setup now uses explicit signed compound package
preparation with bounded transfer, rollback, recovery, and clearer settings.

Managed Hosts must be updated to separately distributed Agent 0.11.6 before
the daemon-side controller recovery fix takes effect. Desktop packages do not
embed the Agent or remote Runtime, and existing project data is preserved.

Release note: 托管 SSH 项目切换不再重复连接,同一 Host 可顺畅承载多个项目和对话;同时修复重连后的 stale-controller,并优化远程环境安装、更新与状态布局。
This commit is contained in:
mesalogo
2026-08-29 10:58:19 +08:00
parent eb947213c8
commit 459cc21e3d
117 changed files with 19876 additions and 9664 deletions
@@ -3,25 +3,21 @@ import {
type RemoteWorkspaceAccessFactory,
type RemoteWorkspaceProjectBinding
} from '../workspace/remote-workspace-access'
import type { AgentInstallationManager } from './agent-installation-manager'
import type { RemoteAgentConnectionManager } from './remote-agent-connection-manager'
import type { AgentInstallationManager } from './agent-installation-manager'
import {
ProtocolRemoteWorkspaceTransport,
type RemoteWorkspaceInstallationIdentityResolver
} from './protocol-remote-workspace-transport'
export type ManagedRemoteWorkspaceAccessFactoryOptions = {
installationManager: Pick<
AgentInstallationManager,
'ensureInstalled'
>
connectionManager: Pick<RemoteAgentConnectionManager, 'acquire'>
installationManager: Pick<AgentInstallationManager, 'activateInstalled'>
}
/**
* Composes persisted project validation with fresh installation and
* connection leases. The resulting WorkspaceAccess remains strictly
* read-only and owns every acquired connection lease.
* Resolves the Host's current Agent before opening a read-only Workspace
* connection. Projects persist only the Host and remote path.
*/
export class ManagedRemoteWorkspaceAccessFactory
implements RemoteWorkspaceAccessFactory
@@ -33,25 +29,21 @@ export class ManagedRemoteWorkspaceAccessFactory
create(bindingInput: RemoteWorkspaceProjectBinding): RemoteWorkspaceAccess {
const binding = { ...bindingInput }
const resolver: RemoteWorkspaceInstallationIdentityResolver = {
resolve: async (hostId, installationId, signal) => {
if (
hostId !== binding.hostId ||
installationId !== binding.agentInstallationId
) {
resolve: async (hostId, signal) => {
if (hostId !== binding.hostId) {
throw new Error(
'Remote workspace installation request does not match its project binding'
'Remote workspace Host does not match its project binding'
)
}
signal?.throwIfAborted()
const installation =
await this.options.installationManager.ensureInstalled(
binding.hostId,
{ signal }
)
signal?.throwIfAborted()
assertInstallationMatches(binding, installation)
return { installation }
return {
installation:
await this.options.installationManager.activateInstalled(
hostId,
{ ...(signal === undefined ? {} : { signal }) }
)
}
}
}
return new RemoteWorkspaceAccess(
@@ -63,22 +55,3 @@ export class ManagedRemoteWorkspaceAccessFactory
)
}
}
function assertInstallationMatches(
binding: RemoteWorkspaceProjectBinding,
installation: Awaited<
ReturnType<AgentInstallationManager['ensureInstalled']>
>
): void {
if (
installation.installationId !== binding.agentInstallationId ||
installation.binaryDigest !== binding.agentBinaryDigest ||
installation.agentVersion !== binding.agentVersion ||
installation.architecture !== binding.agentArchitecture ||
installation.protocol.major !== binding.agentProtocolMajor
) {
throw new Error(
'Installed Remote Agent does not match the persisted project binding'
)
}
}