mirror of
https://github.com/fawney19/Aether.git
synced 2026-10-07 18:07:47 +08:00
fix(ws): harden Responses connection lifecycle
Revalidate control policy per turn, isolate downstream credentials, and make planner/turn ownership cancellation-safe. Preserve opaque protocol events, align configurable timeout semantics, and extend end-to-end security and settlement coverage.
This commit is contained in:
@@ -39,14 +39,13 @@ pub(crate) use self::codex_quota_breaker::{
|
||||
log_codex_quota_breaker_check_failure, log_codex_quota_breaker_install_failure,
|
||||
};
|
||||
pub(crate) use self::effects::{
|
||||
apply_local_execution_effect, spawn_local_oauth_success_effect, LocalAdaptiveRateLimitEffect,
|
||||
LocalAdaptiveSuccessEffect, LocalAttemptFailureEffect, LocalExecutionEffect,
|
||||
LocalExecutionEffectContext, LocalHealthFailureEffect, LocalHealthSuccessEffect,
|
||||
LocalOAuthInvalidationEffect, LocalOAuthSuccessEffect, LocalPoolErrorEffect,
|
||||
apply_local_stream_failure_effects, apply_local_stream_success_effects,
|
||||
release_local_pool_key_lease,
|
||||
release_pool_key_lease_from_report_context, LocalAdaptiveRateLimitEffect,
|
||||
LocalStreamFailureEffect,
|
||||
apply_local_execution_effect, apply_local_stream_failure_effects,
|
||||
apply_local_stream_success_effects, release_local_pool_key_lease,
|
||||
release_pool_key_lease_from_report_context, spawn_local_oauth_success_effect,
|
||||
LocalAdaptiveRateLimitEffect, LocalAdaptiveSuccessEffect, LocalAttemptFailureEffect,
|
||||
LocalExecutionEffect, LocalExecutionEffectContext, LocalHealthFailureEffect,
|
||||
LocalHealthSuccessEffect, LocalOAuthInvalidationEffect, LocalOAuthSuccessEffect,
|
||||
LocalPoolErrorEffect, LocalStreamFailureEffect,
|
||||
};
|
||||
pub(crate) use self::health::{
|
||||
project_local_failure_health, project_local_key_circuit_closed,
|
||||
|
||||
@@ -1254,33 +1254,6 @@ mod tests {
|
||||
assert_eq!(status["quota"]["provider_type"], json!("gemini_cli"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn codex_quota_snapshot_match_requires_explicit_signal_projection() {
|
||||
let parsed = json!({
|
||||
"allowed": false,
|
||||
"limit_reached": true,
|
||||
});
|
||||
|
||||
assert!(!codex_quota_snapshot_matches_metadata(
|
||||
Some(&json!({
|
||||
"quota": {
|
||||
"exhausted": true
|
||||
}
|
||||
})),
|
||||
&parsed,
|
||||
));
|
||||
assert!(codex_quota_snapshot_matches_metadata(
|
||||
Some(&json!({
|
||||
"quota": {
|
||||
"exhausted": true,
|
||||
"allowed": false,
|
||||
"limit_reached": true
|
||||
}
|
||||
})),
|
||||
&parsed,
|
||||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn grok_quota_feedback_decrements_the_matching_window() {
|
||||
let mut bucket = json!({
|
||||
@@ -1467,42 +1440,4 @@ mod tests {
|
||||
None
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn codex_quota_snapshot_does_not_roll_back_exhaustion() {
|
||||
let current = json!({
|
||||
"allowed": false,
|
||||
"limit_reached": true,
|
||||
"primary_used_percent": 100.0,
|
||||
"primary_reset_at": 2_000,
|
||||
"updated_at": 100
|
||||
});
|
||||
let delayed = json!({
|
||||
"allowed": true,
|
||||
"limit_reached": false,
|
||||
"primary_used_percent": 99.0,
|
||||
"primary_reset_at": 2_000,
|
||||
"updated_at": 101
|
||||
});
|
||||
assert!(codex_snapshot_regresses(¤t, &delayed));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn codex_quota_snapshot_allows_a_new_reset_window() {
|
||||
let current = json!({
|
||||
"allowed": false,
|
||||
"limit_reached": true,
|
||||
"primary_used_percent": 100.0,
|
||||
"primary_reset_at": 2_000,
|
||||
"updated_at": 100
|
||||
});
|
||||
let refreshed = json!({
|
||||
"allowed": true,
|
||||
"limit_reached": false,
|
||||
"primary_used_percent": 1.0,
|
||||
"primary_reset_at": 1_000,
|
||||
"updated_at": 101
|
||||
});
|
||||
assert!(!codex_snapshot_regresses(¤t, &refreshed));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user