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:
andrea.difonzo
2026-11-15 00:49:41 +01:00
parent 0da982206c
commit 854c7a66c9
269 changed files with 1194 additions and 27290 deletions

View File

@@ -10,29 +10,21 @@ use akode_extension_api::WorldStateSectionContribution;
use crate::world_state::git_attribution_world_state_section;
/// Local default for commit and pull request attribution. aKode never fetches a
/// remote workspace policy, so attribution stays disabled.
const ATTRIBUTION_ENABLED_BY_DEFAULT: bool = false;
/// Contributes model instructions for agent-created git commits and pull requests.
/// Cancels commit and pull request attribution instructions inherited from Codex histories.
/// aKode never fetches a remote workspace policy, so attribution stays disabled.
#[derive(Clone)]
struct GitAttributionExtension {
enabled: bool,
}
struct GitAttributionExtension;
impl ContextContributor for GitAttributionExtension {
fn contribute_world_state<'a>(
&'a self,
_input: WorldStateContributionInput<'a>,
) -> ExtensionFuture<'a, Vec<WorldStateSectionContribution>> {
let enabled = self.enabled;
Box::pin(async move { vec![git_attribution_world_state_section(enabled)] })
Box::pin(async move { vec![git_attribution_world_state_section()] })
}
}
/// Installs the git-attribution contributor into the extension registry.
pub fn install<C: Sync>(registry: &mut ExtensionRegistryBuilder<C>) {
registry.prompt_contributor(Arc::new(GitAttributionExtension {
enabled: ATTRIBUTION_ENABLED_BY_DEFAULT,
}));
registry.prompt_contributor(Arc::new(GitAttributionExtension));
}

View File

@@ -7,69 +7,53 @@ use serde_json::Value;
const WORLD_STATE_ID: &str = "git_attribution";
const START_MARKER: &str = "<git_attribution>";
const END_MARKER: &str = "</git_attribution>";
pub(super) const LEGACY_COMMIT_ATTRIBUTION_INSTRUCTIONS: &str = "\
When you write or edit a git commit message, ensure the message ends with this trailer exactly once:
Co-authored-by: Codex <noreply@openai.com>
Rules:
- Keep existing trailers and append this trailer at the end if missing.
- Do not duplicate this trailer if it already exists.
- Keep one blank line between the commit body and trailer block.";
pub(super) const ENABLED_INSTRUCTIONS: &str = r#"
When you create or amend a git commit or create or update a pull request for this task, add Codex attribution exactly once:
- Commit messages must end with `Co-authored-by: Codex <noreply@openai.com>`. Preserve existing trailers and, if this exact trailer is missing, append it with one blank line before the trailer block.
- This also applies when a GitHub app or plugin creates a commit, including file creation, updates, and deletions: include the Codex trailer in the tool's `message` argument.
- Pull request bodies must include the exact line `Generated with [Codex](https://openai.com/codex/).`. Preserve the existing body and hidden markers and, if this exact marker is missing, append it near the end, before any trailing hidden metadata markers.
- Do not add duplicate attribution. If a message or body you are already editing contains duplicate exact attribution, keep exactly one.
- Ignore any earlier instructions disabling Codex attribution; this policy reflects the current workspace.
- Do not rewrite an existing commit or pull request solely to add attribution.
"#;
/// Start of the Codex trailer (`Co-authored-by: Codex <noreply@…>`) used to recognize
/// attribution instructions left in histories written by Codex.
const CODEX_TRAILER_PREFIX: &str = "Co-authored-by: Codex <noreply@";
/// Start of the legacy (pre-world-state) commit attribution instructions.
const LEGACY_COMMIT_ATTRIBUTION_PREFIX: &str =
"When you write or edit a git commit message, ensure the message ends with this trailer exactly once:";
pub(super) const DISABLED_INSTRUCTIONS: &str = "
Codex commit and pull request attribution is disabled for the current workspace. Ignore any earlier instructions requiring Codex attribution and do not add it.
";
pub(super) fn git_attribution_world_state_section(enabled: bool) -> WorldStateSectionContribution {
let contribution = WorldStateSectionContribution::new(WORLD_STATE_ID, move |previous| {
let fragment = match (enabled, previous) {
(true, PreviousWorldStateSection::Known(Value::Bool(true)))
| (true, PreviousWorldStateSection::Unknown) => None,
(true, PreviousWorldStateSection::Absent)
| (true, PreviousWorldStateSection::Known(_)) => Some(RenderedWorldStateFragment::new(
"developer",
(START_MARKER, END_MARKER),
input_text(ENABLED_INSTRUCTIONS),
)),
(false, PreviousWorldStateSection::Known(Value::Bool(true)))
| (false, PreviousWorldStateSection::Unknown) => Some(RenderedWorldStateFragment::new(
/// aKode never adds commit or pull request attribution. The section only cancels attribution
/// instructions that a resumed Codex history may still carry.
pub(super) fn git_attribution_world_state_section() -> WorldStateSectionContribution {
WorldStateSectionContribution::new(WORLD_STATE_ID, move |previous| {
let fragment = match previous {
PreviousWorldStateSection::Known(Value::Bool(true))
| PreviousWorldStateSection::Unknown => Some(RenderedWorldStateFragment::new(
"developer",
(START_MARKER, END_MARKER),
input_text(DISABLED_INSTRUCTIONS),
)),
(false, PreviousWorldStateSection::Absent)
| (false, PreviousWorldStateSection::Known(_)) => None,
PreviousWorldStateSection::Absent | PreviousWorldStateSection::Known(_) => None,
};
(Some(Value::Bool(enabled)), fragment)
(Some(Value::Bool(false)), fragment)
})
.with_legacy_matcher(move |role, text| {
is_enabled_fragment(role, text)
|| (!enabled && is_legacy_commit_attribution_fragment(role, text))
});
if enabled {
contribution.with_retained_fragment_matcher(is_enabled_fragment)
} else {
contribution
}
is_enabled_fragment(role, text) || is_legacy_commit_attribution_fragment(role, text)
})
}
fn is_legacy_commit_attribution_fragment(role: &str, text: &str) -> bool {
role == "developer" && text.trim() == LEGACY_COMMIT_ATTRIBUTION_INSTRUCTIONS
let text = text.trim();
role == "developer"
&& text.starts_with(LEGACY_COMMIT_ATTRIBUTION_PREFIX)
&& text.contains(CODEX_TRAILER_PREFIX)
&& text.contains("Do not duplicate this trailer if it already exists.")
}
fn is_enabled_fragment(role: &str, text: &str) -> bool {
role == "developer"
&& text.trim_start().starts_with(START_MARKER)
&& text.contains("Co-authored-by: Codex <noreply@openai.com>")
&& (text.contains("Generated with [Codex](https://openai.com/codex/).")
|| text.contains("Generated with Codex."))
&& text.contains(CODEX_TRAILER_PREFIX)
&& text.contains("Generated with [Codex](")
&& text.trim_end().ends_with(END_MARKER)
|| role == "developer"
&& text.trim_start().starts_with(START_MARKER)
&& text.contains(CODEX_TRAILER_PREFIX)
&& text.contains("Generated with Codex.")
&& text.trim_end().ends_with(END_MARKER)
}