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 codex-rs/memories/write/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
mod control;
mod extensions;
mod guard;
mod metrics;
mod phase1;
mod phase2;
mod prompts;
Expand Down
11 changes: 11 additions & 0 deletions codex-rs/memories/write/src/metrics.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
pub(crate) const MEMORY_STARTUP: &str = "codex.memory.startup";

pub(crate) const MEMORY_PHASE_ONE_JOBS: &str = "codex.memory.phase1";
pub(crate) const MEMORY_PHASE_ONE_E2E_MS: &str = "codex.memory.phase1.e2e_ms";
pub(crate) const MEMORY_PHASE_ONE_OUTPUT: &str = "codex.memory.phase1.output";
pub(crate) const MEMORY_PHASE_ONE_TOKEN_USAGE: &str = "codex.memory.phase1.token_usage";

pub(crate) const MEMORY_PHASE_TWO_JOBS: &str = "codex.memory.phase2";
pub(crate) const MEMORY_PHASE_TWO_E2E_MS: &str = "codex.memory.phase2.e2e_ms";
pub(crate) const MEMORY_PHASE_TWO_INPUT: &str = "codex.memory.phase2.input";
pub(crate) const MEMORY_PHASE_TWO_TOKEN_USAGE: &str = "codex.memory.phase2.token_usage";
8 changes: 4 additions & 4 deletions codex-rs/memories/write/src/phase1.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
use crate::STAGE_ONE_PROMPT;
use crate::build_stage_one_input_message;
use crate::metrics::MEMORY_PHASE_ONE_E2E_MS;
use crate::metrics::MEMORY_PHASE_ONE_JOBS;
use crate::metrics::MEMORY_PHASE_ONE_OUTPUT;
use crate::metrics::MEMORY_PHASE_ONE_TOKEN_USAGE;
use crate::runtime::MemoryStartupContext;
use crate::runtime::StageOneRequestContext;
use codex_config::types::MemoriesConfig;
Expand Down Expand Up @@ -32,10 +36,6 @@ const JOB_LEASE_SECONDS: i64 = 3_600;
const JOB_RETRY_DELAY_SECONDS: i64 = 3_600;
const THREAD_SCAN_LIMIT: usize = 5_000;
const PRUNE_BATCH_SIZE: usize = 200;
const MEMORY_PHASE_ONE_JOBS: &str = "codex.memory.phase1";
const MEMORY_PHASE_ONE_E2E_MS: &str = "codex.memory.phase1.e2e_ms";
const MEMORY_PHASE_ONE_OUTPUT: &str = "codex.memory.phase1.output";
const MEMORY_PHASE_ONE_TOKEN_USAGE: &str = "codex.memory.phase1.token_usage";

struct JobResult {
outcome: JobOutcome,
Expand Down
8 changes: 4 additions & 4 deletions codex-rs/memories/write/src/phase2.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
use crate::build_consolidation_prompt;
use crate::memory_root;
use crate::metrics::MEMORY_PHASE_TWO_E2E_MS;
use crate::metrics::MEMORY_PHASE_TWO_INPUT;
use crate::metrics::MEMORY_PHASE_TWO_JOBS;
use crate::metrics::MEMORY_PHASE_TWO_TOKEN_USAGE;
use crate::prune_old_extension_resources;
use crate::rebuild_raw_memories_file_from_memories;
use crate::runtime::MemoryStartupContext;
Expand Down Expand Up @@ -30,10 +34,6 @@ const REASONING_EFFORT: codex_protocol::openai_models::ReasoningEffort =
const JOB_LEASE_SECONDS: i64 = 3_600;
const JOB_RETRY_DELAY_SECONDS: i64 = 3_600;
const JOB_HEARTBEAT_SECONDS: u64 = 90;
const MEMORY_PHASE_TWO_JOBS: &str = "codex.memory.phase2";
const MEMORY_PHASE_TWO_E2E_MS: &str = "codex.memory.phase2.e2e_ms";
const MEMORY_PHASE_TWO_INPUT: &str = "codex.memory.phase2.input";
const MEMORY_PHASE_TWO_TOKEN_USAGE: &str = "codex.memory.phase2.token_usage";

#[derive(Debug, Clone, Default)]
struct Claim {
Expand Down
3 changes: 1 addition & 2 deletions codex-rs/memories/write/src/start.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use crate::guard;
use crate::metrics::MEMORY_STARTUP;
use crate::phase1;
use crate::phase2;
use crate::runtime::MemoryStartupContext;
Expand All @@ -12,8 +13,6 @@ use codex_protocol::protocol::SessionSource;
use std::sync::Arc;
use tracing::warn;

const MEMORY_STARTUP: &str = "codex.memory.startup";

/// Starts the asynchronous startup memory pipeline for an eligible root session.
///
/// The pipeline is skipped for ephemeral sessions, disabled feature flags, and
Expand Down
Loading