Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

fix: pre-landing review fixes

garrytan0a83204dc096
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0bff08e32c..753716cce1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -20,7 +20,7 @@ The upgrade restarted autopilot only through an installed launchd or systemd ser
|---|---|---|
| Autopilot started by this brain's gbrain cron line | `restart_refused` | handed to the cron line and verified back on the new build |
| Autopilot started by your own cron entry or wrapper | `restart_refused`, fix `kill <pid>` | still refuses, naming `gbrain autopilot --install` or `gbrain config set self_upgrade.autopilot_launcher external` (declare it only when the launcher starts autopilot again within 5 minutes); declared, it is handed over like the cron line |
-| doctor `self_upgrade_health` | silent until an upgrade failed | runs the same pre-swap plan read-only: warns while `gbrain upgrade` would refuse, naming each process and its step (autopilot outside gbrain's service, a process from another install), and names a hand-off or a second Bun global install the upgrade replaces itself; a harness MCP server or a running sync does not warn, and a held or failed auto-upgrade is reported first |
+| doctor `self_upgrade_health` | silent until an upgrade failed | runs the same pre-swap plan read-only: warns while `gbrain upgrade` would refuse, naming each process and its step (autopilot outside gbrain's service, a process from another install), and names a hand-off or a second Bun global install the upgrade replaces itself; a harness MCP server does not warn (`--stop-mcp` stops it), and a held or failed auto-upgrade is reported first |
**The daily stable check no longer sticks on a rolled-back release.** A release that was stable before (its `stable-v<version>` record tag exists) or that `stable.json` lists in `known_bad` is skipped and logged, so the newest release gets its soak instead of a refused promotion on every scheduled run (#8792).
diff --git a/docs/guides/upgrades-auto-update.md b/docs/guides/upgrades-auto-update.md
index c19c28db5b..7b870c001e 100644
--- a/docs/guides/upgrades-auto-update.md
+++ b/docs/guides/upgrades-auto-update.md
@@ -332,9 +332,9 @@ warns while the next `gbrain upgrade` would refuse, naming each process and its
step (for an autopilot started outside gbrain's service, `gbrain autopilot
--install`, after retiring the launcher that starts it now, or the declared
hand-off above), and names a hand-off or a second Bun global install the
-upgrade replaces itself. An MCP server a harness started (`--stop-mcp` stops
-it) and a running `gbrain sync` (it finishes) do not make it warn, and a held
-or failed auto-upgrade is reported first.
+upgrade replaces itself. An MCP server a harness started does not make it
+warn (`gbrain upgrade --stop-mcp` stops it), and a held or failed auto-upgrade
+is reported first.
On an always-on host, start with `gbrain autopilot pause --reason "upgrade"`
and wait until `gbrain jobs list --status active --json` returns no jobs, so no
diff --git a/src/commands/doctor/checks/upgrade-health.ts b/src/commands/doctor/checks/upgrade-health.ts
index a330e4fe76..8336c582f1 100644
--- a/src/commands/doctor/checks/upgrade-health.ts
+++ b/src/commands/doctor/checks/upgrade-health.ts
@@ -187,7 +187,7 @@ export function checkSelfUpgradeHealth(restart?: RestartPlan | null): Check {
};
}
- const blockers = (restart?.manual ?? []).filter((m) => m.role !== 'sync' && !(m.role === 'mcp' && m.argv[0] === 'kill'));
+ const blockers = (restart?.manual ?? []).filter((m) => !(m.role === 'mcp' && m.argv[0] === 'kill'));
if (blockers.length) {
const autopilot = blockers.find((m) => m.role === 'autopilot');
return {
diff --git a/test/upgrade-restart-external-autopilot-8776.test.ts b/test/upgrade-restart-external-autopilot-8776.test.ts
index 13d058af84..5df58a869d 100644
--- a/test/upgrade-restart-external-autopilot-8776.test.ts
+++ b/test/upgrade-restart-external-autopilot-8776.test.ts
@@ -145,13 +145,17 @@ describe('doctor self_upgrade_health with the restart plan', () => {
expect(checkSelfUpgradeHealth(planRestart([], ctx({ expected: PENDING_BUILD }))).message).toBe(plain);
});
});
-test('an MCP server a harness started and a running sync do not warn: --stop-mcp and the sync finishing clear them', async () => {
+ test('an MCP server a harness started does not warn (--stop-mcp stops it); a running sync still does, since a sync --watch never finishes', async () => {
await withEnv({ GBRAIN_SELF_UPGRADE_MODE: 'auto' }, () => {
const mcp: HostProcess = { pid: 40, ppid: null, role: 'mcp', version: OLD, started_ms: 1_000, ancestors: [99], args: ['serve'] };
- const sync: HostProcess = { pid: 41, ppid: null, role: 'sync', version: OLD, started_ms: 1_000, ancestors: [98], args: ['sync'] };
- const plan = planRestart([mcp, sync], ctx({ expected: PENDING_BUILD }));
- expect(plan.manual.map(m => m.role)).toEqual(['mcp', 'sync']);
- expect(checkSelfUpgradeHealth(plan).status).toBe('ok');
+ const sync: HostProcess = { pid: 41, ppid: null, role: 'sync', version: OLD, started_ms: 1_000, ancestors: [98], args: ['sync', '--watch'] };
+ const mcpOnly = planRestart([mcp], ctx({ expected: PENDING_BUILD }));
+ expect(mcpOnly.manual.map(m => m.role)).toEqual(['mcp']);
+ expect(checkSelfUpgradeHealth(mcpOnly).status).toBe('ok');
+ const check = checkSelfUpgradeHealth(planRestart([mcp, sync], ctx({ expected: PENDING_BUILD })));
+ expect(check.status).toBe('warn');
+ expect(check.message).toContain('pid 41');
+ expect(check.message).not.toContain('pid 40');
});
});