Solution for long term memory for agent coding CLIs and to facilitate handoff between different agent vendors
Rust
fix(llm): omit temperature for gpt-6 models
Éverton Toffanettof58e837426d2
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 188df552..a50c4b8d 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -8,6 +8,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0## [Unreleased]### Fixed+- The `codex`, `openai-oauth` and `copilot` providers no longer send+ `temperature` to `gpt-6-*` models. Codex answered these requests with+ `400 Unsupported parameter: temperature`, so any provider or fallback+ configured with `gpt-6-luna`, `gpt-6-sol` or `gpt-6-astra` failed on every+ call. GPT-6 models now get the same treatment as `gpt-5*` and `o*`. (#851)- `companions/ai-memory-macos/build.sh` no longer fails on machines whoseactive developer directory is Command Line Tools only: SwiftUI `@State`needs the `SwiftUIMacros` plugin shipped with full Xcode, so the scriptdiff --git a/crates/ai-memory-llm/src/copilot.rs b/crates/ai-memory-llm/src/copilot.rsindex fee48854..839ad5c2 100644--- a/crates/ai-memory-llm/src/copilot.rs+++ b/crates/ai-memory-llm/src/copilot.rs@@ -697,7 +697,7 @@ fn build_chat_request<'a>(fn model_uses_default_temperature(model: &str) -> bool {let m = model.to_ascii_lowercase();- m.starts_with("gpt-5") || m.starts_with('o')+ m.starts_with("gpt-5") || m.starts_with("gpt-6") || m.starts_with('o')}#[derive(Debug, Clone, Copy, PartialEq, Eq)]@@ -1316,6 +1316,18 @@ mod tests {assert_eq!(value["stream"], false);}+ #[test]+ fn chat_request_omits_gpt6_temperature() {+ let request = ChatRequest {+ system: None,+ messages: vec![crate::types::ChatMessage::user("hello")],+ temperature: Some(0.2),+ max_tokens: 123,+ };+ let value = serde_json::to_value(build_chat_request("gpt-6-sol", &request, None)).unwrap();+ assert!(value.get("temperature").is_none());+ }+#[test]fn structured_request_uses_json_schema_format() {let request = ChatRequest::user_prompt("json please");diff --git a/crates/ai-memory-llm/src/openai_oauth.rs b/crates/ai-memory-llm/src/openai_oauth.rsindex 13c55605..a7632709 100644--- a/crates/ai-memory-llm/src/openai_oauth.rs+++ b/crates/ai-memory-llm/src/openai_oauth.rs@@ -430,7 +430,7 @@ pub(crate) fn parse_sse_response(body: &str) -> LlmResult<CodexResponsesResponsefn model_uses_default_temperature(model: &str) -> bool {let m = model.to_ascii_lowercase();- m.starts_with("gpt-5") || m.starts_with('o')+ m.starts_with("gpt-5") || m.starts_with("gpt-6") || m.starts_with('o')}#[derive(Debug, Serialize)]@@ -706,6 +706,19 @@ mod tests {);}+ #[test]+ fn codex_request_omits_gpt6_temperature() {+ let request = ChatRequest {+ system: None,+ messages: vec![crate::types::ChatMessage::user("hello")],+ temperature: Some(0.2),+ max_tokens: 123,+ };+ let value =+ serde_json::to_value(build_request("gpt-6-luna", &request, None, None)).unwrap();+ assert!(value.get("temperature").is_none());+ }+#[test]fn codex_request_moves_system_to_instructions_and_omits_gpt5_temperature() {let request = ChatRequest {