Skip to content

A self-improving RLM agent for coding workflows and long-running autonomous tasks.

Rust

fix(coding-agent): make blocked daemon update restart warnings actionable (#2515)

minh hoang18a56bf35570
diff --git a/packages/coding-agent/.changes/update-restart-blocked-session-hint.md b/packages/coding-agent/.changes/update-restart-blocked-session-hint.md
new file mode 100644
index 0000000000..a115082a14
--- /dev/null
+++ b/packages/coding-agent/.changes/update-restart-blocked-session-hint.md
@@ -0,0 +1 @@
+- Fixed unclear blocked-update warnings: the refusal now names the blocking session, and the report now says to run `prime-agent shutdown`, then run `prime-agent` to restart and apply the update.
diff --git a/packages/coding-agent/src/cli/daemon-update-restart.ts b/packages/coding-agent/src/cli/daemon-update-restart.ts
index 8172381767..d90d89a2e0 100644
--- a/packages/coding-agent/src/cli/daemon-update-restart.ts
+++ b/packages/coding-agent/src/cli/daemon-update-restart.ts
@@ -122,6 +122,9 @@ export function buildDaemonUpdateRestartReport(status: DaemonUpdateRestartStatus
const report: DaemonUpdateRestartReport = { info: [], warnings: [] };
if (status.phase === "failed") {
report.warnings.push(`Updated, but could not restart the daemon (${status.message ?? "unknown error"}).`);
+ report.warnings.push(
+ "The daemon still runs the previous version; run `prime-agent shutdown`, then run `prime-agent` to restart and apply the update.",
+ );
}
if (status.phase !== "complete" && status.phase !== "failed") {
return report;
diff --git a/packages/coding-agent/src/modes/daemon/daemon-supervisor.ts b/packages/coding-agent/src/modes/daemon/daemon-supervisor.ts
index ac0bd92ed9..f979eaa0df 100644
--- a/packages/coding-agent/src/modes/daemon/daemon-supervisor.ts
+++ b/packages/coding-agent/src/modes/daemon/daemon-supervisor.ts
@@ -6505,8 +6505,9 @@ export class DaemonSupervisor {
this.isWorkerStopping(worker) || worker.descriptor.lifecycle !== "ready" || worker.client === undefined,
);
if (unavailable) {
+ const session = unavailable.descriptor.sessionFile ?? unavailable.descriptor.rootActiveSessionId;
throw new Error(
- `Cannot prepare update restart while resident worker ${unavailable.descriptor.workerId} is ${this.effectiveWorkerState(unavailable)}${unavailable.client ? "" : " and disconnected"}`,
+ `Cannot prepare update restart while resident worker ${unavailable.descriptor.workerId} is ${this.effectiveWorkerState(unavailable)}${unavailable.client ? "" : " and disconnected"} (session ${session})`,
);
}
const workers = residents as Array<ResidentWorker & { client: DaemonWorkerClient }>;
diff --git a/packages/coding-agent/test/daemon-supervisor-monitor.test.ts b/packages/coding-agent/test/daemon-supervisor-monitor.test.ts
index a368442214..e2b2ee5816 100644
--- a/packages/coding-agent/test/daemon-supervisor-monitor.test.ts
+++ b/packages/coding-agent/test/daemon-supervisor-monitor.test.ts
@@ -4570,7 +4570,7 @@ describe("daemon worker supervisor monitoring", () => {
it("rejects update prepare when a resident worker is recovering or disconnected", async () => {
const requestWorker = vi.fn();
const worker = {
- descriptor: { workerId: "resident-1", lifecycle: "recovering" },
+ descriptor: { workerId: "resident-1", rootActiveSessionId: "blocked-root", lifecycle: "recovering" },
client: undefined,
};
const supervisor = Object.assign(Object.create(DaemonSupervisor.prototype), {
@@ -4579,7 +4579,9 @@ describe("daemon worker supervisor monitoring", () => {
prepareUpdateRestartFenced(): Promise<unknown>;
};
- await expect(supervisor.prepareUpdateRestartFenced()).rejects.toThrow(/resident-1.*recovering.*disconnected/);
+ await expect(supervisor.prepareUpdateRestartFenced()).rejects.toThrow(
+ /resident-1.*recovering.*disconnected.*blocked-root/,
+ );
expect(requestWorker).not.toHaveBeenCalled();
});
diff --git a/packages/coding-agent/test/interactive-update-relaunch.test.ts b/packages/coding-agent/test/interactive-update-relaunch.test.ts
index fea01e8327..961a2034c7 100644
--- a/packages/coding-agent/test/interactive-update-relaunch.test.ts
+++ b/packages/coding-agent/test/interactive-update-relaunch.test.ts
@@ -282,6 +282,7 @@ describe("buildDaemonUpdateRestartReport", () => {
expect(report.info).toEqual(["Restored 2 daemon sessions", "Resumed 1 interrupted session"]);
expect(report.warnings).toEqual([
"Updated, but could not restart the daemon (could not stop predecessor).",
+ "The daemon still runs the previous version; run `prime-agent shutdown`, then run `prime-agent` to restart and apply the update.",
"1 daemon session could not be restored.",
"Could not restore /tmp/failed.jsonl: create failed",
]);