Skip to content

feat(core): add multi-language FeedbackDetector support (#1424)#2060

Merged
bug-ops merged 4 commits intomainfrom
feat-1424-multilang-feedback
Mar 20, 2026
Merged

feat(core): add multi-language FeedbackDetector support (#1424)#2060
bug-ops merged 4 commits intomainfrom
feat-1424-multilang-feedback

Conversation

@bug-ops
Copy link
Copy Markdown
Owner

@bug-ops bug-ops commented Mar 20, 2026

Summary

Add multi-language support to FeedbackDetector for self-learning feedback detection across Russian, Spanish, German, French, Chinese (Simplified), and Japanese.

Changes

  • Data structure: Replace 3 separate LazyLock<Vec<Regex>> with LangPatterns struct using Vec<(Regex, f32)> tuples for per-pattern confidence
  • Patterns: 6 languages × 3 correction kinds (ExplicitRejection, AlternativeRequest, SelfCorrection) = 18 pattern sets
  • Dual anchoring strategy: Anchored patterns at base confidence (0.85/0.70/0.80), unanchored variants at -0.10 for mid-sentence feedback
  • Tests: 137 test cases with mandatory false-positive guards per language
  • No config/CLI/TUI changes: Feature is transparent to users

Architecture

  • Single file change: crates/zeph-core/src/agent/feedback_detector.rs (+887 lines)
  • No new dependencies
  • <1ms performance overhead per message
  • Preserves existing English pattern behavior

Test Results

  • 137 tests: all pass (132 core + 5 M-2 English edge cases)
  • 5657 workspace tests: all pass, no regressions
  • All mandatory false-positive guards verified
  • Edge cases: mixed-language, CJK boundaries, transliteration

Known Limitations

  • CJK repetition detection unavailable (whitespace tokenization failure) — filed as follow-up issue
  • CJK unanchored pattern false-positive risk — documented and mitigated
  • Judge rate-limit starvation for unsupported languages — documented

Validation

  • ✅ Architecture approved (v2)
  • ✅ Security audit: no issues
  • ✅ Test coverage: 137 tests, comprehensive
  • ✅ Implementation critique: all issues fixed
  • ✅ Code review: approved

Closes #1424

bug-ops added 2 commits March 20, 2026 17:34
Replace 3 separate LazyLock<Vec<Regex>> statics with a single LangPatterns
struct using Vec<(Regex, f32)> tuples for per-pattern confidence.

Add regex patterns for Russian, Spanish, German, French, Chinese, and Japanese
across all three correction categories (rejection, alternative, self-correction).

Dual anchoring strategy: anchored patterns at base confidence (0.85/0.80/0.70),
unanchored mid-sentence patterns at -0.10 (0.75/0.70/0.65). Principle 1 applied
consistently: no bare ambiguous short words (Spanish "no", French "non", English
"no" when followed by neutral content) without a rejection qualifier.

Add 132 tests covering 7 languages x 3 categories with positive and negative
(false-positive guard) cases including all mandatory cases from architect-1424.md.
H-1: Fix Japanese chigau test assertion — replace silent if-let with
explicit assert!(signal.is_some()) documenting the known CJK word
segmentation limitation.

M-1: Add comment explaining English unanchored patterns retain 0.85
(multi-word guards carry equal signal strength regardless of position).

M-2: Add 5 English "no" tightening guard tests — no worries/problem/thanks
must not match; bare "no" and "no." must match.

docs: add CHANGELOG.md entry under [Unreleased] ### Added for #1424.
@github-actions github-actions bot added documentation Improvements or additions to documentation rust Rust code changes core zeph-core crate enhancement New feature or request size/XL Extra large PR (500+ lines) labels Mar 20, 2026
bug-ops added 2 commits March 20, 2026 20:01
Replace Vec::new() with Vec::with_capacity() in build_*_patterns()
functions to avoid clippy warning 'calls to push immediately after
creation'. Estimated capacities: rejection (25), alternative (20),
self_correction (20).
@bug-ops bug-ops enabled auto-merge (squash) March 20, 2026 19:05
@bug-ops bug-ops merged commit 6d7273d into main Mar 20, 2026
25 checks passed
@bug-ops bug-ops deleted the feat-1424-multilang-feedback branch March 20, 2026 19:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core zeph-core crate documentation Improvements or additions to documentation enhancement New feature or request rust Rust code changes size/XL Extra large PR (500+ lines)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FeedbackDetector only supports English language patterns

1 participant