fix(coding): serialize agent server sleep restart
This commit is contained in:
@@ -133,6 +133,30 @@ describe('Pi Agent Server real process', () => {
|
||||
}
|
||||
}, 10_000);
|
||||
|
||||
it('restarts when start races with a graceful background stop', async () => {
|
||||
const root = await mkdtemp(path.join(tmpdir(), 'makelore-pi-agent-server-restart-'));
|
||||
roots.push(root);
|
||||
const layout = await materializePackagedAgentServerLayout(root);
|
||||
const server = new PiAgentServerProcess({
|
||||
executablePath: electronExecutable,
|
||||
...layout,
|
||||
});
|
||||
|
||||
try {
|
||||
await server.start();
|
||||
const firstProcessId = server.processId;
|
||||
expect(firstProcessId).toBeTypeOf('number');
|
||||
|
||||
const stopping = server.stop();
|
||||
const restarting = server.start();
|
||||
await Promise.all([stopping, restarting]);
|
||||
expect(server.processId).toBeTypeOf('number');
|
||||
expect(server.processId).not.toBe(firstProcessId);
|
||||
} finally {
|
||||
await server.stop();
|
||||
}
|
||||
}, 20_000);
|
||||
|
||||
it('hosts isolated Conversation threads in one long-lived process', async () => {
|
||||
const root = await mkdtemp(path.join(tmpdir(), 'makelore-pi-agent-server-'));
|
||||
roots.push(root);
|
||||
|
||||
Reference in New Issue
Block a user