mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-09-30 12:39:42 +02:00
chore: bump version to 0.1438
This commit is contained in:
@@ -295,6 +295,12 @@ describe('AiIdleChecker', () => {
|
||||
});
|
||||
|
||||
it('should disable after maxConsecutiveErrors', async () => {
|
||||
// With P1-005 exponential backoff, cooldowns increase:
|
||||
// Error 1: 1000ms * 2^0 = 1000ms
|
||||
// Error 2: 1000ms * 2^1 = 2000ms
|
||||
// Error 3: disabled (no cooldown)
|
||||
const cooldowns = [1100, 2100]; // Wait slightly longer than each cooldown
|
||||
|
||||
for (let i = 0; i < 3; i++) {
|
||||
mockedReadFileSync.mockReturnValueOnce('')
|
||||
.mockReturnValueOnce('garbage\n__AICHECK_DONE__');
|
||||
@@ -305,7 +311,7 @@ describe('AiIdleChecker', () => {
|
||||
|
||||
// Clear cooldown for next check (except after the last one which disables)
|
||||
if (i < 2) {
|
||||
await vi.advanceTimersByTimeAsync(1100);
|
||||
await vi.advanceTimersByTimeAsync(cooldowns[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -464,13 +470,19 @@ describe('AiIdleChecker', () => {
|
||||
const handler = vi.fn();
|
||||
checker.on('disabled', handler);
|
||||
|
||||
// With exponential backoff (P1-005), cooldown increases:
|
||||
// Error 1: 1000ms * 2^0 = 1000ms
|
||||
// Error 2: 1000ms * 2^1 = 2000ms
|
||||
// Error 3: disabled (no cooldown needed)
|
||||
const cooldowns = [1100, 2100]; // Wait longer than exponential backoff
|
||||
|
||||
for (let i = 0; i < 3; i++) {
|
||||
mockedReadFileSync.mockReturnValueOnce('')
|
||||
.mockReturnValueOnce('garbage\n__AICHECK_DONE__');
|
||||
const checkPromise = checker.check('output');
|
||||
await vi.advanceTimersByTimeAsync(1000);
|
||||
await checkPromise;
|
||||
if (i < 2) await vi.advanceTimersByTimeAsync(1100);
|
||||
if (i < 2) await vi.advanceTimersByTimeAsync(cooldowns[i]);
|
||||
}
|
||||
|
||||
expect(handler).toHaveBeenCalledWith(expect.stringContaining('consecutive errors'));
|
||||
|
||||
@@ -15,6 +15,8 @@ class MockSession extends EventEmitter {
|
||||
id = 'mock-session-id';
|
||||
workingDir = '/tmp';
|
||||
status = 'idle';
|
||||
pid = 12345; // Mock PID for P1-006 health check
|
||||
isWorking = false; // P0-006 Session.isWorking integration
|
||||
writeBuffer: string[] = [];
|
||||
|
||||
write(data: string): void {
|
||||
|
||||
Reference in New Issue
Block a user