diff --git a/changelog.md b/changelog.md index 37ecb96..9f97164 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,12 @@ # Changelog +## 2025-08-30 - 5.4.2 - fix(cli/process/logs) +Reset log sequence on process restart to avoid false log gap warnings + +- Track process runId when streaming logs and initialize lastRunId from fetched logs +- When a new runId is detected, reset lastSeq so that subsequent streamed logs are accepted (prevents spurious gap warnings) +- Emit an informational message when a restart/runId change is detected to aid debugging of log streams + ## 2025-08-30 - 5.4.1 - fix(processmonitor) Bump tsbuild devDependency and relax ps-tree callback typing in ProcessMonitor diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index 3001c07..18a8544 100644 --- a/ts/00_commitinfo_data.ts +++ b/ts/00_commitinfo_data.ts @@ -3,6 +3,6 @@ */ export const commitinfo = { name: '@git.zone/tspm', - version: '5.4.1', + version: '5.4.2', description: 'a no fuzz process manager' } diff --git a/ts/cli/commands/process/logs.ts b/ts/cli/commands/process/logs.ts index 8bcc1dd..a13c440 100644 --- a/ts/cli/commands/process/logs.ts +++ b/ts/cli/commands/process/logs.ts @@ -50,6 +50,7 @@ export function registerLogsCommand(smartcli: plugins.smartcli.Smartcli) { console.log('─'.repeat(60)); let lastSeq = 0; + let lastRunId: string | undefined = undefined; for (const log of response.logs) { const timestamp = new Date(log.timestamp).toLocaleTimeString(); const prefix = @@ -60,11 +61,18 @@ export function registerLogsCommand(smartcli: plugins.smartcli.Smartcli) { : '[SYS]'; console.log(`${timestamp} ${prefix} ${log.message}`); if (log.seq !== undefined) lastSeq = Math.max(lastSeq, log.seq); + if ((log as any).runId) lastRunId = (log as any).runId; } await withStreamingLifecycle( async () => { await tspmIpcClient.subscribe(id, (log: any) => { + // Reset sequence if runId changed (e.g., process restarted) + if (log.runId && log.runId !== lastRunId) { + console.log(`[INFO] Detected process restart (runId changed).`); + lastSeq = -1; + lastRunId = log.runId; + } if (log.seq !== undefined && log.seq <= lastSeq) return; if (log.seq !== undefined && log.seq > lastSeq + 1) { console.log(