Solution for long term memory for agent coding CLIs and to facilitate handoff between different agent vendors
Rust
test: cover unchanged Codex recovery token
Gabriel Scharb6bd7775db8a9
diff --git a/crates/ai-memory-llm/src/codex.rs b/crates/ai-memory-llm/src/codex.rsindex a608e0d7..80d44386 100644--- a/crates/ai-memory-llm/src/codex.rs+++ b/crates/ai-memory-llm/src/codex.rs@@ -835,6 +835,47 @@ mod tests {assert!(error.contains("timed out"));}+ #[tokio::test]+ async fn provider_rejects_recovery_that_does_not_replace_the_access_token() {+ let server = MockServer::start().await;+ let dir = tempfile::tempdir().unwrap();+ let auth_path = dir.path().join("auth.json");+ write_auth(&auth_path, "old-token", "account-secret");+ fs::write(dir.path().join("fake-mode"), "no-change").unwrap();+ Mock::given(method("POST"))+ .and(request_path("/responses"))+ .respond_with(UnauthorizedUntilRotated)+ .expect(1)+ .mount(&server)+ .await;+ let provider = CodexProvider::new(+ CodexAuth {+ auth_file: auth_path.clone(),+ executable: compile_fake_codex(dir.path()),+ },+ "gpt-5.6-luna",+ )+ .unwrap()+ .with_responses_url(format!("{}/responses", server.uri()));++ let error = provider+ .complete(ChatRequest::user_prompt("test"))+ .await+ .unwrap_err()+ .to_string();++ assert!(error.contains("without replacing the access token"));+ assert!(error.contains("codex login status"));+ assert!(!error.contains("old-token"));+ assert_eq!(+ read_credentials(&auth_path)+ .unwrap()+ .access_token+ .expose_secret(),+ "old-token"+ );+ }+#[tokio::test]async fn concurrent_unauthorized_calls_share_one_recovery() {let server = MockServer::start().await;diff --git a/docs/testing/codex-provider.tdd.md b/docs/testing/codex-provider.tdd.mdindex 04f0225c..ed377208 100644--- a/docs/testing/codex-provider.tdd.md+++ b/docs/testing/codex-provider.tdd.md@@ -30,7 +30,7 @@ cargo test -p ai-memory-cli codex --no-default-featuresObserved results:-- Codex unit/recovery suite: 9 passed.+- Codex unit/recovery suite: 10 passed.- Existing openai-oauth regression suite: 18 passed.- Codex-related CLI/config tests: 17 passed.@@ -52,6 +52,10 @@ output, reload-before-retry, and the one-retry ceiling.passed until two unrelated `ai-memory-core::routing_skills` assertions hitCRLF bytes in the existing Windows checkout. Neither the embedded skillassets nor their tests are changed by this branch.+- The complementary run excluding `ai-memory-core`, followed by all other+ `ai-memory-core` tests with only those two checkout-sensitive assertions+ skipped, passed. The standalone companion importer suite also passed (19+ tests).- `cargo llvm-cov` was unavailable locally, so the 80% target was not measured;the new parser, HTTP/retry path, structured output, protocol limits, nativeprocess recovery, failure cleanup, and concurrent recovery are directly