[Windows] Memory consolidation is rejected when memory_summary.md starts with a UTF-8 byte-order mark

Aperta Adatta ai principianti
#58,666 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
1/5
Tempo stimato
Meno di un'ora
Idoneità per principianti
82/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
powershell, rust
Ambito
backend

Direzione di ricerca

Il controllo si trova in codex-rs/memories/write/src/workspace.rs, in validate_consolidation_artifacts_for_version, dove summary.lines().next() viene confrontato con "v1", e is_valid_v2_summary ripete lo stesso confronto. Rimuovi un U+FEFF iniziale dal testo del riepilogo prima di ogni confronto della prima riga, poi aggiungi un test che scriva un riepilogo con BOM e verifichi che la validazione passi. È completato quando entrambi i controlli accettano un file che inizia con il BOM e i test esistenti continuano a passare.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug memory windows-os
What happens

On Windows, memory consolidation fails every time with:

memory summary artifact does not start with v1: <codex_home>\memories\memory_summary.md
memory consolidation artifacts are invalid

The consolidation agent writes memory_summary.md through its shell tool, which on Windows is Windows PowerShell 5.1. In PowerShell 5.1 Set-Content -Encoding UTF8, Out-File -Encoding UTF8 and > write a UTF-8 byte-order mark (or UTF-16), so the file's first bytes are EF BB BF 76 31 0A ("\u{FEFF}v1\n"). The file's content is correct; only the invisible first character differs.

The check that rejects it

codex-rs/memories/write/src/workspace.rs (tag rust-v0.166.0, validate_consolidation_artifacts_for_version, around line 101-108):

let summary = tokio::fs::read_to_string(&summary_path).await ...;
anyhow::ensure!(
    summary.lines().next() == Some("v1"),
    "memory summary artifact does not start with v1: {}",
    summary_path.display()
);

read_to_string keeps U+FEFF, so lines().next() is "\u{FEFF}v1", not "v1". is_valid_v2_summary in the same file repeats the same first-line comparison.

Suggested fix

Strip an optional BOM before the comparison, in both places, e.g. let summary = summary.strip_prefix('\u{FEFF}').unwrap_or(&summary);. Nothing else needs to change; the model cannot be relied on to choose a BOM-free write on Windows (we worked around it for a while with an instruction in a memory extension, which only helps when the model follows it).

Environment

Windows 11, Windows PowerShell 5.1 as the shell, memories enabled, embedding app-server. Reproduces on a fresh memory (consolidation INIT phase).

Lingua principale
Rust
Stelle
131k
Fork
20.7k
Merge medio
1m
PR unite (30g)
997

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di openai/codex

Tutte le issue di openai/codex

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.