atagen

malice

public
Star0
Watch0

Commit ad8b0072720d

tarball

atagen <boss@atagen.co>2026-10-27 04:10 UTC

2 files changed+4-2
web: log engine panics instead of restarting silently

A panic closes the device worker and every tab reconnects a second later, but the message was dropped on both sides, so a crash loop looked like a healthy engine that had stopped receiving.
Modified file: web/src/lib/transport-worker.ts+3 additions−2 deletions
@@ -101,7 +101,7 @@ class WorkerClient {
101101 }
102102 return;
103103 }
104- if (msg['kind'] === 'fatal') this.handleFatal();
104+ if (msg['kind'] === 'fatal') this.handleFatal(String(msg['message'] ?? ''));
105105 else if (msg['kind'] === 'superseded') this.handleSuperseded();
106106 else if (msg['kind'] === 'recovered') engineRecovered.update((count) => count + 1);
107107 }
@@ -119,7 +119,8 @@ class WorkerClient {
119119 }
120120
121121 /** The worker crashed and closed every port; every tab respawns it after a beat. */
122- private handleFatal(): void {
122+ private handleFatal(message: string): void {
123+ console.error('The engine panicked and is restarting', message);
123124 this.port = null;
124125 for (const pending of this.pending.values()) {
125126 pending.reject(new ApiError(502, 'the worker stopped; reconnecting'));
Modified file: web/src/worker/worker.ts+1 additions
@@ -106,6 +106,7 @@ function onHostEvent(account: string, eventJson: string): void {
106106 }
107107
108108 function onHostFatal(message: string): void {
109+ console.error('engine panicked', message);
109110 for (const port of ports) postTo(port, { kind: 'fatal', message });
110111 close();
111112 }