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
3 changes: 1 addition & 2 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -291,12 +291,11 @@
# MEMORY_CONSOLIDATION_MODEL=qwen3.8-27b
# MEMORY_CONSOLIDATION_TIMEOUT_SECONDS=600
# Each chat hour with enough messages becomes a memory run at HH:02 UTC, after
# the hour completes; the daily cap counts runs created since midnight UTC.
# the hour completes; MEMORY_MAX_QUEUED_RUNS bounds the active queue.
# MEMORY_WORKER_CONCURRENCY=1
# MEMORY_MAX_MESSAGES_PER_RUN=200
# MEMORY_MIN_MESSAGES_PER_RUN=20
# MEMORY_MAX_QUEUED_RUNS=5000
# MEMORY_MAX_DAILY_ENQUEUED_RUNS=2000
# MEMORY_MAX_INPUT_TOKENS=10000
# MEMORY_TOKENIZER_MODEL=google/gemma-4-26B-A4B-it
# MEMORY_TOKENIZER_FILE=
Expand Down
3 changes: 1 addition & 2 deletions crates/openplotva-app/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4372,7 +4372,6 @@ fn admin_memory_policy_json(routes: &StaticWebRoutes) -> serde_json::Value {
serde_json::json!({
"min_messages_per_run": routes.memory_enqueue_policy.min_messages_per_run,
"max_queued_runs": routes.memory_enqueue_policy.max_queued_runs,
"max_daily_enqueued_runs": routes.memory_enqueue_policy.max_daily_enqueued_runs,
"max_messages_per_run": routes.memory_max_messages_per_run,
"max_input_tokens": routes.memory_max_input_tokens,
"token_estimator": routes.memory_token_estimator_source.as_ref(),
Expand Down Expand Up @@ -16624,7 +16623,7 @@ mod tests {
assert!(value["runs"].is_null());
assert_eq!(value["policy"]["min_messages_per_run"], 20);
assert_eq!(value["policy"]["max_queued_runs"], 5000);
assert_eq!(value["policy"]["max_daily_enqueued_runs"], 2000);
assert!(value["policy"].get("max_daily_enqueued_runs").is_none());
assert_eq!(value["policy"]["token_estimator"], "heuristic");
assert!(value["enqueue_rollups"].is_null());

Expand Down
5 changes: 1 addition & 4 deletions crates/openplotva-app/src/memory_runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2525,7 +2525,7 @@ const MEMORY_ENQUEUE_MINUTE: u8 = 2;
/// short outage still lands its hours.
pub const MEMORY_RECENT_LOOKBACK: Duration = Duration::from_secs(2 * 60 * 60);
/// UTC hour whose tick rescans the whole retention window for hours a longer
/// outage or the daily cap left without a run.
/// outage or a full queue left without a run.
const MEMORY_FULL_SCAN_HOUR: u8 = 3;

/// History span one enqueue tick scans: the whole retention window on startup
Expand Down Expand Up @@ -4675,7 +4675,6 @@ pub fn memory_service_worker_config_from_memory_config(
enqueue_policy: openplotva_memory::MemoryRunEnqueuePolicy {
min_messages_per_run: config.min_messages_per_run,
max_queued_runs: config.max_queued_runs,
max_daily_enqueued_runs: config.max_daily_enqueued_runs,
},
process: MemoryRunProcessConfig {
lease: positive_seconds(config.consolidation_timeout_seconds),
Expand Down Expand Up @@ -5667,7 +5666,6 @@ mod tests {
let config = AppConfig::from_raw(openplotva_config::RawConfig {
memory_min_messages_per_run: Some("21".to_owned()),
memory_max_queued_runs: Some("4321".to_owned()),
memory_max_daily_enqueued_runs: Some("1234".to_owned()),
..openplotva_config::RawConfig::default()
})
.expect("config");
Expand All @@ -5676,7 +5674,6 @@ mod tests {

assert_eq!(cfg.enqueue_policy.min_messages_per_run, 21);
assert_eq!(cfg.enqueue_policy.max_queued_runs, 4321);
assert_eq!(cfg.enqueue_policy.max_daily_enqueued_runs, 1234);
}

#[test]
Expand Down
34 changes: 0 additions & 34 deletions crates/openplotva-config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -383,8 +383,6 @@ pub const DEFAULT_MEMORY_MIN_MESSAGES_PER_RUN: i32 = 20;

pub const DEFAULT_MEMORY_MAX_QUEUED_RUNS: i32 = 5_000;

pub const DEFAULT_MEMORY_MAX_DAILY_ENQUEUED_RUNS: i32 = 2_000;

pub const DEFAULT_MEMORY_TOKENIZER_MODEL: &str = "google/gemma-4-26B-A4B-it";

/// Discovery service name the embedder registers under on the AI Farm.
Expand Down Expand Up @@ -1047,7 +1045,6 @@ pub struct MemoryConfig {
pub max_messages_per_run: i32,
pub min_messages_per_run: i32,
pub max_queued_runs: i32,
pub max_daily_enqueued_runs: i32,
pub max_input_tokens: i32,
pub tokenizer_model: String,
pub tokenizer_file: String,
Expand Down Expand Up @@ -1574,8 +1571,6 @@ pub struct RawConfig {
pub memory_min_messages_per_run: Option<String>,
/// `MEMORY_MAX_QUEUED_RUNS`.
pub memory_max_queued_runs: Option<String>,
/// `MEMORY_MAX_DAILY_ENQUEUED_RUNS`.
pub memory_max_daily_enqueued_runs: Option<String>,
/// `MEMORY_MAX_INPUT_TOKENS`.
pub memory_max_input_tokens: Option<String>,
/// `MEMORY_TOKENIZER_MODEL`.
Expand Down Expand Up @@ -2900,14 +2895,6 @@ impl AppConfig {
DEFAULT_MEMORY_MAX_QUEUED_RUNS,
)?,
)?,
max_daily_enqueued_runs: validate_positive_i32(
"MEMORY_MAX_DAILY_ENQUEUED_RUNS",
parse_i32(
"MEMORY_MAX_DAILY_ENQUEUED_RUNS",
raw.memory_max_daily_enqueued_runs,
DEFAULT_MEMORY_MAX_DAILY_ENQUEUED_RUNS,
)?,
)?,
max_input_tokens: parse_i32(
"MEMORY_MAX_INPUT_TOKENS",
raw.memory_max_input_tokens,
Expand Down Expand Up @@ -3392,7 +3379,6 @@ impl RawConfig {
memory_max_messages_per_run: env("MEMORY_MAX_MESSAGES_PER_RUN"),
memory_min_messages_per_run: env("MEMORY_MIN_MESSAGES_PER_RUN"),
memory_max_queued_runs: env("MEMORY_MAX_QUEUED_RUNS"),
memory_max_daily_enqueued_runs: env("MEMORY_MAX_DAILY_ENQUEUED_RUNS"),
memory_max_input_tokens: env("MEMORY_MAX_INPUT_TOKENS"),
memory_tokenizer_model: env("MEMORY_TOKENIZER_MODEL"),
memory_tokenizer_file: env("MEMORY_TOKENIZER_FILE"),
Expand Down Expand Up @@ -4210,10 +4196,6 @@ mod tests {
config.memory.max_queued_runs,
super::DEFAULT_MEMORY_MAX_QUEUED_RUNS
);
assert_eq!(
config.memory.max_daily_enqueued_runs,
super::DEFAULT_MEMORY_MAX_DAILY_ENQUEUED_RUNS
);
assert_eq!(config.memory.max_input_tokens, 10_000);
assert_eq!(config.memory.tokenizer_model, "google/gemma-4-26B-A4B-it");
assert_eq!(config.memory.embedder_service_name, "embedder");
Expand Down Expand Up @@ -4923,7 +4905,6 @@ mod tests {
memory_max_messages_per_run: Some("55".to_owned()),
memory_min_messages_per_run: Some("20".to_owned()),
memory_max_queued_runs: Some("5000".to_owned()),
memory_max_daily_enqueued_runs: Some("2000".to_owned()),
memory_max_input_tokens: Some("6000".to_owned()),
memory_tokenizer_model: Some("tokenizer".to_owned()),
memory_tokenizer_file: Some("/tmp/tokenizer.json".to_owned()),
Expand Down Expand Up @@ -4961,7 +4942,6 @@ mod tests {
assert_eq!(config.memory.max_messages_per_run, 55);
assert_eq!(config.memory.min_messages_per_run, 20);
assert_eq!(config.memory.max_queued_runs, 5000);
assert_eq!(config.memory.max_daily_enqueued_runs, 2000);
assert_eq!(config.memory.max_input_tokens, 6000);
assert_eq!(config.memory.tokenizer_model, "tokenizer");
assert_eq!(config.memory.tokenizer_file, "/tmp/tokenizer.json");
Expand Down Expand Up @@ -4999,7 +4979,6 @@ mod tests {
let config = AppConfig::from_raw(RawConfig::default())?;
assert_eq!(config.memory.min_messages_per_run, 20);
assert_eq!(config.memory.max_queued_runs, 5000);
assert_eq!(config.memory.max_daily_enqueued_runs, 2000);

let error = AppConfig::from_raw(RawConfig {
memory_min_messages_per_run: Some("0".to_owned()),
Expand Down Expand Up @@ -5027,19 +5006,6 @@ mod tests {
})
));

let error = AppConfig::from_raw(RawConfig {
memory_max_daily_enqueued_runs: Some("0".to_owned()),
..RawConfig::default()
})
.err();
assert!(matches!(
error,
Some(super::ConfigError::NonPositiveInteger {
name: "MEMORY_MAX_DAILY_ENQUEUED_RUNS",
value: 0,
})
));

Ok(())
}

Expand Down
8 changes: 0 additions & 8 deletions crates/openplotva-memory/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ pub const PURPOSE: &str = "memory";
pub const DEFAULT_MEMORY_MAX_OUTPUT_TOKENS: i32 = 4000;
pub const DEFAULT_MEMORY_MIN_MESSAGES_PER_RUN: i32 = 20;
pub const DEFAULT_MEMORY_MAX_QUEUED_RUNS: i32 = 5_000;
pub const DEFAULT_MEMORY_MAX_DAILY_ENQUEUED_RUNS: i32 = 2_000;
pub const DISCOVERY_PRIORITY_MEMORY: i32 = 10;
pub const DEFAULT_MEMORY_CONSOLIDATION_MODEL: &str = "Gemma 4 26B Heretic";
pub const PROMPT_VERSION: &str = "chat_memory_daily_v7";
Expand Down Expand Up @@ -179,15 +178,13 @@ pub struct RetrievalScope {
pub struct MemoryRunEnqueuePolicy {
pub min_messages_per_run: i32,
pub max_queued_runs: i32,
pub max_daily_enqueued_runs: i32,
}

impl Default for MemoryRunEnqueuePolicy {
fn default() -> Self {
Self {
min_messages_per_run: DEFAULT_MEMORY_MIN_MESSAGES_PER_RUN,
max_queued_runs: DEFAULT_MEMORY_MAX_QUEUED_RUNS,
max_daily_enqueued_runs: DEFAULT_MEMORY_MAX_DAILY_ENQUEUED_RUNS,
}
}
}
Expand All @@ -207,11 +204,6 @@ impl MemoryRunEnqueuePolicy {
} else {
self.max_queued_runs
},
max_daily_enqueued_runs: if self.max_daily_enqueued_runs <= 0 {
fallback.max_daily_enqueued_runs
} else {
self.max_daily_enqueued_runs
},
}
}
}
Expand Down
Loading
Loading