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:
@@ -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