Skip to content

Solution for long term memory for agent coding CLIs and to facilitate handoff between different agent vendors

Rust

test: cover non-zero Codex recovery exit

Gabriel Scharb11334763690e
diff --git a/crates/ai-memory-llm/tests/support/fake_codex.rs b/crates/ai-memory-llm/tests/support/fake_codex.rs
index 49ed6878..ef8d42a7 100644
--- a/crates/ai-memory-llm/tests/support/fake_codex.rs
+++ b/crates/ai-memory-llm/tests/support/fake_codex.rs
@@ -24,6 +24,9 @@ fn main() {
if mode.trim() == "exit" {
return;
}
+ if mode.trim() == "exit-nonzero" {
+ std::process::exit(17);
+ }
if mode.trim() == "stderr" {
io::stderr().write_all(&vec![b'x'; 70 * 1024]).unwrap();
io::stderr().flush().unwrap();
diff --git a/docs/testing/codex-provider.tdd.md b/docs/testing/codex-provider.tdd.md
index 7f06b794..391f6a85 100644
--- a/docs/testing/codex-provider.tdd.md
+++ b/docs/testing/codex-provider.tdd.md
@@ -39,9 +39,21 @@ Observed results:
The recovery suite compiles a fake Codex executable from Rust source. It runs
without network access or a real home directory and covers handshake messages,
interleaved notifications, wrong IDs, invalid and oversized output, stderr
-limits, premature process exit, timeout, process cleanup, and auth-file
-rotation. HTTP mocks cover account headers, model, reasoning, SSE, structured
-output, reload-before-retry, and the one-retry ceiling.
+limits, premature process exit (both zero and non-zero status), timeout,
+process cleanup, and auth-file rotation. HTTP mocks cover account headers,
+model, reasoning, SSE, structured output, reload-before-retry, and the
+one-retry ceiling.
+
+### Non-zero recovery exit follow-up
+
+- RED commit: `76cfc1b6 test: reproduce non-zero Codex recovery exit`.
+- RED command: `cargo test -p ai-memory-llm
+ rust_fake_codex_exercises_recovery_and_defensive_failures -- --nocapture`.
+- RED result: the new `exit-nonzero` mode timed out because the fake executable
+ did not yet implement it.
+- GREEN implementation: the fake executable now exits with status 17, proving
+ that an app-server failure before a JSON-RPC reply is rejected as a
+ sanitized premature-exit error.
## Local gates and smoke