TUI: Case-insensitive fuzzy matcher rejects exact Greek display-name queries due to inconsistent lowercase normalization
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 72/100
Direzione di ricerca
Il bug si trova nella normalizzazione di haystack e needle in codex-rs/utils/fuzzy-match/src/lib.rs, intorno alle righe 17-26, dove i due lati vengono convertiti in minuscolo in modo diverso. Inizia eseguendo il modulo di test esistente in quel punto, poi aggiungi il test segnalato exact_greek_uppercase_query_matches per vederlo fallire. È completato quando entrambi i lati usano lo stesso trattamento di minuscolo carattere per carattere, la sigma finale viene ricondotta alla sigma ordinaria, la mappatura originale degli indici viene preservata e i test sulle varianti della sigma e i test esistenti passano.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
What issue are you seeing?
The shared codex_utils_fuzzy_match::fuzzy_match implementation can return None when a query exactly matches its original display name. The haystack is lowercased character by character, but the needle is lowercased as a complete string. These operations differ for context-dependent Unicode casing, notably Greek capital sigma.
TUI mention and skill selection candidates with affected Greek display names can disappear from filtered results unless an alternative search term matches.
Version and environment
Source reviewed on main at commit ae21235afbd5ba6556c2ab4b64f6afc96a139ef8. The faulty normalization was also rechecked on the current main branch before submission.
This is a source-level finding. No released CLI version or end-to-end terminal session was tested. Model and subscription are not relevant to the matcher itself.
What steps can reproduce the bug?
Add this regression test to the existing test module in codex-rs/utils/fuzzy-match/src/lib.rs:
#[test]
fn exact_greek_uppercase_query_matches() {
assert_eq!(
fuzzy_match("ΟΣ", "ΟΣ"),
Some((vec![0, 1], -100))
);
}
From the codex-rs directory:
cargo test -p codex-utils-fuzzy-match exact_greek_uppercase_query_matches
The current algorithm returns None because the haystack normalizes to οσ and the needle to ος, even though the original strings are identical.
Expected behavior
An exact display-name query should match, returning the original character indices and existing prefix-match score: Some((vec![0, 1], -100)). The three Greek sigma variants should also compare consistently in case-insensitive searches.
Root cause
utils/fuzzy-match/src/lib.rs:17–26 normalizes the haystack using:
for (orig_idx, ch) in haystack.chars().enumerate() {
for lc in ch.to_lowercase() {
lowered_chars.push(lc);
lowered_to_orig_char_idx.push(orig_idx);
}
}
But the query uses:
let lowered_needle: Vec<char> = needle.to_lowercase().chars().collect();
Rust's string-level lowercase conversion handles the contextual final sigma rule, whereas character-level conversion does not. See the standard library documentation.
Relevant callers include mentions_v2/filter.rs:23–61 and multi_select_picker.rs:902–916.
Related reports
- #60589 reports a similar defect in the separate
thread/searchOccurrencesimplementation. - #60759 fixes that implementation but does not modify this shared fuzzy matcher.
- #45241 concerns scoring during multi-character lowercase expansion, not exact-match rejection.
Searches of issues and pull requests for fuzzy matching, Greek casing, sigma, and the affected normalization did not identify a direct duplicate.
Validation
A standalone Python translation of the current matching algorithm reproduced the exact-match failure. With the proposed normalization below, all 18 sigma-variant assertions and 10 control assertions derived from existing repository tests passed. This is algorithm-level validation, not a compiled Rust test result. A Rust toolchain was unavailable in the review environment, so the Cargo regression test has not been executed.
Proposed resolution
Use the same context-independent normalization on both sides, mapping final sigma to ordinary lowercase sigma. This preserves the existing original-character index mapping and does not require additional dependencies.
Add a helper:
fn fold_search_char(ch: char) -> impl Iterator<Item = char> {
ch.to_lowercase().map(|lower| match lower {
'ς' => 'σ',
other => other,
})
}
Use it for the haystack:
for (orig_idx, ch) in haystack.chars().enumerate() {
for lc in fold_search_char(ch) {
lowered_chars.push(lc);
lowered_to_orig_char_idx.push(orig_idx);
}
}
And for the needle:
let lowered_needle: Vec<char> = needle
.chars()
.flat_map(fold_search_char)
.collect();
Add regression coverage for all sigma variants and their original highlighting indices:
#[test]
fn greek_sigma_variants_match_consistently() {
for haystack in ["ΟΣ", "οσ", "ος"] {
for needle in ["ΟΣ", "οσ", "ος"] {
assert_eq!(
fuzzy_match(haystack, needle),
Some((vec![0, 1], -100))
);
}
for needle in ["Σ", "σ", "ς"] {
assert_eq!(
fuzzy_match(haystack, needle),
Some((vec![1], 0))
);
}
}
}
This is a deliberately narrow correction that avoids changing unrelated fuzzy-matching semantics (including the existing sharp-s test). A broader Unicode case-folding refactor similar to #60759 could be considered separately.
- Lingua principale
- Rust
- Stelle
- 136k
- Fork
- 21.5k
- Merge medio
- 1m
- PR unite (30g)
- 998
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di openai/codex
-
bug CLI performance
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
app bug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
Windows data plugin feedbackApertaapp bug skills windows-os
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
I maintainer di solito rispondono entro 1 giorno
-
app-server bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
openai/codex#63732 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
app bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di openai/codex
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
libracoder/kiri#935 ·
I maintainer di solito rispondono entro 1 giorno
-
Node's `index.d.ts` declares no constructor for `VirtxError`, so TypeScript rejects its argumentsAperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
kashsuks/Pinel#172 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno