Skip to content

Commit 05de1e0

Browse files
VickyXAI1bcMaxclaude
authored
desktop: delete AgentStatus.restartRequired — nothing could ever read it (#379)
Five adapters wrote it, five demo entries mirrored it, and not one line in the app read it. It was write-only state whose only effect was to look consumable. It could not be consumed. Codex and OpenClaw set it to a constant function of `configured`, so it was permanently true from the moment the agent connected — it encoded a category ("this kind of agent needs a restart when you change it"), which `activation` already encodes and `activationLabel` already renders as "Restart gateway/app after changes". Reading it as a state pins those two to a permanent "Restart pending", which is what a reviewer suggestion on #367 would have shipped. The honest reason no adapter can fill it in is that nothing observes whether an agent process has picked a config change up. Desktop knows when it wrote the file; it does not know when the agent last started, and for a CLI invoked per-session there is no such moment to compare against. A field that cannot be computed should not exist, so `types.ts` now says that where the field used to be. `WalletMutationResult.restartRequired` and `PaymentChainSwitchResult.restartRequired` are untouched. There it is a real state: Desktop has just written the config itself and knows whether it also restarted the thing that reads it. `manager.test.ts` pins that behaviour and still passes. Closes #377. Verified: tsc clean, 46 tests pass, vite build and esbuild electron build clean. Claude-Session: https://claude.ai/code/session_015mUab3xrLHNpYqVHJLgJHL Co-authored-by: 1bcMax <viewitter@gmail.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent c56ea3b commit 05de1e0

8 files changed

Lines changed: 7 additions & 13 deletions

File tree

apps/desktop/electron/adapters/codex.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ export class CodexAdapter implements AgentAdapter {
2828
installed: Boolean(await findCommand(context, "codex")),
2929
configured,
3030
activation: this.activation,
31-
restartRequired: configured,
3231
details: configured
3332
? ["Restart Codex CLI or Codex Desktop after changing this connection."]
3433
: [],

apps/desktop/electron/adapters/dsh.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ export class DshAdapter implements AgentAdapter {
3131
installed,
3232
configured,
3333
activation: this.activation,
34-
restartRequired: false,
3534
details: ["DSH settings are hot-reloaded.", "DSH is currently a developer preview."],
3635
});
3736
}

apps/desktop/electron/adapters/hermes.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ export class HermesAdapter implements AgentAdapter {
3434
installed: Boolean(hermes),
3535
configured: hasHermesConfig(config),
3636
activation: this.activation,
37-
restartRequired: false,
3837
details: hermes
3938
? hasHermesConfig(config)
4039
? ["New Hermes chats use ClawRouter; an open session switches with /model."]

apps/desktop/electron/adapters/openclaw.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ export class OpenClawAdapter implements AgentAdapter {
3030
installed,
3131
configured: hasOpenClawConfig(config),
3232
activation: this.activation,
33-
restartRequired: hasOpenClawConfig(config),
3433
details: installed
3534
? hasOpenClawConfig(config)
3635
? ["Restart the OpenClaw gateway after changing this connection."]

apps/desktop/electron/adapters/pi.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ export class PiAdapter implements AgentAdapter {
2929
installed: Boolean(await findCommand(context, "pi")),
3030
configured,
3131
activation: this.activation,
32-
restartRequired: false,
3332
details: configured
3433
? [
3534
"Open /model (or press Ctrl+L) in Pi to use or refresh ClawRouter models; no restart is needed.",

apps/desktop/electron/adapters/shared.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ export async function statusShape(input: {
1515
installed: boolean;
1616
configured: boolean;
1717
activation: ActivationMode;
18-
restartRequired?: boolean;
1918
details?: string[];
2019
}): Promise<AgentStatus> {
2120
const proxyReachable = await proxyHealth(input.context);
@@ -31,7 +30,6 @@ export async function statusShape(input: {
3130
proxyReachable,
3231
health,
3332
activation: input.activation,
34-
restartRequired: input.restartRequired ?? false,
3533
removalMode: "unavailable",
3634
details: input.details ?? [],
3735
};

apps/desktop/electron/core/types.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,14 @@ export type AgentStatus = {
1414
configured: boolean;
1515
proxyReachable: boolean;
1616
health: AgentHealth;
17+
// No `restartRequired` here on purpose. Nothing can observe whether an agent
18+
// process has picked a config change up, so a status field claiming it would be
19+
// a guess — and the two adapters that had one set it to a constant function of
20+
// `configured`, making it permanently true. `activation` carries the category
21+
// ("this kind of agent needs a restart when you change it"), which is the only
22+
// part that is knowable. WalletMutationResult and PaymentChainSwitchResult below
23+
// DO carry it, and there it is real: Desktop has just written the config itself.
1724
activation: ActivationMode;
18-
restartRequired: boolean;
1925
removalMode: "restore" | "disconnect" | "unavailable";
2026
details: string[];
2127
};

apps/desktop/src/api.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ const demoAgents: AgentStatus[] = [
3838
proxyReachable: true,
3939
health: "ready",
4040
activation: "restart-gateway",
41-
restartRequired: false,
4241
removalMode: "disconnect",
4342
details: [],
4443
},
@@ -51,7 +50,6 @@ const demoAgents: AgentStatus[] = [
5150
proxyReachable: true,
5251
health: "ready",
5352
activation: "restart-agent",
54-
restartRequired: true,
5553
removalMode: "restore",
5654
details: ["Restart Codex Desktop after changing the active provider."],
5755
},
@@ -64,7 +62,6 @@ const demoAgents: AgentStatus[] = [
6462
proxyReachable: true,
6563
health: "needs-attention",
6664
activation: "immediate",
67-
restartRequired: false,
6865
removalMode: "disconnect",
6966
details: [],
7067
},
@@ -77,7 +74,6 @@ const demoAgents: AgentStatus[] = [
7774
proxyReachable: true,
7875
health: "not-installed",
7976
activation: "immediate",
80-
restartRequired: false,
8177
removalMode: "unavailable",
8278
details: ["DSH settings are hot-reloaded.", "DSH is currently a developer preview."],
8379
},
@@ -90,7 +86,6 @@ const demoAgents: AgentStatus[] = [
9086
proxyReachable: true,
9187
health: "needs-attention",
9288
activation: "immediate",
93-
restartRequired: false,
9489
removalMode: "unavailable",
9590
details: [],
9691
},

0 commit comments

Comments
 (0)