Skip to content

armgit / alook

Public Imported from GitHub
0

Multi-Agent Collaboration for Team and Friends

fix update hang (#44)

Jinjia45dd18184d9f
diff --git a/src/cli/daemon/daemon.test.ts b/src/cli/daemon/daemon.test.ts
index ae6dfb8f2..f11fe5daa 100644
--- a/src/cli/daemon/daemon.test.ts
+++ b/src/cli/daemon/daemon.test.ts
@@ -1375,11 +1375,11 @@ describe("daemon restart via update", () => {
expect(clearUpdateMarker).toHaveBeenCalled();
});
- it("does not clear update marker when versions differ", async () => {
+ it("clears stale update marker on startup when current version does not match marker", async () => {
vi.clearAllMocks();
mockProcessExit.mockImplementation((() => {}) as any);
- vi.mocked(readUpdateMarker).mockReturnValue("0.0.9"); // differs from cliVersion 0.1.0
+ vi.mocked(readUpdateMarker).mockReturnValue("0.0.9"); // stale — differs from cliVersion 0.1.0
vi.mocked(loadCLIConfigForProfile).mockReturnValue({
server_url: "",
@@ -1390,7 +1390,7 @@ describe("daemon restart via update", () => {
await startDaemon();
- expect(clearUpdateMarker).not.toHaveBeenCalled();
+ expect(clearUpdateMarker).toHaveBeenCalled();
});
});
diff --git a/src/cli/daemon/daemon.ts b/src/cli/daemon/daemon.ts
index 7d8811c6b..76d213ea6 100644
--- a/src/cli/daemon/daemon.ts
+++ b/src/cli/daemon/daemon.ts
@@ -225,9 +225,13 @@ export async function startDaemon(
if (serverUrl) config.serverURL = serverUrl;
const marker = readUpdateMarker(profile);
- if (marker && marker === config.cliVersion) {
+ if (marker) {
clearUpdateMarker(profile);
- log.info(`Cleared update marker — now running v${config.cliVersion}`);
+ if (marker === config.cliVersion) {
+ log.info(`Cleared update marker — now running v${config.cliVersion}`);
+ } else {
+ log.info(`Cleared stale update marker (was v${marker}, running v${config.cliVersion}) — update will be retried`);
+ }
}
const cliConfig = loadCLIConfigForProfile(profile);