fix: make Host updates simple and fast
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
GoodBuddy Agent Release / Authorize Agent release (push) Canceled after 0s
Cross-platform packages / Validate source (push) Canceled after 0s
GoodBuddy Agent Release / Build Linux arm64 compound package (push) Canceled after 0s
GoodBuddy Agent Release / Build Linux x64 compound package (push) Canceled after 0s
GoodBuddy Agent Release / Sign cumulative Agent catalog (push) Canceled after 0s
GoodBuddy Agent Release / Publish Agent to GitHub and OSS (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
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
GoodBuddy Agent Release / Authorize Agent release (push) Canceled after 0s
Cross-platform packages / Validate source (push) Canceled after 0s
GoodBuddy Agent Release / Build Linux arm64 compound package (push) Canceled after 0s
GoodBuddy Agent Release / Build Linux x64 compound package (push) Canceled after 0s
GoodBuddy Agent Release / Sign cumulative Agent catalog (push) Canceled after 0s
GoodBuddy Agent Release / Publish Agent to GitHub and OSS (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
Host repair could fail while adopting the published OpenCode Runtime, then repeat package and payload verification and carry durable metadata snapshots for recovery. Host preparation now verifies each acquired compound archive once, adopts signed Agent and Runtime metadata without rereading payload trees, and retries failed work by cleaning staging and preparing fresh. The desktop and Agent versions are advanced to 0.11.9 with the approved bilingual release notes. Remote Projects remain a disabled-by-default technical preview, Agent packages remain separate Linux x64/arm64 releases, and this release has no LoongArch preview. Release note: 修复 Host 更新采用失败,移除重复远端包体校验,并将中断恢复简化为清理暂存后重新准备。
This commit is contained in:
@@ -67,7 +67,6 @@ function createConnection(identity: SshPoolConnectionIdentity) {
|
||||
prepareRemotePackageBootstrap: vi.fn(),
|
||||
prepareUploadedRemotePackageBootstrap: vi.fn(),
|
||||
commitRemotePackageBootstrap: vi.fn(),
|
||||
getRemotePackageBootstrapCommitStatus: vi.fn(),
|
||||
cleanupRemotePackageBootstrap: vi.fn(),
|
||||
runAgentLifecycleAction: vi.fn(),
|
||||
runAgentRuntimeAction: vi.fn(),
|
||||
@@ -270,10 +269,6 @@ describe("SSH connection pool", () => {
|
||||
unavailable: false,
|
||||
reason: "size-mismatch",
|
||||
});
|
||||
connection.getRemotePackageBootstrapCommitStatus.mockResolvedValue({
|
||||
committed: false,
|
||||
reason: "operation-unavailable",
|
||||
});
|
||||
const pool = new SshConnectionPool(async () => connection);
|
||||
const lease = await pool.acquireRemotePackageBootstrap(createTarget());
|
||||
const candidate = {
|
||||
@@ -305,12 +300,6 @@ describe("SSH connection pool", () => {
|
||||
expect(
|
||||
connection.prepareUploadedRemotePackageBootstrap,
|
||||
).toHaveBeenCalledWith(candidate, undefined);
|
||||
await expect(lease.commitStatus(candidate)).resolves.toMatchObject({
|
||||
reason: "operation-unavailable",
|
||||
});
|
||||
expect(
|
||||
connection.getRemotePackageBootstrapCommitStatus,
|
||||
).toHaveBeenCalledWith(candidate, undefined);
|
||||
expect(lease).not.toHaveProperty("exec");
|
||||
expect(lease).not.toHaveProperty("sftp");
|
||||
lease.release();
|
||||
@@ -699,6 +688,10 @@ describe("authenticated ssh2 connection", () => {
|
||||
{ createClient: () => client as never },
|
||||
);
|
||||
|
||||
await expect(connection.runAgentBootstrapProbe()).resolves.toMatchObject({
|
||||
ready: true,
|
||||
architecture: "arm64",
|
||||
});
|
||||
await expect(connection.runAgentBootstrapProbe()).resolves.toMatchObject({
|
||||
ready: true,
|
||||
architecture: "arm64",
|
||||
@@ -713,6 +706,71 @@ describe("authenticated ssh2 connection", () => {
|
||||
},
|
||||
expect.any(Function),
|
||||
);
|
||||
expect(client.exec).toHaveBeenCalledOnce();
|
||||
client.emit("close");
|
||||
await expect(connection.runAgentBootstrapProbe()).rejects.toThrow(
|
||||
"SSH 连接已关闭",
|
||||
);
|
||||
});
|
||||
|
||||
it("caches an incompatible bootstrap result on the connection", async () => {
|
||||
const channel = Object.assign(new EventEmitter(), {
|
||||
stderr: new EventEmitter(),
|
||||
destroy: vi.fn(),
|
||||
});
|
||||
const output = [
|
||||
"GOODBUDDY_AGENT_BOOTSTRAP_PROBE_V1",
|
||||
"home=/home/builder",
|
||||
"uid=1001",
|
||||
"os=Linux",
|
||||
"arch=riscv64",
|
||||
"shell=/bin/bash",
|
||||
"procfs=ready",
|
||||
"",
|
||||
].join("\n");
|
||||
const client = Object.assign(new EventEmitter(), {
|
||||
connect: vi.fn(function connect(this: EventEmitter) {
|
||||
this.emit("ready");
|
||||
}),
|
||||
end: vi.fn(),
|
||||
destroy: vi.fn(),
|
||||
exec: vi.fn(
|
||||
(
|
||||
_command: string,
|
||||
_options: unknown,
|
||||
callback: (error: Error | undefined, stream: typeof channel) => void,
|
||||
) => {
|
||||
callback(undefined, channel);
|
||||
setTimeout(() => {
|
||||
channel.emit("data", output);
|
||||
channel.emit("close", 0);
|
||||
}, 0);
|
||||
},
|
||||
),
|
||||
sftp: vi.fn(),
|
||||
});
|
||||
const target = createTarget();
|
||||
const connection = await Ssh2AuthenticatedConnection.connect(
|
||||
target,
|
||||
{
|
||||
hostId: target.host.id,
|
||||
hostRevision: target.hostRevision,
|
||||
hostKeyGeneration: target.hostKeyGeneration,
|
||||
authenticationIdentity: "a".repeat(64),
|
||||
},
|
||||
new AbortController().signal,
|
||||
{ createClient: () => client as never },
|
||||
);
|
||||
|
||||
await expect(connection.runAgentBootstrapProbe()).resolves.toEqual({
|
||||
ready: false,
|
||||
reason: "unsupported-architecture",
|
||||
});
|
||||
await expect(connection.runAgentBootstrapProbe()).resolves.toEqual({
|
||||
ready: false,
|
||||
reason: "unsupported-architecture",
|
||||
});
|
||||
expect(client.exec).toHaveBeenCalledOnce();
|
||||
});
|
||||
|
||||
it("cancels a running bootstrap probe and destroys its channel", async () => {
|
||||
|
||||
@@ -99,10 +99,6 @@ export interface AuthenticatedSshConnection {
|
||||
candidate: SshRemotePackageCandidate,
|
||||
options?: SshRemotePackageBootstrapOptions,
|
||||
): Promise<SshRemotePackageBootstrapCommitResult>;
|
||||
getRemotePackageBootstrapCommitStatus(
|
||||
candidate: SshRemotePackageCandidate,
|
||||
options?: SshRemotePackageBootstrapOptions,
|
||||
): Promise<SshRemotePackageBootstrapCommitResult>;
|
||||
cleanupRemotePackageBootstrap(
|
||||
operationId: string,
|
||||
options?: Pick<SshRemotePackageBootstrapOptions, "signal">,
|
||||
@@ -134,7 +130,6 @@ export interface SshConnectionLease extends Omit<
|
||||
| "dispose"
|
||||
| "createRemotePackageUploadStaging"
|
||||
| "prepareUploadedRemotePackageBootstrap"
|
||||
| "getRemotePackageBootstrapCommitStatus"
|
||||
> {
|
||||
release(): void;
|
||||
}
|
||||
@@ -150,7 +145,6 @@ type InternalSshConnectionLease = SshConnectionLease &
|
||||
AuthenticatedSshConnection,
|
||||
| "createRemotePackageUploadStaging"
|
||||
| "prepareUploadedRemotePackageBootstrap"
|
||||
| "getRemotePackageBootstrapCommitStatus"
|
||||
>;
|
||||
|
||||
type ClientLike = Pick<
|
||||
@@ -290,6 +284,7 @@ function waitForSharedConnection(
|
||||
export class Ssh2AuthenticatedConnection implements AuthenticatedSshConnection {
|
||||
private usable = true;
|
||||
private disposed = false;
|
||||
private agentBootstrapProbe: AgentBootstrapProbeResult | undefined;
|
||||
|
||||
private constructor(
|
||||
readonly identity: SshPoolConnectionIdentity,
|
||||
@@ -298,6 +293,7 @@ export class Ssh2AuthenticatedConnection implements AuthenticatedSshConnection {
|
||||
) {
|
||||
const disconnected = (): void => {
|
||||
this.usable = false;
|
||||
this.agentBootstrapProbe = undefined;
|
||||
};
|
||||
this.client.on("close", disconnected);
|
||||
this.client.on("end", disconnected);
|
||||
@@ -423,6 +419,11 @@ export class Ssh2AuthenticatedConnection implements AuthenticatedSshConnection {
|
||||
async runAgentBootstrapProbe(
|
||||
signal?: AbortSignal,
|
||||
): Promise<AgentBootstrapProbeResult> {
|
||||
this.assertUsable();
|
||||
signal?.throwIfAborted();
|
||||
if (this.agentBootstrapProbe !== undefined) {
|
||||
return this.agentBootstrapProbe;
|
||||
}
|
||||
const result = await this.runBoundedCommand(
|
||||
AGENT_BOOTSTRAP_PROBE_COMMAND,
|
||||
signal,
|
||||
@@ -430,7 +431,9 @@ export class Ssh2AuthenticatedConnection implements AuthenticatedSshConnection {
|
||||
if (result.exitCode !== 0 || result.stderr.length !== 0) {
|
||||
throw new Error("Agent 启动探针执行失败");
|
||||
}
|
||||
return parseAgentBootstrapProbeOutput(result.stdout);
|
||||
const probe = parseAgentBootstrapProbeOutput(result.stdout);
|
||||
this.agentBootstrapProbe = probe;
|
||||
return probe;
|
||||
}
|
||||
|
||||
probeRemotePackageBootstrap(
|
||||
@@ -471,13 +474,6 @@ export class Ssh2AuthenticatedConnection implements AuthenticatedSshConnection {
|
||||
return this.remotePackageBootstrap().commit(candidate, options);
|
||||
}
|
||||
|
||||
getRemotePackageBootstrapCommitStatus(
|
||||
candidate: SshRemotePackageCandidate,
|
||||
options?: SshRemotePackageBootstrapOptions,
|
||||
): Promise<SshRemotePackageBootstrapCommitResult> {
|
||||
return this.remotePackageBootstrap().commitStatus(candidate, options);
|
||||
}
|
||||
|
||||
cleanupRemotePackageBootstrap(
|
||||
operationId: string,
|
||||
options?: Pick<SshRemotePackageBootstrapOptions, "signal">,
|
||||
@@ -587,6 +583,7 @@ export class Ssh2AuthenticatedConnection implements AuthenticatedSshConnection {
|
||||
}
|
||||
this.disposed = true;
|
||||
this.usable = false;
|
||||
this.agentBootstrapProbe = undefined;
|
||||
this.client.end();
|
||||
this.client.destroy();
|
||||
}
|
||||
@@ -878,11 +875,6 @@ export class SshConnectionPool {
|
||||
),
|
||||
commit: (candidate, options) =>
|
||||
lease.commitRemotePackageBootstrap(candidate, options),
|
||||
commitStatus: (candidate, options) =>
|
||||
bootstrapConnection.getRemotePackageBootstrapCommitStatus(
|
||||
candidate,
|
||||
options,
|
||||
),
|
||||
cleanup: (operationId, options) =>
|
||||
lease.cleanupRemotePackageBootstrap(operationId, options),
|
||||
release: () => lease.release(),
|
||||
@@ -955,13 +947,6 @@ export class SshConnectionPool {
|
||||
assertActive();
|
||||
return connection.commitRemotePackageBootstrap(candidate, options);
|
||||
},
|
||||
getRemotePackageBootstrapCommitStatus: (candidate, options) => {
|
||||
assertActive();
|
||||
return connection.getRemotePackageBootstrapCommitStatus(
|
||||
candidate,
|
||||
options,
|
||||
);
|
||||
},
|
||||
cleanupRemotePackageBootstrap: (operationId, options) => {
|
||||
assertActive();
|
||||
return connection.cleanupRemotePackageBootstrap(operationId, options);
|
||||
|
||||
@@ -230,7 +230,6 @@ describe("fixed SSH remote package bootstrap", () => {
|
||||
await executor.prepare(candidate);
|
||||
await executor.prepareUploaded(candidate);
|
||||
await executor.commit(candidate);
|
||||
await executor.commitStatus(candidate);
|
||||
await executor.cleanup(operationId);
|
||||
|
||||
const fields = requests.map((request) => request.split("\n"));
|
||||
@@ -246,7 +245,7 @@ describe("fixed SSH remote package bootstrap", () => {
|
||||
controlPlaneInstallerSha256,
|
||||
controlPlaneInstaller.toString("base64"),
|
||||
]);
|
||||
for (const index of [4, 5, 6]) {
|
||||
for (const index of [4, 5]) {
|
||||
expect(fields[index]?.slice(5, 8)).toEqual(["0", "0".repeat(64), ""]);
|
||||
}
|
||||
expect(requests.map((request) => request.split("\n")[1])).toEqual([
|
||||
@@ -255,7 +254,6 @@ describe("fixed SSH remote package bootstrap", () => {
|
||||
"prepare",
|
||||
"prepare-uploaded",
|
||||
"commit",
|
||||
"commit-status",
|
||||
"cleanup",
|
||||
]);
|
||||
expect(fields[3]?.slice(8)).toEqual(["0", ""]);
|
||||
@@ -501,6 +499,12 @@ describe("fixed SSH remote package bootstrap", () => {
|
||||
expect(uploadedBlock).toContain('[ ! -x "$bootstrap/agent/node" ]');
|
||||
expect(uploadedBlock).toContain("run_prepare");
|
||||
expect(uploadedBlock).not.toMatch(/\b(?:curl|sha256sum|unzip)\b/u);
|
||||
expect(SSH_REMOTE_PACKAGE_BOOTSTRAP_SCRIPT).toContain(
|
||||
'--archive-sha256-verified true',
|
||||
);
|
||||
expect(SSH_REMOTE_PACKAGE_BOOTSTRAP_SCRIPT).toContain(
|
||||
'actual_sha256=$(sha256sum "$archive"',
|
||||
);
|
||||
});
|
||||
|
||||
it("rejects empty installer terminal files for prepare and status", () => {
|
||||
|
||||
@@ -233,10 +233,6 @@ export interface SshRemotePackageBootstrapExecutor {
|
||||
candidate: SshRemotePackageCandidate,
|
||||
options?: SshRemotePackageBootstrapOptions,
|
||||
): Promise<SshRemotePackageBootstrapCommitResult>;
|
||||
commitStatus(
|
||||
candidate: SshRemotePackageCandidate,
|
||||
options?: SshRemotePackageBootstrapOptions,
|
||||
): Promise<SshRemotePackageBootstrapCommitResult>;
|
||||
cleanup(
|
||||
operationId: string,
|
||||
options?: Pick<SshRemotePackageBootstrapOptions, "signal">,
|
||||
@@ -572,6 +568,7 @@ run_prepare() {
|
||||
"$bootstrap/agent/node" "$bootstrap/package-installer.mjs" \
|
||||
prepare --operation-root "$operation_root" --archive "$archive" \
|
||||
--expected-sha256 "$expected_sha256" \
|
||||
--archive-sha256-verified true \
|
||||
>"$installer_output" 2>/dev/null || true
|
||||
installer_output_size=$(wc -c < "$installer_output" 2>/dev/null) ||
|
||||
stop failed installer-failed
|
||||
@@ -1611,9 +1608,6 @@ export function createSshRemotePackageBootstrapExecutor(
|
||||
}
|
||||
throw new Error("Agent 远程安装提交返回了无效结果");
|
||||
},
|
||||
commitStatus(candidate, options = {}) {
|
||||
return readCommitStatus(candidate, options);
|
||||
},
|
||||
async cleanup(operationId, options = {}) {
|
||||
const verifiedOperationId = validateOperationId(operationId);
|
||||
const result = await runBootstrapCommand(
|
||||
|
||||
Reference in New Issue
Block a user