mirror of
https://github.com/davidkaya/aryx.git
synced 2026-08-07 04:08:45 +02:00
fix: scope sidecar exit handling to the active process
Wait for an intentional sidecar dispose to exit before refreshing capabilities, and ignore exit events from stale sidecar processes. This prevents a refresh from killing the old process and then having that old exit reject the new capabilities request with an unexpected sidecar exit error. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
import { describe, expect, test } from 'bun:test';
|
||||
|
||||
import { shouldRestartSidecarOnCapabilityRefresh } from '@main/sidecar/sidecarRefresh';
|
||||
import {
|
||||
shouldHandleSidecarExit,
|
||||
shouldRestartSidecarOnCapabilityRefresh,
|
||||
} from '@main/sidecar/sidecarRefresh';
|
||||
|
||||
describe('shouldRestartSidecarOnCapabilityRefresh', () => {
|
||||
test('restarts the sidecar when no run-turn is active', () => {
|
||||
@@ -11,3 +14,18 @@ describe('shouldRestartSidecarOnCapabilityRefresh', () => {
|
||||
expect(shouldRestartSidecarOnCapabilityRefresh(true)).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('shouldHandleSidecarExit', () => {
|
||||
test('handles exit events from the currently active sidecar process', () => {
|
||||
expect(shouldHandleSidecarExit(1234, 1234)).toBe(true);
|
||||
});
|
||||
|
||||
test('ignores exit events from a stale sidecar process', () => {
|
||||
expect(shouldHandleSidecarExit(1234, 5678)).toBe(false);
|
||||
});
|
||||
|
||||
test('ignores exit events when either process id is missing', () => {
|
||||
expect(shouldHandleSidecarExit(undefined, 5678)).toBe(false);
|
||||
expect(shouldHandleSidecarExit(1234, undefined)).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user