feat: use provider defaults for memory models (#27129)

## Why

Memory startup used hardcoded OpenAI model slugs for extraction and
consolidation. That works for the default OpenAI-compatible path, but
provider-specific backends can require different model identifiers. In
particular, Amazon Bedrock should use its Bedrock model ID for these
background memory requests instead of the OpenAI `gpt-5.4-mini` /
`gpt-5.4` slugs.

## What Changed

- Added provider-owned preferred memory model methods alongside
`approval_review_preferred_model`.
- Updated memory extraction and consolidation to resolve their default
model through the active `ModelProvider`.
- Added Amazon Bedrock overrides so both memory stages use
`openai.gpt-5.4` through Bedrock’s provider-specific model ID.
- Kept explicit `memories.extract_model` and
`memories.consolidation_model` config overrides taking precedence.
- Added startup coverage for default OpenAI and Bedrock memory model
selection.

#closes #26288
This commit is contained in:
Celia Chen
2026-06-09 23:49:09 +00:00
committed by GitHub
parent fb8f1ea0d5
commit 51fc4b0559
9 changed files with 413 additions and 13 deletions
@@ -68,6 +68,14 @@ impl ModelProvider for AmazonBedrockModelProvider {
AMAZON_BEDROCK_GPT_5_4_MODEL_ID
}
fn memory_extraction_preferred_model(&self) -> &'static str {
AMAZON_BEDROCK_GPT_5_4_MODEL_ID
}
fn memory_consolidation_preferred_model(&self) -> &'static str {
AMAZON_BEDROCK_GPT_5_4_MODEL_ID
}
fn auth_manager(&self) -> Option<Arc<AuthManager>> {
None
}
+22
View File
@@ -74,6 +74,14 @@ pub type ProviderAccountResult = std::result::Result<ProviderAccountState, Provi
/// require a backend-specific model ID.
pub const DEFAULT_APPROVAL_REVIEW_PREFERRED_MODEL: &str = "codex-auto-review";
/// Default model used for memory extraction when a provider does not require a
/// backend-specific model ID.
pub const DEFAULT_MEMORY_EXTRACTION_PREFERRED_MODEL: &str = "gpt-5.4-mini";
/// Default model used for memory consolidation when a provider does not require
/// a backend-specific model ID.
pub const DEFAULT_MEMORY_CONSOLIDATION_PREFERRED_MODEL: &str = "gpt-5.4";
/// Runtime provider abstraction used by model execution.
///
/// Implementations own provider-specific behavior for a model backend. The
@@ -96,6 +104,20 @@ pub trait ModelProvider: fmt::Debug + Send + Sync {
DEFAULT_APPROVAL_REVIEW_PREFERRED_MODEL
}
/// Returns the preferred model used for memory extraction.
///
/// Providers that require backend-specific model IDs should override this.
fn memory_extraction_preferred_model(&self) -> &'static str {
DEFAULT_MEMORY_EXTRACTION_PREFERRED_MODEL
}
/// Returns the preferred model used for memory consolidation.
///
/// Providers that require backend-specific model IDs should override this.
fn memory_consolidation_preferred_model(&self) -> &'static str {
DEFAULT_MEMORY_CONSOLIDATION_PREFERRED_MODEL
}
/// Returns whether requests made through this provider should include attestation.
fn supports_attestation(&self) -> bool {
false