Recover Codex compaction failures in paired owner flow

This commit is contained in:
ejclaw
2026-04-15 03:11:14 +09:00
parent c76902a84b
commit 2ab3bddc0e
20 changed files with 449 additions and 18 deletions

View File

@@ -1,7 +1,9 @@
import { describe, expect, it } from 'vitest';
import {
shouldResetCodexSessionOnAgentFailure,
shouldResetSessionOnAgentFailure,
shouldRetryFreshCodexSessionOnAgentFailure,
shouldRetryFreshSessionOnAgentFailure,
} from './session-recovery.js';
@@ -99,3 +101,36 @@ describe('shouldRetryFreshSessionOnAgentFailure', () => {
).toBe(false);
});
});
describe('shouldResetCodexSessionOnAgentFailure', () => {
it('matches remote compact task failures that mention prompt_cache_retention', () => {
expect(
shouldResetCodexSessionOnAgentFailure({
result: null,
error:
"Error running remote compact task: Unknown parameter: 'prompt_cache_retention'",
}),
).toBe(true);
});
it('does not match unrelated Codex failures', () => {
expect(
shouldResetCodexSessionOnAgentFailure({
result: null,
error: 'Codex process exited with code 1',
}),
).toBe(false);
});
});
describe('shouldRetryFreshCodexSessionOnAgentFailure', () => {
it('retries the same remote compact task failure with a fresh session', () => {
expect(
shouldRetryFreshCodexSessionOnAgentFailure({
result: null,
error:
"Error running remote compact task: Unknown parameter: 'prompt_cache_retention'",
}),
).toBe(true);
});
});