Skip to content

Open-source AI teammates in Slack, Teams, Discord, Telegram and Mattermost. Self-host it, with any agent harness and any model.

fix(console): give no reason for a killed server rather than its last log line

Simon Flackbb2e4a61c635
diff --git a/console/apps/switch-console-desktop/src/main/core/managed-switch-server/local-server-service.test.ts b/console/apps/switch-console-desktop/src/main/core/managed-switch-server/local-server-service.test.ts
index 6440af876..bf4ea6ee6 100644
--- a/console/apps/switch-console-desktop/src/main/core/managed-switch-server/local-server-service.test.ts
+++ b/console/apps/switch-console-desktop/src/main/core/managed-switch-server/local-server-service.test.ts
@@ -759,6 +759,17 @@ it('notices a native server whose switch-core has exited, and says why', async (
);
});
+it('gives no reason for a killed server rather than its last ordinary log line', async () => {
+ const service = await bootRunningNative();
+ native.running.mockResolvedValue(false);
+ native.failureLine.mockResolvedValue('INFO [uvicorn.access] "GET /gateway/auth/config" 200');
+ await service.watch();
+
+ expect(service.getStatus().error).toMatch(
+ /^switch-core stopped unexpectedly \(full log: .*switch-core\.log\)$/
+ );
+});
+
it('marks a server that stops answering only after several misses, and back when it answers', async () => {
const service = await bootRunningNative();
watch.health.mockResolvedValue(false);
diff --git a/console/apps/switch-console-desktop/src/main/core/managed-switch-server/local-server-service.ts b/console/apps/switch-console-desktop/src/main/core/managed-switch-server/local-server-service.ts
index b00b8b931..781a80406 100644
--- a/console/apps/switch-console-desktop/src/main/core/managed-switch-server/local-server-service.ts
+++ b/console/apps/switch-console-desktop/src/main/core/managed-switch-server/local-server-service.ts
@@ -458,7 +458,10 @@ export class LocalServerService {
}
if (alive === false) {
- const reason = native ? await nativeCoreFailureLine(layout) : null;
+ // Only a line that says what went wrong: a process that was killed
+ // leaves none, and its last ordinary log line would read as a reason.
+ const line = native ? await nativeCoreFailureLine(layout) : null;
+ const reason = line !== null && /(Error|Exception|FATAL)\b/.test(line) ? line : null;
if (overtaken()) return;
const where = native ? ` (full log: ${path.join(layout.logs, 'switch-core.log')})` : '';
await this.markLost(