mirror of
https://github.com/getpaseo/paseo.git
synced 2026-10-14 13:22:37 +00:00
fix(cli): confirm daemon restart when provider probes are slow (#6009)
paseo daemon restart gave each daemon status read one second. Status probes every provider binary, which takes longer than that on machines with several providers installed, so restart kept retrying until its deadline and reported RESTART_NOT_CONFIRMED after the worker had already been replaced. The status read now gets the remaining restart deadline. Connecting to the replacement keeps its one-second bound, so polling a worker that is not up yet stays responsive. Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
This commit is contained in:
@@ -429,6 +429,37 @@ test("empty explicit selectors never select the ambient daemon or create local s
|
||||
}
|
||||
}, 60_000);
|
||||
|
||||
test.skipIf(process.platform === "win32")(
|
||||
"restart confirms the replacement worker when a provider probe is slow",
|
||||
async () => {
|
||||
const f = await fixture();
|
||||
const home = f.homes[0]!;
|
||||
try {
|
||||
await f.configure(home, `127.0.0.1:${await port()}`);
|
||||
const provider = path.join(f.root, "slow-provider");
|
||||
await writeFile(
|
||||
provider,
|
||||
`#!${process.execPath}\nsetTimeout(() => console.log("provider 1.0.0"), 1800);\n`,
|
||||
{ mode: 0o700 },
|
||||
);
|
||||
const configPath = path.join(home, "config.json");
|
||||
const config = JSON.parse(await readFile(configPath, "utf8"));
|
||||
config.agents = {
|
||||
...config.agents,
|
||||
providers: { claude: { command: { mode: "replace", argv: [provider] } } },
|
||||
};
|
||||
await writeFile(configPath, JSON.stringify(config));
|
||||
const launch = await f.ok(["start", "--home", home, "--timeout", "30"]);
|
||||
const restarted = await f.ok(["restart", "--home", home, "--timeout", "30"]);
|
||||
expect(restarted.supervisorPid).toBe(launch.pid);
|
||||
expect(restarted.workerPid).not.toBe(restarted.previousWorkerPid);
|
||||
} finally {
|
||||
await f.close();
|
||||
}
|
||||
},
|
||||
60_000,
|
||||
);
|
||||
|
||||
test("IPv6 publication supports home-selected query and worker restart", async () => {
|
||||
const f = await fixture();
|
||||
const home = f.homes[0]!;
|
||||
|
||||
@@ -73,7 +73,8 @@ export async function runRestartCommand(options: CommandOptions, _command: Comma
|
||||
try {
|
||||
if (replacement.getLastServerInfoMessage()?.serverId !== serverId)
|
||||
throw new Error("Connected peer identity changed");
|
||||
const status = await replacement.getDaemonStatus({ timeout: Math.min(1_000, remaining()) });
|
||||
// Status probes every provider, so it can take seconds on a healthy worker.
|
||||
const status = await replacement.getDaemonStatus({ timeout: remaining() });
|
||||
if (status.pid !== workerPid) {
|
||||
await checkSupervisor();
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user