fix(provider): classify deleted Codex agent runtime as invalid

This commit is contained in:
ZheFox
2026-07-23 11:21:55 +08:00
parent e49024d33b
commit 7bf228a33c
5 changed files with 138 additions and 0 deletions
@@ -806,6 +806,26 @@ mod tests {
);
}
#[test]
fn oauth_status_filter_matches_deleted_agent_runtime_as_invalid() {
let mut key = sample_key("oauth");
key.oauth_invalid_at_unix_secs = Some(1_784_728_663);
key.oauth_invalid_reason =
Some("[REQUEST_FAILED] Agent runtime has been deleted.".to_string());
let status_snapshot = provider_key_status_snapshot_payload(&key, "codex");
assert_eq!(
admin_pool_oauth_status_filter(
&key,
"codex",
None,
status_snapshot.get("oauth").and_then(Value::as_object),
1_784_729_000,
),
Some("invalid")
);
}
#[test]
fn codex_cycle_usage_request_uses_actual_monthly_window_boundaries() {
let key = sample_key("oauth");