mirror of
https://github.com/garrytan/gstack.git
synced 2026-05-02 03:35:09 +02:00
fix: pair-agent server dies 15s after CLI exits
The server monitors BROWSE_PARENT_PID and self-terminates when the parent exits. For pair-agent, the connect subprocess is the parent, so the server dies 15s after connect finishes. Disable parent-PID monitoring for pair-agent sessions so the server outlives the CLI. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
+8
-1
@@ -839,6 +839,11 @@ Refs: After 'snapshot', use @e1, @e2... as selectors:
|
||||
BROWSE_PORT: '34567',
|
||||
BROWSE_SIDEBAR_CHAT: '1',
|
||||
};
|
||||
// If parent explicitly set BROWSE_PARENT_PID=0 (pair-agent disabling
|
||||
// self-termination), pass it through so startServer doesn't override it.
|
||||
if (process.env.BROWSE_PARENT_PID === '0') {
|
||||
serverEnv.BROWSE_PARENT_PID = '0';
|
||||
}
|
||||
const newState = await startServer(serverEnv);
|
||||
|
||||
// Print connected status
|
||||
@@ -975,7 +980,9 @@ Refs: After 'snapshot', use @e1, @e2... as selectors:
|
||||
const connectProc = Bun.spawn([browseBin, 'connect'], {
|
||||
cwd: process.cwd(),
|
||||
stdio: ['ignore', 'inherit', 'inherit'],
|
||||
env: process.env,
|
||||
// Disable parent-PID monitoring: pair-agent needs the server to outlive
|
||||
// the connect subprocess. Setting to 0 tells the server not to self-terminate.
|
||||
env: { ...process.env, BROWSE_PARENT_PID: '0' },
|
||||
});
|
||||
await connectProc.exited;
|
||||
// Re-read state after headed mode switch
|
||||
|
||||
Reference in New Issue
Block a user