aKode: rimossa la memoria nativa di Codex e le funzioni senza codice; meno chiamate al modello
Memoria nativa (memories) rimossa del tutto: - features: memories, memory_tool, external_agent_memory_import, chronicle (alias telepathy) diventano Removed; le chiavi restano accettate e memories/memory_tool/[memories] producono un solo avviso senza link («La sezione [memories] e la chiave memory_tool non sono più usate da aKode: la memoria a lungo termine è il plugin memoria di imeAI.»). - Tolti i crate memories/read, memories/write ed ext/memories, l'avvio della pipeline a ogni turno (app-server), l'estensione, /memories e la richiesta di attivazione nella TUI, `akode debug clear-memories`, l'importazione delle memorie da altri agenti (memory_import.rs, detect/memory.rs; il resto di /import resta). - core: niente più MemoriesConfig, citazioni delle memorie, metriche e marcatura «polluted» dei thread; [memories] (MemoriesToml) resta solo come sezione accettata e ignorata. - state: memories_1.sqlite e memories_v2_1.sqlite non vengono più aperti né cancellati; la colonna threads.memory_mode resta, nessuna migrazione. - Protocollo app-server invariato per compatibilità col daemon: memory/reset risponde «non supportato» senza cancellare nulla, memory/status non è mai pronto, thread/memory/read non ha riassunto. Altre rimozioni: - I 14 flag dell'app desktop di OpenAI senza codice (tool_suggest, in_app_*, browser_use*, computer_use, bedrock_setup_wizard, workspace_dependencies) e analytics_plan_history: Removed, chiavi accettate; analytics_plan_history esce da /experimental. - Skill: tolto l'esperimento «shadow selection» e i selettori collegati. Meno chiamate al modello non richieste: - Titoli dei thread: il primo messaggio dell'utente su una riga, troncato a 36 caratteri; `[tui] auto_title = true` riattiva i titoli generati. - `[tui] auto_recap` predefinito false; `goals` spento di default. Privacy: installation_id e gli id di sessione/thread/finestra (e il blocco dei metadati del turno che li ripete) vanno in client_metadata e negli header di compatibilità solo ai provider locali (loopback, IP privati 10/8, 172.16/12, 192.168/16, host .local/.lan). Domini OpenAI: tolti i link visibili (avviso dei flag deprecati, profili, bubblewrap), l'attribuzione Codex nei commit (sempre spenta), la riscrittura dell'URL della documentazione OpenAI via MCP e la registrazione remota dell'exec-server verso host OpenAI (ora solo loopback); il riconoscimento delle destinazioni OpenAI confronta i domini etichetta per etichetta. Il binario non contiene più «openai.com» né «chatgpt.com». Test adattati (sicurezza compresa: guardian, ruolo ostile, exec-server ora più restrittivo); rimossi solo quelli del codice tolto. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -59,7 +59,6 @@ akode-install-context = { workspace = true }
|
||||
akode-update = { workspace = true }
|
||||
akode-login = { workspace = true }
|
||||
akode-model-provider-info = { workspace = true }
|
||||
akode-memories-write = { workspace = true }
|
||||
akode-mcp = { workspace = true }
|
||||
akode-model-provider = { workspace = true }
|
||||
akode-models-manager = { workspace = true }
|
||||
|
||||
@@ -15,7 +15,6 @@ use akode_exec::ReviewArgs;
|
||||
use akode_execpolicy::ExecPolicyCheckCommand;
|
||||
use akode_rollout_trace::REDUCED_STATE_FILE_NAME;
|
||||
use akode_rollout_trace::replay_bundle;
|
||||
use akode_state::StateRuntime;
|
||||
use akode_tui::AppExitInfo;
|
||||
use akode_tui::Cli as TuiCli;
|
||||
use akode_tui::ExitReason;
|
||||
@@ -85,7 +84,6 @@ use akode_features::Stage;
|
||||
use akode_features::is_known_feature_key;
|
||||
use akode_home::CodexHomeUserInstructionsProvider;
|
||||
use akode_login::AuthManager;
|
||||
use akode_memories_write::clear_memory_roots_contents;
|
||||
use akode_models_manager::bundled_models_response;
|
||||
use akode_models_manager::manager::RefreshStrategy;
|
||||
use akode_protocol::protocol::AskForApproval;
|
||||
@@ -236,10 +234,6 @@ enum DebugSubcommand {
|
||||
/// Replay a rollout trace bundle and write reduced state JSON.
|
||||
#[clap(hide = true)]
|
||||
TraceReduce(DebugTraceReduceCommand),
|
||||
|
||||
/// Internal: reset local memory state for a fresh start.
|
||||
#[clap(hide = true)]
|
||||
ClearMemories,
|
||||
}
|
||||
|
||||
#[derive(Debug, Parser)]
|
||||
@@ -1637,14 +1631,6 @@ async fn dispatch_cli(
|
||||
)?;
|
||||
run_debug_trace_reduce_command(cmd).await?;
|
||||
}
|
||||
DebugSubcommand::ClearMemories => {
|
||||
reject_remote_mode_for_subcommand(
|
||||
root_remote.as_deref(),
|
||||
root_remote_auth_token_env.as_deref(),
|
||||
"debug clear-memories",
|
||||
)?;
|
||||
run_debug_clear_memories_command(&root_config_overrides).await?;
|
||||
}
|
||||
},
|
||||
Some(Subcommand::Execpolicy(ExecpolicyCommand { sub })) => match sub {
|
||||
ExecpolicySubcommand::Check(cmd) => {
|
||||
@@ -1924,9 +1910,6 @@ async fn run_debug_prompt_input_command(
|
||||
.enabled(akode_features::Feature::OmitSkillDescriptions),
|
||||
max_context_tokens: config.skill_max_context_tokens,
|
||||
bundled_skills_enabled: config.bundled_skills_enabled(),
|
||||
shadow_selection_enabled: config
|
||||
.features
|
||||
.enabled(akode_features::Feature::SkillSearch),
|
||||
}
|
||||
});
|
||||
let prompt_input = akode_core::build_prompt_input(
|
||||
@@ -1972,38 +1955,6 @@ async fn run_debug_models_command(
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn run_debug_clear_memories_command(
|
||||
root_config_overrides: &CliConfigOverrides,
|
||||
) -> anyhow::Result<()> {
|
||||
let cli_kv_overrides = root_config_overrides
|
||||
.parse_overrides()
|
||||
.map_err(anyhow::Error::msg)?;
|
||||
let config = ConfigBuilder::default()
|
||||
.cli_overrides(cli_kv_overrides)
|
||||
.build()
|
||||
.await?;
|
||||
|
||||
let memories_path = config.sqlite_config().memories_db_path();
|
||||
let cleared_memories_db =
|
||||
StateRuntime::clear_memory_data_in_sqlite_home(config.sqlite_config()).await?;
|
||||
|
||||
clear_memory_roots_contents(&config.codex_home).await?;
|
||||
|
||||
let mut message = if cleared_memories_db {
|
||||
format!("Cleared memory state from {}.", memories_path.display())
|
||||
} else {
|
||||
format!("No memories db found at {}.", memories_path.display())
|
||||
};
|
||||
message.push_str(&format!(
|
||||
" Cleared memory directories under {}.",
|
||||
config.codex_home.display()
|
||||
));
|
||||
|
||||
println!("{message}");
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Prepend root-level overrides so they have lower precedence than
|
||||
/// CLI-specific ones specified after the subcommand (if any).
|
||||
fn prepend_config_flags(
|
||||
|
||||
@@ -1,185 +0,0 @@
|
||||
use std::path::Path;
|
||||
|
||||
use akode_state::StateRuntime;
|
||||
use akode_utils_absolute_path::test_support::PathExt;
|
||||
use anyhow::Result;
|
||||
use predicates::str::contains;
|
||||
use tempfile::TempDir;
|
||||
|
||||
fn codex_command(codex_home: &Path) -> Result<assert_cmd::Command> {
|
||||
let mut cmd = assert_cmd::Command::new(akode_utils_cargo_bin::cargo_bin("akode")?);
|
||||
cmd.env("AKODE_HOME", codex_home);
|
||||
Ok(cmd)
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn debug_clear_memories_resets_state_and_removes_memory_dir() -> Result<()> {
|
||||
let codex_home = TempDir::new()?;
|
||||
let sqlite = akode_state::SqliteConfig::new_for_testing(codex_home.path().abs());
|
||||
let runtime = StateRuntime::init(sqlite.clone(), "test-provider".to_string()).await?;
|
||||
runtime.close().await;
|
||||
|
||||
let thread_id = "00000000-0000-0000-0000-000000000123";
|
||||
let db_path = sqlite.state_db_path();
|
||||
let pool = sqlite.open_read_write_pool(&db_path).await?;
|
||||
let memories_db_path = sqlite.memories_db_path();
|
||||
let memories_pool = sqlite.open_read_write_pool(&memories_db_path).await?;
|
||||
|
||||
sqlx::query(
|
||||
r#"
|
||||
INSERT INTO threads (
|
||||
id,
|
||||
rollout_path,
|
||||
created_at,
|
||||
updated_at,
|
||||
source,
|
||||
agent_nickname,
|
||||
agent_role,
|
||||
model_provider,
|
||||
cwd,
|
||||
cli_version,
|
||||
title,
|
||||
sandbox_policy,
|
||||
approval_mode,
|
||||
tokens_used,
|
||||
first_user_message,
|
||||
archived,
|
||||
archived_at,
|
||||
git_sha,
|
||||
git_branch,
|
||||
git_origin_url,
|
||||
memory_mode
|
||||
) VALUES (?, ?, 1, 1, 'cli', NULL, NULL, 'test-provider', ?, '', '', 'read-only', 'on-request', 0, '', 0, NULL, NULL, NULL, NULL, 'enabled')
|
||||
"#,
|
||||
)
|
||||
.bind(thread_id)
|
||||
.bind(codex_home.path().join("session.jsonl").display().to_string())
|
||||
.bind(codex_home.path().display().to_string())
|
||||
.execute(&pool)
|
||||
.await?;
|
||||
|
||||
sqlx::query(
|
||||
r#"
|
||||
INSERT INTO stage1_outputs (
|
||||
thread_id,
|
||||
source_updated_at,
|
||||
raw_memory,
|
||||
rollout_summary,
|
||||
generated_at,
|
||||
rollout_slug,
|
||||
usage_count,
|
||||
last_usage,
|
||||
selected_for_phase2,
|
||||
selected_for_phase2_source_updated_at
|
||||
) VALUES (?, 1, 'raw', 'summary', 1, NULL, 0, NULL, 0, NULL)
|
||||
"#,
|
||||
)
|
||||
.bind(thread_id)
|
||||
.execute(&memories_pool)
|
||||
.await?;
|
||||
|
||||
sqlx::query(
|
||||
r#"
|
||||
INSERT INTO jobs (
|
||||
kind,
|
||||
job_key,
|
||||
status,
|
||||
worker_id,
|
||||
ownership_token,
|
||||
started_at,
|
||||
finished_at,
|
||||
lease_until,
|
||||
retry_at,
|
||||
retry_remaining,
|
||||
last_error,
|
||||
input_watermark,
|
||||
last_success_watermark
|
||||
) VALUES
|
||||
('memory_stage1', ?, 'completed', NULL, NULL, NULL, NULL, NULL, NULL, 3, NULL, NULL, 1),
|
||||
('memory_consolidate_global', 'global', 'completed', NULL, NULL, NULL, NULL, NULL, NULL, 3, NULL, NULL, 1)
|
||||
"#,
|
||||
)
|
||||
.bind(thread_id)
|
||||
.execute(&memories_pool)
|
||||
.await?;
|
||||
|
||||
let memory_root = codex_home.path().join("memories");
|
||||
std::fs::create_dir_all(&memory_root)?;
|
||||
std::fs::write(memory_root.join("memory_summary.md"), "stale memory")?;
|
||||
pool.close().await;
|
||||
memories_pool.close().await;
|
||||
|
||||
let mut cmd = codex_command(codex_home.path())?;
|
||||
cmd.args(["debug", "clear-memories"])
|
||||
.assert()
|
||||
.success()
|
||||
.stdout(contains("Cleared memory state"));
|
||||
|
||||
let pool = sqlite.open_read_write_pool(&memories_db_path).await?;
|
||||
let stage1_outputs_count: i64 = sqlx::query_scalar("SELECT COUNT(*) FROM stage1_outputs")
|
||||
.fetch_one(&pool)
|
||||
.await?;
|
||||
assert_eq!(stage1_outputs_count, 0);
|
||||
|
||||
let memory_jobs_count: i64 = sqlx::query_scalar(
|
||||
"SELECT COUNT(*) FROM jobs WHERE kind = 'memory_stage1' OR kind = 'memory_consolidate_global'",
|
||||
)
|
||||
.fetch_one(&pool)
|
||||
.await?;
|
||||
assert_eq!(memory_jobs_count, 0);
|
||||
assert!(memory_root.exists());
|
||||
assert_eq!(std::fs::read_dir(memory_root)?.count(), 0);
|
||||
pool.close().await;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn debug_clear_memories_resets_memories_db_without_state_db() -> Result<()> {
|
||||
let codex_home = TempDir::new()?;
|
||||
let sqlite = akode_state::SqliteConfig::new_for_testing(codex_home.path().abs());
|
||||
let runtime = StateRuntime::init(sqlite.clone(), "test-provider".to_string()).await?;
|
||||
runtime.close().await;
|
||||
|
||||
let db_path = sqlite.state_db_path();
|
||||
let memories_db_path = sqlite.memories_db_path();
|
||||
let memories_pool = sqlite.open_read_write_pool(&memories_db_path).await?;
|
||||
|
||||
sqlx::query(
|
||||
r#"
|
||||
INSERT INTO stage1_outputs (
|
||||
thread_id,
|
||||
source_updated_at,
|
||||
raw_memory,
|
||||
rollout_summary,
|
||||
generated_at,
|
||||
rollout_slug,
|
||||
usage_count,
|
||||
last_usage,
|
||||
selected_for_phase2,
|
||||
selected_for_phase2_source_updated_at
|
||||
) VALUES ('00000000-0000-0000-0000-000000000123', 1, 'raw', 'summary', 1, NULL, 0, NULL, 0, NULL)
|
||||
"#,
|
||||
)
|
||||
.execute(&memories_pool)
|
||||
.await?;
|
||||
|
||||
memories_pool.close().await;
|
||||
std::fs::remove_file(&db_path)?;
|
||||
|
||||
let mut cmd = codex_command(codex_home.path())?;
|
||||
cmd.args(["debug", "clear-memories"])
|
||||
.assert()
|
||||
.success()
|
||||
.stdout(contains("Cleared memory state"));
|
||||
|
||||
let pool = sqlite.open_read_write_pool(&memories_db_path).await?;
|
||||
let stage1_outputs_count: i64 = sqlx::query_scalar("SELECT COUNT(*) FROM stage1_outputs")
|
||||
.fetch_one(&pool)
|
||||
.await?;
|
||||
assert_eq!(stage1_outputs_count, 0);
|
||||
pool.close().await;
|
||||
assert!(!db_path.exists());
|
||||
|
||||
Ok(())
|
||||
}
|
||||
Reference in New Issue
Block a user