Skip to content

fix(write-gate): make decision/error/success bypass cues language-aware - #161

Merged
cdeust merged 1 commit into
mainfrom
fix/issue-158-multilingual-bypass
Jul 22, 2026
Merged

fix(write-gate): make decision/error/success bypass cues language-aware#161
cdeust merged 1 commit into
mainfrom
fix/issue-158-multilingual-bypass

Conversation

@cdeust

@cdeust cdeust commented Jul 22, 2026

Copy link
Copy Markdown
Owner

Fixes #158.

The bypass detectors in determine_bypass and the neuromodulation success cue treated "decision/error cue" as "English keyword", so detection now lives in a new core/content_cues.py module (stdlib-only, pure logic).

  • Structural runtime markers first, language-agnostic: CPython traceback header + File "...", line N frames, JVM/Node stack frames, CamelCase *Error/*Exception class 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).
  • Multilingual keyword sets with per-language provenance: en (pre-Write-gate bypass heuristics (decision/error/success) are English-only — non-English content never bypasses #158 patterns preserved verbatim as regression anchors) + es/pt/ru/ja (the four non-English languages Stack Overflow runs dedicated sites for — the best available developer-demand signal) + de/fr (top W3Techs web-content languages) + ro (the reporter's repro language). Stems use \w* suffixes for inflection; the two known cross-language collisions are documented inline.
  • Deliberately recall-biased: a false bypass costs one extra memory that try_curation merges afterwards; a false negative silently drops a decision — exactly the reported failure.
  • The issue's repro now passes: 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/critical tags remain the universal fallback and stay excluded from the calibration EMA (remember_helpers.py untouched — no new bypass reasons). docs/data-flow.md documents the exact coverage.

Test plan

  • tests_py/core: 2785 passed, 9 skipped (41 new detector tests + 4 integration)
  • Targeted handler suites (write_class, remember, novelty, gate wiring): 55 passed
  • ruff check + ruff format --check clean; 36-case multilingual smoke matrix: 0 failures
  • CI green

🤖 Generated with Claude Code

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>
@cdeust
cdeust merged commit 40ffdfc into main Jul 22, 2026
14 checks passed
@cdeust
cdeust deleted the fix/issue-158-multilingual-bypass branch July 22, 2026 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Write-gate bypass heuristics (decision/error/success) are English-only — non-English content never bypasses

1 participant