From 93456320ef6d95543eb944b923302a5c062794c2 Mon Sep 17 00:00:00 2001 From: jif-oai Date: Wed, 20 May 2026 12:05:58 +0200 Subject: [PATCH] feat: rename 1 (#23667) Just a mechanical renaming --- .../tests/suite/v2/thread_resume.rs | 2 +- codex-rs/core/src/goals.rs | 10 ++-- codex-rs/state/src/lib.rs | 2 +- codex-rs/state/src/runtime.rs | 2 +- codex-rs/state/src/runtime/goals.rs | 54 +++++++++---------- 5 files changed, 35 insertions(+), 35 deletions(-) diff --git a/codex-rs/app-server/tests/suite/v2/thread_resume.rs b/codex-rs/app-server/tests/suite/v2/thread_resume.rs index 036f2368a..d4baf7d77 100644 --- a/codex-rs/app-server/tests/suite/v2/thread_resume.rs +++ b/codex-rs/app-server/tests/suite/v2/thread_resume.rs @@ -1108,7 +1108,7 @@ async fn thread_goal_set_edits_objective_without_resetting_usage() -> Result<()> thread_id, /*time_delta_seconds*/ 12, /*token_delta*/ 50, - codex_state::ThreadGoalAccountingMode::ActiveOnly, + codex_state::GoalAccountingMode::ActiveOnly, Some(persisted_goal.goal_id.as_str()), ) .await?; diff --git a/codex-rs/core/src/goals.rs b/codex-rs/core/src/goals.rs index 6843264e4..794b14ea7 100644 --- a/codex-rs/core/src/goals.rs +++ b/codex-rs/core/src/goals.rs @@ -459,7 +459,7 @@ impl Session { self.account_thread_goal_wall_clock_usage( &state_db, - codex_state::ThreadGoalAccountingMode::ActiveOnly, + codex_state::GoalAccountingMode::ActiveOnly, TerminalMetricEmission::Emit, ) .await?; @@ -601,7 +601,7 @@ impl Session { let state_db = self.require_state_db_for_thread_goals().await?; self.account_thread_goal_wall_clock_usage( &state_db, - codex_state::ThreadGoalAccountingMode::ActiveOnly, + codex_state::GoalAccountingMode::ActiveOnly, TerminalMetricEmission::Emit, ) .await?; @@ -1028,7 +1028,7 @@ impl Session { self.conversation_id, time_delta_seconds, token_delta, - codex_state::ThreadGoalAccountingMode::ActiveOnly, + codex_state::GoalAccountingMode::ActiveOnly, expected_goal_id.as_deref(), ) .await?; @@ -1119,7 +1119,7 @@ impl Session { }; self.account_thread_goal_wall_clock_usage( &state_db, - codex_state::ThreadGoalAccountingMode::ActiveOnly, + codex_state::GoalAccountingMode::ActiveOnly, TerminalMetricEmission::Suppress, ) .await?; @@ -1129,7 +1129,7 @@ impl Session { async fn account_thread_goal_wall_clock_usage( &self, state_db: &StateDbHandle, - mode: codex_state::ThreadGoalAccountingMode, + mode: codex_state::GoalAccountingMode, terminal_metric_emission: TerminalMetricEmission, ) -> anyhow::Result> { let _accounting_permit = self.goal_runtime.accounting_permit().await?; diff --git a/codex-rs/state/src/lib.rs b/codex-rs/state/src/lib.rs index 8746ff3a0..f835000fa 100644 --- a/codex-rs/state/src/lib.rs +++ b/codex-rs/state/src/lib.rs @@ -48,11 +48,11 @@ pub use model::ThreadGoalStatus; pub use model::ThreadMetadata; pub use model::ThreadMetadataBuilder; pub use model::ThreadsPage; +pub use runtime::GoalAccountingMode; pub use runtime::GoalStore; pub use runtime::RemoteControlEnrollmentRecord; pub use runtime::RuntimeDbPath; pub use runtime::ThreadFilterOptions; -pub use runtime::ThreadGoalAccountingMode; pub use runtime::ThreadGoalAccountingOutcome; pub use runtime::ThreadGoalUpdate; pub use runtime::goals_db_filename; diff --git a/codex-rs/state/src/runtime.rs b/codex-rs/state/src/runtime.rs index ac03f227d..1dc349b23 100644 --- a/codex-rs/state/src/runtime.rs +++ b/codex-rs/state/src/runtime.rs @@ -66,8 +66,8 @@ mod remote_control; mod test_support; mod threads; +pub use goals::GoalAccountingMode; pub use goals::GoalStore; -pub use goals::ThreadGoalAccountingMode; pub use goals::ThreadGoalAccountingOutcome; pub use goals::ThreadGoalUpdate; pub use remote_control::RemoteControlEnrollmentRecord; diff --git a/codex-rs/state/src/runtime/goals.rs b/codex-rs/state/src/runtime/goals.rs index bf5a7bd82..c9a1d126b 100644 --- a/codex-rs/state/src/runtime/goals.rs +++ b/codex-rs/state/src/runtime/goals.rs @@ -26,7 +26,7 @@ pub enum ThreadGoalAccountingOutcome { } #[derive(Clone, Copy, Debug, Eq, PartialEq)] -pub enum ThreadGoalAccountingMode { +pub enum GoalAccountingMode { ActiveStatusOnly, ActiveOnly, ActiveOrComplete, @@ -387,7 +387,7 @@ WHERE thread_id = ? thread_id: ThreadId, time_delta_seconds: i64, token_delta: i64, - mode: ThreadGoalAccountingMode, + mode: GoalAccountingMode, expected_goal_id: Option<&str>, ) -> anyhow::Result { let time_delta_seconds = time_delta_seconds.max(0); @@ -400,20 +400,20 @@ WHERE thread_id = ? let now_ms = datetime_to_epoch_millis(Utc::now()); let status_filter = match mode { - ThreadGoalAccountingMode::ActiveStatusOnly => "status = 'active'", - ThreadGoalAccountingMode::ActiveOnly => "status IN ('active', 'budget_limited')", - ThreadGoalAccountingMode::ActiveOrComplete => { + GoalAccountingMode::ActiveStatusOnly => "status = 'active'", + GoalAccountingMode::ActiveOnly => "status IN ('active', 'budget_limited')", + GoalAccountingMode::ActiveOrComplete => { "status IN ('active', 'budget_limited', 'complete')" } - ThreadGoalAccountingMode::ActiveOrStopped => { + GoalAccountingMode::ActiveOrStopped => { "status IN ('active', 'paused', 'blocked', 'usage_limited', 'budget_limited')" } }; let budget_limit_status_filter = match mode { - ThreadGoalAccountingMode::ActiveStatusOnly - | ThreadGoalAccountingMode::ActiveOnly - | ThreadGoalAccountingMode::ActiveOrComplete => "status = 'active'", - ThreadGoalAccountingMode::ActiveOrStopped => { + GoalAccountingMode::ActiveStatusOnly + | GoalAccountingMode::ActiveOnly + | GoalAccountingMode::ActiveOrComplete => "status = 'active'", + GoalAccountingMode::ActiveOrStopped => { "status IN ('active', 'paused', 'blocked', 'usage_limited', 'budget_limited')" } }; @@ -802,7 +802,7 @@ mod tests { thread_id, /*time_delta_seconds*/ 5, /*token_delta*/ 5, - ThreadGoalAccountingMode::ActiveOnly, + GoalAccountingMode::ActiveOnly, Some(original.goal_id.as_str()), ) .await @@ -840,7 +840,7 @@ mod tests { thread_id, /*time_delta_seconds*/ 12, /*token_delta*/ 30, - ThreadGoalAccountingMode::ActiveOnly, + GoalAccountingMode::ActiveOnly, /*expected_goal_id*/ None, ) .await @@ -1062,7 +1062,7 @@ mod tests { thread_id, /*time_delta_seconds*/ 7, /*token_delta*/ 5, - ThreadGoalAccountingMode::ActiveOnly, + GoalAccountingMode::ActiveOnly, /*expected_goal_id*/ None, ) .await @@ -1080,7 +1080,7 @@ mod tests { thread_id, /*time_delta_seconds*/ 3, /*token_delta*/ 15, - ThreadGoalAccountingMode::ActiveOnly, + GoalAccountingMode::ActiveOnly, /*expected_goal_id*/ None, ) .await @@ -1098,7 +1098,7 @@ mod tests { thread_id, /*time_delta_seconds*/ 5, /*token_delta*/ 5, - ThreadGoalAccountingMode::ActiveOnly, + GoalAccountingMode::ActiveOnly, /*expected_goal_id*/ None, ) .await @@ -1133,7 +1133,7 @@ mod tests { thread_id, /*time_delta_seconds*/ 5, /*token_delta*/ 5, - ThreadGoalAccountingMode::ActiveStatusOnly, + GoalAccountingMode::ActiveStatusOnly, /*expected_goal_id*/ None, ) .await @@ -1181,7 +1181,7 @@ mod tests { thread_id, /*time_delta_seconds*/ 3, /*token_delta*/ 25, - ThreadGoalAccountingMode::ActiveOrStopped, + GoalAccountingMode::ActiveOrStopped, /*expected_goal_id*/ None, ) .await @@ -1215,7 +1215,7 @@ mod tests { thread_id, /*time_delta_seconds*/ 1, /*token_delta*/ 50, - ThreadGoalAccountingMode::ActiveOnly, + GoalAccountingMode::ActiveOnly, /*expected_goal_id*/ None, ) .await @@ -1262,7 +1262,7 @@ mod tests { thread_id, /*time_delta_seconds*/ 1, /*token_delta*/ 50, - ThreadGoalAccountingMode::ActiveOnly, + GoalAccountingMode::ActiveOnly, /*expected_goal_id*/ None, ) .await @@ -1313,7 +1313,7 @@ mod tests { thread_id, /*time_delta_seconds*/ 1, /*token_delta*/ 50, - ThreadGoalAccountingMode::ActiveOnly, + GoalAccountingMode::ActiveOnly, /*expected_goal_id*/ None, ) .await @@ -1360,7 +1360,7 @@ mod tests { thread_id, /*time_delta_seconds*/ 1, /*token_delta*/ 50, - ThreadGoalAccountingMode::ActiveOnly, + GoalAccountingMode::ActiveOnly, /*expected_goal_id*/ None, ) .await @@ -1413,7 +1413,7 @@ mod tests { thread_id, /*time_delta_seconds*/ 30, /*token_delta*/ 200, - ThreadGoalAccountingMode::ActiveOnly, + GoalAccountingMode::ActiveOnly, /*expected_goal_id*/ None, ) .await @@ -1431,7 +1431,7 @@ mod tests { thread_id, /*time_delta_seconds*/ 30, /*token_delta*/ 200, - ThreadGoalAccountingMode::ActiveOrComplete, + GoalAccountingMode::ActiveOrComplete, /*expected_goal_id*/ None, ) .await @@ -1480,7 +1480,7 @@ mod tests { thread_id, /*time_delta_seconds*/ 30, /*token_delta*/ 200, - ThreadGoalAccountingMode::ActiveOnly, + GoalAccountingMode::ActiveOnly, /*expected_goal_id*/ None, ) .await @@ -1498,7 +1498,7 @@ mod tests { thread_id, /*time_delta_seconds*/ 30, /*token_delta*/ 200, - ThreadGoalAccountingMode::ActiveOrStopped, + GoalAccountingMode::ActiveOrStopped, /*expected_goal_id*/ None, ) .await @@ -1531,14 +1531,14 @@ mod tests { thread_id, /*time_delta_seconds*/ 4, /*token_delta*/ 40, - ThreadGoalAccountingMode::ActiveOnly, + GoalAccountingMode::ActiveOnly, /*expected_goal_id*/ None, ); let second = runtime.thread_goals().account_thread_goal_usage( thread_id, /*time_delta_seconds*/ 6, /*token_delta*/ 60, - ThreadGoalAccountingMode::ActiveOnly, + GoalAccountingMode::ActiveOnly, /*expected_goal_id*/ None, ); let (first, second) = tokio::join!(first, second);