Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions crates/forge_app/src/orch_spec/orch_setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ impl Default for TestContext {
workspace_server_url: Url::parse("http://localhost:8080").unwrap(),
max_extensions: 15,
parallel_file_reads: 64,
model_cache_ttl: 604_800,
},
title: Some("test-conversation".into()),
agent: Agent::new(
Expand Down
6 changes: 6 additions & 0 deletions crates/forge_domain/src/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ pub struct Environment {
/// Controlled by FORGE_PARALLEL_FILE_READS environment variable.
/// Caps the `buffer_unordered` concurrency to avoid EMFILE errors.
pub parallel_file_reads: usize,
/// TTL in seconds for the model API list cache.
/// Controlled by FORGE_MODEL_CACHE_TTL environment variable.
pub model_cache_ttl: u64,
}

/// The output format used when auto-dumping a conversation on task completion.
Expand Down Expand Up @@ -339,6 +342,7 @@ fn test_command_path() {
max_extensions: 15,
auto_dump: None,
parallel_file_reads: 64,
model_cache_ttl: 604_800,
};

let actual = fixture.command_path();
Expand Down Expand Up @@ -381,6 +385,7 @@ fn test_command_cwd_path() {
max_extensions: 15,
auto_dump: None,
parallel_file_reads: 64,
model_cache_ttl: 604_800,
};

let actual = fixture.command_cwd_path();
Expand Down Expand Up @@ -423,6 +428,7 @@ fn test_command_cwd_path_independent_from_command_path() {
max_extensions: 15,
auto_dump: None,
parallel_file_reads: 64,
model_cache_ttl: 604_800,
};

let command_path = fixture.command_path();
Expand Down
1 change: 1 addition & 0 deletions crates/forge_infra/src/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ impl ForgeEnvironmentInfra {
.unwrap_or(32)
},
),
model_cache_ttl: parse_env::<u64>("FORGE_MODEL_CACHE_TTL").unwrap_or(604_800), /* 1 week */
}
}

Expand Down
5 changes: 1 addition & 4 deletions crates/forge_repo/src/provider/chat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ use crate::provider::google::GoogleResponseRepository;
use crate::provider::openai::OpenAIResponseRepository;
use crate::provider::openai_responses::OpenAIResponsesResponseRepository;

/// TTL for cached model lists: 2 hours in seconds.
const MODEL_CACHE_TTL_SECS: u128 = 7200;

/// Repository responsible for routing chat requests to the appropriate provider
/// implementation based on the provider's response type.
pub struct ForgeChatRepository<F> {
Expand Down Expand Up @@ -48,7 +45,7 @@ impl<F: EnvironmentInfra + HttpInfra> ForgeChatRepository<F> {

let model_cache = Arc::new(CacacheStorage::new(
env.cache_dir().join("model_cache"),
Some(MODEL_CACHE_TTL_SECS),
Some(env.model_cache_ttl as u128),
));

Self {
Expand Down
Loading