gitdone-agent 0.6.14 → 0.6.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +16 -3
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -27,7 +27,7 @@ import { randomUUID } from 'node:crypto'
|
|
|
27
27
|
// Reported to the server on every sync so the web UI can flag outdated agents.
|
|
28
28
|
// Keep in lockstep with packages/agent/package.json "version" AND
|
|
29
29
|
// src/lib/agentVersion.ts LATEST_AGENT_VERSION.
|
|
30
|
-
const AGENT_VERSION = '0.6.
|
|
30
|
+
const AGENT_VERSION = '0.6.15'
|
|
31
31
|
|
|
32
32
|
const AGENT_DIR = join(homedir(), '.gitdone-agent')
|
|
33
33
|
const CONFIG_PATH = join(AGENT_DIR, 'config.json')
|
|
@@ -236,6 +236,14 @@ function installStartup() {
|
|
|
236
236
|
// node-level failures (corrupt file, bad path) finally leave a trace. If the
|
|
237
237
|
// node path recorded at install time vanished (node upgraded/moved), fall
|
|
238
238
|
// back to whatever `node` is on PATH.
|
|
239
|
+
//
|
|
240
|
+
// Restart forever on normal crashes, but STOP on process-START failures
|
|
241
|
+
// (0xc0000142 STATUS_DLL_INIT_FAILED, 0xc0000135 missing DLL): those mean the
|
|
242
|
+
// login session itself is broken (e.g. after a hardware crash), every attempt
|
|
243
|
+
// pops a blocking "Application Error" dialog, and a retry can never succeed —
|
|
244
|
+
// the loop turned into an endless dialog storm (gd-405). Same for the
|
|
245
|
+
// ping-as-sleep: if even ping can't start, bail instead of spinning with no
|
|
246
|
+
// delay at all. A Windows re-login restarts the supervisor cleanly.
|
|
239
247
|
const crashLog = join(AGENT_DIR, 'agent-crash.log')
|
|
240
248
|
const cmd = [
|
|
241
249
|
'@echo off',
|
|
@@ -244,9 +252,14 @@ function installStartup() {
|
|
|
244
252
|
'if not exist "%NODE%" set "NODE=node"',
|
|
245
253
|
':loop',
|
|
246
254
|
`"%NODE%" "${agentPath}" 2>> "${crashLog}"`,
|
|
247
|
-
|
|
248
|
-
|
|
255
|
+
'set CODE=%errorlevel%',
|
|
256
|
+
`echo [%date% %time%] agent exited (code %CODE%) - restart in 10s >> "${crashLog}"`,
|
|
257
|
+
'if "%CODE%"=="-1073741502" goto dead',
|
|
258
|
+
'if "%CODE%"=="-1073741515" goto dead',
|
|
259
|
+
'ping -n 11 127.0.0.1 >nul 2>nul || goto dead',
|
|
249
260
|
'goto loop',
|
|
261
|
+
':dead',
|
|
262
|
+
`echo [%date% %time%] node cannot start (code %CODE%) - supervisor giving up until next login >> "${crashLog}"`,
|
|
250
263
|
].join('\r\n')
|
|
251
264
|
const cmdPath = join(AGENT_DIR, 'run-agent.cmd')
|
|
252
265
|
writeFileSync(cmdPath, cmd, 'utf8')
|