archgraph-argo 0.20.9 → 0.20.10
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.
|
@@ -40,11 +40,13 @@ function appendCrash(entry) {
|
|
|
40
40
|
at: new Date().toISOString(),
|
|
41
41
|
pid: process.pid,
|
|
42
42
|
uptimeMs: Date.now() - startedAt,
|
|
43
|
-
phase: currentPhase,
|
|
43
|
+
phase: entry && entry.phase !== undefined ? entry.phase : currentPhase,
|
|
44
44
|
kind: entry && entry.kind,
|
|
45
45
|
...(entry && entry.origin ? { origin: entry.origin } : {}),
|
|
46
46
|
...(entry && entry.code !== undefined ? { code: entry.code } : {}),
|
|
47
47
|
...(entry && entry.signal !== undefined ? { signal: entry.signal } : {}),
|
|
48
|
+
...(entry && entry.previousPid !== undefined ? { previousPid: entry.previousPid } : {}),
|
|
49
|
+
...(entry && entry.previousAt !== undefined ? { previousAt: entry.previousAt } : {}),
|
|
48
50
|
...(error ? {
|
|
49
51
|
category: error.category,
|
|
50
52
|
message: String(error.message || error).slice(0, 1000),
|
|
@@ -57,10 +59,33 @@ function appendCrash(entry) {
|
|
|
57
59
|
}
|
|
58
60
|
}
|
|
59
61
|
|
|
62
|
+
// A native abort never fires a JS handler, so the ONLY record of the crash-time
|
|
63
|
+
// phase is the synchronously-written phase file. A restart would overwrite it;
|
|
64
|
+
// preserve the previous run's last phase into the (append-only) crash log first.
|
|
65
|
+
function capturePreviousRun() {
|
|
66
|
+
if (!phasePath || !crashLogPath) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
try {
|
|
70
|
+
const previous = JSON.parse(fs.readFileSync(phasePath, 'utf8'));
|
|
71
|
+
if (previous && previous.pid !== undefined && previous.pid !== process.pid) {
|
|
72
|
+
appendCrash({
|
|
73
|
+
kind: 'previous-run-phase',
|
|
74
|
+
phase: previous.phase,
|
|
75
|
+
previousPid: previous.pid,
|
|
76
|
+
previousAt: previous.at,
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
} catch {
|
|
80
|
+
// no previous phase file
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
60
84
|
function installCrashDiagnostics(workspaceRoot) {
|
|
61
85
|
if (workspaceRoot) {
|
|
62
86
|
crashLogPath = tempPath(workspaceRoot, 'mcp-crash.log');
|
|
63
87
|
phasePath = tempPath(workspaceRoot, 'mcp-phase.json');
|
|
88
|
+
capturePreviousRun();
|
|
64
89
|
markPhase(currentPhase);
|
|
65
90
|
}
|
|
66
91
|
if (installed) {
|
package/package.json
CHANGED