From 2621afbbe6f17b71d9c6f412bb2d518d3e6f7c94 Mon Sep 17 00:00:00 2001 From: NessZerra <90105158+Finesssee@users.noreply.github.com> Date: Tue, 22 Sep 2026 16:33:47 +0700 Subject: [PATCH] Show SSH cost snapshot timestamps --- rust/src/codex_costs/host_costs.rs | 32 +++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/rust/src/codex_costs/host_costs.rs b/rust/src/codex_costs/host_costs.rs index 8be1598e4f..ace018c0dc 100644 --- a/rust/src/codex_costs/host_costs.rs +++ b/rust/src/codex_costs/host_costs.rs @@ -188,9 +188,12 @@ fn render_codex_host_report(report: &CodexHostCostReport) -> String { "\nPartial history; scan is incomplete.".to_string() }; format!( - "{title} — Codex API-equivalent estimate (not billed)\n{}{}\nDay boundaries: {}{}", + "{title} — Codex API-equivalent estimate (not billed)\n{}{}\nSnapshot updated: {}\nDay boundaries: {}{}", window_line("Today", &summary.today), history, + summary + .updated_at + .to_rfc3339_opts(chrono::SecondsFormat::Secs, true), summary.bucket_time_zone, coverage ) @@ -199,3 +202,30 @@ fn render_codex_host_report(report: &CodexHostCostReport) -> String { fn format_tokens(value: u64) -> String { value.to_string() } + +#[cfg(test)] +mod tests { + use super::*; + use crate::cost_scanner::CostSummary; + + #[test] + fn ssh_cost_text_shows_source_snapshot_timestamp_in_utc() { + let complete = CostSummary { + history_coverage_established: true, + ..CostSummary::default() + }; + let summary = CodexCostSummary::from_summaries_at( + &complete, + &complete, + 30, + chrono::DateTime::from_timestamp(946_684_800, 0).unwrap(), + "Asia/Tokyo", + ); + + let text = + render_codex_host_report(&CodexHostCostReport::success("qa-windows", "ssh", summary)); + + assert!(text.contains("Snapshot updated: 2000-01-01T00:00:00Z")); + assert!(text.contains("Day boundaries: Asia/Tokyo")); + } +}