fix(write-gate): make decision/error/success bypass cues language-aware - #161
Merged
Conversation
The bypass heuristics in determine_bypass (bypass_decision / bypass_error) and the neuromodulation success cue were English-only regexes, so decision/error notes written in any other language never bypassed novelty gating and were silently rejected as duplicates whenever combined novelty fell under the threshold (issue #158 repro: combined 0.2909 < 0.4 for a Romanian decision note whose English translation bypassed via bypass_decision). Root cause: the detectors conflated "decision/error cue" with "English decision/error keyword". Fix extracts detection into core/content_cues.py with two layers: - Structural error markers, language-agnostic and case-sensitive (casing is the signal): CPython traceback header and frame lines (docs.python.org/3/library/traceback.html), JVM/Node stack frames (Throwable#printStackTrace javadoc; v8.dev/docs/stack-trace-api), CamelCase *Error/*Exception class names (PEP 8; Java naming convention), POSIX signal names (POSIX.1-2017 <signal.h>). These fire for any natural language, keywords or not. - Multilingual keyword sets, one entry per language with provenance comments: en (verbatim pre-#158 patterns, regression anchor); es/pt/ru/ja (the four languages Stack Overflow runs dedicated non-English sites for — developer-demand signal); de/fr (remaining top W3Techs web content languages); ro (the reporter's repro language). Recall-biased by design: a false bypass costs one extra stored memory that try_curation merges/links afterwards (existing gate contract); a false negative silently drops a decision as a "duplicate" — the reported failure. force=true and important/critical tags remain the universal language-independent fallback and stay excluded from the calibration EMA (remember_helpers is unchanged; no new bypass reasons). Tests: new tests_py/core/test_content_cues.py (exact Romanian repro, 7 non-English languages across the three detectors, pre-#158 English keyword anchors, structural-marker-only path, case-sensitivity guard) plus determine_bypass / apply_neuromodulation integration cases. tests_py/core: 2785 passed, 9 skipped; targeted handler suites (write_class, remember, gate wiring): 55 passed. Fixes #158 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #158.
The bypass detectors in
determine_bypassand the neuromodulation success cue treated "decision/error cue" as "English keyword", so detection now lives in a newcore/content_cues.pymodule (stdlib-only, pure logic).File "...", line Nframes, JVM/Node stack frames, CamelCase*Error/*Exceptionclass names, POSIX signal names — these fire in any prose language because runtimes emit them in fixed ASCII form. Each pattern cited to its spec (CPython docs, Throwable javadoc, V8 stack-trace API, PEP 8/Java naming, POSIX.1-2017).\w*suffixes for inflection; the two known cross-language collisions are documented inline.try_curationmerges afterwards; a false negative silently drops a decision — exactly the reported failure.is_decision_content("Am decis sa alegem optiunea A")→ True,determine_bypass→(True, "bypass_decision"). Structural-only case with zero keywords in any language also bypasses (Finnish prose + Java frame).force=true/important/criticaltags remain the universal fallback and stay excluded from the calibration EMA (remember_helpers.pyuntouched — no new bypass reasons).docs/data-flow.mddocuments the exact coverage.Test plan
tests_py/core: 2785 passed, 9 skipped (41 new detector tests + 4 integration)ruff check+ruff format --checkclean; 36-case multilingual smoke matrix: 0 failures🤖 Generated with Claude Code