mirror of
https://github.com/garrytan/gstack.git
synced 2026-11-05 00:03:15 +01:00
fix(browse): keep agentStatus's zombie check before the generation return (terminal-agent-watchdog source pin)
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
This commit is contained in:
1 parent
caa404d166
commit
20d7707314
1 file changed
+4
-4
@@ -368,9 +368,8 @@ function agentStatus(record: AgentRecord, ownerPid?: number): 'owned' | 'gone' |
|
||||
if (ownerPid !== undefined && (record.ownerPid !== ownerPid || record.ownerStartTime !== readAgentStartTime(ownerPid))) return 'unknown';
|
||||
const actual = agentProcessInfo(record.pid);
|
||||
if (!actual.startTime) return isAgentRecordLive(record) ? 'unknown' : 'gone';
|
||||
const ownsGeneration = actual.commandLine.split(/\s+/).some(arg => arg.replace(/^['"]|['"]$/g, '') === `--agent-gen=${record.gen}`);
|
||||
if (actual.startTime !== record.startTime && process.platform === 'win32' && !actual.commandLine) return 'unknown';
|
||||
if (actual.startTime !== record.startTime && !(process.platform === 'win32' && ownsGeneration)) return 'gone';
|
||||
if (actual.startTime !== record.startTime && process.platform !== 'win32') return 'gone';
|
||||
if (actual.startTime !== record.startTime && !actual.commandLine) return 'unknown';
|
||||
try {
|
||||
let state: string | undefined;
|
||||
if (process.platform === 'linux') {
|
||||
@@ -382,7 +381,8 @@ function agentStatus(record: AgentRecord, ownerPid?: number): 'owned' | 'gone' |
|
||||
if (state === 'Z') return 'gone';
|
||||
} catch {}
|
||||
if (!isAgentRecordLive(record)) return 'gone';
|
||||
return ownsGeneration ? 'owned' : 'unknown';
|
||||
return actual.commandLine.split(/\s+/).some(arg => arg.replace(/^['"]|['"]$/g, '') === `--agent-gen=${record.gen}`)
|
||||
? 'owned' : actual.startTime === record.startTime ? 'unknown' : 'gone';
|
||||
}
|
||||
|
||||
export function isOurAgent(record: AgentRecord, ownerPid?: number): boolean {
|
||||
|
||||
Reference in new issue
Block a user