aKode fase 5: test e snapshot adeguati alla rinomina, 429 distinto (ProviderRateLimited), cargo fmt dopo il cambio dei prefissi
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -11,16 +11,16 @@ use crate::protocol::RateLimitReachedType;
|
||||
use crate::protocol::RateLimitSnapshot;
|
||||
use crate::protocol::TokenUsage;
|
||||
use crate::protocol::TruncationPolicy;
|
||||
use chrono::DateTime;
|
||||
use chrono::Datelike;
|
||||
use chrono::Local;
|
||||
use chrono::Utc;
|
||||
use akode_async_utils::CancelErr;
|
||||
use akode_async_utils::backoff;
|
||||
use akode_http_client::HttpError;
|
||||
use akode_http_client::RetryAfter;
|
||||
use akode_utils_string::truncate_middle_chars;
|
||||
use akode_utils_string::truncate_middle_with_token_budget;
|
||||
use chrono::DateTime;
|
||||
use chrono::Datelike;
|
||||
use chrono::Local;
|
||||
use chrono::Utc;
|
||||
use http::StatusCode;
|
||||
use serde_json;
|
||||
use std::fmt;
|
||||
@@ -123,13 +123,16 @@ pub enum CodexErrorDetails {
|
||||
/// A retryable upstream rate limit received inside the response stream.
|
||||
#[error("rate limit exceeded: {0}")]
|
||||
RateLimitExceeded(String),
|
||||
/// HTTP 429 from the model provider: back off and retry, more patiently than other failures.
|
||||
#[error("Limite del provider raggiunto: {0}")]
|
||||
ProviderRateLimited(String),
|
||||
/// The provider's daily (or otherwise long-window) request allowance is used up; retrying
|
||||
/// within the turn cannot succeed.
|
||||
#[error("Limite giornaliero del provider esaurito. {0}")]
|
||||
ProviderDailyLimitExhausted(String),
|
||||
// The iOS input-limit classifier matches this message's ASCII prefix.
|
||||
#[error(
|
||||
"Codex ran out of room in the model's context window. Start a new thread or clear earlier history before retrying."
|
||||
"aKode ran out of room in the model's context window. Start a new thread or clear earlier history before retrying."
|
||||
)]
|
||||
ContextWindowExceeded,
|
||||
#[error("no thread with id: {0}")]
|
||||
@@ -475,6 +478,7 @@ impl CodexErr {
|
||||
CodexErrorDetails::Stream(..)
|
||||
| CodexErrorDetails::ContentFilter
|
||||
| CodexErrorDetails::RateLimitExceeded(_)
|
||||
| CodexErrorDetails::ProviderRateLimited(_)
|
||||
| CodexErrorDetails::Timeout
|
||||
| CodexErrorDetails::RequestTimeout
|
||||
| CodexErrorDetails::UnexpectedStatus(_)
|
||||
@@ -522,7 +526,9 @@ impl CodexErr {
|
||||
match &self.details {
|
||||
CodexErrorDetails::ContextWindowExceeded => CodexErrorInfo::ContextWindowExceeded,
|
||||
CodexErrorDetails::SessionBudgetExceeded => CodexErrorInfo::SessionBudgetExceeded,
|
||||
CodexErrorDetails::RateLimitExceeded(_) => CodexErrorInfo::RateLimitExceeded,
|
||||
CodexErrorDetails::RateLimitExceeded(_) | CodexErrorDetails::ProviderRateLimited(_) => {
|
||||
CodexErrorInfo::RateLimitExceeded
|
||||
}
|
||||
CodexErrorDetails::UsageLimitReached(_)
|
||||
| CodexErrorDetails::QuotaExceeded
|
||||
| CodexErrorDetails::ProviderDailyLimitExhausted(_)
|
||||
|
||||
@@ -2,11 +2,11 @@ use super::*;
|
||||
use crate::auth::KnownPlan;
|
||||
use crate::exec_output::StreamOutput;
|
||||
use crate::protocol::RateLimitWindow;
|
||||
use akode_http_client::HttpResponse;
|
||||
use chrono::DateTime;
|
||||
use chrono::Duration as ChronoDuration;
|
||||
use chrono::TimeZone;
|
||||
use chrono::Utc;
|
||||
use akode_http_client::HttpResponse;
|
||||
use http::Response as RawHttpResponse;
|
||||
use http::StatusCode;
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
@@ -40,7 +40,6 @@ pub fn is_node_repl_backed_server(server: &str) -> bool {
|
||||
matches!(server, "node_repl" | "cua_repl")
|
||||
}
|
||||
|
||||
|
||||
/// Recognizes Node REPL-backed tools in model-visible MCP namespaces or legacy
|
||||
/// flat tool names. An explicit namespace takes precedence over the tool name.
|
||||
pub fn is_node_repl_backed_tool(name: &str, namespace: Option<&str>) -> bool {
|
||||
|
||||
@@ -2675,8 +2675,8 @@ impl std::fmt::Display for FunctionCallOutputPayload {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use anyhow::Result;
|
||||
use akode_execpolicy::Policy;
|
||||
use anyhow::Result;
|
||||
use pretty_assertions::assert_eq;
|
||||
use std::path::PathBuf;
|
||||
use tempfile::tempdir;
|
||||
|
||||
@@ -86,7 +86,7 @@ fn local_metadata_case_aliases_respect_filesystem_and_explicit_grants() -> anyho
|
||||
let matching = policy.prepare_local_matching(&context)?;
|
||||
for relative in [
|
||||
".GIT/config",
|
||||
".CoDeX/config.toml",
|
||||
".AkOdE/config.toml",
|
||||
".AGENTS/new",
|
||||
".AWS/config",
|
||||
] {
|
||||
@@ -101,7 +101,7 @@ fn local_metadata_case_aliases_respect_filesystem_and_explicit_grants() -> anyho
|
||||
);
|
||||
}
|
||||
let root_alias = parent.join("WORKSPACE")?;
|
||||
for relative in [".GIT/config", ".git/config", ".CoDeX/config.toml"] {
|
||||
for relative in [".GIT/config", ".git/config", ".AkOdE/config.toml"] {
|
||||
let path = root_alias.join(relative)?;
|
||||
assert_eq!(
|
||||
(
|
||||
|
||||
@@ -4886,10 +4886,10 @@ mod tests {
|
||||
use crate::permissions::FileSystemSandboxPolicy;
|
||||
use crate::permissions::FileSystemSpecialPath;
|
||||
use crate::permissions::NetworkSandboxPolicy;
|
||||
use anyhow::Result;
|
||||
use akode_utils_absolute_path::AbsolutePathBuf;
|
||||
use akode_utils_absolute_path::test_support::PathBufExt;
|
||||
use akode_utils_absolute_path::test_support::test_path_buf;
|
||||
use anyhow::Result;
|
||||
use pretty_assertions::assert_eq;
|
||||
use serde_json::json;
|
||||
use std::path::PathBuf;
|
||||
|
||||
@@ -22,7 +22,7 @@ fn tool_call_id_replaces_platform_equivalent_names() {
|
||||
let mut env = HashMap::from([
|
||||
("AKODE_TOOL_CALL_ID".to_string(), "stale-call".to_string()),
|
||||
(
|
||||
"Codex_Tool_Call_Id".to_string(),
|
||||
"Akode_Tool_Call_Id".to_string(),
|
||||
"mixed-case-call".to_string(),
|
||||
),
|
||||
(
|
||||
@@ -38,7 +38,7 @@ fn tool_call_id_replaces_platform_equivalent_names() {
|
||||
#[cfg(not(windows))]
|
||||
expected.extend([
|
||||
(
|
||||
"Codex_Tool_Call_Id".to_string(),
|
||||
"Akode_Tool_Call_Id".to_string(),
|
||||
"mixed-case-call".to_string(),
|
||||
),
|
||||
(
|
||||
@@ -58,7 +58,7 @@ fn non_inheritable_environment_is_removed_after_policy_overrides() {
|
||||
let vars = [
|
||||
("SAFE".to_string(), "inherited".to_string()),
|
||||
(
|
||||
"codex_guardian_decisions_api_key".into(),
|
||||
"akode_guardian_decisions_api_key".into(),
|
||||
"synthetic-inherited-key".into(),
|
||||
),
|
||||
("node_repl_auth_token".into(), "inherited-token".into()),
|
||||
@@ -71,7 +71,7 @@ fn non_inheritable_environment_is_removed_after_policy_overrides() {
|
||||
r#"{"instance_id":"box-one"}"#.to_string(),
|
||||
),
|
||||
(
|
||||
"codex_exec_server_noise_auth_token".to_string(),
|
||||
"akode_exec_server_noise_auth_token".to_string(),
|
||||
"inherited-noise-token".to_string(),
|
||||
),
|
||||
];
|
||||
@@ -90,7 +90,7 @@ fn non_inheritable_environment_is_removed_after_policy_overrides() {
|
||||
"/run/identity-token".to_string(),
|
||||
),
|
||||
(
|
||||
"Codex_Exec_Server_Noise_Auth_Token".to_string(),
|
||||
"Akode_Exec_Server_Noise_Auth_Token".to_string(),
|
||||
"configured-noise-token".to_string(),
|
||||
),
|
||||
]),
|
||||
@@ -110,7 +110,7 @@ fn command_scrubber_removes_names_from_real_child_environment() {
|
||||
.args([TEST_NAME, "--exact", "--nocapture"])
|
||||
.env(CHILD_MODE_ENV_VAR, "1")
|
||||
.env(
|
||||
"Codex_Guardian_Decisions_Api_Key",
|
||||
"Akode_Guardian_Decisions_Api_Key",
|
||||
"synthetic-inherited-key",
|
||||
)
|
||||
.env("Node_Repl_Auth_Token", "inherited-token")
|
||||
@@ -120,7 +120,7 @@ fn command_scrubber_removes_names_from_real_child_environment() {
|
||||
r#"{"instance_id":"box-one"}"#,
|
||||
)
|
||||
.env(
|
||||
"Codex_Exec_Server_Noise_Auth_Token",
|
||||
"Akode_Exec_Server_Noise_Auth_Token",
|
||||
"inherited-noise-token",
|
||||
)
|
||||
.output()
|
||||
|
||||
Reference in New Issue
Block a user