Rinomina: crate akode-*, cartelle akode-rs/ e akode-cli/, binario akode, ~/.akode, AKODE_* (A)
Riapplica la fase 5 di aKode (86e7c72e) sulla base ripulita:
- crate codex-* -> akode-*, codex-rs -> akode-rs, codex-cli -> akode-cli, binario e ausiliari akode;
- ~/.codex -> ~/.akode, CODEX_HOME -> AKODE_HOME, variabili CODEX_* -> AKODE_*, .codex/ -> .akode/ di progetto;
nessun fallback a ~/.codex o a CODEX_*;
- testi per l'utente "Codex" -> "aKode"; testi verso il modello e istruzioni di sistema invariati;
- snapshot insta rinominati (non ancora rigenerati).
I conflitti con la base ripulita sono stati risolti riapplicando la rinomina ai file senza le
funzioni di imeAI (script di mappa dei token per file).
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
73
akode-rs/core/src/compact_model_fallback.rs
Normal file
73
akode-rs/core/src/compact_model_fallback.rs
Normal file
@@ -0,0 +1,73 @@
|
||||
use crate::compaction_metadata::CompactionImplementation;
|
||||
use crate::compaction_metadata::CompactionReason;
|
||||
use crate::session::turn_context::TurnContext;
|
||||
use akode_otel::SessionTelemetry;
|
||||
use akode_protocol::error::CodexErr;
|
||||
use akode_protocol::error::CodexErrorDetails;
|
||||
use tracing::warn;
|
||||
|
||||
/// Returns whether a failed compaction attempt should use the current model.
|
||||
pub(crate) fn should_retry_with_current_model(
|
||||
error: &CodexErr,
|
||||
previous: &TurnContext,
|
||||
current: &TurnContext,
|
||||
) -> bool {
|
||||
if matches!(
|
||||
error.details(),
|
||||
CodexErrorDetails::TurnAborted
|
||||
| CodexErrorDetails::Interrupted
|
||||
| CodexErrorDetails::SessionBudgetExceeded
|
||||
| CodexErrorDetails::ResponseIncomplete(_)
|
||||
) || previous.model_info().slug == current.model_info().slug
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Model fallback during compaction relied on OpenAI's API-key catalog; no
|
||||
// aKode provider supports it.
|
||||
let _ = current;
|
||||
false
|
||||
}
|
||||
|
||||
pub(crate) fn record_model_fallback(
|
||||
session_telemetry: &SessionTelemetry,
|
||||
previous_model: &str,
|
||||
current_model: &str,
|
||||
reason: CompactionReason,
|
||||
implementation: CompactionImplementation,
|
||||
fallback_error: Option<&CodexErr>,
|
||||
) {
|
||||
let reason_tag = match reason {
|
||||
CompactionReason::UserRequested => "user_requested",
|
||||
CompactionReason::ContextLimit => "context_limit",
|
||||
CompactionReason::ModelDownshift => "model_downshift",
|
||||
CompactionReason::CompHashChanged => "comp_hash_changed",
|
||||
};
|
||||
let implementation_tag = match implementation {
|
||||
CompactionImplementation::Responses => "responses",
|
||||
CompactionImplementation::ResponsesCompactionV2 => "responses_compaction_v2",
|
||||
};
|
||||
let outcome = if fallback_error.is_none() {
|
||||
"succeeded"
|
||||
} else {
|
||||
"failed"
|
||||
};
|
||||
session_telemetry.counter(
|
||||
"codex.compaction.model_fallback",
|
||||
/*inc*/ 1,
|
||||
&[
|
||||
("reason", reason_tag),
|
||||
("implementation", implementation_tag),
|
||||
("outcome", outcome),
|
||||
],
|
||||
);
|
||||
warn!(
|
||||
previous_model,
|
||||
current_model,
|
||||
?reason,
|
||||
?implementation,
|
||||
outcome,
|
||||
?fallback_error,
|
||||
"previous-model compaction failed; retried with current model"
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user